@tanstack/react-query
Advanced tools
| module.exports = ({ root, jscodeshift }) => { | ||
| const findImportIdentifierOf = (importSpecifiers, identifier) => { | ||
| const specifier = importSpecifiers | ||
| .filter((node) => node.value.imported.name === identifier) | ||
| .paths() | ||
| if (specifier.length > 0) { | ||
| return specifier[0].value.local | ||
| } | ||
| return jscodeshift.identifier(identifier) | ||
| } | ||
| const findImportSpecifiers = (packageName) => | ||
| root | ||
| .find(jscodeshift.ImportDeclaration, { | ||
| source: { | ||
| value: packageName, | ||
| }, | ||
| }) | ||
| .find(jscodeshift.ImportSpecifier, {}) | ||
| const locateImports = ( | ||
| identifiers, | ||
| packageName = '@tanstack/react-query', | ||
| ) => { | ||
| const findNamespaceImportIdentifier = () => { | ||
| const specifier = root | ||
| .find(jscodeshift.ImportDeclaration, { | ||
| source: { | ||
| value: packageName, | ||
| }, | ||
| }) | ||
| .find(jscodeshift.ImportNamespaceSpecifier) | ||
| .paths() | ||
| return specifier.length > 0 ? specifier[0].value.local : null | ||
| } | ||
| /** | ||
| * First, we search for the namespace import identifier because if we have any, we assume the consumer uses | ||
| * namespace imports. In this case, we won't search for named imports at all. | ||
| */ | ||
| const namespaceImportIdentifier = findNamespaceImportIdentifier() | ||
| if (namespaceImportIdentifier) { | ||
| const identifierMap = {} | ||
| for (const identifier of identifiers) { | ||
| identifierMap[identifier] = jscodeshift.identifier(identifier) | ||
| } | ||
| return { | ||
| namespace: namespaceImportIdentifier, | ||
| ...identifierMap, | ||
| } | ||
| } | ||
| const importSpecifiers = findImportSpecifiers(packageName) | ||
| const identifierMap = {} | ||
| for (const identifier of identifiers) { | ||
| identifierMap[identifier] = findImportIdentifierOf( | ||
| importSpecifiers, | ||
| identifier, | ||
| ) | ||
| } | ||
| return { | ||
| namespace: null, | ||
| ...identifierMap, | ||
| } | ||
| } | ||
| const findAllMethodCalls = () => | ||
| root | ||
| // First, we need to find all method calls. | ||
| .find(jscodeshift.CallExpression, { | ||
| callee: { | ||
| type: jscodeshift.MemberExpression.name, | ||
| property: { | ||
| type: jscodeshift.Identifier.name, | ||
| }, | ||
| }, | ||
| }) | ||
| const findQueryClientIdentifiers = (importIdentifiers) => | ||
| root | ||
| .find(jscodeshift.VariableDeclarator, {}) | ||
| .filter((node) => { | ||
| if (node.value.init) { | ||
| const initializer = node.value.init | ||
| return ( | ||
| isClassInstantiationOf( | ||
| initializer, | ||
| getSelectorByImports(importIdentifiers, 'QueryClient'), | ||
| ) || | ||
| isFunctionCallOf( | ||
| initializer, | ||
| getSelectorByImports(importIdentifiers, 'useQueryClient'), | ||
| ) | ||
| ) | ||
| } | ||
| return false | ||
| }) | ||
| .paths() | ||
| .map((node) => node.value.id.name) | ||
| const isCallExpression = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.CallExpression.name }) | ||
| const isIdentifier = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.Identifier.name }) | ||
| const isMemberExpression = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.MemberExpression.name }) | ||
| const isNewExpression = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.NewExpression.name }) | ||
| const isArrayExpression = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.ArrayExpression.name }) | ||
| const isObjectExpression = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.ObjectExpression.name }) | ||
| const isObjectProperty = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.ObjectProperty.name }) | ||
| const isSpreadElement = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.SpreadElement.name }) | ||
| /** | ||
| * @param {import('jscodeshift').Node} node | ||
| * @returns {boolean} | ||
| */ | ||
| const isFunctionDefinition = (node) => { | ||
| const isArrowFunctionExpression = jscodeshift.match(node, { | ||
| type: jscodeshift.ArrowFunctionExpression.name, | ||
| }) | ||
| const isFunctionExpression = jscodeshift.match(node, { | ||
| type: jscodeshift.FunctionExpression.name, | ||
| }) | ||
| return isArrowFunctionExpression || isFunctionExpression | ||
| } | ||
| const warn = (message) => { | ||
| if (process.env.NODE_ENV !== 'test') { | ||
| console.warn(message) | ||
| } | ||
| } | ||
| const isClassInstantiationOf = (node, selector) => { | ||
| if (!isNewExpression(node)) { | ||
| return false | ||
| } | ||
| const parts = selector.split('.') | ||
| return parts.length === 1 | ||
| ? isIdentifier(node.callee) && node.callee.name === parts[0] | ||
| : isMemberExpression(node.callee) && | ||
| node.callee.object.name === parts[0] && | ||
| node.callee.property.name === parts[1] | ||
| } | ||
| const isFunctionCallOf = (node, selector) => { | ||
| if (!isCallExpression(node)) { | ||
| return false | ||
| } | ||
| const parts = selector.split('.') | ||
| return parts.length === 1 | ||
| ? isIdentifier(node.callee) && node.callee.name === parts[0] | ||
| : isMemberExpression(node.callee) && | ||
| node.callee.object.name === parts[0] && | ||
| node.callee.property.name === parts[1] | ||
| } | ||
| const getSelectorByImports = (imports, path) => | ||
| imports.namespace | ||
| ? `${imports.namespace.name}.${imports[path].name}` | ||
| : imports[path].name | ||
| return { | ||
| findAllMethodCalls, | ||
| getSelectorByImports, | ||
| isCallExpression, | ||
| isClassInstantiationOf, | ||
| isFunctionCallOf, | ||
| isIdentifier, | ||
| isMemberExpression, | ||
| isArrayExpression, | ||
| isObjectExpression, | ||
| isObjectProperty, | ||
| isSpreadElement, | ||
| isFunctionDefinition, | ||
| locateImports, | ||
| warn, | ||
| queryClient: { | ||
| findQueryClientIdentifiers, | ||
| }, | ||
| } | ||
| } |
| module.exports = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName = '@tanstack/react-query', | ||
| }) => { | ||
| const isGetQueryCacheMethodCall = ( | ||
| initializer, | ||
| importIdentifiers, | ||
| knownQueryClientIds, | ||
| ) => { | ||
| const isKnownQueryClient = (node) => | ||
| utils.isIdentifier(node) && knownQueryClientIds.includes(node.name) | ||
| const isGetQueryCacheIdentifier = (node) => | ||
| utils.isIdentifier(node) && node.name === 'getQueryCache' | ||
| const isValidInitializer = (node) => | ||
| utils.isCallExpression(node) && utils.isMemberExpression(node.callee) | ||
| if (isValidInitializer(initializer)) { | ||
| const instance = initializer.callee.object | ||
| return ( | ||
| isGetQueryCacheIdentifier(initializer.callee.property) && | ||
| (isKnownQueryClient(instance) || | ||
| utils.isFunctionCallOf( | ||
| instance, | ||
| utils.getSelectorByImports(importIdentifiers, 'useQueryClient'), | ||
| )) | ||
| ) | ||
| } | ||
| return false | ||
| } | ||
| const findQueryCacheInstantiations = ( | ||
| importIdentifiers, | ||
| knownQueryClientIds, | ||
| ) => | ||
| root.find(jscodeshift.VariableDeclarator, {}).filter((node) => { | ||
| if (node.value.init) { | ||
| const initializer = node.value.init | ||
| return ( | ||
| utils.isClassInstantiationOf( | ||
| initializer, | ||
| utils.getSelectorByImports(importIdentifiers, 'QueryCache'), | ||
| ) || | ||
| isGetQueryCacheMethodCall( | ||
| initializer, | ||
| importIdentifiers, | ||
| knownQueryClientIds, | ||
| ) | ||
| ) | ||
| } | ||
| return false | ||
| }) | ||
| const filterQueryCacheMethodCalls = (node) => | ||
| utils.isIdentifier(node) && ['find', 'findAll'].includes(node.name) | ||
| const findQueryCacheMethodCalls = (importIdentifiers) => { | ||
| /** | ||
| * Here we collect all query client instantiations. We have to make aware of them because the query cache can be | ||
| * accessed by the query client as well. | ||
| */ | ||
| const queryClientIdentifiers = | ||
| utils.queryClient.findQueryClientIdentifiers(importIdentifiers) | ||
| /** | ||
| * Here we collect all query cache instantiations. The reason is simple: the methods can be called on query cache | ||
| * instances, to locate the possible usages we need to be aware of the identifier names. | ||
| */ | ||
| const queryCacheIdentifiers = findQueryCacheInstantiations( | ||
| importIdentifiers, | ||
| queryClientIdentifiers, | ||
| ) | ||
| .paths() | ||
| .map((node) => node.value.id.name) | ||
| return ( | ||
| utils | ||
| // First, we need to find all method calls. | ||
| .findAllMethodCalls() | ||
| // Then we narrow the collection to all `fetch` and `fetchAll` methods. | ||
| .filter((node) => | ||
| filterQueryCacheMethodCalls(node.value.callee.property), | ||
| ) | ||
| .filter((node) => { | ||
| const object = node.value.callee.object | ||
| // If the method is called on a `QueryCache` instance, we keep it in the collection. | ||
| if (utils.isIdentifier(object)) { | ||
| return queryCacheIdentifiers.includes(object.name) | ||
| } | ||
| // If the method is called on a `QueryClient` instance, we keep it in the collection. | ||
| if (utils.isCallExpression(object)) { | ||
| return isGetQueryCacheMethodCall( | ||
| object, | ||
| importIdentifiers, | ||
| queryClientIdentifiers, | ||
| ) | ||
| } | ||
| return false | ||
| }) | ||
| ) | ||
| } | ||
| const execute = (replacer) => { | ||
| findQueryCacheMethodCalls( | ||
| utils.locateImports( | ||
| ['QueryCache', 'QueryClient', 'useQueryClient'], | ||
| packageName, | ||
| ), | ||
| ).replaceWith(replacer) | ||
| } | ||
| return { | ||
| execute, | ||
| } | ||
| } |
| module.exports = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName = '@tanstack/react-query', | ||
| }) => { | ||
| const filterQueryClientMethodCalls = (node, methods) => | ||
| utils.isIdentifier(node) && methods.includes(node.name) | ||
| const findQueryClientMethodCalls = (importIdentifiers, methods) => { | ||
| /** | ||
| * Here we collect all query client instantiations. We have to make aware of them because some method calls might | ||
| * be invoked on these instances. | ||
| */ | ||
| const queryClientIdentifiers = | ||
| utils.queryClient.findQueryClientIdentifiers(importIdentifiers) | ||
| return ( | ||
| utils | ||
| // First, we need to find all method calls. | ||
| .findAllMethodCalls() | ||
| // Then we narrow the collection to `QueryClient` methods. | ||
| .filter((node) => | ||
| filterQueryClientMethodCalls(node.value.callee.property, methods), | ||
| ) | ||
| .filter((node) => { | ||
| const object = node.value.callee.object | ||
| // If the method is called on a `QueryClient` instance, we keep it in the collection. | ||
| if (utils.isIdentifier(object)) { | ||
| return queryClientIdentifiers.includes(object.name) | ||
| } | ||
| // If the method is called on the return value of `useQueryClient` hook, we keep it in the collection. | ||
| return utils.isFunctionCallOf( | ||
| object, | ||
| utils.getSelectorByImports(importIdentifiers, 'useQueryClient'), | ||
| ) | ||
| }) | ||
| ) | ||
| } | ||
| const execute = (methods, replacer) => { | ||
| findQueryClientMethodCalls( | ||
| utils.locateImports(['QueryClient', 'useQueryClient'], packageName), | ||
| methods, | ||
| ).replaceWith(replacer) | ||
| } | ||
| return { | ||
| execute, | ||
| } | ||
| } |
| module.exports = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName = '@tanstack/react-query', | ||
| }) => { | ||
| const filterUseQueryLikeHookCalls = (node, importIdentifiers, hooks) => { | ||
| for (const hook of hooks) { | ||
| const selector = utils.getSelectorByImports(importIdentifiers, hook) | ||
| if (utils.isFunctionCallOf(node, selector)) { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
| const findUseQueryLikeHookCalls = (importIdentifiers, hooks) => | ||
| root | ||
| // First, we need to find all call expressions. | ||
| .find(jscodeshift.CallExpression, {}) | ||
| // Then we narrow the collection to the `useQuery` like hook calls. | ||
| .filter((node) => | ||
| filterUseQueryLikeHookCalls(node.value, importIdentifiers, hooks), | ||
| ) | ||
| const execute = (hooks, replacer) => { | ||
| findUseQueryLikeHookCalls( | ||
| utils.locateImports(hooks, packageName), | ||
| hooks, | ||
| ).replaceWith(replacer) | ||
| } | ||
| return { | ||
| execute, | ||
| } | ||
| } |
| const createUtilsObject = require('../utils/index.cjs') | ||
| const createKeyReplacer = require('./utils/replacers/key-replacer.cjs') | ||
| const createUseQueryLikeTransformer = require('../utils/transformers/use-query-like-transformer.cjs') | ||
| const createQueryClientTransformer = require('../utils/transformers/query-client-transformer.cjs') | ||
| const createQueryCacheTransformer = require('../utils/transformers/query-cache-transformer.cjs') | ||
| const transformQueryClientUsages = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| filePath, | ||
| packageName, | ||
| }) => { | ||
| const transformer = createQueryClientTransformer({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName, | ||
| }) | ||
| const replacer = createKeyReplacer({ jscodeshift, root, filePath }) | ||
| transformer.execute( | ||
| [ | ||
| // Not object syntax-aware methods. | ||
| 'getMutationDefaults', | ||
| 'getQueriesData', | ||
| 'getQueryData', | ||
| 'getQueryDefaults', | ||
| 'getQueryState', | ||
| 'isFetching', | ||
| 'setMutationDefaults', | ||
| 'setQueriesData', | ||
| 'setQueryData', | ||
| 'setQueryDefaults', | ||
| // Object syntax-aware methods. | ||
| 'cancelQueries', | ||
| 'fetchInfiniteQuery', | ||
| 'fetchQuery', | ||
| 'invalidateQueries', | ||
| 'prefetchInfiniteQuery', | ||
| 'prefetchQuery', | ||
| 'refetchQueries', | ||
| 'removeQueries', | ||
| 'resetQueries', | ||
| ], | ||
| replacer, | ||
| ) | ||
| } | ||
| const transformUseQueriesUsages = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName, | ||
| }) => { | ||
| const transformer = createUseQueryLikeTransformer({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName, | ||
| }) | ||
| const replacer = ({ node }) => { | ||
| /** | ||
| * When the node doesn't have the 'original' property, that means the codemod has been already applied, | ||
| * so we don't need to do any changes. | ||
| */ | ||
| if (!node.original) { | ||
| return node | ||
| } | ||
| const newCallExpression = jscodeshift.callExpression(node.original.callee, [ | ||
| jscodeshift.objectExpression([ | ||
| jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier('queries'), | ||
| node.original.arguments[0], | ||
| ), | ||
| ]), | ||
| ]) | ||
| // TODO: This should be part of one function! | ||
| if (node.typeParameters) { | ||
| newCallExpression.typeArguments = node.typeParameters | ||
| } | ||
| return newCallExpression | ||
| } | ||
| transformer.execute(['useQueries'], replacer) | ||
| } | ||
| const transformUseQueryLikeUsages = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| filePath, | ||
| packageName, | ||
| }) => { | ||
| const transformer = createUseQueryLikeTransformer({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName, | ||
| }) | ||
| transformer.execute( | ||
| ['useQuery', 'useInfiniteQuery', 'useIsFetching', 'useIsMutating'], | ||
| createKeyReplacer({ | ||
| jscodeshift, | ||
| root, | ||
| filePath, | ||
| keyName: 'queryKey', | ||
| }), | ||
| ) | ||
| transformer.execute( | ||
| ['useMutation'], | ||
| createKeyReplacer({ | ||
| jscodeshift, | ||
| root, | ||
| filePath, | ||
| keyName: 'mutationKey', | ||
| }), | ||
| ) | ||
| } | ||
| const transformQueryCacheUsages = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| filePath, | ||
| packageName, | ||
| }) => { | ||
| const transformer = createQueryCacheTransformer({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName, | ||
| }) | ||
| const replacer = createKeyReplacer({ jscodeshift, root, filePath }) | ||
| transformer.execute(replacer) | ||
| } | ||
| module.exports = (file, api) => { | ||
| const jscodeshift = api.jscodeshift | ||
| const root = jscodeshift(file.source) | ||
| // TODO: Execute the transformers only when it contains a `react-query` import! | ||
| const utils = createUtilsObject({ root, jscodeshift }) | ||
| const filePath = file.path | ||
| const packageName = 'react-query' | ||
| // This function transforms usages like `useQuery` and `useMutation`. | ||
| transformUseQueryLikeUsages({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| filePath, | ||
| packageName, | ||
| }) | ||
| // This function transforms usages of `useQueries`. | ||
| transformUseQueriesUsages({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| packageName, | ||
| }) | ||
| // This function transforms usages of `QueryClient`. | ||
| transformQueryClientUsages({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| filePath, | ||
| packageName, | ||
| }) | ||
| // This function transforms usages of `QueryCache`. | ||
| transformQueryCacheUsages({ jscodeshift, utils, root, filePath, packageName }) | ||
| return root.toSource({ quote: 'single', lineTerminator: '\n' }) | ||
| } |
| module.exports = (file, api) => { | ||
| const jscodeshift = api.jscodeshift | ||
| const root = jscodeshift(file.source) | ||
| const replacements = [ | ||
| { from: 'react-query', to: '@tanstack/react-query' }, | ||
| { from: 'react-query/devtools', to: '@tanstack/react-query-devtools' }, | ||
| ] | ||
| replacements.forEach(({ from, to }) => { | ||
| root | ||
| .find(jscodeshift.ImportDeclaration, { | ||
| source: { | ||
| value: from, | ||
| }, | ||
| }) | ||
| .replaceWith(({ node }) => { | ||
| node.source.value = to | ||
| return node | ||
| }) | ||
| }) | ||
| return root.toSource({ quote: 'single', lineTerminator: '\n' }) | ||
| } |
| class UnprocessableKeyError extends Error { | ||
| constructor(message) { | ||
| super(message) | ||
| this.name = 'UnprocessableKeyError' | ||
| } | ||
| } | ||
| module.exports = ({ jscodeshift, root, filePath, keyName = 'queryKey' }) => { | ||
| const isArrayExpression = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.ArrayExpression.name }) | ||
| const isStringLiteral = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.StringLiteral.name }) || | ||
| jscodeshift.match(node, { type: jscodeshift.Literal.name }) | ||
| const isTemplateLiteral = (node) => | ||
| jscodeshift.match(node, { type: jscodeshift.TemplateLiteral.name }) | ||
| const findVariableDeclaration = (node) => { | ||
| const declarations = root | ||
| .find(jscodeshift.VariableDeclarator, { | ||
| id: { | ||
| type: jscodeshift.Identifier.name, | ||
| name: node.name, | ||
| }, | ||
| }) | ||
| .paths() | ||
| return declarations.length > 0 ? declarations[0] : null | ||
| } | ||
| const createKeyValue = (node) => { | ||
| // When the node is a string literal we convert it into an array of strings. | ||
| if (isStringLiteral(node)) { | ||
| return jscodeshift.arrayExpression([ | ||
| jscodeshift.stringLiteral(node.value), | ||
| ]) | ||
| } | ||
| // When the node is a template literal we convert it into an array of template literals. | ||
| if (isTemplateLiteral(node)) { | ||
| return jscodeshift.arrayExpression([ | ||
| jscodeshift.templateLiteral(node.quasis, node.expressions), | ||
| ]) | ||
| } | ||
| if (jscodeshift.match(node, { type: jscodeshift.Identifier.name })) { | ||
| // When the node is an identifier at first, we try to find its declaration, because we will try | ||
| // to guess its type. | ||
| const variableDeclaration = findVariableDeclaration(node) | ||
| if (!variableDeclaration) { | ||
| throw new UnprocessableKeyError( | ||
| `In file ${filePath} at line ${node.loc.start.line} the type of identifier \`${node.name}\` couldn't be recognized, so the codemod couldn't be applied. Please migrate manually.`, | ||
| ) | ||
| } | ||
| const initializer = variableDeclaration.value.init | ||
| // When it's a string, we just wrap it into an array expression. | ||
| if (isStringLiteral(initializer) || isTemplateLiteral(initializer)) { | ||
| return jscodeshift.arrayExpression([node]) | ||
| } | ||
| } | ||
| throw new UnprocessableKeyError( | ||
| `In file ${filePath} at line ${node.loc.start.line} the type of the \`${keyName}\` couldn't be recognized, so the codemod couldn't be applied. Please migrate manually.`, | ||
| ) | ||
| } | ||
| const createKeyProperty = (node) => | ||
| jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier(keyName), | ||
| createKeyValue(node), | ||
| ) | ||
| const getPropertyFromObjectExpression = (objectExpression, propertyName) => | ||
| objectExpression.properties.find( | ||
| (property) => property.key.name === propertyName, | ||
| ) ?? null | ||
| const buildWithTypeArguments = (node, builder) => { | ||
| const newNode = builder(node) | ||
| if (node.typeParameters) { | ||
| newNode.typeArguments = node.typeParameters | ||
| } | ||
| return newNode | ||
| } | ||
| return ({ node }) => { | ||
| // When the node doesn't have the 'original' property, that means the codemod has been already applied, | ||
| // so we don't need to do any changes. | ||
| if (!node.original) { | ||
| return node | ||
| } | ||
| const methodArguments = node.arguments | ||
| // The method call doesn't have any arguments, we have nothing to do in this case. | ||
| if (methodArguments.length === 0) { | ||
| return node | ||
| } | ||
| try { | ||
| const [firstArgument, ...restOfTheArguments] = methodArguments | ||
| if ( | ||
| jscodeshift.match(firstArgument, { | ||
| type: jscodeshift.ObjectExpression.name, | ||
| }) | ||
| ) { | ||
| const originalKey = getPropertyFromObjectExpression( | ||
| firstArgument, | ||
| keyName, | ||
| ) | ||
| if (!originalKey) { | ||
| throw new UnprocessableKeyError( | ||
| `In file ${filePath} at line ${node.loc.start.line} the \`${keyName}\` couldn't be found. Did you forget to add it?`, | ||
| ) | ||
| } | ||
| const restOfTheProperties = firstArgument.properties.filter( | ||
| (item) => item.key.name !== keyName, | ||
| ) | ||
| return buildWithTypeArguments(node, (originalNode) => | ||
| jscodeshift.callExpression(originalNode.original.callee, [ | ||
| jscodeshift.objectExpression([ | ||
| createKeyProperty(originalKey.value), | ||
| ...restOfTheProperties, | ||
| ]), | ||
| ...restOfTheArguments, | ||
| ]), | ||
| ) | ||
| } | ||
| // When the node is an array expression we just simply return it because we want query keys to be arrays. | ||
| if (isArrayExpression(firstArgument)) { | ||
| return node | ||
| } | ||
| return buildWithTypeArguments(node, (originalNode) => | ||
| jscodeshift.callExpression(originalNode.original.callee, [ | ||
| createKeyValue(firstArgument), | ||
| ...restOfTheArguments, | ||
| ]), | ||
| ) | ||
| } catch (error) { | ||
| if (error.name === 'UnprocessableKeyError') { | ||
| if (process.env.NODE_ENV !== 'test') { | ||
| console.warn(error.message) | ||
| } | ||
| return node | ||
| } | ||
| throw error | ||
| } | ||
| } | ||
| } |
| const createUtilsObject = require('../../utils/index.cjs') | ||
| const createUseQueryLikeTransformer = require('../../utils/transformers/use-query-like-transformer.cjs') | ||
| const createQueryClientTransformer = require('../../utils/transformers/query-client-transformer.cjs') | ||
| const originalName = 'isLoading' | ||
| const newName = 'isPending' | ||
| /** | ||
| * @param {import('jscodeshift')} jscodeshift | ||
| * @param {Object} utils | ||
| * @param {import('jscodeshift').Collection} root | ||
| * @param {string} filePath | ||
| * @param {{keyName: "mutationKey"|"queryKey", queryClientMethods: ReadonlyArray<string>, hooks: ReadonlyArray<string>}} config | ||
| */ | ||
| const transformUsages = ({ jscodeshift, utils, root, filePath, config }) => { | ||
| /** | ||
| * @param {import('jscodeshift').CallExpression | import('jscodeshift').ExpressionStatement} node | ||
| * @returns {{start: number, end: number}} | ||
| */ | ||
| const getNodeLocation = (node) => { | ||
| const location = utils.isCallExpression(node) ? node.callee.loc : node.loc | ||
| const start = location.start.line | ||
| const end = location.end.line | ||
| return { start, end } | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ASTNode} node | ||
| * @returns {boolean} | ||
| */ | ||
| const isObjectExpression = (node) => { | ||
| return jscodeshift.match(node, { | ||
| type: jscodeshift.ObjectExpression.name, | ||
| }) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ASTNode} node | ||
| * @returns {boolean} | ||
| */ | ||
| const isObjectPattern = (node) => { | ||
| return jscodeshift.match(node, { | ||
| type: jscodeshift.ObjectPattern.name, | ||
| }) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ASTNode} node | ||
| * @returns {boolean} | ||
| */ | ||
| const isVariableDeclarator = (node) => { | ||
| return jscodeshift.match(node, { | ||
| type: jscodeshift.VariableDeclarator.name, | ||
| }) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').Node} node | ||
| * @param {import('jscodeshift').Identifier} identifier | ||
| * @returns {Collection<import('jscodeshift').MemberExpression>} | ||
| */ | ||
| const findIsLoadingPropertiesOfIdentifier = (node, identifier) => { | ||
| return jscodeshift(node).find(jscodeshift.MemberExpression, { | ||
| object: { | ||
| type: jscodeshift.Identifier.name, | ||
| name: identifier.name, | ||
| }, | ||
| property: { | ||
| type: jscodeshift.Identifier.name, | ||
| name: originalName, | ||
| }, | ||
| }) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ObjectPattern} node | ||
| * @returns {import('jscodeshift').ObjectProperty|null} | ||
| */ | ||
| const findIsLoadingObjectPropertyInObjectPattern = (node) => { | ||
| return ( | ||
| node.properties.find((property) => | ||
| jscodeshift.match(property, { | ||
| key: { | ||
| type: jscodeshift.Identifier.name, | ||
| name: originalName, | ||
| }, | ||
| }), | ||
| ) ?? null | ||
| ) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ObjectPattern} node | ||
| * @returns {import('jscodeshift').RestElement|null} | ||
| */ | ||
| const findRestElementInObjectPattern = (node) => { | ||
| return ( | ||
| node.properties.find((property) => | ||
| jscodeshift.match(property, { | ||
| type: jscodeshift.RestElement.name, | ||
| }), | ||
| ) ?? null | ||
| ) | ||
| } | ||
| const replacer = (path, transformNode) => { | ||
| const node = path.node | ||
| const parentNode = path.parentPath.value | ||
| const { start, end } = getNodeLocation(node) | ||
| try { | ||
| if (!isVariableDeclarator(parentNode)) { | ||
| // The parent node is not a variable declarator, the transformation will be skipped. | ||
| return node | ||
| } | ||
| const lookupNode = path.scope.node | ||
| const variableDeclaratorId = parentNode.id | ||
| if (isObjectPattern(variableDeclaratorId)) { | ||
| const isLoadingObjectProperty = | ||
| findIsLoadingObjectPropertyInObjectPattern(variableDeclaratorId) | ||
| if (isLoadingObjectProperty) { | ||
| jscodeshift(lookupNode) | ||
| .find(jscodeshift.ObjectProperty, { | ||
| key: { | ||
| type: jscodeshift.Identifier.name, | ||
| name: originalName, | ||
| }, | ||
| }) | ||
| .replaceWith((mutablePath) => { | ||
| if (isObjectPattern(mutablePath.parent)) { | ||
| const affectedProperty = mutablePath.value.value.shorthand | ||
| ? 'value' | ||
| : 'key' | ||
| mutablePath.value[affectedProperty].name = newName | ||
| return mutablePath.value | ||
| } | ||
| if (isObjectExpression(mutablePath.parent)) { | ||
| const affectedProperty = mutablePath.value.value.shorthand | ||
| ? 'key' | ||
| : 'value' | ||
| mutablePath.value[affectedProperty].name = newName | ||
| return mutablePath.value | ||
| } | ||
| return mutablePath.value | ||
| }) | ||
| // Renaming all other 'isLoading' references that are object properties. | ||
| jscodeshift(lookupNode) | ||
| .find(jscodeshift.Identifier, { name: originalName }) | ||
| .replaceWith((mutablePath) => { | ||
| if ( | ||
| !jscodeshift.match(mutablePath.parent, { | ||
| type: jscodeshift.ObjectProperty.name, | ||
| }) | ||
| ) { | ||
| mutablePath.value.name = newName | ||
| } | ||
| return mutablePath.value | ||
| }) | ||
| } | ||
| const restElement = findRestElementInObjectPattern(variableDeclaratorId) | ||
| if (restElement) { | ||
| findIsLoadingPropertiesOfIdentifier( | ||
| lookupNode, | ||
| restElement.argument, | ||
| ).replaceWith(({ node: mutableNode }) => { | ||
| mutableNode.property.name = newName | ||
| return mutableNode | ||
| }) | ||
| } | ||
| return node | ||
| } | ||
| if (utils.isIdentifier(variableDeclaratorId)) { | ||
| findIsLoadingPropertiesOfIdentifier( | ||
| lookupNode, | ||
| variableDeclaratorId, | ||
| ).replaceWith(({ node: mutableNode }) => { | ||
| mutableNode.property.name = newName | ||
| return mutableNode | ||
| }) | ||
| return node | ||
| } | ||
| utils.warn( | ||
| `The usage in file "${filePath}" at line ${start}:${end} could not be transformed. Please migrate this usage manually.`, | ||
| ) | ||
| return node | ||
| } catch (error) { | ||
| utils.warn( | ||
| `An unknown error occurred while processing the "${filePath}" file. Please review this file, because the codemod couldn't be applied.`, | ||
| ) | ||
| return node | ||
| } | ||
| } | ||
| createUseQueryLikeTransformer({ jscodeshift, utils, root }).execute( | ||
| config.hooks, | ||
| replacer, | ||
| ) | ||
| createQueryClientTransformer({ jscodeshift, utils, root }).execute( | ||
| config.queryClientMethods, | ||
| replacer, | ||
| ) | ||
| } | ||
| module.exports = (file, api) => { | ||
| const jscodeshift = api.jscodeshift | ||
| const root = jscodeshift(file.source) | ||
| const utils = createUtilsObject({ root, jscodeshift }) | ||
| const filePath = file.path | ||
| const dependencies = { jscodeshift, utils, root, filePath } | ||
| transformUsages({ | ||
| ...dependencies, | ||
| config: { | ||
| hooks: ['useQuery', 'useMutation'], | ||
| queryClientMethods: [], | ||
| }, | ||
| }) | ||
| return root.toSource({ quote: 'single', lineTerminator: '\n' }) | ||
| } |
| const createUtilsObject = require('../../utils/index.cjs') | ||
| const createUseQueryLikeTransformer = require('../../utils/transformers/use-query-like-transformer.cjs') | ||
| const createQueryClientTransformer = require('../../utils/transformers/query-client-transformer.cjs') | ||
| const AlreadyHasPlaceholderDataProperty = require('./utils/already-has-placeholder-data-property.cjs') | ||
| /** | ||
| * @param {import('jscodeshift')} jscodeshift | ||
| * @param {Object} utils | ||
| * @param {import('jscodeshift').Collection} root | ||
| * @param {string} filePath | ||
| * @param {{keyName: "mutationKey"|"queryKey", queryClientMethods: ReadonlyArray<string>, hooks: ReadonlyArray<string>}} config | ||
| */ | ||
| const transformUsages = ({ jscodeshift, utils, root, filePath, config }) => { | ||
| /** | ||
| * @param {import('jscodeshift').CallExpression | import('jscodeshift').ExpressionStatement} node | ||
| * @returns {{start: number, end: number}} | ||
| */ | ||
| const getNodeLocation = (node) => { | ||
| const location = utils.isCallExpression(node) ? node.callee.loc : node.loc | ||
| const start = location.start.line | ||
| const end = location.end.line | ||
| return { start, end } | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ObjectProperty} objectProperty | ||
| * @returns {boolean} | ||
| */ | ||
| const isKeepPreviousDataObjectProperty = (objectProperty) => { | ||
| return jscodeshift.match(objectProperty.key, { | ||
| type: jscodeshift.Identifier.name, | ||
| name: 'keepPreviousData', | ||
| }) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ObjectProperty} objectProperty | ||
| * @returns {boolean} | ||
| */ | ||
| const isObjectPropertyHasTrueBooleanLiteralValue = (objectProperty) => { | ||
| return jscodeshift.match(objectProperty.value, { | ||
| type: jscodeshift.BooleanLiteral.name, | ||
| value: true, | ||
| }) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ObjectExpression} objectExpression | ||
| * @returns {Array<import('jscodeshift').ObjectProperty>} | ||
| */ | ||
| const filterKeepPreviousDataProperty = (objectExpression) => { | ||
| return objectExpression.properties.filter((objectProperty) => { | ||
| return !isKeepPreviousDataObjectProperty(objectProperty) | ||
| }) | ||
| } | ||
| const createPlaceholderDataObjectProperty = () => { | ||
| return jscodeshift.objectProperty( | ||
| jscodeshift.identifier('placeholderData'), | ||
| jscodeshift.identifier('keepPreviousData'), | ||
| ) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ObjectExpression} objectExpression | ||
| * @returns {boolean} | ||
| */ | ||
| const hasPlaceholderDataProperty = (objectExpression) => { | ||
| return ( | ||
| objectExpression.properties.findIndex((objectProperty) => { | ||
| return jscodeshift.match(objectProperty.key, { | ||
| type: jscodeshift.Identifier.name, | ||
| name: 'placeholderData', | ||
| }) | ||
| }) !== -1 | ||
| ) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').ObjectExpression} objectExpression | ||
| * @returns {import('jscodeshift').ObjectProperty | undefined} | ||
| */ | ||
| const getKeepPreviousDataProperty = (objectExpression) => { | ||
| return objectExpression.properties.find(isKeepPreviousDataObjectProperty) | ||
| } | ||
| let shouldAddKeepPreviousDataImport = false | ||
| const replacer = (path, resolveTargetArgument, transformNode) => { | ||
| const node = path.node | ||
| const { start, end } = getNodeLocation(node) | ||
| try { | ||
| const targetArgument = resolveTargetArgument(node) | ||
| if (targetArgument && utils.isObjectExpression(targetArgument)) { | ||
| const isPlaceholderDataPropertyPresent = | ||
| hasPlaceholderDataProperty(targetArgument) | ||
| if (hasPlaceholderDataProperty(targetArgument)) { | ||
| throw new AlreadyHasPlaceholderDataProperty(node, filePath) | ||
| } | ||
| const keepPreviousDataProperty = | ||
| getKeepPreviousDataProperty(targetArgument) | ||
| const keepPreviousDataPropertyHasTrueValue = | ||
| isObjectPropertyHasTrueBooleanLiteralValue(keepPreviousDataProperty) | ||
| if (!keepPreviousDataPropertyHasTrueValue) { | ||
| utils.warn( | ||
| `The usage in file "${filePath}" at line ${start}:${end} already contains a "keepPreviousData" property but its value is not "true". Please migrate this usage manually.`, | ||
| ) | ||
| return node | ||
| } | ||
| if (keepPreviousDataPropertyHasTrueValue) { | ||
| // Removing the `keepPreviousData` property from the object. | ||
| const mutableObjectExpressionProperties = | ||
| filterKeepPreviousDataProperty(targetArgument) | ||
| if (!isPlaceholderDataPropertyPresent) { | ||
| shouldAddKeepPreviousDataImport = true | ||
| // When the `placeholderData` property is not present, the `placeholderData: keepPreviousData` property will be added. | ||
| mutableObjectExpressionProperties.push( | ||
| createPlaceholderDataObjectProperty(), | ||
| ) | ||
| } | ||
| return transformNode( | ||
| node, | ||
| jscodeshift.objectExpression(mutableObjectExpressionProperties), | ||
| ) | ||
| } | ||
| } | ||
| utils.warn( | ||
| `The usage in file "${filePath}" at line ${start}:${end} could not be transformed, because the first parameter is not an object expression. Please migrate this usage manually.`, | ||
| ) | ||
| return node | ||
| } catch (error) { | ||
| utils.warn( | ||
| error.name === AlreadyHasPlaceholderDataProperty.name | ||
| ? error.message | ||
| : `An unknown error occurred while processing the "${filePath}" file. Please review this file, because the codemod couldn't be applied.`, | ||
| ) | ||
| return node | ||
| } | ||
| } | ||
| createUseQueryLikeTransformer({ jscodeshift, utils, root }).execute( | ||
| config.hooks, | ||
| (path) => { | ||
| const resolveTargetArgument = (node) => node.arguments[0] ?? null | ||
| const transformNode = (node, transformedArgument) => | ||
| jscodeshift.callExpression(node.original.callee, [transformedArgument]) | ||
| return replacer(path, resolveTargetArgument, transformNode) | ||
| }, | ||
| ) | ||
| createQueryClientTransformer({ jscodeshift, utils, root }).execute( | ||
| config.queryClientMethods, | ||
| (path) => { | ||
| const resolveTargetArgument = (node) => node.arguments[1] ?? null | ||
| const transformNode = (node, transformedArgument) => { | ||
| return jscodeshift.callExpression(node.original.callee, [ | ||
| node.arguments[0], | ||
| transformedArgument, | ||
| ...node.arguments.slice(2, 0), | ||
| ]) | ||
| } | ||
| return replacer(path, resolveTargetArgument, transformNode) | ||
| }, | ||
| ) | ||
| const importIdentifierOfQueryClient = utils.getSelectorByImports( | ||
| utils.locateImports(['QueryClient']), | ||
| 'QueryClient', | ||
| ) | ||
| root | ||
| .find(jscodeshift.ExpressionStatement, { | ||
| expression: { | ||
| type: jscodeshift.NewExpression.name, | ||
| callee: { | ||
| type: jscodeshift.Identifier.name, | ||
| name: importIdentifierOfQueryClient, | ||
| }, | ||
| }, | ||
| }) | ||
| .filter((path) => path.node.expression) | ||
| .replaceWith((path) => { | ||
| const resolveTargetArgument = (node) => { | ||
| const paths = jscodeshift(node) | ||
| .find(jscodeshift.ObjectProperty, { | ||
| key: { | ||
| type: jscodeshift.Identifier.name, | ||
| name: 'keepPreviousData', | ||
| }, | ||
| }) | ||
| .paths() | ||
| return paths.length > 0 ? paths[0].parent.node : null | ||
| } | ||
| const transformNode = (node, transformedArgument) => { | ||
| jscodeshift(node.expression) | ||
| .find(jscodeshift.ObjectProperty, { | ||
| key: { | ||
| type: jscodeshift.Identifier.name, | ||
| name: 'queries', | ||
| }, | ||
| }) | ||
| .replaceWith(({ node: mutableNode }) => { | ||
| mutableNode.value.properties = transformedArgument.properties | ||
| return mutableNode | ||
| }) | ||
| return node | ||
| } | ||
| return replacer(path, resolveTargetArgument, transformNode) | ||
| }) | ||
| return { shouldAddKeepPreviousDataImport } | ||
| } | ||
| module.exports = (file, api) => { | ||
| const jscodeshift = api.jscodeshift | ||
| const root = jscodeshift(file.source) | ||
| const utils = createUtilsObject({ root, jscodeshift }) | ||
| const filePath = file.path | ||
| const dependencies = { jscodeshift, utils, root, filePath } | ||
| const { shouldAddKeepPreviousDataImport } = transformUsages({ | ||
| ...dependencies, | ||
| config: { | ||
| hooks: ['useInfiniteQuery', 'useQueries', 'useQuery'], | ||
| queryClientMethods: ['setQueryDefaults'], | ||
| }, | ||
| }) | ||
| if (shouldAddKeepPreviousDataImport) { | ||
| root | ||
| .find(jscodeshift.ImportDeclaration, { | ||
| source: { | ||
| value: '@tanstack/react-query', | ||
| }, | ||
| }) | ||
| .replaceWith(({ node: mutableNode }) => { | ||
| mutableNode.specifiers = [ | ||
| jscodeshift.importSpecifier( | ||
| jscodeshift.identifier('keepPreviousData'), | ||
| ), | ||
| ...mutableNode.specifiers, | ||
| ] | ||
| return mutableNode | ||
| }) | ||
| } | ||
| return root.toSource({ quote: 'single', lineTerminator: '\n' }) | ||
| } |
| ### Intro | ||
| The prerequisite for this code mod is to migrate your usages to the new syntax, so overloads for hooks and `QueryClient` methods shouldn't be available anymore. | ||
| ### Affected usages | ||
| Please note, this code mod transforms usages only where the first argument is an object expression. | ||
| The following usage should be transformed by the code mod: | ||
| ```ts | ||
| const { data } = useQuery({ | ||
| queryKey: ['posts'], | ||
| queryFn: queryFn, | ||
| keepPreviousData: true, | ||
| }) | ||
| ``` | ||
| But the following usage won't be transformed by the code mod, because the first argument an identifier: | ||
| ```ts | ||
| const hookArgument = { | ||
| queryKey: ['posts'], | ||
| queryFn: queryFn, | ||
| keepPreviousData: true, | ||
| } | ||
| const { data } = useQuery(hookArgument) | ||
| ``` | ||
| ### Troubleshooting | ||
| In case of any errors, feel free to reach us out via Discord or open an issue. If you open an issue, please provide a code snippet as well, because without a snippet we cannot find the bug in the code mod. |
| class AlreadyHasPlaceholderDataProperty extends Error { | ||
| /** | ||
| * @param {import('jscodeshift').CallExpression} callExpression | ||
| * @param {string} filePath | ||
| */ | ||
| constructor(callExpression, filePath) { | ||
| super('') | ||
| this.message = this.buildMessage(callExpression, filePath) | ||
| this.name = 'AlreadyHasPlaceholderDataProperty' | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').CallExpression} callExpression | ||
| * @param {string} filePath | ||
| * @returns {string} | ||
| */ | ||
| buildMessage(callExpression, filePath) { | ||
| const location = callExpression.callee.loc | ||
| const start = location.start.line | ||
| const end = location.end.line | ||
| return `The usage in file "${filePath}" at line ${start}:${end} already contains a "placeholderData" property. Please migrate this usage manually.` | ||
| } | ||
| } | ||
| module.exports = AlreadyHasPlaceholderDataProperty |
| const createUtilsObject = require('../../utils/index.cjs') | ||
| const transformFilterAwareUsages = require('./transformers/filter-aware-usage-transformer.cjs') | ||
| const transformQueryFnAwareUsages = require('./transformers/query-fn-aware-usage-transformer.cjs') | ||
| module.exports = (file, api) => { | ||
| const jscodeshift = api.jscodeshift | ||
| const root = jscodeshift(file.source) | ||
| const utils = createUtilsObject({ root, jscodeshift }) | ||
| const filePath = file.path | ||
| const dependencies = { jscodeshift, utils, root, filePath } | ||
| transformFilterAwareUsages({ | ||
| ...dependencies, | ||
| config: { | ||
| keyName: 'queryKey', | ||
| fnName: 'queryFn', | ||
| queryClientMethods: [ | ||
| 'cancelQueries', | ||
| 'getQueriesData', | ||
| 'invalidateQueries', | ||
| 'isFetching', | ||
| 'refetchQueries', | ||
| 'removeQueries', | ||
| 'resetQueries', | ||
| // 'setQueriesData', | ||
| ], | ||
| hooks: ['useIsFetching', 'useQuery'], | ||
| }, | ||
| }) | ||
| transformFilterAwareUsages({ | ||
| ...dependencies, | ||
| config: { | ||
| keyName: 'mutationKey', | ||
| fnName: 'mutationFn', | ||
| queryClientMethods: [], | ||
| hooks: ['useIsMutating', 'useMutation'], | ||
| }, | ||
| }) | ||
| transformQueryFnAwareUsages({ | ||
| ...dependencies, | ||
| config: { | ||
| keyName: 'queryKey', | ||
| queryClientMethods: [ | ||
| 'ensureQueryData', | ||
| 'fetchQuery', | ||
| 'prefetchQuery', | ||
| 'fetchInfiniteQuery', | ||
| 'prefetchInfiniteQuery', | ||
| ], | ||
| hooks: [], | ||
| }, | ||
| }) | ||
| return root.toSource({ quote: 'single', lineTerminator: '\n' }) | ||
| } |
| const createV5UtilsObject = require('../utils/index.cjs') | ||
| const UnknownUsageError = require('../utils/unknown-usage-error.cjs') | ||
| const createQueryClientTransformer = require('../../../utils/transformers/query-client-transformer.cjs') | ||
| const createQueryCacheTransformer = require('../../../utils/transformers/query-cache-transformer.cjs') | ||
| const createUseQueryLikeTransformer = require('../../../utils/transformers/use-query-like-transformer.cjs') | ||
| /** | ||
| * @param {import('jscodeshift').api} jscodeshift | ||
| * @param {Object} utils | ||
| * @param {import('jscodeshift').Collection} root | ||
| * @param {string} filePath | ||
| * @param {{keyName: "mutationKey"|"queryKey", fnName: "mutationFn"|"queryFn", queryClientMethods: ReadonlyArray<string>, hooks: ReadonlyArray<string>}} config | ||
| */ | ||
| const transformFilterAwareUsages = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| filePath, | ||
| config, | ||
| }) => { | ||
| const v5Utils = createV5UtilsObject({ jscodeshift, utils }) | ||
| /** | ||
| * @param {import('jscodeshift').CallExpression} node | ||
| * @param {"mutationKey"|"queryKey"} keyName | ||
| * @param {"mutationFn"|"queryFn"} fnName | ||
| * @returns {boolean} | ||
| */ | ||
| const canSkipReplacement = (node, keyName, fnName) => { | ||
| const callArguments = node.arguments | ||
| const hasKeyOrFnProperty = () => | ||
| callArguments[0].properties.some( | ||
| (property) => | ||
| utils.isObjectProperty(property) && | ||
| property.key.name !== keyName && | ||
| property.key.name !== fnName, | ||
| ) | ||
| /** | ||
| * This call has at least one argument. If it's an object expression and contains the "queryKey" or "mutationKey" | ||
| * field, the transformation can be skipped, because it's already matching the expected signature. | ||
| */ | ||
| return ( | ||
| callArguments.length > 0 && | ||
| utils.isObjectExpression(callArguments[0]) && | ||
| hasKeyOrFnProperty() | ||
| ) | ||
| } | ||
| /** | ||
| * This function checks whether the given object property is a spread element or a property that's not named | ||
| * "queryKey" or "mutationKey". | ||
| * | ||
| * @param {import('jscodeshift').ObjectProperty} property | ||
| * @returns {boolean} | ||
| */ | ||
| const predicate = (property) => { | ||
| const isSpreadElement = utils.isSpreadElement(property) | ||
| const isObjectProperty = utils.isObjectProperty(property) | ||
| return ( | ||
| isSpreadElement || | ||
| (isObjectProperty && property.key.name !== config.keyName) | ||
| ) | ||
| } | ||
| const replacer = (path) => { | ||
| const node = path.node | ||
| const isFunctionDefinition = (functionArgument) => { | ||
| if (utils.isFunctionDefinition(functionArgument)) { | ||
| return true | ||
| } | ||
| if (utils.isIdentifier(functionArgument)) { | ||
| const binding = v5Utils.getBindingFromScope( | ||
| path, | ||
| functionArgument.name, | ||
| filePath, | ||
| ) | ||
| const isVariableDeclarator = jscodeshift.match(binding, { | ||
| type: jscodeshift.VariableDeclarator.name, | ||
| }) | ||
| return isVariableDeclarator && utils.isFunctionDefinition(binding.init) | ||
| } | ||
| } | ||
| try { | ||
| // If the given method/function call matches certain criteria, the node doesn't need to be replaced, this step can be skipped. | ||
| if (canSkipReplacement(node, config.keyName, config.fnName)) { | ||
| return node | ||
| } | ||
| /** | ||
| * Here we attempt to determine the first parameter of the function call. | ||
| * If it's a function definition, we can create an object property from it (the mutation fn). | ||
| */ | ||
| const firstArgument = node.arguments[0] | ||
| if (isFunctionDefinition(firstArgument)) { | ||
| const objectExpression = jscodeshift.objectExpression([ | ||
| jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier(config.fnName), | ||
| firstArgument, | ||
| ), | ||
| ]) | ||
| const secondArgument = node.arguments[1] | ||
| if (secondArgument) { | ||
| // If it's an object expression, we can copy the properties from it to the newly created object expression. | ||
| if (utils.isObjectExpression(secondArgument)) { | ||
| v5Utils.copyPropertiesFromSource( | ||
| secondArgument, | ||
| objectExpression, | ||
| predicate, | ||
| ) | ||
| } else { | ||
| // Otherwise, we simply spread the second argument in the newly created object expression. | ||
| objectExpression.properties.push( | ||
| jscodeshift.spreadElement(secondArgument), | ||
| ) | ||
| } | ||
| } | ||
| return jscodeshift.callExpression(node.original.callee, [ | ||
| objectExpression, | ||
| ]) | ||
| } | ||
| /** | ||
| * If, instead, the first parameter is an array expression or an identifier that references | ||
| * an array expression, then we create an object property from it (the query or mutation key). | ||
| * | ||
| * @type {import('jscodeshift').Property|undefined} | ||
| */ | ||
| const keyProperty = v5Utils.transformArgumentToKey( | ||
| path, | ||
| node.arguments[0], | ||
| config.keyName, | ||
| filePath, | ||
| ) | ||
| /** | ||
| * The first parameter couldn't be transformed into an object property, so it's time to throw an exception, | ||
| * it will notify the consumers that they need to rewrite this usage manually. | ||
| */ | ||
| if (!keyProperty) { | ||
| const secondArgument = | ||
| node.arguments.length > 1 ? node.arguments[1] : null | ||
| if (!secondArgument) { | ||
| throw new UnknownUsageError(node, filePath) | ||
| } | ||
| if (utils.isFunctionDefinition(secondArgument)) { | ||
| const originalArguments = node.arguments | ||
| const firstArgument = jscodeshift.objectExpression([ | ||
| jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier(config.keyName), | ||
| originalArguments[0], | ||
| ), | ||
| jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier(config.fnName), | ||
| secondArgument, | ||
| ), | ||
| ]) | ||
| return jscodeshift.callExpression(node.original.callee, [ | ||
| firstArgument, | ||
| ...originalArguments.slice(2), | ||
| ]) | ||
| } | ||
| } | ||
| const functionArguments = [jscodeshift.objectExpression([keyProperty])] | ||
| const secondParameter = node.arguments[1] | ||
| if (secondParameter) { | ||
| const createdObjectExpression = functionArguments[0] | ||
| if (isFunctionDefinition(secondParameter)) { | ||
| const objectExpression = jscodeshift.objectExpression([ | ||
| jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier(config.keyName), | ||
| node.arguments[0], | ||
| ), | ||
| jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier(config.fnName), | ||
| secondParameter, | ||
| ), | ||
| ]) | ||
| const thirdArgument = node.arguments[2] | ||
| if (thirdArgument) { | ||
| // If it's an object expression, we can copy the properties from it to the newly created object expression. | ||
| if (utils.isObjectExpression(thirdArgument)) { | ||
| v5Utils.copyPropertiesFromSource( | ||
| thirdArgument, | ||
| objectExpression, | ||
| predicate, | ||
| ) | ||
| } else { | ||
| // Otherwise, we simply spread the third argument in the newly created object expression. | ||
| objectExpression.properties.push( | ||
| jscodeshift.spreadElement(thirdArgument), | ||
| ) | ||
| } | ||
| } | ||
| return jscodeshift.callExpression(node.original.callee, [ | ||
| objectExpression, | ||
| ]) | ||
| } | ||
| /** | ||
| * If it has a second argument, and it's an object expression, then we get the properties from it | ||
| * (except the "queryKey" or "mutationKey" properties), because these arguments will also be moved to the | ||
| * newly created object expression. | ||
| */ | ||
| if (utils.isObjectExpression(secondParameter)) { | ||
| v5Utils.copyPropertiesFromSource( | ||
| secondParameter, | ||
| createdObjectExpression, | ||
| predicate, | ||
| ) | ||
| } else { | ||
| // Otherwise, we simply spread the second parameter in the newly created object expression. | ||
| createdObjectExpression.properties.push( | ||
| jscodeshift.spreadElement(secondParameter), | ||
| ) | ||
| } | ||
| } | ||
| // The rest of the function arguments can be simply pushed to the function arguments object so all will be kept. | ||
| functionArguments.push(...node.arguments.slice(2)) | ||
| return jscodeshift.callExpression(node.original.callee, functionArguments) | ||
| } catch (error) { | ||
| utils.warn( | ||
| error.name === UnknownUsageError.name | ||
| ? error.message | ||
| : `An unknown error occurred while processing the "${filePath}" file. Please review this file, because the codemod couldn't be applied.`, | ||
| ) | ||
| return node | ||
| } | ||
| } | ||
| createQueryClientTransformer({ jscodeshift, utils, root }).execute( | ||
| config.queryClientMethods, | ||
| replacer, | ||
| ) | ||
| createUseQueryLikeTransformer({ jscodeshift, utils, root }).execute( | ||
| config.hooks, | ||
| replacer, | ||
| ) | ||
| createQueryCacheTransformer({ jscodeshift, utils, root }).execute(replacer) | ||
| } | ||
| module.exports = transformFilterAwareUsages |
| const createV5UtilsObject = require('../utils/index.cjs') | ||
| const UnknownUsageError = require('../utils/unknown-usage-error.cjs') | ||
| const createQueryClientTransformer = require('../../../utils/transformers/query-client-transformer.cjs') | ||
| /** | ||
| * @param {import('jscodeshift').api} jscodeshift | ||
| * @param {Object} utils | ||
| * @param {import('jscodeshift').Collection} root | ||
| * @param {string} filePath | ||
| * @param {{keyName: "mutationKey"|"queryKey", queryClientMethods: ReadonlyArray<string>, hooks: ReadonlyArray<string>}} config | ||
| */ | ||
| const transformQueryFnAwareUsages = ({ | ||
| jscodeshift, | ||
| utils, | ||
| root, | ||
| filePath, | ||
| config, | ||
| }) => { | ||
| const v5Utils = createV5UtilsObject({ jscodeshift, utils }) | ||
| /** | ||
| * @param {import('jscodeshift').CallExpression} node | ||
| * @returns {boolean} | ||
| */ | ||
| const canSkipReplacement = (node) => { | ||
| const callArguments = node.arguments | ||
| const hasKeyProperty = () => | ||
| callArguments[0].properties.some( | ||
| (property) => | ||
| utils.isObjectProperty(property) && | ||
| [config.keyName, 'queryFn'].includes(property.key.name), | ||
| ) | ||
| return ( | ||
| callArguments.length > 0 && | ||
| utils.isObjectExpression(callArguments[0]) && | ||
| hasKeyProperty() | ||
| ) | ||
| } | ||
| const predicate = (property) => { | ||
| const isSpreadElement = utils.isSpreadElement(property) | ||
| const isObjectProperty = utils.isObjectProperty(property) | ||
| return ( | ||
| isSpreadElement || | ||
| (isObjectProperty && property.key.name !== config.keyName) | ||
| ) | ||
| } | ||
| const transformArgumentToQueryFunction = (path, node) => { | ||
| const isIdentifier = utils.isIdentifier(node) | ||
| const isFunctionDefinition = utils.isFunctionDefinition(node) | ||
| if (!isIdentifier && !isFunctionDefinition) { | ||
| return undefined | ||
| } | ||
| if (isFunctionDefinition) { | ||
| return jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier('queryFn'), | ||
| node, | ||
| ) | ||
| } | ||
| const binding = v5Utils.getBindingFromScope(path, node.name, filePath) | ||
| const initializer = v5Utils.getInitializerByDeclarator(binding) | ||
| if (!utils.isFunctionDefinition(initializer)) { | ||
| return undefined | ||
| } | ||
| return jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier('queryFn'), | ||
| binding.id, | ||
| ) | ||
| } | ||
| const transformArgumentToOptionsObject = (path, node) => { | ||
| if (!utils.isIdentifier(node)) { | ||
| return undefined | ||
| } | ||
| const binding = v5Utils.getBindingFromScope(path, node.name, filePath) | ||
| const initializer = v5Utils.getInitializerByDeclarator(binding) | ||
| if (utils.isObjectExpression(initializer)) { | ||
| return jscodeshift.spreadElement(binding.id) | ||
| } | ||
| } | ||
| const replacer = (path) => { | ||
| const node = path.node | ||
| try { | ||
| // If the given method/function call matches certain criteria, the node doesn't need to be replaced, this step can be skipped. | ||
| if (canSkipReplacement(node)) { | ||
| return node | ||
| } | ||
| const keyProperty = v5Utils.transformArgumentToKey( | ||
| path, | ||
| node.arguments[0], | ||
| config.keyName, | ||
| filePath, | ||
| ) | ||
| if (!keyProperty) { | ||
| throw new UnknownUsageError(node, filePath) | ||
| } | ||
| const parameters = [jscodeshift.objectExpression([keyProperty])] | ||
| const createdObjectExpression = parameters[0] | ||
| const secondParameter = node.arguments[1] | ||
| if (secondParameter) { | ||
| const queryFnProperty = transformArgumentToQueryFunction( | ||
| path, | ||
| secondParameter, | ||
| ) | ||
| if (queryFnProperty) { | ||
| createdObjectExpression.properties.push(queryFnProperty) | ||
| const thirdParameter = node.arguments[2] | ||
| if (utils.isObjectExpression(thirdParameter)) { | ||
| v5Utils.copyPropertiesFromSource( | ||
| thirdParameter, | ||
| createdObjectExpression, | ||
| predicate, | ||
| ) | ||
| } else { | ||
| createdObjectExpression.properties.push( | ||
| jscodeshift.spreadElement(thirdParameter), | ||
| ) | ||
| } | ||
| return jscodeshift.callExpression(node.original.callee, parameters) | ||
| } | ||
| const optionsProperty = transformArgumentToOptionsObject( | ||
| path, | ||
| secondParameter, | ||
| ) | ||
| if (optionsProperty) { | ||
| createdObjectExpression.properties.push(optionsProperty) | ||
| return jscodeshift.callExpression(node.original.callee, parameters) | ||
| } | ||
| if (utils.isObjectExpression(secondParameter)) { | ||
| v5Utils.copyPropertiesFromSource( | ||
| secondParameter, | ||
| createdObjectExpression, | ||
| predicate, | ||
| ) | ||
| } | ||
| return jscodeshift.callExpression(node.original.callee, parameters) | ||
| } | ||
| return jscodeshift.callExpression(node.original.callee, parameters) | ||
| } catch (error) { | ||
| utils.warn( | ||
| error.name === UnknownUsageError.name | ||
| ? error.message | ||
| : `An unknown error occurred while processing the "${filePath}" file. Please review this file, because the codemod couldn't be applied.`, | ||
| ) | ||
| return node | ||
| } | ||
| } | ||
| createQueryClientTransformer({ jscodeshift, utils, root }).execute( | ||
| config.queryClientMethods, | ||
| replacer, | ||
| ) | ||
| } | ||
| module.exports = transformQueryFnAwareUsages |
| const UnknownUsageError = require('./unknown-usage-error.cjs') | ||
| module.exports = ({ jscodeshift, utils }) => { | ||
| /** | ||
| * | ||
| * @param {import('jscodeshift').ObjectExpression} source | ||
| * @param {import('jscodeshift').ObjectExpression} target | ||
| * @param {(node: import('jscodeshift').Node) => boolean} predicate | ||
| */ | ||
| const copyPropertiesFromSource = (source, target, predicate) => { | ||
| source.properties.forEach((property) => { | ||
| if (predicate(property)) { | ||
| target.properties.push(property) | ||
| } | ||
| }) | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').NodePath} path | ||
| * @param {string} argumentName | ||
| * @param {string} filePath | ||
| * @returns {*} | ||
| */ | ||
| const getBindingFromScope = (path, argumentName, filePath) => { | ||
| /** | ||
| * If the current scope contains the declaration then we can use the actual one else we attempt to find the | ||
| * binding from above. | ||
| */ | ||
| const scope = path.scope.declares(argumentName) | ||
| ? path.scope | ||
| : path.scope.lookup(argumentName) | ||
| /** | ||
| * The declaration couldn't be found for some reason, time to move on. We warn the user it needs to be rewritten | ||
| * by themselves. | ||
| */ | ||
| if (!scope) { | ||
| return undefined | ||
| } | ||
| const binding = scope.bindings[argumentName] | ||
| .filter((item) => utils.isIdentifier(item.value)) | ||
| .map((item) => item.parentPath.value) | ||
| .at(0) | ||
| if (!binding) { | ||
| throw new UnknownUsageError(path.node, filePath) | ||
| } | ||
| return binding | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').VariableDeclarator} binding | ||
| * @returns {import('jscodeshift').Node|undefined} | ||
| */ | ||
| const getInitializerByDeclarator = (binding) => { | ||
| const isVariableDeclaration = jscodeshift.match(binding, { | ||
| type: jscodeshift.VariableDeclarator.name, | ||
| }) | ||
| if (!isVariableDeclaration) { | ||
| return undefined | ||
| } | ||
| const isTSAsExpression = jscodeshift.match(binding.init, { | ||
| type: jscodeshift.TSAsExpression.name, | ||
| }) | ||
| return isTSAsExpression ? binding.init.expression : binding.init | ||
| } | ||
| /** | ||
| * @param {import('jscodeshift').Node} node | ||
| * @returns {boolean} | ||
| */ | ||
| const isArrayExpressionVariable = (node) => | ||
| jscodeshift.match(node, { | ||
| type: jscodeshift.VariableDeclarator.name, | ||
| init: { | ||
| type: jscodeshift.ArrayExpression.name, | ||
| }, | ||
| }) | ||
| /** | ||
| * @param {import('jscodeshift').NodePath} path | ||
| * @param {import('jscodeshift').Node} node | ||
| * @param {"queryKey"|"mutationKey"} keyName | ||
| * @param {string} filePath | ||
| * @returns {import('jscodeshift').Property|undefined} | ||
| */ | ||
| const transformArgumentToKey = (path, node, keyName, filePath) => { | ||
| // If the first argument is an identifier we have to infer its type if possible. | ||
| if (utils.isIdentifier(node)) { | ||
| const binding = getBindingFromScope(path, node.name, filePath) | ||
| if (isArrayExpressionVariable(binding)) { | ||
| return jscodeshift.property( | ||
| 'init', | ||
| jscodeshift.identifier(keyName), | ||
| jscodeshift.identifier(binding.id.name), | ||
| ) | ||
| } | ||
| } | ||
| // If the first argument is an array, then it matches the following overload: | ||
| // methodName(queryKey?: QueryKey, firstObject?: TFirstObject, secondObject?: TSecondObject) | ||
| if (utils.isArrayExpression(node)) { | ||
| // Then we create the 'queryKey' property based on it, because it will be passed to the first argument | ||
| // that should be an object according to the new signature. | ||
| return jscodeshift.property('init', jscodeshift.identifier(keyName), node) | ||
| } | ||
| return undefined | ||
| } | ||
| return { | ||
| copyPropertiesFromSource, | ||
| getInitializerByDeclarator, | ||
| getBindingFromScope, | ||
| transformArgumentToKey, | ||
| } | ||
| } |
| class UnknownUsageError extends Error { | ||
| /** | ||
| * @param {import('jscodeshift').CallExpression} callExpression | ||
| * @param {string} filePath | ||
| */ | ||
| constructor(callExpression, filePath) { | ||
| super('') | ||
| this.message = this.buildMessage(callExpression, filePath) | ||
| this.name = 'UnknownUsageError' | ||
| } | ||
| /** | ||
| * | ||
| * @param {import('jscodeshift').CallExpression} callExpression | ||
| * @param {string} filePath | ||
| * @returns {string} | ||
| */ | ||
| buildMessage(callExpression, filePath) { | ||
| const location = callExpression.callee.loc | ||
| const start = location.start.line | ||
| const end = location.end.line | ||
| return `The usage in file "${filePath}" at line ${start}:${end} could not be transformed into the new syntax. Please do this manually.` | ||
| } | ||
| } | ||
| module.exports = UnknownUsageError |
| module.exports = (file, api) => { | ||
| const jscodeshift = api.jscodeshift | ||
| const root = jscodeshift(file.source) | ||
| const importSpecifiers = root | ||
| .find(jscodeshift.ImportDeclaration, { | ||
| source: { | ||
| value: '@tanstack/react-query', | ||
| }, | ||
| }) | ||
| .find(jscodeshift.ImportSpecifier, { | ||
| imported: { | ||
| name: 'Hydrate', | ||
| }, | ||
| }) | ||
| if (importSpecifiers.length > 0) { | ||
| const names = { | ||
| searched: 'Hydrate', // By default, we want to replace the `Hydrate` usages. | ||
| target: 'HydrationBoundary', // We want to replace them with `HydrationBoundary`. | ||
| } | ||
| importSpecifiers.replaceWith(({ node: mutableNode }) => { | ||
| /** | ||
| * When the local and imported names match which means the code doesn't contain import aliases, we need | ||
| * to replace only the import specifier. | ||
| * @type {boolean} | ||
| */ | ||
| const usesDefaultImport = | ||
| mutableNode.local.name === mutableNode.imported.name | ||
| if (!usesDefaultImport) { | ||
| // If the code uses import aliases, we must re-use the alias. | ||
| names.searched = mutableNode.local.name | ||
| names.target = mutableNode.local.name | ||
| } | ||
| // Override the import specifier. | ||
| mutableNode.imported.name = 'HydrationBoundary' | ||
| return mutableNode | ||
| }) | ||
| root | ||
| .findJSXElements(names.searched) | ||
| .replaceWith(({ node: mutableNode }) => { | ||
| mutableNode.openingElement.name.name = names.target | ||
| mutableNode.closingElement.name.name = names.target | ||
| return mutableNode | ||
| }) | ||
| } | ||
| return root.toSource({ quote: 'single', lineTerminator: '\n' }) | ||
| } |
| module.exports = (file, api) => { | ||
| const jscodeshift = api.jscodeshift | ||
| const root = jscodeshift(file.source) | ||
| const baseRenameLogic = (kind, from, to) => { | ||
| root | ||
| .find(kind, (node) => { | ||
| return ( | ||
| node.computed === false && | ||
| (node.key?.name === from || node.key?.value === from) | ||
| ) | ||
| }) | ||
| .replaceWith(({ node: mutableNode }) => { | ||
| if (mutableNode.key.name !== undefined) { | ||
| mutableNode.key.name = to | ||
| } | ||
| if (mutableNode.key.value !== undefined) { | ||
| mutableNode.key.value = to | ||
| } | ||
| return mutableNode | ||
| }) | ||
| } | ||
| const renameObjectProperty = (from, to) => { | ||
| baseRenameLogic(jscodeshift.ObjectProperty, from, to) | ||
| } | ||
| const renameTypeScriptPropertySignature = (from, to) => { | ||
| baseRenameLogic(jscodeshift.TSPropertySignature, from, to) | ||
| } | ||
| renameObjectProperty('cacheTime', 'gcTime') | ||
| renameObjectProperty('useErrorBoundary', 'throwOnError') | ||
| renameTypeScriptPropertySignature('cacheTime', 'gcTime') | ||
| renameTypeScriptPropertySignature('useErrorBoundary', 'throwOnError') | ||
| return root.toSource({ quote: 'single', lineTerminator: '\n' }) | ||
| } |
| import { AnyDataTag } from '@tanstack/query-core'; | ||
| import { CancelledError } from '@tanstack/query-core'; | ||
| import { CancelOptions } from '@tanstack/query-core'; | ||
| import { DataTag } from '@tanstack/query-core'; | ||
| import { dataTagErrorSymbol } from '@tanstack/query-core'; | ||
| import { dataTagSymbol } from '@tanstack/query-core'; | ||
| import { DefaultedInfiniteQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { DefaultedQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { DefaultError } from '@tanstack/query-core'; | ||
| import { DefaultOptions } from '@tanstack/query-core'; | ||
| import { defaultScheduler } from '@tanstack/query-core'; | ||
| import { defaultShouldDehydrateMutation } from '@tanstack/query-core'; | ||
| import { defaultShouldDehydrateQuery } from '@tanstack/query-core'; | ||
| import { DefinedInfiniteQueryObserverResult } from '@tanstack/query-core'; | ||
| import { DefinedQueryObserverResult } from '@tanstack/query-core'; | ||
| import { dehydrate } from '@tanstack/query-core'; | ||
| import { DehydratedState } from '@tanstack/query-core'; | ||
| import { DehydrateOptions } from '@tanstack/query-core'; | ||
| import { DistributiveOmit } from '@tanstack/query-core'; | ||
| import { Enabled } from '@tanstack/query-core'; | ||
| import { EnsureInfiniteQueryDataOptions } from '@tanstack/query-core'; | ||
| import { EnsureQueryDataOptions } from '@tanstack/query-core'; | ||
| import { environmentManager } from '@tanstack/query-core'; | ||
| import { experimental_streamedQuery } from '@tanstack/query-core'; | ||
| import { FetchInfiniteQueryOptions } from '@tanstack/query-core'; | ||
| import { FetchNextPageOptions } from '@tanstack/query-core'; | ||
| import { FetchPreviousPageOptions } from '@tanstack/query-core'; | ||
| import { FetchQueryOptions } from '@tanstack/query-core'; | ||
| import { FetchStatus } from '@tanstack/query-core'; | ||
| import { focusManager } from '@tanstack/query-core'; | ||
| import { GetNextPageParamFunction } from '@tanstack/query-core'; | ||
| import { GetPreviousPageParamFunction } from '@tanstack/query-core'; | ||
| import { hashKey } from '@tanstack/query-core'; | ||
| import { hydrate } from '@tanstack/query-core'; | ||
| import { HydrateOptions } from '@tanstack/query-core'; | ||
| import { InferDataFromTag } from '@tanstack/query-core'; | ||
| import { InferErrorFromTag } from '@tanstack/query-core'; | ||
| import { InfiniteData } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserver } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverBaseResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverLoadingErrorResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverPendingResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverPlaceholderResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverRefetchErrorResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryPageParamsOptions } from '@tanstack/query-core'; | ||
| import { InitialDataFunction } from '@tanstack/query-core'; | ||
| import { InitialPageParam } from '@tanstack/query-core'; | ||
| import { InvalidateOptions } from '@tanstack/query-core'; | ||
| import { InvalidateQueryFilters } from '@tanstack/query-core'; | ||
| import { isCancelledError } from '@tanstack/query-core'; | ||
| import { isServer } from '@tanstack/query-core'; | ||
| import { JSX } from 'react/jsx-runtime'; | ||
| import { keepPreviousData } from '@tanstack/query-core'; | ||
| import { ManagedTimerId } from '@tanstack/query-core'; | ||
| import { matchMutation } from '@tanstack/query-core'; | ||
| import { matchQuery } from '@tanstack/query-core'; | ||
| import { MutateFunction } from '@tanstack/query-core'; | ||
| import { MutateOptions } from '@tanstack/query-core'; | ||
| import { Mutation } from '@tanstack/query-core'; | ||
| import { MutationCache } from '@tanstack/query-core'; | ||
| import { MutationCacheNotifyEvent } from '@tanstack/query-core'; | ||
| import { MutationFilters } from '@tanstack/query-core'; | ||
| import { MutationFunction } from '@tanstack/query-core'; | ||
| import { MutationFunctionContext } from '@tanstack/query-core'; | ||
| import { MutationKey } from '@tanstack/query-core'; | ||
| import { MutationMeta } from '@tanstack/query-core'; | ||
| import { MutationObserver as MutationObserver_2 } from '@tanstack/query-core'; | ||
| import { MutationObserverBaseResult } from '@tanstack/query-core'; | ||
| import { MutationObserverErrorResult } from '@tanstack/query-core'; | ||
| import { MutationObserverIdleResult } from '@tanstack/query-core'; | ||
| import { MutationObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { MutationObserverOptions } from '@tanstack/query-core'; | ||
| import { MutationObserverResult } from '@tanstack/query-core'; | ||
| import { MutationObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { MutationOptions } from '@tanstack/query-core'; | ||
| import { MutationScope } from '@tanstack/query-core'; | ||
| import { MutationState } from '@tanstack/query-core'; | ||
| import { MutationStatus } from '@tanstack/query-core'; | ||
| import { NetworkMode } from '@tanstack/query-core'; | ||
| import { NoInfer as NoInfer_2 } from '@tanstack/query-core'; | ||
| import { NonUndefinedGuard } from '@tanstack/query-core'; | ||
| import { noop } from '@tanstack/query-core'; | ||
| import { NotifyEvent } from '@tanstack/query-core'; | ||
| import { NotifyEventType } from '@tanstack/query-core'; | ||
| import { notifyManager } from '@tanstack/query-core'; | ||
| import { NotifyOnChangeProps } from '@tanstack/query-core'; | ||
| import { OmitKeyof } from '@tanstack/query-core'; | ||
| import { onlineManager } from '@tanstack/query-core'; | ||
| import { Options } from 'tsup'; | ||
| import { Override } from '@tanstack/query-core'; | ||
| import { partialMatchKey } from '@tanstack/query-core'; | ||
| import { PlaceholderDataFunction } from '@tanstack/query-core'; | ||
| import { QueriesObserver } from '@tanstack/query-core'; | ||
| import { QueriesObserverOptions } from '@tanstack/query-core'; | ||
| import { QueriesPlaceholderDataFunction } from '@tanstack/query-core'; | ||
| import { Query } from '@tanstack/query-core'; | ||
| import { QueryCache } from '@tanstack/query-core'; | ||
| import { QueryCacheNotifyEvent } from '@tanstack/query-core'; | ||
| import { QueryClient } from '@tanstack/query-core'; | ||
| import { QueryClientConfig } from '@tanstack/query-core'; | ||
| import { QueryFilters } from '@tanstack/query-core'; | ||
| import { QueryFunction } from '@tanstack/query-core'; | ||
| import { QueryFunctionContext } from '@tanstack/query-core'; | ||
| import { QueryKey } from '@tanstack/query-core'; | ||
| import { QueryKeyHashFunction } from '@tanstack/query-core'; | ||
| import { QueryMeta } from '@tanstack/query-core'; | ||
| import { QueryObserver } from '@tanstack/query-core'; | ||
| import { QueryObserverBaseResult } from '@tanstack/query-core'; | ||
| import { QueryObserverLoadingErrorResult } from '@tanstack/query-core'; | ||
| import { QueryObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { QueryObserverOptions } from '@tanstack/query-core'; | ||
| import { QueryObserverPendingResult } from '@tanstack/query-core'; | ||
| import { QueryObserverPlaceholderResult } from '@tanstack/query-core'; | ||
| import { QueryObserverRefetchErrorResult } from '@tanstack/query-core'; | ||
| import { QueryObserverResult } from '@tanstack/query-core'; | ||
| import { QueryObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { QueryOptions } from '@tanstack/query-core'; | ||
| import { QueryPersister } from '@tanstack/query-core'; | ||
| import { QueryState } from '@tanstack/query-core'; | ||
| import { QueryStatus } from '@tanstack/query-core'; | ||
| import * as React_2 from 'react'; | ||
| import { RefetchOptions } from '@tanstack/query-core'; | ||
| import { RefetchQueryFilters } from '@tanstack/query-core'; | ||
| import { Register } from '@tanstack/query-core'; | ||
| import { replaceEqualDeep } from '@tanstack/query-core'; | ||
| import { ResetOptions } from '@tanstack/query-core'; | ||
| import { ResultOptions } from '@tanstack/query-core'; | ||
| import { SetDataOptions } from '@tanstack/query-core'; | ||
| import { shouldThrowError } from '@tanstack/query-core'; | ||
| import { SkipToken } from '@tanstack/query-core'; | ||
| import { skipToken } from '@tanstack/query-core'; | ||
| import { StaleTime } from '@tanstack/query-core'; | ||
| import { StaleTimeFunction } from '@tanstack/query-core'; | ||
| import { ThrowOnError } from '@tanstack/query-core'; | ||
| import { TimeoutCallback } from '@tanstack/query-core'; | ||
| import { timeoutManager } from '@tanstack/query-core'; | ||
| import { TimeoutProvider } from '@tanstack/query-core'; | ||
| import { UnsetMarker } from '@tanstack/query-core'; | ||
| import { unsetMarker } from '@tanstack/query-core'; | ||
| import { Updater } from '@tanstack/query-core'; | ||
| import { UserConfig } from 'vite'; | ||
| import { WithRequired } from '@tanstack/query-core'; | ||
| export { AnyDataTag } | ||
| declare type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseBaseQueryOptions } | ||
| export { AnyUseBaseQueryOptions as AnyUseBaseQueryOptions_alias_1 } | ||
| declare type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseInfiniteQueryOptions } | ||
| export { AnyUseInfiniteQueryOptions as AnyUseInfiniteQueryOptions_alias_1 } | ||
| declare type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>; | ||
| export { AnyUseMutationOptions } | ||
| export { AnyUseMutationOptions as AnyUseMutationOptions_alias_1 } | ||
| declare type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>; | ||
| export { AnyUseQueryOptions } | ||
| export { AnyUseQueryOptions as AnyUseQueryOptions_alias_1 } | ||
| declare type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseSuspenseInfiniteQueryOptions } | ||
| export { AnyUseSuspenseInfiniteQueryOptions as AnyUseSuspenseInfiniteQueryOptions_alias_1 } | ||
| declare type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>; | ||
| export { AnyUseSuspenseQueryOptions } | ||
| export { AnyUseSuspenseQueryOptions as AnyUseSuspenseQueryOptions_alias_1 } | ||
| export { CancelledError } | ||
| export { CancelOptions } | ||
| export { DataTag } | ||
| export { dataTagErrorSymbol } | ||
| export { dataTagSymbol } | ||
| export declare const default_alias: any[]; | ||
| export declare const default_alias_1: any[]; | ||
| export declare const default_alias_2: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>); | ||
| export declare const default_alias_3: UserConfig; | ||
| export { DefaultedInfiniteQueryObserverOptions } | ||
| export { DefaultedQueryObserverOptions } | ||
| export { DefaultError } | ||
| export { DefaultOptions } | ||
| export { defaultScheduler } | ||
| export { defaultShouldDehydrateMutation } | ||
| export { defaultShouldDehydrateQuery } | ||
| export declare const defaultThrowOnError: <TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(_error: TError, query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean; | ||
| export { DefinedInfiniteQueryObserverResult } | ||
| declare type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined; | ||
| }; | ||
| export { DefinedInitialDataInfiniteOptions } | ||
| export { DefinedInitialDataInfiniteOptions as DefinedInitialDataInfiniteOptions_alias_1 } | ||
| declare type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & { | ||
| initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>); | ||
| queryFn?: QueryFunction<TQueryFnData, TQueryKey>; | ||
| }; | ||
| export { DefinedInitialDataOptions } | ||
| export { DefinedInitialDataOptions as DefinedInitialDataOptions_alias_1 } | ||
| export { DefinedQueryObserverResult } | ||
| declare type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>; | ||
| export { DefinedUseInfiniteQueryResult } | ||
| export { DefinedUseInfiniteQueryResult as DefinedUseInfiniteQueryResult_alias_1 } | ||
| declare type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>; | ||
| export { DefinedUseQueryResult } | ||
| export { DefinedUseQueryResult as DefinedUseQueryResult_alias_1 } | ||
| export { dehydrate } | ||
| export { DehydratedState } | ||
| export { DehydrateOptions } | ||
| export { DistributiveOmit } | ||
| export { Enabled } | ||
| export { EnsureInfiniteQueryDataOptions } | ||
| export declare const ensurePreventErrorBoundaryRetry: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue, query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined) => void; | ||
| export { EnsureQueryDataOptions } | ||
| export declare const ensureSuspenseTimers: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void; | ||
| export { environmentManager } | ||
| export { experimental_streamedQuery } | ||
| export { FetchInfiniteQueryOptions } | ||
| export { FetchNextPageOptions } | ||
| export declare const fetchOptimistic: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(defaultedOptions: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue) => Promise<void | QueryObserverResult<TData, TError>>; | ||
| export { FetchPreviousPageOptions } | ||
| export { FetchQueryOptions } | ||
| export { FetchStatus } | ||
| export { focusManager } | ||
| declare type GetDefinedOrUndefinedQueryResult<T, TData, TError = unknown> = T extends { | ||
| initialData?: infer TInitialData; | ||
| } ? unknown extends TInitialData ? UseQueryResult<TData, TError> : TInitialData extends TData ? DefinedUseQueryResult<TData, TError> : TInitialData extends () => infer TInitialDataResult ? unknown extends TInitialDataResult ? UseQueryResult<TData, TError> : TInitialDataResult extends TData ? DefinedUseQueryResult<TData, TError> : UseQueryResult<TData, TError> : UseQueryResult<TData, TError> : UseQueryResult<TData, TError>; | ||
| export declare const getHasError: <TData, TError, TQueryFnData, TQueryData, TQueryKey extends QueryKey>({ result, errorResetBoundary, throwOnError, query, suspense, }: { | ||
| result: QueryObserverResult<TData, TError>; | ||
| errorResetBoundary: QueryErrorResetBoundaryValue; | ||
| throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>; | ||
| query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined; | ||
| suspense: boolean | undefined; | ||
| }) => boolean | undefined; | ||
| export { GetNextPageParamFunction } | ||
| export { GetPreviousPageParamFunction } | ||
| declare type GetUseQueryOptionsForUseQueries<T> = T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseQueryOptionsForUseQueries<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? UseQueryOptionsForUseQueries<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseQueryOptionsForUseQueries<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, unknown extends TError ? DefaultError : TError, unknown extends TData ? TQueryFnData : TData, TQueryKey> : UseQueryOptionsForUseQueries; | ||
| declare type GetUseQueryResult<T> = T extends { | ||
| queryFnData: any; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends [any, infer TError, infer TData] ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends [infer TQueryFnData, infer TError] ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError> : T extends [infer TQueryFnData] ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : UseQueryResult; | ||
| declare type GetUseSuspenseQueryOptions<T> = T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TData> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryOptions<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? UseSuspenseQueryOptions<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? UseSuspenseQueryOptions<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseSuspenseQueryOptions<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries_2; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries_2; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TQueryFnData, TQueryKey> : UseSuspenseQueryOptions; | ||
| declare type GetUseSuspenseQueryResult<T> = T extends { | ||
| queryFnData: any; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseSuspenseQueryResult<TData, TError> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryResult<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryResult<TData, TError> : T extends [any, infer TError, infer TData] ? UseSuspenseQueryResult<TData, TError> : T extends [infer TQueryFnData, infer TError] ? UseSuspenseQueryResult<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseSuspenseQueryResult<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries_2; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryResult<unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries_2; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryResult<TQueryFnData, unknown extends TError ? DefaultError : TError> : UseSuspenseQueryResult; | ||
| export { hashKey } | ||
| export { hydrate } | ||
| export { HydrateOptions } | ||
| declare const HydrationBoundary: ({ children, options, state, queryClient, }: HydrationBoundaryProps) => React_2.ReactElement; | ||
| export { HydrationBoundary } | ||
| export { HydrationBoundary as HydrationBoundary_alias_1 } | ||
| declare interface HydrationBoundaryProps { | ||
| state: DehydratedState | null | undefined; | ||
| options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & { | ||
| defaultOptions?: OmitKeyof<Exclude<HydrateOptions['defaultOptions'], undefined>, 'mutations'>; | ||
| }; | ||
| children?: React_2.ReactNode; | ||
| queryClient?: QueryClient; | ||
| } | ||
| export { HydrationBoundaryProps } | ||
| export { HydrationBoundaryProps as HydrationBoundaryProps_alias_1 } | ||
| export { InferDataFromTag } | ||
| export { InferErrorFromTag } | ||
| export { InfiniteData } | ||
| export { InfiniteQueryObserver } | ||
| export { InfiniteQueryObserverBaseResult } | ||
| export { InfiniteQueryObserverLoadingErrorResult } | ||
| export { InfiniteQueryObserverLoadingResult } | ||
| export { InfiniteQueryObserverOptions } | ||
| export { InfiniteQueryObserverPendingResult } | ||
| export { InfiniteQueryObserverPlaceholderResult } | ||
| export { InfiniteQueryObserverRefetchErrorResult } | ||
| export { InfiniteQueryObserverResult } | ||
| export { InfiniteQueryObserverSuccessResult } | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| export { infiniteQueryOptions } | ||
| export { infiniteQueryOptions as infiniteQueryOptions_alias_1 } | ||
| export { InfiniteQueryPageParamsOptions } | ||
| export { InitialDataFunction } | ||
| export { InitialPageParam } | ||
| export { InvalidateOptions } | ||
| export { InvalidateQueryFilters } | ||
| export { isCancelledError } | ||
| declare const IsRestoringProvider: React_2.Provider<boolean>; | ||
| export { IsRestoringProvider } | ||
| export { IsRestoringProvider as IsRestoringProvider_alias_1 } | ||
| export { isServer } | ||
| export { keepPreviousData } | ||
| /** | ||
| * @param {Object} opts - Options for building configurations. | ||
| * @param {string[]} opts.entry - The entry array. | ||
| * @returns {import('tsup').Options} | ||
| */ | ||
| export declare function legacyConfig(opts: { | ||
| entry: string[]; | ||
| }): Options; | ||
| export { ManagedTimerId } | ||
| export { matchMutation } | ||
| export { matchQuery } | ||
| declare type MAXIMUM_DEPTH = 20; | ||
| declare type MAXIMUM_DEPTH_2 = 20; | ||
| /** | ||
| * @param {Object} opts - Options for building configurations. | ||
| * @param {string[]} opts.entry - The entry array. | ||
| * @returns {import('tsup').Options} | ||
| */ | ||
| export declare function modernConfig(opts: { | ||
| entry: string[]; | ||
| }): Options; | ||
| export { MutateFunction } | ||
| export { MutateOptions } | ||
| export { Mutation } | ||
| export { MutationCache } | ||
| export { MutationCacheNotifyEvent } | ||
| export { MutationFilters } | ||
| export { MutationFunction } | ||
| export { MutationFunctionContext } | ||
| export { MutationKey } | ||
| export { MutationMeta } | ||
| export { MutationObserver_2 as MutationObserver } | ||
| export { MutationObserverBaseResult } | ||
| export { MutationObserverErrorResult } | ||
| export { MutationObserverIdleResult } | ||
| export { MutationObserverLoadingResult } | ||
| export { MutationObserverOptions } | ||
| export { MutationObserverResult } | ||
| export { MutationObserverSuccessResult } | ||
| export { MutationOptions } | ||
| declare function mutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: WithRequired<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>): WithRequired<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>; | ||
| declare function mutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: Omit<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>): Omit<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>; | ||
| export { mutationOptions } | ||
| export { mutationOptions as mutationOptions_alias_1 } | ||
| export { MutationScope } | ||
| export { MutationState } | ||
| declare type MutationStateOptions<TResult = MutationState> = { | ||
| filters?: MutationFilters; | ||
| select?: (mutation: Mutation) => TResult; | ||
| }; | ||
| export { MutationStatus } | ||
| export { NetworkMode } | ||
| export { NoInfer_2 as NoInfer } | ||
| export { NonUndefinedGuard } | ||
| export { noop } | ||
| export { NotifyEvent } | ||
| export { NotifyEventType } | ||
| export { notifyManager } | ||
| export { NotifyOnChangeProps } | ||
| export { OmitKeyof } | ||
| export { onlineManager } | ||
| export { Override } | ||
| export { partialMatchKey } | ||
| export { PlaceholderDataFunction } | ||
| export { QueriesObserver } | ||
| export { QueriesObserverOptions } | ||
| /** | ||
| * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
| */ | ||
| declare type QueriesOptions<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryOptionsForUseQueries> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryOptionsForUseQueries<Head>] : T extends [infer Head, ...infer Tails] ? QueriesOptions<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseQueryOptionsForUseQueries<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : ReadonlyArray<unknown> extends T ? T : T extends Array<UseQueryOptionsForUseQueries<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<UseQueryOptionsForUseQueries<TQueryFnData, TError, TData, TQueryKey>> : Array<UseQueryOptionsForUseQueries>; | ||
| export { QueriesOptions } | ||
| export { QueriesOptions as QueriesOptions_alias_1 } | ||
| export { QueriesPlaceholderDataFunction } | ||
| /** | ||
| * QueriesResults reducer recursively maps type param to results | ||
| */ | ||
| declare type QueriesResults<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryResult<Head>] : T extends [infer Head, ...infer Tails] ? QueriesResults<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseQueryResult<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : { | ||
| [K in keyof T]: GetUseQueryResult<T[K]>; | ||
| }; | ||
| export { QueriesResults } | ||
| export { QueriesResults as QueriesResults_alias_1 } | ||
| export { Query } | ||
| export { QueryCache } | ||
| export { QueryCacheNotifyEvent } | ||
| export { QueryClient } | ||
| export { QueryClientConfig } | ||
| declare const QueryClientContext: React_2.Context<QueryClient | undefined>; | ||
| export { QueryClientContext } | ||
| export { QueryClientContext as QueryClientContext_alias_1 } | ||
| declare const QueryClientProvider: ({ client, children, }: QueryClientProviderProps) => React_2.JSX.Element; | ||
| export { QueryClientProvider } | ||
| export { QueryClientProvider as QueryClientProvider_alias_1 } | ||
| declare type QueryClientProviderProps = { | ||
| client: QueryClient; | ||
| children?: React_2.ReactNode; | ||
| }; | ||
| export { QueryClientProviderProps } | ||
| export { QueryClientProviderProps as QueryClientProviderProps_alias_1 } | ||
| declare type QueryErrorClearResetFunction = () => void; | ||
| export { QueryErrorClearResetFunction } | ||
| export { QueryErrorClearResetFunction as QueryErrorClearResetFunction_alias_1 } | ||
| declare type QueryErrorIsResetFunction = () => boolean; | ||
| export { QueryErrorIsResetFunction } | ||
| export { QueryErrorIsResetFunction as QueryErrorIsResetFunction_alias_1 } | ||
| declare const QueryErrorResetBoundary: ({ children, }: QueryErrorResetBoundaryProps) => JSX.Element; | ||
| export { QueryErrorResetBoundary } | ||
| export { QueryErrorResetBoundary as QueryErrorResetBoundary_alias_1 } | ||
| declare type QueryErrorResetBoundaryFunction = (value: QueryErrorResetBoundaryValue) => React_2.ReactNode; | ||
| export { QueryErrorResetBoundaryFunction } | ||
| export { QueryErrorResetBoundaryFunction as QueryErrorResetBoundaryFunction_alias_1 } | ||
| declare interface QueryErrorResetBoundaryProps { | ||
| children: QueryErrorResetBoundaryFunction | React_2.ReactNode; | ||
| } | ||
| export { QueryErrorResetBoundaryProps } | ||
| export { QueryErrorResetBoundaryProps as QueryErrorResetBoundaryProps_alias_1 } | ||
| export declare interface QueryErrorResetBoundaryValue { | ||
| clearReset: QueryErrorClearResetFunction; | ||
| isReset: QueryErrorIsResetFunction; | ||
| reset: QueryErrorResetFunction; | ||
| } | ||
| declare type QueryErrorResetFunction = () => void; | ||
| export { QueryErrorResetFunction } | ||
| export { QueryErrorResetFunction as QueryErrorResetFunction_alias_1 } | ||
| export { QueryFilters } | ||
| export { QueryFunction } | ||
| export { QueryFunctionContext } | ||
| export { QueryKey } | ||
| export { QueryKeyHashFunction } | ||
| export { QueryMeta } | ||
| export { QueryObserver } | ||
| export { QueryObserverBaseResult } | ||
| export { QueryObserverLoadingErrorResult } | ||
| export { QueryObserverLoadingResult } | ||
| export { QueryObserverOptions } | ||
| export { QueryObserverPendingResult } | ||
| export { QueryObserverPlaceholderResult } | ||
| export { QueryObserverRefetchErrorResult } | ||
| export { QueryObserverResult } | ||
| export { QueryObserverSuccessResult } | ||
| export { QueryOptions } | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| export { queryOptions } | ||
| export { queryOptions as queryOptions_alias_1 } | ||
| export { QueryPersister } | ||
| export { QueryState } | ||
| export { QueryStatus } | ||
| export { RefetchOptions } | ||
| export { RefetchQueryFilters } | ||
| export { Register } | ||
| export { replaceEqualDeep } | ||
| export { ResetOptions } | ||
| export { ResultOptions } | ||
| export { SetDataOptions } | ||
| export declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any> | undefined, result: QueryObserverResult<any, any>) => boolean | undefined; | ||
| export { shouldThrowError } | ||
| export { SkipToken } | ||
| export { skipToken } | ||
| declare type SkipTokenForUseQueries = symbol; | ||
| declare type SkipTokenForUseQueries_2 = symbol; | ||
| export { StaleTime } | ||
| export { StaleTimeFunction } | ||
| /** | ||
| * SuspenseQueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
| */ | ||
| declare type SuspenseQueriesOptions<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH_2 ? Array<UseSuspenseQueryOptions> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseSuspenseQueryOptions<Head>] : T extends [infer Head, ...infer Tails] ? SuspenseQueriesOptions<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseSuspenseQueryOptions<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : Array<unknown> extends T ? T : T extends Array<UseSuspenseQueryOptions<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>> : Array<UseSuspenseQueryOptions>; | ||
| export { SuspenseQueriesOptions } | ||
| export { SuspenseQueriesOptions as SuspenseQueriesOptions_alias_1 } | ||
| /** | ||
| * SuspenseQueriesResults reducer recursively maps type param to results | ||
| */ | ||
| declare type SuspenseQueriesResults<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH_2 ? Array<UseSuspenseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseSuspenseQueryResult<Head>] : T extends [infer Head, ...infer Tails] ? SuspenseQueriesResults<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseSuspenseQueryResult<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : { | ||
| [K in keyof T]: GetUseSuspenseQueryResult<T[K]>; | ||
| }; | ||
| export { SuspenseQueriesResults } | ||
| export { SuspenseQueriesResults as SuspenseQueriesResults_alias_1 } | ||
| export { ThrowOnError } | ||
| export { TimeoutCallback } | ||
| export { timeoutManager } | ||
| export { TimeoutProvider } | ||
| declare type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| initialData?: undefined | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | InitialDataFunction<NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>>; | ||
| }; | ||
| export { UndefinedInitialDataInfiniteOptions } | ||
| export { UndefinedInitialDataInfiniteOptions as UndefinedInitialDataInfiniteOptions_alias_1 } | ||
| declare type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>> | NonUndefinedGuard<TQueryFnData>; | ||
| }; | ||
| export { UndefinedInitialDataOptions } | ||
| export { UndefinedInitialDataOptions as UndefinedInitialDataOptions_alias_1 } | ||
| export { UnsetMarker } | ||
| export { unsetMarker } | ||
| declare type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & { | ||
| queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>; | ||
| }; | ||
| export { UnusedSkipTokenInfiniteOptions } | ||
| export { UnusedSkipTokenInfiniteOptions as UnusedSkipTokenInfiniteOptions_alias_1 } | ||
| declare type UnusedSkipTokenOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & { | ||
| queryFn?: Exclude<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken | undefined>; | ||
| }; | ||
| export { UnusedSkipTokenOptions } | ||
| export { UnusedSkipTokenOptions as UnusedSkipTokenOptions_alias_1 } | ||
| export { Updater } | ||
| declare type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, { | ||
| mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| }> & { | ||
| mutateAsync: UseMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| }; | ||
| export { UseBaseMutationResult } | ||
| export { UseBaseMutationResult as UseBaseMutationResult_alias_1 } | ||
| export declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, Observer: typeof QueryObserver, queryClient?: QueryClient): QueryObserverResult<TData, TError>; | ||
| declare interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> { | ||
| /** | ||
| * Set this to `false` to unsubscribe this observer from updates to the query cache. | ||
| * Defaults to `true`. | ||
| */ | ||
| subscribed?: boolean; | ||
| } | ||
| export { UseBaseQueryOptions } | ||
| export { UseBaseQueryOptions as UseBaseQueryOptions_alias_1 } | ||
| declare type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>; | ||
| export { UseBaseQueryResult } | ||
| export { UseBaseQueryResult as UseBaseQueryResult_alias_1 } | ||
| export declare const useClearResetErrorBoundary: (errorResetBoundary: QueryErrorResetBoundaryValue) => void; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): DefinedUseInfiniteQueryResult<TData, TError>; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>; | ||
| export { useInfiniteQuery } | ||
| export { useInfiniteQuery as useInfiniteQuery_alias_1 } | ||
| declare interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> { | ||
| /** | ||
| * Set this to `false` to unsubscribe this observer from updates to the query cache. | ||
| * Defaults to `true`. | ||
| */ | ||
| subscribed?: boolean; | ||
| } | ||
| export { UseInfiniteQueryOptions } | ||
| export { UseInfiniteQueryOptions as UseInfiniteQueryOptions_alias_1 } | ||
| declare type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>; | ||
| export { UseInfiniteQueryResult } | ||
| export { UseInfiniteQueryResult as UseInfiniteQueryResult_alias_1 } | ||
| declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number; | ||
| export { useIsFetching } | ||
| export { useIsFetching as useIsFetching_alias_1 } | ||
| declare function useIsMutating(filters?: MutationFilters, queryClient?: QueryClient): number; | ||
| export { useIsMutating } | ||
| export { useIsMutating as useIsMutating_alias_1 } | ||
| declare const useIsRestoring: () => boolean; | ||
| export { useIsRestoring } | ||
| export { useIsRestoring as useIsRestoring_alias_1 } | ||
| declare type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| export { UseMutateAsyncFunction } | ||
| export { UseMutateAsyncFunction as UseMutateAsyncFunction_alias_1 } | ||
| declare type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void; | ||
| export { UseMutateFunction } | ||
| export { UseMutateFunction as UseMutateFunction_alias_1 } | ||
| declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient): UseMutationResult<TData, TError, TVariables, TOnMutateResult>; | ||
| export { useMutation } | ||
| export { useMutation as useMutation_alias_1 } | ||
| declare interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>, '_defaulted'> { | ||
| } | ||
| export { UseMutationOptions } | ||
| export { UseMutationOptions as UseMutationOptions_alias_1 } | ||
| declare type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>; | ||
| export { UseMutationResult } | ||
| export { UseMutationResult as UseMutationResult_alias_1 } | ||
| declare function useMutationState<TResult = MutationState>(options?: MutationStateOptions<TResult>, queryClient?: QueryClient): Array<TResult>; | ||
| export { useMutationState } | ||
| export { useMutationState as useMutationState_alias_1 } | ||
| declare function usePrefetchInfiniteQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): void; | ||
| export { usePrefetchInfiniteQuery } | ||
| export { usePrefetchInfiniteQuery as usePrefetchInfiniteQuery_alias_1 } | ||
| declare function usePrefetchQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): void; | ||
| export { usePrefetchQuery } | ||
| export { usePrefetchQuery as usePrefetchQuery_alias_1 } | ||
| declare interface UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> { | ||
| queryFn?: Exclude<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>; | ||
| } | ||
| export { UsePrefetchQueryOptions } | ||
| export { UsePrefetchQueryOptions as UsePrefetchQueryOptions_alias_1 } | ||
| declare function useQueries<T extends Array<any>, TCombinedResult = QueriesResults<T>>({ queries, ...options }: { | ||
| queries: readonly [...QueriesOptions<T>] | readonly [...{ | ||
| [K in keyof T]: GetUseQueryOptionsForUseQueries<T[K]>; | ||
| }]; | ||
| combine?: (result: QueriesResults<T>) => TCombinedResult; | ||
| subscribed?: boolean; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| export { useQueries } | ||
| export { useQueries as useQueries_alias_1 } | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): DefinedUseQueryResult<NoInfer_2<TData>, TError>; | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseQueryResult<NoInfer_2<TData>, TError>; | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseQueryResult<NoInfer_2<TData>, TError>; | ||
| export { useQuery } | ||
| export { useQuery as useQuery_alias_1 } | ||
| declare const useQueryClient: (queryClient?: QueryClient) => QueryClient; | ||
| export { useQueryClient } | ||
| export { useQueryClient as useQueryClient_alias_1 } | ||
| declare const useQueryErrorResetBoundary: () => QueryErrorResetBoundaryValue; | ||
| export { useQueryErrorResetBoundary } | ||
| export { useQueryErrorResetBoundary as useQueryErrorResetBoundary_alias_1 } | ||
| declare interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> { | ||
| } | ||
| export { UseQueryOptions } | ||
| export { UseQueryOptions as UseQueryOptions_alias_1 } | ||
| declare type UseQueryOptionsForUseQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData' | 'subscribed'> & { | ||
| placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>; | ||
| }; | ||
| declare type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>; | ||
| export { UseQueryResult } | ||
| export { UseQueryResult as UseQueryResult_alias_1 } | ||
| declare function useSuspenseInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseSuspenseInfiniteQueryResult<TData, TError>; | ||
| export { useSuspenseInfiniteQuery } | ||
| export { useSuspenseInfiniteQuery as useSuspenseInfiniteQuery_alias_1 } | ||
| declare interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> { | ||
| queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken>; | ||
| } | ||
| export { UseSuspenseInfiniteQueryOptions } | ||
| export { UseSuspenseInfiniteQueryOptions as UseSuspenseInfiniteQueryOptions_alias_1 } | ||
| declare type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>; | ||
| export { UseSuspenseInfiniteQueryResult } | ||
| export { UseSuspenseInfiniteQueryResult as UseSuspenseInfiniteQueryResult_alias_1 } | ||
| declare function useSuspenseQueries<T extends Array<any>, TCombinedResult = SuspenseQueriesResults<T>>(options: { | ||
| queries: readonly [...SuspenseQueriesOptions<T>] | readonly [...{ | ||
| [K in keyof T]: GetUseSuspenseQueryOptions<T[K]>; | ||
| }]; | ||
| combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| declare function useSuspenseQueries<T extends Array<any>, TCombinedResult = SuspenseQueriesResults<T>>(options: { | ||
| queries: readonly [...SuspenseQueriesOptions<T>]; | ||
| combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| export { useSuspenseQueries } | ||
| export { useSuspenseQueries as useSuspenseQueries_alias_1 } | ||
| declare function useSuspenseQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseSuspenseQueryResult<TData, TError>; | ||
| export { useSuspenseQuery } | ||
| export { useSuspenseQuery as useSuspenseQuery_alias_1 } | ||
| declare interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> { | ||
| queryFn?: Exclude<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>; | ||
| } | ||
| export { UseSuspenseQueryOptions } | ||
| export { UseSuspenseQueryOptions as UseSuspenseQueryOptions_alias_1 } | ||
| declare type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>; | ||
| export { UseSuspenseQueryResult } | ||
| export { UseSuspenseQueryResult as UseSuspenseQueryResult_alias_1 } | ||
| export declare const willFetch: (result: QueryObserverResult<any, any>, isRestoring: boolean) => boolean; | ||
| export { WithRequired } | ||
| export { } |
| import { AnyDataTag } from '@tanstack/query-core'; | ||
| import { CancelledError } from '@tanstack/query-core'; | ||
| import { CancelOptions } from '@tanstack/query-core'; | ||
| import { DataTag } from '@tanstack/query-core'; | ||
| import { dataTagErrorSymbol } from '@tanstack/query-core'; | ||
| import { dataTagSymbol } from '@tanstack/query-core'; | ||
| import { DefaultedInfiniteQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { DefaultedQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { DefaultError } from '@tanstack/query-core'; | ||
| import { DefaultOptions } from '@tanstack/query-core'; | ||
| import { defaultScheduler } from '@tanstack/query-core'; | ||
| import { defaultShouldDehydrateMutation } from '@tanstack/query-core'; | ||
| import { defaultShouldDehydrateQuery } from '@tanstack/query-core'; | ||
| import { DefinedInfiniteQueryObserverResult } from '@tanstack/query-core'; | ||
| import { DefinedQueryObserverResult } from '@tanstack/query-core'; | ||
| import { dehydrate } from '@tanstack/query-core'; | ||
| import { DehydratedState } from '@tanstack/query-core'; | ||
| import { DehydrateOptions } from '@tanstack/query-core'; | ||
| import { DistributiveOmit } from '@tanstack/query-core'; | ||
| import { Enabled } from '@tanstack/query-core'; | ||
| import { EnsureInfiniteQueryDataOptions } from '@tanstack/query-core'; | ||
| import { EnsureQueryDataOptions } from '@tanstack/query-core'; | ||
| import { environmentManager } from '@tanstack/query-core'; | ||
| import { experimental_streamedQuery } from '@tanstack/query-core'; | ||
| import { FetchInfiniteQueryOptions } from '@tanstack/query-core'; | ||
| import { FetchNextPageOptions } from '@tanstack/query-core'; | ||
| import { FetchPreviousPageOptions } from '@tanstack/query-core'; | ||
| import { FetchQueryOptions } from '@tanstack/query-core'; | ||
| import { FetchStatus } from '@tanstack/query-core'; | ||
| import { focusManager } from '@tanstack/query-core'; | ||
| import { GetNextPageParamFunction } from '@tanstack/query-core'; | ||
| import { GetPreviousPageParamFunction } from '@tanstack/query-core'; | ||
| import { hashKey } from '@tanstack/query-core'; | ||
| import { hydrate } from '@tanstack/query-core'; | ||
| import { HydrateOptions } from '@tanstack/query-core'; | ||
| import { InferDataFromTag } from '@tanstack/query-core'; | ||
| import { InferErrorFromTag } from '@tanstack/query-core'; | ||
| import { InfiniteData } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserver } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverBaseResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverLoadingErrorResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverPendingResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverPlaceholderResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverRefetchErrorResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryPageParamsOptions } from '@tanstack/query-core'; | ||
| import { InitialDataFunction } from '@tanstack/query-core'; | ||
| import { InitialPageParam } from '@tanstack/query-core'; | ||
| import { InvalidateOptions } from '@tanstack/query-core'; | ||
| import { InvalidateQueryFilters } from '@tanstack/query-core'; | ||
| import { isCancelledError } from '@tanstack/query-core'; | ||
| import { isServer } from '@tanstack/query-core'; | ||
| import { JSX } from 'react/jsx-runtime'; | ||
| import { keepPreviousData } from '@tanstack/query-core'; | ||
| import { ManagedTimerId } from '@tanstack/query-core'; | ||
| import { matchMutation } from '@tanstack/query-core'; | ||
| import { matchQuery } from '@tanstack/query-core'; | ||
| import { MutateFunction } from '@tanstack/query-core'; | ||
| import { MutateOptions } from '@tanstack/query-core'; | ||
| import { Mutation } from '@tanstack/query-core'; | ||
| import { MutationCache } from '@tanstack/query-core'; | ||
| import { MutationCacheNotifyEvent } from '@tanstack/query-core'; | ||
| import { MutationFilters } from '@tanstack/query-core'; | ||
| import { MutationFunction } from '@tanstack/query-core'; | ||
| import { MutationFunctionContext } from '@tanstack/query-core'; | ||
| import { MutationKey } from '@tanstack/query-core'; | ||
| import { MutationMeta } from '@tanstack/query-core'; | ||
| import { MutationObserver as MutationObserver_2 } from '@tanstack/query-core'; | ||
| import { MutationObserverBaseResult } from '@tanstack/query-core'; | ||
| import { MutationObserverErrorResult } from '@tanstack/query-core'; | ||
| import { MutationObserverIdleResult } from '@tanstack/query-core'; | ||
| import { MutationObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { MutationObserverOptions } from '@tanstack/query-core'; | ||
| import { MutationObserverResult } from '@tanstack/query-core'; | ||
| import { MutationObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { MutationOptions } from '@tanstack/query-core'; | ||
| import { MutationScope } from '@tanstack/query-core'; | ||
| import { MutationState } from '@tanstack/query-core'; | ||
| import { MutationStatus } from '@tanstack/query-core'; | ||
| import { NetworkMode } from '@tanstack/query-core'; | ||
| import { NoInfer as NoInfer_2 } from '@tanstack/query-core'; | ||
| import { NonUndefinedGuard } from '@tanstack/query-core'; | ||
| import { noop } from '@tanstack/query-core'; | ||
| import { NotifyEvent } from '@tanstack/query-core'; | ||
| import { NotifyEventType } from '@tanstack/query-core'; | ||
| import { notifyManager } from '@tanstack/query-core'; | ||
| import { NotifyOnChangeProps } from '@tanstack/query-core'; | ||
| import { OmitKeyof } from '@tanstack/query-core'; | ||
| import { onlineManager } from '@tanstack/query-core'; | ||
| import { Options } from 'tsup'; | ||
| import { Override } from '@tanstack/query-core'; | ||
| import { partialMatchKey } from '@tanstack/query-core'; | ||
| import { PlaceholderDataFunction } from '@tanstack/query-core'; | ||
| import { QueriesObserver } from '@tanstack/query-core'; | ||
| import { QueriesObserverOptions } from '@tanstack/query-core'; | ||
| import { QueriesPlaceholderDataFunction } from '@tanstack/query-core'; | ||
| import { Query } from '@tanstack/query-core'; | ||
| import { QueryCache } from '@tanstack/query-core'; | ||
| import { QueryCacheNotifyEvent } from '@tanstack/query-core'; | ||
| import { QueryClient } from '@tanstack/query-core'; | ||
| import { QueryClientConfig } from '@tanstack/query-core'; | ||
| import { QueryFilters } from '@tanstack/query-core'; | ||
| import { QueryFunction } from '@tanstack/query-core'; | ||
| import { QueryFunctionContext } from '@tanstack/query-core'; | ||
| import { QueryKey } from '@tanstack/query-core'; | ||
| import { QueryKeyHashFunction } from '@tanstack/query-core'; | ||
| import { QueryMeta } from '@tanstack/query-core'; | ||
| import { QueryObserver } from '@tanstack/query-core'; | ||
| import { QueryObserverBaseResult } from '@tanstack/query-core'; | ||
| import { QueryObserverLoadingErrorResult } from '@tanstack/query-core'; | ||
| import { QueryObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { QueryObserverOptions } from '@tanstack/query-core'; | ||
| import { QueryObserverPendingResult } from '@tanstack/query-core'; | ||
| import { QueryObserverPlaceholderResult } from '@tanstack/query-core'; | ||
| import { QueryObserverRefetchErrorResult } from '@tanstack/query-core'; | ||
| import { QueryObserverResult } from '@tanstack/query-core'; | ||
| import { QueryObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { QueryOptions } from '@tanstack/query-core'; | ||
| import { QueryPersister } from '@tanstack/query-core'; | ||
| import { QueryState } from '@tanstack/query-core'; | ||
| import { QueryStatus } from '@tanstack/query-core'; | ||
| import * as React_2 from 'react'; | ||
| import { RefetchOptions } from '@tanstack/query-core'; | ||
| import { RefetchQueryFilters } from '@tanstack/query-core'; | ||
| import { Register } from '@tanstack/query-core'; | ||
| import { replaceEqualDeep } from '@tanstack/query-core'; | ||
| import { ResetOptions } from '@tanstack/query-core'; | ||
| import { ResultOptions } from '@tanstack/query-core'; | ||
| import { SetDataOptions } from '@tanstack/query-core'; | ||
| import { shouldThrowError } from '@tanstack/query-core'; | ||
| import { SkipToken } from '@tanstack/query-core'; | ||
| import { skipToken } from '@tanstack/query-core'; | ||
| import { StaleTime } from '@tanstack/query-core'; | ||
| import { StaleTimeFunction } from '@tanstack/query-core'; | ||
| import { ThrowOnError } from '@tanstack/query-core'; | ||
| import { TimeoutCallback } from '@tanstack/query-core'; | ||
| import { timeoutManager } from '@tanstack/query-core'; | ||
| import { TimeoutProvider } from '@tanstack/query-core'; | ||
| import { UnsetMarker } from '@tanstack/query-core'; | ||
| import { unsetMarker } from '@tanstack/query-core'; | ||
| import { Updater } from '@tanstack/query-core'; | ||
| import { UserConfig } from 'vite'; | ||
| import { WithRequired } from '@tanstack/query-core'; | ||
| export { AnyDataTag } | ||
| declare type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseBaseQueryOptions } | ||
| export { AnyUseBaseQueryOptions as AnyUseBaseQueryOptions_alias_1 } | ||
| declare type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseInfiniteQueryOptions } | ||
| export { AnyUseInfiniteQueryOptions as AnyUseInfiniteQueryOptions_alias_1 } | ||
| declare type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>; | ||
| export { AnyUseMutationOptions } | ||
| export { AnyUseMutationOptions as AnyUseMutationOptions_alias_1 } | ||
| declare type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>; | ||
| export { AnyUseQueryOptions } | ||
| export { AnyUseQueryOptions as AnyUseQueryOptions_alias_1 } | ||
| declare type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseSuspenseInfiniteQueryOptions } | ||
| export { AnyUseSuspenseInfiniteQueryOptions as AnyUseSuspenseInfiniteQueryOptions_alias_1 } | ||
| declare type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>; | ||
| export { AnyUseSuspenseQueryOptions } | ||
| export { AnyUseSuspenseQueryOptions as AnyUseSuspenseQueryOptions_alias_1 } | ||
| export { CancelledError } | ||
| export { CancelOptions } | ||
| export { DataTag } | ||
| export { dataTagErrorSymbol } | ||
| export { dataTagSymbol } | ||
| export declare const default_alias: any[]; | ||
| export declare const default_alias_1: any[]; | ||
| export declare const default_alias_2: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>); | ||
| export declare const default_alias_3: UserConfig; | ||
| export { DefaultedInfiniteQueryObserverOptions } | ||
| export { DefaultedQueryObserverOptions } | ||
| export { DefaultError } | ||
| export { DefaultOptions } | ||
| export { defaultScheduler } | ||
| export { defaultShouldDehydrateMutation } | ||
| export { defaultShouldDehydrateQuery } | ||
| export declare const defaultThrowOnError: <TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(_error: TError, query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean; | ||
| export { DefinedInfiniteQueryObserverResult } | ||
| declare type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined; | ||
| }; | ||
| export { DefinedInitialDataInfiniteOptions } | ||
| export { DefinedInitialDataInfiniteOptions as DefinedInitialDataInfiniteOptions_alias_1 } | ||
| declare type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & { | ||
| initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>); | ||
| queryFn?: QueryFunction<TQueryFnData, TQueryKey>; | ||
| }; | ||
| export { DefinedInitialDataOptions } | ||
| export { DefinedInitialDataOptions as DefinedInitialDataOptions_alias_1 } | ||
| export { DefinedQueryObserverResult } | ||
| declare type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>; | ||
| export { DefinedUseInfiniteQueryResult } | ||
| export { DefinedUseInfiniteQueryResult as DefinedUseInfiniteQueryResult_alias_1 } | ||
| declare type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>; | ||
| export { DefinedUseQueryResult } | ||
| export { DefinedUseQueryResult as DefinedUseQueryResult_alias_1 } | ||
| export { dehydrate } | ||
| export { DehydratedState } | ||
| export { DehydrateOptions } | ||
| export { DistributiveOmit } | ||
| export { Enabled } | ||
| export { EnsureInfiniteQueryDataOptions } | ||
| export declare const ensurePreventErrorBoundaryRetry: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue, query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined) => void; | ||
| export { EnsureQueryDataOptions } | ||
| export declare const ensureSuspenseTimers: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void; | ||
| export { environmentManager } | ||
| export { experimental_streamedQuery } | ||
| export { FetchInfiniteQueryOptions } | ||
| export { FetchNextPageOptions } | ||
| export declare const fetchOptimistic: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(defaultedOptions: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue) => Promise<void | QueryObserverResult<TData, TError>>; | ||
| export { FetchPreviousPageOptions } | ||
| export { FetchQueryOptions } | ||
| export { FetchStatus } | ||
| export { focusManager } | ||
| declare type GetDefinedOrUndefinedQueryResult<T, TData, TError = unknown> = T extends { | ||
| initialData?: infer TInitialData; | ||
| } ? unknown extends TInitialData ? UseQueryResult<TData, TError> : TInitialData extends TData ? DefinedUseQueryResult<TData, TError> : TInitialData extends () => infer TInitialDataResult ? unknown extends TInitialDataResult ? UseQueryResult<TData, TError> : TInitialDataResult extends TData ? DefinedUseQueryResult<TData, TError> : UseQueryResult<TData, TError> : UseQueryResult<TData, TError> : UseQueryResult<TData, TError>; | ||
| export declare const getHasError: <TData, TError, TQueryFnData, TQueryData, TQueryKey extends QueryKey>({ result, errorResetBoundary, throwOnError, query, suspense, }: { | ||
| result: QueryObserverResult<TData, TError>; | ||
| errorResetBoundary: QueryErrorResetBoundaryValue; | ||
| throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>; | ||
| query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined; | ||
| suspense: boolean | undefined; | ||
| }) => boolean | undefined; | ||
| export { GetNextPageParamFunction } | ||
| export { GetPreviousPageParamFunction } | ||
| declare type GetUseQueryOptionsForUseQueries<T> = T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseQueryOptionsForUseQueries<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? UseQueryOptionsForUseQueries<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseQueryOptionsForUseQueries<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, unknown extends TError ? DefaultError : TError, unknown extends TData ? TQueryFnData : TData, TQueryKey> : UseQueryOptionsForUseQueries; | ||
| declare type GetUseQueryResult<T> = T extends { | ||
| queryFnData: any; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends [any, infer TError, infer TData] ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends [infer TQueryFnData, infer TError] ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError> : T extends [infer TQueryFnData] ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : UseQueryResult; | ||
| declare type GetUseSuspenseQueryOptions<T> = T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TData> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryOptions<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? UseSuspenseQueryOptions<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? UseSuspenseQueryOptions<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseSuspenseQueryOptions<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries_2; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries_2; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TQueryFnData, TQueryKey> : UseSuspenseQueryOptions; | ||
| declare type GetUseSuspenseQueryResult<T> = T extends { | ||
| queryFnData: any; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseSuspenseQueryResult<TData, TError> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryResult<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryResult<TData, TError> : T extends [any, infer TError, infer TData] ? UseSuspenseQueryResult<TData, TError> : T extends [infer TQueryFnData, infer TError] ? UseSuspenseQueryResult<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseSuspenseQueryResult<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries_2; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryResult<unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries_2; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryResult<TQueryFnData, unknown extends TError ? DefaultError : TError> : UseSuspenseQueryResult; | ||
| export { hashKey } | ||
| export { hydrate } | ||
| export { HydrateOptions } | ||
| declare const HydrationBoundary: ({ children, options, state, queryClient, }: HydrationBoundaryProps) => React_2.ReactElement; | ||
| export { HydrationBoundary } | ||
| export { HydrationBoundary as HydrationBoundary_alias_1 } | ||
| declare interface HydrationBoundaryProps { | ||
| state: DehydratedState | null | undefined; | ||
| options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & { | ||
| defaultOptions?: OmitKeyof<Exclude<HydrateOptions['defaultOptions'], undefined>, 'mutations'>; | ||
| }; | ||
| children?: React_2.ReactNode; | ||
| queryClient?: QueryClient; | ||
| } | ||
| export { HydrationBoundaryProps } | ||
| export { HydrationBoundaryProps as HydrationBoundaryProps_alias_1 } | ||
| export { InferDataFromTag } | ||
| export { InferErrorFromTag } | ||
| export { InfiniteData } | ||
| export { InfiniteQueryObserver } | ||
| export { InfiniteQueryObserverBaseResult } | ||
| export { InfiniteQueryObserverLoadingErrorResult } | ||
| export { InfiniteQueryObserverLoadingResult } | ||
| export { InfiniteQueryObserverOptions } | ||
| export { InfiniteQueryObserverPendingResult } | ||
| export { InfiniteQueryObserverPlaceholderResult } | ||
| export { InfiniteQueryObserverRefetchErrorResult } | ||
| export { InfiniteQueryObserverResult } | ||
| export { InfiniteQueryObserverSuccessResult } | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| export { infiniteQueryOptions } | ||
| export { infiniteQueryOptions as infiniteQueryOptions_alias_1 } | ||
| export { InfiniteQueryPageParamsOptions } | ||
| export { InitialDataFunction } | ||
| export { InitialPageParam } | ||
| export { InvalidateOptions } | ||
| export { InvalidateQueryFilters } | ||
| export { isCancelledError } | ||
| declare const IsRestoringProvider: React_2.Provider<boolean>; | ||
| export { IsRestoringProvider } | ||
| export { IsRestoringProvider as IsRestoringProvider_alias_1 } | ||
| export { isServer } | ||
| export { keepPreviousData } | ||
| /** | ||
| * @param {Object} opts - Options for building configurations. | ||
| * @param {string[]} opts.entry - The entry array. | ||
| * @returns {import('tsup').Options} | ||
| */ | ||
| export declare function legacyConfig(opts: { | ||
| entry: string[]; | ||
| }): Options; | ||
| export { ManagedTimerId } | ||
| export { matchMutation } | ||
| export { matchQuery } | ||
| declare type MAXIMUM_DEPTH = 20; | ||
| declare type MAXIMUM_DEPTH_2 = 20; | ||
| /** | ||
| * @param {Object} opts - Options for building configurations. | ||
| * @param {string[]} opts.entry - The entry array. | ||
| * @returns {import('tsup').Options} | ||
| */ | ||
| export declare function modernConfig(opts: { | ||
| entry: string[]; | ||
| }): Options; | ||
| export { MutateFunction } | ||
| export { MutateOptions } | ||
| export { Mutation } | ||
| export { MutationCache } | ||
| export { MutationCacheNotifyEvent } | ||
| export { MutationFilters } | ||
| export { MutationFunction } | ||
| export { MutationFunctionContext } | ||
| export { MutationKey } | ||
| export { MutationMeta } | ||
| export { MutationObserver_2 as MutationObserver } | ||
| export { MutationObserverBaseResult } | ||
| export { MutationObserverErrorResult } | ||
| export { MutationObserverIdleResult } | ||
| export { MutationObserverLoadingResult } | ||
| export { MutationObserverOptions } | ||
| export { MutationObserverResult } | ||
| export { MutationObserverSuccessResult } | ||
| export { MutationOptions } | ||
| declare function mutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: WithRequired<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>): WithRequired<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>; | ||
| declare function mutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: Omit<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>): Omit<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>; | ||
| export { mutationOptions } | ||
| export { mutationOptions as mutationOptions_alias_1 } | ||
| export { MutationScope } | ||
| export { MutationState } | ||
| declare type MutationStateOptions<TResult = MutationState> = { | ||
| filters?: MutationFilters; | ||
| select?: (mutation: Mutation) => TResult; | ||
| }; | ||
| export { MutationStatus } | ||
| export { NetworkMode } | ||
| export { NoInfer_2 as NoInfer } | ||
| export { NonUndefinedGuard } | ||
| export { noop } | ||
| export { NotifyEvent } | ||
| export { NotifyEventType } | ||
| export { notifyManager } | ||
| export { NotifyOnChangeProps } | ||
| export { OmitKeyof } | ||
| export { onlineManager } | ||
| export { Override } | ||
| export { partialMatchKey } | ||
| export { PlaceholderDataFunction } | ||
| export { QueriesObserver } | ||
| export { QueriesObserverOptions } | ||
| /** | ||
| * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
| */ | ||
| declare type QueriesOptions<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryOptionsForUseQueries> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryOptionsForUseQueries<Head>] : T extends [infer Head, ...infer Tails] ? QueriesOptions<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseQueryOptionsForUseQueries<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : ReadonlyArray<unknown> extends T ? T : T extends Array<UseQueryOptionsForUseQueries<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<UseQueryOptionsForUseQueries<TQueryFnData, TError, TData, TQueryKey>> : Array<UseQueryOptionsForUseQueries>; | ||
| export { QueriesOptions } | ||
| export { QueriesOptions as QueriesOptions_alias_1 } | ||
| export { QueriesPlaceholderDataFunction } | ||
| /** | ||
| * QueriesResults reducer recursively maps type param to results | ||
| */ | ||
| declare type QueriesResults<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryResult<Head>] : T extends [infer Head, ...infer Tails] ? QueriesResults<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseQueryResult<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : { | ||
| [K in keyof T]: GetUseQueryResult<T[K]>; | ||
| }; | ||
| export { QueriesResults } | ||
| export { QueriesResults as QueriesResults_alias_1 } | ||
| export { Query } | ||
| export { QueryCache } | ||
| export { QueryCacheNotifyEvent } | ||
| export { QueryClient } | ||
| export { QueryClientConfig } | ||
| declare const QueryClientContext: React_2.Context<QueryClient | undefined>; | ||
| export { QueryClientContext } | ||
| export { QueryClientContext as QueryClientContext_alias_1 } | ||
| declare const QueryClientProvider: ({ client, children, }: QueryClientProviderProps) => React_2.JSX.Element; | ||
| export { QueryClientProvider } | ||
| export { QueryClientProvider as QueryClientProvider_alias_1 } | ||
| declare type QueryClientProviderProps = { | ||
| client: QueryClient; | ||
| children?: React_2.ReactNode; | ||
| }; | ||
| export { QueryClientProviderProps } | ||
| export { QueryClientProviderProps as QueryClientProviderProps_alias_1 } | ||
| declare type QueryErrorClearResetFunction = () => void; | ||
| export { QueryErrorClearResetFunction } | ||
| export { QueryErrorClearResetFunction as QueryErrorClearResetFunction_alias_1 } | ||
| declare type QueryErrorIsResetFunction = () => boolean; | ||
| export { QueryErrorIsResetFunction } | ||
| export { QueryErrorIsResetFunction as QueryErrorIsResetFunction_alias_1 } | ||
| declare const QueryErrorResetBoundary: ({ children, }: QueryErrorResetBoundaryProps) => JSX.Element; | ||
| export { QueryErrorResetBoundary } | ||
| export { QueryErrorResetBoundary as QueryErrorResetBoundary_alias_1 } | ||
| declare type QueryErrorResetBoundaryFunction = (value: QueryErrorResetBoundaryValue) => React_2.ReactNode; | ||
| export { QueryErrorResetBoundaryFunction } | ||
| export { QueryErrorResetBoundaryFunction as QueryErrorResetBoundaryFunction_alias_1 } | ||
| declare interface QueryErrorResetBoundaryProps { | ||
| children: QueryErrorResetBoundaryFunction | React_2.ReactNode; | ||
| } | ||
| export { QueryErrorResetBoundaryProps } | ||
| export { QueryErrorResetBoundaryProps as QueryErrorResetBoundaryProps_alias_1 } | ||
| export declare interface QueryErrorResetBoundaryValue { | ||
| clearReset: QueryErrorClearResetFunction; | ||
| isReset: QueryErrorIsResetFunction; | ||
| reset: QueryErrorResetFunction; | ||
| } | ||
| declare type QueryErrorResetFunction = () => void; | ||
| export { QueryErrorResetFunction } | ||
| export { QueryErrorResetFunction as QueryErrorResetFunction_alias_1 } | ||
| export { QueryFilters } | ||
| export { QueryFunction } | ||
| export { QueryFunctionContext } | ||
| export { QueryKey } | ||
| export { QueryKeyHashFunction } | ||
| export { QueryMeta } | ||
| export { QueryObserver } | ||
| export { QueryObserverBaseResult } | ||
| export { QueryObserverLoadingErrorResult } | ||
| export { QueryObserverLoadingResult } | ||
| export { QueryObserverOptions } | ||
| export { QueryObserverPendingResult } | ||
| export { QueryObserverPlaceholderResult } | ||
| export { QueryObserverRefetchErrorResult } | ||
| export { QueryObserverResult } | ||
| export { QueryObserverSuccessResult } | ||
| export { QueryOptions } | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| export { queryOptions } | ||
| export { queryOptions as queryOptions_alias_1 } | ||
| export { QueryPersister } | ||
| export { QueryState } | ||
| export { QueryStatus } | ||
| export { RefetchOptions } | ||
| export { RefetchQueryFilters } | ||
| export { Register } | ||
| export { replaceEqualDeep } | ||
| export { ResetOptions } | ||
| export { ResultOptions } | ||
| export { SetDataOptions } | ||
| export declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any> | undefined, result: QueryObserverResult<any, any>) => boolean | undefined; | ||
| export { shouldThrowError } | ||
| export { SkipToken } | ||
| export { skipToken } | ||
| declare type SkipTokenForUseQueries = symbol; | ||
| declare type SkipTokenForUseQueries_2 = symbol; | ||
| export { StaleTime } | ||
| export { StaleTimeFunction } | ||
| /** | ||
| * SuspenseQueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
| */ | ||
| declare type SuspenseQueriesOptions<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH_2 ? Array<UseSuspenseQueryOptions> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseSuspenseQueryOptions<Head>] : T extends [infer Head, ...infer Tails] ? SuspenseQueriesOptions<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseSuspenseQueryOptions<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : Array<unknown> extends T ? T : T extends Array<UseSuspenseQueryOptions<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>> : Array<UseSuspenseQueryOptions>; | ||
| export { SuspenseQueriesOptions } | ||
| export { SuspenseQueriesOptions as SuspenseQueriesOptions_alias_1 } | ||
| /** | ||
| * SuspenseQueriesResults reducer recursively maps type param to results | ||
| */ | ||
| declare type SuspenseQueriesResults<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH_2 ? Array<UseSuspenseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseSuspenseQueryResult<Head>] : T extends [infer Head, ...infer Tails] ? SuspenseQueriesResults<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseSuspenseQueryResult<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : { | ||
| [K in keyof T]: GetUseSuspenseQueryResult<T[K]>; | ||
| }; | ||
| export { SuspenseQueriesResults } | ||
| export { SuspenseQueriesResults as SuspenseQueriesResults_alias_1 } | ||
| export { ThrowOnError } | ||
| export { TimeoutCallback } | ||
| export { timeoutManager } | ||
| export { TimeoutProvider } | ||
| declare type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| initialData?: undefined | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | InitialDataFunction<NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>>; | ||
| }; | ||
| export { UndefinedInitialDataInfiniteOptions } | ||
| export { UndefinedInitialDataInfiniteOptions as UndefinedInitialDataInfiniteOptions_alias_1 } | ||
| declare type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>> | NonUndefinedGuard<TQueryFnData>; | ||
| }; | ||
| export { UndefinedInitialDataOptions } | ||
| export { UndefinedInitialDataOptions as UndefinedInitialDataOptions_alias_1 } | ||
| export { UnsetMarker } | ||
| export { unsetMarker } | ||
| declare type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & { | ||
| queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>; | ||
| }; | ||
| export { UnusedSkipTokenInfiniteOptions } | ||
| export { UnusedSkipTokenInfiniteOptions as UnusedSkipTokenInfiniteOptions_alias_1 } | ||
| declare type UnusedSkipTokenOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & { | ||
| queryFn?: Exclude<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken | undefined>; | ||
| }; | ||
| export { UnusedSkipTokenOptions } | ||
| export { UnusedSkipTokenOptions as UnusedSkipTokenOptions_alias_1 } | ||
| export { Updater } | ||
| declare type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, { | ||
| mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| }> & { | ||
| mutateAsync: UseMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| }; | ||
| export { UseBaseMutationResult } | ||
| export { UseBaseMutationResult as UseBaseMutationResult_alias_1 } | ||
| export declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, Observer: typeof QueryObserver, queryClient?: QueryClient): QueryObserverResult<TData, TError>; | ||
| declare interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> { | ||
| /** | ||
| * Set this to `false` to unsubscribe this observer from updates to the query cache. | ||
| * Defaults to `true`. | ||
| */ | ||
| subscribed?: boolean; | ||
| } | ||
| export { UseBaseQueryOptions } | ||
| export { UseBaseQueryOptions as UseBaseQueryOptions_alias_1 } | ||
| declare type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>; | ||
| export { UseBaseQueryResult } | ||
| export { UseBaseQueryResult as UseBaseQueryResult_alias_1 } | ||
| export declare const useClearResetErrorBoundary: (errorResetBoundary: QueryErrorResetBoundaryValue) => void; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): DefinedUseInfiniteQueryResult<TData, TError>; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>; | ||
| export { useInfiniteQuery } | ||
| export { useInfiniteQuery as useInfiniteQuery_alias_1 } | ||
| declare interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> { | ||
| /** | ||
| * Set this to `false` to unsubscribe this observer from updates to the query cache. | ||
| * Defaults to `true`. | ||
| */ | ||
| subscribed?: boolean; | ||
| } | ||
| export { UseInfiniteQueryOptions } | ||
| export { UseInfiniteQueryOptions as UseInfiniteQueryOptions_alias_1 } | ||
| declare type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>; | ||
| export { UseInfiniteQueryResult } | ||
| export { UseInfiniteQueryResult as UseInfiniteQueryResult_alias_1 } | ||
| declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number; | ||
| export { useIsFetching } | ||
| export { useIsFetching as useIsFetching_alias_1 } | ||
| declare function useIsMutating(filters?: MutationFilters, queryClient?: QueryClient): number; | ||
| export { useIsMutating } | ||
| export { useIsMutating as useIsMutating_alias_1 } | ||
| declare const useIsRestoring: () => boolean; | ||
| export { useIsRestoring } | ||
| export { useIsRestoring as useIsRestoring_alias_1 } | ||
| declare type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| export { UseMutateAsyncFunction } | ||
| export { UseMutateAsyncFunction as UseMutateAsyncFunction_alias_1 } | ||
| declare type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void; | ||
| export { UseMutateFunction } | ||
| export { UseMutateFunction as UseMutateFunction_alias_1 } | ||
| declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient): UseMutationResult<TData, TError, TVariables, TOnMutateResult>; | ||
| export { useMutation } | ||
| export { useMutation as useMutation_alias_1 } | ||
| declare interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>, '_defaulted'> { | ||
| } | ||
| export { UseMutationOptions } | ||
| export { UseMutationOptions as UseMutationOptions_alias_1 } | ||
| declare type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>; | ||
| export { UseMutationResult } | ||
| export { UseMutationResult as UseMutationResult_alias_1 } | ||
| declare function useMutationState<TResult = MutationState>(options?: MutationStateOptions<TResult>, queryClient?: QueryClient): Array<TResult>; | ||
| export { useMutationState } | ||
| export { useMutationState as useMutationState_alias_1 } | ||
| declare function usePrefetchInfiniteQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): void; | ||
| export { usePrefetchInfiniteQuery } | ||
| export { usePrefetchInfiniteQuery as usePrefetchInfiniteQuery_alias_1 } | ||
| declare function usePrefetchQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): void; | ||
| export { usePrefetchQuery } | ||
| export { usePrefetchQuery as usePrefetchQuery_alias_1 } | ||
| declare interface UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> { | ||
| queryFn?: Exclude<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>; | ||
| } | ||
| export { UsePrefetchQueryOptions } | ||
| export { UsePrefetchQueryOptions as UsePrefetchQueryOptions_alias_1 } | ||
| declare function useQueries<T extends Array<any>, TCombinedResult = QueriesResults<T>>({ queries, ...options }: { | ||
| queries: readonly [...QueriesOptions<T>] | readonly [...{ | ||
| [K in keyof T]: GetUseQueryOptionsForUseQueries<T[K]>; | ||
| }]; | ||
| combine?: (result: QueriesResults<T>) => TCombinedResult; | ||
| subscribed?: boolean; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| export { useQueries } | ||
| export { useQueries as useQueries_alias_1 } | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): DefinedUseQueryResult<NoInfer_2<TData>, TError>; | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseQueryResult<NoInfer_2<TData>, TError>; | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseQueryResult<NoInfer_2<TData>, TError>; | ||
| export { useQuery } | ||
| export { useQuery as useQuery_alias_1 } | ||
| declare const useQueryClient: (queryClient?: QueryClient) => QueryClient; | ||
| export { useQueryClient } | ||
| export { useQueryClient as useQueryClient_alias_1 } | ||
| declare const useQueryErrorResetBoundary: () => QueryErrorResetBoundaryValue; | ||
| export { useQueryErrorResetBoundary } | ||
| export { useQueryErrorResetBoundary as useQueryErrorResetBoundary_alias_1 } | ||
| declare interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> { | ||
| } | ||
| export { UseQueryOptions } | ||
| export { UseQueryOptions as UseQueryOptions_alias_1 } | ||
| declare type UseQueryOptionsForUseQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData' | 'subscribed'> & { | ||
| placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>; | ||
| }; | ||
| declare type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>; | ||
| export { UseQueryResult } | ||
| export { UseQueryResult as UseQueryResult_alias_1 } | ||
| declare function useSuspenseInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseSuspenseInfiniteQueryResult<TData, TError>; | ||
| export { useSuspenseInfiniteQuery } | ||
| export { useSuspenseInfiniteQuery as useSuspenseInfiniteQuery_alias_1 } | ||
| declare interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> { | ||
| queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken>; | ||
| } | ||
| export { UseSuspenseInfiniteQueryOptions } | ||
| export { UseSuspenseInfiniteQueryOptions as UseSuspenseInfiniteQueryOptions_alias_1 } | ||
| declare type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>; | ||
| export { UseSuspenseInfiniteQueryResult } | ||
| export { UseSuspenseInfiniteQueryResult as UseSuspenseInfiniteQueryResult_alias_1 } | ||
| declare function useSuspenseQueries<T extends Array<any>, TCombinedResult = SuspenseQueriesResults<T>>(options: { | ||
| queries: readonly [...SuspenseQueriesOptions<T>] | readonly [...{ | ||
| [K in keyof T]: GetUseSuspenseQueryOptions<T[K]>; | ||
| }]; | ||
| combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| declare function useSuspenseQueries<T extends Array<any>, TCombinedResult = SuspenseQueriesResults<T>>(options: { | ||
| queries: readonly [...SuspenseQueriesOptions<T>]; | ||
| combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| export { useSuspenseQueries } | ||
| export { useSuspenseQueries as useSuspenseQueries_alias_1 } | ||
| declare function useSuspenseQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseSuspenseQueryResult<TData, TError>; | ||
| export { useSuspenseQuery } | ||
| export { useSuspenseQuery as useSuspenseQuery_alias_1 } | ||
| declare interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> { | ||
| queryFn?: Exclude<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>; | ||
| } | ||
| export { UseSuspenseQueryOptions } | ||
| export { UseSuspenseQueryOptions as UseSuspenseQueryOptions_alias_1 } | ||
| declare type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>; | ||
| export { UseSuspenseQueryResult } | ||
| export { UseSuspenseQueryResult as UseSuspenseQueryResult_alias_1 } | ||
| export declare const willFetch: (result: QueryObserverResult<any, any>, isRestoring: boolean) => boolean; | ||
| export { WithRequired } | ||
| export { } |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/errorBoundaryUtils.ts | ||
| var errorBoundaryUtils_exports = {}; | ||
| __export(errorBoundaryUtils_exports, { | ||
| ensurePreventErrorBoundaryRetry: () => ensurePreventErrorBoundaryRetry, | ||
| getHasError: () => getHasError, | ||
| useClearResetErrorBoundary: () => useClearResetErrorBoundary | ||
| }); | ||
| module.exports = __toCommonJS(errorBoundaryUtils_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => { | ||
| const throwOnError = (query == null ? void 0 : query.state.error) && typeof options.throwOnError === "function" ? (0, import_query_core.shouldThrowError)(options.throwOnError, [query.state.error, query]) : options.throwOnError; | ||
| if (options.suspense || options.experimental_prefetchInRender || throwOnError) { | ||
| if (!errorResetBoundary.isReset()) { | ||
| options.retryOnMount = false; | ||
| } | ||
| } | ||
| }; | ||
| var useClearResetErrorBoundary = (errorResetBoundary) => { | ||
| React.useEffect(() => { | ||
| errorResetBoundary.clearReset(); | ||
| }, [errorResetBoundary]); | ||
| }; | ||
| var getHasError = ({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError, | ||
| query, | ||
| suspense | ||
| }) => { | ||
| return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || (0, import_query_core.shouldThrowError)(throwOnError, [result.error, query])); | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| ensurePreventErrorBoundaryRetry, | ||
| getHasError, | ||
| useClearResetErrorBoundary | ||
| }); | ||
| //# sourceMappingURL=errorBoundaryUtils.cjs.map |
| {"version":3,"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => {\n const throwOnError =\n query?.state.error && typeof options.throwOnError === 'function'\n ? shouldThrowError(options.throwOnError, [query.state.error, query])\n : options.throwOnError\n\n if (\n options.suspense ||\n options.experimental_prefetchInRender ||\n throwOnError\n ) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,wBAAiC;AAU1B,IAAM,kCAAkC,CAO7C,SAOA,oBACA,UACG;AACH,QAAM,gBACJ,+BAAO,MAAM,UAAS,OAAO,QAAQ,iBAAiB,iBAClD,oCAAiB,QAAQ,cAAc,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,IACjE,QAAQ;AAEd,MACE,QAAQ,YACR,QAAQ,iCACR,cACA;AAEA,QAAI,CAAC,mBAAmB,QAAQ,GAAG;AACjC,cAAQ,eAAe;AAAA,IACzB;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,CACxC,uBACG;AACH,EAAM,gBAAU,MAAM;AACpB,uBAAmB,WAAW;AAAA,EAChC,GAAG,CAAC,kBAAkB,CAAC;AACzB;AAEO,IAAM,cAAc,CAMzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAMM;AACJ,SACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,cAC5B,oCAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D;","names":[]} |
| export { ensurePreventErrorBoundaryRetry } from './_tsup-dts-rollup.cjs'; | ||
| export { useClearResetErrorBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { getHasError } from './_tsup-dts-rollup.cjs'; |
| export { ensurePreventErrorBoundaryRetry } from './_tsup-dts-rollup.js'; | ||
| export { useClearResetErrorBoundary } from './_tsup-dts-rollup.js'; | ||
| export { getHasError } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/errorBoundaryUtils.ts | ||
| import * as React from "react"; | ||
| import { shouldThrowError } from "@tanstack/query-core"; | ||
| var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => { | ||
| const throwOnError = (query == null ? void 0 : query.state.error) && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError; | ||
| if (options.suspense || options.experimental_prefetchInRender || throwOnError) { | ||
| if (!errorResetBoundary.isReset()) { | ||
| options.retryOnMount = false; | ||
| } | ||
| } | ||
| }; | ||
| var useClearResetErrorBoundary = (errorResetBoundary) => { | ||
| React.useEffect(() => { | ||
| errorResetBoundary.clearReset(); | ||
| }, [errorResetBoundary]); | ||
| }; | ||
| var getHasError = ({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError, | ||
| query, | ||
| suspense | ||
| }) => { | ||
| return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query])); | ||
| }; | ||
| export { | ||
| ensurePreventErrorBoundaryRetry, | ||
| getHasError, | ||
| useClearResetErrorBoundary | ||
| }; | ||
| //# sourceMappingURL=errorBoundaryUtils.js.map |
| {"version":3,"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => {\n const throwOnError =\n query?.state.error && typeof options.throwOnError === 'function'\n ? shouldThrowError(options.throwOnError, [query.state.error, query])\n : options.throwOnError\n\n if (\n options.suspense ||\n options.experimental_prefetchInRender ||\n throwOnError\n ) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB,SAAS,wBAAwB;AAU1B,IAAM,kCAAkC,CAO7C,SAOA,oBACA,UACG;AACH,QAAM,gBACJ,+BAAO,MAAM,UAAS,OAAO,QAAQ,iBAAiB,aAClD,iBAAiB,QAAQ,cAAc,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,IACjE,QAAQ;AAEd,MACE,QAAQ,YACR,QAAQ,iCACR,cACA;AAEA,QAAI,CAAC,mBAAmB,QAAQ,GAAG;AACjC,cAAQ,eAAe;AAAA,IACzB;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,CACxC,uBACG;AACH,EAAM,gBAAU,MAAM;AACpB,uBAAmB,WAAW;AAAA,EAChC,GAAG,CAAC,kBAAkB,CAAC;AACzB;AAEO,IAAM,cAAc,CAMzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAMM;AACJ,SACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,UAC5B,iBAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/HydrationBoundary.tsx | ||
| var HydrationBoundary_exports = {}; | ||
| __export(HydrationBoundary_exports, { | ||
| HydrationBoundary: () => HydrationBoundary | ||
| }); | ||
| module.exports = __toCommonJS(HydrationBoundary_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| var HydrationBoundary = ({ | ||
| children, | ||
| options = {}, | ||
| state, | ||
| queryClient | ||
| }) => { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const optionsRef = React.useRef(options); | ||
| React.useEffect(() => { | ||
| optionsRef.current = options; | ||
| }); | ||
| const hydrationQueue = React.useMemo(() => { | ||
| if (state) { | ||
| if (typeof state !== "object") { | ||
| return; | ||
| } | ||
| const queryCache = client.getQueryCache(); | ||
| const queries = state.queries || []; | ||
| const newQueries = []; | ||
| const existingQueries = []; | ||
| for (const dehydratedQuery of queries) { | ||
| const existingQuery = queryCache.get(dehydratedQuery.queryHash); | ||
| if (!existingQuery) { | ||
| newQueries.push(dehydratedQuery); | ||
| } else { | ||
| const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt; | ||
| if (hydrationIsNewer) { | ||
| existingQueries.push(dehydratedQuery); | ||
| } | ||
| } | ||
| } | ||
| if (newQueries.length > 0) { | ||
| (0, import_query_core.hydrate)(client, { queries: newQueries }, optionsRef.current); | ||
| } | ||
| if (existingQueries.length > 0) { | ||
| return existingQueries; | ||
| } | ||
| } | ||
| return void 0; | ||
| }, [client, state]); | ||
| React.useEffect(() => { | ||
| if (hydrationQueue) { | ||
| (0, import_query_core.hydrate)(client, { queries: hydrationQueue }, optionsRef.current); | ||
| } | ||
| }, [client, hydrationQueue]); | ||
| return children; | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| HydrationBoundary | ||
| }); | ||
| //# sourceMappingURL=HydrationBoundary.cjs.map |
| {"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAAwB;AACxB,iCAA+B;AAoBxB,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,aAAS,2CAAe,WAAW;AAEzC,QAAM,aAAmB,aAAO,OAAO;AACvC,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAiBD,QAAM,iBACE,cAAQ,MAAM;AAClB,QAAI,OAAO;AACT,UAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,MACF;AAEA,YAAM,aAAa,OAAO,cAAc;AAKxC,YAAM,UAAU,MAAM,WAAW,CAAC;AAElC,YAAM,aAAyC,CAAC;AAChD,YAAM,kBAA8C,CAAC;AACrD,iBAAW,mBAAmB,SAAS;AACrC,cAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;AAE9D,YAAI,CAAC,eAAe;AAClB,qBAAW,KAAK,eAAe;AAAA,QACjC,OAAO;AACL,gBAAM,mBACJ,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,UACjC,gBAAgB,eACd,cAAc,MAAM;AAE1B,cAAI,kBAAkB;AACpB,4BAAgB,KAAK,eAAe;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAEA,UAAI,WAAW,SAAS,GAAG;AAIzB,uCAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;AAAA,MAC7D;AACA,UAAI,gBAAgB,SAAS,GAAG;AAC9B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,KAAK,CAAC;AAEpB,EAAM,gBAAU,MAAM;AACpB,QAAI,gBAAgB;AAClB,qCAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO;AACT;","names":[]} |
| export { HydrationBoundaryProps } from './_tsup-dts-rollup.cjs'; | ||
| export { HydrationBoundary } from './_tsup-dts-rollup.cjs'; |
| export { HydrationBoundaryProps } from './_tsup-dts-rollup.js'; | ||
| export { HydrationBoundary } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/HydrationBoundary.tsx | ||
| import * as React from "react"; | ||
| import { hydrate } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| var HydrationBoundary = ({ | ||
| children, | ||
| options = {}, | ||
| state, | ||
| queryClient | ||
| }) => { | ||
| const client = useQueryClient(queryClient); | ||
| const optionsRef = React.useRef(options); | ||
| React.useEffect(() => { | ||
| optionsRef.current = options; | ||
| }); | ||
| const hydrationQueue = React.useMemo(() => { | ||
| if (state) { | ||
| if (typeof state !== "object") { | ||
| return; | ||
| } | ||
| const queryCache = client.getQueryCache(); | ||
| const queries = state.queries || []; | ||
| const newQueries = []; | ||
| const existingQueries = []; | ||
| for (const dehydratedQuery of queries) { | ||
| const existingQuery = queryCache.get(dehydratedQuery.queryHash); | ||
| if (!existingQuery) { | ||
| newQueries.push(dehydratedQuery); | ||
| } else { | ||
| const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt; | ||
| if (hydrationIsNewer) { | ||
| existingQueries.push(dehydratedQuery); | ||
| } | ||
| } | ||
| } | ||
| if (newQueries.length > 0) { | ||
| hydrate(client, { queries: newQueries }, optionsRef.current); | ||
| } | ||
| if (existingQueries.length > 0) { | ||
| return existingQueries; | ||
| } | ||
| } | ||
| return void 0; | ||
| }, [client, state]); | ||
| React.useEffect(() => { | ||
| if (hydrationQueue) { | ||
| hydrate(client, { queries: hydrationQueue }, optionsRef.current); | ||
| } | ||
| }, [client, hydrationQueue]); | ||
| return children; | ||
| }; | ||
| export { | ||
| HydrationBoundary | ||
| }; | ||
| //# sourceMappingURL=HydrationBoundary.js.map |
| {"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAoBxB,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,SAAS,eAAe,WAAW;AAEzC,QAAM,aAAmB,aAAO,OAAO;AACvC,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAiBD,QAAM,iBACE,cAAQ,MAAM;AAClB,QAAI,OAAO;AACT,UAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,MACF;AAEA,YAAM,aAAa,OAAO,cAAc;AAKxC,YAAM,UAAU,MAAM,WAAW,CAAC;AAElC,YAAM,aAAyC,CAAC;AAChD,YAAM,kBAA8C,CAAC;AACrD,iBAAW,mBAAmB,SAAS;AACrC,cAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;AAE9D,YAAI,CAAC,eAAe;AAClB,qBAAW,KAAK,eAAe;AAAA,QACjC,OAAO;AACL,gBAAM,mBACJ,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,UACjC,gBAAgB,eACd,cAAc,MAAM;AAE1B,cAAI,kBAAkB;AACpB,4BAAgB,KAAK,eAAe;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAEA,UAAI,WAAW,SAAS,GAAG;AAIzB,gBAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;AAAA,MAC7D;AACA,UAAI,gBAAgB,SAAS,GAAG;AAC9B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,KAAK,CAAC;AAEpB,EAAM,gBAAU,MAAM;AACpB,QAAI,gBAAgB;AAClB,cAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO;AACT;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/index.ts | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| HydrationBoundary: () => import_HydrationBoundary.HydrationBoundary, | ||
| IsRestoringProvider: () => import_IsRestoringProvider.IsRestoringProvider, | ||
| QueryClientContext: () => import_QueryClientProvider.QueryClientContext, | ||
| QueryClientProvider: () => import_QueryClientProvider.QueryClientProvider, | ||
| QueryErrorResetBoundary: () => import_QueryErrorResetBoundary.QueryErrorResetBoundary, | ||
| infiniteQueryOptions: () => import_infiniteQueryOptions.infiniteQueryOptions, | ||
| mutationOptions: () => import_mutationOptions.mutationOptions, | ||
| queryOptions: () => import_queryOptions.queryOptions, | ||
| useInfiniteQuery: () => import_useInfiniteQuery.useInfiniteQuery, | ||
| useIsFetching: () => import_useIsFetching.useIsFetching, | ||
| useIsMutating: () => import_useMutationState.useIsMutating, | ||
| useIsRestoring: () => import_IsRestoringProvider.useIsRestoring, | ||
| useMutation: () => import_useMutation.useMutation, | ||
| useMutationState: () => import_useMutationState.useMutationState, | ||
| usePrefetchInfiniteQuery: () => import_usePrefetchInfiniteQuery.usePrefetchInfiniteQuery, | ||
| usePrefetchQuery: () => import_usePrefetchQuery.usePrefetchQuery, | ||
| useQueries: () => import_useQueries.useQueries, | ||
| useQuery: () => import_useQuery.useQuery, | ||
| useQueryClient: () => import_QueryClientProvider.useQueryClient, | ||
| useQueryErrorResetBoundary: () => import_QueryErrorResetBoundary.useQueryErrorResetBoundary, | ||
| useSuspenseInfiniteQuery: () => import_useSuspenseInfiniteQuery.useSuspenseInfiniteQuery, | ||
| useSuspenseQueries: () => import_useSuspenseQueries.useSuspenseQueries, | ||
| useSuspenseQuery: () => import_useSuspenseQuery.useSuspenseQuery | ||
| }); | ||
| module.exports = __toCommonJS(index_exports); | ||
| __reExport(index_exports, require("@tanstack/query-core"), module.exports); | ||
| __reExport(index_exports, require("./types.cjs"), module.exports); | ||
| var import_useQueries = require("./useQueries.cjs"); | ||
| var import_useQuery = require("./useQuery.cjs"); | ||
| var import_useSuspenseQuery = require("./useSuspenseQuery.cjs"); | ||
| var import_useSuspenseInfiniteQuery = require("./useSuspenseInfiniteQuery.cjs"); | ||
| var import_useSuspenseQueries = require("./useSuspenseQueries.cjs"); | ||
| var import_usePrefetchQuery = require("./usePrefetchQuery.cjs"); | ||
| var import_usePrefetchInfiniteQuery = require("./usePrefetchInfiniteQuery.cjs"); | ||
| var import_queryOptions = require("./queryOptions.cjs"); | ||
| var import_infiniteQueryOptions = require("./infiniteQueryOptions.cjs"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| var import_HydrationBoundary = require("./HydrationBoundary.cjs"); | ||
| var import_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs"); | ||
| var import_useIsFetching = require("./useIsFetching.cjs"); | ||
| var import_useMutationState = require("./useMutationState.cjs"); | ||
| var import_useMutation = require("./useMutation.cjs"); | ||
| var import_mutationOptions = require("./mutationOptions.cjs"); | ||
| var import_useInfiniteQuery = require("./useInfiniteQuery.cjs"); | ||
| var import_IsRestoringProvider = require("./IsRestoringProvider.cjs"); | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| HydrationBoundary, | ||
| IsRestoringProvider, | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| QueryErrorResetBoundary, | ||
| infiniteQueryOptions, | ||
| mutationOptions, | ||
| queryOptions, | ||
| useInfiniteQuery, | ||
| useIsFetching, | ||
| useIsMutating, | ||
| useIsRestoring, | ||
| useMutation, | ||
| useMutationState, | ||
| usePrefetchInfiniteQuery, | ||
| usePrefetchQuery, | ||
| useQueries, | ||
| useQuery, | ||
| useQueryClient, | ||
| useQueryErrorResetBoundary, | ||
| useSuspenseInfiniteQuery, | ||
| useSuspenseQueries, | ||
| useSuspenseQuery, | ||
| ...require("@tanstack/query-core"), | ||
| ...require("./types.cjs") | ||
| }); | ||
| //# sourceMappingURL=index.cjs.map |
| {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\n// Re-export core\nexport * from '@tanstack/query-core'\n\n// React Query\nexport * from './types'\nexport { useQueries } from './useQueries'\nexport type { QueriesResults, QueriesOptions } from './useQueries'\nexport { useQuery } from './useQuery'\nexport { useSuspenseQuery } from './useSuspenseQuery'\nexport { useSuspenseInfiniteQuery } from './useSuspenseInfiniteQuery'\nexport { useSuspenseQueries } from './useSuspenseQueries'\nexport type {\n SuspenseQueriesResults,\n SuspenseQueriesOptions,\n} from './useSuspenseQueries'\nexport { usePrefetchQuery } from './usePrefetchQuery'\nexport { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery'\nexport { queryOptions } from './queryOptions'\nexport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n UnusedSkipTokenOptions,\n} from './queryOptions'\nexport { infiniteQueryOptions } from './infiniteQueryOptions'\nexport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n UnusedSkipTokenInfiniteOptions,\n} from './infiniteQueryOptions'\nexport {\n QueryClientContext,\n QueryClientProvider,\n useQueryClient,\n} from './QueryClientProvider'\nexport type { QueryClientProviderProps } from './QueryClientProvider'\nexport type { QueryErrorResetBoundaryProps } from './QueryErrorResetBoundary'\nexport { HydrationBoundary } from './HydrationBoundary'\nexport type { HydrationBoundaryProps } from './HydrationBoundary'\nexport type {\n QueryErrorClearResetFunction,\n QueryErrorIsResetFunction,\n QueryErrorResetBoundaryFunction,\n QueryErrorResetFunction,\n} from './QueryErrorResetBoundary'\nexport {\n QueryErrorResetBoundary,\n useQueryErrorResetBoundary,\n} from './QueryErrorResetBoundary'\nexport { useIsFetching } from './useIsFetching'\nexport { useIsMutating, useMutationState } from './useMutationState'\nexport { useMutation } from './useMutation'\nexport { mutationOptions } from './mutationOptions'\nexport { useInfiniteQuery } from './useInfiniteQuery'\nexport { useIsRestoring, IsRestoringProvider } from './IsRestoringProvider'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAc,iCAHd;AAMA,0BAAc,wBANd;AAOA,wBAA2B;AAE3B,sBAAyB;AACzB,8BAAiC;AACjC,sCAAyC;AACzC,gCAAmC;AAKnC,8BAAiC;AACjC,sCAAyC;AACzC,0BAA6B;AAM7B,kCAAqC;AAMrC,iCAIO;AAGP,+BAAkC;AAQlC,qCAGO;AACP,2BAA8B;AAC9B,8BAAgD;AAChD,yBAA4B;AAC5B,6BAAgC;AAChC,8BAAiC;AACjC,iCAAoD;","names":[]} |
| export { useQueries } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesResults } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { useQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { useSuspenseQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { useSuspenseInfiniteQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { useSuspenseQueries } from './_tsup-dts-rollup.cjs'; | ||
| export { SuspenseQueriesResults } from './_tsup-dts-rollup.cjs'; | ||
| export { SuspenseQueriesOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { usePrefetchQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { usePrefetchInfiniteQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { queryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInitialDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UndefinedInitialDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UnusedSkipTokenOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { infiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UndefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UnusedSkipTokenInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientContext_alias_1 as QueryClientContext } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientProvider_alias_1 as QueryClientProvider } from './_tsup-dts-rollup.cjs'; | ||
| export { useQueryClient_alias_1 as useQueryClient } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientProviderProps_alias_1 as QueryClientProviderProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryProps_alias_1 as QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.cjs'; | ||
| export { HydrationBoundary_alias_1 as HydrationBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { HydrationBoundaryProps_alias_1 as HydrationBoundaryProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorClearResetFunction_alias_1 as QueryErrorClearResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorIsResetFunction_alias_1 as QueryErrorIsResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryFunction_alias_1 as QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetFunction_alias_1 as QueryErrorResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundary_alias_1 as QueryErrorResetBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { useQueryErrorResetBoundary_alias_1 as useQueryErrorResetBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { useIsFetching } from './_tsup-dts-rollup.cjs'; | ||
| export { useIsMutating } from './_tsup-dts-rollup.cjs'; | ||
| export { useMutationState } from './_tsup-dts-rollup.cjs'; | ||
| export { useMutation } from './_tsup-dts-rollup.cjs'; | ||
| export { mutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { useInfiniteQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { useIsRestoring_alias_1 as useIsRestoring } from './_tsup-dts-rollup.cjs'; | ||
| export { IsRestoringProvider_alias_1 as IsRestoringProvider } from './_tsup-dts-rollup.cjs'; | ||
| export { focusManager } from './_tsup-dts-rollup.cjs'; | ||
| export { environmentManager } from './_tsup-dts-rollup.cjs'; | ||
| export { defaultShouldDehydrateMutation } from './_tsup-dts-rollup.cjs'; | ||
| export { defaultShouldDehydrateQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { dehydrate } from './_tsup-dts-rollup.cjs'; | ||
| export { hydrate } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserver } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationCache } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationCacheNotifyEvent } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserver } from './_tsup-dts-rollup.cjs'; | ||
| export { defaultScheduler } from './_tsup-dts-rollup.cjs'; | ||
| export { notifyManager } from './_tsup-dts-rollup.cjs'; | ||
| export { onlineManager } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesObserver } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryCache } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryCacheNotifyEvent } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClient } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserver } from './_tsup-dts-rollup.cjs'; | ||
| export { CancelledError } from './_tsup-dts-rollup.cjs'; | ||
| export { isCancelledError } from './_tsup-dts-rollup.cjs'; | ||
| export { timeoutManager } from './_tsup-dts-rollup.cjs'; | ||
| export { ManagedTimerId } from './_tsup-dts-rollup.cjs'; | ||
| export { TimeoutCallback } from './_tsup-dts-rollup.cjs'; | ||
| export { TimeoutProvider } from './_tsup-dts-rollup.cjs'; | ||
| export { hashKey } from './_tsup-dts-rollup.cjs'; | ||
| export { isServer } from './_tsup-dts-rollup.cjs'; | ||
| export { keepPreviousData } from './_tsup-dts-rollup.cjs'; | ||
| export { matchMutation } from './_tsup-dts-rollup.cjs'; | ||
| export { matchQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { noop } from './_tsup-dts-rollup.cjs'; | ||
| export { partialMatchKey } from './_tsup-dts-rollup.cjs'; | ||
| export { replaceEqualDeep } from './_tsup-dts-rollup.cjs'; | ||
| export { shouldThrowError } from './_tsup-dts-rollup.cjs'; | ||
| export { skipToken } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationFilters } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryFilters } from './_tsup-dts-rollup.cjs'; | ||
| export { SkipToken } from './_tsup-dts-rollup.cjs'; | ||
| export { Updater } from './_tsup-dts-rollup.cjs'; | ||
| export { experimental_streamedQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { DehydratedState } from './_tsup-dts-rollup.cjs'; | ||
| export { DehydrateOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { HydrateOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { Mutation } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationState } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { Query } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryState } from './_tsup-dts-rollup.cjs'; | ||
| export { NonUndefinedGuard } from './_tsup-dts-rollup.cjs'; | ||
| export { DistributiveOmit } from './_tsup-dts-rollup.cjs'; | ||
| export { OmitKeyof } from './_tsup-dts-rollup.cjs'; | ||
| export { Override } from './_tsup-dts-rollup.cjs'; | ||
| export { NoInfer } from './_tsup-dts-rollup.cjs'; | ||
| export { Register } from './_tsup-dts-rollup.cjs'; | ||
| export { DefaultError } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryKey } from './_tsup-dts-rollup.cjs'; | ||
| export { dataTagSymbol } from './_tsup-dts-rollup.cjs'; | ||
| export { dataTagErrorSymbol } from './_tsup-dts-rollup.cjs'; | ||
| export { unsetMarker } from './_tsup-dts-rollup.cjs'; | ||
| export { UnsetMarker } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyDataTag } from './_tsup-dts-rollup.cjs'; | ||
| export { DataTag } from './_tsup-dts-rollup.cjs'; | ||
| export { InferDataFromTag } from './_tsup-dts-rollup.cjs'; | ||
| export { InferErrorFromTag } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { StaleTime } from './_tsup-dts-rollup.cjs'; | ||
| export { StaleTimeFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { Enabled } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryPersister } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryFunctionContext } from './_tsup-dts-rollup.cjs'; | ||
| export { InitialDataFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { PlaceholderDataFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesPlaceholderDataFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryKeyHashFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { GetPreviousPageParamFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { GetNextPageParamFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteData } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryMeta } from './_tsup-dts-rollup.cjs'; | ||
| export { NetworkMode } from './_tsup-dts-rollup.cjs'; | ||
| export { NotifyOnChangeProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { InitialPageParam } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryPageParamsOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { ThrowOnError } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { WithRequired } from './_tsup-dts-rollup.cjs'; | ||
| export { DefaultedQueryObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefaultedInfiniteQueryObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { EnsureQueryDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { EnsureInfiniteQueryDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { ResultOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { RefetchOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { InvalidateQueryFilters } from './_tsup-dts-rollup.cjs'; | ||
| export { RefetchQueryFilters } from './_tsup-dts-rollup.cjs'; | ||
| export { InvalidateOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { ResetOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchNextPageOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchPreviousPageOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryStatus } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchStatus } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverBaseResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverPendingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverLoadingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverLoadingErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverRefetchErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverSuccessResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverPlaceholderResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedQueryObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverBaseResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverPendingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverLoadingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverLoadingErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverRefetchErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverSuccessResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverPlaceholderResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInfiniteQueryObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationKey } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationStatus } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationScope } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationMeta } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationFunctionContext } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { MutateOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { MutateFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverBaseResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverIdleResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverLoadingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverSuccessResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientConfig } from './_tsup-dts-rollup.cjs'; | ||
| export { DefaultOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { CancelOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { SetDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { NotifyEventType } from './_tsup-dts-rollup.cjs'; | ||
| export { NotifyEvent } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseBaseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UsePrefetchQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseSuspenseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedUseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedUseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseMutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutateFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutateAsyncFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseMutationResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutationResult } from './_tsup-dts-rollup.cjs'; |
| export { useQueries } from './_tsup-dts-rollup.js'; | ||
| export { QueriesResults } from './_tsup-dts-rollup.js'; | ||
| export { QueriesOptions } from './_tsup-dts-rollup.js'; | ||
| export { useQuery } from './_tsup-dts-rollup.js'; | ||
| export { useSuspenseQuery } from './_tsup-dts-rollup.js'; | ||
| export { useSuspenseInfiniteQuery } from './_tsup-dts-rollup.js'; | ||
| export { useSuspenseQueries } from './_tsup-dts-rollup.js'; | ||
| export { SuspenseQueriesResults } from './_tsup-dts-rollup.js'; | ||
| export { SuspenseQueriesOptions } from './_tsup-dts-rollup.js'; | ||
| export { usePrefetchQuery } from './_tsup-dts-rollup.js'; | ||
| export { usePrefetchInfiniteQuery } from './_tsup-dts-rollup.js'; | ||
| export { queryOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInitialDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { UndefinedInitialDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { UnusedSkipTokenOptions } from './_tsup-dts-rollup.js'; | ||
| export { infiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { UndefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { UnusedSkipTokenInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientContext_alias_1 as QueryClientContext } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientProvider_alias_1 as QueryClientProvider } from './_tsup-dts-rollup.js'; | ||
| export { useQueryClient_alias_1 as useQueryClient } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientProviderProps_alias_1 as QueryClientProviderProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryProps_alias_1 as QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.js'; | ||
| export { HydrationBoundary_alias_1 as HydrationBoundary } from './_tsup-dts-rollup.js'; | ||
| export { HydrationBoundaryProps_alias_1 as HydrationBoundaryProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorClearResetFunction_alias_1 as QueryErrorClearResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorIsResetFunction_alias_1 as QueryErrorIsResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryFunction_alias_1 as QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetFunction_alias_1 as QueryErrorResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundary_alias_1 as QueryErrorResetBoundary } from './_tsup-dts-rollup.js'; | ||
| export { useQueryErrorResetBoundary_alias_1 as useQueryErrorResetBoundary } from './_tsup-dts-rollup.js'; | ||
| export { useIsFetching } from './_tsup-dts-rollup.js'; | ||
| export { useIsMutating } from './_tsup-dts-rollup.js'; | ||
| export { useMutationState } from './_tsup-dts-rollup.js'; | ||
| export { useMutation } from './_tsup-dts-rollup.js'; | ||
| export { mutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { useInfiniteQuery } from './_tsup-dts-rollup.js'; | ||
| export { useIsRestoring_alias_1 as useIsRestoring } from './_tsup-dts-rollup.js'; | ||
| export { IsRestoringProvider_alias_1 as IsRestoringProvider } from './_tsup-dts-rollup.js'; | ||
| export { focusManager } from './_tsup-dts-rollup.js'; | ||
| export { environmentManager } from './_tsup-dts-rollup.js'; | ||
| export { defaultShouldDehydrateMutation } from './_tsup-dts-rollup.js'; | ||
| export { defaultShouldDehydrateQuery } from './_tsup-dts-rollup.js'; | ||
| export { dehydrate } from './_tsup-dts-rollup.js'; | ||
| export { hydrate } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserver } from './_tsup-dts-rollup.js'; | ||
| export { MutationCache } from './_tsup-dts-rollup.js'; | ||
| export { MutationCacheNotifyEvent } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserver } from './_tsup-dts-rollup.js'; | ||
| export { defaultScheduler } from './_tsup-dts-rollup.js'; | ||
| export { notifyManager } from './_tsup-dts-rollup.js'; | ||
| export { onlineManager } from './_tsup-dts-rollup.js'; | ||
| export { QueriesObserver } from './_tsup-dts-rollup.js'; | ||
| export { QueryCache } from './_tsup-dts-rollup.js'; | ||
| export { QueryCacheNotifyEvent } from './_tsup-dts-rollup.js'; | ||
| export { QueryClient } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserver } from './_tsup-dts-rollup.js'; | ||
| export { CancelledError } from './_tsup-dts-rollup.js'; | ||
| export { isCancelledError } from './_tsup-dts-rollup.js'; | ||
| export { timeoutManager } from './_tsup-dts-rollup.js'; | ||
| export { ManagedTimerId } from './_tsup-dts-rollup.js'; | ||
| export { TimeoutCallback } from './_tsup-dts-rollup.js'; | ||
| export { TimeoutProvider } from './_tsup-dts-rollup.js'; | ||
| export { hashKey } from './_tsup-dts-rollup.js'; | ||
| export { isServer } from './_tsup-dts-rollup.js'; | ||
| export { keepPreviousData } from './_tsup-dts-rollup.js'; | ||
| export { matchMutation } from './_tsup-dts-rollup.js'; | ||
| export { matchQuery } from './_tsup-dts-rollup.js'; | ||
| export { noop } from './_tsup-dts-rollup.js'; | ||
| export { partialMatchKey } from './_tsup-dts-rollup.js'; | ||
| export { replaceEqualDeep } from './_tsup-dts-rollup.js'; | ||
| export { shouldThrowError } from './_tsup-dts-rollup.js'; | ||
| export { skipToken } from './_tsup-dts-rollup.js'; | ||
| export { MutationFilters } from './_tsup-dts-rollup.js'; | ||
| export { QueryFilters } from './_tsup-dts-rollup.js'; | ||
| export { SkipToken } from './_tsup-dts-rollup.js'; | ||
| export { Updater } from './_tsup-dts-rollup.js'; | ||
| export { experimental_streamedQuery } from './_tsup-dts-rollup.js'; | ||
| export { DehydratedState } from './_tsup-dts-rollup.js'; | ||
| export { DehydrateOptions } from './_tsup-dts-rollup.js'; | ||
| export { HydrateOptions } from './_tsup-dts-rollup.js'; | ||
| export { Mutation } from './_tsup-dts-rollup.js'; | ||
| export { MutationState } from './_tsup-dts-rollup.js'; | ||
| export { QueriesObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { Query } from './_tsup-dts-rollup.js'; | ||
| export { QueryState } from './_tsup-dts-rollup.js'; | ||
| export { NonUndefinedGuard } from './_tsup-dts-rollup.js'; | ||
| export { DistributiveOmit } from './_tsup-dts-rollup.js'; | ||
| export { OmitKeyof } from './_tsup-dts-rollup.js'; | ||
| export { Override } from './_tsup-dts-rollup.js'; | ||
| export { NoInfer } from './_tsup-dts-rollup.js'; | ||
| export { Register } from './_tsup-dts-rollup.js'; | ||
| export { DefaultError } from './_tsup-dts-rollup.js'; | ||
| export { QueryKey } from './_tsup-dts-rollup.js'; | ||
| export { dataTagSymbol } from './_tsup-dts-rollup.js'; | ||
| export { dataTagErrorSymbol } from './_tsup-dts-rollup.js'; | ||
| export { unsetMarker } from './_tsup-dts-rollup.js'; | ||
| export { UnsetMarker } from './_tsup-dts-rollup.js'; | ||
| export { AnyDataTag } from './_tsup-dts-rollup.js'; | ||
| export { DataTag } from './_tsup-dts-rollup.js'; | ||
| export { InferDataFromTag } from './_tsup-dts-rollup.js'; | ||
| export { InferErrorFromTag } from './_tsup-dts-rollup.js'; | ||
| export { QueryFunction } from './_tsup-dts-rollup.js'; | ||
| export { StaleTime } from './_tsup-dts-rollup.js'; | ||
| export { StaleTimeFunction } from './_tsup-dts-rollup.js'; | ||
| export { Enabled } from './_tsup-dts-rollup.js'; | ||
| export { QueryPersister } from './_tsup-dts-rollup.js'; | ||
| export { QueryFunctionContext } from './_tsup-dts-rollup.js'; | ||
| export { InitialDataFunction } from './_tsup-dts-rollup.js'; | ||
| export { PlaceholderDataFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueriesPlaceholderDataFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryKeyHashFunction } from './_tsup-dts-rollup.js'; | ||
| export { GetPreviousPageParamFunction } from './_tsup-dts-rollup.js'; | ||
| export { GetNextPageParamFunction } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteData } from './_tsup-dts-rollup.js'; | ||
| export { QueryMeta } from './_tsup-dts-rollup.js'; | ||
| export { NetworkMode } from './_tsup-dts-rollup.js'; | ||
| export { NotifyOnChangeProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { InitialPageParam } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryPageParamsOptions } from './_tsup-dts-rollup.js'; | ||
| export { ThrowOnError } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { WithRequired } from './_tsup-dts-rollup.js'; | ||
| export { DefaultedQueryObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefaultedInfiniteQueryObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { FetchQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { EnsureQueryDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { EnsureInfiniteQueryDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { FetchInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { ResultOptions } from './_tsup-dts-rollup.js'; | ||
| export { RefetchOptions } from './_tsup-dts-rollup.js'; | ||
| export { InvalidateQueryFilters } from './_tsup-dts-rollup.js'; | ||
| export { RefetchQueryFilters } from './_tsup-dts-rollup.js'; | ||
| export { InvalidateOptions } from './_tsup-dts-rollup.js'; | ||
| export { ResetOptions } from './_tsup-dts-rollup.js'; | ||
| export { FetchNextPageOptions } from './_tsup-dts-rollup.js'; | ||
| export { FetchPreviousPageOptions } from './_tsup-dts-rollup.js'; | ||
| export { QueryStatus } from './_tsup-dts-rollup.js'; | ||
| export { FetchStatus } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverBaseResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverPendingResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverLoadingResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverLoadingErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverRefetchErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverSuccessResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverPlaceholderResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedQueryObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverBaseResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverPendingResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverLoadingResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverLoadingErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverRefetchErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverSuccessResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverPlaceholderResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInfiniteQueryObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationKey } from './_tsup-dts-rollup.js'; | ||
| export { MutationStatus } from './_tsup-dts-rollup.js'; | ||
| export { MutationScope } from './_tsup-dts-rollup.js'; | ||
| export { MutationMeta } from './_tsup-dts-rollup.js'; | ||
| export { MutationFunctionContext } from './_tsup-dts-rollup.js'; | ||
| export { MutationFunction } from './_tsup-dts-rollup.js'; | ||
| export { MutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { MutateOptions } from './_tsup-dts-rollup.js'; | ||
| export { MutateFunction } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverBaseResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverIdleResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverLoadingResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverSuccessResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientConfig } from './_tsup-dts-rollup.js'; | ||
| export { DefaultOptions } from './_tsup-dts-rollup.js'; | ||
| export { CancelOptions } from './_tsup-dts-rollup.js'; | ||
| export { SetDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { NotifyEventType } from './_tsup-dts-rollup.js'; | ||
| export { NotifyEvent } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseBaseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UsePrefetchQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseSuspenseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedUseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedUseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseMutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseMutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseMutateFunction } from './_tsup-dts-rollup.js'; | ||
| export { UseMutateAsyncFunction } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseMutationResult } from './_tsup-dts-rollup.js'; | ||
| export { UseMutationResult } from './_tsup-dts-rollup.js'; |
| // src/index.ts | ||
| export * from "@tanstack/query-core"; | ||
| export * from "./types.js"; | ||
| import { useQueries } from "./useQueries.js"; | ||
| import { useQuery } from "./useQuery.js"; | ||
| import { useSuspenseQuery } from "./useSuspenseQuery.js"; | ||
| import { useSuspenseInfiniteQuery } from "./useSuspenseInfiniteQuery.js"; | ||
| import { useSuspenseQueries } from "./useSuspenseQueries.js"; | ||
| import { usePrefetchQuery } from "./usePrefetchQuery.js"; | ||
| import { usePrefetchInfiniteQuery } from "./usePrefetchInfiniteQuery.js"; | ||
| import { queryOptions } from "./queryOptions.js"; | ||
| import { infiniteQueryOptions } from "./infiniteQueryOptions.js"; | ||
| import { | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| useQueryClient | ||
| } from "./QueryClientProvider.js"; | ||
| import { HydrationBoundary } from "./HydrationBoundary.js"; | ||
| import { | ||
| QueryErrorResetBoundary, | ||
| useQueryErrorResetBoundary | ||
| } from "./QueryErrorResetBoundary.js"; | ||
| import { useIsFetching } from "./useIsFetching.js"; | ||
| import { useIsMutating, useMutationState } from "./useMutationState.js"; | ||
| import { useMutation } from "./useMutation.js"; | ||
| import { mutationOptions } from "./mutationOptions.js"; | ||
| import { useInfiniteQuery } from "./useInfiniteQuery.js"; | ||
| import { useIsRestoring, IsRestoringProvider } from "./IsRestoringProvider.js"; | ||
| export { | ||
| HydrationBoundary, | ||
| IsRestoringProvider, | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| QueryErrorResetBoundary, | ||
| infiniteQueryOptions, | ||
| mutationOptions, | ||
| queryOptions, | ||
| useInfiniteQuery, | ||
| useIsFetching, | ||
| useIsMutating, | ||
| useIsRestoring, | ||
| useMutation, | ||
| useMutationState, | ||
| usePrefetchInfiniteQuery, | ||
| usePrefetchQuery, | ||
| useQueries, | ||
| useQuery, | ||
| useQueryClient, | ||
| useQueryErrorResetBoundary, | ||
| useSuspenseInfiniteQuery, | ||
| useSuspenseQueries, | ||
| useSuspenseQuery | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\n// Re-export core\nexport * from '@tanstack/query-core'\n\n// React Query\nexport * from './types'\nexport { useQueries } from './useQueries'\nexport type { QueriesResults, QueriesOptions } from './useQueries'\nexport { useQuery } from './useQuery'\nexport { useSuspenseQuery } from './useSuspenseQuery'\nexport { useSuspenseInfiniteQuery } from './useSuspenseInfiniteQuery'\nexport { useSuspenseQueries } from './useSuspenseQueries'\nexport type {\n SuspenseQueriesResults,\n SuspenseQueriesOptions,\n} from './useSuspenseQueries'\nexport { usePrefetchQuery } from './usePrefetchQuery'\nexport { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery'\nexport { queryOptions } from './queryOptions'\nexport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n UnusedSkipTokenOptions,\n} from './queryOptions'\nexport { infiniteQueryOptions } from './infiniteQueryOptions'\nexport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n UnusedSkipTokenInfiniteOptions,\n} from './infiniteQueryOptions'\nexport {\n QueryClientContext,\n QueryClientProvider,\n useQueryClient,\n} from './QueryClientProvider'\nexport type { QueryClientProviderProps } from './QueryClientProvider'\nexport type { QueryErrorResetBoundaryProps } from './QueryErrorResetBoundary'\nexport { HydrationBoundary } from './HydrationBoundary'\nexport type { HydrationBoundaryProps } from './HydrationBoundary'\nexport type {\n QueryErrorClearResetFunction,\n QueryErrorIsResetFunction,\n QueryErrorResetBoundaryFunction,\n QueryErrorResetFunction,\n} from './QueryErrorResetBoundary'\nexport {\n QueryErrorResetBoundary,\n useQueryErrorResetBoundary,\n} from './QueryErrorResetBoundary'\nexport { useIsFetching } from './useIsFetching'\nexport { useIsMutating, useMutationState } from './useMutationState'\nexport { useMutation } from './useMutation'\nexport { mutationOptions } from './mutationOptions'\nexport { useInfiniteQuery } from './useInfiniteQuery'\nexport { useIsRestoring, IsRestoringProvider } from './IsRestoringProvider'\n"],"mappings":";AAGA,cAAc;AAGd,cAAc;AACd,SAAS,kBAAkB;AAE3B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AAKnC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAM7B,SAAS,4BAA4B;AAMrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,yBAAyB;AAQlC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAS,eAAe,wBAAwB;AAChD,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,gBAAgB,2BAA2B;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/infiniteQueryOptions.ts | ||
| var infiniteQueryOptions_exports = {}; | ||
| __export(infiniteQueryOptions_exports, { | ||
| infiniteQueryOptions: () => infiniteQueryOptions | ||
| }); | ||
| module.exports = __toCommonJS(infiniteQueryOptions_exports); | ||
| function infiniteQueryOptions(options) { | ||
| return options; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| infiniteQueryOptions | ||
| }); | ||
| //# sourceMappingURL=infiniteQueryOptions.cjs.map |
| {"version":3,"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData?:\n | undefined\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData:\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkJO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;","names":[]} |
| export { infiniteQueryOptions_alias_1 as infiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UndefinedInitialDataInfiniteOptions_alias_1 as UndefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UnusedSkipTokenInfiniteOptions_alias_1 as UnusedSkipTokenInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInitialDataInfiniteOptions_alias_1 as DefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.cjs'; |
| export { infiniteQueryOptions_alias_1 as infiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UndefinedInitialDataInfiniteOptions_alias_1 as UndefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { UnusedSkipTokenInfiniteOptions_alias_1 as UnusedSkipTokenInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInitialDataInfiniteOptions_alias_1 as DefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.js'; |
| // src/infiniteQueryOptions.ts | ||
| function infiniteQueryOptions(options) { | ||
| return options; | ||
| } | ||
| export { | ||
| infiniteQueryOptions | ||
| }; | ||
| //# sourceMappingURL=infiniteQueryOptions.js.map |
| {"version":3,"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData?:\n | undefined\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData:\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAkJO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/IsRestoringProvider.ts | ||
| var IsRestoringProvider_exports = {}; | ||
| __export(IsRestoringProvider_exports, { | ||
| IsRestoringProvider: () => IsRestoringProvider, | ||
| useIsRestoring: () => useIsRestoring | ||
| }); | ||
| module.exports = __toCommonJS(IsRestoringProvider_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var IsRestoringContext = React.createContext(false); | ||
| var useIsRestoring = () => React.useContext(IsRestoringContext); | ||
| var IsRestoringProvider = IsRestoringContext.Provider; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| IsRestoringProvider, | ||
| useIsRestoring | ||
| }); | ||
| //# sourceMappingURL=IsRestoringProvider.cjs.map |
| {"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,IAAM,qBAA2B,oBAAc,KAAK;AAE7C,IAAM,iBAAiB,MAAY,iBAAW,kBAAkB;AAChE,IAAM,sBAAsB,mBAAmB;","names":[]} |
| export { useIsRestoring } from './_tsup-dts-rollup.cjs'; | ||
| export { IsRestoringProvider } from './_tsup-dts-rollup.cjs'; |
| export { useIsRestoring } from './_tsup-dts-rollup.js'; | ||
| export { IsRestoringProvider } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/IsRestoringProvider.ts | ||
| import * as React from "react"; | ||
| var IsRestoringContext = React.createContext(false); | ||
| var useIsRestoring = () => React.useContext(IsRestoringContext); | ||
| var IsRestoringProvider = IsRestoringContext.Provider; | ||
| export { | ||
| IsRestoringProvider, | ||
| useIsRestoring | ||
| }; | ||
| //# sourceMappingURL=IsRestoringProvider.js.map |
| {"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,IAAM,qBAA2B,oBAAc,KAAK;AAE7C,IAAM,iBAAiB,MAAY,iBAAW,kBAAkB;AAChE,IAAM,sBAAsB,mBAAmB;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/mutationOptions.ts | ||
| var mutationOptions_exports = {}; | ||
| __export(mutationOptions_exports, { | ||
| mutationOptions: () => mutationOptions | ||
| }); | ||
| module.exports = __toCommonJS(mutationOptions_exports); | ||
| function mutationOptions(options) { | ||
| return options; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| mutationOptions | ||
| }); | ||
| //# sourceMappingURL=mutationOptions.cjs.map |
| {"version":3,"sources":["../../src/mutationOptions.ts"],"sourcesContent":["import type { DefaultError, WithRequired } from '@tanstack/query-core'\nimport type { UseMutationOptions } from './types'\n\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n): UseMutationOptions<TData, TError, TVariables, TOnMutateResult> {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BO,SAAS,gBAMd,SACgE;AAChE,SAAO;AACT;","names":[]} |
| export { mutationOptions_alias_1 as mutationOptions } from './_tsup-dts-rollup.cjs'; |
| export { mutationOptions_alias_1 as mutationOptions } from './_tsup-dts-rollup.js'; |
| // src/mutationOptions.ts | ||
| function mutationOptions(options) { | ||
| return options; | ||
| } | ||
| export { | ||
| mutationOptions | ||
| }; | ||
| //# sourceMappingURL=mutationOptions.js.map |
| {"version":3,"sources":["../../src/mutationOptions.ts"],"sourcesContent":["import type { DefaultError, WithRequired } from '@tanstack/query-core'\nimport type { UseMutationOptions } from './types'\n\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n): UseMutationOptions<TData, TError, TVariables, TOnMutateResult> {\n return options\n}\n"],"mappings":";AA+BO,SAAS,gBAMd,SACgE;AAChE,SAAO;AACT;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/QueryClientProvider.tsx | ||
| var QueryClientProvider_exports = {}; | ||
| __export(QueryClientProvider_exports, { | ||
| QueryClientContext: () => QueryClientContext, | ||
| QueryClientProvider: () => QueryClientProvider, | ||
| useQueryClient: () => useQueryClient | ||
| }); | ||
| module.exports = __toCommonJS(QueryClientProvider_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_jsx_runtime = require("react/jsx-runtime"); | ||
| var QueryClientContext = React.createContext( | ||
| void 0 | ||
| ); | ||
| var useQueryClient = (queryClient) => { | ||
| const client = React.useContext(QueryClientContext); | ||
| if (queryClient) { | ||
| return queryClient; | ||
| } | ||
| if (!client) { | ||
| throw new Error("No QueryClient set, use QueryClientProvider to set one"); | ||
| } | ||
| return client; | ||
| }; | ||
| var QueryClientProvider = ({ | ||
| client, | ||
| children | ||
| }) => { | ||
| React.useEffect(() => { | ||
| client.mount(); | ||
| return () => { | ||
| client.unmount(); | ||
| }; | ||
| }, [client]); | ||
| return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, { value: client, children }); | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| useQueryClient | ||
| }); | ||
| //# sourceMappingURL=QueryClientProvider.cjs.map |
| {"version":3,"sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): React.JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAuCnB;AAnCG,IAAM,qBAA2B;AAAA,EACtC;AACF;AAEO,IAAM,iBAAiB,CAAC,gBAA8B;AAC3D,QAAM,SAAe,iBAAW,kBAAkB;AAElD,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,SAAO;AACT;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAmD;AACjD,EAAM,gBAAU,MAAM;AACpB,WAAO,MAAM;AACb,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,QACjC,UACH;AAEJ;","names":[]} |
| export { QueryClientContext } from './_tsup-dts-rollup.cjs'; | ||
| export { useQueryClient } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientProviderProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientProvider } from './_tsup-dts-rollup.cjs'; |
| export { QueryClientContext } from './_tsup-dts-rollup.js'; | ||
| export { useQueryClient } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientProviderProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientProvider } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/QueryClientProvider.tsx | ||
| import * as React from "react"; | ||
| import { jsx } from "react/jsx-runtime"; | ||
| var QueryClientContext = React.createContext( | ||
| void 0 | ||
| ); | ||
| var useQueryClient = (queryClient) => { | ||
| const client = React.useContext(QueryClientContext); | ||
| if (queryClient) { | ||
| return queryClient; | ||
| } | ||
| if (!client) { | ||
| throw new Error("No QueryClient set, use QueryClientProvider to set one"); | ||
| } | ||
| return client; | ||
| }; | ||
| var QueryClientProvider = ({ | ||
| client, | ||
| children | ||
| }) => { | ||
| React.useEffect(() => { | ||
| client.mount(); | ||
| return () => { | ||
| client.unmount(); | ||
| }; | ||
| }, [client]); | ||
| return /* @__PURE__ */ jsx(QueryClientContext.Provider, { value: client, children }); | ||
| }; | ||
| export { | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| useQueryClient | ||
| }; | ||
| //# sourceMappingURL=QueryClientProvider.js.map |
| {"version":3,"sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): React.JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAuCnB;AAnCG,IAAM,qBAA2B;AAAA,EACtC;AACF;AAEO,IAAM,iBAAiB,CAAC,gBAA8B;AAC3D,QAAM,SAAe,iBAAW,kBAAkB;AAElD,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,SAAO;AACT;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAmD;AACjD,EAAM,gBAAU,MAAM;AACpB,WAAO,MAAM;AACb,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,QACjC,UACH;AAEJ;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/QueryErrorResetBoundary.tsx | ||
| var QueryErrorResetBoundary_exports = {}; | ||
| __export(QueryErrorResetBoundary_exports, { | ||
| QueryErrorResetBoundary: () => QueryErrorResetBoundary, | ||
| useQueryErrorResetBoundary: () => useQueryErrorResetBoundary | ||
| }); | ||
| module.exports = __toCommonJS(QueryErrorResetBoundary_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_jsx_runtime = require("react/jsx-runtime"); | ||
| function createValue() { | ||
| let isReset = false; | ||
| return { | ||
| clearReset: () => { | ||
| isReset = false; | ||
| }, | ||
| reset: () => { | ||
| isReset = true; | ||
| }, | ||
| isReset: () => { | ||
| return isReset; | ||
| } | ||
| }; | ||
| } | ||
| var QueryErrorResetBoundaryContext = React.createContext(createValue()); | ||
| var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext); | ||
| var QueryErrorResetBoundary = ({ | ||
| children | ||
| }) => { | ||
| const [value] = React.useState(() => createValue()); | ||
| return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children }); | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| QueryErrorResetBoundary, | ||
| useQueryErrorResetBoundary | ||
| }); | ||
| //# sourceMappingURL=QueryErrorResetBoundary.cjs.map |
| {"version":3,"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAkDnB;AArCJ,SAAS,cAA4C;AACnD,MAAI,UAAU;AACd,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,gBAAU;AAAA,IACZ;AAAA,IACA,OAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,IACA,SAAS,MAAM;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,iCAAuC,oBAAc,YAAY,CAAC;AAIjE,IAAM,6BAA6B,MAClC,iBAAW,8BAA8B;AAY1C,IAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,CAAC,KAAK,IAAU,eAAS,MAAM,YAAY,CAAC;AAClD,SACE,4CAAC,+BAA+B,UAA/B,EAAwC,OACtC,iBAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACtD;AAEJ;","names":[]} |
| export { QueryErrorResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorIsResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorClearResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryValue } from './_tsup-dts-rollup.cjs'; | ||
| export { useQueryErrorResetBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundary } from './_tsup-dts-rollup.cjs'; |
| export { QueryErrorResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorIsResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorClearResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryValue } from './_tsup-dts-rollup.js'; | ||
| export { useQueryErrorResetBoundary } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundary } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/QueryErrorResetBoundary.tsx | ||
| import * as React from "react"; | ||
| import { jsx } from "react/jsx-runtime"; | ||
| function createValue() { | ||
| let isReset = false; | ||
| return { | ||
| clearReset: () => { | ||
| isReset = false; | ||
| }, | ||
| reset: () => { | ||
| isReset = true; | ||
| }, | ||
| isReset: () => { | ||
| return isReset; | ||
| } | ||
| }; | ||
| } | ||
| var QueryErrorResetBoundaryContext = React.createContext(createValue()); | ||
| var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext); | ||
| var QueryErrorResetBoundary = ({ | ||
| children | ||
| }) => { | ||
| const [value] = React.useState(() => createValue()); | ||
| return /* @__PURE__ */ jsx(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children }); | ||
| }; | ||
| export { | ||
| QueryErrorResetBoundary, | ||
| useQueryErrorResetBoundary | ||
| }; | ||
| //# sourceMappingURL=QueryErrorResetBoundary.js.map |
| {"version":3,"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAkDnB;AArCJ,SAAS,cAA4C;AACnD,MAAI,UAAU;AACd,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,gBAAU;AAAA,IACZ;AAAA,IACA,OAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,IACA,SAAS,MAAM;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,iCAAuC,oBAAc,YAAY,CAAC;AAIjE,IAAM,6BAA6B,MAClC,iBAAW,8BAA8B;AAY1C,IAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,CAAC,KAAK,IAAU,eAAS,MAAM,YAAY,CAAC;AAClD,SACE,oBAAC,+BAA+B,UAA/B,EAAwC,OACtC,iBAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACtD;AAEJ;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/queryOptions.ts | ||
| var queryOptions_exports = {}; | ||
| __export(queryOptions_exports, { | ||
| queryOptions: () => queryOptions | ||
| }); | ||
| module.exports = __toCommonJS(queryOptions_exports); | ||
| function queryOptions(options) { | ||
| return options; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| queryOptions | ||
| }); | ||
| //# sourceMappingURL=queryOptions.cjs.map |
| {"version":3,"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoFO,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;","names":[]} |
| export { queryOptions_alias_1 as queryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UndefinedInitialDataOptions_alias_1 as UndefinedInitialDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UnusedSkipTokenOptions_alias_1 as UnusedSkipTokenOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInitialDataOptions_alias_1 as DefinedInitialDataOptions } from './_tsup-dts-rollup.cjs'; |
| export { queryOptions_alias_1 as queryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UndefinedInitialDataOptions_alias_1 as UndefinedInitialDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { UnusedSkipTokenOptions_alias_1 as UnusedSkipTokenOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInitialDataOptions_alias_1 as DefinedInitialDataOptions } from './_tsup-dts-rollup.js'; |
| // src/queryOptions.ts | ||
| function queryOptions(options) { | ||
| return options; | ||
| } | ||
| export { | ||
| queryOptions | ||
| }; | ||
| //# sourceMappingURL=queryOptions.js.map |
| {"version":3,"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAoFO,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/suspense.ts | ||
| var suspense_exports = {}; | ||
| __export(suspense_exports, { | ||
| defaultThrowOnError: () => defaultThrowOnError, | ||
| ensureSuspenseTimers: () => ensureSuspenseTimers, | ||
| fetchOptimistic: () => fetchOptimistic, | ||
| shouldSuspend: () => shouldSuspend, | ||
| willFetch: () => willFetch | ||
| }); | ||
| module.exports = __toCommonJS(suspense_exports); | ||
| var defaultThrowOnError = (_error, query) => query.state.data === void 0; | ||
| var ensureSuspenseTimers = (defaultedOptions) => { | ||
| if (defaultedOptions.suspense) { | ||
| const MIN_SUSPENSE_TIME_MS = 1e3; | ||
| const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS); | ||
| const originalStaleTime = defaultedOptions.staleTime; | ||
| defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime); | ||
| if (typeof defaultedOptions.gcTime === "number") { | ||
| defaultedOptions.gcTime = Math.max( | ||
| defaultedOptions.gcTime, | ||
| MIN_SUSPENSE_TIME_MS | ||
| ); | ||
| } | ||
| } | ||
| }; | ||
| var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring; | ||
| var shouldSuspend = (defaultedOptions, result) => (defaultedOptions == null ? void 0 : defaultedOptions.suspense) && result.isPending; | ||
| var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => { | ||
| errorResetBoundary.clearReset(); | ||
| }); | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| defaultThrowOnError, | ||
| ensureSuspenseTimers, | ||
| fetchOptimistic, | ||
| shouldSuspend, | ||
| willFetch | ||
| }); | ||
| //# sourceMappingURL=suspense.cjs.map |
| {"version":3,"sources":["../../src/suspense.ts"],"sourcesContent":["import type {\n DefaultError,\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const defaultThrowOnError = <\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n _error: TError,\n query: Query<TQueryFnData, TError, TData, TQueryKey>,\n) => query.state.data === undefined\n\nexport const ensureSuspenseTimers = (\n defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>,\n) => {\n if (defaultedOptions.suspense) {\n // Handle staleTime to ensure minimum 1000ms in Suspense mode\n // This prevents unnecessary refetching when components remount after suspending\n const MIN_SUSPENSE_TIME_MS = 1000\n\n const clamp = (value: number | 'static' | undefined) =>\n value === 'static'\n ? value\n : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS)\n\n const originalStaleTime = defaultedOptions.staleTime\n defaultedOptions.staleTime =\n typeof originalStaleTime === 'function'\n ? (...args) => clamp(originalStaleTime(...args))\n : clamp(originalStaleTime)\n\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(\n defaultedOptions.gcTime,\n MIN_SUSPENSE_TIME_MS,\n )\n }\n }\n}\n\nexport const willFetch = (\n result: QueryObserverResult<any, any>,\n isRestoring: boolean,\n) => result.isLoading && result.isFetching && !isRestoring\n\nexport const shouldSuspend = (\n defaultedOptions:\n | DefaultedQueryObserverOptions<any, any, any, any, any>\n | undefined,\n result: QueryObserverResult<any, any>,\n) => defaultedOptions?.suspense && result.isPending\n\nexport const fetchOptimistic = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n defaultedOptions: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) =>\n observer.fetchOptimistic(defaultedOptions).catch(() => {\n errorResetBoundary.clearReset()\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,IAAM,sBAAsB,CAMjC,QACA,UACG,MAAM,MAAM,SAAS;AAEnB,IAAM,uBAAuB,CAClC,qBACG;AACH,MAAI,iBAAiB,UAAU;AAG7B,UAAM,uBAAuB;AAE7B,UAAM,QAAQ,CAAC,UACb,UAAU,WACN,QACA,KAAK,IAAI,SAAS,sBAAsB,oBAAoB;AAElE,UAAM,oBAAoB,iBAAiB;AAC3C,qBAAiB,YACf,OAAO,sBAAsB,aACzB,IAAI,SAAS,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAC7C,MAAM,iBAAiB;AAE7B,QAAI,OAAO,iBAAiB,WAAW,UAAU;AAC/C,uBAAiB,SAAS,KAAK;AAAA,QAC7B,iBAAiB;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,YAAY,CACvB,QACA,gBACG,OAAO,aAAa,OAAO,cAAc,CAAC;AAExC,IAAM,gBAAgB,CAC3B,kBAGA,YACG,qDAAkB,aAAY,OAAO;AAEnC,IAAM,kBAAkB,CAO7B,kBAOA,UACA,uBAEA,SAAS,gBAAgB,gBAAgB,EAAE,MAAM,MAAM;AACrD,qBAAmB,WAAW;AAChC,CAAC;","names":[]} |
| export { defaultThrowOnError } from './_tsup-dts-rollup.cjs'; | ||
| export { ensureSuspenseTimers } from './_tsup-dts-rollup.cjs'; | ||
| export { willFetch } from './_tsup-dts-rollup.cjs'; | ||
| export { shouldSuspend } from './_tsup-dts-rollup.cjs'; | ||
| export { fetchOptimistic } from './_tsup-dts-rollup.cjs'; |
| export { defaultThrowOnError } from './_tsup-dts-rollup.js'; | ||
| export { ensureSuspenseTimers } from './_tsup-dts-rollup.js'; | ||
| export { willFetch } from './_tsup-dts-rollup.js'; | ||
| export { shouldSuspend } from './_tsup-dts-rollup.js'; | ||
| export { fetchOptimistic } from './_tsup-dts-rollup.js'; |
| // src/suspense.ts | ||
| var defaultThrowOnError = (_error, query) => query.state.data === void 0; | ||
| var ensureSuspenseTimers = (defaultedOptions) => { | ||
| if (defaultedOptions.suspense) { | ||
| const MIN_SUSPENSE_TIME_MS = 1e3; | ||
| const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS); | ||
| const originalStaleTime = defaultedOptions.staleTime; | ||
| defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime); | ||
| if (typeof defaultedOptions.gcTime === "number") { | ||
| defaultedOptions.gcTime = Math.max( | ||
| defaultedOptions.gcTime, | ||
| MIN_SUSPENSE_TIME_MS | ||
| ); | ||
| } | ||
| } | ||
| }; | ||
| var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring; | ||
| var shouldSuspend = (defaultedOptions, result) => (defaultedOptions == null ? void 0 : defaultedOptions.suspense) && result.isPending; | ||
| var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => { | ||
| errorResetBoundary.clearReset(); | ||
| }); | ||
| export { | ||
| defaultThrowOnError, | ||
| ensureSuspenseTimers, | ||
| fetchOptimistic, | ||
| shouldSuspend, | ||
| willFetch | ||
| }; | ||
| //# sourceMappingURL=suspense.js.map |
| {"version":3,"sources":["../../src/suspense.ts"],"sourcesContent":["import type {\n DefaultError,\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const defaultThrowOnError = <\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n _error: TError,\n query: Query<TQueryFnData, TError, TData, TQueryKey>,\n) => query.state.data === undefined\n\nexport const ensureSuspenseTimers = (\n defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>,\n) => {\n if (defaultedOptions.suspense) {\n // Handle staleTime to ensure minimum 1000ms in Suspense mode\n // This prevents unnecessary refetching when components remount after suspending\n const MIN_SUSPENSE_TIME_MS = 1000\n\n const clamp = (value: number | 'static' | undefined) =>\n value === 'static'\n ? value\n : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS)\n\n const originalStaleTime = defaultedOptions.staleTime\n defaultedOptions.staleTime =\n typeof originalStaleTime === 'function'\n ? (...args) => clamp(originalStaleTime(...args))\n : clamp(originalStaleTime)\n\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(\n defaultedOptions.gcTime,\n MIN_SUSPENSE_TIME_MS,\n )\n }\n }\n}\n\nexport const willFetch = (\n result: QueryObserverResult<any, any>,\n isRestoring: boolean,\n) => result.isLoading && result.isFetching && !isRestoring\n\nexport const shouldSuspend = (\n defaultedOptions:\n | DefaultedQueryObserverOptions<any, any, any, any, any>\n | undefined,\n result: QueryObserverResult<any, any>,\n) => defaultedOptions?.suspense && result.isPending\n\nexport const fetchOptimistic = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n defaultedOptions: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) =>\n observer.fetchOptimistic(defaultedOptions).catch(() => {\n errorResetBoundary.clearReset()\n })\n"],"mappings":";AAUO,IAAM,sBAAsB,CAMjC,QACA,UACG,MAAM,MAAM,SAAS;AAEnB,IAAM,uBAAuB,CAClC,qBACG;AACH,MAAI,iBAAiB,UAAU;AAG7B,UAAM,uBAAuB;AAE7B,UAAM,QAAQ,CAAC,UACb,UAAU,WACN,QACA,KAAK,IAAI,SAAS,sBAAsB,oBAAoB;AAElE,UAAM,oBAAoB,iBAAiB;AAC3C,qBAAiB,YACf,OAAO,sBAAsB,aACzB,IAAI,SAAS,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAC7C,MAAM,iBAAiB;AAE7B,QAAI,OAAO,iBAAiB,WAAW,UAAU;AAC/C,uBAAiB,SAAS,KAAK;AAAA,QAC7B,iBAAiB;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,YAAY,CACvB,QACA,gBACG,OAAO,aAAa,OAAO,cAAc,CAAC;AAExC,IAAM,gBAAgB,CAC3B,kBAGA,YACG,qDAAkB,aAAY,OAAO;AAEnC,IAAM,kBAAkB,CAO7B,kBAOA,UACA,uBAEA,SAAS,gBAAgB,gBAAgB,EAAE,MAAM,MAAM;AACrD,qBAAmB,WAAW;AAChC,CAAC;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/types.ts | ||
| var types_exports = {}; | ||
| module.exports = __toCommonJS(types_exports); | ||
| //# sourceMappingURL=types.cjs.map |
| {"version":3,"sources":["../../src/types.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport type {\n DefaultError,\n DefinedInfiniteQueryObserverResult,\n DefinedQueryObserverResult,\n DistributiveOmit,\n FetchQueryOptions,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n MutateFunction,\n MutationObserverOptions,\n MutationObserverResult,\n OmitKeyof,\n Override,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n SkipToken,\n} from '@tanstack/query-core'\n\nexport type AnyUseBaseQueryOptions = UseBaseQueryOptions<\n any,\n any,\n any,\n any,\n any\n>\nexport interface UseBaseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n> {\n /**\n * Set this to `false` to unsubscribe this observer from updates to the query cache.\n * Defaults to `true`.\n */\n subscribed?: boolean\n}\n\nexport interface UsePrefetchQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> {\n queryFn?: Exclude<\n FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken\n >\n}\n\nexport type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>\nexport interface UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>,\n 'suspense'\n> {}\n\nexport type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<\n any,\n any,\n any,\n any\n>\nexport interface UseSuspenseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n> {\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken\n >\n}\n\nexport type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<\n any,\n any,\n any,\n any,\n any\n>\nexport interface UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'suspense'\n> {\n /**\n * Set this to `false` to unsubscribe this observer from updates to the query cache.\n * Defaults to `true`.\n */\n subscribed?: boolean\n}\n\nexport type AnyUseSuspenseInfiniteQueryOptions =\n UseSuspenseInfiniteQueryOptions<any, any, any, any, any>\nexport interface UseSuspenseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n> {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\nexport type UseBaseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = QueryObserverResult<TData, TError>\n\nexport type UseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = UseBaseQueryResult<TData, TError>\n\nexport type UseSuspenseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DistributiveOmit<\n DefinedQueryObserverResult<TData, TError>,\n 'isPlaceholderData' | 'promise'\n>\n\nexport type DefinedUseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DefinedQueryObserverResult<TData, TError>\n\nexport type UseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = InfiniteQueryObserverResult<TData, TError>\n\nexport type DefinedUseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DefinedInfiniteQueryObserverResult<TData, TError>\n\nexport type UseSuspenseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = OmitKeyof<\n DefinedInfiniteQueryObserverResult<TData, TError>,\n 'isPlaceholderData' | 'promise'\n>\n\nexport type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>\nexport interface UseMutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>,\n '_defaulted'\n> {}\n\nexport type UseMutateFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = (\n ...args: Parameters<\n MutateFunction<TData, TError, TVariables, TOnMutateResult>\n >\n) => void\n\nexport type UseMutateAsyncFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = MutateFunction<TData, TError, TVariables, TOnMutateResult>\n\nexport type UseBaseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> = Override<\n MutationObserverResult<TData, TError, TVariables, TOnMutateResult>,\n { mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult> }\n> & {\n mutateAsync: UseMutateAsyncFunction<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >\n}\n\nexport type UseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]} |
| export { AnyUseBaseQueryOptions_alias_1 as AnyUseBaseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseQueryOptions_alias_1 as UseBaseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UsePrefetchQueryOptions_alias_1 as UsePrefetchQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseQueryOptions_alias_1 as AnyUseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseQueryOptions_alias_1 as UseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseSuspenseQueryOptions_alias_1 as AnyUseSuspenseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseQueryOptions_alias_1 as UseSuspenseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseInfiniteQueryOptions_alias_1 as AnyUseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseInfiniteQueryOptions_alias_1 as UseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseSuspenseInfiniteQueryOptions_alias_1 as AnyUseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseInfiniteQueryOptions_alias_1 as UseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseQueryResult_alias_1 as UseBaseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseQueryResult_alias_1 as UseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseQueryResult_alias_1 as UseSuspenseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedUseQueryResult_alias_1 as DefinedUseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseInfiniteQueryResult_alias_1 as UseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedUseInfiniteQueryResult_alias_1 as DefinedUseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseInfiniteQueryResult_alias_1 as UseSuspenseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseMutationOptions_alias_1 as AnyUseMutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutationOptions_alias_1 as UseMutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutateFunction_alias_1 as UseMutateFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutateAsyncFunction_alias_1 as UseMutateAsyncFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseMutationResult_alias_1 as UseBaseMutationResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutationResult_alias_1 as UseMutationResult } from './_tsup-dts-rollup.cjs'; |
| export { AnyUseBaseQueryOptions_alias_1 as AnyUseBaseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseQueryOptions_alias_1 as UseBaseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UsePrefetchQueryOptions_alias_1 as UsePrefetchQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseQueryOptions_alias_1 as AnyUseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseQueryOptions_alias_1 as UseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseSuspenseQueryOptions_alias_1 as AnyUseSuspenseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseQueryOptions_alias_1 as UseSuspenseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseInfiniteQueryOptions_alias_1 as AnyUseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseInfiniteQueryOptions_alias_1 as UseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseSuspenseInfiniteQueryOptions_alias_1 as AnyUseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseInfiniteQueryOptions_alias_1 as UseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseQueryResult_alias_1 as UseBaseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseQueryResult_alias_1 as UseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseQueryResult_alias_1 as UseSuspenseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedUseQueryResult_alias_1 as DefinedUseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseInfiniteQueryResult_alias_1 as UseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedUseInfiniteQueryResult_alias_1 as DefinedUseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseInfiniteQueryResult_alias_1 as UseSuspenseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseMutationOptions_alias_1 as AnyUseMutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseMutationOptions_alias_1 as UseMutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseMutateFunction_alias_1 as UseMutateFunction } from './_tsup-dts-rollup.js'; | ||
| export { UseMutateAsyncFunction_alias_1 as UseMutateAsyncFunction } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseMutationResult_alias_1 as UseBaseMutationResult } from './_tsup-dts-rollup.js'; | ||
| export { UseMutationResult_alias_1 as UseMutationResult } from './_tsup-dts-rollup.js'; |
| //# sourceMappingURL=types.js.map |
| {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useBaseQuery.ts | ||
| var useBaseQuery_exports = {}; | ||
| __export(useBaseQuery_exports, { | ||
| useBaseQuery: () => useBaseQuery | ||
| }); | ||
| module.exports = __toCommonJS(useBaseQuery_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| var import_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs"); | ||
| var import_errorBoundaryUtils = require("./errorBoundaryUtils.cjs"); | ||
| var import_IsRestoringProvider = require("./IsRestoringProvider.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useBaseQuery(options, Observer, queryClient) { | ||
| var _a, _b, _c, _d; | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (typeof options !== "object" || Array.isArray(options)) { | ||
| throw new Error( | ||
| 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object' | ||
| ); | ||
| } | ||
| } | ||
| const isRestoring = (0, import_IsRestoringProvider.useIsRestoring)(); | ||
| const errorResetBoundary = (0, import_QueryErrorResetBoundary.useQueryErrorResetBoundary)(); | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const defaultedOptions = client.defaultQueryOptions(options); | ||
| (_b = (_a = client.getDefaultOptions().queries) == null ? void 0 : _a._experimental_beforeQuery) == null ? void 0 : _b.call( | ||
| _a, | ||
| defaultedOptions | ||
| ); | ||
| const query = client.getQueryCache().get(defaultedOptions.queryHash); | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (!defaultedOptions.queryFn) { | ||
| console.error( | ||
| `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function` | ||
| ); | ||
| } | ||
| } | ||
| defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
| (0, import_suspense.ensureSuspenseTimers)(defaultedOptions); | ||
| (0, import_errorBoundaryUtils.ensurePreventErrorBoundaryRetry)(defaultedOptions, errorResetBoundary, query); | ||
| (0, import_errorBoundaryUtils.useClearResetErrorBoundary)(errorResetBoundary); | ||
| const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash); | ||
| const [observer] = React.useState( | ||
| () => new Observer( | ||
| client, | ||
| defaultedOptions | ||
| ) | ||
| ); | ||
| const result = observer.getOptimisticResult(defaultedOptions); | ||
| const shouldSubscribe = !isRestoring && options.subscribed !== false; | ||
| React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => { | ||
| const unsubscribe = shouldSubscribe ? observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)) : import_query_core.noop; | ||
| observer.updateResult(); | ||
| return unsubscribe; | ||
| }, | ||
| [observer, shouldSubscribe] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setOptions(defaultedOptions); | ||
| }, [defaultedOptions, observer]); | ||
| if ((0, import_suspense.shouldSuspend)(defaultedOptions, result)) { | ||
| throw (0, import_suspense.fetchOptimistic)(defaultedOptions, observer, errorResetBoundary); | ||
| } | ||
| if ((0, import_errorBoundaryUtils.getHasError)({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError: defaultedOptions.throwOnError, | ||
| query, | ||
| suspense: defaultedOptions.suspense | ||
| })) { | ||
| throw result.error; | ||
| } | ||
| ; | ||
| (_d = (_c = client.getDefaultOptions().queries) == null ? void 0 : _c._experimental_afterQuery) == null ? void 0 : _d.call( | ||
| _c, | ||
| defaultedOptions, | ||
| result | ||
| ); | ||
| if (defaultedOptions.experimental_prefetchInRender && !import_query_core.environmentManager.isServer() && (0, import_suspense.willFetch)(result, isRestoring)) { | ||
| const promise = isNewCacheEntry ? ( | ||
| // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted | ||
| (0, import_suspense.fetchOptimistic)(defaultedOptions, observer, errorResetBoundary) | ||
| ) : ( | ||
| // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in | ||
| query == null ? void 0 : query.promise | ||
| ); | ||
| promise == null ? void 0 : promise.catch(import_query_core.noop).finally(() => { | ||
| observer.updateResult(); | ||
| }); | ||
| } | ||
| return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useBaseQuery | ||
| }); | ||
| //# sourceMappingURL=useBaseQuery.cjs.map |
| {"version":3,"sources":["../../src/useBaseQuery.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { environmentManager, noop, notifyManager } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport { useIsRestoring } from './IsRestoringProvider'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n willFetch,\n} from './suspense'\nimport type {\n QueryClient,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { UseBaseQueryOptions } from './types'\n\nexport function useBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: UseBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n queryClient?: QueryClient,\n): QueryObserverResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof options !== 'object' || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object',\n )\n }\n }\n\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n const client = useQueryClient(queryClient)\n const defaultedOptions = client.defaultQueryOptions(options)\n ;(client.getDefaultOptions().queries as any)?._experimental_beforeQuery?.(\n defaultedOptions,\n )\n\n const query = client\n .getQueryCache()\n .get<\n TQueryFnData,\n TError,\n TQueryData,\n TQueryKey\n >(defaultedOptions.queryHash)\n\n if (process.env.NODE_ENV !== 'production') {\n if (!defaultedOptions.queryFn) {\n console.error(\n `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`,\n )\n }\n }\n\n // Make sure results are optimistically set in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n ensureSuspenseTimers(defaultedOptions)\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query)\n useClearResetErrorBoundary(errorResetBoundary)\n\n // this needs to be invoked before creating the Observer because that can create a cache entry\n const isNewCacheEntry = !client\n .getQueryCache()\n .get(defaultedOptions.queryHash)\n\n const [observer] = React.useState(\n () =>\n new Observer<TQueryFnData, TError, TData, TQueryData, TQueryKey>(\n client,\n defaultedOptions,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const result = observer.getOptimisticResult(defaultedOptions)\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop\n\n // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n observer.updateResult()\n\n return unsubscribe\n },\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n observer.setOptions(defaultedOptions)\n }, [defaultedOptions, observer])\n\n // Handle suspense\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n }\n\n // Handle error boundary\n if (\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query,\n suspense: defaultedOptions.suspense,\n })\n ) {\n throw result.error\n }\n\n ;(client.getDefaultOptions().queries as any)?._experimental_afterQuery?.(\n defaultedOptions,\n result,\n )\n\n if (\n defaultedOptions.experimental_prefetchInRender &&\n !environmentManager.isServer() &&\n willFetch(result, isRestoring)\n ) {\n const promise = isNewCacheEntry\n ? // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted\n fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n : // subscribe to the \"cache promise\" so that we can finalize the currentThenable once data comes in\n query?.promise\n\n promise?.catch(noop).finally(() => {\n // `.updateResult()` will trigger `.#currentThenable` to finalize\n observer.updateResult()\n })\n }\n\n // Handle result property usage tracking\n return !defaultedOptions.notifyOnChangeProps\n ? observer.trackResult(result)\n : result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAAwD;AACxD,iCAA+B;AAC/B,qCAA2C;AAC3C,gCAIO;AACP,iCAA+B;AAC/B,sBAKO;AASA,SAAS,aAOd,SAOA,UACA,aACoC;AA1CtC;AA2CE,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;AACzD,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kBAAc,2CAAe;AACnC,QAAM,yBAAqB,2DAA2B;AACtD,QAAM,aAAS,2CAAe,WAAW;AACzC,QAAM,mBAAmB,OAAO,oBAAoB,OAAO;AAC1D,GAAC,kBAAO,kBAAkB,EAAE,YAA3B,mBAA4C,8BAA5C;AAAA;AAAA,IACA;AAAA;AAGF,QAAM,QAAQ,OACX,cAAc,EACd,IAKC,iBAAiB,SAAS;AAE9B,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,iBAAiB,SAAS;AAC7B,cAAQ;AAAA,QACN,IAAI,iBAAiB,SAAS;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAGA,mBAAiB,qBAAqB,cAClC,gBACA;AAEJ,4CAAqB,gBAAgB;AACrC,iEAAgC,kBAAkB,oBAAoB,KAAK;AAC3E,4DAA2B,kBAAkB;AAG7C,QAAM,kBAAkB,CAAC,OACtB,cAAc,EACd,IAAI,iBAAiB,SAAS;AAEjC,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAGA,QAAM,SAAS,SAAS,oBAAoB,gBAAgB;AAE5D,QAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;AAC/D,EAAM;AAAA,IACE;AAAA,MACJ,CAAC,kBAAkB;AACjB,cAAM,cAAc,kBAChB,SAAS,UAAU,gCAAc,WAAW,aAAa,CAAC,IAC1D;AAIJ,iBAAS,aAAa;AAEtB,eAAO;AAAA,MACT;AAAA,MACA,CAAC,UAAU,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,gBAAgB;AAAA,EACtC,GAAG,CAAC,kBAAkB,QAAQ,CAAC;AAG/B,UAAI,+BAAc,kBAAkB,MAAM,GAAG;AAC3C,cAAM,iCAAgB,kBAAkB,UAAU,kBAAkB;AAAA,EACtE;AAGA,UACE,uCAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA,cAAc,iBAAiB;AAAA,IAC/B;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC,GACD;AACA,UAAM,OAAO;AAAA,EACf;AAEA;AAAC,GAAC,kBAAO,kBAAkB,EAAE,YAA3B,mBAA4C,6BAA5C;AAAA;AAAA,IACA;AAAA,IACA;AAAA;AAGF,MACE,iBAAiB,iCACjB,CAAC,qCAAmB,SAAS,SAC7B,2BAAU,QAAQ,WAAW,GAC7B;AACA,UAAM,UAAU;AAAA;AAAA,UAEZ,iCAAgB,kBAAkB,UAAU,kBAAkB;AAAA;AAAA;AAAA,MAE9D,+BAAO;AAAA;AAEX,uCAAS,MAAM,wBAAM,QAAQ,MAAM;AAEjC,eAAS,aAAa;AAAA,IACxB;AAAA,EACF;AAGA,SAAO,CAAC,iBAAiB,sBACrB,SAAS,YAAY,MAAM,IAC3B;AACN;","names":[]} |
| export { useBaseQuery } from './_tsup-dts-rollup.cjs'; |
| export { useBaseQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useBaseQuery.ts | ||
| import * as React from "react"; | ||
| import { environmentManager, noop, notifyManager } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| import { useQueryErrorResetBoundary } from "./QueryErrorResetBoundary.js"; | ||
| import { | ||
| ensurePreventErrorBoundaryRetry, | ||
| getHasError, | ||
| useClearResetErrorBoundary | ||
| } from "./errorBoundaryUtils.js"; | ||
| import { useIsRestoring } from "./IsRestoringProvider.js"; | ||
| import { | ||
| ensureSuspenseTimers, | ||
| fetchOptimistic, | ||
| shouldSuspend, | ||
| willFetch | ||
| } from "./suspense.js"; | ||
| function useBaseQuery(options, Observer, queryClient) { | ||
| var _a, _b, _c, _d; | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (typeof options !== "object" || Array.isArray(options)) { | ||
| throw new Error( | ||
| 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object' | ||
| ); | ||
| } | ||
| } | ||
| const isRestoring = useIsRestoring(); | ||
| const errorResetBoundary = useQueryErrorResetBoundary(); | ||
| const client = useQueryClient(queryClient); | ||
| const defaultedOptions = client.defaultQueryOptions(options); | ||
| (_b = (_a = client.getDefaultOptions().queries) == null ? void 0 : _a._experimental_beforeQuery) == null ? void 0 : _b.call( | ||
| _a, | ||
| defaultedOptions | ||
| ); | ||
| const query = client.getQueryCache().get(defaultedOptions.queryHash); | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (!defaultedOptions.queryFn) { | ||
| console.error( | ||
| `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function` | ||
| ); | ||
| } | ||
| } | ||
| defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
| ensureSuspenseTimers(defaultedOptions); | ||
| ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query); | ||
| useClearResetErrorBoundary(errorResetBoundary); | ||
| const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash); | ||
| const [observer] = React.useState( | ||
| () => new Observer( | ||
| client, | ||
| defaultedOptions | ||
| ) | ||
| ); | ||
| const result = observer.getOptimisticResult(defaultedOptions); | ||
| const shouldSubscribe = !isRestoring && options.subscribed !== false; | ||
| React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => { | ||
| const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop; | ||
| observer.updateResult(); | ||
| return unsubscribe; | ||
| }, | ||
| [observer, shouldSubscribe] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setOptions(defaultedOptions); | ||
| }, [defaultedOptions, observer]); | ||
| if (shouldSuspend(defaultedOptions, result)) { | ||
| throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary); | ||
| } | ||
| if (getHasError({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError: defaultedOptions.throwOnError, | ||
| query, | ||
| suspense: defaultedOptions.suspense | ||
| })) { | ||
| throw result.error; | ||
| } | ||
| ; | ||
| (_d = (_c = client.getDefaultOptions().queries) == null ? void 0 : _c._experimental_afterQuery) == null ? void 0 : _d.call( | ||
| _c, | ||
| defaultedOptions, | ||
| result | ||
| ); | ||
| if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) { | ||
| const promise = isNewCacheEntry ? ( | ||
| // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted | ||
| fetchOptimistic(defaultedOptions, observer, errorResetBoundary) | ||
| ) : ( | ||
| // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in | ||
| query == null ? void 0 : query.promise | ||
| ); | ||
| promise == null ? void 0 : promise.catch(noop).finally(() => { | ||
| observer.updateResult(); | ||
| }); | ||
| } | ||
| return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result; | ||
| } | ||
| export { | ||
| useBaseQuery | ||
| }; | ||
| //# sourceMappingURL=useBaseQuery.js.map |
| {"version":3,"sources":["../../src/useBaseQuery.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { environmentManager, noop, notifyManager } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport { useIsRestoring } from './IsRestoringProvider'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n willFetch,\n} from './suspense'\nimport type {\n QueryClient,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { UseBaseQueryOptions } from './types'\n\nexport function useBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: UseBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n queryClient?: QueryClient,\n): QueryObserverResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof options !== 'object' || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object',\n )\n }\n }\n\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n const client = useQueryClient(queryClient)\n const defaultedOptions = client.defaultQueryOptions(options)\n ;(client.getDefaultOptions().queries as any)?._experimental_beforeQuery?.(\n defaultedOptions,\n )\n\n const query = client\n .getQueryCache()\n .get<\n TQueryFnData,\n TError,\n TQueryData,\n TQueryKey\n >(defaultedOptions.queryHash)\n\n if (process.env.NODE_ENV !== 'production') {\n if (!defaultedOptions.queryFn) {\n console.error(\n `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`,\n )\n }\n }\n\n // Make sure results are optimistically set in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n ensureSuspenseTimers(defaultedOptions)\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query)\n useClearResetErrorBoundary(errorResetBoundary)\n\n // this needs to be invoked before creating the Observer because that can create a cache entry\n const isNewCacheEntry = !client\n .getQueryCache()\n .get(defaultedOptions.queryHash)\n\n const [observer] = React.useState(\n () =>\n new Observer<TQueryFnData, TError, TData, TQueryData, TQueryKey>(\n client,\n defaultedOptions,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const result = observer.getOptimisticResult(defaultedOptions)\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop\n\n // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n observer.updateResult()\n\n return unsubscribe\n },\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n observer.setOptions(defaultedOptions)\n }, [defaultedOptions, observer])\n\n // Handle suspense\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n }\n\n // Handle error boundary\n if (\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query,\n suspense: defaultedOptions.suspense,\n })\n ) {\n throw result.error\n }\n\n ;(client.getDefaultOptions().queries as any)?._experimental_afterQuery?.(\n defaultedOptions,\n result,\n )\n\n if (\n defaultedOptions.experimental_prefetchInRender &&\n !environmentManager.isServer() &&\n willFetch(result, isRestoring)\n ) {\n const promise = isNewCacheEntry\n ? // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted\n fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n : // subscribe to the \"cache promise\" so that we can finalize the currentThenable once data comes in\n query?.promise\n\n promise?.catch(noop).finally(() => {\n // `.updateResult()` will trigger `.#currentThenable` to finalize\n observer.updateResult()\n })\n }\n\n // Handle result property usage tracking\n return !defaultedOptions.notifyOnChangeProps\n ? observer.trackResult(result)\n : result\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,SAAS,oBAAoB,MAAM,qBAAqB;AACxD,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASA,SAAS,aAOd,SAOA,UACA,aACoC;AA1CtC;AA2CE,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;AACzD,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,eAAe;AACnC,QAAM,qBAAqB,2BAA2B;AACtD,QAAM,SAAS,eAAe,WAAW;AACzC,QAAM,mBAAmB,OAAO,oBAAoB,OAAO;AAC1D,GAAC,kBAAO,kBAAkB,EAAE,YAA3B,mBAA4C,8BAA5C;AAAA;AAAA,IACA;AAAA;AAGF,QAAM,QAAQ,OACX,cAAc,EACd,IAKC,iBAAiB,SAAS;AAE9B,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,iBAAiB,SAAS;AAC7B,cAAQ;AAAA,QACN,IAAI,iBAAiB,SAAS;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAGA,mBAAiB,qBAAqB,cAClC,gBACA;AAEJ,uBAAqB,gBAAgB;AACrC,kCAAgC,kBAAkB,oBAAoB,KAAK;AAC3E,6BAA2B,kBAAkB;AAG7C,QAAM,kBAAkB,CAAC,OACtB,cAAc,EACd,IAAI,iBAAiB,SAAS;AAEjC,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAGA,QAAM,SAAS,SAAS,oBAAoB,gBAAgB;AAE5D,QAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;AAC/D,EAAM;AAAA,IACE;AAAA,MACJ,CAAC,kBAAkB;AACjB,cAAM,cAAc,kBAChB,SAAS,UAAU,cAAc,WAAW,aAAa,CAAC,IAC1D;AAIJ,iBAAS,aAAa;AAEtB,eAAO;AAAA,MACT;AAAA,MACA,CAAC,UAAU,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,gBAAgB;AAAA,EACtC,GAAG,CAAC,kBAAkB,QAAQ,CAAC;AAG/B,MAAI,cAAc,kBAAkB,MAAM,GAAG;AAC3C,UAAM,gBAAgB,kBAAkB,UAAU,kBAAkB;AAAA,EACtE;AAGA,MACE,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA,cAAc,iBAAiB;AAAA,IAC/B;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC,GACD;AACA,UAAM,OAAO;AAAA,EACf;AAEA;AAAC,GAAC,kBAAO,kBAAkB,EAAE,YAA3B,mBAA4C,6BAA5C;AAAA;AAAA,IACA;AAAA,IACA;AAAA;AAGF,MACE,iBAAiB,iCACjB,CAAC,mBAAmB,SAAS,KAC7B,UAAU,QAAQ,WAAW,GAC7B;AACA,UAAM,UAAU;AAAA;AAAA,MAEZ,gBAAgB,kBAAkB,UAAU,kBAAkB;AAAA;AAAA;AAAA,MAE9D,+BAAO;AAAA;AAEX,uCAAS,MAAM,MAAM,QAAQ,MAAM;AAEjC,eAAS,aAAa;AAAA,IACxB;AAAA,EACF;AAGA,SAAO,CAAC,iBAAiB,sBACrB,SAAS,YAAY,MAAM,IAC3B;AACN;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useInfiniteQuery.ts | ||
| var useInfiniteQuery_exports = {}; | ||
| __export(useInfiniteQuery_exports, { | ||
| useInfiniteQuery: () => useInfiniteQuery | ||
| }); | ||
| module.exports = __toCommonJS(useInfiniteQuery_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useBaseQuery = require("./useBaseQuery.cjs"); | ||
| function useInfiniteQuery(options, queryClient) { | ||
| return (0, import_useBaseQuery.useBaseQuery)( | ||
| options, | ||
| import_query_core.InfiniteQueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useInfiniteQuery | ||
| }); | ||
| //# sourceMappingURL=useInfiniteQuery.cjs.map |
| {"version":3,"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseInfiniteQueryResult,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): DefinedUseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AACtC,0BAA6B;AAqEtB,SAAS,iBACd,SACA,aACA;AACA,aAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| export { useInfiniteQuery_alias_1 as useInfiniteQuery } from './_tsup-dts-rollup.cjs'; |
| export { useInfiniteQuery_alias_1 as useInfiniteQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useInfiniteQuery.ts | ||
| import { InfiniteQueryObserver } from "@tanstack/query-core"; | ||
| import { useBaseQuery } from "./useBaseQuery.js"; | ||
| function useInfiniteQuery(options, queryClient) { | ||
| return useBaseQuery( | ||
| options, | ||
| InfiniteQueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| export { | ||
| useInfiniteQuery | ||
| }; | ||
| //# sourceMappingURL=useInfiniteQuery.js.map |
| {"version":3,"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseInfiniteQueryResult,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): DefinedUseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;AACA,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAqEtB,SAAS,iBACd,SACA,aACA;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useIsFetching.ts | ||
| var useIsFetching_exports = {}; | ||
| __export(useIsFetching_exports, { | ||
| useIsFetching: () => useIsFetching | ||
| }); | ||
| module.exports = __toCommonJS(useIsFetching_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function useIsFetching(filters, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const queryCache = client.getQueryCache(); | ||
| return React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => queryCache.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)), | ||
| [queryCache] | ||
| ), | ||
| () => client.isFetching(filters), | ||
| () => client.isFetching(filters) | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useIsFetching | ||
| }); | ||
| //# sourceMappingURL=useIsFetching.cjs.map |
| {"version":3,"sources":["../../src/useIsFetching.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { notifyManager } from '@tanstack/query-core'\n\nimport { useQueryClient } from './QueryClientProvider'\nimport type { QueryClient, QueryFilters } from '@tanstack/query-core'\n\nexport function useIsFetching(\n filters?: QueryFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n const queryCache = client.getQueryCache()\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),\n [queryCache],\n ),\n () => client.isFetching(filters),\n () => client.isFetching(filters),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,wBAA8B;AAE9B,iCAA+B;AAGxB,SAAS,cACd,SACA,aACQ;AACR,QAAM,aAAS,2CAAe,WAAW;AACzC,QAAM,aAAa,OAAO,cAAc;AAExC,SAAa;AAAA,IACL;AAAA,MACJ,CAAC,kBACC,WAAW,UAAU,gCAAc,WAAW,aAAa,CAAC;AAAA,MAC9D,CAAC,UAAU;AAAA,IACb;AAAA,IACA,MAAM,OAAO,WAAW,OAAO;AAAA,IAC/B,MAAM,OAAO,WAAW,OAAO;AAAA,EACjC;AACF;","names":[]} |
| export { useIsFetching_alias_1 as useIsFetching } from './_tsup-dts-rollup.cjs'; |
| export { useIsFetching_alias_1 as useIsFetching } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useIsFetching.ts | ||
| import * as React from "react"; | ||
| import { notifyManager } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function useIsFetching(filters, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| const queryCache = client.getQueryCache(); | ||
| return React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), | ||
| [queryCache] | ||
| ), | ||
| () => client.isFetching(filters), | ||
| () => client.isFetching(filters) | ||
| ); | ||
| } | ||
| export { | ||
| useIsFetching | ||
| }; | ||
| //# sourceMappingURL=useIsFetching.js.map |
| {"version":3,"sources":["../../src/useIsFetching.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { notifyManager } from '@tanstack/query-core'\n\nimport { useQueryClient } from './QueryClientProvider'\nimport type { QueryClient, QueryFilters } from '@tanstack/query-core'\n\nexport function useIsFetching(\n filters?: QueryFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n const queryCache = client.getQueryCache()\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),\n [queryCache],\n ),\n () => client.isFetching(filters),\n () => client.isFetching(filters),\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB,SAAS,qBAAqB;AAE9B,SAAS,sBAAsB;AAGxB,SAAS,cACd,SACA,aACQ;AACR,QAAM,SAAS,eAAe,WAAW;AACzC,QAAM,aAAa,OAAO,cAAc;AAExC,SAAa;AAAA,IACL;AAAA,MACJ,CAAC,kBACC,WAAW,UAAU,cAAc,WAAW,aAAa,CAAC;AAAA,MAC9D,CAAC,UAAU;AAAA,IACb;AAAA,IACA,MAAM,OAAO,WAAW,OAAO;AAAA,IAC/B,MAAM,OAAO,WAAW,OAAO;AAAA,EACjC;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useMutation.ts | ||
| var useMutation_exports = {}; | ||
| __export(useMutation_exports, { | ||
| useMutation: () => useMutation | ||
| }); | ||
| module.exports = __toCommonJS(useMutation_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function useMutation(options, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const [observer] = React.useState( | ||
| () => new import_query_core.MutationObserver( | ||
| client, | ||
| options | ||
| ) | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setOptions(options); | ||
| }, [observer, options]); | ||
| const result = React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)), | ||
| [observer] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| const mutate = React.useCallback( | ||
| (variables, mutateOptions) => { | ||
| observer.mutate(variables, mutateOptions).catch(import_query_core.noop); | ||
| }, | ||
| [observer] | ||
| ); | ||
| if (result.error && (0, import_query_core.shouldThrowError)(observer.options.throwOnError, [result.error])) { | ||
| throw result.error; | ||
| } | ||
| return { ...result, mutate, mutateAsync: result.mutate }; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useMutation | ||
| }); | ||
| //# sourceMappingURL=useMutation.cjs.map |
| {"version":3,"sources":["../../src/useMutation.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport {\n MutationObserver,\n noop,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n UseMutateFunction,\n UseMutationOptions,\n UseMutationResult,\n} from './types'\nimport type { DefaultError, QueryClient } from '@tanstack/query-core'\n\n// HOOK\n\nexport function useMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n queryClient?: QueryClient,\n): UseMutationResult<TData, TError, TVariables, TOnMutateResult> {\n const client = useQueryClient(queryClient)\n\n const [observer] = React.useState(\n () =>\n new MutationObserver<TData, TError, TVariables, TOnMutateResult>(\n client,\n options,\n ),\n )\n\n React.useEffect(() => {\n observer.setOptions(options)\n }, [observer, options])\n\n const result = React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n observer.subscribe(notifyManager.batchCalls(onStoreChange)),\n [observer],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n const mutate = React.useCallback<\n UseMutateFunction<TData, TError, TVariables, TOnMutateResult>\n >(\n (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop)\n },\n [observer],\n )\n\n if (\n result.error &&\n shouldThrowError(observer.options.throwOnError, [result.error])\n ) {\n throw result.error\n }\n\n return { ...result, mutate, mutateAsync: result.mutate }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,wBAKO;AACP,iCAA+B;AAUxB,SAAS,YAMd,SACA,aAC+D;AAC/D,QAAM,aAAS,2CAAe,WAAW;AAEzC,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,OAAO;AAAA,EAC7B,GAAG,CAAC,UAAU,OAAO,CAAC;AAEtB,QAAM,SAAe;AAAA,IACb;AAAA,MACJ,CAAC,kBACC,SAAS,UAAU,gCAAc,WAAW,aAAa,CAAC;AAAA,MAC5D,CAAC,QAAQ;AAAA,IACX;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,QAAM,SAAe;AAAA,IAGnB,CAAC,WAAW,kBAAkB;AAC5B,eAAS,OAAO,WAAW,aAAa,EAAE,MAAM,sBAAI;AAAA,IACtD;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,MACE,OAAO,aACP,oCAAiB,SAAS,QAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,GAC9D;AACA,UAAM,OAAO;AAAA,EACf;AAEA,SAAO,EAAE,GAAG,QAAQ,QAAQ,aAAa,OAAO,OAAO;AACzD;","names":[]} |
| export { useMutation_alias_1 as useMutation } from './_tsup-dts-rollup.cjs'; |
| export { useMutation_alias_1 as useMutation } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useMutation.ts | ||
| import * as React from "react"; | ||
| import { | ||
| MutationObserver, | ||
| noop, | ||
| notifyManager, | ||
| shouldThrowError | ||
| } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function useMutation(options, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| const [observer] = React.useState( | ||
| () => new MutationObserver( | ||
| client, | ||
| options | ||
| ) | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setOptions(options); | ||
| }, [observer, options]); | ||
| const result = React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), | ||
| [observer] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| const mutate = React.useCallback( | ||
| (variables, mutateOptions) => { | ||
| observer.mutate(variables, mutateOptions).catch(noop); | ||
| }, | ||
| [observer] | ||
| ); | ||
| if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) { | ||
| throw result.error; | ||
| } | ||
| return { ...result, mutate, mutateAsync: result.mutate }; | ||
| } | ||
| export { | ||
| useMutation | ||
| }; | ||
| //# sourceMappingURL=useMutation.js.map |
| {"version":3,"sources":["../../src/useMutation.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport {\n MutationObserver,\n noop,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n UseMutateFunction,\n UseMutationOptions,\n UseMutationResult,\n} from './types'\nimport type { DefaultError, QueryClient } from '@tanstack/query-core'\n\n// HOOK\n\nexport function useMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n queryClient?: QueryClient,\n): UseMutationResult<TData, TError, TVariables, TOnMutateResult> {\n const client = useQueryClient(queryClient)\n\n const [observer] = React.useState(\n () =>\n new MutationObserver<TData, TError, TVariables, TOnMutateResult>(\n client,\n options,\n ),\n )\n\n React.useEffect(() => {\n observer.setOptions(options)\n }, [observer, options])\n\n const result = React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n observer.subscribe(notifyManager.batchCalls(onStoreChange)),\n [observer],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n const mutate = React.useCallback<\n UseMutateFunction<TData, TError, TVariables, TOnMutateResult>\n >(\n (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop)\n },\n [observer],\n )\n\n if (\n result.error &&\n shouldThrowError(observer.options.throwOnError, [result.error])\n ) {\n throw result.error\n }\n\n return { ...result, mutate, mutateAsync: result.mutate }\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAUxB,SAAS,YAMd,SACA,aAC+D;AAC/D,QAAM,SAAS,eAAe,WAAW;AAEzC,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,OAAO;AAAA,EAC7B,GAAG,CAAC,UAAU,OAAO,CAAC;AAEtB,QAAM,SAAe;AAAA,IACb;AAAA,MACJ,CAAC,kBACC,SAAS,UAAU,cAAc,WAAW,aAAa,CAAC;AAAA,MAC5D,CAAC,QAAQ;AAAA,IACX;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,QAAM,SAAe;AAAA,IAGnB,CAAC,WAAW,kBAAkB;AAC5B,eAAS,OAAO,WAAW,aAAa,EAAE,MAAM,IAAI;AAAA,IACtD;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,MACE,OAAO,SACP,iBAAiB,SAAS,QAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,GAC9D;AACA,UAAM,OAAO;AAAA,EACf;AAEA,SAAO,EAAE,GAAG,QAAQ,QAAQ,aAAa,OAAO,OAAO;AACzD;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useMutationState.ts | ||
| var useMutationState_exports = {}; | ||
| __export(useMutationState_exports, { | ||
| useIsMutating: () => useIsMutating, | ||
| useMutationState: () => useMutationState | ||
| }); | ||
| module.exports = __toCommonJS(useMutationState_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function useIsMutating(filters, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| return useMutationState( | ||
| { filters: { ...filters, status: "pending" } }, | ||
| client | ||
| ).length; | ||
| } | ||
| function getResult(mutationCache, options) { | ||
| return mutationCache.findAll(options.filters).map( | ||
| (mutation) => options.select ? options.select(mutation) : mutation.state | ||
| ); | ||
| } | ||
| function useMutationState(options = {}, queryClient) { | ||
| const mutationCache = (0, import_QueryClientProvider.useQueryClient)(queryClient).getMutationCache(); | ||
| const optionsRef = React.useRef(options); | ||
| const result = React.useRef(null); | ||
| if (result.current === null) { | ||
| result.current = getResult(mutationCache, options); | ||
| } | ||
| React.useEffect(() => { | ||
| optionsRef.current = options; | ||
| }); | ||
| return React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => mutationCache.subscribe(() => { | ||
| const nextResult = (0, import_query_core.replaceEqualDeep)( | ||
| result.current, | ||
| getResult(mutationCache, optionsRef.current) | ||
| ); | ||
| if (result.current !== nextResult) { | ||
| result.current = nextResult; | ||
| import_query_core.notifyManager.schedule(onStoreChange); | ||
| } | ||
| }), | ||
| [mutationCache] | ||
| ), | ||
| () => result.current, | ||
| () => result.current | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useIsMutating, | ||
| useMutationState | ||
| }); | ||
| //# sourceMappingURL=useMutationState.cjs.map |
| {"version":3,"sources":["../../src/useMutationState.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { notifyManager, replaceEqualDeep } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n Mutation,\n MutationCache,\n MutationFilters,\n MutationState,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport function useIsMutating(\n filters?: MutationFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n return useMutationState(\n { filters: { ...filters, status: 'pending' } },\n client,\n ).length\n}\n\ntype MutationStateOptions<TResult = MutationState> = {\n filters?: MutationFilters\n select?: (mutation: Mutation) => TResult\n}\n\nfunction getResult<TResult = MutationState>(\n mutationCache: MutationCache,\n options: MutationStateOptions<TResult>,\n): Array<TResult> {\n return mutationCache\n .findAll(options.filters)\n .map(\n (mutation): TResult =>\n (options.select ? options.select(mutation) : mutation.state) as TResult,\n )\n}\n\nexport function useMutationState<TResult = MutationState>(\n options: MutationStateOptions<TResult> = {},\n queryClient?: QueryClient,\n): Array<TResult> {\n const mutationCache = useQueryClient(queryClient).getMutationCache()\n const optionsRef = React.useRef(options)\n const result = React.useRef<Array<TResult>>(null)\n if (result.current === null) {\n result.current = getResult(mutationCache, options)\n }\n\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n mutationCache.subscribe(() => {\n const nextResult = replaceEqualDeep(\n result.current,\n getResult(mutationCache, optionsRef.current),\n )\n if (result.current !== nextResult) {\n result.current = nextResult\n notifyManager.schedule(onStoreChange)\n }\n }),\n [mutationCache],\n ),\n () => result.current,\n () => result.current,\n )!\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAAgD;AAChD,iCAA+B;AASxB,SAAS,cACd,SACA,aACQ;AACR,QAAM,aAAS,2CAAe,WAAW;AACzC,SAAO;AAAA,IACL,EAAE,SAAS,EAAE,GAAG,SAAS,QAAQ,UAAU,EAAE;AAAA,IAC7C;AAAA,EACF,EAAE;AACJ;AAOA,SAAS,UACP,eACA,SACgB;AAChB,SAAO,cACJ,QAAQ,QAAQ,OAAO,EACvB;AAAA,IACC,CAAC,aACE,QAAQ,SAAS,QAAQ,OAAO,QAAQ,IAAI,SAAS;AAAA,EAC1D;AACJ;AAEO,SAAS,iBACd,UAAyC,CAAC,GAC1C,aACgB;AAChB,QAAM,oBAAgB,2CAAe,WAAW,EAAE,iBAAiB;AACnE,QAAM,aAAmB,aAAO,OAAO;AACvC,QAAM,SAAe,aAAuB,IAAI;AAChD,MAAI,OAAO,YAAY,MAAM;AAC3B,WAAO,UAAU,UAAU,eAAe,OAAO;AAAA,EACnD;AAEA,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAED,SAAa;AAAA,IACL;AAAA,MACJ,CAAC,kBACC,cAAc,UAAU,MAAM;AAC5B,cAAM,iBAAa;AAAA,UACjB,OAAO;AAAA,UACP,UAAU,eAAe,WAAW,OAAO;AAAA,QAC7C;AACA,YAAI,OAAO,YAAY,YAAY;AACjC,iBAAO,UAAU;AACjB,0CAAc,SAAS,aAAa;AAAA,QACtC;AAAA,MACF,CAAC;AAAA,MACH,CAAC,aAAa;AAAA,IAChB;AAAA,IACA,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,EACf;AACF;","names":[]} |
| export { useIsMutating_alias_1 as useIsMutating } from './_tsup-dts-rollup.cjs'; | ||
| export { useMutationState_alias_1 as useMutationState } from './_tsup-dts-rollup.cjs'; |
| export { useIsMutating_alias_1 as useIsMutating } from './_tsup-dts-rollup.js'; | ||
| export { useMutationState_alias_1 as useMutationState } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useMutationState.ts | ||
| import * as React from "react"; | ||
| import { notifyManager, replaceEqualDeep } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function useIsMutating(filters, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| return useMutationState( | ||
| { filters: { ...filters, status: "pending" } }, | ||
| client | ||
| ).length; | ||
| } | ||
| function getResult(mutationCache, options) { | ||
| return mutationCache.findAll(options.filters).map( | ||
| (mutation) => options.select ? options.select(mutation) : mutation.state | ||
| ); | ||
| } | ||
| function useMutationState(options = {}, queryClient) { | ||
| const mutationCache = useQueryClient(queryClient).getMutationCache(); | ||
| const optionsRef = React.useRef(options); | ||
| const result = React.useRef(null); | ||
| if (result.current === null) { | ||
| result.current = getResult(mutationCache, options); | ||
| } | ||
| React.useEffect(() => { | ||
| optionsRef.current = options; | ||
| }); | ||
| return React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => mutationCache.subscribe(() => { | ||
| const nextResult = replaceEqualDeep( | ||
| result.current, | ||
| getResult(mutationCache, optionsRef.current) | ||
| ); | ||
| if (result.current !== nextResult) { | ||
| result.current = nextResult; | ||
| notifyManager.schedule(onStoreChange); | ||
| } | ||
| }), | ||
| [mutationCache] | ||
| ), | ||
| () => result.current, | ||
| () => result.current | ||
| ); | ||
| } | ||
| export { | ||
| useIsMutating, | ||
| useMutationState | ||
| }; | ||
| //# sourceMappingURL=useMutationState.js.map |
| {"version":3,"sources":["../../src/useMutationState.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { notifyManager, replaceEqualDeep } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n Mutation,\n MutationCache,\n MutationFilters,\n MutationState,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport function useIsMutating(\n filters?: MutationFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n return useMutationState(\n { filters: { ...filters, status: 'pending' } },\n client,\n ).length\n}\n\ntype MutationStateOptions<TResult = MutationState> = {\n filters?: MutationFilters\n select?: (mutation: Mutation) => TResult\n}\n\nfunction getResult<TResult = MutationState>(\n mutationCache: MutationCache,\n options: MutationStateOptions<TResult>,\n): Array<TResult> {\n return mutationCache\n .findAll(options.filters)\n .map(\n (mutation): TResult =>\n (options.select ? options.select(mutation) : mutation.state) as TResult,\n )\n}\n\nexport function useMutationState<TResult = MutationState>(\n options: MutationStateOptions<TResult> = {},\n queryClient?: QueryClient,\n): Array<TResult> {\n const mutationCache = useQueryClient(queryClient).getMutationCache()\n const optionsRef = React.useRef(options)\n const result = React.useRef<Array<TResult>>(null)\n if (result.current === null) {\n result.current = getResult(mutationCache, options)\n }\n\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n mutationCache.subscribe(() => {\n const nextResult = replaceEqualDeep(\n result.current,\n getResult(mutationCache, optionsRef.current),\n )\n if (result.current !== nextResult) {\n result.current = nextResult\n notifyManager.schedule(onStoreChange)\n }\n }),\n [mutationCache],\n ),\n () => result.current,\n () => result.current,\n )!\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,SAAS,eAAe,wBAAwB;AAChD,SAAS,sBAAsB;AASxB,SAAS,cACd,SACA,aACQ;AACR,QAAM,SAAS,eAAe,WAAW;AACzC,SAAO;AAAA,IACL,EAAE,SAAS,EAAE,GAAG,SAAS,QAAQ,UAAU,EAAE;AAAA,IAC7C;AAAA,EACF,EAAE;AACJ;AAOA,SAAS,UACP,eACA,SACgB;AAChB,SAAO,cACJ,QAAQ,QAAQ,OAAO,EACvB;AAAA,IACC,CAAC,aACE,QAAQ,SAAS,QAAQ,OAAO,QAAQ,IAAI,SAAS;AAAA,EAC1D;AACJ;AAEO,SAAS,iBACd,UAAyC,CAAC,GAC1C,aACgB;AAChB,QAAM,gBAAgB,eAAe,WAAW,EAAE,iBAAiB;AACnE,QAAM,aAAmB,aAAO,OAAO;AACvC,QAAM,SAAe,aAAuB,IAAI;AAChD,MAAI,OAAO,YAAY,MAAM;AAC3B,WAAO,UAAU,UAAU,eAAe,OAAO;AAAA,EACnD;AAEA,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAED,SAAa;AAAA,IACL;AAAA,MACJ,CAAC,kBACC,cAAc,UAAU,MAAM;AAC5B,cAAM,aAAa;AAAA,UACjB,OAAO;AAAA,UACP,UAAU,eAAe,WAAW,OAAO;AAAA,QAC7C;AACA,YAAI,OAAO,YAAY,YAAY;AACjC,iBAAO,UAAU;AACjB,wBAAc,SAAS,aAAa;AAAA,QACtC;AAAA,MACF,CAAC;AAAA,MACH,CAAC,aAAa;AAAA,IAChB;AAAA,IACA,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,EACf;AACF;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/usePrefetchInfiniteQuery.tsx | ||
| var usePrefetchInfiniteQuery_exports = {}; | ||
| __export(usePrefetchInfiniteQuery_exports, { | ||
| usePrefetchInfiniteQuery: () => usePrefetchInfiniteQuery | ||
| }); | ||
| module.exports = __toCommonJS(usePrefetchInfiniteQuery_exports); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function usePrefetchInfiniteQuery(options, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| if (!client.getQueryState(options.queryKey)) { | ||
| client.prefetchInfiniteQuery(options); | ||
| } | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| usePrefetchInfiniteQuery | ||
| }); | ||
| //# sourceMappingURL=usePrefetchInfiniteQuery.cjs.map |
| {"version":3,"sources":["../../src/usePrefetchInfiniteQuery.tsx"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n DefaultError,\n FetchInfiniteQueryOptions,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\n\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchInfiniteQuery(options)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAA+B;AAQxB,SAAS,yBAOd,SAOA,aACA;AACA,QAAM,aAAS,2CAAe,WAAW;AAEzC,MAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GAAG;AAC3C,WAAO,sBAAsB,OAAO;AAAA,EACtC;AACF;","names":[]} |
| export { usePrefetchInfiniteQuery_alias_1 as usePrefetchInfiniteQuery } from './_tsup-dts-rollup.cjs'; |
| export { usePrefetchInfiniteQuery_alias_1 as usePrefetchInfiniteQuery } from './_tsup-dts-rollup.js'; |
| // src/usePrefetchInfiniteQuery.tsx | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function usePrefetchInfiniteQuery(options, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| if (!client.getQueryState(options.queryKey)) { | ||
| client.prefetchInfiniteQuery(options); | ||
| } | ||
| } | ||
| export { | ||
| usePrefetchInfiniteQuery | ||
| }; | ||
| //# sourceMappingURL=usePrefetchInfiniteQuery.js.map |
| {"version":3,"sources":["../../src/usePrefetchInfiniteQuery.tsx"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n DefaultError,\n FetchInfiniteQueryOptions,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\n\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchInfiniteQuery(options)\n }\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAQxB,SAAS,yBAOd,SAOA,aACA;AACA,QAAM,SAAS,eAAe,WAAW;AAEzC,MAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GAAG;AAC3C,WAAO,sBAAsB,OAAO;AAAA,EACtC;AACF;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/usePrefetchQuery.tsx | ||
| var usePrefetchQuery_exports = {}; | ||
| __export(usePrefetchQuery_exports, { | ||
| usePrefetchQuery: () => usePrefetchQuery | ||
| }); | ||
| module.exports = __toCommonJS(usePrefetchQuery_exports); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function usePrefetchQuery(options, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| if (!client.getQueryState(options.queryKey)) { | ||
| client.prefetchQuery(options); | ||
| } | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| usePrefetchQuery | ||
| }); | ||
| //# sourceMappingURL=usePrefetchQuery.cjs.map |
| {"version":3,"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchQuery(options)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAA+B;AAIxB,SAAS,iBAMd,SACA,aACA;AACA,QAAM,aAAS,2CAAe,WAAW;AAEzC,MAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GAAG;AAC3C,WAAO,cAAc,OAAO;AAAA,EAC9B;AACF;","names":[]} |
| export { usePrefetchQuery_alias_1 as usePrefetchQuery } from './_tsup-dts-rollup.cjs'; |
| export { usePrefetchQuery_alias_1 as usePrefetchQuery } from './_tsup-dts-rollup.js'; |
| // src/usePrefetchQuery.tsx | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function usePrefetchQuery(options, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| if (!client.getQueryState(options.queryKey)) { | ||
| client.prefetchQuery(options); | ||
| } | ||
| } | ||
| export { | ||
| usePrefetchQuery | ||
| }; | ||
| //# sourceMappingURL=usePrefetchQuery.js.map |
| {"version":3,"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchQuery(options)\n }\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAIxB,SAAS,iBAMd,SACA,aACA;AACA,QAAM,SAAS,eAAe,WAAW;AAEzC,MAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GAAG;AAC3C,WAAO,cAAc,OAAO;AAAA,EAC9B;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useQueries.ts | ||
| var useQueries_exports = {}; | ||
| __export(useQueries_exports, { | ||
| useQueries: () => useQueries | ||
| }); | ||
| module.exports = __toCommonJS(useQueries_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| var import_IsRestoringProvider = require("./IsRestoringProvider.cjs"); | ||
| var import_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs"); | ||
| var import_errorBoundaryUtils = require("./errorBoundaryUtils.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useQueries({ | ||
| queries, | ||
| ...options | ||
| }, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const isRestoring = (0, import_IsRestoringProvider.useIsRestoring)(); | ||
| const errorResetBoundary = (0, import_QueryErrorResetBoundary.useQueryErrorResetBoundary)(); | ||
| const defaultedQueries = React.useMemo( | ||
| () => queries.map((opts) => { | ||
| const defaultedOptions = client.defaultQueryOptions( | ||
| opts | ||
| ); | ||
| defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
| return defaultedOptions; | ||
| }), | ||
| [queries, client, isRestoring] | ||
| ); | ||
| defaultedQueries.forEach((queryOptions) => { | ||
| (0, import_suspense.ensureSuspenseTimers)(queryOptions); | ||
| const query = client.getQueryCache().get(queryOptions.queryHash); | ||
| (0, import_errorBoundaryUtils.ensurePreventErrorBoundaryRetry)(queryOptions, errorResetBoundary, query); | ||
| }); | ||
| (0, import_errorBoundaryUtils.useClearResetErrorBoundary)(errorResetBoundary); | ||
| const [observer] = React.useState( | ||
| () => new import_query_core.QueriesObserver( | ||
| client, | ||
| defaultedQueries, | ||
| options | ||
| ) | ||
| ); | ||
| const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult( | ||
| defaultedQueries, | ||
| options.combine | ||
| ); | ||
| const shouldSubscribe = !isRestoring && options.subscribed !== false; | ||
| React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => shouldSubscribe ? observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)) : import_query_core.noop, | ||
| [observer, shouldSubscribe] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setQueries( | ||
| defaultedQueries, | ||
| options | ||
| ); | ||
| }, [defaultedQueries, options, observer]); | ||
| const shouldAtLeastOneSuspend = optimisticResult.some( | ||
| (result, index) => (0, import_suspense.shouldSuspend)(defaultedQueries[index], result) | ||
| ); | ||
| const suspensePromises = shouldAtLeastOneSuspend ? optimisticResult.flatMap((result, index) => { | ||
| const opts = defaultedQueries[index]; | ||
| if (opts && (0, import_suspense.shouldSuspend)(opts, result)) { | ||
| const queryObserver = new import_query_core.QueryObserver(client, opts); | ||
| return (0, import_suspense.fetchOptimistic)(opts, queryObserver, errorResetBoundary); | ||
| } | ||
| return []; | ||
| }) : []; | ||
| if (suspensePromises.length > 0) { | ||
| throw Promise.all(suspensePromises); | ||
| } | ||
| const firstSingleResultWhichShouldThrow = optimisticResult.find( | ||
| (result, index) => { | ||
| const query = defaultedQueries[index]; | ||
| return query && (0, import_errorBoundaryUtils.getHasError)({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError: query.throwOnError, | ||
| query: client.getQueryCache().get(query.queryHash), | ||
| suspense: query.suspense | ||
| }); | ||
| } | ||
| ); | ||
| if (firstSingleResultWhichShouldThrow == null ? void 0 : firstSingleResultWhichShouldThrow.error) { | ||
| throw firstSingleResultWhichShouldThrow.error; | ||
| } | ||
| return getCombinedResult(trackResult()); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useQueries | ||
| }); | ||
| //# sourceMappingURL=useQueries.cjs.map |
| {"version":3,"sources":["../../src/useQueries.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport {\n QueriesObserver,\n QueryObserver,\n noop,\n notifyManager,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useIsRestoring } from './IsRestoringProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n} from './suspense'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefaultError,\n OmitKeyof,\n QueriesObserverOptions,\n QueriesPlaceholderDataFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n QueryObserverOptions,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.\n// `placeholderData` function always gets undefined passed\ntype UseQueryOptionsForUseQueries<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'placeholderData' | 'subscribed'\n> & {\n placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>\n}\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetUseQueryOptionsForUseQueries<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseQueryOptionsForUseQueries<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseQueryOptionsForUseQueries<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseQueryOptionsForUseQueries<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError,\n unknown extends TData ? TQueryFnData : TData,\n TQueryKey\n >\n : // Fallback\n UseQueryOptionsForUseQueries\n\n// A defined initialData setting should return a DefinedUseQueryResult rather than UseQueryResult\ntype GetDefinedOrUndefinedQueryResult<T, TData, TError = unknown> = T extends {\n initialData?: infer TInitialData\n}\n ? unknown extends TInitialData\n ? UseQueryResult<TData, TError>\n : TInitialData extends TData\n ? DefinedUseQueryResult<TData, TError>\n : TInitialData extends () => infer TInitialDataResult\n ? unknown extends TInitialDataResult\n ? UseQueryResult<TData, TError>\n : TInitialDataResult extends TData\n ? DefinedUseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n\ntype GetUseQueryResult<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? GetDefinedOrUndefinedQueryResult<\n T,\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n UseQueryResult\n\n/**\n * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n */\nexport type QueriesOptions<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseQueryOptionsForUseQueries>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseQueryOptionsForUseQueries<Head>]\n : T extends [infer Head, ...infer Tails]\n ? QueriesOptions<\n [...Tails],\n [...TResults, GetUseQueryOptionsForUseQueries<Head>],\n [...TDepth, 1]\n >\n : ReadonlyArray<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n UseQueryOptionsForUseQueries<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n UseQueryOptionsForUseQueries<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n >\n : // Fallback\n Array<UseQueryOptionsForUseQueries>\n\n/**\n * QueriesResults reducer recursively maps type param to results\n */\nexport type QueriesResults<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseQueryResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseQueryResult<Head>]\n : T extends [infer Head, ...infer Tails]\n ? QueriesResults<\n [...Tails],\n [...TResults, GetUseQueryResult<Head>],\n [...TDepth, 1]\n >\n : { [K in keyof T]: GetUseQueryResult<T[K]> }\n\nexport function useQueries<\n T extends Array<any>,\n TCombinedResult = QueriesResults<T>,\n>(\n {\n queries,\n ...options\n }: {\n queries:\n | readonly [...QueriesOptions<T>]\n | readonly [...{ [K in keyof T]: GetUseQueryOptionsForUseQueries<T[K]> }]\n combine?: (result: QueriesResults<T>) => TCombinedResult\n subscribed?: boolean\n },\n queryClient?: QueryClient,\n): TCombinedResult {\n const client = useQueryClient(queryClient)\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n\n const defaultedQueries = React.useMemo(\n () =>\n queries.map((opts) => {\n const defaultedOptions = client.defaultQueryOptions(\n opts as QueryObserverOptions,\n )\n\n // Make sure the results are already in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n return defaultedOptions\n }),\n [queries, client, isRestoring],\n )\n\n defaultedQueries.forEach((queryOptions) => {\n ensureSuspenseTimers(queryOptions)\n const query = client.getQueryCache().get(queryOptions.queryHash)\n ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query)\n })\n\n useClearResetErrorBoundary(errorResetBoundary)\n\n const [observer] = React.useState(\n () =>\n new QueriesObserver<TCombinedResult>(\n client,\n defaultedQueries,\n options as QueriesObserverOptions<TCombinedResult>,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const [optimisticResult, getCombinedResult, trackResult] =\n observer.getOptimisticResult(\n defaultedQueries,\n (options as QueriesObserverOptions<TCombinedResult>).combine,\n )\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop,\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n observer.setQueries(\n defaultedQueries,\n options as QueriesObserverOptions<TCombinedResult>,\n )\n }, [defaultedQueries, options, observer])\n\n const shouldAtLeastOneSuspend = optimisticResult.some((result, index) =>\n shouldSuspend(defaultedQueries[index], result),\n )\n\n const suspensePromises = shouldAtLeastOneSuspend\n ? optimisticResult.flatMap((result, index) => {\n const opts = defaultedQueries[index]\n\n if (opts && shouldSuspend(opts, result)) {\n const queryObserver = new QueryObserver(client, opts)\n return fetchOptimistic(opts, queryObserver, errorResetBoundary)\n }\n return []\n })\n : []\n\n if (suspensePromises.length > 0) {\n throw Promise.all(suspensePromises)\n }\n const firstSingleResultWhichShouldThrow = optimisticResult.find(\n (result, index) => {\n const query = defaultedQueries[index]\n return (\n query &&\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: query.throwOnError,\n query: client.getQueryCache().get(query.queryHash),\n suspense: query.suspense,\n })\n )\n },\n )\n\n if (firstSingleResultWhichShouldThrow?.error) {\n throw firstSingleResultWhichShouldThrow.error\n }\n\n return getCombinedResult(trackResult())\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAKO;AACP,iCAA+B;AAC/B,iCAA+B;AAC/B,qCAA2C;AAC3C,gCAIO;AACP,sBAIO;AAyLA,SAAS,WAId;AAAA,EACE;AAAA,EACA,GAAG;AACL,GAOA,aACiB;AACjB,QAAM,aAAS,2CAAe,WAAW;AACzC,QAAM,kBAAc,2CAAe;AACnC,QAAM,yBAAqB,2DAA2B;AAEtD,QAAM,mBAAyB;AAAA,IAC7B,MACE,QAAQ,IAAI,CAAC,SAAS;AACpB,YAAM,mBAAmB,OAAO;AAAA,QAC9B;AAAA,MACF;AAGA,uBAAiB,qBAAqB,cAClC,gBACA;AAEJ,aAAO;AAAA,IACT,CAAC;AAAA,IACH,CAAC,SAAS,QAAQ,WAAW;AAAA,EAC/B;AAEA,mBAAiB,QAAQ,CAAC,iBAAiB;AACzC,8CAAqB,YAAY;AACjC,UAAM,QAAQ,OAAO,cAAc,EAAE,IAAI,aAAa,SAAS;AAC/D,mEAAgC,cAAc,oBAAoB,KAAK;AAAA,EACzE,CAAC;AAED,4DAA2B,kBAAkB;AAE7C,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAGA,QAAM,CAAC,kBAAkB,mBAAmB,WAAW,IACrD,SAAS;AAAA,IACP;AAAA,IACC,QAAoD;AAAA,EACvD;AAEF,QAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;AAC/D,EAAM;AAAA,IACE;AAAA,MACJ,CAAC,kBACC,kBACI,SAAS,UAAU,gCAAc,WAAW,aAAa,CAAC,IAC1D;AAAA,MACN,CAAC,UAAU,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,kBAAkB,SAAS,QAAQ,CAAC;AAExC,QAAM,0BAA0B,iBAAiB;AAAA,IAAK,CAAC,QAAQ,cAC7D,+BAAc,iBAAiB,KAAK,GAAG,MAAM;AAAA,EAC/C;AAEA,QAAM,mBAAmB,0BACrB,iBAAiB,QAAQ,CAAC,QAAQ,UAAU;AAC1C,UAAM,OAAO,iBAAiB,KAAK;AAEnC,QAAI,YAAQ,+BAAc,MAAM,MAAM,GAAG;AACvC,YAAM,gBAAgB,IAAI,gCAAc,QAAQ,IAAI;AACpD,iBAAO,iCAAgB,MAAM,eAAe,kBAAkB;AAAA,IAChE;AACA,WAAO,CAAC;AAAA,EACV,CAAC,IACD,CAAC;AAEL,MAAI,iBAAiB,SAAS,GAAG;AAC/B,UAAM,QAAQ,IAAI,gBAAgB;AAAA,EACpC;AACA,QAAM,oCAAoC,iBAAiB;AAAA,IACzD,CAAC,QAAQ,UAAU;AACjB,YAAM,QAAQ,iBAAiB,KAAK;AACpC,aACE,aACA,uCAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA,cAAc,MAAM;AAAA,QACpB,OAAO,OAAO,cAAc,EAAE,IAAI,MAAM,SAAS;AAAA,QACjD,UAAU,MAAM;AAAA,MAClB,CAAC;AAAA,IAEL;AAAA,EACF;AAEA,MAAI,uFAAmC,OAAO;AAC5C,UAAM,kCAAkC;AAAA,EAC1C;AAEA,SAAO,kBAAkB,YAAY,CAAC;AACxC;","names":[]} |
| export { useQueries_alias_1 as useQueries } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesOptions_alias_1 as QueriesOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesResults_alias_1 as QueriesResults } from './_tsup-dts-rollup.cjs'; |
| export { useQueries_alias_1 as useQueries } from './_tsup-dts-rollup.js'; | ||
| export { QueriesOptions_alias_1 as QueriesOptions } from './_tsup-dts-rollup.js'; | ||
| export { QueriesResults_alias_1 as QueriesResults } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useQueries.ts | ||
| import * as React from "react"; | ||
| import { | ||
| QueriesObserver, | ||
| QueryObserver, | ||
| noop, | ||
| notifyManager | ||
| } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| import { useIsRestoring } from "./IsRestoringProvider.js"; | ||
| import { useQueryErrorResetBoundary } from "./QueryErrorResetBoundary.js"; | ||
| import { | ||
| ensurePreventErrorBoundaryRetry, | ||
| getHasError, | ||
| useClearResetErrorBoundary | ||
| } from "./errorBoundaryUtils.js"; | ||
| import { | ||
| ensureSuspenseTimers, | ||
| fetchOptimistic, | ||
| shouldSuspend | ||
| } from "./suspense.js"; | ||
| function useQueries({ | ||
| queries, | ||
| ...options | ||
| }, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| const isRestoring = useIsRestoring(); | ||
| const errorResetBoundary = useQueryErrorResetBoundary(); | ||
| const defaultedQueries = React.useMemo( | ||
| () => queries.map((opts) => { | ||
| const defaultedOptions = client.defaultQueryOptions( | ||
| opts | ||
| ); | ||
| defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
| return defaultedOptions; | ||
| }), | ||
| [queries, client, isRestoring] | ||
| ); | ||
| defaultedQueries.forEach((queryOptions) => { | ||
| ensureSuspenseTimers(queryOptions); | ||
| const query = client.getQueryCache().get(queryOptions.queryHash); | ||
| ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query); | ||
| }); | ||
| useClearResetErrorBoundary(errorResetBoundary); | ||
| const [observer] = React.useState( | ||
| () => new QueriesObserver( | ||
| client, | ||
| defaultedQueries, | ||
| options | ||
| ) | ||
| ); | ||
| const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult( | ||
| defaultedQueries, | ||
| options.combine | ||
| ); | ||
| const shouldSubscribe = !isRestoring && options.subscribed !== false; | ||
| React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop, | ||
| [observer, shouldSubscribe] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setQueries( | ||
| defaultedQueries, | ||
| options | ||
| ); | ||
| }, [defaultedQueries, options, observer]); | ||
| const shouldAtLeastOneSuspend = optimisticResult.some( | ||
| (result, index) => shouldSuspend(defaultedQueries[index], result) | ||
| ); | ||
| const suspensePromises = shouldAtLeastOneSuspend ? optimisticResult.flatMap((result, index) => { | ||
| const opts = defaultedQueries[index]; | ||
| if (opts && shouldSuspend(opts, result)) { | ||
| const queryObserver = new QueryObserver(client, opts); | ||
| return fetchOptimistic(opts, queryObserver, errorResetBoundary); | ||
| } | ||
| return []; | ||
| }) : []; | ||
| if (suspensePromises.length > 0) { | ||
| throw Promise.all(suspensePromises); | ||
| } | ||
| const firstSingleResultWhichShouldThrow = optimisticResult.find( | ||
| (result, index) => { | ||
| const query = defaultedQueries[index]; | ||
| return query && getHasError({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError: query.throwOnError, | ||
| query: client.getQueryCache().get(query.queryHash), | ||
| suspense: query.suspense | ||
| }); | ||
| } | ||
| ); | ||
| if (firstSingleResultWhichShouldThrow == null ? void 0 : firstSingleResultWhichShouldThrow.error) { | ||
| throw firstSingleResultWhichShouldThrow.error; | ||
| } | ||
| return getCombinedResult(trackResult()); | ||
| } | ||
| export { | ||
| useQueries | ||
| }; | ||
| //# sourceMappingURL=useQueries.js.map |
| {"version":3,"sources":["../../src/useQueries.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport {\n QueriesObserver,\n QueryObserver,\n noop,\n notifyManager,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useIsRestoring } from './IsRestoringProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n} from './suspense'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefaultError,\n OmitKeyof,\n QueriesObserverOptions,\n QueriesPlaceholderDataFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n QueryObserverOptions,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.\n// `placeholderData` function always gets undefined passed\ntype UseQueryOptionsForUseQueries<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'placeholderData' | 'subscribed'\n> & {\n placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>\n}\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetUseQueryOptionsForUseQueries<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseQueryOptionsForUseQueries<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseQueryOptionsForUseQueries<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseQueryOptionsForUseQueries<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError,\n unknown extends TData ? TQueryFnData : TData,\n TQueryKey\n >\n : // Fallback\n UseQueryOptionsForUseQueries\n\n// A defined initialData setting should return a DefinedUseQueryResult rather than UseQueryResult\ntype GetDefinedOrUndefinedQueryResult<T, TData, TError = unknown> = T extends {\n initialData?: infer TInitialData\n}\n ? unknown extends TInitialData\n ? UseQueryResult<TData, TError>\n : TInitialData extends TData\n ? DefinedUseQueryResult<TData, TError>\n : TInitialData extends () => infer TInitialDataResult\n ? unknown extends TInitialDataResult\n ? UseQueryResult<TData, TError>\n : TInitialDataResult extends TData\n ? DefinedUseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n\ntype GetUseQueryResult<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? GetDefinedOrUndefinedQueryResult<\n T,\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n UseQueryResult\n\n/**\n * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n */\nexport type QueriesOptions<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseQueryOptionsForUseQueries>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseQueryOptionsForUseQueries<Head>]\n : T extends [infer Head, ...infer Tails]\n ? QueriesOptions<\n [...Tails],\n [...TResults, GetUseQueryOptionsForUseQueries<Head>],\n [...TDepth, 1]\n >\n : ReadonlyArray<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n UseQueryOptionsForUseQueries<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n UseQueryOptionsForUseQueries<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n >\n : // Fallback\n Array<UseQueryOptionsForUseQueries>\n\n/**\n * QueriesResults reducer recursively maps type param to results\n */\nexport type QueriesResults<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseQueryResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseQueryResult<Head>]\n : T extends [infer Head, ...infer Tails]\n ? QueriesResults<\n [...Tails],\n [...TResults, GetUseQueryResult<Head>],\n [...TDepth, 1]\n >\n : { [K in keyof T]: GetUseQueryResult<T[K]> }\n\nexport function useQueries<\n T extends Array<any>,\n TCombinedResult = QueriesResults<T>,\n>(\n {\n queries,\n ...options\n }: {\n queries:\n | readonly [...QueriesOptions<T>]\n | readonly [...{ [K in keyof T]: GetUseQueryOptionsForUseQueries<T[K]> }]\n combine?: (result: QueriesResults<T>) => TCombinedResult\n subscribed?: boolean\n },\n queryClient?: QueryClient,\n): TCombinedResult {\n const client = useQueryClient(queryClient)\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n\n const defaultedQueries = React.useMemo(\n () =>\n queries.map((opts) => {\n const defaultedOptions = client.defaultQueryOptions(\n opts as QueryObserverOptions,\n )\n\n // Make sure the results are already in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n return defaultedOptions\n }),\n [queries, client, isRestoring],\n )\n\n defaultedQueries.forEach((queryOptions) => {\n ensureSuspenseTimers(queryOptions)\n const query = client.getQueryCache().get(queryOptions.queryHash)\n ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query)\n })\n\n useClearResetErrorBoundary(errorResetBoundary)\n\n const [observer] = React.useState(\n () =>\n new QueriesObserver<TCombinedResult>(\n client,\n defaultedQueries,\n options as QueriesObserverOptions<TCombinedResult>,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const [optimisticResult, getCombinedResult, trackResult] =\n observer.getOptimisticResult(\n defaultedQueries,\n (options as QueriesObserverOptions<TCombinedResult>).combine,\n )\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop,\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n observer.setQueries(\n defaultedQueries,\n options as QueriesObserverOptions<TCombinedResult>,\n )\n }, [defaultedQueries, options, observer])\n\n const shouldAtLeastOneSuspend = optimisticResult.some((result, index) =>\n shouldSuspend(defaultedQueries[index], result),\n )\n\n const suspensePromises = shouldAtLeastOneSuspend\n ? optimisticResult.flatMap((result, index) => {\n const opts = defaultedQueries[index]\n\n if (opts && shouldSuspend(opts, result)) {\n const queryObserver = new QueryObserver(client, opts)\n return fetchOptimistic(opts, queryObserver, errorResetBoundary)\n }\n return []\n })\n : []\n\n if (suspensePromises.length > 0) {\n throw Promise.all(suspensePromises)\n }\n const firstSingleResultWhichShouldThrow = optimisticResult.find(\n (result, index) => {\n const query = defaultedQueries[index]\n return (\n query &&\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: query.throwOnError,\n query: client.getQueryCache().get(query.queryHash),\n suspense: query.suspense,\n })\n )\n },\n )\n\n if (firstSingleResultWhichShouldThrow?.error) {\n throw firstSingleResultWhichShouldThrow.error\n }\n\n return getCombinedResult(trackResult())\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAyLA,SAAS,WAId;AAAA,EACE;AAAA,EACA,GAAG;AACL,GAOA,aACiB;AACjB,QAAM,SAAS,eAAe,WAAW;AACzC,QAAM,cAAc,eAAe;AACnC,QAAM,qBAAqB,2BAA2B;AAEtD,QAAM,mBAAyB;AAAA,IAC7B,MACE,QAAQ,IAAI,CAAC,SAAS;AACpB,YAAM,mBAAmB,OAAO;AAAA,QAC9B;AAAA,MACF;AAGA,uBAAiB,qBAAqB,cAClC,gBACA;AAEJ,aAAO;AAAA,IACT,CAAC;AAAA,IACH,CAAC,SAAS,QAAQ,WAAW;AAAA,EAC/B;AAEA,mBAAiB,QAAQ,CAAC,iBAAiB;AACzC,yBAAqB,YAAY;AACjC,UAAM,QAAQ,OAAO,cAAc,EAAE,IAAI,aAAa,SAAS;AAC/D,oCAAgC,cAAc,oBAAoB,KAAK;AAAA,EACzE,CAAC;AAED,6BAA2B,kBAAkB;AAE7C,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAGA,QAAM,CAAC,kBAAkB,mBAAmB,WAAW,IACrD,SAAS;AAAA,IACP;AAAA,IACC,QAAoD;AAAA,EACvD;AAEF,QAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;AAC/D,EAAM;AAAA,IACE;AAAA,MACJ,CAAC,kBACC,kBACI,SAAS,UAAU,cAAc,WAAW,aAAa,CAAC,IAC1D;AAAA,MACN,CAAC,UAAU,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,kBAAkB,SAAS,QAAQ,CAAC;AAExC,QAAM,0BAA0B,iBAAiB;AAAA,IAAK,CAAC,QAAQ,UAC7D,cAAc,iBAAiB,KAAK,GAAG,MAAM;AAAA,EAC/C;AAEA,QAAM,mBAAmB,0BACrB,iBAAiB,QAAQ,CAAC,QAAQ,UAAU;AAC1C,UAAM,OAAO,iBAAiB,KAAK;AAEnC,QAAI,QAAQ,cAAc,MAAM,MAAM,GAAG;AACvC,YAAM,gBAAgB,IAAI,cAAc,QAAQ,IAAI;AACpD,aAAO,gBAAgB,MAAM,eAAe,kBAAkB;AAAA,IAChE;AACA,WAAO,CAAC;AAAA,EACV,CAAC,IACD,CAAC;AAEL,MAAI,iBAAiB,SAAS,GAAG;AAC/B,UAAM,QAAQ,IAAI,gBAAgB;AAAA,EACpC;AACA,QAAM,oCAAoC,iBAAiB;AAAA,IACzD,CAAC,QAAQ,UAAU;AACjB,YAAM,QAAQ,iBAAiB,KAAK;AACpC,aACE,SACA,YAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA,cAAc,MAAM;AAAA,QACpB,OAAO,OAAO,cAAc,EAAE,IAAI,MAAM,SAAS;AAAA,QACjD,UAAU,MAAM;AAAA,MAClB,CAAC;AAAA,IAEL;AAAA,EACF;AAEA,MAAI,uFAAmC,OAAO;AAC5C,UAAM,kCAAkC;AAAA,EAC1C;AAEA,SAAO,kBAAkB,YAAY,CAAC;AACxC;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useQuery.ts | ||
| var useQuery_exports = {}; | ||
| __export(useQuery_exports, { | ||
| useQuery: () => useQuery | ||
| }); | ||
| module.exports = __toCommonJS(useQuery_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useBaseQuery = require("./useBaseQuery.cjs"); | ||
| function useQuery(options, queryClient) { | ||
| return (0, import_useBaseQuery.useBaseQuery)(options, import_query_core.QueryObserver, queryClient); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useQuery | ||
| }); | ||
| //# sourceMappingURL=useQuery.cjs.map |
| {"version":3,"sources":["../../src/useQuery.ts"],"sourcesContent":["'use client'\nimport { QueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n NoInfer,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n} from './queryOptions'\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): DefinedUseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery(options: UseQueryOptions, queryClient?: QueryClient) {\n return useBaseQuery(options, QueryObserver, queryClient)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA8B;AAC9B,0BAA6B;AA+CtB,SAAS,SAAS,SAA0B,aAA2B;AAC5E,aAAO,kCAAa,SAAS,iCAAe,WAAW;AACzD;","names":[]} |
| export { useQuery_alias_1 as useQuery } from './_tsup-dts-rollup.cjs'; |
| export { useQuery_alias_1 as useQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useQuery.ts | ||
| import { QueryObserver } from "@tanstack/query-core"; | ||
| import { useBaseQuery } from "./useBaseQuery.js"; | ||
| function useQuery(options, queryClient) { | ||
| return useBaseQuery(options, QueryObserver, queryClient); | ||
| } | ||
| export { | ||
| useQuery | ||
| }; | ||
| //# sourceMappingURL=useQuery.js.map |
| {"version":3,"sources":["../../src/useQuery.ts"],"sourcesContent":["'use client'\nimport { QueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n NoInfer,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n} from './queryOptions'\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): DefinedUseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery(options: UseQueryOptions, queryClient?: QueryClient) {\n return useBaseQuery(options, QueryObserver, queryClient)\n}\n"],"mappings":";;;AACA,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AA+CtB,SAAS,SAAS,SAA0B,aAA2B;AAC5E,SAAO,aAAa,SAAS,eAAe,WAAW;AACzD;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useSuspenseInfiniteQuery.ts | ||
| var useSuspenseInfiniteQuery_exports = {}; | ||
| __export(useSuspenseInfiniteQuery_exports, { | ||
| useSuspenseInfiniteQuery: () => useSuspenseInfiniteQuery | ||
| }); | ||
| module.exports = __toCommonJS(useSuspenseInfiniteQuery_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useBaseQuery = require("./useBaseQuery.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useSuspenseInfiniteQuery(options, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (options.queryFn === import_query_core.skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseInfiniteQuery"); | ||
| } | ||
| } | ||
| return (0, import_useBaseQuery.useBaseQuery)( | ||
| { | ||
| ...options, | ||
| enabled: true, | ||
| suspense: true, | ||
| throwOnError: import_suspense.defaultThrowOnError | ||
| }, | ||
| import_query_core.InfiniteQueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useSuspenseInfiniteQuery | ||
| }); | ||
| //# sourceMappingURL=useSuspenseInfiniteQuery.cjs.map |
| {"version":3,"sources":["../../src/useSuspenseInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver, skipToken } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport { defaultThrowOnError } from './suspense'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverSuccessResult,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n UseSuspenseInfiniteQueryOptions,\n UseSuspenseInfiniteQueryResult,\n} from './types'\n\nexport function useSuspenseInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UseSuspenseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseSuspenseInfiniteQueryResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if ((options.queryFn as any) === skipToken) {\n console.error('skipToken is not allowed for useSuspenseInfiniteQuery')\n }\n }\n\n return useBaseQuery(\n {\n ...options,\n enabled: true,\n suspense: true,\n throwOnError: defaultThrowOnError,\n },\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n ) as InfiniteQueryObserverSuccessResult<TData, TError>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAiD;AACjD,0BAA6B;AAC7B,sBAAoC;AAc7B,SAAS,yBAOd,SAOA,aAC+C;AAC/C,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAK,QAAQ,YAAoB,6BAAW;AAC1C,cAAQ,MAAM,uDAAuD;AAAA,IACvE;AAAA,EACF;AAEA,aAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| export { useSuspenseInfiniteQuery_alias_1 as useSuspenseInfiniteQuery } from './_tsup-dts-rollup.cjs'; |
| export { useSuspenseInfiniteQuery_alias_1 as useSuspenseInfiniteQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useSuspenseInfiniteQuery.ts | ||
| import { InfiniteQueryObserver, skipToken } from "@tanstack/query-core"; | ||
| import { useBaseQuery } from "./useBaseQuery.js"; | ||
| import { defaultThrowOnError } from "./suspense.js"; | ||
| function useSuspenseInfiniteQuery(options, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (options.queryFn === skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseInfiniteQuery"); | ||
| } | ||
| } | ||
| return useBaseQuery( | ||
| { | ||
| ...options, | ||
| enabled: true, | ||
| suspense: true, | ||
| throwOnError: defaultThrowOnError | ||
| }, | ||
| InfiniteQueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| export { | ||
| useSuspenseInfiniteQuery | ||
| }; | ||
| //# sourceMappingURL=useSuspenseInfiniteQuery.js.map |
| {"version":3,"sources":["../../src/useSuspenseInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver, skipToken } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport { defaultThrowOnError } from './suspense'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverSuccessResult,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n UseSuspenseInfiniteQueryOptions,\n UseSuspenseInfiniteQueryResult,\n} from './types'\n\nexport function useSuspenseInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UseSuspenseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseSuspenseInfiniteQueryResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if ((options.queryFn as any) === skipToken) {\n console.error('skipToken is not allowed for useSuspenseInfiniteQuery')\n }\n }\n\n return useBaseQuery(\n {\n ...options,\n enabled: true,\n suspense: true,\n throwOnError: defaultThrowOnError,\n },\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n ) as InfiniteQueryObserverSuccessResult<TData, TError>\n}\n"],"mappings":";;;AACA,SAAS,uBAAuB,iBAAiB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAc7B,SAAS,yBAOd,SAOA,aAC+C;AAC/C,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAK,QAAQ,YAAoB,WAAW;AAC1C,cAAQ,MAAM,uDAAuD;AAAA,IACvE;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useSuspenseQueries.ts | ||
| var useSuspenseQueries_exports = {}; | ||
| __export(useSuspenseQueries_exports, { | ||
| useSuspenseQueries: () => useSuspenseQueries | ||
| }); | ||
| module.exports = __toCommonJS(useSuspenseQueries_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useQueries = require("./useQueries.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useSuspenseQueries(options, queryClient) { | ||
| return (0, import_useQueries.useQueries)( | ||
| { | ||
| ...options, | ||
| queries: options.queries.map((query) => { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (query.queryFn === import_query_core.skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseQueries"); | ||
| } | ||
| } | ||
| return { | ||
| ...query, | ||
| suspense: true, | ||
| throwOnError: import_suspense.defaultThrowOnError, | ||
| enabled: true, | ||
| placeholderData: void 0 | ||
| }; | ||
| }) | ||
| }, | ||
| queryClient | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useSuspenseQueries | ||
| }); | ||
| //# sourceMappingURL=useSuspenseQueries.cjs.map |
| {"version":3,"sources":["../../src/useSuspenseQueries.ts"],"sourcesContent":["'use client'\nimport { skipToken } from '@tanstack/query-core'\nimport { useQueries } from './useQueries'\nimport { defaultThrowOnError } from './suspense'\nimport type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types'\nimport type {\n DefaultError,\n QueryClient,\n QueryFunction,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetUseSuspenseQueryOptions<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? UseSuspenseQueryOptions<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseSuspenseQueryOptions<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseSuspenseQueryOptions<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? UseSuspenseQueryOptions<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? UseSuspenseQueryOptions<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseSuspenseQueryOptions<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n : T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryOptions<\n TQueryFnData,\n TError,\n TQueryFnData,\n TQueryKey\n >\n : // Fallback\n UseSuspenseQueryOptions\n\ntype GetUseSuspenseQueryResult<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? UseSuspenseQueryResult<TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseSuspenseQueryResult<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseSuspenseQueryResult<TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? UseSuspenseQueryResult<TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? UseSuspenseQueryResult<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseSuspenseQueryResult<TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryResult<\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryResult<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n UseSuspenseQueryResult\n\n/**\n * SuspenseQueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n */\nexport type SuspenseQueriesOptions<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseSuspenseQueryOptions>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseSuspenseQueryOptions<Head>]\n : T extends [infer Head, ...infer Tails]\n ? SuspenseQueriesOptions<\n [...Tails],\n [...TResults, GetUseSuspenseQueryOptions<Head>],\n [...TDepth, 1]\n >\n : Array<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n UseSuspenseQueryOptions<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>\n >\n : // Fallback\n Array<UseSuspenseQueryOptions>\n\n/**\n * SuspenseQueriesResults reducer recursively maps type param to results\n */\nexport type SuspenseQueriesResults<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseSuspenseQueryResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseSuspenseQueryResult<Head>]\n : T extends [infer Head, ...infer Tails]\n ? SuspenseQueriesResults<\n [...Tails],\n [...TResults, GetUseSuspenseQueryResult<Head>],\n [...TDepth, 1]\n >\n : { [K in keyof T]: GetUseSuspenseQueryResult<T[K]> }\n\nexport function useSuspenseQueries<\n T extends Array<any>,\n TCombinedResult = SuspenseQueriesResults<T>,\n>(\n options: {\n queries:\n | readonly [...SuspenseQueriesOptions<T>]\n | readonly [...{ [K in keyof T]: GetUseSuspenseQueryOptions<T[K]> }]\n combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult\n },\n queryClient?: QueryClient,\n): TCombinedResult\n\nexport function useSuspenseQueries<\n T extends Array<any>,\n TCombinedResult = SuspenseQueriesResults<T>,\n>(\n options: {\n queries: readonly [...SuspenseQueriesOptions<T>]\n combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult\n },\n queryClient?: QueryClient,\n): TCombinedResult\n\nexport function useSuspenseQueries(options: any, queryClient?: QueryClient) {\n return useQueries(\n {\n ...options,\n queries: options.queries.map((query: any) => {\n if (process.env.NODE_ENV !== 'production') {\n if (query.queryFn === skipToken) {\n console.error('skipToken is not allowed for useSuspenseQueries')\n }\n }\n\n return {\n ...query,\n suspense: true,\n throwOnError: defaultThrowOnError,\n enabled: true,\n placeholderData: undefined,\n }\n }),\n },\n queryClient,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0B;AAC1B,wBAA2B;AAC3B,sBAAoC;AAyL7B,SAAS,mBAAmB,SAAc,aAA2B;AAC1E,aAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS,QAAQ,QAAQ,IAAI,CAAC,UAAe;AAC3C,YAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAI,MAAM,YAAY,6BAAW;AAC/B,oBAAQ,MAAM,iDAAiD;AAAA,UACjE;AAAA,QACF;AAEA,eAAO;AAAA,UACL,GAAG;AAAA,UACH,UAAU;AAAA,UACV,cAAc;AAAA,UACd,SAAS;AAAA,UACT,iBAAiB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| export { useSuspenseQueries_alias_1 as useSuspenseQueries } from './_tsup-dts-rollup.cjs'; | ||
| export { SuspenseQueriesOptions_alias_1 as SuspenseQueriesOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { SuspenseQueriesResults_alias_1 as SuspenseQueriesResults } from './_tsup-dts-rollup.cjs'; |
| export { useSuspenseQueries_alias_1 as useSuspenseQueries } from './_tsup-dts-rollup.js'; | ||
| export { SuspenseQueriesOptions_alias_1 as SuspenseQueriesOptions } from './_tsup-dts-rollup.js'; | ||
| export { SuspenseQueriesResults_alias_1 as SuspenseQueriesResults } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useSuspenseQueries.ts | ||
| import { skipToken } from "@tanstack/query-core"; | ||
| import { useQueries } from "./useQueries.js"; | ||
| import { defaultThrowOnError } from "./suspense.js"; | ||
| function useSuspenseQueries(options, queryClient) { | ||
| return useQueries( | ||
| { | ||
| ...options, | ||
| queries: options.queries.map((query) => { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (query.queryFn === skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseQueries"); | ||
| } | ||
| } | ||
| return { | ||
| ...query, | ||
| suspense: true, | ||
| throwOnError: defaultThrowOnError, | ||
| enabled: true, | ||
| placeholderData: void 0 | ||
| }; | ||
| }) | ||
| }, | ||
| queryClient | ||
| ); | ||
| } | ||
| export { | ||
| useSuspenseQueries | ||
| }; | ||
| //# sourceMappingURL=useSuspenseQueries.js.map |
| {"version":3,"sources":["../../src/useSuspenseQueries.ts"],"sourcesContent":["'use client'\nimport { skipToken } from '@tanstack/query-core'\nimport { useQueries } from './useQueries'\nimport { defaultThrowOnError } from './suspense'\nimport type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types'\nimport type {\n DefaultError,\n QueryClient,\n QueryFunction,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetUseSuspenseQueryOptions<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? UseSuspenseQueryOptions<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseSuspenseQueryOptions<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseSuspenseQueryOptions<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? UseSuspenseQueryOptions<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? UseSuspenseQueryOptions<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseSuspenseQueryOptions<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n : T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryOptions<\n TQueryFnData,\n TError,\n TQueryFnData,\n TQueryKey\n >\n : // Fallback\n UseSuspenseQueryOptions\n\ntype GetUseSuspenseQueryResult<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? UseSuspenseQueryResult<TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseSuspenseQueryResult<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseSuspenseQueryResult<TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? UseSuspenseQueryResult<TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? UseSuspenseQueryResult<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseSuspenseQueryResult<TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryResult<\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryResult<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n UseSuspenseQueryResult\n\n/**\n * SuspenseQueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n */\nexport type SuspenseQueriesOptions<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseSuspenseQueryOptions>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseSuspenseQueryOptions<Head>]\n : T extends [infer Head, ...infer Tails]\n ? SuspenseQueriesOptions<\n [...Tails],\n [...TResults, GetUseSuspenseQueryOptions<Head>],\n [...TDepth, 1]\n >\n : Array<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n UseSuspenseQueryOptions<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>\n >\n : // Fallback\n Array<UseSuspenseQueryOptions>\n\n/**\n * SuspenseQueriesResults reducer recursively maps type param to results\n */\nexport type SuspenseQueriesResults<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseSuspenseQueryResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseSuspenseQueryResult<Head>]\n : T extends [infer Head, ...infer Tails]\n ? SuspenseQueriesResults<\n [...Tails],\n [...TResults, GetUseSuspenseQueryResult<Head>],\n [...TDepth, 1]\n >\n : { [K in keyof T]: GetUseSuspenseQueryResult<T[K]> }\n\nexport function useSuspenseQueries<\n T extends Array<any>,\n TCombinedResult = SuspenseQueriesResults<T>,\n>(\n options: {\n queries:\n | readonly [...SuspenseQueriesOptions<T>]\n | readonly [...{ [K in keyof T]: GetUseSuspenseQueryOptions<T[K]> }]\n combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult\n },\n queryClient?: QueryClient,\n): TCombinedResult\n\nexport function useSuspenseQueries<\n T extends Array<any>,\n TCombinedResult = SuspenseQueriesResults<T>,\n>(\n options: {\n queries: readonly [...SuspenseQueriesOptions<T>]\n combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult\n },\n queryClient?: QueryClient,\n): TCombinedResult\n\nexport function useSuspenseQueries(options: any, queryClient?: QueryClient) {\n return useQueries(\n {\n ...options,\n queries: options.queries.map((query: any) => {\n if (process.env.NODE_ENV !== 'production') {\n if (query.queryFn === skipToken) {\n console.error('skipToken is not allowed for useSuspenseQueries')\n }\n }\n\n return {\n ...query,\n suspense: true,\n throwOnError: defaultThrowOnError,\n enabled: true,\n placeholderData: undefined,\n }\n }),\n },\n queryClient,\n )\n}\n"],"mappings":";;;AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AAyL7B,SAAS,mBAAmB,SAAc,aAA2B;AAC1E,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS,QAAQ,QAAQ,IAAI,CAAC,UAAe;AAC3C,YAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAI,MAAM,YAAY,WAAW;AAC/B,oBAAQ,MAAM,iDAAiD;AAAA,UACjE;AAAA,QACF;AAEA,eAAO;AAAA,UACL,GAAG;AAAA,UACH,UAAU;AAAA,UACV,cAAc;AAAA,UACd,SAAS;AAAA,UACT,iBAAiB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useSuspenseQuery.ts | ||
| var useSuspenseQuery_exports = {}; | ||
| __export(useSuspenseQuery_exports, { | ||
| useSuspenseQuery: () => useSuspenseQuery | ||
| }); | ||
| module.exports = __toCommonJS(useSuspenseQuery_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useBaseQuery = require("./useBaseQuery.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useSuspenseQuery(options, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (options.queryFn === import_query_core.skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseQuery"); | ||
| } | ||
| } | ||
| return (0, import_useBaseQuery.useBaseQuery)( | ||
| { | ||
| ...options, | ||
| enabled: true, | ||
| suspense: true, | ||
| throwOnError: import_suspense.defaultThrowOnError, | ||
| placeholderData: void 0 | ||
| }, | ||
| import_query_core.QueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useSuspenseQuery | ||
| }); | ||
| //# sourceMappingURL=useSuspenseQuery.cjs.map |
| {"version":3,"sources":["../../src/useSuspenseQuery.ts"],"sourcesContent":["'use client'\nimport { QueryObserver, skipToken } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport { defaultThrowOnError } from './suspense'\nimport type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\n\nexport function useSuspenseQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if ((options.queryFn as any) === skipToken) {\n console.error('skipToken is not allowed for useSuspenseQuery')\n }\n }\n\n return useBaseQuery(\n {\n ...options,\n enabled: true,\n suspense: true,\n throwOnError: defaultThrowOnError,\n placeholderData: undefined,\n },\n QueryObserver,\n queryClient,\n ) as UseSuspenseQueryResult<TData, TError>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAyC;AACzC,0BAA6B;AAC7B,sBAAoC;AAI7B,SAAS,iBAMd,SACA,aACuC;AACvC,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAK,QAAQ,YAAoB,6BAAW;AAC1C,cAAQ,MAAM,+CAA+C;AAAA,IAC/D;AAAA,EACF;AAEA,aAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,cAAc;AAAA,MACd,iBAAiB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| export { useSuspenseQuery_alias_1 as useSuspenseQuery } from './_tsup-dts-rollup.cjs'; |
| export { useSuspenseQuery_alias_1 as useSuspenseQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useSuspenseQuery.ts | ||
| import { QueryObserver, skipToken } from "@tanstack/query-core"; | ||
| import { useBaseQuery } from "./useBaseQuery.js"; | ||
| import { defaultThrowOnError } from "./suspense.js"; | ||
| function useSuspenseQuery(options, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (options.queryFn === skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseQuery"); | ||
| } | ||
| } | ||
| return useBaseQuery( | ||
| { | ||
| ...options, | ||
| enabled: true, | ||
| suspense: true, | ||
| throwOnError: defaultThrowOnError, | ||
| placeholderData: void 0 | ||
| }, | ||
| QueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| export { | ||
| useSuspenseQuery | ||
| }; | ||
| //# sourceMappingURL=useSuspenseQuery.js.map |
| {"version":3,"sources":["../../src/useSuspenseQuery.ts"],"sourcesContent":["'use client'\nimport { QueryObserver, skipToken } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport { defaultThrowOnError } from './suspense'\nimport type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\n\nexport function useSuspenseQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if ((options.queryFn as any) === skipToken) {\n console.error('skipToken is not allowed for useSuspenseQuery')\n }\n }\n\n return useBaseQuery(\n {\n ...options,\n enabled: true,\n suspense: true,\n throwOnError: defaultThrowOnError,\n placeholderData: undefined,\n },\n QueryObserver,\n queryClient,\n ) as UseSuspenseQueryResult<TData, TError>\n}\n"],"mappings":";;;AACA,SAAS,eAAe,iBAAiB;AACzC,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAI7B,SAAS,iBAMd,SACA,aACuC;AACvC,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAK,QAAQ,YAAoB,WAAW;AAC1C,cAAQ,MAAM,+CAA+C;AAAA,IAC/D;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,cAAc;AAAA,MACd,iBAAiB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| import { AnyDataTag } from '@tanstack/query-core'; | ||
| import { CancelledError } from '@tanstack/query-core'; | ||
| import { CancelOptions } from '@tanstack/query-core'; | ||
| import { DataTag } from '@tanstack/query-core'; | ||
| import { dataTagErrorSymbol } from '@tanstack/query-core'; | ||
| import { dataTagSymbol } from '@tanstack/query-core'; | ||
| import { DefaultedInfiniteQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { DefaultedQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { DefaultError } from '@tanstack/query-core'; | ||
| import { DefaultOptions } from '@tanstack/query-core'; | ||
| import { defaultScheduler } from '@tanstack/query-core'; | ||
| import { defaultShouldDehydrateMutation } from '@tanstack/query-core'; | ||
| import { defaultShouldDehydrateQuery } from '@tanstack/query-core'; | ||
| import { DefinedInfiniteQueryObserverResult } from '@tanstack/query-core'; | ||
| import { DefinedQueryObserverResult } from '@tanstack/query-core'; | ||
| import { dehydrate } from '@tanstack/query-core'; | ||
| import { DehydratedState } from '@tanstack/query-core'; | ||
| import { DehydrateOptions } from '@tanstack/query-core'; | ||
| import { DistributiveOmit } from '@tanstack/query-core'; | ||
| import { Enabled } from '@tanstack/query-core'; | ||
| import { EnsureInfiniteQueryDataOptions } from '@tanstack/query-core'; | ||
| import { EnsureQueryDataOptions } from '@tanstack/query-core'; | ||
| import { environmentManager } from '@tanstack/query-core'; | ||
| import { experimental_streamedQuery } from '@tanstack/query-core'; | ||
| import { FetchInfiniteQueryOptions } from '@tanstack/query-core'; | ||
| import { FetchNextPageOptions } from '@tanstack/query-core'; | ||
| import { FetchPreviousPageOptions } from '@tanstack/query-core'; | ||
| import { FetchQueryOptions } from '@tanstack/query-core'; | ||
| import { FetchStatus } from '@tanstack/query-core'; | ||
| import { focusManager } from '@tanstack/query-core'; | ||
| import { GetNextPageParamFunction } from '@tanstack/query-core'; | ||
| import { GetPreviousPageParamFunction } from '@tanstack/query-core'; | ||
| import { hashKey } from '@tanstack/query-core'; | ||
| import { hydrate } from '@tanstack/query-core'; | ||
| import { HydrateOptions } from '@tanstack/query-core'; | ||
| import { InferDataFromTag } from '@tanstack/query-core'; | ||
| import { InferErrorFromTag } from '@tanstack/query-core'; | ||
| import { InfiniteData } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserver } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverBaseResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverLoadingErrorResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverPendingResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverPlaceholderResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverRefetchErrorResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryPageParamsOptions } from '@tanstack/query-core'; | ||
| import { InitialDataFunction } from '@tanstack/query-core'; | ||
| import { InitialPageParam } from '@tanstack/query-core'; | ||
| import { InvalidateOptions } from '@tanstack/query-core'; | ||
| import { InvalidateQueryFilters } from '@tanstack/query-core'; | ||
| import { isCancelledError } from '@tanstack/query-core'; | ||
| import { isServer } from '@tanstack/query-core'; | ||
| import { JSX } from 'react/jsx-runtime'; | ||
| import { keepPreviousData } from '@tanstack/query-core'; | ||
| import { ManagedTimerId } from '@tanstack/query-core'; | ||
| import { matchMutation } from '@tanstack/query-core'; | ||
| import { matchQuery } from '@tanstack/query-core'; | ||
| import { MutateFunction } from '@tanstack/query-core'; | ||
| import { MutateOptions } from '@tanstack/query-core'; | ||
| import { Mutation } from '@tanstack/query-core'; | ||
| import { MutationCache } from '@tanstack/query-core'; | ||
| import { MutationCacheNotifyEvent } from '@tanstack/query-core'; | ||
| import { MutationFilters } from '@tanstack/query-core'; | ||
| import { MutationFunction } from '@tanstack/query-core'; | ||
| import { MutationFunctionContext } from '@tanstack/query-core'; | ||
| import { MutationKey } from '@tanstack/query-core'; | ||
| import { MutationMeta } from '@tanstack/query-core'; | ||
| import { MutationObserver as MutationObserver_2 } from '@tanstack/query-core'; | ||
| import { MutationObserverBaseResult } from '@tanstack/query-core'; | ||
| import { MutationObserverErrorResult } from '@tanstack/query-core'; | ||
| import { MutationObserverIdleResult } from '@tanstack/query-core'; | ||
| import { MutationObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { MutationObserverOptions } from '@tanstack/query-core'; | ||
| import { MutationObserverResult } from '@tanstack/query-core'; | ||
| import { MutationObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { MutationOptions } from '@tanstack/query-core'; | ||
| import { MutationScope } from '@tanstack/query-core'; | ||
| import { MutationState } from '@tanstack/query-core'; | ||
| import { MutationStatus } from '@tanstack/query-core'; | ||
| import { NetworkMode } from '@tanstack/query-core'; | ||
| import { NoInfer as NoInfer_2 } from '@tanstack/query-core'; | ||
| import { NonUndefinedGuard } from '@tanstack/query-core'; | ||
| import { noop } from '@tanstack/query-core'; | ||
| import { NotifyEvent } from '@tanstack/query-core'; | ||
| import { NotifyEventType } from '@tanstack/query-core'; | ||
| import { notifyManager } from '@tanstack/query-core'; | ||
| import { NotifyOnChangeProps } from '@tanstack/query-core'; | ||
| import { OmitKeyof } from '@tanstack/query-core'; | ||
| import { onlineManager } from '@tanstack/query-core'; | ||
| import { Options } from 'tsup'; | ||
| import { Override } from '@tanstack/query-core'; | ||
| import { partialMatchKey } from '@tanstack/query-core'; | ||
| import { PlaceholderDataFunction } from '@tanstack/query-core'; | ||
| import { QueriesObserver } from '@tanstack/query-core'; | ||
| import { QueriesObserverOptions } from '@tanstack/query-core'; | ||
| import { QueriesPlaceholderDataFunction } from '@tanstack/query-core'; | ||
| import { Query } from '@tanstack/query-core'; | ||
| import { QueryCache } from '@tanstack/query-core'; | ||
| import { QueryCacheNotifyEvent } from '@tanstack/query-core'; | ||
| import { QueryClient } from '@tanstack/query-core'; | ||
| import { QueryClientConfig } from '@tanstack/query-core'; | ||
| import { QueryFilters } from '@tanstack/query-core'; | ||
| import { QueryFunction } from '@tanstack/query-core'; | ||
| import { QueryFunctionContext } from '@tanstack/query-core'; | ||
| import { QueryKey } from '@tanstack/query-core'; | ||
| import { QueryKeyHashFunction } from '@tanstack/query-core'; | ||
| import { QueryMeta } from '@tanstack/query-core'; | ||
| import { QueryObserver } from '@tanstack/query-core'; | ||
| import { QueryObserverBaseResult } from '@tanstack/query-core'; | ||
| import { QueryObserverLoadingErrorResult } from '@tanstack/query-core'; | ||
| import { QueryObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { QueryObserverOptions } from '@tanstack/query-core'; | ||
| import { QueryObserverPendingResult } from '@tanstack/query-core'; | ||
| import { QueryObserverPlaceholderResult } from '@tanstack/query-core'; | ||
| import { QueryObserverRefetchErrorResult } from '@tanstack/query-core'; | ||
| import { QueryObserverResult } from '@tanstack/query-core'; | ||
| import { QueryObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { QueryOptions } from '@tanstack/query-core'; | ||
| import { QueryPersister } from '@tanstack/query-core'; | ||
| import { QueryState } from '@tanstack/query-core'; | ||
| import { QueryStatus } from '@tanstack/query-core'; | ||
| import * as React_2 from 'react'; | ||
| import { RefetchOptions } from '@tanstack/query-core'; | ||
| import { RefetchQueryFilters } from '@tanstack/query-core'; | ||
| import { Register } from '@tanstack/query-core'; | ||
| import { replaceEqualDeep } from '@tanstack/query-core'; | ||
| import { ResetOptions } from '@tanstack/query-core'; | ||
| import { ResultOptions } from '@tanstack/query-core'; | ||
| import { SetDataOptions } from '@tanstack/query-core'; | ||
| import { shouldThrowError } from '@tanstack/query-core'; | ||
| import { SkipToken } from '@tanstack/query-core'; | ||
| import { skipToken } from '@tanstack/query-core'; | ||
| import { StaleTime } from '@tanstack/query-core'; | ||
| import { StaleTimeFunction } from '@tanstack/query-core'; | ||
| import { ThrowOnError } from '@tanstack/query-core'; | ||
| import { TimeoutCallback } from '@tanstack/query-core'; | ||
| import { timeoutManager } from '@tanstack/query-core'; | ||
| import { TimeoutProvider } from '@tanstack/query-core'; | ||
| import { UnsetMarker } from '@tanstack/query-core'; | ||
| import { unsetMarker } from '@tanstack/query-core'; | ||
| import { Updater } from '@tanstack/query-core'; | ||
| import { UserConfig } from 'vite'; | ||
| import { WithRequired } from '@tanstack/query-core'; | ||
| export { AnyDataTag } | ||
| declare type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseBaseQueryOptions } | ||
| export { AnyUseBaseQueryOptions as AnyUseBaseQueryOptions_alias_1 } | ||
| declare type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseInfiniteQueryOptions } | ||
| export { AnyUseInfiniteQueryOptions as AnyUseInfiniteQueryOptions_alias_1 } | ||
| declare type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>; | ||
| export { AnyUseMutationOptions } | ||
| export { AnyUseMutationOptions as AnyUseMutationOptions_alias_1 } | ||
| declare type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>; | ||
| export { AnyUseQueryOptions } | ||
| export { AnyUseQueryOptions as AnyUseQueryOptions_alias_1 } | ||
| declare type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseSuspenseInfiniteQueryOptions } | ||
| export { AnyUseSuspenseInfiniteQueryOptions as AnyUseSuspenseInfiniteQueryOptions_alias_1 } | ||
| declare type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>; | ||
| export { AnyUseSuspenseQueryOptions } | ||
| export { AnyUseSuspenseQueryOptions as AnyUseSuspenseQueryOptions_alias_1 } | ||
| export { CancelledError } | ||
| export { CancelOptions } | ||
| export { DataTag } | ||
| export { dataTagErrorSymbol } | ||
| export { dataTagSymbol } | ||
| export declare const default_alias: any[]; | ||
| export declare const default_alias_1: any[]; | ||
| export declare const default_alias_2: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>); | ||
| export declare const default_alias_3: UserConfig; | ||
| export { DefaultedInfiniteQueryObserverOptions } | ||
| export { DefaultedQueryObserverOptions } | ||
| export { DefaultError } | ||
| export { DefaultOptions } | ||
| export { defaultScheduler } | ||
| export { defaultShouldDehydrateMutation } | ||
| export { defaultShouldDehydrateQuery } | ||
| export declare const defaultThrowOnError: <TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(_error: TError, query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean; | ||
| export { DefinedInfiniteQueryObserverResult } | ||
| declare type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined; | ||
| }; | ||
| export { DefinedInitialDataInfiniteOptions } | ||
| export { DefinedInitialDataInfiniteOptions as DefinedInitialDataInfiniteOptions_alias_1 } | ||
| declare type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & { | ||
| initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>); | ||
| queryFn?: QueryFunction<TQueryFnData, TQueryKey>; | ||
| }; | ||
| export { DefinedInitialDataOptions } | ||
| export { DefinedInitialDataOptions as DefinedInitialDataOptions_alias_1 } | ||
| export { DefinedQueryObserverResult } | ||
| declare type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>; | ||
| export { DefinedUseInfiniteQueryResult } | ||
| export { DefinedUseInfiniteQueryResult as DefinedUseInfiniteQueryResult_alias_1 } | ||
| declare type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>; | ||
| export { DefinedUseQueryResult } | ||
| export { DefinedUseQueryResult as DefinedUseQueryResult_alias_1 } | ||
| export { dehydrate } | ||
| export { DehydratedState } | ||
| export { DehydrateOptions } | ||
| export { DistributiveOmit } | ||
| export { Enabled } | ||
| export { EnsureInfiniteQueryDataOptions } | ||
| export declare const ensurePreventErrorBoundaryRetry: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue, query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined) => void; | ||
| export { EnsureQueryDataOptions } | ||
| export declare const ensureSuspenseTimers: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void; | ||
| export { environmentManager } | ||
| export { experimental_streamedQuery } | ||
| export { FetchInfiniteQueryOptions } | ||
| export { FetchNextPageOptions } | ||
| export declare const fetchOptimistic: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(defaultedOptions: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue) => Promise<void | QueryObserverResult<TData, TError>>; | ||
| export { FetchPreviousPageOptions } | ||
| export { FetchQueryOptions } | ||
| export { FetchStatus } | ||
| export { focusManager } | ||
| declare type GetDefinedOrUndefinedQueryResult<T, TData, TError = unknown> = T extends { | ||
| initialData?: infer TInitialData; | ||
| } ? unknown extends TInitialData ? UseQueryResult<TData, TError> : TInitialData extends TData ? DefinedUseQueryResult<TData, TError> : TInitialData extends () => infer TInitialDataResult ? unknown extends TInitialDataResult ? UseQueryResult<TData, TError> : TInitialDataResult extends TData ? DefinedUseQueryResult<TData, TError> : UseQueryResult<TData, TError> : UseQueryResult<TData, TError> : UseQueryResult<TData, TError>; | ||
| export declare const getHasError: <TData, TError, TQueryFnData, TQueryData, TQueryKey extends QueryKey>({ result, errorResetBoundary, throwOnError, query, suspense, }: { | ||
| result: QueryObserverResult<TData, TError>; | ||
| errorResetBoundary: QueryErrorResetBoundaryValue; | ||
| throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>; | ||
| query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined; | ||
| suspense: boolean | undefined; | ||
| }) => boolean | undefined; | ||
| export { GetNextPageParamFunction } | ||
| export { GetPreviousPageParamFunction } | ||
| declare type GetUseQueryOptionsForUseQueries<T> = T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseQueryOptionsForUseQueries<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? UseQueryOptionsForUseQueries<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseQueryOptionsForUseQueries<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, unknown extends TError ? DefaultError : TError, unknown extends TData ? TQueryFnData : TData, TQueryKey> : UseQueryOptionsForUseQueries; | ||
| declare type GetUseQueryResult<T> = T extends { | ||
| queryFnData: any; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends [any, infer TError, infer TData] ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends [infer TQueryFnData, infer TError] ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError> : T extends [infer TQueryFnData] ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : UseQueryResult; | ||
| declare type GetUseSuspenseQueryOptions<T> = T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TData> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryOptions<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? UseSuspenseQueryOptions<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? UseSuspenseQueryOptions<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseSuspenseQueryOptions<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries_2; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries_2; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TQueryFnData, TQueryKey> : UseSuspenseQueryOptions; | ||
| declare type GetUseSuspenseQueryResult<T> = T extends { | ||
| queryFnData: any; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseSuspenseQueryResult<TData, TError> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryResult<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryResult<TData, TError> : T extends [any, infer TError, infer TData] ? UseSuspenseQueryResult<TData, TError> : T extends [infer TQueryFnData, infer TError] ? UseSuspenseQueryResult<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseSuspenseQueryResult<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries_2; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryResult<unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries_2; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryResult<TQueryFnData, unknown extends TError ? DefaultError : TError> : UseSuspenseQueryResult; | ||
| export { hashKey } | ||
| export { hydrate } | ||
| export { HydrateOptions } | ||
| declare const HydrationBoundary: ({ children, options, state, queryClient, }: HydrationBoundaryProps) => React_2.ReactElement; | ||
| export { HydrationBoundary } | ||
| export { HydrationBoundary as HydrationBoundary_alias_1 } | ||
| declare interface HydrationBoundaryProps { | ||
| state: DehydratedState | null | undefined; | ||
| options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & { | ||
| defaultOptions?: OmitKeyof<Exclude<HydrateOptions['defaultOptions'], undefined>, 'mutations'>; | ||
| }; | ||
| children?: React_2.ReactNode; | ||
| queryClient?: QueryClient; | ||
| } | ||
| export { HydrationBoundaryProps } | ||
| export { HydrationBoundaryProps as HydrationBoundaryProps_alias_1 } | ||
| export { InferDataFromTag } | ||
| export { InferErrorFromTag } | ||
| export { InfiniteData } | ||
| export { InfiniteQueryObserver } | ||
| export { InfiniteQueryObserverBaseResult } | ||
| export { InfiniteQueryObserverLoadingErrorResult } | ||
| export { InfiniteQueryObserverLoadingResult } | ||
| export { InfiniteQueryObserverOptions } | ||
| export { InfiniteQueryObserverPendingResult } | ||
| export { InfiniteQueryObserverPlaceholderResult } | ||
| export { InfiniteQueryObserverRefetchErrorResult } | ||
| export { InfiniteQueryObserverResult } | ||
| export { InfiniteQueryObserverSuccessResult } | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| export { infiniteQueryOptions } | ||
| export { infiniteQueryOptions as infiniteQueryOptions_alias_1 } | ||
| export { InfiniteQueryPageParamsOptions } | ||
| export { InitialDataFunction } | ||
| export { InitialPageParam } | ||
| export { InvalidateOptions } | ||
| export { InvalidateQueryFilters } | ||
| export { isCancelledError } | ||
| declare const IsRestoringProvider: React_2.Provider<boolean>; | ||
| export { IsRestoringProvider } | ||
| export { IsRestoringProvider as IsRestoringProvider_alias_1 } | ||
| export { isServer } | ||
| export { keepPreviousData } | ||
| /** | ||
| * @param {Object} opts - Options for building configurations. | ||
| * @param {string[]} opts.entry - The entry array. | ||
| * @returns {import('tsup').Options} | ||
| */ | ||
| export declare function legacyConfig(opts: { | ||
| entry: string[]; | ||
| }): Options; | ||
| export { ManagedTimerId } | ||
| export { matchMutation } | ||
| export { matchQuery } | ||
| declare type MAXIMUM_DEPTH = 20; | ||
| declare type MAXIMUM_DEPTH_2 = 20; | ||
| /** | ||
| * @param {Object} opts - Options for building configurations. | ||
| * @param {string[]} opts.entry - The entry array. | ||
| * @returns {import('tsup').Options} | ||
| */ | ||
| export declare function modernConfig(opts: { | ||
| entry: string[]; | ||
| }): Options; | ||
| export { MutateFunction } | ||
| export { MutateOptions } | ||
| export { Mutation } | ||
| export { MutationCache } | ||
| export { MutationCacheNotifyEvent } | ||
| export { MutationFilters } | ||
| export { MutationFunction } | ||
| export { MutationFunctionContext } | ||
| export { MutationKey } | ||
| export { MutationMeta } | ||
| export { MutationObserver_2 as MutationObserver } | ||
| export { MutationObserverBaseResult } | ||
| export { MutationObserverErrorResult } | ||
| export { MutationObserverIdleResult } | ||
| export { MutationObserverLoadingResult } | ||
| export { MutationObserverOptions } | ||
| export { MutationObserverResult } | ||
| export { MutationObserverSuccessResult } | ||
| export { MutationOptions } | ||
| declare function mutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: WithRequired<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>): WithRequired<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>; | ||
| declare function mutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: Omit<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>): Omit<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>; | ||
| export { mutationOptions } | ||
| export { mutationOptions as mutationOptions_alias_1 } | ||
| export { MutationScope } | ||
| export { MutationState } | ||
| declare type MutationStateOptions<TResult = MutationState> = { | ||
| filters?: MutationFilters; | ||
| select?: (mutation: Mutation) => TResult; | ||
| }; | ||
| export { MutationStatus } | ||
| export { NetworkMode } | ||
| export { NoInfer_2 as NoInfer } | ||
| export { NonUndefinedGuard } | ||
| export { noop } | ||
| export { NotifyEvent } | ||
| export { NotifyEventType } | ||
| export { notifyManager } | ||
| export { NotifyOnChangeProps } | ||
| export { OmitKeyof } | ||
| export { onlineManager } | ||
| export { Override } | ||
| export { partialMatchKey } | ||
| export { PlaceholderDataFunction } | ||
| export { QueriesObserver } | ||
| export { QueriesObserverOptions } | ||
| /** | ||
| * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
| */ | ||
| declare type QueriesOptions<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryOptionsForUseQueries> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryOptionsForUseQueries<Head>] : T extends [infer Head, ...infer Tails] ? QueriesOptions<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseQueryOptionsForUseQueries<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : ReadonlyArray<unknown> extends T ? T : T extends Array<UseQueryOptionsForUseQueries<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<UseQueryOptionsForUseQueries<TQueryFnData, TError, TData, TQueryKey>> : Array<UseQueryOptionsForUseQueries>; | ||
| export { QueriesOptions } | ||
| export { QueriesOptions as QueriesOptions_alias_1 } | ||
| export { QueriesPlaceholderDataFunction } | ||
| /** | ||
| * QueriesResults reducer recursively maps type param to results | ||
| */ | ||
| declare type QueriesResults<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryResult<Head>] : T extends [infer Head, ...infer Tails] ? QueriesResults<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseQueryResult<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : { | ||
| [K in keyof T]: GetUseQueryResult<T[K]>; | ||
| }; | ||
| export { QueriesResults } | ||
| export { QueriesResults as QueriesResults_alias_1 } | ||
| export { Query } | ||
| export { QueryCache } | ||
| export { QueryCacheNotifyEvent } | ||
| export { QueryClient } | ||
| export { QueryClientConfig } | ||
| declare const QueryClientContext: React_2.Context<QueryClient | undefined>; | ||
| export { QueryClientContext } | ||
| export { QueryClientContext as QueryClientContext_alias_1 } | ||
| declare const QueryClientProvider: ({ client, children, }: QueryClientProviderProps) => React_2.JSX.Element; | ||
| export { QueryClientProvider } | ||
| export { QueryClientProvider as QueryClientProvider_alias_1 } | ||
| declare type QueryClientProviderProps = { | ||
| client: QueryClient; | ||
| children?: React_2.ReactNode; | ||
| }; | ||
| export { QueryClientProviderProps } | ||
| export { QueryClientProviderProps as QueryClientProviderProps_alias_1 } | ||
| declare type QueryErrorClearResetFunction = () => void; | ||
| export { QueryErrorClearResetFunction } | ||
| export { QueryErrorClearResetFunction as QueryErrorClearResetFunction_alias_1 } | ||
| declare type QueryErrorIsResetFunction = () => boolean; | ||
| export { QueryErrorIsResetFunction } | ||
| export { QueryErrorIsResetFunction as QueryErrorIsResetFunction_alias_1 } | ||
| declare const QueryErrorResetBoundary: ({ children, }: QueryErrorResetBoundaryProps) => JSX.Element; | ||
| export { QueryErrorResetBoundary } | ||
| export { QueryErrorResetBoundary as QueryErrorResetBoundary_alias_1 } | ||
| declare type QueryErrorResetBoundaryFunction = (value: QueryErrorResetBoundaryValue) => React_2.ReactNode; | ||
| export { QueryErrorResetBoundaryFunction } | ||
| export { QueryErrorResetBoundaryFunction as QueryErrorResetBoundaryFunction_alias_1 } | ||
| declare interface QueryErrorResetBoundaryProps { | ||
| children: QueryErrorResetBoundaryFunction | React_2.ReactNode; | ||
| } | ||
| export { QueryErrorResetBoundaryProps } | ||
| export { QueryErrorResetBoundaryProps as QueryErrorResetBoundaryProps_alias_1 } | ||
| export declare interface QueryErrorResetBoundaryValue { | ||
| clearReset: QueryErrorClearResetFunction; | ||
| isReset: QueryErrorIsResetFunction; | ||
| reset: QueryErrorResetFunction; | ||
| } | ||
| declare type QueryErrorResetFunction = () => void; | ||
| export { QueryErrorResetFunction } | ||
| export { QueryErrorResetFunction as QueryErrorResetFunction_alias_1 } | ||
| export { QueryFilters } | ||
| export { QueryFunction } | ||
| export { QueryFunctionContext } | ||
| export { QueryKey } | ||
| export { QueryKeyHashFunction } | ||
| export { QueryMeta } | ||
| export { QueryObserver } | ||
| export { QueryObserverBaseResult } | ||
| export { QueryObserverLoadingErrorResult } | ||
| export { QueryObserverLoadingResult } | ||
| export { QueryObserverOptions } | ||
| export { QueryObserverPendingResult } | ||
| export { QueryObserverPlaceholderResult } | ||
| export { QueryObserverRefetchErrorResult } | ||
| export { QueryObserverResult } | ||
| export { QueryObserverSuccessResult } | ||
| export { QueryOptions } | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| export { queryOptions } | ||
| export { queryOptions as queryOptions_alias_1 } | ||
| export { QueryPersister } | ||
| export { QueryState } | ||
| export { QueryStatus } | ||
| export { RefetchOptions } | ||
| export { RefetchQueryFilters } | ||
| export { Register } | ||
| export { replaceEqualDeep } | ||
| export { ResetOptions } | ||
| export { ResultOptions } | ||
| export { SetDataOptions } | ||
| export declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any> | undefined, result: QueryObserverResult<any, any>) => boolean | undefined; | ||
| export { shouldThrowError } | ||
| export { SkipToken } | ||
| export { skipToken } | ||
| declare type SkipTokenForUseQueries = symbol; | ||
| declare type SkipTokenForUseQueries_2 = symbol; | ||
| export { StaleTime } | ||
| export { StaleTimeFunction } | ||
| /** | ||
| * SuspenseQueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
| */ | ||
| declare type SuspenseQueriesOptions<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH_2 ? Array<UseSuspenseQueryOptions> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseSuspenseQueryOptions<Head>] : T extends [infer Head, ...infer Tails] ? SuspenseQueriesOptions<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseSuspenseQueryOptions<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : Array<unknown> extends T ? T : T extends Array<UseSuspenseQueryOptions<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>> : Array<UseSuspenseQueryOptions>; | ||
| export { SuspenseQueriesOptions } | ||
| export { SuspenseQueriesOptions as SuspenseQueriesOptions_alias_1 } | ||
| /** | ||
| * SuspenseQueriesResults reducer recursively maps type param to results | ||
| */ | ||
| declare type SuspenseQueriesResults<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH_2 ? Array<UseSuspenseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseSuspenseQueryResult<Head>] : T extends [infer Head, ...infer Tails] ? SuspenseQueriesResults<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseSuspenseQueryResult<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : { | ||
| [K in keyof T]: GetUseSuspenseQueryResult<T[K]>; | ||
| }; | ||
| export { SuspenseQueriesResults } | ||
| export { SuspenseQueriesResults as SuspenseQueriesResults_alias_1 } | ||
| export { ThrowOnError } | ||
| export { TimeoutCallback } | ||
| export { timeoutManager } | ||
| export { TimeoutProvider } | ||
| declare type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| initialData?: undefined | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | InitialDataFunction<NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>>; | ||
| }; | ||
| export { UndefinedInitialDataInfiniteOptions } | ||
| export { UndefinedInitialDataInfiniteOptions as UndefinedInitialDataInfiniteOptions_alias_1 } | ||
| declare type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>> | NonUndefinedGuard<TQueryFnData>; | ||
| }; | ||
| export { UndefinedInitialDataOptions } | ||
| export { UndefinedInitialDataOptions as UndefinedInitialDataOptions_alias_1 } | ||
| export { UnsetMarker } | ||
| export { unsetMarker } | ||
| declare type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & { | ||
| queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>; | ||
| }; | ||
| export { UnusedSkipTokenInfiniteOptions } | ||
| export { UnusedSkipTokenInfiniteOptions as UnusedSkipTokenInfiniteOptions_alias_1 } | ||
| declare type UnusedSkipTokenOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & { | ||
| queryFn?: Exclude<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken | undefined>; | ||
| }; | ||
| export { UnusedSkipTokenOptions } | ||
| export { UnusedSkipTokenOptions as UnusedSkipTokenOptions_alias_1 } | ||
| export { Updater } | ||
| declare type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, { | ||
| mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| }> & { | ||
| mutateAsync: UseMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| }; | ||
| export { UseBaseMutationResult } | ||
| export { UseBaseMutationResult as UseBaseMutationResult_alias_1 } | ||
| export declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, Observer: typeof QueryObserver, queryClient?: QueryClient): QueryObserverResult<TData, TError>; | ||
| declare interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> { | ||
| /** | ||
| * Set this to `false` to unsubscribe this observer from updates to the query cache. | ||
| * Defaults to `true`. | ||
| */ | ||
| subscribed?: boolean; | ||
| } | ||
| export { UseBaseQueryOptions } | ||
| export { UseBaseQueryOptions as UseBaseQueryOptions_alias_1 } | ||
| declare type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>; | ||
| export { UseBaseQueryResult } | ||
| export { UseBaseQueryResult as UseBaseQueryResult_alias_1 } | ||
| export declare const useClearResetErrorBoundary: (errorResetBoundary: QueryErrorResetBoundaryValue) => void; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): DefinedUseInfiniteQueryResult<TData, TError>; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>; | ||
| export { useInfiniteQuery } | ||
| export { useInfiniteQuery as useInfiniteQuery_alias_1 } | ||
| declare interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> { | ||
| /** | ||
| * Set this to `false` to unsubscribe this observer from updates to the query cache. | ||
| * Defaults to `true`. | ||
| */ | ||
| subscribed?: boolean; | ||
| } | ||
| export { UseInfiniteQueryOptions } | ||
| export { UseInfiniteQueryOptions as UseInfiniteQueryOptions_alias_1 } | ||
| declare type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>; | ||
| export { UseInfiniteQueryResult } | ||
| export { UseInfiniteQueryResult as UseInfiniteQueryResult_alias_1 } | ||
| declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number; | ||
| export { useIsFetching } | ||
| export { useIsFetching as useIsFetching_alias_1 } | ||
| declare function useIsMutating(filters?: MutationFilters, queryClient?: QueryClient): number; | ||
| export { useIsMutating } | ||
| export { useIsMutating as useIsMutating_alias_1 } | ||
| declare const useIsRestoring: () => boolean; | ||
| export { useIsRestoring } | ||
| export { useIsRestoring as useIsRestoring_alias_1 } | ||
| declare type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| export { UseMutateAsyncFunction } | ||
| export { UseMutateAsyncFunction as UseMutateAsyncFunction_alias_1 } | ||
| declare type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void; | ||
| export { UseMutateFunction } | ||
| export { UseMutateFunction as UseMutateFunction_alias_1 } | ||
| declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient): UseMutationResult<TData, TError, TVariables, TOnMutateResult>; | ||
| export { useMutation } | ||
| export { useMutation as useMutation_alias_1 } | ||
| declare interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>, '_defaulted'> { | ||
| } | ||
| export { UseMutationOptions } | ||
| export { UseMutationOptions as UseMutationOptions_alias_1 } | ||
| declare type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>; | ||
| export { UseMutationResult } | ||
| export { UseMutationResult as UseMutationResult_alias_1 } | ||
| declare function useMutationState<TResult = MutationState>(options?: MutationStateOptions<TResult>, queryClient?: QueryClient): Array<TResult>; | ||
| export { useMutationState } | ||
| export { useMutationState as useMutationState_alias_1 } | ||
| declare function usePrefetchInfiniteQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): void; | ||
| export { usePrefetchInfiniteQuery } | ||
| export { usePrefetchInfiniteQuery as usePrefetchInfiniteQuery_alias_1 } | ||
| declare function usePrefetchQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): void; | ||
| export { usePrefetchQuery } | ||
| export { usePrefetchQuery as usePrefetchQuery_alias_1 } | ||
| declare interface UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> { | ||
| queryFn?: Exclude<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>; | ||
| } | ||
| export { UsePrefetchQueryOptions } | ||
| export { UsePrefetchQueryOptions as UsePrefetchQueryOptions_alias_1 } | ||
| declare function useQueries<T extends Array<any>, TCombinedResult = QueriesResults<T>>({ queries, ...options }: { | ||
| queries: readonly [...QueriesOptions<T>] | readonly [...{ | ||
| [K in keyof T]: GetUseQueryOptionsForUseQueries<T[K]>; | ||
| }]; | ||
| combine?: (result: QueriesResults<T>) => TCombinedResult; | ||
| subscribed?: boolean; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| export { useQueries } | ||
| export { useQueries as useQueries_alias_1 } | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): DefinedUseQueryResult<NoInfer_2<TData>, TError>; | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseQueryResult<NoInfer_2<TData>, TError>; | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseQueryResult<NoInfer_2<TData>, TError>; | ||
| export { useQuery } | ||
| export { useQuery as useQuery_alias_1 } | ||
| declare const useQueryClient: (queryClient?: QueryClient) => QueryClient; | ||
| export { useQueryClient } | ||
| export { useQueryClient as useQueryClient_alias_1 } | ||
| declare const useQueryErrorResetBoundary: () => QueryErrorResetBoundaryValue; | ||
| export { useQueryErrorResetBoundary } | ||
| export { useQueryErrorResetBoundary as useQueryErrorResetBoundary_alias_1 } | ||
| declare interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> { | ||
| } | ||
| export { UseQueryOptions } | ||
| export { UseQueryOptions as UseQueryOptions_alias_1 } | ||
| declare type UseQueryOptionsForUseQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData' | 'subscribed'> & { | ||
| placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>; | ||
| }; | ||
| declare type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>; | ||
| export { UseQueryResult } | ||
| export { UseQueryResult as UseQueryResult_alias_1 } | ||
| declare function useSuspenseInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseSuspenseInfiniteQueryResult<TData, TError>; | ||
| export { useSuspenseInfiniteQuery } | ||
| export { useSuspenseInfiniteQuery as useSuspenseInfiniteQuery_alias_1 } | ||
| declare interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> { | ||
| queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken>; | ||
| } | ||
| export { UseSuspenseInfiniteQueryOptions } | ||
| export { UseSuspenseInfiniteQueryOptions as UseSuspenseInfiniteQueryOptions_alias_1 } | ||
| declare type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>; | ||
| export { UseSuspenseInfiniteQueryResult } | ||
| export { UseSuspenseInfiniteQueryResult as UseSuspenseInfiniteQueryResult_alias_1 } | ||
| declare function useSuspenseQueries<T extends Array<any>, TCombinedResult = SuspenseQueriesResults<T>>(options: { | ||
| queries: readonly [...SuspenseQueriesOptions<T>] | readonly [...{ | ||
| [K in keyof T]: GetUseSuspenseQueryOptions<T[K]>; | ||
| }]; | ||
| combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| declare function useSuspenseQueries<T extends Array<any>, TCombinedResult = SuspenseQueriesResults<T>>(options: { | ||
| queries: readonly [...SuspenseQueriesOptions<T>]; | ||
| combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| export { useSuspenseQueries } | ||
| export { useSuspenseQueries as useSuspenseQueries_alias_1 } | ||
| declare function useSuspenseQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseSuspenseQueryResult<TData, TError>; | ||
| export { useSuspenseQuery } | ||
| export { useSuspenseQuery as useSuspenseQuery_alias_1 } | ||
| declare interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> { | ||
| queryFn?: Exclude<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>; | ||
| } | ||
| export { UseSuspenseQueryOptions } | ||
| export { UseSuspenseQueryOptions as UseSuspenseQueryOptions_alias_1 } | ||
| declare type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>; | ||
| export { UseSuspenseQueryResult } | ||
| export { UseSuspenseQueryResult as UseSuspenseQueryResult_alias_1 } | ||
| export declare const willFetch: (result: QueryObserverResult<any, any>, isRestoring: boolean) => boolean; | ||
| export { WithRequired } | ||
| export { } |
| import { AnyDataTag } from '@tanstack/query-core'; | ||
| import { CancelledError } from '@tanstack/query-core'; | ||
| import { CancelOptions } from '@tanstack/query-core'; | ||
| import { DataTag } from '@tanstack/query-core'; | ||
| import { dataTagErrorSymbol } from '@tanstack/query-core'; | ||
| import { dataTagSymbol } from '@tanstack/query-core'; | ||
| import { DefaultedInfiniteQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { DefaultedQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { DefaultError } from '@tanstack/query-core'; | ||
| import { DefaultOptions } from '@tanstack/query-core'; | ||
| import { defaultScheduler } from '@tanstack/query-core'; | ||
| import { defaultShouldDehydrateMutation } from '@tanstack/query-core'; | ||
| import { defaultShouldDehydrateQuery } from '@tanstack/query-core'; | ||
| import { DefinedInfiniteQueryObserverResult } from '@tanstack/query-core'; | ||
| import { DefinedQueryObserverResult } from '@tanstack/query-core'; | ||
| import { dehydrate } from '@tanstack/query-core'; | ||
| import { DehydratedState } from '@tanstack/query-core'; | ||
| import { DehydrateOptions } from '@tanstack/query-core'; | ||
| import { DistributiveOmit } from '@tanstack/query-core'; | ||
| import { Enabled } from '@tanstack/query-core'; | ||
| import { EnsureInfiniteQueryDataOptions } from '@tanstack/query-core'; | ||
| import { EnsureQueryDataOptions } from '@tanstack/query-core'; | ||
| import { environmentManager } from '@tanstack/query-core'; | ||
| import { experimental_streamedQuery } from '@tanstack/query-core'; | ||
| import { FetchInfiniteQueryOptions } from '@tanstack/query-core'; | ||
| import { FetchNextPageOptions } from '@tanstack/query-core'; | ||
| import { FetchPreviousPageOptions } from '@tanstack/query-core'; | ||
| import { FetchQueryOptions } from '@tanstack/query-core'; | ||
| import { FetchStatus } from '@tanstack/query-core'; | ||
| import { focusManager } from '@tanstack/query-core'; | ||
| import { GetNextPageParamFunction } from '@tanstack/query-core'; | ||
| import { GetPreviousPageParamFunction } from '@tanstack/query-core'; | ||
| import { hashKey } from '@tanstack/query-core'; | ||
| import { hydrate } from '@tanstack/query-core'; | ||
| import { HydrateOptions } from '@tanstack/query-core'; | ||
| import { InferDataFromTag } from '@tanstack/query-core'; | ||
| import { InferErrorFromTag } from '@tanstack/query-core'; | ||
| import { InfiniteData } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserver } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverBaseResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverLoadingErrorResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverOptions } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverPendingResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverPlaceholderResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverRefetchErrorResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { InfiniteQueryPageParamsOptions } from '@tanstack/query-core'; | ||
| import { InitialDataFunction } from '@tanstack/query-core'; | ||
| import { InitialPageParam } from '@tanstack/query-core'; | ||
| import { InvalidateOptions } from '@tanstack/query-core'; | ||
| import { InvalidateQueryFilters } from '@tanstack/query-core'; | ||
| import { isCancelledError } from '@tanstack/query-core'; | ||
| import { isServer } from '@tanstack/query-core'; | ||
| import { JSX } from 'react/jsx-runtime'; | ||
| import { keepPreviousData } from '@tanstack/query-core'; | ||
| import { ManagedTimerId } from '@tanstack/query-core'; | ||
| import { matchMutation } from '@tanstack/query-core'; | ||
| import { matchQuery } from '@tanstack/query-core'; | ||
| import { MutateFunction } from '@tanstack/query-core'; | ||
| import { MutateOptions } from '@tanstack/query-core'; | ||
| import { Mutation } from '@tanstack/query-core'; | ||
| import { MutationCache } from '@tanstack/query-core'; | ||
| import { MutationCacheNotifyEvent } from '@tanstack/query-core'; | ||
| import { MutationFilters } from '@tanstack/query-core'; | ||
| import { MutationFunction } from '@tanstack/query-core'; | ||
| import { MutationFunctionContext } from '@tanstack/query-core'; | ||
| import { MutationKey } from '@tanstack/query-core'; | ||
| import { MutationMeta } from '@tanstack/query-core'; | ||
| import { MutationObserver as MutationObserver_2 } from '@tanstack/query-core'; | ||
| import { MutationObserverBaseResult } from '@tanstack/query-core'; | ||
| import { MutationObserverErrorResult } from '@tanstack/query-core'; | ||
| import { MutationObserverIdleResult } from '@tanstack/query-core'; | ||
| import { MutationObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { MutationObserverOptions } from '@tanstack/query-core'; | ||
| import { MutationObserverResult } from '@tanstack/query-core'; | ||
| import { MutationObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { MutationOptions } from '@tanstack/query-core'; | ||
| import { MutationScope } from '@tanstack/query-core'; | ||
| import { MutationState } from '@tanstack/query-core'; | ||
| import { MutationStatus } from '@tanstack/query-core'; | ||
| import { NetworkMode } from '@tanstack/query-core'; | ||
| import { NoInfer as NoInfer_2 } from '@tanstack/query-core'; | ||
| import { NonUndefinedGuard } from '@tanstack/query-core'; | ||
| import { noop } from '@tanstack/query-core'; | ||
| import { NotifyEvent } from '@tanstack/query-core'; | ||
| import { NotifyEventType } from '@tanstack/query-core'; | ||
| import { notifyManager } from '@tanstack/query-core'; | ||
| import { NotifyOnChangeProps } from '@tanstack/query-core'; | ||
| import { OmitKeyof } from '@tanstack/query-core'; | ||
| import { onlineManager } from '@tanstack/query-core'; | ||
| import { Options } from 'tsup'; | ||
| import { Override } from '@tanstack/query-core'; | ||
| import { partialMatchKey } from '@tanstack/query-core'; | ||
| import { PlaceholderDataFunction } from '@tanstack/query-core'; | ||
| import { QueriesObserver } from '@tanstack/query-core'; | ||
| import { QueriesObserverOptions } from '@tanstack/query-core'; | ||
| import { QueriesPlaceholderDataFunction } from '@tanstack/query-core'; | ||
| import { Query } from '@tanstack/query-core'; | ||
| import { QueryCache } from '@tanstack/query-core'; | ||
| import { QueryCacheNotifyEvent } from '@tanstack/query-core'; | ||
| import { QueryClient } from '@tanstack/query-core'; | ||
| import { QueryClientConfig } from '@tanstack/query-core'; | ||
| import { QueryFilters } from '@tanstack/query-core'; | ||
| import { QueryFunction } from '@tanstack/query-core'; | ||
| import { QueryFunctionContext } from '@tanstack/query-core'; | ||
| import { QueryKey } from '@tanstack/query-core'; | ||
| import { QueryKeyHashFunction } from '@tanstack/query-core'; | ||
| import { QueryMeta } from '@tanstack/query-core'; | ||
| import { QueryObserver } from '@tanstack/query-core'; | ||
| import { QueryObserverBaseResult } from '@tanstack/query-core'; | ||
| import { QueryObserverLoadingErrorResult } from '@tanstack/query-core'; | ||
| import { QueryObserverLoadingResult } from '@tanstack/query-core'; | ||
| import { QueryObserverOptions } from '@tanstack/query-core'; | ||
| import { QueryObserverPendingResult } from '@tanstack/query-core'; | ||
| import { QueryObserverPlaceholderResult } from '@tanstack/query-core'; | ||
| import { QueryObserverRefetchErrorResult } from '@tanstack/query-core'; | ||
| import { QueryObserverResult } from '@tanstack/query-core'; | ||
| import { QueryObserverSuccessResult } from '@tanstack/query-core'; | ||
| import { QueryOptions } from '@tanstack/query-core'; | ||
| import { QueryPersister } from '@tanstack/query-core'; | ||
| import { QueryState } from '@tanstack/query-core'; | ||
| import { QueryStatus } from '@tanstack/query-core'; | ||
| import * as React_2 from 'react'; | ||
| import { RefetchOptions } from '@tanstack/query-core'; | ||
| import { RefetchQueryFilters } from '@tanstack/query-core'; | ||
| import { Register } from '@tanstack/query-core'; | ||
| import { replaceEqualDeep } from '@tanstack/query-core'; | ||
| import { ResetOptions } from '@tanstack/query-core'; | ||
| import { ResultOptions } from '@tanstack/query-core'; | ||
| import { SetDataOptions } from '@tanstack/query-core'; | ||
| import { shouldThrowError } from '@tanstack/query-core'; | ||
| import { SkipToken } from '@tanstack/query-core'; | ||
| import { skipToken } from '@tanstack/query-core'; | ||
| import { StaleTime } from '@tanstack/query-core'; | ||
| import { StaleTimeFunction } from '@tanstack/query-core'; | ||
| import { ThrowOnError } from '@tanstack/query-core'; | ||
| import { TimeoutCallback } from '@tanstack/query-core'; | ||
| import { timeoutManager } from '@tanstack/query-core'; | ||
| import { TimeoutProvider } from '@tanstack/query-core'; | ||
| import { UnsetMarker } from '@tanstack/query-core'; | ||
| import { unsetMarker } from '@tanstack/query-core'; | ||
| import { Updater } from '@tanstack/query-core'; | ||
| import { UserConfig } from 'vite'; | ||
| import { WithRequired } from '@tanstack/query-core'; | ||
| export { AnyDataTag } | ||
| declare type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseBaseQueryOptions } | ||
| export { AnyUseBaseQueryOptions as AnyUseBaseQueryOptions_alias_1 } | ||
| declare type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseInfiniteQueryOptions } | ||
| export { AnyUseInfiniteQueryOptions as AnyUseInfiniteQueryOptions_alias_1 } | ||
| declare type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>; | ||
| export { AnyUseMutationOptions } | ||
| export { AnyUseMutationOptions as AnyUseMutationOptions_alias_1 } | ||
| declare type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>; | ||
| export { AnyUseQueryOptions } | ||
| export { AnyUseQueryOptions as AnyUseQueryOptions_alias_1 } | ||
| declare type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>; | ||
| export { AnyUseSuspenseInfiniteQueryOptions } | ||
| export { AnyUseSuspenseInfiniteQueryOptions as AnyUseSuspenseInfiniteQueryOptions_alias_1 } | ||
| declare type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>; | ||
| export { AnyUseSuspenseQueryOptions } | ||
| export { AnyUseSuspenseQueryOptions as AnyUseSuspenseQueryOptions_alias_1 } | ||
| export { CancelledError } | ||
| export { CancelOptions } | ||
| export { DataTag } | ||
| export { dataTagErrorSymbol } | ||
| export { dataTagSymbol } | ||
| export declare const default_alias: any[]; | ||
| export declare const default_alias_1: any[]; | ||
| export declare const default_alias_2: Options | Options[] | ((overrideOptions: Options) => Options | Options[] | Promise<Options | Options[]>); | ||
| export declare const default_alias_3: UserConfig; | ||
| export { DefaultedInfiniteQueryObserverOptions } | ||
| export { DefaultedQueryObserverOptions } | ||
| export { DefaultError } | ||
| export { DefaultOptions } | ||
| export { defaultScheduler } | ||
| export { defaultShouldDehydrateMutation } | ||
| export { defaultShouldDehydrateQuery } | ||
| export declare const defaultThrowOnError: <TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(_error: TError, query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean; | ||
| export { DefinedInfiniteQueryObserverResult } | ||
| declare type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined; | ||
| }; | ||
| export { DefinedInitialDataInfiniteOptions } | ||
| export { DefinedInitialDataInfiniteOptions as DefinedInitialDataInfiniteOptions_alias_1 } | ||
| declare type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & { | ||
| initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>); | ||
| queryFn?: QueryFunction<TQueryFnData, TQueryKey>; | ||
| }; | ||
| export { DefinedInitialDataOptions } | ||
| export { DefinedInitialDataOptions as DefinedInitialDataOptions_alias_1 } | ||
| export { DefinedQueryObserverResult } | ||
| declare type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>; | ||
| export { DefinedUseInfiniteQueryResult } | ||
| export { DefinedUseInfiniteQueryResult as DefinedUseInfiniteQueryResult_alias_1 } | ||
| declare type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>; | ||
| export { DefinedUseQueryResult } | ||
| export { DefinedUseQueryResult as DefinedUseQueryResult_alias_1 } | ||
| export { dehydrate } | ||
| export { DehydratedState } | ||
| export { DehydrateOptions } | ||
| export { DistributiveOmit } | ||
| export { Enabled } | ||
| export { EnsureInfiniteQueryDataOptions } | ||
| export declare const ensurePreventErrorBoundaryRetry: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue, query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined) => void; | ||
| export { EnsureQueryDataOptions } | ||
| export declare const ensureSuspenseTimers: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void; | ||
| export { environmentManager } | ||
| export { experimental_streamedQuery } | ||
| export { FetchInfiniteQueryOptions } | ||
| export { FetchNextPageOptions } | ||
| export declare const fetchOptimistic: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(defaultedOptions: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue) => Promise<void | QueryObserverResult<TData, TError>>; | ||
| export { FetchPreviousPageOptions } | ||
| export { FetchQueryOptions } | ||
| export { FetchStatus } | ||
| export { focusManager } | ||
| declare type GetDefinedOrUndefinedQueryResult<T, TData, TError = unknown> = T extends { | ||
| initialData?: infer TInitialData; | ||
| } ? unknown extends TInitialData ? UseQueryResult<TData, TError> : TInitialData extends TData ? DefinedUseQueryResult<TData, TError> : TInitialData extends () => infer TInitialDataResult ? unknown extends TInitialDataResult ? UseQueryResult<TData, TError> : TInitialDataResult extends TData ? DefinedUseQueryResult<TData, TError> : UseQueryResult<TData, TError> : UseQueryResult<TData, TError> : UseQueryResult<TData, TError>; | ||
| export declare const getHasError: <TData, TError, TQueryFnData, TQueryData, TQueryKey extends QueryKey>({ result, errorResetBoundary, throwOnError, query, suspense, }: { | ||
| result: QueryObserverResult<TData, TError>; | ||
| errorResetBoundary: QueryErrorResetBoundaryValue; | ||
| throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>; | ||
| query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined; | ||
| suspense: boolean | undefined; | ||
| }) => boolean | undefined; | ||
| export { GetNextPageParamFunction } | ||
| export { GetPreviousPageParamFunction } | ||
| declare type GetUseQueryOptionsForUseQueries<T> = T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseQueryOptionsForUseQueries<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? UseQueryOptionsForUseQueries<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseQueryOptionsForUseQueries<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseQueryOptionsForUseQueries<TQueryFnData, unknown extends TError ? DefaultError : TError, unknown extends TData ? TQueryFnData : TData, TQueryKey> : UseQueryOptionsForUseQueries; | ||
| declare type GetUseQueryResult<T> = T extends { | ||
| queryFnData: any; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends [any, infer TError, infer TData] ? GetDefinedOrUndefinedQueryResult<T, TData, TError> : T extends [infer TQueryFnData, infer TError] ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError> : T extends [infer TQueryFnData] ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? GetDefinedOrUndefinedQueryResult<T, unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : UseQueryResult; | ||
| declare type GetUseSuspenseQueryOptions<T> = T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TData> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryOptions<unknown, TError, TData> : T extends [infer TQueryFnData, infer TError, infer TData] ? UseSuspenseQueryOptions<TQueryFnData, TError, TData> : T extends [infer TQueryFnData, infer TError] ? UseSuspenseQueryOptions<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseSuspenseQueryOptions<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries_2; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, infer TQueryKey> | SkipTokenForUseQueries_2; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryOptions<TQueryFnData, TError, TQueryFnData, TQueryKey> : UseSuspenseQueryOptions; | ||
| declare type GetUseSuspenseQueryResult<T> = T extends { | ||
| queryFnData: any; | ||
| error?: infer TError; | ||
| data: infer TData; | ||
| } ? UseSuspenseQueryResult<TData, TError> : T extends { | ||
| queryFnData: infer TQueryFnData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryResult<TQueryFnData, TError> : T extends { | ||
| data: infer TData; | ||
| error?: infer TError; | ||
| } ? UseSuspenseQueryResult<TData, TError> : T extends [any, infer TError, infer TData] ? UseSuspenseQueryResult<TData, TError> : T extends [infer TQueryFnData, infer TError] ? UseSuspenseQueryResult<TQueryFnData, TError> : T extends [infer TQueryFnData] ? UseSuspenseQueryResult<TQueryFnData> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries_2; | ||
| select?: (data: any) => infer TData; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryResult<unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError> : T extends { | ||
| queryFn?: QueryFunction<infer TQueryFnData, any> | SkipTokenForUseQueries_2; | ||
| throwOnError?: ThrowOnError<any, infer TError, any, any>; | ||
| } ? UseSuspenseQueryResult<TQueryFnData, unknown extends TError ? DefaultError : TError> : UseSuspenseQueryResult; | ||
| export { hashKey } | ||
| export { hydrate } | ||
| export { HydrateOptions } | ||
| declare const HydrationBoundary: ({ children, options, state, queryClient, }: HydrationBoundaryProps) => React_2.ReactElement; | ||
| export { HydrationBoundary } | ||
| export { HydrationBoundary as HydrationBoundary_alias_1 } | ||
| declare interface HydrationBoundaryProps { | ||
| state: DehydratedState | null | undefined; | ||
| options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & { | ||
| defaultOptions?: OmitKeyof<Exclude<HydrateOptions['defaultOptions'], undefined>, 'mutations'>; | ||
| }; | ||
| children?: React_2.ReactNode; | ||
| queryClient?: QueryClient; | ||
| } | ||
| export { HydrationBoundaryProps } | ||
| export { HydrationBoundaryProps as HydrationBoundaryProps_alias_1 } | ||
| export { InferDataFromTag } | ||
| export { InferErrorFromTag } | ||
| export { InfiniteData } | ||
| export { InfiniteQueryObserver } | ||
| export { InfiniteQueryObserverBaseResult } | ||
| export { InfiniteQueryObserverLoadingErrorResult } | ||
| export { InfiniteQueryObserverLoadingResult } | ||
| export { InfiniteQueryObserverOptions } | ||
| export { InfiniteQueryObserverPendingResult } | ||
| export { InfiniteQueryObserverPlaceholderResult } | ||
| export { InfiniteQueryObserverRefetchErrorResult } | ||
| export { InfiniteQueryObserverResult } | ||
| export { InfiniteQueryObserverSuccessResult } | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>; | ||
| }; | ||
| export { infiniteQueryOptions } | ||
| export { infiniteQueryOptions as infiniteQueryOptions_alias_1 } | ||
| export { InfiniteQueryPageParamsOptions } | ||
| export { InitialDataFunction } | ||
| export { InitialPageParam } | ||
| export { InvalidateOptions } | ||
| export { InvalidateQueryFilters } | ||
| export { isCancelledError } | ||
| declare const IsRestoringProvider: React_2.Provider<boolean>; | ||
| export { IsRestoringProvider } | ||
| export { IsRestoringProvider as IsRestoringProvider_alias_1 } | ||
| export { isServer } | ||
| export { keepPreviousData } | ||
| /** | ||
| * @param {Object} opts - Options for building configurations. | ||
| * @param {string[]} opts.entry - The entry array. | ||
| * @returns {import('tsup').Options} | ||
| */ | ||
| export declare function legacyConfig(opts: { | ||
| entry: string[]; | ||
| }): Options; | ||
| export { ManagedTimerId } | ||
| export { matchMutation } | ||
| export { matchQuery } | ||
| declare type MAXIMUM_DEPTH = 20; | ||
| declare type MAXIMUM_DEPTH_2 = 20; | ||
| /** | ||
| * @param {Object} opts - Options for building configurations. | ||
| * @param {string[]} opts.entry - The entry array. | ||
| * @returns {import('tsup').Options} | ||
| */ | ||
| export declare function modernConfig(opts: { | ||
| entry: string[]; | ||
| }): Options; | ||
| export { MutateFunction } | ||
| export { MutateOptions } | ||
| export { Mutation } | ||
| export { MutationCache } | ||
| export { MutationCacheNotifyEvent } | ||
| export { MutationFilters } | ||
| export { MutationFunction } | ||
| export { MutationFunctionContext } | ||
| export { MutationKey } | ||
| export { MutationMeta } | ||
| export { MutationObserver_2 as MutationObserver } | ||
| export { MutationObserverBaseResult } | ||
| export { MutationObserverErrorResult } | ||
| export { MutationObserverIdleResult } | ||
| export { MutationObserverLoadingResult } | ||
| export { MutationObserverOptions } | ||
| export { MutationObserverResult } | ||
| export { MutationObserverSuccessResult } | ||
| export { MutationOptions } | ||
| declare function mutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: WithRequired<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>): WithRequired<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>; | ||
| declare function mutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: Omit<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>): Omit<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, 'mutationKey'>; | ||
| export { mutationOptions } | ||
| export { mutationOptions as mutationOptions_alias_1 } | ||
| export { MutationScope } | ||
| export { MutationState } | ||
| declare type MutationStateOptions<TResult = MutationState> = { | ||
| filters?: MutationFilters; | ||
| select?: (mutation: Mutation) => TResult; | ||
| }; | ||
| export { MutationStatus } | ||
| export { NetworkMode } | ||
| export { NoInfer_2 as NoInfer } | ||
| export { NonUndefinedGuard } | ||
| export { noop } | ||
| export { NotifyEvent } | ||
| export { NotifyEventType } | ||
| export { notifyManager } | ||
| export { NotifyOnChangeProps } | ||
| export { OmitKeyof } | ||
| export { onlineManager } | ||
| export { Override } | ||
| export { partialMatchKey } | ||
| export { PlaceholderDataFunction } | ||
| export { QueriesObserver } | ||
| export { QueriesObserverOptions } | ||
| /** | ||
| * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
| */ | ||
| declare type QueriesOptions<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryOptionsForUseQueries> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryOptionsForUseQueries<Head>] : T extends [infer Head, ...infer Tails] ? QueriesOptions<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseQueryOptionsForUseQueries<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : ReadonlyArray<unknown> extends T ? T : T extends Array<UseQueryOptionsForUseQueries<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<UseQueryOptionsForUseQueries<TQueryFnData, TError, TData, TQueryKey>> : Array<UseQueryOptionsForUseQueries>; | ||
| export { QueriesOptions } | ||
| export { QueriesOptions as QueriesOptions_alias_1 } | ||
| export { QueriesPlaceholderDataFunction } | ||
| /** | ||
| * QueriesResults reducer recursively maps type param to results | ||
| */ | ||
| declare type QueriesResults<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH ? Array<UseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseQueryResult<Head>] : T extends [infer Head, ...infer Tails] ? QueriesResults<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseQueryResult<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : { | ||
| [K in keyof T]: GetUseQueryResult<T[K]>; | ||
| }; | ||
| export { QueriesResults } | ||
| export { QueriesResults as QueriesResults_alias_1 } | ||
| export { Query } | ||
| export { QueryCache } | ||
| export { QueryCacheNotifyEvent } | ||
| export { QueryClient } | ||
| export { QueryClientConfig } | ||
| declare const QueryClientContext: React_2.Context<QueryClient | undefined>; | ||
| export { QueryClientContext } | ||
| export { QueryClientContext as QueryClientContext_alias_1 } | ||
| declare const QueryClientProvider: ({ client, children, }: QueryClientProviderProps) => React_2.JSX.Element; | ||
| export { QueryClientProvider } | ||
| export { QueryClientProvider as QueryClientProvider_alias_1 } | ||
| declare type QueryClientProviderProps = { | ||
| client: QueryClient; | ||
| children?: React_2.ReactNode; | ||
| }; | ||
| export { QueryClientProviderProps } | ||
| export { QueryClientProviderProps as QueryClientProviderProps_alias_1 } | ||
| declare type QueryErrorClearResetFunction = () => void; | ||
| export { QueryErrorClearResetFunction } | ||
| export { QueryErrorClearResetFunction as QueryErrorClearResetFunction_alias_1 } | ||
| declare type QueryErrorIsResetFunction = () => boolean; | ||
| export { QueryErrorIsResetFunction } | ||
| export { QueryErrorIsResetFunction as QueryErrorIsResetFunction_alias_1 } | ||
| declare const QueryErrorResetBoundary: ({ children, }: QueryErrorResetBoundaryProps) => JSX.Element; | ||
| export { QueryErrorResetBoundary } | ||
| export { QueryErrorResetBoundary as QueryErrorResetBoundary_alias_1 } | ||
| declare type QueryErrorResetBoundaryFunction = (value: QueryErrorResetBoundaryValue) => React_2.ReactNode; | ||
| export { QueryErrorResetBoundaryFunction } | ||
| export { QueryErrorResetBoundaryFunction as QueryErrorResetBoundaryFunction_alias_1 } | ||
| declare interface QueryErrorResetBoundaryProps { | ||
| children: QueryErrorResetBoundaryFunction | React_2.ReactNode; | ||
| } | ||
| export { QueryErrorResetBoundaryProps } | ||
| export { QueryErrorResetBoundaryProps as QueryErrorResetBoundaryProps_alias_1 } | ||
| export declare interface QueryErrorResetBoundaryValue { | ||
| clearReset: QueryErrorClearResetFunction; | ||
| isReset: QueryErrorIsResetFunction; | ||
| reset: QueryErrorResetFunction; | ||
| } | ||
| declare type QueryErrorResetFunction = () => void; | ||
| export { QueryErrorResetFunction } | ||
| export { QueryErrorResetFunction as QueryErrorResetFunction_alias_1 } | ||
| export { QueryFilters } | ||
| export { QueryFunction } | ||
| export { QueryFunctionContext } | ||
| export { QueryKey } | ||
| export { QueryKeyHashFunction } | ||
| export { QueryMeta } | ||
| export { QueryObserver } | ||
| export { QueryObserverBaseResult } | ||
| export { QueryObserverLoadingErrorResult } | ||
| export { QueryObserverLoadingResult } | ||
| export { QueryObserverOptions } | ||
| export { QueryObserverPendingResult } | ||
| export { QueryObserverPlaceholderResult } | ||
| export { QueryObserverRefetchErrorResult } | ||
| export { QueryObserverResult } | ||
| export { QueryObserverSuccessResult } | ||
| export { QueryOptions } | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError>; | ||
| }; | ||
| export { queryOptions } | ||
| export { queryOptions as queryOptions_alias_1 } | ||
| export { QueryPersister } | ||
| export { QueryState } | ||
| export { QueryStatus } | ||
| export { RefetchOptions } | ||
| export { RefetchQueryFilters } | ||
| export { Register } | ||
| export { replaceEqualDeep } | ||
| export { ResetOptions } | ||
| export { ResultOptions } | ||
| export { SetDataOptions } | ||
| export declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any> | undefined, result: QueryObserverResult<any, any>) => boolean | undefined; | ||
| export { shouldThrowError } | ||
| export { SkipToken } | ||
| export { skipToken } | ||
| declare type SkipTokenForUseQueries = symbol; | ||
| declare type SkipTokenForUseQueries_2 = symbol; | ||
| export { StaleTime } | ||
| export { StaleTimeFunction } | ||
| /** | ||
| * SuspenseQueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
| */ | ||
| declare type SuspenseQueriesOptions<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH_2 ? Array<UseSuspenseQueryOptions> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseSuspenseQueryOptions<Head>] : T extends [infer Head, ...infer Tails] ? SuspenseQueriesOptions<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseSuspenseQueryOptions<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : Array<unknown> extends T ? T : T extends Array<UseSuspenseQueryOptions<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>> ? Array<UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>> : Array<UseSuspenseQueryOptions>; | ||
| export { SuspenseQueriesOptions } | ||
| export { SuspenseQueriesOptions as SuspenseQueriesOptions_alias_1 } | ||
| /** | ||
| * SuspenseQueriesResults reducer recursively maps type param to results | ||
| */ | ||
| declare type SuspenseQueriesResults<T extends Array<any>, TResults extends Array<any> = [], TDepth extends ReadonlyArray<number> = []> = TDepth['length'] extends MAXIMUM_DEPTH_2 ? Array<UseSuspenseQueryResult> : T extends [] ? [] : T extends [infer Head] ? [...TResults, GetUseSuspenseQueryResult<Head>] : T extends [infer Head, ...infer Tails] ? SuspenseQueriesResults<[ | ||
| ...Tails | ||
| ], [ | ||
| ...TResults, | ||
| GetUseSuspenseQueryResult<Head> | ||
| ], [ | ||
| ...TDepth, | ||
| 1 | ||
| ]> : { | ||
| [K in keyof T]: GetUseSuspenseQueryResult<T[K]>; | ||
| }; | ||
| export { SuspenseQueriesResults } | ||
| export { SuspenseQueriesResults as SuspenseQueriesResults_alias_1 } | ||
| export { ThrowOnError } | ||
| export { TimeoutCallback } | ||
| export { timeoutManager } | ||
| export { TimeoutProvider } | ||
| declare type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & { | ||
| initialData?: undefined | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | InitialDataFunction<NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>>; | ||
| }; | ||
| export { UndefinedInitialDataInfiniteOptions } | ||
| export { UndefinedInitialDataInfiniteOptions as UndefinedInitialDataInfiniteOptions_alias_1 } | ||
| declare type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
| initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>> | NonUndefinedGuard<TQueryFnData>; | ||
| }; | ||
| export { UndefinedInitialDataOptions } | ||
| export { UndefinedInitialDataOptions as UndefinedInitialDataOptions_alias_1 } | ||
| export { UnsetMarker } | ||
| export { unsetMarker } | ||
| declare type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & { | ||
| queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>; | ||
| }; | ||
| export { UnusedSkipTokenInfiniteOptions } | ||
| export { UnusedSkipTokenInfiniteOptions as UnusedSkipTokenInfiniteOptions_alias_1 } | ||
| declare type UnusedSkipTokenOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & { | ||
| queryFn?: Exclude<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken | undefined>; | ||
| }; | ||
| export { UnusedSkipTokenOptions } | ||
| export { UnusedSkipTokenOptions as UnusedSkipTokenOptions_alias_1 } | ||
| export { Updater } | ||
| declare type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TOnMutateResult>, { | ||
| mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| }> & { | ||
| mutateAsync: UseMutateAsyncFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| }; | ||
| export { UseBaseMutationResult } | ||
| export { UseBaseMutationResult as UseBaseMutationResult_alias_1 } | ||
| export declare function useBaseQuery<TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, Observer: typeof QueryObserver, queryClient?: QueryClient): QueryObserverResult<TData, TError>; | ||
| declare interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> { | ||
| /** | ||
| * Set this to `false` to unsubscribe this observer from updates to the query cache. | ||
| * Defaults to `true`. | ||
| */ | ||
| subscribed?: boolean; | ||
| } | ||
| export { UseBaseQueryOptions } | ||
| export { UseBaseQueryOptions as UseBaseQueryOptions_alias_1 } | ||
| declare type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>; | ||
| export { UseBaseQueryResult } | ||
| export { UseBaseQueryResult as UseBaseQueryResult_alias_1 } | ||
| export declare const useClearResetErrorBoundary: (errorResetBoundary: QueryErrorResetBoundaryValue) => void; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): DefinedUseInfiniteQueryResult<TData, TError>; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>; | ||
| declare function useInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>; | ||
| export { useInfiniteQuery } | ||
| export { useInfiniteQuery as useInfiniteQuery_alias_1 } | ||
| declare interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> { | ||
| /** | ||
| * Set this to `false` to unsubscribe this observer from updates to the query cache. | ||
| * Defaults to `true`. | ||
| */ | ||
| subscribed?: boolean; | ||
| } | ||
| export { UseInfiniteQueryOptions } | ||
| export { UseInfiniteQueryOptions as UseInfiniteQueryOptions_alias_1 } | ||
| declare type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>; | ||
| export { UseInfiniteQueryResult } | ||
| export { UseInfiniteQueryResult as UseInfiniteQueryResult_alias_1 } | ||
| declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number; | ||
| export { useIsFetching } | ||
| export { useIsFetching as useIsFetching_alias_1 } | ||
| declare function useIsMutating(filters?: MutationFilters, queryClient?: QueryClient): number; | ||
| export { useIsMutating } | ||
| export { useIsMutating as useIsMutating_alias_1 } | ||
| declare const useIsRestoring: () => boolean; | ||
| export { useIsRestoring } | ||
| export { useIsRestoring as useIsRestoring_alias_1 } | ||
| declare type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = MutateFunction<TData, TError, TVariables, TOnMutateResult>; | ||
| export { UseMutateAsyncFunction } | ||
| export { UseMutateAsyncFunction as UseMutateAsyncFunction_alias_1 } | ||
| declare type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TOnMutateResult>>) => void; | ||
| export { UseMutateFunction } | ||
| export { UseMutateFunction as UseMutateFunction_alias_1 } | ||
| declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>(options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient): UseMutationResult<TData, TError, TVariables, TOnMutateResult>; | ||
| export { useMutation } | ||
| export { useMutation as useMutation_alias_1 } | ||
| declare interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>, '_defaulted'> { | ||
| } | ||
| export { UseMutationOptions } | ||
| export { UseMutationOptions as UseMutationOptions_alias_1 } | ||
| declare type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>; | ||
| export { UseMutationResult } | ||
| export { UseMutationResult as UseMutationResult_alias_1 } | ||
| declare function useMutationState<TResult = MutationState>(options?: MutationStateOptions<TResult>, queryClient?: QueryClient): Array<TResult>; | ||
| export { useMutationState } | ||
| export { useMutationState as useMutationState_alias_1 } | ||
| declare function usePrefetchInfiniteQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: FetchInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): void; | ||
| export { usePrefetchInfiniteQuery } | ||
| export { usePrefetchInfiniteQuery as usePrefetchInfiniteQuery_alias_1 } | ||
| declare function usePrefetchQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): void; | ||
| export { usePrefetchQuery } | ||
| export { usePrefetchQuery as usePrefetchQuery_alias_1 } | ||
| declare interface UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> { | ||
| queryFn?: Exclude<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>; | ||
| } | ||
| export { UsePrefetchQueryOptions } | ||
| export { UsePrefetchQueryOptions as UsePrefetchQueryOptions_alias_1 } | ||
| declare function useQueries<T extends Array<any>, TCombinedResult = QueriesResults<T>>({ queries, ...options }: { | ||
| queries: readonly [...QueriesOptions<T>] | readonly [...{ | ||
| [K in keyof T]: GetUseQueryOptionsForUseQueries<T[K]>; | ||
| }]; | ||
| combine?: (result: QueriesResults<T>) => TCombinedResult; | ||
| subscribed?: boolean; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| export { useQueries } | ||
| export { useQueries as useQueries_alias_1 } | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): DefinedUseQueryResult<NoInfer_2<TData>, TError>; | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseQueryResult<NoInfer_2<TData>, TError>; | ||
| declare function useQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseQueryResult<NoInfer_2<TData>, TError>; | ||
| export { useQuery } | ||
| export { useQuery as useQuery_alias_1 } | ||
| declare const useQueryClient: (queryClient?: QueryClient) => QueryClient; | ||
| export { useQueryClient } | ||
| export { useQueryClient as useQueryClient_alias_1 } | ||
| declare const useQueryErrorResetBoundary: () => QueryErrorResetBoundaryValue; | ||
| export { useQueryErrorResetBoundary } | ||
| export { useQueryErrorResetBoundary as useQueryErrorResetBoundary_alias_1 } | ||
| declare interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> { | ||
| } | ||
| export { UseQueryOptions } | ||
| export { UseQueryOptions as UseQueryOptions_alias_1 } | ||
| declare type UseQueryOptionsForUseQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData' | 'subscribed'> & { | ||
| placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>; | ||
| }; | ||
| declare type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>; | ||
| export { UseQueryResult } | ||
| export { UseQueryResult as UseQueryResult_alias_1 } | ||
| declare function useSuspenseInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseSuspenseInfiniteQueryResult<TData, TError>; | ||
| export { useSuspenseInfiniteQuery } | ||
| export { useSuspenseInfiniteQuery as useSuspenseInfiniteQuery_alias_1 } | ||
| declare interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> { | ||
| queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken>; | ||
| } | ||
| export { UseSuspenseInfiniteQueryOptions } | ||
| export { UseSuspenseInfiniteQueryOptions as UseSuspenseInfiniteQueryOptions_alias_1 } | ||
| declare type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>; | ||
| export { UseSuspenseInfiniteQueryResult } | ||
| export { UseSuspenseInfiniteQueryResult as UseSuspenseInfiniteQueryResult_alias_1 } | ||
| declare function useSuspenseQueries<T extends Array<any>, TCombinedResult = SuspenseQueriesResults<T>>(options: { | ||
| queries: readonly [...SuspenseQueriesOptions<T>] | readonly [...{ | ||
| [K in keyof T]: GetUseSuspenseQueryOptions<T[K]>; | ||
| }]; | ||
| combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| declare function useSuspenseQueries<T extends Array<any>, TCombinedResult = SuspenseQueriesResults<T>>(options: { | ||
| queries: readonly [...SuspenseQueriesOptions<T>]; | ||
| combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult; | ||
| }, queryClient?: QueryClient): TCombinedResult; | ||
| export { useSuspenseQueries } | ||
| export { useSuspenseQueries as useSuspenseQueries_alias_1 } | ||
| declare function useSuspenseQuery<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, queryClient?: QueryClient): UseSuspenseQueryResult<TData, TError>; | ||
| export { useSuspenseQuery } | ||
| export { useSuspenseQuery as useSuspenseQuery_alias_1 } | ||
| declare interface UseSuspenseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> { | ||
| queryFn?: Exclude<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>; | ||
| } | ||
| export { UseSuspenseQueryOptions } | ||
| export { UseSuspenseQueryOptions as UseSuspenseQueryOptions_alias_1 } | ||
| declare type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>; | ||
| export { UseSuspenseQueryResult } | ||
| export { UseSuspenseQueryResult as UseSuspenseQueryResult_alias_1 } | ||
| export declare const willFetch: (result: QueryObserverResult<any, any>, isRestoring: boolean) => boolean; | ||
| export { WithRequired } | ||
| export { } |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/errorBoundaryUtils.ts | ||
| var errorBoundaryUtils_exports = {}; | ||
| __export(errorBoundaryUtils_exports, { | ||
| ensurePreventErrorBoundaryRetry: () => ensurePreventErrorBoundaryRetry, | ||
| getHasError: () => getHasError, | ||
| useClearResetErrorBoundary: () => useClearResetErrorBoundary | ||
| }); | ||
| module.exports = __toCommonJS(errorBoundaryUtils_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => { | ||
| const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? (0, import_query_core.shouldThrowError)(options.throwOnError, [query.state.error, query]) : options.throwOnError; | ||
| if (options.suspense || options.experimental_prefetchInRender || throwOnError) { | ||
| if (!errorResetBoundary.isReset()) { | ||
| options.retryOnMount = false; | ||
| } | ||
| } | ||
| }; | ||
| var useClearResetErrorBoundary = (errorResetBoundary) => { | ||
| React.useEffect(() => { | ||
| errorResetBoundary.clearReset(); | ||
| }, [errorResetBoundary]); | ||
| }; | ||
| var getHasError = ({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError, | ||
| query, | ||
| suspense | ||
| }) => { | ||
| return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || (0, import_query_core.shouldThrowError)(throwOnError, [result.error, query])); | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| ensurePreventErrorBoundaryRetry, | ||
| getHasError, | ||
| useClearResetErrorBoundary | ||
| }); | ||
| //# sourceMappingURL=errorBoundaryUtils.cjs.map |
| {"version":3,"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => {\n const throwOnError =\n query?.state.error && typeof options.throwOnError === 'function'\n ? shouldThrowError(options.throwOnError, [query.state.error, query])\n : options.throwOnError\n\n if (\n options.suspense ||\n options.experimental_prefetchInRender ||\n throwOnError\n ) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,wBAAiC;AAU1B,IAAM,kCAAkC,CAO7C,SAOA,oBACA,UACG;AACH,QAAM,eACJ,OAAO,MAAM,SAAS,OAAO,QAAQ,iBAAiB,iBAClD,oCAAiB,QAAQ,cAAc,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,IACjE,QAAQ;AAEd,MACE,QAAQ,YACR,QAAQ,iCACR,cACA;AAEA,QAAI,CAAC,mBAAmB,QAAQ,GAAG;AACjC,cAAQ,eAAe;AAAA,IACzB;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,CACxC,uBACG;AACH,EAAM,gBAAU,MAAM;AACpB,uBAAmB,WAAW;AAAA,EAChC,GAAG,CAAC,kBAAkB,CAAC;AACzB;AAEO,IAAM,cAAc,CAMzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAMM;AACJ,SACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,cAC5B,oCAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D;","names":[]} |
| export { ensurePreventErrorBoundaryRetry } from './_tsup-dts-rollup.cjs'; | ||
| export { useClearResetErrorBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { getHasError } from './_tsup-dts-rollup.cjs'; |
| export { ensurePreventErrorBoundaryRetry } from './_tsup-dts-rollup.js'; | ||
| export { useClearResetErrorBoundary } from './_tsup-dts-rollup.js'; | ||
| export { getHasError } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/errorBoundaryUtils.ts | ||
| import * as React from "react"; | ||
| import { shouldThrowError } from "@tanstack/query-core"; | ||
| var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => { | ||
| const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError; | ||
| if (options.suspense || options.experimental_prefetchInRender || throwOnError) { | ||
| if (!errorResetBoundary.isReset()) { | ||
| options.retryOnMount = false; | ||
| } | ||
| } | ||
| }; | ||
| var useClearResetErrorBoundary = (errorResetBoundary) => { | ||
| React.useEffect(() => { | ||
| errorResetBoundary.clearReset(); | ||
| }, [errorResetBoundary]); | ||
| }; | ||
| var getHasError = ({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError, | ||
| query, | ||
| suspense | ||
| }) => { | ||
| return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query])); | ||
| }; | ||
| export { | ||
| ensurePreventErrorBoundaryRetry, | ||
| getHasError, | ||
| useClearResetErrorBoundary | ||
| }; | ||
| //# sourceMappingURL=errorBoundaryUtils.js.map |
| {"version":3,"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined,\n) => {\n const throwOnError =\n query?.state.error && typeof options.throwOnError === 'function'\n ? shouldThrowError(options.throwOnError, [query.state.error, query])\n : options.throwOnError\n\n if (\n options.suspense ||\n options.experimental_prefetchInRender ||\n throwOnError\n ) {\n // Prevent retrying failed query if the error boundary has not been reset yet\n if (!errorResetBoundary.isReset()) {\n options.retryOnMount = false\n }\n }\n}\n\nexport const useClearResetErrorBoundary = (\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\n React.useEffect(() => {\n errorResetBoundary.clearReset()\n }, [errorResetBoundary])\n}\n\nexport const getHasError = <\n TData,\n TError,\n TQueryFnData,\n TQueryData,\n TQueryKey extends QueryKey,\n>({\n result,\n errorResetBoundary,\n throwOnError,\n query,\n suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB,SAAS,wBAAwB;AAU1B,IAAM,kCAAkC,CAO7C,SAOA,oBACA,UACG;AACH,QAAM,eACJ,OAAO,MAAM,SAAS,OAAO,QAAQ,iBAAiB,aAClD,iBAAiB,QAAQ,cAAc,CAAC,MAAM,MAAM,OAAO,KAAK,CAAC,IACjE,QAAQ;AAEd,MACE,QAAQ,YACR,QAAQ,iCACR,cACA;AAEA,QAAI,CAAC,mBAAmB,QAAQ,GAAG;AACjC,cAAQ,eAAe;AAAA,IACzB;AAAA,EACF;AACF;AAEO,IAAM,6BAA6B,CACxC,uBACG;AACH,EAAM,gBAAU,MAAM;AACpB,uBAAmB,WAAW;AAAA,EAChC,GAAG,CAAC,kBAAkB,CAAC;AACzB;AAEO,IAAM,cAAc,CAMzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAMM;AACJ,SACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,UAC5B,iBAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/HydrationBoundary.tsx | ||
| var HydrationBoundary_exports = {}; | ||
| __export(HydrationBoundary_exports, { | ||
| HydrationBoundary: () => HydrationBoundary | ||
| }); | ||
| module.exports = __toCommonJS(HydrationBoundary_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| var HydrationBoundary = ({ | ||
| children, | ||
| options = {}, | ||
| state, | ||
| queryClient | ||
| }) => { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const optionsRef = React.useRef(options); | ||
| React.useEffect(() => { | ||
| optionsRef.current = options; | ||
| }); | ||
| const hydrationQueue = React.useMemo(() => { | ||
| if (state) { | ||
| if (typeof state !== "object") { | ||
| return; | ||
| } | ||
| const queryCache = client.getQueryCache(); | ||
| const queries = state.queries || []; | ||
| const newQueries = []; | ||
| const existingQueries = []; | ||
| for (const dehydratedQuery of queries) { | ||
| const existingQuery = queryCache.get(dehydratedQuery.queryHash); | ||
| if (!existingQuery) { | ||
| newQueries.push(dehydratedQuery); | ||
| } else { | ||
| const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt; | ||
| if (hydrationIsNewer) { | ||
| existingQueries.push(dehydratedQuery); | ||
| } | ||
| } | ||
| } | ||
| if (newQueries.length > 0) { | ||
| (0, import_query_core.hydrate)(client, { queries: newQueries }, optionsRef.current); | ||
| } | ||
| if (existingQueries.length > 0) { | ||
| return existingQueries; | ||
| } | ||
| } | ||
| return void 0; | ||
| }, [client, state]); | ||
| React.useEffect(() => { | ||
| if (hydrationQueue) { | ||
| (0, import_query_core.hydrate)(client, { queries: hydrationQueue }, optionsRef.current); | ||
| } | ||
| }, [client, hydrationQueue]); | ||
| return children; | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| HydrationBoundary | ||
| }); | ||
| //# sourceMappingURL=HydrationBoundary.cjs.map |
| {"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAAwB;AACxB,iCAA+B;AAoBxB,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,aAAS,2CAAe,WAAW;AAEzC,QAAM,aAAmB,aAAO,OAAO;AACvC,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAiBD,QAAM,iBACE,cAAQ,MAAM;AAClB,QAAI,OAAO;AACT,UAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,MACF;AAEA,YAAM,aAAa,OAAO,cAAc;AAKxC,YAAM,UAAU,MAAM,WAAW,CAAC;AAElC,YAAM,aAAyC,CAAC;AAChD,YAAM,kBAA8C,CAAC;AACrD,iBAAW,mBAAmB,SAAS;AACrC,cAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;AAE9D,YAAI,CAAC,eAAe;AAClB,qBAAW,KAAK,eAAe;AAAA,QACjC,OAAO;AACL,gBAAM,mBACJ,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,UACjC,gBAAgB,eACd,cAAc,MAAM;AAE1B,cAAI,kBAAkB;AACpB,4BAAgB,KAAK,eAAe;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAEA,UAAI,WAAW,SAAS,GAAG;AAIzB,uCAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;AAAA,MAC7D;AACA,UAAI,gBAAgB,SAAS,GAAG;AAC9B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,KAAK,CAAC;AAEpB,EAAM,gBAAU,MAAM;AACpB,QAAI,gBAAgB;AAClB,qCAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO;AACT;","names":[]} |
| export { HydrationBoundaryProps } from './_tsup-dts-rollup.cjs'; | ||
| export { HydrationBoundary } from './_tsup-dts-rollup.cjs'; |
| export { HydrationBoundaryProps } from './_tsup-dts-rollup.js'; | ||
| export { HydrationBoundary } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/HydrationBoundary.tsx | ||
| import * as React from "react"; | ||
| import { hydrate } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| var HydrationBoundary = ({ | ||
| children, | ||
| options = {}, | ||
| state, | ||
| queryClient | ||
| }) => { | ||
| const client = useQueryClient(queryClient); | ||
| const optionsRef = React.useRef(options); | ||
| React.useEffect(() => { | ||
| optionsRef.current = options; | ||
| }); | ||
| const hydrationQueue = React.useMemo(() => { | ||
| if (state) { | ||
| if (typeof state !== "object") { | ||
| return; | ||
| } | ||
| const queryCache = client.getQueryCache(); | ||
| const queries = state.queries || []; | ||
| const newQueries = []; | ||
| const existingQueries = []; | ||
| for (const dehydratedQuery of queries) { | ||
| const existingQuery = queryCache.get(dehydratedQuery.queryHash); | ||
| if (!existingQuery) { | ||
| newQueries.push(dehydratedQuery); | ||
| } else { | ||
| const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt; | ||
| if (hydrationIsNewer) { | ||
| existingQueries.push(dehydratedQuery); | ||
| } | ||
| } | ||
| } | ||
| if (newQueries.length > 0) { | ||
| hydrate(client, { queries: newQueries }, optionsRef.current); | ||
| } | ||
| if (existingQueries.length > 0) { | ||
| return existingQueries; | ||
| } | ||
| } | ||
| return void 0; | ||
| }, [client, state]); | ||
| React.useEffect(() => { | ||
| if (hydrationQueue) { | ||
| hydrate(client, { queries: hydrationQueue }, optionsRef.current); | ||
| } | ||
| }, [client, hydrationQueue]); | ||
| return children; | ||
| }; | ||
| export { | ||
| HydrationBoundary | ||
| }; | ||
| //# sourceMappingURL=HydrationBoundary.js.map |
| {"version":3,"sources":["../../src/HydrationBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { hydrate } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n DehydratedState,\n HydrateOptions,\n OmitKeyof,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport interface HydrationBoundaryProps {\n state: DehydratedState | null | undefined\n options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {\n defaultOptions?: OmitKeyof<\n Exclude<HydrateOptions['defaultOptions'], undefined>,\n 'mutations'\n >\n }\n children?: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport const HydrationBoundary = ({\n children,\n options = {},\n state,\n queryClient,\n}: HydrationBoundaryProps) => {\n const client = useQueryClient(queryClient)\n\n const optionsRef = React.useRef(options)\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n // This useMemo is for performance reasons only, everything inside it must\n // be safe to run in every render and code here should be read as \"in render\".\n //\n // This code needs to happen during the render phase, because after initial\n // SSR, hydration needs to happen _before_ children render. Also, if hydrating\n // during a transition, we want to hydrate as much as is safe in render so\n // we can prerender as much as possible.\n //\n // For any queries that already exist in the cache, we want to hold back on\n // hydrating until _after_ the render phase. The reason for this is that during\n // transitions, we don't want the existing queries and observers to update to\n // the new data on the current page, only _after_ the transition is committed.\n // If the transition is aborted, we will have hydrated any _new_ queries, but\n // we throw away the fresh data for any existing ones to avoid unexpectedly\n // updating the UI.\n const hydrationQueue: DehydratedState['queries'] | undefined =\n React.useMemo(() => {\n if (state) {\n if (typeof state !== 'object') {\n return\n }\n\n const queryCache = client.getQueryCache()\n // State is supplied from the outside and we might as well fail\n // gracefully if it has the wrong shape, so while we type `queries`\n // as required, we still provide a fallback.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n const queries = state.queries || []\n\n const newQueries: DehydratedState['queries'] = []\n const existingQueries: DehydratedState['queries'] = []\n for (const dehydratedQuery of queries) {\n const existingQuery = queryCache.get(dehydratedQuery.queryHash)\n\n if (!existingQuery) {\n newQueries.push(dehydratedQuery)\n } else {\n const hydrationIsNewer =\n dehydratedQuery.state.dataUpdatedAt >\n existingQuery.state.dataUpdatedAt ||\n (dehydratedQuery.promise &&\n existingQuery.state.status !== 'pending' &&\n existingQuery.state.fetchStatus !== 'fetching' &&\n dehydratedQuery.dehydratedAt !== undefined &&\n dehydratedQuery.dehydratedAt >\n existingQuery.state.dataUpdatedAt)\n\n if (hydrationIsNewer) {\n existingQueries.push(dehydratedQuery)\n }\n }\n }\n\n if (newQueries.length > 0) {\n // It's actually fine to call this with queries/state that already exists\n // in the cache, or is older. hydrate() is idempotent for queries.\n // eslint-disable-next-line react-hooks/refs\n hydrate(client, { queries: newQueries }, optionsRef.current)\n }\n if (existingQueries.length > 0) {\n return existingQueries\n }\n }\n return undefined\n }, [client, state])\n\n React.useEffect(() => {\n if (hydrationQueue) {\n hydrate(client, { queries: hydrationQueue }, optionsRef.current)\n }\n }, [client, hydrationQueue])\n\n return children as React.ReactElement\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,SAAS,eAAe;AACxB,SAAS,sBAAsB;AAoBxB,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AACF,MAA8B;AAC5B,QAAM,SAAS,eAAe,WAAW;AAEzC,QAAM,aAAmB,aAAO,OAAO;AACvC,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAiBD,QAAM,iBACE,cAAQ,MAAM;AAClB,QAAI,OAAO;AACT,UAAI,OAAO,UAAU,UAAU;AAC7B;AAAA,MACF;AAEA,YAAM,aAAa,OAAO,cAAc;AAKxC,YAAM,UAAU,MAAM,WAAW,CAAC;AAElC,YAAM,aAAyC,CAAC;AAChD,YAAM,kBAA8C,CAAC;AACrD,iBAAW,mBAAmB,SAAS;AACrC,cAAM,gBAAgB,WAAW,IAAI,gBAAgB,SAAS;AAE9D,YAAI,CAAC,eAAe;AAClB,qBAAW,KAAK,eAAe;AAAA,QACjC,OAAO;AACL,gBAAM,mBACJ,gBAAgB,MAAM,gBACpB,cAAc,MAAM,iBACrB,gBAAgB,WACf,cAAc,MAAM,WAAW,aAC/B,cAAc,MAAM,gBAAgB,cACpC,gBAAgB,iBAAiB,UACjC,gBAAgB,eACd,cAAc,MAAM;AAE1B,cAAI,kBAAkB;AACpB,4BAAgB,KAAK,eAAe;AAAA,UACtC;AAAA,QACF;AAAA,MACF;AAEA,UAAI,WAAW,SAAS,GAAG;AAIzB,gBAAQ,QAAQ,EAAE,SAAS,WAAW,GAAG,WAAW,OAAO;AAAA,MAC7D;AACA,UAAI,gBAAgB,SAAS,GAAG;AAC9B,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,KAAK,CAAC;AAEpB,EAAM,gBAAU,MAAM;AACpB,QAAI,gBAAgB;AAClB,cAAQ,QAAQ,EAAE,SAAS,eAAe,GAAG,WAAW,OAAO;AAAA,IACjE;AAAA,EACF,GAAG,CAAC,QAAQ,cAAc,CAAC;AAE3B,SAAO;AACT;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/index.ts | ||
| var index_exports = {}; | ||
| __export(index_exports, { | ||
| HydrationBoundary: () => import_HydrationBoundary.HydrationBoundary, | ||
| IsRestoringProvider: () => import_IsRestoringProvider.IsRestoringProvider, | ||
| QueryClientContext: () => import_QueryClientProvider.QueryClientContext, | ||
| QueryClientProvider: () => import_QueryClientProvider.QueryClientProvider, | ||
| QueryErrorResetBoundary: () => import_QueryErrorResetBoundary.QueryErrorResetBoundary, | ||
| infiniteQueryOptions: () => import_infiniteQueryOptions.infiniteQueryOptions, | ||
| mutationOptions: () => import_mutationOptions.mutationOptions, | ||
| queryOptions: () => import_queryOptions.queryOptions, | ||
| useInfiniteQuery: () => import_useInfiniteQuery.useInfiniteQuery, | ||
| useIsFetching: () => import_useIsFetching.useIsFetching, | ||
| useIsMutating: () => import_useMutationState.useIsMutating, | ||
| useIsRestoring: () => import_IsRestoringProvider.useIsRestoring, | ||
| useMutation: () => import_useMutation.useMutation, | ||
| useMutationState: () => import_useMutationState.useMutationState, | ||
| usePrefetchInfiniteQuery: () => import_usePrefetchInfiniteQuery.usePrefetchInfiniteQuery, | ||
| usePrefetchQuery: () => import_usePrefetchQuery.usePrefetchQuery, | ||
| useQueries: () => import_useQueries.useQueries, | ||
| useQuery: () => import_useQuery.useQuery, | ||
| useQueryClient: () => import_QueryClientProvider.useQueryClient, | ||
| useQueryErrorResetBoundary: () => import_QueryErrorResetBoundary.useQueryErrorResetBoundary, | ||
| useSuspenseInfiniteQuery: () => import_useSuspenseInfiniteQuery.useSuspenseInfiniteQuery, | ||
| useSuspenseQueries: () => import_useSuspenseQueries.useSuspenseQueries, | ||
| useSuspenseQuery: () => import_useSuspenseQuery.useSuspenseQuery | ||
| }); | ||
| module.exports = __toCommonJS(index_exports); | ||
| __reExport(index_exports, require("@tanstack/query-core"), module.exports); | ||
| __reExport(index_exports, require("./types.cjs"), module.exports); | ||
| var import_useQueries = require("./useQueries.cjs"); | ||
| var import_useQuery = require("./useQuery.cjs"); | ||
| var import_useSuspenseQuery = require("./useSuspenseQuery.cjs"); | ||
| var import_useSuspenseInfiniteQuery = require("./useSuspenseInfiniteQuery.cjs"); | ||
| var import_useSuspenseQueries = require("./useSuspenseQueries.cjs"); | ||
| var import_usePrefetchQuery = require("./usePrefetchQuery.cjs"); | ||
| var import_usePrefetchInfiniteQuery = require("./usePrefetchInfiniteQuery.cjs"); | ||
| var import_queryOptions = require("./queryOptions.cjs"); | ||
| var import_infiniteQueryOptions = require("./infiniteQueryOptions.cjs"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| var import_HydrationBoundary = require("./HydrationBoundary.cjs"); | ||
| var import_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs"); | ||
| var import_useIsFetching = require("./useIsFetching.cjs"); | ||
| var import_useMutationState = require("./useMutationState.cjs"); | ||
| var import_useMutation = require("./useMutation.cjs"); | ||
| var import_mutationOptions = require("./mutationOptions.cjs"); | ||
| var import_useInfiniteQuery = require("./useInfiniteQuery.cjs"); | ||
| var import_IsRestoringProvider = require("./IsRestoringProvider.cjs"); | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| HydrationBoundary, | ||
| IsRestoringProvider, | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| QueryErrorResetBoundary, | ||
| infiniteQueryOptions, | ||
| mutationOptions, | ||
| queryOptions, | ||
| useInfiniteQuery, | ||
| useIsFetching, | ||
| useIsMutating, | ||
| useIsRestoring, | ||
| useMutation, | ||
| useMutationState, | ||
| usePrefetchInfiniteQuery, | ||
| usePrefetchQuery, | ||
| useQueries, | ||
| useQuery, | ||
| useQueryClient, | ||
| useQueryErrorResetBoundary, | ||
| useSuspenseInfiniteQuery, | ||
| useSuspenseQueries, | ||
| useSuspenseQuery, | ||
| ...require("@tanstack/query-core"), | ||
| ...require("./types.cjs") | ||
| }); | ||
| //# sourceMappingURL=index.cjs.map |
| {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\n// Re-export core\nexport * from '@tanstack/query-core'\n\n// React Query\nexport * from './types'\nexport { useQueries } from './useQueries'\nexport type { QueriesResults, QueriesOptions } from './useQueries'\nexport { useQuery } from './useQuery'\nexport { useSuspenseQuery } from './useSuspenseQuery'\nexport { useSuspenseInfiniteQuery } from './useSuspenseInfiniteQuery'\nexport { useSuspenseQueries } from './useSuspenseQueries'\nexport type {\n SuspenseQueriesResults,\n SuspenseQueriesOptions,\n} from './useSuspenseQueries'\nexport { usePrefetchQuery } from './usePrefetchQuery'\nexport { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery'\nexport { queryOptions } from './queryOptions'\nexport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n UnusedSkipTokenOptions,\n} from './queryOptions'\nexport { infiniteQueryOptions } from './infiniteQueryOptions'\nexport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n UnusedSkipTokenInfiniteOptions,\n} from './infiniteQueryOptions'\nexport {\n QueryClientContext,\n QueryClientProvider,\n useQueryClient,\n} from './QueryClientProvider'\nexport type { QueryClientProviderProps } from './QueryClientProvider'\nexport type { QueryErrorResetBoundaryProps } from './QueryErrorResetBoundary'\nexport { HydrationBoundary } from './HydrationBoundary'\nexport type { HydrationBoundaryProps } from './HydrationBoundary'\nexport type {\n QueryErrorClearResetFunction,\n QueryErrorIsResetFunction,\n QueryErrorResetBoundaryFunction,\n QueryErrorResetFunction,\n} from './QueryErrorResetBoundary'\nexport {\n QueryErrorResetBoundary,\n useQueryErrorResetBoundary,\n} from './QueryErrorResetBoundary'\nexport { useIsFetching } from './useIsFetching'\nexport { useIsMutating, useMutationState } from './useMutationState'\nexport { useMutation } from './useMutation'\nexport { mutationOptions } from './mutationOptions'\nexport { useInfiniteQuery } from './useInfiniteQuery'\nexport { useIsRestoring, IsRestoringProvider } from './IsRestoringProvider'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAc,iCAHd;AAMA,0BAAc,wBANd;AAOA,wBAA2B;AAE3B,sBAAyB;AACzB,8BAAiC;AACjC,sCAAyC;AACzC,gCAAmC;AAKnC,8BAAiC;AACjC,sCAAyC;AACzC,0BAA6B;AAM7B,kCAAqC;AAMrC,iCAIO;AAGP,+BAAkC;AAQlC,qCAGO;AACP,2BAA8B;AAC9B,8BAAgD;AAChD,yBAA4B;AAC5B,6BAAgC;AAChC,8BAAiC;AACjC,iCAAoD;","names":[]} |
| export { useQueries } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesResults } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { useQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { useSuspenseQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { useSuspenseInfiniteQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { useSuspenseQueries } from './_tsup-dts-rollup.cjs'; | ||
| export { SuspenseQueriesResults } from './_tsup-dts-rollup.cjs'; | ||
| export { SuspenseQueriesOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { usePrefetchQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { usePrefetchInfiniteQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { queryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInitialDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UndefinedInitialDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UnusedSkipTokenOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { infiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UndefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UnusedSkipTokenInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientContext_alias_1 as QueryClientContext } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientProvider_alias_1 as QueryClientProvider } from './_tsup-dts-rollup.cjs'; | ||
| export { useQueryClient_alias_1 as useQueryClient } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientProviderProps_alias_1 as QueryClientProviderProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryProps_alias_1 as QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.cjs'; | ||
| export { HydrationBoundary_alias_1 as HydrationBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { HydrationBoundaryProps_alias_1 as HydrationBoundaryProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorClearResetFunction_alias_1 as QueryErrorClearResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorIsResetFunction_alias_1 as QueryErrorIsResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryFunction_alias_1 as QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetFunction_alias_1 as QueryErrorResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundary_alias_1 as QueryErrorResetBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { useQueryErrorResetBoundary_alias_1 as useQueryErrorResetBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { useIsFetching } from './_tsup-dts-rollup.cjs'; | ||
| export { useIsMutating } from './_tsup-dts-rollup.cjs'; | ||
| export { useMutationState } from './_tsup-dts-rollup.cjs'; | ||
| export { useMutation } from './_tsup-dts-rollup.cjs'; | ||
| export { mutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { useInfiniteQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { useIsRestoring_alias_1 as useIsRestoring } from './_tsup-dts-rollup.cjs'; | ||
| export { IsRestoringProvider_alias_1 as IsRestoringProvider } from './_tsup-dts-rollup.cjs'; | ||
| export { focusManager } from './_tsup-dts-rollup.cjs'; | ||
| export { environmentManager } from './_tsup-dts-rollup.cjs'; | ||
| export { defaultShouldDehydrateMutation } from './_tsup-dts-rollup.cjs'; | ||
| export { defaultShouldDehydrateQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { dehydrate } from './_tsup-dts-rollup.cjs'; | ||
| export { hydrate } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserver } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationCache } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationCacheNotifyEvent } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserver } from './_tsup-dts-rollup.cjs'; | ||
| export { defaultScheduler } from './_tsup-dts-rollup.cjs'; | ||
| export { notifyManager } from './_tsup-dts-rollup.cjs'; | ||
| export { onlineManager } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesObserver } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryCache } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryCacheNotifyEvent } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClient } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserver } from './_tsup-dts-rollup.cjs'; | ||
| export { CancelledError } from './_tsup-dts-rollup.cjs'; | ||
| export { isCancelledError } from './_tsup-dts-rollup.cjs'; | ||
| export { timeoutManager } from './_tsup-dts-rollup.cjs'; | ||
| export { ManagedTimerId } from './_tsup-dts-rollup.cjs'; | ||
| export { TimeoutCallback } from './_tsup-dts-rollup.cjs'; | ||
| export { TimeoutProvider } from './_tsup-dts-rollup.cjs'; | ||
| export { hashKey } from './_tsup-dts-rollup.cjs'; | ||
| export { isServer } from './_tsup-dts-rollup.cjs'; | ||
| export { keepPreviousData } from './_tsup-dts-rollup.cjs'; | ||
| export { matchMutation } from './_tsup-dts-rollup.cjs'; | ||
| export { matchQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { noop } from './_tsup-dts-rollup.cjs'; | ||
| export { partialMatchKey } from './_tsup-dts-rollup.cjs'; | ||
| export { replaceEqualDeep } from './_tsup-dts-rollup.cjs'; | ||
| export { shouldThrowError } from './_tsup-dts-rollup.cjs'; | ||
| export { skipToken } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationFilters } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryFilters } from './_tsup-dts-rollup.cjs'; | ||
| export { SkipToken } from './_tsup-dts-rollup.cjs'; | ||
| export { Updater } from './_tsup-dts-rollup.cjs'; | ||
| export { experimental_streamedQuery } from './_tsup-dts-rollup.cjs'; | ||
| export { DehydratedState } from './_tsup-dts-rollup.cjs'; | ||
| export { DehydrateOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { HydrateOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { Mutation } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationState } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { Query } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryState } from './_tsup-dts-rollup.cjs'; | ||
| export { NonUndefinedGuard } from './_tsup-dts-rollup.cjs'; | ||
| export { DistributiveOmit } from './_tsup-dts-rollup.cjs'; | ||
| export { OmitKeyof } from './_tsup-dts-rollup.cjs'; | ||
| export { Override } from './_tsup-dts-rollup.cjs'; | ||
| export { NoInfer } from './_tsup-dts-rollup.cjs'; | ||
| export { Register } from './_tsup-dts-rollup.cjs'; | ||
| export { DefaultError } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryKey } from './_tsup-dts-rollup.cjs'; | ||
| export { dataTagSymbol } from './_tsup-dts-rollup.cjs'; | ||
| export { dataTagErrorSymbol } from './_tsup-dts-rollup.cjs'; | ||
| export { unsetMarker } from './_tsup-dts-rollup.cjs'; | ||
| export { UnsetMarker } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyDataTag } from './_tsup-dts-rollup.cjs'; | ||
| export { DataTag } from './_tsup-dts-rollup.cjs'; | ||
| export { InferDataFromTag } from './_tsup-dts-rollup.cjs'; | ||
| export { InferErrorFromTag } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { StaleTime } from './_tsup-dts-rollup.cjs'; | ||
| export { StaleTimeFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { Enabled } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryPersister } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryFunctionContext } from './_tsup-dts-rollup.cjs'; | ||
| export { InitialDataFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { PlaceholderDataFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesPlaceholderDataFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryKeyHashFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { GetPreviousPageParamFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { GetNextPageParamFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteData } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryMeta } from './_tsup-dts-rollup.cjs'; | ||
| export { NetworkMode } from './_tsup-dts-rollup.cjs'; | ||
| export { NotifyOnChangeProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { InitialPageParam } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryPageParamsOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { ThrowOnError } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { WithRequired } from './_tsup-dts-rollup.cjs'; | ||
| export { DefaultedQueryObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefaultedInfiniteQueryObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { EnsureQueryDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { EnsureInfiniteQueryDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { ResultOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { RefetchOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { InvalidateQueryFilters } from './_tsup-dts-rollup.cjs'; | ||
| export { RefetchQueryFilters } from './_tsup-dts-rollup.cjs'; | ||
| export { InvalidateOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { ResetOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchNextPageOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchPreviousPageOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryStatus } from './_tsup-dts-rollup.cjs'; | ||
| export { FetchStatus } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverBaseResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverPendingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverLoadingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverLoadingErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverRefetchErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverSuccessResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverPlaceholderResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedQueryObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverBaseResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverPendingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverLoadingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverLoadingErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverRefetchErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverSuccessResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverPlaceholderResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInfiniteQueryObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { InfiniteQueryObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationKey } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationStatus } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationScope } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationMeta } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationFunctionContext } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { MutateOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { MutateFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverBaseResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverIdleResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverLoadingResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverErrorResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverSuccessResult } from './_tsup-dts-rollup.cjs'; | ||
| export { MutationObserverResult } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientConfig } from './_tsup-dts-rollup.cjs'; | ||
| export { DefaultOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { CancelOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { SetDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { NotifyEventType } from './_tsup-dts-rollup.cjs'; | ||
| export { NotifyEvent } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseBaseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UsePrefetchQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseSuspenseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedUseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedUseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseMutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutateFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutateAsyncFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseMutationResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutationResult } from './_tsup-dts-rollup.cjs'; |
| export { useQueries } from './_tsup-dts-rollup.js'; | ||
| export { QueriesResults } from './_tsup-dts-rollup.js'; | ||
| export { QueriesOptions } from './_tsup-dts-rollup.js'; | ||
| export { useQuery } from './_tsup-dts-rollup.js'; | ||
| export { useSuspenseQuery } from './_tsup-dts-rollup.js'; | ||
| export { useSuspenseInfiniteQuery } from './_tsup-dts-rollup.js'; | ||
| export { useSuspenseQueries } from './_tsup-dts-rollup.js'; | ||
| export { SuspenseQueriesResults } from './_tsup-dts-rollup.js'; | ||
| export { SuspenseQueriesOptions } from './_tsup-dts-rollup.js'; | ||
| export { usePrefetchQuery } from './_tsup-dts-rollup.js'; | ||
| export { usePrefetchInfiniteQuery } from './_tsup-dts-rollup.js'; | ||
| export { queryOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInitialDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { UndefinedInitialDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { UnusedSkipTokenOptions } from './_tsup-dts-rollup.js'; | ||
| export { infiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { UndefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { UnusedSkipTokenInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientContext_alias_1 as QueryClientContext } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientProvider_alias_1 as QueryClientProvider } from './_tsup-dts-rollup.js'; | ||
| export { useQueryClient_alias_1 as useQueryClient } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientProviderProps_alias_1 as QueryClientProviderProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryProps_alias_1 as QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.js'; | ||
| export { HydrationBoundary_alias_1 as HydrationBoundary } from './_tsup-dts-rollup.js'; | ||
| export { HydrationBoundaryProps_alias_1 as HydrationBoundaryProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorClearResetFunction_alias_1 as QueryErrorClearResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorIsResetFunction_alias_1 as QueryErrorIsResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryFunction_alias_1 as QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetFunction_alias_1 as QueryErrorResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundary_alias_1 as QueryErrorResetBoundary } from './_tsup-dts-rollup.js'; | ||
| export { useQueryErrorResetBoundary_alias_1 as useQueryErrorResetBoundary } from './_tsup-dts-rollup.js'; | ||
| export { useIsFetching } from './_tsup-dts-rollup.js'; | ||
| export { useIsMutating } from './_tsup-dts-rollup.js'; | ||
| export { useMutationState } from './_tsup-dts-rollup.js'; | ||
| export { useMutation } from './_tsup-dts-rollup.js'; | ||
| export { mutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { useInfiniteQuery } from './_tsup-dts-rollup.js'; | ||
| export { useIsRestoring_alias_1 as useIsRestoring } from './_tsup-dts-rollup.js'; | ||
| export { IsRestoringProvider_alias_1 as IsRestoringProvider } from './_tsup-dts-rollup.js'; | ||
| export { focusManager } from './_tsup-dts-rollup.js'; | ||
| export { environmentManager } from './_tsup-dts-rollup.js'; | ||
| export { defaultShouldDehydrateMutation } from './_tsup-dts-rollup.js'; | ||
| export { defaultShouldDehydrateQuery } from './_tsup-dts-rollup.js'; | ||
| export { dehydrate } from './_tsup-dts-rollup.js'; | ||
| export { hydrate } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserver } from './_tsup-dts-rollup.js'; | ||
| export { MutationCache } from './_tsup-dts-rollup.js'; | ||
| export { MutationCacheNotifyEvent } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserver } from './_tsup-dts-rollup.js'; | ||
| export { defaultScheduler } from './_tsup-dts-rollup.js'; | ||
| export { notifyManager } from './_tsup-dts-rollup.js'; | ||
| export { onlineManager } from './_tsup-dts-rollup.js'; | ||
| export { QueriesObserver } from './_tsup-dts-rollup.js'; | ||
| export { QueryCache } from './_tsup-dts-rollup.js'; | ||
| export { QueryCacheNotifyEvent } from './_tsup-dts-rollup.js'; | ||
| export { QueryClient } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserver } from './_tsup-dts-rollup.js'; | ||
| export { CancelledError } from './_tsup-dts-rollup.js'; | ||
| export { isCancelledError } from './_tsup-dts-rollup.js'; | ||
| export { timeoutManager } from './_tsup-dts-rollup.js'; | ||
| export { ManagedTimerId } from './_tsup-dts-rollup.js'; | ||
| export { TimeoutCallback } from './_tsup-dts-rollup.js'; | ||
| export { TimeoutProvider } from './_tsup-dts-rollup.js'; | ||
| export { hashKey } from './_tsup-dts-rollup.js'; | ||
| export { isServer } from './_tsup-dts-rollup.js'; | ||
| export { keepPreviousData } from './_tsup-dts-rollup.js'; | ||
| export { matchMutation } from './_tsup-dts-rollup.js'; | ||
| export { matchQuery } from './_tsup-dts-rollup.js'; | ||
| export { noop } from './_tsup-dts-rollup.js'; | ||
| export { partialMatchKey } from './_tsup-dts-rollup.js'; | ||
| export { replaceEqualDeep } from './_tsup-dts-rollup.js'; | ||
| export { shouldThrowError } from './_tsup-dts-rollup.js'; | ||
| export { skipToken } from './_tsup-dts-rollup.js'; | ||
| export { MutationFilters } from './_tsup-dts-rollup.js'; | ||
| export { QueryFilters } from './_tsup-dts-rollup.js'; | ||
| export { SkipToken } from './_tsup-dts-rollup.js'; | ||
| export { Updater } from './_tsup-dts-rollup.js'; | ||
| export { experimental_streamedQuery } from './_tsup-dts-rollup.js'; | ||
| export { DehydratedState } from './_tsup-dts-rollup.js'; | ||
| export { DehydrateOptions } from './_tsup-dts-rollup.js'; | ||
| export { HydrateOptions } from './_tsup-dts-rollup.js'; | ||
| export { Mutation } from './_tsup-dts-rollup.js'; | ||
| export { MutationState } from './_tsup-dts-rollup.js'; | ||
| export { QueriesObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { Query } from './_tsup-dts-rollup.js'; | ||
| export { QueryState } from './_tsup-dts-rollup.js'; | ||
| export { NonUndefinedGuard } from './_tsup-dts-rollup.js'; | ||
| export { DistributiveOmit } from './_tsup-dts-rollup.js'; | ||
| export { OmitKeyof } from './_tsup-dts-rollup.js'; | ||
| export { Override } from './_tsup-dts-rollup.js'; | ||
| export { NoInfer } from './_tsup-dts-rollup.js'; | ||
| export { Register } from './_tsup-dts-rollup.js'; | ||
| export { DefaultError } from './_tsup-dts-rollup.js'; | ||
| export { QueryKey } from './_tsup-dts-rollup.js'; | ||
| export { dataTagSymbol } from './_tsup-dts-rollup.js'; | ||
| export { dataTagErrorSymbol } from './_tsup-dts-rollup.js'; | ||
| export { unsetMarker } from './_tsup-dts-rollup.js'; | ||
| export { UnsetMarker } from './_tsup-dts-rollup.js'; | ||
| export { AnyDataTag } from './_tsup-dts-rollup.js'; | ||
| export { DataTag } from './_tsup-dts-rollup.js'; | ||
| export { InferDataFromTag } from './_tsup-dts-rollup.js'; | ||
| export { InferErrorFromTag } from './_tsup-dts-rollup.js'; | ||
| export { QueryFunction } from './_tsup-dts-rollup.js'; | ||
| export { StaleTime } from './_tsup-dts-rollup.js'; | ||
| export { StaleTimeFunction } from './_tsup-dts-rollup.js'; | ||
| export { Enabled } from './_tsup-dts-rollup.js'; | ||
| export { QueryPersister } from './_tsup-dts-rollup.js'; | ||
| export { QueryFunctionContext } from './_tsup-dts-rollup.js'; | ||
| export { InitialDataFunction } from './_tsup-dts-rollup.js'; | ||
| export { PlaceholderDataFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueriesPlaceholderDataFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryKeyHashFunction } from './_tsup-dts-rollup.js'; | ||
| export { GetPreviousPageParamFunction } from './_tsup-dts-rollup.js'; | ||
| export { GetNextPageParamFunction } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteData } from './_tsup-dts-rollup.js'; | ||
| export { QueryMeta } from './_tsup-dts-rollup.js'; | ||
| export { NetworkMode } from './_tsup-dts-rollup.js'; | ||
| export { NotifyOnChangeProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { InitialPageParam } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryPageParamsOptions } from './_tsup-dts-rollup.js'; | ||
| export { ThrowOnError } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { WithRequired } from './_tsup-dts-rollup.js'; | ||
| export { DefaultedQueryObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefaultedInfiniteQueryObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { FetchQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { EnsureQueryDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { EnsureInfiniteQueryDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { FetchInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { ResultOptions } from './_tsup-dts-rollup.js'; | ||
| export { RefetchOptions } from './_tsup-dts-rollup.js'; | ||
| export { InvalidateQueryFilters } from './_tsup-dts-rollup.js'; | ||
| export { RefetchQueryFilters } from './_tsup-dts-rollup.js'; | ||
| export { InvalidateOptions } from './_tsup-dts-rollup.js'; | ||
| export { ResetOptions } from './_tsup-dts-rollup.js'; | ||
| export { FetchNextPageOptions } from './_tsup-dts-rollup.js'; | ||
| export { FetchPreviousPageOptions } from './_tsup-dts-rollup.js'; | ||
| export { QueryStatus } from './_tsup-dts-rollup.js'; | ||
| export { FetchStatus } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverBaseResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverPendingResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverLoadingResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverLoadingErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverRefetchErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverSuccessResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverPlaceholderResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedQueryObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverBaseResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverPendingResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverLoadingResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverLoadingErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverRefetchErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverSuccessResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverPlaceholderResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInfiniteQueryObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { InfiniteQueryObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationKey } from './_tsup-dts-rollup.js'; | ||
| export { MutationStatus } from './_tsup-dts-rollup.js'; | ||
| export { MutationScope } from './_tsup-dts-rollup.js'; | ||
| export { MutationMeta } from './_tsup-dts-rollup.js'; | ||
| export { MutationFunctionContext } from './_tsup-dts-rollup.js'; | ||
| export { MutationFunction } from './_tsup-dts-rollup.js'; | ||
| export { MutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverOptions } from './_tsup-dts-rollup.js'; | ||
| export { MutateOptions } from './_tsup-dts-rollup.js'; | ||
| export { MutateFunction } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverBaseResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverIdleResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverLoadingResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverErrorResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverSuccessResult } from './_tsup-dts-rollup.js'; | ||
| export { MutationObserverResult } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientConfig } from './_tsup-dts-rollup.js'; | ||
| export { DefaultOptions } from './_tsup-dts-rollup.js'; | ||
| export { CancelOptions } from './_tsup-dts-rollup.js'; | ||
| export { SetDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { NotifyEventType } from './_tsup-dts-rollup.js'; | ||
| export { NotifyEvent } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseBaseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UsePrefetchQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseSuspenseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedUseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedUseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseMutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseMutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseMutateFunction } from './_tsup-dts-rollup.js'; | ||
| export { UseMutateAsyncFunction } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseMutationResult } from './_tsup-dts-rollup.js'; | ||
| export { UseMutationResult } from './_tsup-dts-rollup.js'; |
| // src/index.ts | ||
| export * from "@tanstack/query-core"; | ||
| export * from "./types.js"; | ||
| import { useQueries } from "./useQueries.js"; | ||
| import { useQuery } from "./useQuery.js"; | ||
| import { useSuspenseQuery } from "./useSuspenseQuery.js"; | ||
| import { useSuspenseInfiniteQuery } from "./useSuspenseInfiniteQuery.js"; | ||
| import { useSuspenseQueries } from "./useSuspenseQueries.js"; | ||
| import { usePrefetchQuery } from "./usePrefetchQuery.js"; | ||
| import { usePrefetchInfiniteQuery } from "./usePrefetchInfiniteQuery.js"; | ||
| import { queryOptions } from "./queryOptions.js"; | ||
| import { infiniteQueryOptions } from "./infiniteQueryOptions.js"; | ||
| import { | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| useQueryClient | ||
| } from "./QueryClientProvider.js"; | ||
| import { HydrationBoundary } from "./HydrationBoundary.js"; | ||
| import { | ||
| QueryErrorResetBoundary, | ||
| useQueryErrorResetBoundary | ||
| } from "./QueryErrorResetBoundary.js"; | ||
| import { useIsFetching } from "./useIsFetching.js"; | ||
| import { useIsMutating, useMutationState } from "./useMutationState.js"; | ||
| import { useMutation } from "./useMutation.js"; | ||
| import { mutationOptions } from "./mutationOptions.js"; | ||
| import { useInfiniteQuery } from "./useInfiniteQuery.js"; | ||
| import { useIsRestoring, IsRestoringProvider } from "./IsRestoringProvider.js"; | ||
| export { | ||
| HydrationBoundary, | ||
| IsRestoringProvider, | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| QueryErrorResetBoundary, | ||
| infiniteQueryOptions, | ||
| mutationOptions, | ||
| queryOptions, | ||
| useInfiniteQuery, | ||
| useIsFetching, | ||
| useIsMutating, | ||
| useIsRestoring, | ||
| useMutation, | ||
| useMutationState, | ||
| usePrefetchInfiniteQuery, | ||
| usePrefetchQuery, | ||
| useQueries, | ||
| useQuery, | ||
| useQueryClient, | ||
| useQueryErrorResetBoundary, | ||
| useSuspenseInfiniteQuery, | ||
| useSuspenseQueries, | ||
| useSuspenseQuery | ||
| }; | ||
| //# sourceMappingURL=index.js.map |
| {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* istanbul ignore file */\n\n// Re-export core\nexport * from '@tanstack/query-core'\n\n// React Query\nexport * from './types'\nexport { useQueries } from './useQueries'\nexport type { QueriesResults, QueriesOptions } from './useQueries'\nexport { useQuery } from './useQuery'\nexport { useSuspenseQuery } from './useSuspenseQuery'\nexport { useSuspenseInfiniteQuery } from './useSuspenseInfiniteQuery'\nexport { useSuspenseQueries } from './useSuspenseQueries'\nexport type {\n SuspenseQueriesResults,\n SuspenseQueriesOptions,\n} from './useSuspenseQueries'\nexport { usePrefetchQuery } from './usePrefetchQuery'\nexport { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery'\nexport { queryOptions } from './queryOptions'\nexport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n UnusedSkipTokenOptions,\n} from './queryOptions'\nexport { infiniteQueryOptions } from './infiniteQueryOptions'\nexport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n UnusedSkipTokenInfiniteOptions,\n} from './infiniteQueryOptions'\nexport {\n QueryClientContext,\n QueryClientProvider,\n useQueryClient,\n} from './QueryClientProvider'\nexport type { QueryClientProviderProps } from './QueryClientProvider'\nexport type { QueryErrorResetBoundaryProps } from './QueryErrorResetBoundary'\nexport { HydrationBoundary } from './HydrationBoundary'\nexport type { HydrationBoundaryProps } from './HydrationBoundary'\nexport type {\n QueryErrorClearResetFunction,\n QueryErrorIsResetFunction,\n QueryErrorResetBoundaryFunction,\n QueryErrorResetFunction,\n} from './QueryErrorResetBoundary'\nexport {\n QueryErrorResetBoundary,\n useQueryErrorResetBoundary,\n} from './QueryErrorResetBoundary'\nexport { useIsFetching } from './useIsFetching'\nexport { useIsMutating, useMutationState } from './useMutationState'\nexport { useMutation } from './useMutation'\nexport { mutationOptions } from './mutationOptions'\nexport { useInfiniteQuery } from './useInfiniteQuery'\nexport { useIsRestoring, IsRestoringProvider } from './IsRestoringProvider'\n"],"mappings":";AAGA,cAAc;AAGd,cAAc;AACd,SAAS,kBAAkB;AAE3B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AAKnC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAM7B,SAAS,4BAA4B;AAMrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,yBAAyB;AAQlC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAS,eAAe,wBAAwB;AAChD,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,gBAAgB,2BAA2B;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/infiniteQueryOptions.ts | ||
| var infiniteQueryOptions_exports = {}; | ||
| __export(infiniteQueryOptions_exports, { | ||
| infiniteQueryOptions: () => infiniteQueryOptions | ||
| }); | ||
| module.exports = __toCommonJS(infiniteQueryOptions_exports); | ||
| function infiniteQueryOptions(options) { | ||
| return options; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| infiniteQueryOptions | ||
| }); | ||
| //# sourceMappingURL=infiniteQueryOptions.cjs.map |
| {"version":3,"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData?:\n | undefined\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData:\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkJO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;","names":[]} |
| export { infiniteQueryOptions_alias_1 as infiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UndefinedInitialDataInfiniteOptions_alias_1 as UndefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UnusedSkipTokenInfiniteOptions_alias_1 as UnusedSkipTokenInfiniteOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInitialDataInfiniteOptions_alias_1 as DefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.cjs'; |
| export { infiniteQueryOptions_alias_1 as infiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UndefinedInitialDataInfiniteOptions_alias_1 as UndefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { UnusedSkipTokenInfiniteOptions_alias_1 as UnusedSkipTokenInfiniteOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInitialDataInfiniteOptions_alias_1 as DefinedInitialDataInfiniteOptions } from './_tsup-dts-rollup.js'; |
| // src/infiniteQueryOptions.ts | ||
| function infiniteQueryOptions(options) { | ||
| return options; | ||
| } | ||
| export { | ||
| infiniteQueryOptions | ||
| }; | ||
| //# sourceMappingURL=infiniteQueryOptions.js.map |
| {"version":3,"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData?:\n | undefined\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData:\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAkJO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/IsRestoringProvider.ts | ||
| var IsRestoringProvider_exports = {}; | ||
| __export(IsRestoringProvider_exports, { | ||
| IsRestoringProvider: () => IsRestoringProvider, | ||
| useIsRestoring: () => useIsRestoring | ||
| }); | ||
| module.exports = __toCommonJS(IsRestoringProvider_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var IsRestoringContext = React.createContext(false); | ||
| var useIsRestoring = () => React.useContext(IsRestoringContext); | ||
| var IsRestoringProvider = IsRestoringContext.Provider; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| IsRestoringProvider, | ||
| useIsRestoring | ||
| }); | ||
| //# sourceMappingURL=IsRestoringProvider.cjs.map |
| {"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,IAAM,qBAA2B,oBAAc,KAAK;AAE7C,IAAM,iBAAiB,MAAY,iBAAW,kBAAkB;AAChE,IAAM,sBAAsB,mBAAmB;","names":[]} |
| export { useIsRestoring } from './_tsup-dts-rollup.cjs'; | ||
| export { IsRestoringProvider } from './_tsup-dts-rollup.cjs'; |
| export { useIsRestoring } from './_tsup-dts-rollup.js'; | ||
| export { IsRestoringProvider } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/IsRestoringProvider.ts | ||
| import * as React from "react"; | ||
| var IsRestoringContext = React.createContext(false); | ||
| var useIsRestoring = () => React.useContext(IsRestoringContext); | ||
| var IsRestoringProvider = IsRestoringContext.Provider; | ||
| export { | ||
| IsRestoringProvider, | ||
| useIsRestoring | ||
| }; | ||
| //# sourceMappingURL=IsRestoringProvider.js.map |
| {"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,IAAM,qBAA2B,oBAAc,KAAK;AAE7C,IAAM,iBAAiB,MAAY,iBAAW,kBAAkB;AAChE,IAAM,sBAAsB,mBAAmB;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/mutationOptions.ts | ||
| var mutationOptions_exports = {}; | ||
| __export(mutationOptions_exports, { | ||
| mutationOptions: () => mutationOptions | ||
| }); | ||
| module.exports = __toCommonJS(mutationOptions_exports); | ||
| function mutationOptions(options) { | ||
| return options; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| mutationOptions | ||
| }); | ||
| //# sourceMappingURL=mutationOptions.cjs.map |
| {"version":3,"sources":["../../src/mutationOptions.ts"],"sourcesContent":["import type { DefaultError, WithRequired } from '@tanstack/query-core'\nimport type { UseMutationOptions } from './types'\n\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n): UseMutationOptions<TData, TError, TVariables, TOnMutateResult> {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BO,SAAS,gBAMd,SACgE;AAChE,SAAO;AACT;","names":[]} |
| export { mutationOptions_alias_1 as mutationOptions } from './_tsup-dts-rollup.cjs'; |
| export { mutationOptions_alias_1 as mutationOptions } from './_tsup-dts-rollup.js'; |
| // src/mutationOptions.ts | ||
| function mutationOptions(options) { | ||
| return options; | ||
| } | ||
| export { | ||
| mutationOptions | ||
| }; | ||
| //# sourceMappingURL=mutationOptions.js.map |
| {"version":3,"sources":["../../src/mutationOptions.ts"],"sourcesContent":["import type { DefaultError, WithRequired } from '@tanstack/query-core'\nimport type { UseMutationOptions } from './types'\n\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): WithRequired<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n >,\n): Omit<\n UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n 'mutationKey'\n>\nexport function mutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n): UseMutationOptions<TData, TError, TVariables, TOnMutateResult> {\n return options\n}\n"],"mappings":";AA+BO,SAAS,gBAMd,SACgE;AAChE,SAAO;AACT;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/QueryClientProvider.tsx | ||
| var QueryClientProvider_exports = {}; | ||
| __export(QueryClientProvider_exports, { | ||
| QueryClientContext: () => QueryClientContext, | ||
| QueryClientProvider: () => QueryClientProvider, | ||
| useQueryClient: () => useQueryClient | ||
| }); | ||
| module.exports = __toCommonJS(QueryClientProvider_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_jsx_runtime = require("react/jsx-runtime"); | ||
| var QueryClientContext = React.createContext( | ||
| void 0 | ||
| ); | ||
| var useQueryClient = (queryClient) => { | ||
| const client = React.useContext(QueryClientContext); | ||
| if (queryClient) { | ||
| return queryClient; | ||
| } | ||
| if (!client) { | ||
| throw new Error("No QueryClient set, use QueryClientProvider to set one"); | ||
| } | ||
| return client; | ||
| }; | ||
| var QueryClientProvider = ({ | ||
| client, | ||
| children | ||
| }) => { | ||
| React.useEffect(() => { | ||
| client.mount(); | ||
| return () => { | ||
| client.unmount(); | ||
| }; | ||
| }, [client]); | ||
| return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryClientContext.Provider, { value: client, children }); | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| useQueryClient | ||
| }); | ||
| //# sourceMappingURL=QueryClientProvider.cjs.map |
| {"version":3,"sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): React.JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAuCnB;AAnCG,IAAM,qBAA2B;AAAA,EACtC;AACF;AAEO,IAAM,iBAAiB,CAAC,gBAA8B;AAC3D,QAAM,SAAe,iBAAW,kBAAkB;AAElD,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,SAAO;AACT;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAmD;AACjD,EAAM,gBAAU,MAAM;AACpB,WAAO,MAAM;AACb,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,QACjC,UACH;AAEJ;","names":[]} |
| export { QueryClientContext } from './_tsup-dts-rollup.cjs'; | ||
| export { useQueryClient } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientProviderProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryClientProvider } from './_tsup-dts-rollup.cjs'; |
| export { QueryClientContext } from './_tsup-dts-rollup.js'; | ||
| export { useQueryClient } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientProviderProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryClientProvider } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/QueryClientProvider.tsx | ||
| import * as React from "react"; | ||
| import { jsx } from "react/jsx-runtime"; | ||
| var QueryClientContext = React.createContext( | ||
| void 0 | ||
| ); | ||
| var useQueryClient = (queryClient) => { | ||
| const client = React.useContext(QueryClientContext); | ||
| if (queryClient) { | ||
| return queryClient; | ||
| } | ||
| if (!client) { | ||
| throw new Error("No QueryClient set, use QueryClientProvider to set one"); | ||
| } | ||
| return client; | ||
| }; | ||
| var QueryClientProvider = ({ | ||
| client, | ||
| children | ||
| }) => { | ||
| React.useEffect(() => { | ||
| client.mount(); | ||
| return () => { | ||
| client.unmount(); | ||
| }; | ||
| }, [client]); | ||
| return /* @__PURE__ */ jsx(QueryClientContext.Provider, { value: client, children }); | ||
| }; | ||
| export { | ||
| QueryClientContext, | ||
| QueryClientProvider, | ||
| useQueryClient | ||
| }; | ||
| //# sourceMappingURL=QueryClientProvider.js.map |
| {"version":3,"sources":["../../src/QueryClientProvider.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport type { QueryClient } from '@tanstack/query-core'\n\nexport const QueryClientContext = React.createContext<QueryClient | undefined>(\n undefined,\n)\n\nexport const useQueryClient = (queryClient?: QueryClient) => {\n const client = React.useContext(QueryClientContext)\n\n if (queryClient) {\n return queryClient\n }\n\n if (!client) {\n throw new Error('No QueryClient set, use QueryClientProvider to set one')\n }\n\n return client\n}\n\nexport type QueryClientProviderProps = {\n client: QueryClient\n children?: React.ReactNode\n}\n\nexport const QueryClientProvider = ({\n client,\n children,\n}: QueryClientProviderProps): React.JSX.Element => {\n React.useEffect(() => {\n client.mount()\n return () => {\n client.unmount()\n }\n }, [client])\n\n return (\n <QueryClientContext.Provider value={client}>\n {children}\n </QueryClientContext.Provider>\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAuCnB;AAnCG,IAAM,qBAA2B;AAAA,EACtC;AACF;AAEO,IAAM,iBAAiB,CAAC,gBAA8B;AAC3D,QAAM,SAAe,iBAAW,kBAAkB;AAElD,MAAI,aAAa;AACf,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AAEA,SAAO;AACT;AAOO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AACF,MAAmD;AACjD,EAAM,gBAAU,MAAM;AACpB,WAAO,MAAM;AACb,WAAO,MAAM;AACX,aAAO,QAAQ;AAAA,IACjB;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,QACjC,UACH;AAEJ;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/QueryErrorResetBoundary.tsx | ||
| var QueryErrorResetBoundary_exports = {}; | ||
| __export(QueryErrorResetBoundary_exports, { | ||
| QueryErrorResetBoundary: () => QueryErrorResetBoundary, | ||
| useQueryErrorResetBoundary: () => useQueryErrorResetBoundary | ||
| }); | ||
| module.exports = __toCommonJS(QueryErrorResetBoundary_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_jsx_runtime = require("react/jsx-runtime"); | ||
| function createValue() { | ||
| let isReset = false; | ||
| return { | ||
| clearReset: () => { | ||
| isReset = false; | ||
| }, | ||
| reset: () => { | ||
| isReset = true; | ||
| }, | ||
| isReset: () => { | ||
| return isReset; | ||
| } | ||
| }; | ||
| } | ||
| var QueryErrorResetBoundaryContext = React.createContext(createValue()); | ||
| var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext); | ||
| var QueryErrorResetBoundary = ({ | ||
| children | ||
| }) => { | ||
| const [value] = React.useState(() => createValue()); | ||
| return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children }); | ||
| }; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| QueryErrorResetBoundary, | ||
| useQueryErrorResetBoundary | ||
| }); | ||
| //# sourceMappingURL=QueryErrorResetBoundary.cjs.map |
| {"version":3,"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAkDnB;AArCJ,SAAS,cAA4C;AACnD,MAAI,UAAU;AACd,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,gBAAU;AAAA,IACZ;AAAA,IACA,OAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,IACA,SAAS,MAAM;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,iCAAuC,oBAAc,YAAY,CAAC;AAIjE,IAAM,6BAA6B,MAClC,iBAAW,8BAA8B;AAY1C,IAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,CAAC,KAAK,IAAU,eAAS,MAAM,YAAY,CAAC;AAClD,SACE,4CAAC,+BAA+B,UAA/B,EAAwC,OACtC,iBAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACtD;AAEJ;","names":[]} |
| export { QueryErrorResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorIsResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorClearResetFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryValue } from './_tsup-dts-rollup.cjs'; | ||
| export { useQueryErrorResetBoundary } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.cjs'; | ||
| export { QueryErrorResetBoundary } from './_tsup-dts-rollup.cjs'; |
| export { QueryErrorResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorIsResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorClearResetFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryValue } from './_tsup-dts-rollup.js'; | ||
| export { useQueryErrorResetBoundary } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryFunction } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundaryProps } from './_tsup-dts-rollup.js'; | ||
| export { QueryErrorResetBoundary } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/QueryErrorResetBoundary.tsx | ||
| import * as React from "react"; | ||
| import { jsx } from "react/jsx-runtime"; | ||
| function createValue() { | ||
| let isReset = false; | ||
| return { | ||
| clearReset: () => { | ||
| isReset = false; | ||
| }, | ||
| reset: () => { | ||
| isReset = true; | ||
| }, | ||
| isReset: () => { | ||
| return isReset; | ||
| } | ||
| }; | ||
| } | ||
| var QueryErrorResetBoundaryContext = React.createContext(createValue()); | ||
| var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext); | ||
| var QueryErrorResetBoundary = ({ | ||
| children | ||
| }) => { | ||
| const [value] = React.useState(() => createValue()); | ||
| return /* @__PURE__ */ jsx(QueryErrorResetBoundaryContext.Provider, { value, children: typeof children === "function" ? children(value) : children }); | ||
| }; | ||
| export { | ||
| QueryErrorResetBoundary, | ||
| useQueryErrorResetBoundary | ||
| }; | ||
| //# sourceMappingURL=QueryErrorResetBoundary.js.map |
| {"version":3,"sources":["../../src/QueryErrorResetBoundary.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\n// CONTEXT\nexport type QueryErrorResetFunction = () => void\nexport type QueryErrorIsResetFunction = () => boolean\nexport type QueryErrorClearResetFunction = () => void\n\nexport interface QueryErrorResetBoundaryValue {\n clearReset: QueryErrorClearResetFunction\n isReset: QueryErrorIsResetFunction\n reset: QueryErrorResetFunction\n}\n\nfunction createValue(): QueryErrorResetBoundaryValue {\n let isReset = false\n return {\n clearReset: () => {\n isReset = false\n },\n reset: () => {\n isReset = true\n },\n isReset: () => {\n return isReset\n },\n }\n}\n\nconst QueryErrorResetBoundaryContext = React.createContext(createValue())\n\n// HOOK\n\nexport const useQueryErrorResetBoundary = () =>\n React.useContext(QueryErrorResetBoundaryContext)\n\n// COMPONENT\n\nexport type QueryErrorResetBoundaryFunction = (\n value: QueryErrorResetBoundaryValue,\n) => React.ReactNode\n\nexport interface QueryErrorResetBoundaryProps {\n children: QueryErrorResetBoundaryFunction | React.ReactNode\n}\n\nexport const QueryErrorResetBoundary = ({\n children,\n}: QueryErrorResetBoundaryProps) => {\n const [value] = React.useState(() => createValue())\n return (\n <QueryErrorResetBoundaryContext.Provider value={value}>\n {typeof children === 'function' ? children(value) : children}\n </QueryErrorResetBoundaryContext.Provider>\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAkDnB;AArCJ,SAAS,cAA4C;AACnD,MAAI,UAAU;AACd,SAAO;AAAA,IACL,YAAY,MAAM;AAChB,gBAAU;AAAA,IACZ;AAAA,IACA,OAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,IACA,SAAS,MAAM;AACb,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,IAAM,iCAAuC,oBAAc,YAAY,CAAC;AAIjE,IAAM,6BAA6B,MAClC,iBAAW,8BAA8B;AAY1C,IAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,CAAC,KAAK,IAAU,eAAS,MAAM,YAAY,CAAC;AAClD,SACE,oBAAC,+BAA+B,UAA/B,EAAwC,OACtC,iBAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACtD;AAEJ;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/queryOptions.ts | ||
| var queryOptions_exports = {}; | ||
| __export(queryOptions_exports, { | ||
| queryOptions: () => queryOptions | ||
| }); | ||
| module.exports = __toCommonJS(queryOptions_exports); | ||
| function queryOptions(options) { | ||
| return options; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| queryOptions | ||
| }); | ||
| //# sourceMappingURL=queryOptions.cjs.map |
| {"version":3,"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoFO,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;","names":[]} |
| export { queryOptions_alias_1 as queryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UndefinedInitialDataOptions_alias_1 as UndefinedInitialDataOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UnusedSkipTokenOptions_alias_1 as UnusedSkipTokenOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedInitialDataOptions_alias_1 as DefinedInitialDataOptions } from './_tsup-dts-rollup.cjs'; |
| export { queryOptions_alias_1 as queryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UndefinedInitialDataOptions_alias_1 as UndefinedInitialDataOptions } from './_tsup-dts-rollup.js'; | ||
| export { UnusedSkipTokenOptions_alias_1 as UnusedSkipTokenOptions } from './_tsup-dts-rollup.js'; | ||
| export { DefinedInitialDataOptions_alias_1 as DefinedInitialDataOptions } from './_tsup-dts-rollup.js'; |
| // src/queryOptions.ts | ||
| function queryOptions(options) { | ||
| return options; | ||
| } | ||
| export { | ||
| queryOptions | ||
| }; | ||
| //# sourceMappingURL=queryOptions.js.map |
| {"version":3,"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAoFO,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/suspense.ts | ||
| var suspense_exports = {}; | ||
| __export(suspense_exports, { | ||
| defaultThrowOnError: () => defaultThrowOnError, | ||
| ensureSuspenseTimers: () => ensureSuspenseTimers, | ||
| fetchOptimistic: () => fetchOptimistic, | ||
| shouldSuspend: () => shouldSuspend, | ||
| willFetch: () => willFetch | ||
| }); | ||
| module.exports = __toCommonJS(suspense_exports); | ||
| var defaultThrowOnError = (_error, query) => query.state.data === void 0; | ||
| var ensureSuspenseTimers = (defaultedOptions) => { | ||
| if (defaultedOptions.suspense) { | ||
| const MIN_SUSPENSE_TIME_MS = 1e3; | ||
| const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS); | ||
| const originalStaleTime = defaultedOptions.staleTime; | ||
| defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime); | ||
| if (typeof defaultedOptions.gcTime === "number") { | ||
| defaultedOptions.gcTime = Math.max( | ||
| defaultedOptions.gcTime, | ||
| MIN_SUSPENSE_TIME_MS | ||
| ); | ||
| } | ||
| } | ||
| }; | ||
| var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring; | ||
| var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending; | ||
| var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => { | ||
| errorResetBoundary.clearReset(); | ||
| }); | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| defaultThrowOnError, | ||
| ensureSuspenseTimers, | ||
| fetchOptimistic, | ||
| shouldSuspend, | ||
| willFetch | ||
| }); | ||
| //# sourceMappingURL=suspense.cjs.map |
| {"version":3,"sources":["../../src/suspense.ts"],"sourcesContent":["import type {\n DefaultError,\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const defaultThrowOnError = <\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n _error: TError,\n query: Query<TQueryFnData, TError, TData, TQueryKey>,\n) => query.state.data === undefined\n\nexport const ensureSuspenseTimers = (\n defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>,\n) => {\n if (defaultedOptions.suspense) {\n // Handle staleTime to ensure minimum 1000ms in Suspense mode\n // This prevents unnecessary refetching when components remount after suspending\n const MIN_SUSPENSE_TIME_MS = 1000\n\n const clamp = (value: number | 'static' | undefined) =>\n value === 'static'\n ? value\n : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS)\n\n const originalStaleTime = defaultedOptions.staleTime\n defaultedOptions.staleTime =\n typeof originalStaleTime === 'function'\n ? (...args) => clamp(originalStaleTime(...args))\n : clamp(originalStaleTime)\n\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(\n defaultedOptions.gcTime,\n MIN_SUSPENSE_TIME_MS,\n )\n }\n }\n}\n\nexport const willFetch = (\n result: QueryObserverResult<any, any>,\n isRestoring: boolean,\n) => result.isLoading && result.isFetching && !isRestoring\n\nexport const shouldSuspend = (\n defaultedOptions:\n | DefaultedQueryObserverOptions<any, any, any, any, any>\n | undefined,\n result: QueryObserverResult<any, any>,\n) => defaultedOptions?.suspense && result.isPending\n\nexport const fetchOptimistic = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n defaultedOptions: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) =>\n observer.fetchOptimistic(defaultedOptions).catch(() => {\n errorResetBoundary.clearReset()\n })\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,IAAM,sBAAsB,CAMjC,QACA,UACG,MAAM,MAAM,SAAS;AAEnB,IAAM,uBAAuB,CAClC,qBACG;AACH,MAAI,iBAAiB,UAAU;AAG7B,UAAM,uBAAuB;AAE7B,UAAM,QAAQ,CAAC,UACb,UAAU,WACN,QACA,KAAK,IAAI,SAAS,sBAAsB,oBAAoB;AAElE,UAAM,oBAAoB,iBAAiB;AAC3C,qBAAiB,YACf,OAAO,sBAAsB,aACzB,IAAI,SAAS,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAC7C,MAAM,iBAAiB;AAE7B,QAAI,OAAO,iBAAiB,WAAW,UAAU;AAC/C,uBAAiB,SAAS,KAAK;AAAA,QAC7B,iBAAiB;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,YAAY,CACvB,QACA,gBACG,OAAO,aAAa,OAAO,cAAc,CAAC;AAExC,IAAM,gBAAgB,CAC3B,kBAGA,WACG,kBAAkB,YAAY,OAAO;AAEnC,IAAM,kBAAkB,CAO7B,kBAOA,UACA,uBAEA,SAAS,gBAAgB,gBAAgB,EAAE,MAAM,MAAM;AACrD,qBAAmB,WAAW;AAChC,CAAC;","names":[]} |
| export { defaultThrowOnError } from './_tsup-dts-rollup.cjs'; | ||
| export { ensureSuspenseTimers } from './_tsup-dts-rollup.cjs'; | ||
| export { willFetch } from './_tsup-dts-rollup.cjs'; | ||
| export { shouldSuspend } from './_tsup-dts-rollup.cjs'; | ||
| export { fetchOptimistic } from './_tsup-dts-rollup.cjs'; |
| export { defaultThrowOnError } from './_tsup-dts-rollup.js'; | ||
| export { ensureSuspenseTimers } from './_tsup-dts-rollup.js'; | ||
| export { willFetch } from './_tsup-dts-rollup.js'; | ||
| export { shouldSuspend } from './_tsup-dts-rollup.js'; | ||
| export { fetchOptimistic } from './_tsup-dts-rollup.js'; |
| // src/suspense.ts | ||
| var defaultThrowOnError = (_error, query) => query.state.data === void 0; | ||
| var ensureSuspenseTimers = (defaultedOptions) => { | ||
| if (defaultedOptions.suspense) { | ||
| const MIN_SUSPENSE_TIME_MS = 1e3; | ||
| const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS); | ||
| const originalStaleTime = defaultedOptions.staleTime; | ||
| defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime); | ||
| if (typeof defaultedOptions.gcTime === "number") { | ||
| defaultedOptions.gcTime = Math.max( | ||
| defaultedOptions.gcTime, | ||
| MIN_SUSPENSE_TIME_MS | ||
| ); | ||
| } | ||
| } | ||
| }; | ||
| var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring; | ||
| var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending; | ||
| var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => { | ||
| errorResetBoundary.clearReset(); | ||
| }); | ||
| export { | ||
| defaultThrowOnError, | ||
| ensureSuspenseTimers, | ||
| fetchOptimistic, | ||
| shouldSuspend, | ||
| willFetch | ||
| }; | ||
| //# sourceMappingURL=suspense.js.map |
| {"version":3,"sources":["../../src/suspense.ts"],"sourcesContent":["import type {\n DefaultError,\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const defaultThrowOnError = <\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n _error: TError,\n query: Query<TQueryFnData, TError, TData, TQueryKey>,\n) => query.state.data === undefined\n\nexport const ensureSuspenseTimers = (\n defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>,\n) => {\n if (defaultedOptions.suspense) {\n // Handle staleTime to ensure minimum 1000ms in Suspense mode\n // This prevents unnecessary refetching when components remount after suspending\n const MIN_SUSPENSE_TIME_MS = 1000\n\n const clamp = (value: number | 'static' | undefined) =>\n value === 'static'\n ? value\n : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS)\n\n const originalStaleTime = defaultedOptions.staleTime\n defaultedOptions.staleTime =\n typeof originalStaleTime === 'function'\n ? (...args) => clamp(originalStaleTime(...args))\n : clamp(originalStaleTime)\n\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(\n defaultedOptions.gcTime,\n MIN_SUSPENSE_TIME_MS,\n )\n }\n }\n}\n\nexport const willFetch = (\n result: QueryObserverResult<any, any>,\n isRestoring: boolean,\n) => result.isLoading && result.isFetching && !isRestoring\n\nexport const shouldSuspend = (\n defaultedOptions:\n | DefaultedQueryObserverOptions<any, any, any, any, any>\n | undefined,\n result: QueryObserverResult<any, any>,\n) => defaultedOptions?.suspense && result.isPending\n\nexport const fetchOptimistic = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n defaultedOptions: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n observer: QueryObserver<TQueryFnData, TError, TData, TQueryData, TQueryKey>,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) =>\n observer.fetchOptimistic(defaultedOptions).catch(() => {\n errorResetBoundary.clearReset()\n })\n"],"mappings":";AAUO,IAAM,sBAAsB,CAMjC,QACA,UACG,MAAM,MAAM,SAAS;AAEnB,IAAM,uBAAuB,CAClC,qBACG;AACH,MAAI,iBAAiB,UAAU;AAG7B,UAAM,uBAAuB;AAE7B,UAAM,QAAQ,CAAC,UACb,UAAU,WACN,QACA,KAAK,IAAI,SAAS,sBAAsB,oBAAoB;AAElE,UAAM,oBAAoB,iBAAiB;AAC3C,qBAAiB,YACf,OAAO,sBAAsB,aACzB,IAAI,SAAS,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAC7C,MAAM,iBAAiB;AAE7B,QAAI,OAAO,iBAAiB,WAAW,UAAU;AAC/C,uBAAiB,SAAS,KAAK;AAAA,QAC7B,iBAAiB;AAAA,QACjB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,YAAY,CACvB,QACA,gBACG,OAAO,aAAa,OAAO,cAAc,CAAC;AAExC,IAAM,gBAAgB,CAC3B,kBAGA,WACG,kBAAkB,YAAY,OAAO;AAEnC,IAAM,kBAAkB,CAO7B,kBAOA,UACA,uBAEA,SAAS,gBAAgB,gBAAgB,EAAE,MAAM,MAAM;AACrD,qBAAmB,WAAW;AAChC,CAAC;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/types.ts | ||
| var types_exports = {}; | ||
| module.exports = __toCommonJS(types_exports); | ||
| //# sourceMappingURL=types.cjs.map |
| {"version":3,"sources":["../../src/types.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport type {\n DefaultError,\n DefinedInfiniteQueryObserverResult,\n DefinedQueryObserverResult,\n DistributiveOmit,\n FetchQueryOptions,\n InfiniteQueryObserverOptions,\n InfiniteQueryObserverResult,\n MutateFunction,\n MutationObserverOptions,\n MutationObserverResult,\n OmitKeyof,\n Override,\n QueryKey,\n QueryObserverOptions,\n QueryObserverResult,\n SkipToken,\n} from '@tanstack/query-core'\n\nexport type AnyUseBaseQueryOptions = UseBaseQueryOptions<\n any,\n any,\n any,\n any,\n any\n>\nexport interface UseBaseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n> {\n /**\n * Set this to `false` to unsubscribe this observer from updates to the query cache.\n * Defaults to `true`.\n */\n subscribed?: boolean\n}\n\nexport interface UsePrefetchQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> {\n queryFn?: Exclude<\n FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken\n >\n}\n\nexport type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>\nexport interface UseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>,\n 'suspense'\n> {}\n\nexport type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<\n any,\n any,\n any,\n any\n>\nexport interface UseSuspenseQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n> {\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken\n >\n}\n\nexport type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<\n any,\n any,\n any,\n any,\n any\n>\nexport interface UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'suspense'\n> {\n /**\n * Set this to `false` to unsubscribe this observer from updates to the query cache.\n * Defaults to `true`.\n */\n subscribed?: boolean\n}\n\nexport type AnyUseSuspenseInfiniteQueryOptions =\n UseSuspenseInfiniteQueryOptions<any, any, any, any, any>\nexport interface UseSuspenseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n> {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken\n >\n}\n\nexport type UseBaseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = QueryObserverResult<TData, TError>\n\nexport type UseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = UseBaseQueryResult<TData, TError>\n\nexport type UseSuspenseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DistributiveOmit<\n DefinedQueryObserverResult<TData, TError>,\n 'isPlaceholderData' | 'promise'\n>\n\nexport type DefinedUseQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DefinedQueryObserverResult<TData, TError>\n\nexport type UseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = InfiniteQueryObserverResult<TData, TError>\n\nexport type DefinedUseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = DefinedInfiniteQueryObserverResult<TData, TError>\n\nexport type UseSuspenseInfiniteQueryResult<\n TData = unknown,\n TError = DefaultError,\n> = OmitKeyof<\n DefinedInfiniteQueryObserverResult<TData, TError>,\n 'isPlaceholderData' | 'promise'\n>\n\nexport type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>\nexport interface UseMutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>,\n '_defaulted'\n> {}\n\nexport type UseMutateFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = (\n ...args: Parameters<\n MutateFunction<TData, TError, TVariables, TOnMutateResult>\n >\n) => void\n\nexport type UseMutateAsyncFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> = MutateFunction<TData, TError, TVariables, TOnMutateResult>\n\nexport type UseBaseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> = Override<\n MutationObserverResult<TData, TError, TVariables, TOnMutateResult>,\n { mutate: UseMutateFunction<TData, TError, TVariables, TOnMutateResult> }\n> & {\n mutateAsync: UseMutateAsyncFunction<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >\n}\n\nexport type UseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TOnMutateResult = unknown,\n> = UseBaseMutationResult<TData, TError, TVariables, TOnMutateResult>\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]} |
| export { AnyUseBaseQueryOptions_alias_1 as AnyUseBaseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseQueryOptions_alias_1 as UseBaseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UsePrefetchQueryOptions_alias_1 as UsePrefetchQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseQueryOptions_alias_1 as AnyUseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseQueryOptions_alias_1 as UseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseSuspenseQueryOptions_alias_1 as AnyUseSuspenseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseQueryOptions_alias_1 as UseSuspenseQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseInfiniteQueryOptions_alias_1 as AnyUseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseInfiniteQueryOptions_alias_1 as UseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseSuspenseInfiniteQueryOptions_alias_1 as AnyUseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseInfiniteQueryOptions_alias_1 as UseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseQueryResult_alias_1 as UseBaseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseQueryResult_alias_1 as UseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseQueryResult_alias_1 as UseSuspenseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedUseQueryResult_alias_1 as DefinedUseQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseInfiniteQueryResult_alias_1 as UseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { DefinedUseInfiniteQueryResult_alias_1 as DefinedUseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseSuspenseInfiniteQueryResult_alias_1 as UseSuspenseInfiniteQueryResult } from './_tsup-dts-rollup.cjs'; | ||
| export { AnyUseMutationOptions_alias_1 as AnyUseMutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutationOptions_alias_1 as UseMutationOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutateFunction_alias_1 as UseMutateFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutateAsyncFunction_alias_1 as UseMutateAsyncFunction } from './_tsup-dts-rollup.cjs'; | ||
| export { UseBaseMutationResult_alias_1 as UseBaseMutationResult } from './_tsup-dts-rollup.cjs'; | ||
| export { UseMutationResult_alias_1 as UseMutationResult } from './_tsup-dts-rollup.cjs'; |
| export { AnyUseBaseQueryOptions_alias_1 as AnyUseBaseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseQueryOptions_alias_1 as UseBaseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UsePrefetchQueryOptions_alias_1 as UsePrefetchQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseQueryOptions_alias_1 as AnyUseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseQueryOptions_alias_1 as UseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseSuspenseQueryOptions_alias_1 as AnyUseSuspenseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseQueryOptions_alias_1 as UseSuspenseQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseInfiniteQueryOptions_alias_1 as AnyUseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseInfiniteQueryOptions_alias_1 as UseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseSuspenseInfiniteQueryOptions_alias_1 as AnyUseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseInfiniteQueryOptions_alias_1 as UseSuspenseInfiniteQueryOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseQueryResult_alias_1 as UseBaseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseQueryResult_alias_1 as UseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseQueryResult_alias_1 as UseSuspenseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedUseQueryResult_alias_1 as DefinedUseQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseInfiniteQueryResult_alias_1 as UseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { DefinedUseInfiniteQueryResult_alias_1 as DefinedUseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { UseSuspenseInfiniteQueryResult_alias_1 as UseSuspenseInfiniteQueryResult } from './_tsup-dts-rollup.js'; | ||
| export { AnyUseMutationOptions_alias_1 as AnyUseMutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseMutationOptions_alias_1 as UseMutationOptions } from './_tsup-dts-rollup.js'; | ||
| export { UseMutateFunction_alias_1 as UseMutateFunction } from './_tsup-dts-rollup.js'; | ||
| export { UseMutateAsyncFunction_alias_1 as UseMutateAsyncFunction } from './_tsup-dts-rollup.js'; | ||
| export { UseBaseMutationResult_alias_1 as UseBaseMutationResult } from './_tsup-dts-rollup.js'; | ||
| export { UseMutationResult_alias_1 as UseMutationResult } from './_tsup-dts-rollup.js'; |
| //# sourceMappingURL=types.js.map |
| {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useBaseQuery.ts | ||
| var useBaseQuery_exports = {}; | ||
| __export(useBaseQuery_exports, { | ||
| useBaseQuery: () => useBaseQuery | ||
| }); | ||
| module.exports = __toCommonJS(useBaseQuery_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| var import_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs"); | ||
| var import_errorBoundaryUtils = require("./errorBoundaryUtils.cjs"); | ||
| var import_IsRestoringProvider = require("./IsRestoringProvider.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useBaseQuery(options, Observer, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (typeof options !== "object" || Array.isArray(options)) { | ||
| throw new Error( | ||
| 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object' | ||
| ); | ||
| } | ||
| } | ||
| const isRestoring = (0, import_IsRestoringProvider.useIsRestoring)(); | ||
| const errorResetBoundary = (0, import_QueryErrorResetBoundary.useQueryErrorResetBoundary)(); | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const defaultedOptions = client.defaultQueryOptions(options); | ||
| client.getDefaultOptions().queries?._experimental_beforeQuery?.( | ||
| defaultedOptions | ||
| ); | ||
| const query = client.getQueryCache().get(defaultedOptions.queryHash); | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (!defaultedOptions.queryFn) { | ||
| console.error( | ||
| `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function` | ||
| ); | ||
| } | ||
| } | ||
| defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
| (0, import_suspense.ensureSuspenseTimers)(defaultedOptions); | ||
| (0, import_errorBoundaryUtils.ensurePreventErrorBoundaryRetry)(defaultedOptions, errorResetBoundary, query); | ||
| (0, import_errorBoundaryUtils.useClearResetErrorBoundary)(errorResetBoundary); | ||
| const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash); | ||
| const [observer] = React.useState( | ||
| () => new Observer( | ||
| client, | ||
| defaultedOptions | ||
| ) | ||
| ); | ||
| const result = observer.getOptimisticResult(defaultedOptions); | ||
| const shouldSubscribe = !isRestoring && options.subscribed !== false; | ||
| React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => { | ||
| const unsubscribe = shouldSubscribe ? observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)) : import_query_core.noop; | ||
| observer.updateResult(); | ||
| return unsubscribe; | ||
| }, | ||
| [observer, shouldSubscribe] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setOptions(defaultedOptions); | ||
| }, [defaultedOptions, observer]); | ||
| if ((0, import_suspense.shouldSuspend)(defaultedOptions, result)) { | ||
| throw (0, import_suspense.fetchOptimistic)(defaultedOptions, observer, errorResetBoundary); | ||
| } | ||
| if ((0, import_errorBoundaryUtils.getHasError)({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError: defaultedOptions.throwOnError, | ||
| query, | ||
| suspense: defaultedOptions.suspense | ||
| })) { | ||
| throw result.error; | ||
| } | ||
| ; | ||
| client.getDefaultOptions().queries?._experimental_afterQuery?.( | ||
| defaultedOptions, | ||
| result | ||
| ); | ||
| if (defaultedOptions.experimental_prefetchInRender && !import_query_core.environmentManager.isServer() && (0, import_suspense.willFetch)(result, isRestoring)) { | ||
| const promise = isNewCacheEntry ? ( | ||
| // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted | ||
| (0, import_suspense.fetchOptimistic)(defaultedOptions, observer, errorResetBoundary) | ||
| ) : ( | ||
| // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in | ||
| query?.promise | ||
| ); | ||
| promise?.catch(import_query_core.noop).finally(() => { | ||
| observer.updateResult(); | ||
| }); | ||
| } | ||
| return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useBaseQuery | ||
| }); | ||
| //# sourceMappingURL=useBaseQuery.cjs.map |
| {"version":3,"sources":["../../src/useBaseQuery.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { environmentManager, noop, notifyManager } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport { useIsRestoring } from './IsRestoringProvider'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n willFetch,\n} from './suspense'\nimport type {\n QueryClient,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { UseBaseQueryOptions } from './types'\n\nexport function useBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: UseBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n queryClient?: QueryClient,\n): QueryObserverResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof options !== 'object' || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object',\n )\n }\n }\n\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n const client = useQueryClient(queryClient)\n const defaultedOptions = client.defaultQueryOptions(options)\n ;(client.getDefaultOptions().queries as any)?._experimental_beforeQuery?.(\n defaultedOptions,\n )\n\n const query = client\n .getQueryCache()\n .get<\n TQueryFnData,\n TError,\n TQueryData,\n TQueryKey\n >(defaultedOptions.queryHash)\n\n if (process.env.NODE_ENV !== 'production') {\n if (!defaultedOptions.queryFn) {\n console.error(\n `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`,\n )\n }\n }\n\n // Make sure results are optimistically set in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n ensureSuspenseTimers(defaultedOptions)\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query)\n useClearResetErrorBoundary(errorResetBoundary)\n\n // this needs to be invoked before creating the Observer because that can create a cache entry\n const isNewCacheEntry = !client\n .getQueryCache()\n .get(defaultedOptions.queryHash)\n\n const [observer] = React.useState(\n () =>\n new Observer<TQueryFnData, TError, TData, TQueryData, TQueryKey>(\n client,\n defaultedOptions,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const result = observer.getOptimisticResult(defaultedOptions)\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop\n\n // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n observer.updateResult()\n\n return unsubscribe\n },\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n observer.setOptions(defaultedOptions)\n }, [defaultedOptions, observer])\n\n // Handle suspense\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n }\n\n // Handle error boundary\n if (\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query,\n suspense: defaultedOptions.suspense,\n })\n ) {\n throw result.error\n }\n\n ;(client.getDefaultOptions().queries as any)?._experimental_afterQuery?.(\n defaultedOptions,\n result,\n )\n\n if (\n defaultedOptions.experimental_prefetchInRender &&\n !environmentManager.isServer() &&\n willFetch(result, isRestoring)\n ) {\n const promise = isNewCacheEntry\n ? // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted\n fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n : // subscribe to the \"cache promise\" so that we can finalize the currentThenable once data comes in\n query?.promise\n\n promise?.catch(noop).finally(() => {\n // `.updateResult()` will trigger `.#currentThenable` to finalize\n observer.updateResult()\n })\n }\n\n // Handle result property usage tracking\n return !defaultedOptions.notifyOnChangeProps\n ? observer.trackResult(result)\n : result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAAwD;AACxD,iCAA+B;AAC/B,qCAA2C;AAC3C,gCAIO;AACP,iCAA+B;AAC/B,sBAKO;AASA,SAAS,aAOd,SAOA,UACA,aACoC;AACpC,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;AACzD,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,kBAAc,2CAAe;AACnC,QAAM,yBAAqB,2DAA2B;AACtD,QAAM,aAAS,2CAAe,WAAW;AACzC,QAAM,mBAAmB,OAAO,oBAAoB,OAAO;AAC1D,EAAC,OAAO,kBAAkB,EAAE,SAAiB;AAAA,IAC5C;AAAA,EACF;AAEA,QAAM,QAAQ,OACX,cAAc,EACd,IAKC,iBAAiB,SAAS;AAE9B,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,iBAAiB,SAAS;AAC7B,cAAQ;AAAA,QACN,IAAI,iBAAiB,SAAS;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAGA,mBAAiB,qBAAqB,cAClC,gBACA;AAEJ,4CAAqB,gBAAgB;AACrC,iEAAgC,kBAAkB,oBAAoB,KAAK;AAC3E,4DAA2B,kBAAkB;AAG7C,QAAM,kBAAkB,CAAC,OACtB,cAAc,EACd,IAAI,iBAAiB,SAAS;AAEjC,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAGA,QAAM,SAAS,SAAS,oBAAoB,gBAAgB;AAE5D,QAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;AAC/D,EAAM;AAAA,IACE;AAAA,MACJ,CAAC,kBAAkB;AACjB,cAAM,cAAc,kBAChB,SAAS,UAAU,gCAAc,WAAW,aAAa,CAAC,IAC1D;AAIJ,iBAAS,aAAa;AAEtB,eAAO;AAAA,MACT;AAAA,MACA,CAAC,UAAU,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,gBAAgB;AAAA,EACtC,GAAG,CAAC,kBAAkB,QAAQ,CAAC;AAG/B,UAAI,+BAAc,kBAAkB,MAAM,GAAG;AAC3C,cAAM,iCAAgB,kBAAkB,UAAU,kBAAkB;AAAA,EACtE;AAGA,UACE,uCAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA,cAAc,iBAAiB;AAAA,IAC/B;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC,GACD;AACA,UAAM,OAAO;AAAA,EACf;AAEA;AAAC,EAAC,OAAO,kBAAkB,EAAE,SAAiB;AAAA,IAC5C;AAAA,IACA;AAAA,EACF;AAEA,MACE,iBAAiB,iCACjB,CAAC,qCAAmB,SAAS,SAC7B,2BAAU,QAAQ,WAAW,GAC7B;AACA,UAAM,UAAU;AAAA;AAAA,UAEZ,iCAAgB,kBAAkB,UAAU,kBAAkB;AAAA;AAAA;AAAA,MAE9D,OAAO;AAAA;AAEX,aAAS,MAAM,sBAAI,EAAE,QAAQ,MAAM;AAEjC,eAAS,aAAa;AAAA,IACxB,CAAC;AAAA,EACH;AAGA,SAAO,CAAC,iBAAiB,sBACrB,SAAS,YAAY,MAAM,IAC3B;AACN;","names":[]} |
| export { useBaseQuery } from './_tsup-dts-rollup.cjs'; |
| export { useBaseQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useBaseQuery.ts | ||
| import * as React from "react"; | ||
| import { environmentManager, noop, notifyManager } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| import { useQueryErrorResetBoundary } from "./QueryErrorResetBoundary.js"; | ||
| import { | ||
| ensurePreventErrorBoundaryRetry, | ||
| getHasError, | ||
| useClearResetErrorBoundary | ||
| } from "./errorBoundaryUtils.js"; | ||
| import { useIsRestoring } from "./IsRestoringProvider.js"; | ||
| import { | ||
| ensureSuspenseTimers, | ||
| fetchOptimistic, | ||
| shouldSuspend, | ||
| willFetch | ||
| } from "./suspense.js"; | ||
| function useBaseQuery(options, Observer, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (typeof options !== "object" || Array.isArray(options)) { | ||
| throw new Error( | ||
| 'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object' | ||
| ); | ||
| } | ||
| } | ||
| const isRestoring = useIsRestoring(); | ||
| const errorResetBoundary = useQueryErrorResetBoundary(); | ||
| const client = useQueryClient(queryClient); | ||
| const defaultedOptions = client.defaultQueryOptions(options); | ||
| client.getDefaultOptions().queries?._experimental_beforeQuery?.( | ||
| defaultedOptions | ||
| ); | ||
| const query = client.getQueryCache().get(defaultedOptions.queryHash); | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (!defaultedOptions.queryFn) { | ||
| console.error( | ||
| `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function` | ||
| ); | ||
| } | ||
| } | ||
| defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
| ensureSuspenseTimers(defaultedOptions); | ||
| ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query); | ||
| useClearResetErrorBoundary(errorResetBoundary); | ||
| const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash); | ||
| const [observer] = React.useState( | ||
| () => new Observer( | ||
| client, | ||
| defaultedOptions | ||
| ) | ||
| ); | ||
| const result = observer.getOptimisticResult(defaultedOptions); | ||
| const shouldSubscribe = !isRestoring && options.subscribed !== false; | ||
| React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => { | ||
| const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop; | ||
| observer.updateResult(); | ||
| return unsubscribe; | ||
| }, | ||
| [observer, shouldSubscribe] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setOptions(defaultedOptions); | ||
| }, [defaultedOptions, observer]); | ||
| if (shouldSuspend(defaultedOptions, result)) { | ||
| throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary); | ||
| } | ||
| if (getHasError({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError: defaultedOptions.throwOnError, | ||
| query, | ||
| suspense: defaultedOptions.suspense | ||
| })) { | ||
| throw result.error; | ||
| } | ||
| ; | ||
| client.getDefaultOptions().queries?._experimental_afterQuery?.( | ||
| defaultedOptions, | ||
| result | ||
| ); | ||
| if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) { | ||
| const promise = isNewCacheEntry ? ( | ||
| // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted | ||
| fetchOptimistic(defaultedOptions, observer, errorResetBoundary) | ||
| ) : ( | ||
| // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in | ||
| query?.promise | ||
| ); | ||
| promise?.catch(noop).finally(() => { | ||
| observer.updateResult(); | ||
| }); | ||
| } | ||
| return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result; | ||
| } | ||
| export { | ||
| useBaseQuery | ||
| }; | ||
| //# sourceMappingURL=useBaseQuery.js.map |
| {"version":3,"sources":["../../src/useBaseQuery.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { environmentManager, noop, notifyManager } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport { useIsRestoring } from './IsRestoringProvider'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n willFetch,\n} from './suspense'\nimport type {\n QueryClient,\n QueryKey,\n QueryObserver,\n QueryObserverResult,\n} from '@tanstack/query-core'\nimport type { UseBaseQueryOptions } from './types'\n\nexport function useBaseQuery<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: UseBaseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n Observer: typeof QueryObserver,\n queryClient?: QueryClient,\n): QueryObserverResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof options !== 'object' || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object',\n )\n }\n }\n\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n const client = useQueryClient(queryClient)\n const defaultedOptions = client.defaultQueryOptions(options)\n ;(client.getDefaultOptions().queries as any)?._experimental_beforeQuery?.(\n defaultedOptions,\n )\n\n const query = client\n .getQueryCache()\n .get<\n TQueryFnData,\n TError,\n TQueryData,\n TQueryKey\n >(defaultedOptions.queryHash)\n\n if (process.env.NODE_ENV !== 'production') {\n if (!defaultedOptions.queryFn) {\n console.error(\n `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`,\n )\n }\n }\n\n // Make sure results are optimistically set in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n ensureSuspenseTimers(defaultedOptions)\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query)\n useClearResetErrorBoundary(errorResetBoundary)\n\n // this needs to be invoked before creating the Observer because that can create a cache entry\n const isNewCacheEntry = !client\n .getQueryCache()\n .get(defaultedOptions.queryHash)\n\n const [observer] = React.useState(\n () =>\n new Observer<TQueryFnData, TError, TData, TQueryData, TQueryKey>(\n client,\n defaultedOptions,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const result = observer.getOptimisticResult(defaultedOptions)\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop\n\n // Update result to make sure we did not miss any query updates\n // between creating the observer and subscribing to it.\n observer.updateResult()\n\n return unsubscribe\n },\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n observer.setOptions(defaultedOptions)\n }, [defaultedOptions, observer])\n\n // Handle suspense\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n }\n\n // Handle error boundary\n if (\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query,\n suspense: defaultedOptions.suspense,\n })\n ) {\n throw result.error\n }\n\n ;(client.getDefaultOptions().queries as any)?._experimental_afterQuery?.(\n defaultedOptions,\n result,\n )\n\n if (\n defaultedOptions.experimental_prefetchInRender &&\n !environmentManager.isServer() &&\n willFetch(result, isRestoring)\n ) {\n const promise = isNewCacheEntry\n ? // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted\n fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n : // subscribe to the \"cache promise\" so that we can finalize the currentThenable once data comes in\n query?.promise\n\n promise?.catch(noop).finally(() => {\n // `.updateResult()` will trigger `.#currentThenable` to finalize\n observer.updateResult()\n })\n }\n\n // Handle result property usage tracking\n return !defaultedOptions.notifyOnChangeProps\n ? observer.trackResult(result)\n : result\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,SAAS,oBAAoB,MAAM,qBAAqB;AACxD,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASA,SAAS,aAOd,SAOA,UACA,aACoC;AACpC,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;AACzD,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,cAAc,eAAe;AACnC,QAAM,qBAAqB,2BAA2B;AACtD,QAAM,SAAS,eAAe,WAAW;AACzC,QAAM,mBAAmB,OAAO,oBAAoB,OAAO;AAC1D,EAAC,OAAO,kBAAkB,EAAE,SAAiB;AAAA,IAC5C;AAAA,EACF;AAEA,QAAM,QAAQ,OACX,cAAc,EACd,IAKC,iBAAiB,SAAS;AAE9B,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,iBAAiB,SAAS;AAC7B,cAAQ;AAAA,QACN,IAAI,iBAAiB,SAAS;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAGA,mBAAiB,qBAAqB,cAClC,gBACA;AAEJ,uBAAqB,gBAAgB;AACrC,kCAAgC,kBAAkB,oBAAoB,KAAK;AAC3E,6BAA2B,kBAAkB;AAG7C,QAAM,kBAAkB,CAAC,OACtB,cAAc,EACd,IAAI,iBAAiB,SAAS;AAEjC,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAGA,QAAM,SAAS,SAAS,oBAAoB,gBAAgB;AAE5D,QAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;AAC/D,EAAM;AAAA,IACE;AAAA,MACJ,CAAC,kBAAkB;AACjB,cAAM,cAAc,kBAChB,SAAS,UAAU,cAAc,WAAW,aAAa,CAAC,IAC1D;AAIJ,iBAAS,aAAa;AAEtB,eAAO;AAAA,MACT;AAAA,MACA,CAAC,UAAU,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,gBAAgB;AAAA,EACtC,GAAG,CAAC,kBAAkB,QAAQ,CAAC;AAG/B,MAAI,cAAc,kBAAkB,MAAM,GAAG;AAC3C,UAAM,gBAAgB,kBAAkB,UAAU,kBAAkB;AAAA,EACtE;AAGA,MACE,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA,cAAc,iBAAiB;AAAA,IAC/B;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC7B,CAAC,GACD;AACA,UAAM,OAAO;AAAA,EACf;AAEA;AAAC,EAAC,OAAO,kBAAkB,EAAE,SAAiB;AAAA,IAC5C;AAAA,IACA;AAAA,EACF;AAEA,MACE,iBAAiB,iCACjB,CAAC,mBAAmB,SAAS,KAC7B,UAAU,QAAQ,WAAW,GAC7B;AACA,UAAM,UAAU;AAAA;AAAA,MAEZ,gBAAgB,kBAAkB,UAAU,kBAAkB;AAAA;AAAA;AAAA,MAE9D,OAAO;AAAA;AAEX,aAAS,MAAM,IAAI,EAAE,QAAQ,MAAM;AAEjC,eAAS,aAAa;AAAA,IACxB,CAAC;AAAA,EACH;AAGA,SAAO,CAAC,iBAAiB,sBACrB,SAAS,YAAY,MAAM,IAC3B;AACN;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useInfiniteQuery.ts | ||
| var useInfiniteQuery_exports = {}; | ||
| __export(useInfiniteQuery_exports, { | ||
| useInfiniteQuery: () => useInfiniteQuery | ||
| }); | ||
| module.exports = __toCommonJS(useInfiniteQuery_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useBaseQuery = require("./useBaseQuery.cjs"); | ||
| function useInfiniteQuery(options, queryClient) { | ||
| return (0, import_useBaseQuery.useBaseQuery)( | ||
| options, | ||
| import_query_core.InfiniteQueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useInfiniteQuery | ||
| }); | ||
| //# sourceMappingURL=useInfiniteQuery.cjs.map |
| {"version":3,"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseInfiniteQueryResult,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): DefinedUseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AACtC,0BAA6B;AAqEtB,SAAS,iBACd,SACA,aACA;AACA,aAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| export { useInfiniteQuery_alias_1 as useInfiniteQuery } from './_tsup-dts-rollup.cjs'; |
| export { useInfiniteQuery_alias_1 as useInfiniteQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useInfiniteQuery.ts | ||
| import { InfiniteQueryObserver } from "@tanstack/query-core"; | ||
| import { useBaseQuery } from "./useBaseQuery.js"; | ||
| function useInfiniteQuery(options, queryClient) { | ||
| return useBaseQuery( | ||
| options, | ||
| InfiniteQueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| export { | ||
| useInfiniteQuery | ||
| }; | ||
| //# sourceMappingURL=useInfiniteQuery.js.map |
| {"version":3,"sources":["../../src/useInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n InfiniteData,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseInfiniteQueryResult,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infiniteQueryOptions'\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): DefinedUseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;AACA,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAqEtB,SAAS,iBACd,SACA,aACA;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useIsFetching.ts | ||
| var useIsFetching_exports = {}; | ||
| __export(useIsFetching_exports, { | ||
| useIsFetching: () => useIsFetching | ||
| }); | ||
| module.exports = __toCommonJS(useIsFetching_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function useIsFetching(filters, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const queryCache = client.getQueryCache(); | ||
| return React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => queryCache.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)), | ||
| [queryCache] | ||
| ), | ||
| () => client.isFetching(filters), | ||
| () => client.isFetching(filters) | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useIsFetching | ||
| }); | ||
| //# sourceMappingURL=useIsFetching.cjs.map |
| {"version":3,"sources":["../../src/useIsFetching.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { notifyManager } from '@tanstack/query-core'\n\nimport { useQueryClient } from './QueryClientProvider'\nimport type { QueryClient, QueryFilters } from '@tanstack/query-core'\n\nexport function useIsFetching(\n filters?: QueryFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n const queryCache = client.getQueryCache()\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),\n [queryCache],\n ),\n () => client.isFetching(filters),\n () => client.isFetching(filters),\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,wBAA8B;AAE9B,iCAA+B;AAGxB,SAAS,cACd,SACA,aACQ;AACR,QAAM,aAAS,2CAAe,WAAW;AACzC,QAAM,aAAa,OAAO,cAAc;AAExC,SAAa;AAAA,IACL;AAAA,MACJ,CAAC,kBACC,WAAW,UAAU,gCAAc,WAAW,aAAa,CAAC;AAAA,MAC9D,CAAC,UAAU;AAAA,IACb;AAAA,IACA,MAAM,OAAO,WAAW,OAAO;AAAA,IAC/B,MAAM,OAAO,WAAW,OAAO;AAAA,EACjC;AACF;","names":[]} |
| export { useIsFetching_alias_1 as useIsFetching } from './_tsup-dts-rollup.cjs'; |
| export { useIsFetching_alias_1 as useIsFetching } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useIsFetching.ts | ||
| import * as React from "react"; | ||
| import { notifyManager } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function useIsFetching(filters, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| const queryCache = client.getQueryCache(); | ||
| return React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), | ||
| [queryCache] | ||
| ), | ||
| () => client.isFetching(filters), | ||
| () => client.isFetching(filters) | ||
| ); | ||
| } | ||
| export { | ||
| useIsFetching | ||
| }; | ||
| //# sourceMappingURL=useIsFetching.js.map |
| {"version":3,"sources":["../../src/useIsFetching.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { notifyManager } from '@tanstack/query-core'\n\nimport { useQueryClient } from './QueryClientProvider'\nimport type { QueryClient, QueryFilters } from '@tanstack/query-core'\n\nexport function useIsFetching(\n filters?: QueryFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n const queryCache = client.getQueryCache()\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),\n [queryCache],\n ),\n () => client.isFetching(filters),\n () => client.isFetching(filters),\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB,SAAS,qBAAqB;AAE9B,SAAS,sBAAsB;AAGxB,SAAS,cACd,SACA,aACQ;AACR,QAAM,SAAS,eAAe,WAAW;AACzC,QAAM,aAAa,OAAO,cAAc;AAExC,SAAa;AAAA,IACL;AAAA,MACJ,CAAC,kBACC,WAAW,UAAU,cAAc,WAAW,aAAa,CAAC;AAAA,MAC9D,CAAC,UAAU;AAAA,IACb;AAAA,IACA,MAAM,OAAO,WAAW,OAAO;AAAA,IAC/B,MAAM,OAAO,WAAW,OAAO;AAAA,EACjC;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useMutation.ts | ||
| var useMutation_exports = {}; | ||
| __export(useMutation_exports, { | ||
| useMutation: () => useMutation | ||
| }); | ||
| module.exports = __toCommonJS(useMutation_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function useMutation(options, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const [observer] = React.useState( | ||
| () => new import_query_core.MutationObserver( | ||
| client, | ||
| options | ||
| ) | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setOptions(options); | ||
| }, [observer, options]); | ||
| const result = React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)), | ||
| [observer] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| const mutate = React.useCallback( | ||
| (variables, mutateOptions) => { | ||
| observer.mutate(variables, mutateOptions).catch(import_query_core.noop); | ||
| }, | ||
| [observer] | ||
| ); | ||
| if (result.error && (0, import_query_core.shouldThrowError)(observer.options.throwOnError, [result.error])) { | ||
| throw result.error; | ||
| } | ||
| return { ...result, mutate, mutateAsync: result.mutate }; | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useMutation | ||
| }); | ||
| //# sourceMappingURL=useMutation.cjs.map |
| {"version":3,"sources":["../../src/useMutation.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport {\n MutationObserver,\n noop,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n UseMutateFunction,\n UseMutationOptions,\n UseMutationResult,\n} from './types'\nimport type { DefaultError, QueryClient } from '@tanstack/query-core'\n\n// HOOK\n\nexport function useMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n queryClient?: QueryClient,\n): UseMutationResult<TData, TError, TVariables, TOnMutateResult> {\n const client = useQueryClient(queryClient)\n\n const [observer] = React.useState(\n () =>\n new MutationObserver<TData, TError, TVariables, TOnMutateResult>(\n client,\n options,\n ),\n )\n\n React.useEffect(() => {\n observer.setOptions(options)\n }, [observer, options])\n\n const result = React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n observer.subscribe(notifyManager.batchCalls(onStoreChange)),\n [observer],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n const mutate = React.useCallback<\n UseMutateFunction<TData, TError, TVariables, TOnMutateResult>\n >(\n (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop)\n },\n [observer],\n )\n\n if (\n result.error &&\n shouldThrowError(observer.options.throwOnError, [result.error])\n ) {\n throw result.error\n }\n\n return { ...result, mutate, mutateAsync: result.mutate }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,wBAKO;AACP,iCAA+B;AAUxB,SAAS,YAMd,SACA,aAC+D;AAC/D,QAAM,aAAS,2CAAe,WAAW;AAEzC,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,OAAO;AAAA,EAC7B,GAAG,CAAC,UAAU,OAAO,CAAC;AAEtB,QAAM,SAAe;AAAA,IACb;AAAA,MACJ,CAAC,kBACC,SAAS,UAAU,gCAAc,WAAW,aAAa,CAAC;AAAA,MAC5D,CAAC,QAAQ;AAAA,IACX;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,QAAM,SAAe;AAAA,IAGnB,CAAC,WAAW,kBAAkB;AAC5B,eAAS,OAAO,WAAW,aAAa,EAAE,MAAM,sBAAI;AAAA,IACtD;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,MACE,OAAO,aACP,oCAAiB,SAAS,QAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,GAC9D;AACA,UAAM,OAAO;AAAA,EACf;AAEA,SAAO,EAAE,GAAG,QAAQ,QAAQ,aAAa,OAAO,OAAO;AACzD;","names":[]} |
| export { useMutation_alias_1 as useMutation } from './_tsup-dts-rollup.cjs'; |
| export { useMutation_alias_1 as useMutation } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useMutation.ts | ||
| import * as React from "react"; | ||
| import { | ||
| MutationObserver, | ||
| noop, | ||
| notifyManager, | ||
| shouldThrowError | ||
| } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function useMutation(options, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| const [observer] = React.useState( | ||
| () => new MutationObserver( | ||
| client, | ||
| options | ||
| ) | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setOptions(options); | ||
| }, [observer, options]); | ||
| const result = React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), | ||
| [observer] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| const mutate = React.useCallback( | ||
| (variables, mutateOptions) => { | ||
| observer.mutate(variables, mutateOptions).catch(noop); | ||
| }, | ||
| [observer] | ||
| ); | ||
| if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) { | ||
| throw result.error; | ||
| } | ||
| return { ...result, mutate, mutateAsync: result.mutate }; | ||
| } | ||
| export { | ||
| useMutation | ||
| }; | ||
| //# sourceMappingURL=useMutation.js.map |
| {"version":3,"sources":["../../src/useMutation.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport {\n MutationObserver,\n noop,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n UseMutateFunction,\n UseMutationOptions,\n UseMutationResult,\n} from './types'\nimport type { DefaultError, QueryClient } from '@tanstack/query-core'\n\n// HOOK\n\nexport function useMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TOnMutateResult>,\n queryClient?: QueryClient,\n): UseMutationResult<TData, TError, TVariables, TOnMutateResult> {\n const client = useQueryClient(queryClient)\n\n const [observer] = React.useState(\n () =>\n new MutationObserver<TData, TError, TVariables, TOnMutateResult>(\n client,\n options,\n ),\n )\n\n React.useEffect(() => {\n observer.setOptions(options)\n }, [observer, options])\n\n const result = React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n observer.subscribe(notifyManager.batchCalls(onStoreChange)),\n [observer],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n const mutate = React.useCallback<\n UseMutateFunction<TData, TError, TVariables, TOnMutateResult>\n >(\n (variables, mutateOptions) => {\n observer.mutate(variables, mutateOptions).catch(noop)\n },\n [observer],\n )\n\n if (\n result.error &&\n shouldThrowError(observer.options.throwOnError, [result.error])\n ) {\n throw result.error\n }\n\n return { ...result, mutate, mutateAsync: result.mutate }\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAUxB,SAAS,YAMd,SACA,aAC+D;AAC/D,QAAM,SAAS,eAAe,WAAW;AAEzC,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS,WAAW,OAAO;AAAA,EAC7B,GAAG,CAAC,UAAU,OAAO,CAAC;AAEtB,QAAM,SAAe;AAAA,IACb;AAAA,MACJ,CAAC,kBACC,SAAS,UAAU,cAAc,WAAW,aAAa,CAAC;AAAA,MAC5D,CAAC,QAAQ;AAAA,IACX;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,QAAM,SAAe;AAAA,IAGnB,CAAC,WAAW,kBAAkB;AAC5B,eAAS,OAAO,WAAW,aAAa,EAAE,MAAM,IAAI;AAAA,IACtD;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,MACE,OAAO,SACP,iBAAiB,SAAS,QAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,GAC9D;AACA,UAAM,OAAO;AAAA,EACf;AAEA,SAAO,EAAE,GAAG,QAAQ,QAAQ,aAAa,OAAO,OAAO;AACzD;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useMutationState.ts | ||
| var useMutationState_exports = {}; | ||
| __export(useMutationState_exports, { | ||
| useIsMutating: () => useIsMutating, | ||
| useMutationState: () => useMutationState | ||
| }); | ||
| module.exports = __toCommonJS(useMutationState_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function useIsMutating(filters, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| return useMutationState( | ||
| { filters: { ...filters, status: "pending" } }, | ||
| client | ||
| ).length; | ||
| } | ||
| function getResult(mutationCache, options) { | ||
| return mutationCache.findAll(options.filters).map( | ||
| (mutation) => options.select ? options.select(mutation) : mutation.state | ||
| ); | ||
| } | ||
| function useMutationState(options = {}, queryClient) { | ||
| const mutationCache = (0, import_QueryClientProvider.useQueryClient)(queryClient).getMutationCache(); | ||
| const optionsRef = React.useRef(options); | ||
| const result = React.useRef(null); | ||
| if (result.current === null) { | ||
| result.current = getResult(mutationCache, options); | ||
| } | ||
| React.useEffect(() => { | ||
| optionsRef.current = options; | ||
| }); | ||
| return React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => mutationCache.subscribe(() => { | ||
| const nextResult = (0, import_query_core.replaceEqualDeep)( | ||
| result.current, | ||
| getResult(mutationCache, optionsRef.current) | ||
| ); | ||
| if (result.current !== nextResult) { | ||
| result.current = nextResult; | ||
| import_query_core.notifyManager.schedule(onStoreChange); | ||
| } | ||
| }), | ||
| [mutationCache] | ||
| ), | ||
| () => result.current, | ||
| () => result.current | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useIsMutating, | ||
| useMutationState | ||
| }); | ||
| //# sourceMappingURL=useMutationState.cjs.map |
| {"version":3,"sources":["../../src/useMutationState.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { notifyManager, replaceEqualDeep } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n Mutation,\n MutationCache,\n MutationFilters,\n MutationState,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport function useIsMutating(\n filters?: MutationFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n return useMutationState(\n { filters: { ...filters, status: 'pending' } },\n client,\n ).length\n}\n\ntype MutationStateOptions<TResult = MutationState> = {\n filters?: MutationFilters\n select?: (mutation: Mutation) => TResult\n}\n\nfunction getResult<TResult = MutationState>(\n mutationCache: MutationCache,\n options: MutationStateOptions<TResult>,\n): Array<TResult> {\n return mutationCache\n .findAll(options.filters)\n .map(\n (mutation): TResult =>\n (options.select ? options.select(mutation) : mutation.state) as TResult,\n )\n}\n\nexport function useMutationState<TResult = MutationState>(\n options: MutationStateOptions<TResult> = {},\n queryClient?: QueryClient,\n): Array<TResult> {\n const mutationCache = useQueryClient(queryClient).getMutationCache()\n const optionsRef = React.useRef(options)\n const result = React.useRef<Array<TResult>>(null)\n if (result.current === null) {\n result.current = getResult(mutationCache, options)\n }\n\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n mutationCache.subscribe(() => {\n const nextResult = replaceEqualDeep(\n result.current,\n getResult(mutationCache, optionsRef.current),\n )\n if (result.current !== nextResult) {\n result.current = nextResult\n notifyManager.schedule(onStoreChange)\n }\n }),\n [mutationCache],\n ),\n () => result.current,\n () => result.current,\n )!\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAAgD;AAChD,iCAA+B;AASxB,SAAS,cACd,SACA,aACQ;AACR,QAAM,aAAS,2CAAe,WAAW;AACzC,SAAO;AAAA,IACL,EAAE,SAAS,EAAE,GAAG,SAAS,QAAQ,UAAU,EAAE;AAAA,IAC7C;AAAA,EACF,EAAE;AACJ;AAOA,SAAS,UACP,eACA,SACgB;AAChB,SAAO,cACJ,QAAQ,QAAQ,OAAO,EACvB;AAAA,IACC,CAAC,aACE,QAAQ,SAAS,QAAQ,OAAO,QAAQ,IAAI,SAAS;AAAA,EAC1D;AACJ;AAEO,SAAS,iBACd,UAAyC,CAAC,GAC1C,aACgB;AAChB,QAAM,oBAAgB,2CAAe,WAAW,EAAE,iBAAiB;AACnE,QAAM,aAAmB,aAAO,OAAO;AACvC,QAAM,SAAe,aAAuB,IAAI;AAChD,MAAI,OAAO,YAAY,MAAM;AAC3B,WAAO,UAAU,UAAU,eAAe,OAAO;AAAA,EACnD;AAEA,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAED,SAAa;AAAA,IACL;AAAA,MACJ,CAAC,kBACC,cAAc,UAAU,MAAM;AAC5B,cAAM,iBAAa;AAAA,UACjB,OAAO;AAAA,UACP,UAAU,eAAe,WAAW,OAAO;AAAA,QAC7C;AACA,YAAI,OAAO,YAAY,YAAY;AACjC,iBAAO,UAAU;AACjB,0CAAc,SAAS,aAAa;AAAA,QACtC;AAAA,MACF,CAAC;AAAA,MACH,CAAC,aAAa;AAAA,IAChB;AAAA,IACA,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,EACf;AACF;","names":[]} |
| export { useIsMutating_alias_1 as useIsMutating } from './_tsup-dts-rollup.cjs'; | ||
| export { useMutationState_alias_1 as useMutationState } from './_tsup-dts-rollup.cjs'; |
| export { useIsMutating_alias_1 as useIsMutating } from './_tsup-dts-rollup.js'; | ||
| export { useMutationState_alias_1 as useMutationState } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useMutationState.ts | ||
| import * as React from "react"; | ||
| import { notifyManager, replaceEqualDeep } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function useIsMutating(filters, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| return useMutationState( | ||
| { filters: { ...filters, status: "pending" } }, | ||
| client | ||
| ).length; | ||
| } | ||
| function getResult(mutationCache, options) { | ||
| return mutationCache.findAll(options.filters).map( | ||
| (mutation) => options.select ? options.select(mutation) : mutation.state | ||
| ); | ||
| } | ||
| function useMutationState(options = {}, queryClient) { | ||
| const mutationCache = useQueryClient(queryClient).getMutationCache(); | ||
| const optionsRef = React.useRef(options); | ||
| const result = React.useRef(null); | ||
| if (result.current === null) { | ||
| result.current = getResult(mutationCache, options); | ||
| } | ||
| React.useEffect(() => { | ||
| optionsRef.current = options; | ||
| }); | ||
| return React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => mutationCache.subscribe(() => { | ||
| const nextResult = replaceEqualDeep( | ||
| result.current, | ||
| getResult(mutationCache, optionsRef.current) | ||
| ); | ||
| if (result.current !== nextResult) { | ||
| result.current = nextResult; | ||
| notifyManager.schedule(onStoreChange); | ||
| } | ||
| }), | ||
| [mutationCache] | ||
| ), | ||
| () => result.current, | ||
| () => result.current | ||
| ); | ||
| } | ||
| export { | ||
| useIsMutating, | ||
| useMutationState | ||
| }; | ||
| //# sourceMappingURL=useMutationState.js.map |
| {"version":3,"sources":["../../src/useMutationState.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport { notifyManager, replaceEqualDeep } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n Mutation,\n MutationCache,\n MutationFilters,\n MutationState,\n QueryClient,\n} from '@tanstack/query-core'\n\nexport function useIsMutating(\n filters?: MutationFilters,\n queryClient?: QueryClient,\n): number {\n const client = useQueryClient(queryClient)\n return useMutationState(\n { filters: { ...filters, status: 'pending' } },\n client,\n ).length\n}\n\ntype MutationStateOptions<TResult = MutationState> = {\n filters?: MutationFilters\n select?: (mutation: Mutation) => TResult\n}\n\nfunction getResult<TResult = MutationState>(\n mutationCache: MutationCache,\n options: MutationStateOptions<TResult>,\n): Array<TResult> {\n return mutationCache\n .findAll(options.filters)\n .map(\n (mutation): TResult =>\n (options.select ? options.select(mutation) : mutation.state) as TResult,\n )\n}\n\nexport function useMutationState<TResult = MutationState>(\n options: MutationStateOptions<TResult> = {},\n queryClient?: QueryClient,\n): Array<TResult> {\n const mutationCache = useQueryClient(queryClient).getMutationCache()\n const optionsRef = React.useRef(options)\n const result = React.useRef<Array<TResult>>(null)\n if (result.current === null) {\n result.current = getResult(mutationCache, options)\n }\n\n React.useEffect(() => {\n optionsRef.current = options\n })\n\n return React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n mutationCache.subscribe(() => {\n const nextResult = replaceEqualDeep(\n result.current,\n getResult(mutationCache, optionsRef.current),\n )\n if (result.current !== nextResult) {\n result.current = nextResult\n notifyManager.schedule(onStoreChange)\n }\n }),\n [mutationCache],\n ),\n () => result.current,\n () => result.current,\n )!\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,SAAS,eAAe,wBAAwB;AAChD,SAAS,sBAAsB;AASxB,SAAS,cACd,SACA,aACQ;AACR,QAAM,SAAS,eAAe,WAAW;AACzC,SAAO;AAAA,IACL,EAAE,SAAS,EAAE,GAAG,SAAS,QAAQ,UAAU,EAAE;AAAA,IAC7C;AAAA,EACF,EAAE;AACJ;AAOA,SAAS,UACP,eACA,SACgB;AAChB,SAAO,cACJ,QAAQ,QAAQ,OAAO,EACvB;AAAA,IACC,CAAC,aACE,QAAQ,SAAS,QAAQ,OAAO,QAAQ,IAAI,SAAS;AAAA,EAC1D;AACJ;AAEO,SAAS,iBACd,UAAyC,CAAC,GAC1C,aACgB;AAChB,QAAM,gBAAgB,eAAe,WAAW,EAAE,iBAAiB;AACnE,QAAM,aAAmB,aAAO,OAAO;AACvC,QAAM,SAAe,aAAuB,IAAI;AAChD,MAAI,OAAO,YAAY,MAAM;AAC3B,WAAO,UAAU,UAAU,eAAe,OAAO;AAAA,EACnD;AAEA,EAAM,gBAAU,MAAM;AACpB,eAAW,UAAU;AAAA,EACvB,CAAC;AAED,SAAa;AAAA,IACL;AAAA,MACJ,CAAC,kBACC,cAAc,UAAU,MAAM;AAC5B,cAAM,aAAa;AAAA,UACjB,OAAO;AAAA,UACP,UAAU,eAAe,WAAW,OAAO;AAAA,QAC7C;AACA,YAAI,OAAO,YAAY,YAAY;AACjC,iBAAO,UAAU;AACjB,wBAAc,SAAS,aAAa;AAAA,QACtC;AAAA,MACF,CAAC;AAAA,MACH,CAAC,aAAa;AAAA,IAChB;AAAA,IACA,MAAM,OAAO;AAAA,IACb,MAAM,OAAO;AAAA,EACf;AACF;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/usePrefetchInfiniteQuery.tsx | ||
| var usePrefetchInfiniteQuery_exports = {}; | ||
| __export(usePrefetchInfiniteQuery_exports, { | ||
| usePrefetchInfiniteQuery: () => usePrefetchInfiniteQuery | ||
| }); | ||
| module.exports = __toCommonJS(usePrefetchInfiniteQuery_exports); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function usePrefetchInfiniteQuery(options, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| if (!client.getQueryState(options.queryKey)) { | ||
| client.prefetchInfiniteQuery(options); | ||
| } | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| usePrefetchInfiniteQuery | ||
| }); | ||
| //# sourceMappingURL=usePrefetchInfiniteQuery.cjs.map |
| {"version":3,"sources":["../../src/usePrefetchInfiniteQuery.tsx"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n DefaultError,\n FetchInfiniteQueryOptions,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\n\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchInfiniteQuery(options)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAA+B;AAQxB,SAAS,yBAOd,SAOA,aACA;AACA,QAAM,aAAS,2CAAe,WAAW;AAEzC,MAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GAAG;AAC3C,WAAO,sBAAsB,OAAO;AAAA,EACtC;AACF;","names":[]} |
| export { usePrefetchInfiniteQuery_alias_1 as usePrefetchInfiniteQuery } from './_tsup-dts-rollup.cjs'; |
| export { usePrefetchInfiniteQuery_alias_1 as usePrefetchInfiniteQuery } from './_tsup-dts-rollup.js'; |
| // src/usePrefetchInfiniteQuery.tsx | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function usePrefetchInfiniteQuery(options, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| if (!client.getQueryState(options.queryKey)) { | ||
| client.prefetchInfiniteQuery(options); | ||
| } | ||
| } | ||
| export { | ||
| usePrefetchInfiniteQuery | ||
| }; | ||
| //# sourceMappingURL=usePrefetchInfiniteQuery.js.map |
| {"version":3,"sources":["../../src/usePrefetchInfiniteQuery.tsx"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type {\n DefaultError,\n FetchInfiniteQueryOptions,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\n\nexport function usePrefetchInfiniteQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: FetchInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchInfiniteQuery(options)\n }\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAQxB,SAAS,yBAOd,SAOA,aACA;AACA,QAAM,SAAS,eAAe,WAAW;AAEzC,MAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GAAG;AAC3C,WAAO,sBAAsB,OAAO;AAAA,EACtC;AACF;","names":[]} |
| "use strict"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/usePrefetchQuery.tsx | ||
| var usePrefetchQuery_exports = {}; | ||
| __export(usePrefetchQuery_exports, { | ||
| usePrefetchQuery: () => usePrefetchQuery | ||
| }); | ||
| module.exports = __toCommonJS(usePrefetchQuery_exports); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| function usePrefetchQuery(options, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| if (!client.getQueryState(options.queryKey)) { | ||
| client.prefetchQuery(options); | ||
| } | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| usePrefetchQuery | ||
| }); | ||
| //# sourceMappingURL=usePrefetchQuery.cjs.map |
| {"version":3,"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchQuery(options)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAA+B;AAIxB,SAAS,iBAMd,SACA,aACA;AACA,QAAM,aAAS,2CAAe,WAAW;AAEzC,MAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GAAG;AAC3C,WAAO,cAAc,OAAO;AAAA,EAC9B;AACF;","names":[]} |
| export { usePrefetchQuery_alias_1 as usePrefetchQuery } from './_tsup-dts-rollup.cjs'; |
| export { usePrefetchQuery_alias_1 as usePrefetchQuery } from './_tsup-dts-rollup.js'; |
| // src/usePrefetchQuery.tsx | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| function usePrefetchQuery(options, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| if (!client.getQueryState(options.queryKey)) { | ||
| client.prefetchQuery(options); | ||
| } | ||
| } | ||
| export { | ||
| usePrefetchQuery | ||
| }; | ||
| //# sourceMappingURL=usePrefetchQuery.js.map |
| {"version":3,"sources":["../../src/usePrefetchQuery.tsx"],"sourcesContent":["import { useQueryClient } from './QueryClientProvider'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\nimport type { UsePrefetchQueryOptions } from './types'\n\nexport function usePrefetchQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UsePrefetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n) {\n const client = useQueryClient(queryClient)\n\n if (!client.getQueryState(options.queryKey)) {\n client.prefetchQuery(options)\n }\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAIxB,SAAS,iBAMd,SACA,aACA;AACA,QAAM,SAAS,eAAe,WAAW;AAEzC,MAAI,CAAC,OAAO,cAAc,QAAQ,QAAQ,GAAG;AAC3C,WAAO,cAAc,OAAO;AAAA,EAC9B;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useQueries.ts | ||
| var useQueries_exports = {}; | ||
| __export(useQueries_exports, { | ||
| useQueries: () => useQueries | ||
| }); | ||
| module.exports = __toCommonJS(useQueries_exports); | ||
| var React = __toESM(require("react"), 1); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_QueryClientProvider = require("./QueryClientProvider.cjs"); | ||
| var import_IsRestoringProvider = require("./IsRestoringProvider.cjs"); | ||
| var import_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs"); | ||
| var import_errorBoundaryUtils = require("./errorBoundaryUtils.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useQueries({ | ||
| queries, | ||
| ...options | ||
| }, queryClient) { | ||
| const client = (0, import_QueryClientProvider.useQueryClient)(queryClient); | ||
| const isRestoring = (0, import_IsRestoringProvider.useIsRestoring)(); | ||
| const errorResetBoundary = (0, import_QueryErrorResetBoundary.useQueryErrorResetBoundary)(); | ||
| const defaultedQueries = React.useMemo( | ||
| () => queries.map((opts) => { | ||
| const defaultedOptions = client.defaultQueryOptions( | ||
| opts | ||
| ); | ||
| defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
| return defaultedOptions; | ||
| }), | ||
| [queries, client, isRestoring] | ||
| ); | ||
| defaultedQueries.forEach((queryOptions) => { | ||
| (0, import_suspense.ensureSuspenseTimers)(queryOptions); | ||
| const query = client.getQueryCache().get(queryOptions.queryHash); | ||
| (0, import_errorBoundaryUtils.ensurePreventErrorBoundaryRetry)(queryOptions, errorResetBoundary, query); | ||
| }); | ||
| (0, import_errorBoundaryUtils.useClearResetErrorBoundary)(errorResetBoundary); | ||
| const [observer] = React.useState( | ||
| () => new import_query_core.QueriesObserver( | ||
| client, | ||
| defaultedQueries, | ||
| options | ||
| ) | ||
| ); | ||
| const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult( | ||
| defaultedQueries, | ||
| options.combine | ||
| ); | ||
| const shouldSubscribe = !isRestoring && options.subscribed !== false; | ||
| React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => shouldSubscribe ? observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)) : import_query_core.noop, | ||
| [observer, shouldSubscribe] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setQueries( | ||
| defaultedQueries, | ||
| options | ||
| ); | ||
| }, [defaultedQueries, options, observer]); | ||
| const shouldAtLeastOneSuspend = optimisticResult.some( | ||
| (result, index) => (0, import_suspense.shouldSuspend)(defaultedQueries[index], result) | ||
| ); | ||
| const suspensePromises = shouldAtLeastOneSuspend ? optimisticResult.flatMap((result, index) => { | ||
| const opts = defaultedQueries[index]; | ||
| if (opts && (0, import_suspense.shouldSuspend)(opts, result)) { | ||
| const queryObserver = new import_query_core.QueryObserver(client, opts); | ||
| return (0, import_suspense.fetchOptimistic)(opts, queryObserver, errorResetBoundary); | ||
| } | ||
| return []; | ||
| }) : []; | ||
| if (suspensePromises.length > 0) { | ||
| throw Promise.all(suspensePromises); | ||
| } | ||
| const firstSingleResultWhichShouldThrow = optimisticResult.find( | ||
| (result, index) => { | ||
| const query = defaultedQueries[index]; | ||
| return query && (0, import_errorBoundaryUtils.getHasError)({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError: query.throwOnError, | ||
| query: client.getQueryCache().get(query.queryHash), | ||
| suspense: query.suspense | ||
| }); | ||
| } | ||
| ); | ||
| if (firstSingleResultWhichShouldThrow?.error) { | ||
| throw firstSingleResultWhichShouldThrow.error; | ||
| } | ||
| return getCombinedResult(trackResult()); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useQueries | ||
| }); | ||
| //# sourceMappingURL=useQueries.cjs.map |
| {"version":3,"sources":["../../src/useQueries.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport {\n QueriesObserver,\n QueryObserver,\n noop,\n notifyManager,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useIsRestoring } from './IsRestoringProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n} from './suspense'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefaultError,\n OmitKeyof,\n QueriesObserverOptions,\n QueriesPlaceholderDataFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n QueryObserverOptions,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.\n// `placeholderData` function always gets undefined passed\ntype UseQueryOptionsForUseQueries<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'placeholderData' | 'subscribed'\n> & {\n placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>\n}\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetUseQueryOptionsForUseQueries<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseQueryOptionsForUseQueries<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseQueryOptionsForUseQueries<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseQueryOptionsForUseQueries<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError,\n unknown extends TData ? TQueryFnData : TData,\n TQueryKey\n >\n : // Fallback\n UseQueryOptionsForUseQueries\n\n// A defined initialData setting should return a DefinedUseQueryResult rather than UseQueryResult\ntype GetDefinedOrUndefinedQueryResult<T, TData, TError = unknown> = T extends {\n initialData?: infer TInitialData\n}\n ? unknown extends TInitialData\n ? UseQueryResult<TData, TError>\n : TInitialData extends TData\n ? DefinedUseQueryResult<TData, TError>\n : TInitialData extends () => infer TInitialDataResult\n ? unknown extends TInitialDataResult\n ? UseQueryResult<TData, TError>\n : TInitialDataResult extends TData\n ? DefinedUseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n\ntype GetUseQueryResult<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? GetDefinedOrUndefinedQueryResult<\n T,\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n UseQueryResult\n\n/**\n * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n */\nexport type QueriesOptions<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseQueryOptionsForUseQueries>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseQueryOptionsForUseQueries<Head>]\n : T extends [infer Head, ...infer Tails]\n ? QueriesOptions<\n [...Tails],\n [...TResults, GetUseQueryOptionsForUseQueries<Head>],\n [...TDepth, 1]\n >\n : ReadonlyArray<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n UseQueryOptionsForUseQueries<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n UseQueryOptionsForUseQueries<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n >\n : // Fallback\n Array<UseQueryOptionsForUseQueries>\n\n/**\n * QueriesResults reducer recursively maps type param to results\n */\nexport type QueriesResults<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseQueryResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseQueryResult<Head>]\n : T extends [infer Head, ...infer Tails]\n ? QueriesResults<\n [...Tails],\n [...TResults, GetUseQueryResult<Head>],\n [...TDepth, 1]\n >\n : { [K in keyof T]: GetUseQueryResult<T[K]> }\n\nexport function useQueries<\n T extends Array<any>,\n TCombinedResult = QueriesResults<T>,\n>(\n {\n queries,\n ...options\n }: {\n queries:\n | readonly [...QueriesOptions<T>]\n | readonly [...{ [K in keyof T]: GetUseQueryOptionsForUseQueries<T[K]> }]\n combine?: (result: QueriesResults<T>) => TCombinedResult\n subscribed?: boolean\n },\n queryClient?: QueryClient,\n): TCombinedResult {\n const client = useQueryClient(queryClient)\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n\n const defaultedQueries = React.useMemo(\n () =>\n queries.map((opts) => {\n const defaultedOptions = client.defaultQueryOptions(\n opts as QueryObserverOptions,\n )\n\n // Make sure the results are already in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n return defaultedOptions\n }),\n [queries, client, isRestoring],\n )\n\n defaultedQueries.forEach((queryOptions) => {\n ensureSuspenseTimers(queryOptions)\n const query = client.getQueryCache().get(queryOptions.queryHash)\n ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query)\n })\n\n useClearResetErrorBoundary(errorResetBoundary)\n\n const [observer] = React.useState(\n () =>\n new QueriesObserver<TCombinedResult>(\n client,\n defaultedQueries,\n options as QueriesObserverOptions<TCombinedResult>,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const [optimisticResult, getCombinedResult, trackResult] =\n observer.getOptimisticResult(\n defaultedQueries,\n (options as QueriesObserverOptions<TCombinedResult>).combine,\n )\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop,\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n observer.setQueries(\n defaultedQueries,\n options as QueriesObserverOptions<TCombinedResult>,\n )\n }, [defaultedQueries, options, observer])\n\n const shouldAtLeastOneSuspend = optimisticResult.some((result, index) =>\n shouldSuspend(defaultedQueries[index], result),\n )\n\n const suspensePromises = shouldAtLeastOneSuspend\n ? optimisticResult.flatMap((result, index) => {\n const opts = defaultedQueries[index]\n\n if (opts && shouldSuspend(opts, result)) {\n const queryObserver = new QueryObserver(client, opts)\n return fetchOptimistic(opts, queryObserver, errorResetBoundary)\n }\n return []\n })\n : []\n\n if (suspensePromises.length > 0) {\n throw Promise.all(suspensePromises)\n }\n const firstSingleResultWhichShouldThrow = optimisticResult.find(\n (result, index) => {\n const query = defaultedQueries[index]\n return (\n query &&\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: query.throwOnError,\n query: client.getQueryCache().get(query.queryHash),\n suspense: query.suspense,\n })\n )\n },\n )\n\n if (firstSingleResultWhichShouldThrow?.error) {\n throw firstSingleResultWhichShouldThrow.error\n }\n\n return getCombinedResult(trackResult())\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,wBAKO;AACP,iCAA+B;AAC/B,iCAA+B;AAC/B,qCAA2C;AAC3C,gCAIO;AACP,sBAIO;AAyLA,SAAS,WAId;AAAA,EACE;AAAA,EACA,GAAG;AACL,GAOA,aACiB;AACjB,QAAM,aAAS,2CAAe,WAAW;AACzC,QAAM,kBAAc,2CAAe;AACnC,QAAM,yBAAqB,2DAA2B;AAEtD,QAAM,mBAAyB;AAAA,IAC7B,MACE,QAAQ,IAAI,CAAC,SAAS;AACpB,YAAM,mBAAmB,OAAO;AAAA,QAC9B;AAAA,MACF;AAGA,uBAAiB,qBAAqB,cAClC,gBACA;AAEJ,aAAO;AAAA,IACT,CAAC;AAAA,IACH,CAAC,SAAS,QAAQ,WAAW;AAAA,EAC/B;AAEA,mBAAiB,QAAQ,CAAC,iBAAiB;AACzC,8CAAqB,YAAY;AACjC,UAAM,QAAQ,OAAO,cAAc,EAAE,IAAI,aAAa,SAAS;AAC/D,mEAAgC,cAAc,oBAAoB,KAAK;AAAA,EACzE,CAAC;AAED,4DAA2B,kBAAkB;AAE7C,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAGA,QAAM,CAAC,kBAAkB,mBAAmB,WAAW,IACrD,SAAS;AAAA,IACP;AAAA,IACC,QAAoD;AAAA,EACvD;AAEF,QAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;AAC/D,EAAM;AAAA,IACE;AAAA,MACJ,CAAC,kBACC,kBACI,SAAS,UAAU,gCAAc,WAAW,aAAa,CAAC,IAC1D;AAAA,MACN,CAAC,UAAU,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,kBAAkB,SAAS,QAAQ,CAAC;AAExC,QAAM,0BAA0B,iBAAiB;AAAA,IAAK,CAAC,QAAQ,cAC7D,+BAAc,iBAAiB,KAAK,GAAG,MAAM;AAAA,EAC/C;AAEA,QAAM,mBAAmB,0BACrB,iBAAiB,QAAQ,CAAC,QAAQ,UAAU;AAC1C,UAAM,OAAO,iBAAiB,KAAK;AAEnC,QAAI,YAAQ,+BAAc,MAAM,MAAM,GAAG;AACvC,YAAM,gBAAgB,IAAI,gCAAc,QAAQ,IAAI;AACpD,iBAAO,iCAAgB,MAAM,eAAe,kBAAkB;AAAA,IAChE;AACA,WAAO,CAAC;AAAA,EACV,CAAC,IACD,CAAC;AAEL,MAAI,iBAAiB,SAAS,GAAG;AAC/B,UAAM,QAAQ,IAAI,gBAAgB;AAAA,EACpC;AACA,QAAM,oCAAoC,iBAAiB;AAAA,IACzD,CAAC,QAAQ,UAAU;AACjB,YAAM,QAAQ,iBAAiB,KAAK;AACpC,aACE,aACA,uCAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA,cAAc,MAAM;AAAA,QACpB,OAAO,OAAO,cAAc,EAAE,IAAI,MAAM,SAAS;AAAA,QACjD,UAAU,MAAM;AAAA,MAClB,CAAC;AAAA,IAEL;AAAA,EACF;AAEA,MAAI,mCAAmC,OAAO;AAC5C,UAAM,kCAAkC;AAAA,EAC1C;AAEA,SAAO,kBAAkB,YAAY,CAAC;AACxC;","names":[]} |
| export { useQueries_alias_1 as useQueries } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesOptions_alias_1 as QueriesOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { QueriesResults_alias_1 as QueriesResults } from './_tsup-dts-rollup.cjs'; |
| export { useQueries_alias_1 as useQueries } from './_tsup-dts-rollup.js'; | ||
| export { QueriesOptions_alias_1 as QueriesOptions } from './_tsup-dts-rollup.js'; | ||
| export { QueriesResults_alias_1 as QueriesResults } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useQueries.ts | ||
| import * as React from "react"; | ||
| import { | ||
| QueriesObserver, | ||
| QueryObserver, | ||
| noop, | ||
| notifyManager | ||
| } from "@tanstack/query-core"; | ||
| import { useQueryClient } from "./QueryClientProvider.js"; | ||
| import { useIsRestoring } from "./IsRestoringProvider.js"; | ||
| import { useQueryErrorResetBoundary } from "./QueryErrorResetBoundary.js"; | ||
| import { | ||
| ensurePreventErrorBoundaryRetry, | ||
| getHasError, | ||
| useClearResetErrorBoundary | ||
| } from "./errorBoundaryUtils.js"; | ||
| import { | ||
| ensureSuspenseTimers, | ||
| fetchOptimistic, | ||
| shouldSuspend | ||
| } from "./suspense.js"; | ||
| function useQueries({ | ||
| queries, | ||
| ...options | ||
| }, queryClient) { | ||
| const client = useQueryClient(queryClient); | ||
| const isRestoring = useIsRestoring(); | ||
| const errorResetBoundary = useQueryErrorResetBoundary(); | ||
| const defaultedQueries = React.useMemo( | ||
| () => queries.map((opts) => { | ||
| const defaultedOptions = client.defaultQueryOptions( | ||
| opts | ||
| ); | ||
| defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic"; | ||
| return defaultedOptions; | ||
| }), | ||
| [queries, client, isRestoring] | ||
| ); | ||
| defaultedQueries.forEach((queryOptions) => { | ||
| ensureSuspenseTimers(queryOptions); | ||
| const query = client.getQueryCache().get(queryOptions.queryHash); | ||
| ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query); | ||
| }); | ||
| useClearResetErrorBoundary(errorResetBoundary); | ||
| const [observer] = React.useState( | ||
| () => new QueriesObserver( | ||
| client, | ||
| defaultedQueries, | ||
| options | ||
| ) | ||
| ); | ||
| const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult( | ||
| defaultedQueries, | ||
| options.combine | ||
| ); | ||
| const shouldSubscribe = !isRestoring && options.subscribed !== false; | ||
| React.useSyncExternalStore( | ||
| React.useCallback( | ||
| (onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop, | ||
| [observer, shouldSubscribe] | ||
| ), | ||
| () => observer.getCurrentResult(), | ||
| () => observer.getCurrentResult() | ||
| ); | ||
| React.useEffect(() => { | ||
| observer.setQueries( | ||
| defaultedQueries, | ||
| options | ||
| ); | ||
| }, [defaultedQueries, options, observer]); | ||
| const shouldAtLeastOneSuspend = optimisticResult.some( | ||
| (result, index) => shouldSuspend(defaultedQueries[index], result) | ||
| ); | ||
| const suspensePromises = shouldAtLeastOneSuspend ? optimisticResult.flatMap((result, index) => { | ||
| const opts = defaultedQueries[index]; | ||
| if (opts && shouldSuspend(opts, result)) { | ||
| const queryObserver = new QueryObserver(client, opts); | ||
| return fetchOptimistic(opts, queryObserver, errorResetBoundary); | ||
| } | ||
| return []; | ||
| }) : []; | ||
| if (suspensePromises.length > 0) { | ||
| throw Promise.all(suspensePromises); | ||
| } | ||
| const firstSingleResultWhichShouldThrow = optimisticResult.find( | ||
| (result, index) => { | ||
| const query = defaultedQueries[index]; | ||
| return query && getHasError({ | ||
| result, | ||
| errorResetBoundary, | ||
| throwOnError: query.throwOnError, | ||
| query: client.getQueryCache().get(query.queryHash), | ||
| suspense: query.suspense | ||
| }); | ||
| } | ||
| ); | ||
| if (firstSingleResultWhichShouldThrow?.error) { | ||
| throw firstSingleResultWhichShouldThrow.error; | ||
| } | ||
| return getCombinedResult(trackResult()); | ||
| } | ||
| export { | ||
| useQueries | ||
| }; | ||
| //# sourceMappingURL=useQueries.js.map |
| {"version":3,"sources":["../../src/useQueries.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nimport {\n QueriesObserver,\n QueryObserver,\n noop,\n notifyManager,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { useIsRestoring } from './IsRestoringProvider'\nimport { useQueryErrorResetBoundary } from './QueryErrorResetBoundary'\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary,\n} from './errorBoundaryUtils'\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n} from './suspense'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefaultError,\n OmitKeyof,\n QueriesObserverOptions,\n QueriesPlaceholderDataFunction,\n QueryClient,\n QueryFunction,\n QueryKey,\n QueryObserverOptions,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.\n// `placeholderData` function always gets undefined passed\ntype UseQueryOptionsForUseQueries<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'placeholderData' | 'subscribed'\n> & {\n placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>\n}\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetUseQueryOptionsForUseQueries<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseQueryOptionsForUseQueries<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? UseQueryOptionsForUseQueries<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseQueryOptionsForUseQueries<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseQueryOptionsForUseQueries<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError,\n unknown extends TData ? TQueryFnData : TData,\n TQueryKey\n >\n : // Fallback\n UseQueryOptionsForUseQueries\n\n// A defined initialData setting should return a DefinedUseQueryResult rather than UseQueryResult\ntype GetDefinedOrUndefinedQueryResult<T, TData, TError = unknown> = T extends {\n initialData?: infer TInitialData\n}\n ? unknown extends TInitialData\n ? UseQueryResult<TData, TError>\n : TInitialData extends TData\n ? DefinedUseQueryResult<TData, TError>\n : TInitialData extends () => infer TInitialDataResult\n ? unknown extends TInitialDataResult\n ? UseQueryResult<TData, TError>\n : TInitialDataResult extends TData\n ? DefinedUseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n : UseQueryResult<TData, TError>\n\ntype GetUseQueryResult<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? GetDefinedOrUndefinedQueryResult<T, TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? GetDefinedOrUndefinedQueryResult<T, TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? GetDefinedOrUndefinedQueryResult<\n T,\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n UseQueryResult\n\n/**\n * QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n */\nexport type QueriesOptions<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseQueryOptionsForUseQueries>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseQueryOptionsForUseQueries<Head>]\n : T extends [infer Head, ...infer Tails]\n ? QueriesOptions<\n [...Tails],\n [...TResults, GetUseQueryOptionsForUseQueries<Head>],\n [...TDepth, 1]\n >\n : ReadonlyArray<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n UseQueryOptionsForUseQueries<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n UseQueryOptionsForUseQueries<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n >\n : // Fallback\n Array<UseQueryOptionsForUseQueries>\n\n/**\n * QueriesResults reducer recursively maps type param to results\n */\nexport type QueriesResults<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseQueryResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseQueryResult<Head>]\n : T extends [infer Head, ...infer Tails]\n ? QueriesResults<\n [...Tails],\n [...TResults, GetUseQueryResult<Head>],\n [...TDepth, 1]\n >\n : { [K in keyof T]: GetUseQueryResult<T[K]> }\n\nexport function useQueries<\n T extends Array<any>,\n TCombinedResult = QueriesResults<T>,\n>(\n {\n queries,\n ...options\n }: {\n queries:\n | readonly [...QueriesOptions<T>]\n | readonly [...{ [K in keyof T]: GetUseQueryOptionsForUseQueries<T[K]> }]\n combine?: (result: QueriesResults<T>) => TCombinedResult\n subscribed?: boolean\n },\n queryClient?: QueryClient,\n): TCombinedResult {\n const client = useQueryClient(queryClient)\n const isRestoring = useIsRestoring()\n const errorResetBoundary = useQueryErrorResetBoundary()\n\n const defaultedQueries = React.useMemo(\n () =>\n queries.map((opts) => {\n const defaultedOptions = client.defaultQueryOptions(\n opts as QueryObserverOptions,\n )\n\n // Make sure the results are already in fetching state before subscribing or updating options\n defaultedOptions._optimisticResults = isRestoring\n ? 'isRestoring'\n : 'optimistic'\n\n return defaultedOptions\n }),\n [queries, client, isRestoring],\n )\n\n defaultedQueries.forEach((queryOptions) => {\n ensureSuspenseTimers(queryOptions)\n const query = client.getQueryCache().get(queryOptions.queryHash)\n ensurePreventErrorBoundaryRetry(queryOptions, errorResetBoundary, query)\n })\n\n useClearResetErrorBoundary(errorResetBoundary)\n\n const [observer] = React.useState(\n () =>\n new QueriesObserver<TCombinedResult>(\n client,\n defaultedQueries,\n options as QueriesObserverOptions<TCombinedResult>,\n ),\n )\n\n // note: this must be called before useSyncExternalStore\n const [optimisticResult, getCombinedResult, trackResult] =\n observer.getOptimisticResult(\n defaultedQueries,\n (options as QueriesObserverOptions<TCombinedResult>).combine,\n )\n\n const shouldSubscribe = !isRestoring && options.subscribed !== false\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) =>\n shouldSubscribe\n ? observer.subscribe(notifyManager.batchCalls(onStoreChange))\n : noop,\n [observer, shouldSubscribe],\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult(),\n )\n\n React.useEffect(() => {\n observer.setQueries(\n defaultedQueries,\n options as QueriesObserverOptions<TCombinedResult>,\n )\n }, [defaultedQueries, options, observer])\n\n const shouldAtLeastOneSuspend = optimisticResult.some((result, index) =>\n shouldSuspend(defaultedQueries[index], result),\n )\n\n const suspensePromises = shouldAtLeastOneSuspend\n ? optimisticResult.flatMap((result, index) => {\n const opts = defaultedQueries[index]\n\n if (opts && shouldSuspend(opts, result)) {\n const queryObserver = new QueryObserver(client, opts)\n return fetchOptimistic(opts, queryObserver, errorResetBoundary)\n }\n return []\n })\n : []\n\n if (suspensePromises.length > 0) {\n throw Promise.all(suspensePromises)\n }\n const firstSingleResultWhichShouldThrow = optimisticResult.find(\n (result, index) => {\n const query = defaultedQueries[index]\n return (\n query &&\n getHasError({\n result,\n errorResetBoundary,\n throwOnError: query.throwOnError,\n query: client.getQueryCache().get(query.queryHash),\n suspense: query.suspense,\n })\n )\n },\n )\n\n if (firstSingleResultWhichShouldThrow?.error) {\n throw firstSingleResultWhichShouldThrow.error\n }\n\n return getCombinedResult(trackResult())\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAyLA,SAAS,WAId;AAAA,EACE;AAAA,EACA,GAAG;AACL,GAOA,aACiB;AACjB,QAAM,SAAS,eAAe,WAAW;AACzC,QAAM,cAAc,eAAe;AACnC,QAAM,qBAAqB,2BAA2B;AAEtD,QAAM,mBAAyB;AAAA,IAC7B,MACE,QAAQ,IAAI,CAAC,SAAS;AACpB,YAAM,mBAAmB,OAAO;AAAA,QAC9B;AAAA,MACF;AAGA,uBAAiB,qBAAqB,cAClC,gBACA;AAEJ,aAAO;AAAA,IACT,CAAC;AAAA,IACH,CAAC,SAAS,QAAQ,WAAW;AAAA,EAC/B;AAEA,mBAAiB,QAAQ,CAAC,iBAAiB;AACzC,yBAAqB,YAAY;AACjC,UAAM,QAAQ,OAAO,cAAc,EAAE,IAAI,aAAa,SAAS;AAC/D,oCAAgC,cAAc,oBAAoB,KAAK;AAAA,EACzE,CAAC;AAED,6BAA2B,kBAAkB;AAE7C,QAAM,CAAC,QAAQ,IAAU;AAAA,IACvB,MACE,IAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACJ;AAGA,QAAM,CAAC,kBAAkB,mBAAmB,WAAW,IACrD,SAAS;AAAA,IACP;AAAA,IACC,QAAoD;AAAA,EACvD;AAEF,QAAM,kBAAkB,CAAC,eAAe,QAAQ,eAAe;AAC/D,EAAM;AAAA,IACE;AAAA,MACJ,CAAC,kBACC,kBACI,SAAS,UAAU,cAAc,WAAW,aAAa,CAAC,IAC1D;AAAA,MACN,CAAC,UAAU,eAAe;AAAA,IAC5B;AAAA,IACA,MAAM,SAAS,iBAAiB;AAAA,IAChC,MAAM,SAAS,iBAAiB;AAAA,EAClC;AAEA,EAAM,gBAAU,MAAM;AACpB,aAAS;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,kBAAkB,SAAS,QAAQ,CAAC;AAExC,QAAM,0BAA0B,iBAAiB;AAAA,IAAK,CAAC,QAAQ,UAC7D,cAAc,iBAAiB,KAAK,GAAG,MAAM;AAAA,EAC/C;AAEA,QAAM,mBAAmB,0BACrB,iBAAiB,QAAQ,CAAC,QAAQ,UAAU;AAC1C,UAAM,OAAO,iBAAiB,KAAK;AAEnC,QAAI,QAAQ,cAAc,MAAM,MAAM,GAAG;AACvC,YAAM,gBAAgB,IAAI,cAAc,QAAQ,IAAI;AACpD,aAAO,gBAAgB,MAAM,eAAe,kBAAkB;AAAA,IAChE;AACA,WAAO,CAAC;AAAA,EACV,CAAC,IACD,CAAC;AAEL,MAAI,iBAAiB,SAAS,GAAG;AAC/B,UAAM,QAAQ,IAAI,gBAAgB;AAAA,EACpC;AACA,QAAM,oCAAoC,iBAAiB;AAAA,IACzD,CAAC,QAAQ,UAAU;AACjB,YAAM,QAAQ,iBAAiB,KAAK;AACpC,aACE,SACA,YAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA,cAAc,MAAM;AAAA,QACpB,OAAO,OAAO,cAAc,EAAE,IAAI,MAAM,SAAS;AAAA,QACjD,UAAU,MAAM;AAAA,MAClB,CAAC;AAAA,IAEL;AAAA,EACF;AAEA,MAAI,mCAAmC,OAAO;AAC5C,UAAM,kCAAkC;AAAA,EAC1C;AAEA,SAAO,kBAAkB,YAAY,CAAC;AACxC;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useQuery.ts | ||
| var useQuery_exports = {}; | ||
| __export(useQuery_exports, { | ||
| useQuery: () => useQuery | ||
| }); | ||
| module.exports = __toCommonJS(useQuery_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useBaseQuery = require("./useBaseQuery.cjs"); | ||
| function useQuery(options, queryClient) { | ||
| return (0, import_useBaseQuery.useBaseQuery)(options, import_query_core.QueryObserver, queryClient); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useQuery | ||
| }); | ||
| //# sourceMappingURL=useQuery.cjs.map |
| {"version":3,"sources":["../../src/useQuery.ts"],"sourcesContent":["'use client'\nimport { QueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n NoInfer,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n} from './queryOptions'\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): DefinedUseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery(options: UseQueryOptions, queryClient?: QueryClient) {\n return useBaseQuery(options, QueryObserver, queryClient)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA8B;AAC9B,0BAA6B;AA+CtB,SAAS,SAAS,SAA0B,aAA2B;AAC5E,aAAO,kCAAa,SAAS,iCAAe,WAAW;AACzD;","names":[]} |
| export { useQuery_alias_1 as useQuery } from './_tsup-dts-rollup.cjs'; |
| export { useQuery_alias_1 as useQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useQuery.ts | ||
| import { QueryObserver } from "@tanstack/query-core"; | ||
| import { useBaseQuery } from "./useBaseQuery.js"; | ||
| function useQuery(options, queryClient) { | ||
| return useBaseQuery(options, QueryObserver, queryClient); | ||
| } | ||
| export { | ||
| useQuery | ||
| }; | ||
| //# sourceMappingURL=useQuery.js.map |
| {"version":3,"sources":["../../src/useQuery.ts"],"sourcesContent":["'use client'\nimport { QueryObserver } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport type {\n DefaultError,\n NoInfer,\n QueryClient,\n QueryKey,\n} from '@tanstack/query-core'\nimport type {\n DefinedUseQueryResult,\n UseQueryOptions,\n UseQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataOptions,\n UndefinedInitialDataOptions,\n} from './queryOptions'\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): DefinedUseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseQueryResult<NoInfer<TData>, TError>\n\nexport function useQuery(options: UseQueryOptions, queryClient?: QueryClient) {\n return useBaseQuery(options, QueryObserver, queryClient)\n}\n"],"mappings":";;;AACA,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AA+CtB,SAAS,SAAS,SAA0B,aAA2B;AAC5E,SAAO,aAAa,SAAS,eAAe,WAAW;AACzD;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useSuspenseInfiniteQuery.ts | ||
| var useSuspenseInfiniteQuery_exports = {}; | ||
| __export(useSuspenseInfiniteQuery_exports, { | ||
| useSuspenseInfiniteQuery: () => useSuspenseInfiniteQuery | ||
| }); | ||
| module.exports = __toCommonJS(useSuspenseInfiniteQuery_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useBaseQuery = require("./useBaseQuery.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useSuspenseInfiniteQuery(options, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (options.queryFn === import_query_core.skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseInfiniteQuery"); | ||
| } | ||
| } | ||
| return (0, import_useBaseQuery.useBaseQuery)( | ||
| { | ||
| ...options, | ||
| enabled: true, | ||
| suspense: true, | ||
| throwOnError: import_suspense.defaultThrowOnError | ||
| }, | ||
| import_query_core.InfiniteQueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useSuspenseInfiniteQuery | ||
| }); | ||
| //# sourceMappingURL=useSuspenseInfiniteQuery.cjs.map |
| {"version":3,"sources":["../../src/useSuspenseInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver, skipToken } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport { defaultThrowOnError } from './suspense'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverSuccessResult,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n UseSuspenseInfiniteQueryOptions,\n UseSuspenseInfiniteQueryResult,\n} from './types'\n\nexport function useSuspenseInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UseSuspenseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseSuspenseInfiniteQueryResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if ((options.queryFn as any) === skipToken) {\n console.error('skipToken is not allowed for useSuspenseInfiniteQuery')\n }\n }\n\n return useBaseQuery(\n {\n ...options,\n enabled: true,\n suspense: true,\n throwOnError: defaultThrowOnError,\n },\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n ) as InfiniteQueryObserverSuccessResult<TData, TError>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAiD;AACjD,0BAA6B;AAC7B,sBAAoC;AAc7B,SAAS,yBAOd,SAOA,aAC+C;AAC/C,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAK,QAAQ,YAAoB,6BAAW;AAC1C,cAAQ,MAAM,uDAAuD;AAAA,IACvE;AAAA,EACF;AAEA,aAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| export { useSuspenseInfiniteQuery_alias_1 as useSuspenseInfiniteQuery } from './_tsup-dts-rollup.cjs'; |
| export { useSuspenseInfiniteQuery_alias_1 as useSuspenseInfiniteQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useSuspenseInfiniteQuery.ts | ||
| import { InfiniteQueryObserver, skipToken } from "@tanstack/query-core"; | ||
| import { useBaseQuery } from "./useBaseQuery.js"; | ||
| import { defaultThrowOnError } from "./suspense.js"; | ||
| function useSuspenseInfiniteQuery(options, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (options.queryFn === skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseInfiniteQuery"); | ||
| } | ||
| } | ||
| return useBaseQuery( | ||
| { | ||
| ...options, | ||
| enabled: true, | ||
| suspense: true, | ||
| throwOnError: defaultThrowOnError | ||
| }, | ||
| InfiniteQueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| export { | ||
| useSuspenseInfiniteQuery | ||
| }; | ||
| //# sourceMappingURL=useSuspenseInfiniteQuery.js.map |
| {"version":3,"sources":["../../src/useSuspenseInfiniteQuery.ts"],"sourcesContent":["'use client'\nimport { InfiniteQueryObserver, skipToken } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport { defaultThrowOnError } from './suspense'\nimport type {\n DefaultError,\n InfiniteData,\n InfiniteQueryObserverSuccessResult,\n QueryClient,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n UseSuspenseInfiniteQueryOptions,\n UseSuspenseInfiniteQueryResult,\n} from './types'\n\nexport function useSuspenseInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UseSuspenseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseSuspenseInfiniteQueryResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if ((options.queryFn as any) === skipToken) {\n console.error('skipToken is not allowed for useSuspenseInfiniteQuery')\n }\n }\n\n return useBaseQuery(\n {\n ...options,\n enabled: true,\n suspense: true,\n throwOnError: defaultThrowOnError,\n },\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n ) as InfiniteQueryObserverSuccessResult<TData, TError>\n}\n"],"mappings":";;;AACA,SAAS,uBAAuB,iBAAiB;AACjD,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAc7B,SAAS,yBAOd,SAOA,aAC+C;AAC/C,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAK,QAAQ,YAAoB,WAAW;AAC1C,cAAQ,MAAM,uDAAuD;AAAA,IACvE;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useSuspenseQueries.ts | ||
| var useSuspenseQueries_exports = {}; | ||
| __export(useSuspenseQueries_exports, { | ||
| useSuspenseQueries: () => useSuspenseQueries | ||
| }); | ||
| module.exports = __toCommonJS(useSuspenseQueries_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useQueries = require("./useQueries.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useSuspenseQueries(options, queryClient) { | ||
| return (0, import_useQueries.useQueries)( | ||
| { | ||
| ...options, | ||
| queries: options.queries.map((query) => { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (query.queryFn === import_query_core.skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseQueries"); | ||
| } | ||
| } | ||
| return { | ||
| ...query, | ||
| suspense: true, | ||
| throwOnError: import_suspense.defaultThrowOnError, | ||
| enabled: true, | ||
| placeholderData: void 0 | ||
| }; | ||
| }) | ||
| }, | ||
| queryClient | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useSuspenseQueries | ||
| }); | ||
| //# sourceMappingURL=useSuspenseQueries.cjs.map |
| {"version":3,"sources":["../../src/useSuspenseQueries.ts"],"sourcesContent":["'use client'\nimport { skipToken } from '@tanstack/query-core'\nimport { useQueries } from './useQueries'\nimport { defaultThrowOnError } from './suspense'\nimport type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types'\nimport type {\n DefaultError,\n QueryClient,\n QueryFunction,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetUseSuspenseQueryOptions<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? UseSuspenseQueryOptions<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseSuspenseQueryOptions<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseSuspenseQueryOptions<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? UseSuspenseQueryOptions<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? UseSuspenseQueryOptions<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseSuspenseQueryOptions<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n : T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryOptions<\n TQueryFnData,\n TError,\n TQueryFnData,\n TQueryKey\n >\n : // Fallback\n UseSuspenseQueryOptions\n\ntype GetUseSuspenseQueryResult<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? UseSuspenseQueryResult<TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseSuspenseQueryResult<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseSuspenseQueryResult<TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? UseSuspenseQueryResult<TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? UseSuspenseQueryResult<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseSuspenseQueryResult<TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryResult<\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryResult<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n UseSuspenseQueryResult\n\n/**\n * SuspenseQueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n */\nexport type SuspenseQueriesOptions<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseSuspenseQueryOptions>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseSuspenseQueryOptions<Head>]\n : T extends [infer Head, ...infer Tails]\n ? SuspenseQueriesOptions<\n [...Tails],\n [...TResults, GetUseSuspenseQueryOptions<Head>],\n [...TDepth, 1]\n >\n : Array<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n UseSuspenseQueryOptions<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>\n >\n : // Fallback\n Array<UseSuspenseQueryOptions>\n\n/**\n * SuspenseQueriesResults reducer recursively maps type param to results\n */\nexport type SuspenseQueriesResults<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseSuspenseQueryResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseSuspenseQueryResult<Head>]\n : T extends [infer Head, ...infer Tails]\n ? SuspenseQueriesResults<\n [...Tails],\n [...TResults, GetUseSuspenseQueryResult<Head>],\n [...TDepth, 1]\n >\n : { [K in keyof T]: GetUseSuspenseQueryResult<T[K]> }\n\nexport function useSuspenseQueries<\n T extends Array<any>,\n TCombinedResult = SuspenseQueriesResults<T>,\n>(\n options: {\n queries:\n | readonly [...SuspenseQueriesOptions<T>]\n | readonly [...{ [K in keyof T]: GetUseSuspenseQueryOptions<T[K]> }]\n combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult\n },\n queryClient?: QueryClient,\n): TCombinedResult\n\nexport function useSuspenseQueries<\n T extends Array<any>,\n TCombinedResult = SuspenseQueriesResults<T>,\n>(\n options: {\n queries: readonly [...SuspenseQueriesOptions<T>]\n combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult\n },\n queryClient?: QueryClient,\n): TCombinedResult\n\nexport function useSuspenseQueries(options: any, queryClient?: QueryClient) {\n return useQueries(\n {\n ...options,\n queries: options.queries.map((query: any) => {\n if (process.env.NODE_ENV !== 'production') {\n if (query.queryFn === skipToken) {\n console.error('skipToken is not allowed for useSuspenseQueries')\n }\n }\n\n return {\n ...query,\n suspense: true,\n throwOnError: defaultThrowOnError,\n enabled: true,\n placeholderData: undefined,\n }\n }),\n },\n queryClient,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0B;AAC1B,wBAA2B;AAC3B,sBAAoC;AAyL7B,SAAS,mBAAmB,SAAc,aAA2B;AAC1E,aAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS,QAAQ,QAAQ,IAAI,CAAC,UAAe;AAC3C,YAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAI,MAAM,YAAY,6BAAW;AAC/B,oBAAQ,MAAM,iDAAiD;AAAA,UACjE;AAAA,QACF;AAEA,eAAO;AAAA,UACL,GAAG;AAAA,UACH,UAAU;AAAA,UACV,cAAc;AAAA,UACd,SAAS;AAAA,UACT,iBAAiB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| export { useSuspenseQueries_alias_1 as useSuspenseQueries } from './_tsup-dts-rollup.cjs'; | ||
| export { SuspenseQueriesOptions_alias_1 as SuspenseQueriesOptions } from './_tsup-dts-rollup.cjs'; | ||
| export { SuspenseQueriesResults_alias_1 as SuspenseQueriesResults } from './_tsup-dts-rollup.cjs'; |
| export { useSuspenseQueries_alias_1 as useSuspenseQueries } from './_tsup-dts-rollup.js'; | ||
| export { SuspenseQueriesOptions_alias_1 as SuspenseQueriesOptions } from './_tsup-dts-rollup.js'; | ||
| export { SuspenseQueriesResults_alias_1 as SuspenseQueriesResults } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useSuspenseQueries.ts | ||
| import { skipToken } from "@tanstack/query-core"; | ||
| import { useQueries } from "./useQueries.js"; | ||
| import { defaultThrowOnError } from "./suspense.js"; | ||
| function useSuspenseQueries(options, queryClient) { | ||
| return useQueries( | ||
| { | ||
| ...options, | ||
| queries: options.queries.map((query) => { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (query.queryFn === skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseQueries"); | ||
| } | ||
| } | ||
| return { | ||
| ...query, | ||
| suspense: true, | ||
| throwOnError: defaultThrowOnError, | ||
| enabled: true, | ||
| placeholderData: void 0 | ||
| }; | ||
| }) | ||
| }, | ||
| queryClient | ||
| ); | ||
| } | ||
| export { | ||
| useSuspenseQueries | ||
| }; | ||
| //# sourceMappingURL=useSuspenseQueries.js.map |
| {"version":3,"sources":["../../src/useSuspenseQueries.ts"],"sourcesContent":["'use client'\nimport { skipToken } from '@tanstack/query-core'\nimport { useQueries } from './useQueries'\nimport { defaultThrowOnError } from './suspense'\nimport type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types'\nimport type {\n DefaultError,\n QueryClient,\n QueryFunction,\n ThrowOnError,\n} from '@tanstack/query-core'\n\n// Avoid TS depth-limit error in case of large array literal\ntype MAXIMUM_DEPTH = 20\n\n// Widen the type of the symbol to enable type inference even if skipToken is not immutable.\ntype SkipTokenForUseQueries = symbol\n\ntype GetUseSuspenseQueryOptions<T> =\n // Part 1: responsible for applying explicit type parameter to function arguments, if object { queryFnData: TQueryFnData, error: TError, data: TData }\n T extends {\n queryFnData: infer TQueryFnData\n error?: infer TError\n data: infer TData\n }\n ? UseSuspenseQueryOptions<TQueryFnData, TError, TData>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseSuspenseQueryOptions<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseSuspenseQueryOptions<unknown, TError, TData>\n : // Part 2: responsible for applying explicit type parameter to function arguments, if tuple [TQueryFnData, TError, TData]\n T extends [infer TQueryFnData, infer TError, infer TData]\n ? UseSuspenseQueryOptions<TQueryFnData, TError, TData>\n : T extends [infer TQueryFnData, infer TError]\n ? UseSuspenseQueryOptions<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseSuspenseQueryOptions<TQueryFnData>\n : // Part 3: responsible for inferring and enforcing type if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey\n >\n : T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, infer TQueryKey>\n | SkipTokenForUseQueries\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryOptions<\n TQueryFnData,\n TError,\n TQueryFnData,\n TQueryKey\n >\n : // Fallback\n UseSuspenseQueryOptions\n\ntype GetUseSuspenseQueryResult<T> =\n // Part 1: responsible for mapping explicit type parameter to function result, if object\n T extends { queryFnData: any; error?: infer TError; data: infer TData }\n ? UseSuspenseQueryResult<TData, TError>\n : T extends { queryFnData: infer TQueryFnData; error?: infer TError }\n ? UseSuspenseQueryResult<TQueryFnData, TError>\n : T extends { data: infer TData; error?: infer TError }\n ? UseSuspenseQueryResult<TData, TError>\n : // Part 2: responsible for mapping explicit type parameter to function result, if tuple\n T extends [any, infer TError, infer TData]\n ? UseSuspenseQueryResult<TData, TError>\n : T extends [infer TQueryFnData, infer TError]\n ? UseSuspenseQueryResult<TQueryFnData, TError>\n : T extends [infer TQueryFnData]\n ? UseSuspenseQueryResult<TQueryFnData>\n : // Part 3: responsible for mapping inferred type to results, if no explicit parameter was provided\n T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n select?: (data: any) => infer TData\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryResult<\n unknown extends TData ? TQueryFnData : TData,\n unknown extends TError ? DefaultError : TError\n >\n : T extends {\n queryFn?:\n | QueryFunction<infer TQueryFnData, any>\n | SkipTokenForUseQueries\n throwOnError?: ThrowOnError<any, infer TError, any, any>\n }\n ? UseSuspenseQueryResult<\n TQueryFnData,\n unknown extends TError ? DefaultError : TError\n >\n : // Fallback\n UseSuspenseQueryResult\n\n/**\n * SuspenseQueriesOptions reducer recursively unwraps function arguments to infer/enforce type param\n */\nexport type SuspenseQueriesOptions<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseSuspenseQueryOptions>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseSuspenseQueryOptions<Head>]\n : T extends [infer Head, ...infer Tails]\n ? SuspenseQueriesOptions<\n [...Tails],\n [...TResults, GetUseSuspenseQueryOptions<Head>],\n [...TDepth, 1]\n >\n : Array<unknown> extends T\n ? T\n : // If T is *some* array but we couldn't assign unknown[] to it, then it must hold some known/homogenous type!\n // use this to infer the param types in the case of Array.map() argument\n T extends Array<\n UseSuspenseQueryOptions<\n infer TQueryFnData,\n infer TError,\n infer TData,\n infer TQueryKey\n >\n >\n ? Array<\n UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>\n >\n : // Fallback\n Array<UseSuspenseQueryOptions>\n\n/**\n * SuspenseQueriesResults reducer recursively maps type param to results\n */\nexport type SuspenseQueriesResults<\n T extends Array<any>,\n TResults extends Array<any> = [],\n TDepth extends ReadonlyArray<number> = [],\n> = TDepth['length'] extends MAXIMUM_DEPTH\n ? Array<UseSuspenseQueryResult>\n : T extends []\n ? []\n : T extends [infer Head]\n ? [...TResults, GetUseSuspenseQueryResult<Head>]\n : T extends [infer Head, ...infer Tails]\n ? SuspenseQueriesResults<\n [...Tails],\n [...TResults, GetUseSuspenseQueryResult<Head>],\n [...TDepth, 1]\n >\n : { [K in keyof T]: GetUseSuspenseQueryResult<T[K]> }\n\nexport function useSuspenseQueries<\n T extends Array<any>,\n TCombinedResult = SuspenseQueriesResults<T>,\n>(\n options: {\n queries:\n | readonly [...SuspenseQueriesOptions<T>]\n | readonly [...{ [K in keyof T]: GetUseSuspenseQueryOptions<T[K]> }]\n combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult\n },\n queryClient?: QueryClient,\n): TCombinedResult\n\nexport function useSuspenseQueries<\n T extends Array<any>,\n TCombinedResult = SuspenseQueriesResults<T>,\n>(\n options: {\n queries: readonly [...SuspenseQueriesOptions<T>]\n combine?: (result: SuspenseQueriesResults<T>) => TCombinedResult\n },\n queryClient?: QueryClient,\n): TCombinedResult\n\nexport function useSuspenseQueries(options: any, queryClient?: QueryClient) {\n return useQueries(\n {\n ...options,\n queries: options.queries.map((query: any) => {\n if (process.env.NODE_ENV !== 'production') {\n if (query.queryFn === skipToken) {\n console.error('skipToken is not allowed for useSuspenseQueries')\n }\n }\n\n return {\n ...query,\n suspense: true,\n throwOnError: defaultThrowOnError,\n enabled: true,\n placeholderData: undefined,\n }\n }),\n },\n queryClient,\n )\n}\n"],"mappings":";;;AACA,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AAyL7B,SAAS,mBAAmB,SAAc,aAA2B;AAC1E,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS,QAAQ,QAAQ,IAAI,CAAC,UAAe;AAC3C,YAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAI,MAAM,YAAY,WAAW;AAC/B,oBAAQ,MAAM,iDAAiD;AAAA,UACjE;AAAA,QACF;AAEA,eAAO;AAAA,UACL,GAAG;AAAA,UACH,UAAU;AAAA,UACV,cAAc;AAAA,UACd,SAAS;AAAA,UACT,iBAAiB;AAAA,QACnB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| "use strict"; | ||
| "use client"; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| // src/useSuspenseQuery.ts | ||
| var useSuspenseQuery_exports = {}; | ||
| __export(useSuspenseQuery_exports, { | ||
| useSuspenseQuery: () => useSuspenseQuery | ||
| }); | ||
| module.exports = __toCommonJS(useSuspenseQuery_exports); | ||
| var import_query_core = require("@tanstack/query-core"); | ||
| var import_useBaseQuery = require("./useBaseQuery.cjs"); | ||
| var import_suspense = require("./suspense.cjs"); | ||
| function useSuspenseQuery(options, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (options.queryFn === import_query_core.skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseQuery"); | ||
| } | ||
| } | ||
| return (0, import_useBaseQuery.useBaseQuery)( | ||
| { | ||
| ...options, | ||
| enabled: true, | ||
| suspense: true, | ||
| throwOnError: import_suspense.defaultThrowOnError, | ||
| placeholderData: void 0 | ||
| }, | ||
| import_query_core.QueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| useSuspenseQuery | ||
| }); | ||
| //# sourceMappingURL=useSuspenseQuery.cjs.map |
| {"version":3,"sources":["../../src/useSuspenseQuery.ts"],"sourcesContent":["'use client'\nimport { QueryObserver, skipToken } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport { defaultThrowOnError } from './suspense'\nimport type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\n\nexport function useSuspenseQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if ((options.queryFn as any) === skipToken) {\n console.error('skipToken is not allowed for useSuspenseQuery')\n }\n }\n\n return useBaseQuery(\n {\n ...options,\n enabled: true,\n suspense: true,\n throwOnError: defaultThrowOnError,\n placeholderData: undefined,\n },\n QueryObserver,\n queryClient,\n ) as UseSuspenseQueryResult<TData, TError>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAyC;AACzC,0BAA6B;AAC7B,sBAAoC;AAI7B,SAAS,iBAMd,SACA,aACuC;AACvC,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAK,QAAQ,YAAoB,6BAAW;AAC1C,cAAQ,MAAM,+CAA+C;AAAA,IAC/D;AAAA,EACF;AAEA,aAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,cAAc;AAAA,MACd,iBAAiB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| export { useSuspenseQuery_alias_1 as useSuspenseQuery } from './_tsup-dts-rollup.cjs'; |
| export { useSuspenseQuery_alias_1 as useSuspenseQuery } from './_tsup-dts-rollup.js'; |
| "use client"; | ||
| // src/useSuspenseQuery.ts | ||
| import { QueryObserver, skipToken } from "@tanstack/query-core"; | ||
| import { useBaseQuery } from "./useBaseQuery.js"; | ||
| import { defaultThrowOnError } from "./suspense.js"; | ||
| function useSuspenseQuery(options, queryClient) { | ||
| if (process.env.NODE_ENV !== "production") { | ||
| if (options.queryFn === skipToken) { | ||
| console.error("skipToken is not allowed for useSuspenseQuery"); | ||
| } | ||
| } | ||
| return useBaseQuery( | ||
| { | ||
| ...options, | ||
| enabled: true, | ||
| suspense: true, | ||
| throwOnError: defaultThrowOnError, | ||
| placeholderData: void 0 | ||
| }, | ||
| QueryObserver, | ||
| queryClient | ||
| ); | ||
| } | ||
| export { | ||
| useSuspenseQuery | ||
| }; | ||
| //# sourceMappingURL=useSuspenseQuery.js.map |
| {"version":3,"sources":["../../src/useSuspenseQuery.ts"],"sourcesContent":["'use client'\nimport { QueryObserver, skipToken } from '@tanstack/query-core'\nimport { useBaseQuery } from './useBaseQuery'\nimport { defaultThrowOnError } from './suspense'\nimport type { UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types'\nimport type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'\n\nexport function useSuspenseQuery<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UseSuspenseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n queryClient?: QueryClient,\n): UseSuspenseQueryResult<TData, TError> {\n if (process.env.NODE_ENV !== 'production') {\n if ((options.queryFn as any) === skipToken) {\n console.error('skipToken is not allowed for useSuspenseQuery')\n }\n }\n\n return useBaseQuery(\n {\n ...options,\n enabled: true,\n suspense: true,\n throwOnError: defaultThrowOnError,\n placeholderData: undefined,\n },\n QueryObserver,\n queryClient,\n ) as UseSuspenseQueryResult<TData, TError>\n}\n"],"mappings":";;;AACA,SAAS,eAAe,iBAAiB;AACzC,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AAI7B,SAAS,iBAMd,SACA,aACuC;AACvC,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAK,QAAQ,YAAoB,WAAW;AAC1C,cAAQ,MAAM,+CAA+C;AAAA,IAC/D;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,MACE,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU;AAAA,MACV,cAAc;AAAA,MACd,iBAAiB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]} |
| // @ts-check | ||
| import rootConfig from './root.eslint.config.js' | ||
| export default [ | ||
| ...rootConfig, | ||
| { | ||
| rules: { | ||
| 'cspell/spellchecker': 'off', | ||
| '@typescript-eslint/no-unnecessary-condition': 'off', | ||
| 'import/no-duplicates': 'off', | ||
| 'import/no-unresolved': 'off', | ||
| 'import/order': 'off', | ||
| 'no-shadow': 'off', | ||
| 'sort-imports': 'off', | ||
| }, | ||
| }, | ||
| ] |
| { | ||
| "name": "@tanstack/query-codemods", | ||
| "private": true, | ||
| "description": "Collection of codemods to make the migration easier.", | ||
| "author": "Balázs Máté Petró", | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/TanStack/query.git", | ||
| "directory": "packages/query-codemods" | ||
| }, | ||
| "homepage": "https://tanstack.com/query", | ||
| "funding": { | ||
| "type": "github", | ||
| "url": "https://github.com/sponsors/tannerlinsley" | ||
| }, | ||
| "scripts": { | ||
| "clean": "premove ./coverage ./dist-ts", | ||
| "test:eslint": "eslint --concurrency=auto ./src", | ||
| "test:lib": "vitest", | ||
| "test:lib:dev": "pnpm run test:lib --watch" | ||
| }, | ||
| "type": "module", | ||
| "exports": { | ||
| "./package.json": "./package.json" | ||
| }, | ||
| "sideEffects": false, | ||
| "files": [ | ||
| "src", | ||
| "!src/jest.config.js", | ||
| "!src/**/__testfixtures__", | ||
| "!src/**/__tests__" | ||
| ], | ||
| "devDependencies": { | ||
| "@types/jscodeshift": "17.3.0", | ||
| "jscodeshift": "17.3.0" | ||
| } | ||
| } |
| // @ts-check | ||
| // @ts-ignore Needed due to moduleResolution Node vs Bundler | ||
| import { tanstackConfig } from '@tanstack/eslint-config' | ||
| import pluginCspell from '@cspell/eslint-plugin' | ||
| import vitest from '@vitest/eslint-plugin' | ||
| export default [ | ||
| ...tanstackConfig, | ||
| { | ||
| name: 'tanstack/temp', | ||
| plugins: { | ||
| cspell: pluginCspell, | ||
| }, | ||
| rules: { | ||
| 'cspell/spellchecker': [ | ||
| 'warn', | ||
| { | ||
| cspell: { | ||
| words: [ | ||
| 'Promisable', // Our public interface | ||
| 'TSES', // @typescript-eslint package's interface | ||
| 'codemod', // We support our codemod | ||
| 'combinate', // Library name | ||
| 'datatag', // Query options tagging | ||
| 'extralight', // Our public interface | ||
| 'jscodeshift', | ||
| 'refetches', // Query refetch operations | ||
| 'retryer', // Our public interface | ||
| 'solidjs', // Our target framework | ||
| 'tabular-nums', // https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric | ||
| 'tanstack', // Our package scope | ||
| 'todos', // Too general word to be caught as error | ||
| 'tsqd', // Our public interface (TanStack Query Devtools shorthand) | ||
| 'tsup', // We use tsup as builder | ||
| 'typecheck', // Field of vite.config.ts | ||
| 'vue-demi', // dependency of @tanstack/vue-query | ||
| 'ɵkind', // Angular specific | ||
| 'ɵproviders', // Angular specific | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| '@typescript-eslint/no-empty-function': 'off', | ||
| '@typescript-eslint/no-unsafe-function-type': 'off', | ||
| 'no-case-declarations': 'off', | ||
| 'prefer-const': 'off', | ||
| }, | ||
| }, | ||
| { | ||
| files: ['**/*.spec.ts*', '**/*.test.ts*', '**/*.test-d.ts*'], | ||
| plugins: { vitest }, | ||
| rules: { | ||
| ...vitest.configs.recommended.rules, | ||
| 'vitest/no-standalone-expect': [ | ||
| 'error', | ||
| { | ||
| additionalTestBlockFunctions: ['testIf'], | ||
| }, | ||
| ], | ||
| }, | ||
| settings: { vitest: { typecheck: true } }, | ||
| }, | ||
| ] |
| { | ||
| "extends": "../../tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "./dist-ts", | ||
| "rootDir": "." | ||
| }, | ||
| "include": ["src", "*.config.*", "package.json"] | ||
| } |
| import { defineConfig } from 'vitest/config' | ||
| import packageJson from './package.json' | ||
| export default defineConfig({ | ||
| // fix from https://github.com/vitest-dev/vitest/issues/6992#issuecomment-2509408660 | ||
| resolve: { | ||
| conditions: ['@tanstack/custom-condition'], | ||
| }, | ||
| environments: { | ||
| ssr: { | ||
| resolve: { | ||
| conditions: ['@tanstack/custom-condition'], | ||
| }, | ||
| }, | ||
| }, | ||
| test: { | ||
| name: packageJson.name, | ||
| dir: './src', | ||
| watch: false, | ||
| globals: true, | ||
| coverage: { | ||
| enabled: true, | ||
| provider: 'istanbul', | ||
| include: ['src/**/*.{js,ts,cjs,mjs,jsx,tsx}'], | ||
| }, | ||
| typecheck: { enabled: true }, | ||
| restoreMocks: true, | ||
| }, | ||
| }) |
+3
-3
| { | ||
| "name": "@tanstack/react-query", | ||
| "version": "5.94.4", | ||
| "version": "5.94.5", | ||
| "description": "Hooks for managing, caching and syncing asynchronous and remote data in React", | ||
@@ -47,3 +47,3 @@ "author": "tannerlinsley", | ||
| "dependencies": { | ||
| "@tanstack/query-core": "5.94.4" | ||
| "@tanstack/query-core": "5.94.5" | ||
| }, | ||
@@ -61,3 +61,3 @@ "devDependencies": { | ||
| "react-error-boundary": "^4.1.2", | ||
| "@tanstack/query-persist-client-core": "5.94.4", | ||
| "@tanstack/query-persist-client-core": "5.94.5", | ||
| "@tanstack/query-test-utils": "0.0.0" | ||
@@ -64,0 +64,0 @@ }, |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
861967
1148.72%329
1165.38%10062
421.35%28
366.67%+ Added
- Removed
Updated