Initial commit
This commit is contained in:
208
node_modules/@tanstack/react-query/build/codemods/src/utils/index.cjs
generated
vendored
Normal file
208
node_modules/@tanstack/react-query/build/codemods/src/utils/index.cjs
generated
vendored
Normal file
@ -0,0 +1,208 @@
|
||||
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,
|
||||
},
|
||||
}
|
||||
}
|
||||
124
node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/query-cache-transformer.cjs
generated
vendored
Normal file
124
node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/query-cache-transformer.cjs
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
53
node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/query-client-transformer.cjs
generated
vendored
Normal file
53
node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/query-client-transformer.cjs
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
38
node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/use-query-like-transformer.cjs
generated
vendored
Normal file
38
node_modules/@tanstack/react-query/build/codemods/src/utils/transformers/use-query-like-transformer.cjs
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
181
node_modules/@tanstack/react-query/build/codemods/src/v4/key-transformation.cjs
generated
vendored
Normal file
181
node_modules/@tanstack/react-query/build/codemods/src/v4/key-transformation.cjs
generated
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
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' })
|
||||
}
|
||||
25
node_modules/@tanstack/react-query/build/codemods/src/v4/replace-import-specifier.cjs
generated
vendored
Normal file
25
node_modules/@tanstack/react-query/build/codemods/src/v4/replace-import-specifier.cjs
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
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' })
|
||||
}
|
||||
164
node_modules/@tanstack/react-query/build/codemods/src/v4/utils/replacers/key-replacer.cjs
generated
vendored
Normal file
164
node_modules/@tanstack/react-query/build/codemods/src/v4/utils/replacers/key-replacer.cjs
generated
vendored
Normal file
@ -0,0 +1,164 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
244
node_modules/@tanstack/react-query/build/codemods/src/v5/is-loading/is-loading.cjs
generated
vendored
Normal file
244
node_modules/@tanstack/react-query/build/codemods/src/v5/is-loading/is-loading.cjs
generated
vendored
Normal file
@ -0,0 +1,244 @@
|
||||
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' })
|
||||
}
|
||||
32
node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/README.md
generated
vendored
Normal file
32
node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/README.md
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
### 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.
|
||||
271
node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/keep-previous-data.cjs
generated
vendored
Normal file
271
node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/keep-previous-data.cjs
generated
vendored
Normal file
@ -0,0 +1,271 @@
|
||||
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' })
|
||||
}
|
||||
26
node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/utils/already-has-placeholder-data-property.cjs
generated
vendored
Normal file
26
node_modules/@tanstack/react-query/build/codemods/src/v5/keep-previous-data/utils/already-has-placeholder-data-property.cjs
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
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 a "placeholderData" property. Please migrate this usage manually.`
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = AlreadyHasPlaceholderDataProperty
|
||||
58
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/remove-overloads.cjs
generated
vendored
Normal file
58
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/remove-overloads.cjs
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
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' })
|
||||
}
|
||||
271
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/transformers/filter-aware-usage-transformer.cjs
generated
vendored
Normal file
271
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/transformers/filter-aware-usage-transformer.cjs
generated
vendored
Normal file
@ -0,0 +1,271 @@
|
||||
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
|
||||
185
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs
generated
vendored
Normal file
185
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/transformers/query-fn-aware-usage-transformer.cjs
generated
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
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
|
||||
123
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/utils/index.cjs
generated
vendored
Normal file
123
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/utils/index.cjs
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
27
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/utils/unknown-usage-error.cjs
generated
vendored
Normal file
27
node_modules/@tanstack/react-query/build/codemods/src/v5/remove-overloads/utils/unknown-usage-error.cjs
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
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
|
||||
55
node_modules/@tanstack/react-query/build/codemods/src/v5/rename-hydrate/rename-hydrate.cjs
generated
vendored
Normal file
55
node_modules/@tanstack/react-query/build/codemods/src/v5/rename-hydrate/rename-hydrate.cjs
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
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' })
|
||||
}
|
||||
41
node_modules/@tanstack/react-query/build/codemods/src/v5/rename-properties/rename-properties.cjs
generated
vendored
Normal file
41
node_modules/@tanstack/react-query/build/codemods/src/v5/rename-properties/rename-properties.cjs
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
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' })
|
||||
}
|
||||
95
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.cjs
generated
vendored
Normal file
95
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.cjs
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
"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 [hydrationQueue, setHydrationQueue] = React.useState();
|
||||
const optionsRef = React.useRef(options);
|
||||
optionsRef.current = options;
|
||||
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;
|
||||
const queryAlreadyQueued = hydrationQueue == null ? void 0 : hydrationQueue.find(
|
||||
(query) => query.queryHash === dehydratedQuery.queryHash
|
||||
);
|
||||
if (hydrationIsNewer && (!queryAlreadyQueued || dehydratedQuery.state.dataUpdatedAt > queryAlreadyQueued.state.dataUpdatedAt)) {
|
||||
existingQueries.push(dehydratedQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newQueries.length > 0) {
|
||||
(0, import_query_core.hydrate)(client, { queries: newQueries }, optionsRef.current);
|
||||
}
|
||||
if (existingQueries.length > 0) {
|
||||
setHydrationQueue(
|
||||
(prev) => prev ? [...prev, ...existingQueries] : existingQueries
|
||||
);
|
||||
}
|
||||
}
|
||||
}, [client, hydrationQueue, state]);
|
||||
React.useEffect(() => {
|
||||
if (hydrationQueue) {
|
||||
(0, import_query_core.hydrate)(client, { queries: hydrationQueue }, optionsRef.current);
|
||||
setHydrationQueue(void 0);
|
||||
}
|
||||
}, [client, hydrationQueue]);
|
||||
return children;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
HydrationBoundary
|
||||
});
|
||||
//# sourceMappingURL=HydrationBoundary.cjs.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.d.cts
generated
vendored
Normal file
14
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.d.cts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { OmitKeyof, HydrateOptions, QueryClient } from '@tanstack/query-core';
|
||||
|
||||
interface HydrationBoundaryProps {
|
||||
state?: unknown;
|
||||
options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {
|
||||
defaultOptions?: OmitKeyof<Exclude<HydrateOptions['defaultOptions'], undefined>, 'mutations'>;
|
||||
};
|
||||
children?: React.ReactNode;
|
||||
queryClient?: QueryClient;
|
||||
}
|
||||
declare const HydrationBoundary: ({ children, options, state, queryClient, }: HydrationBoundaryProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
||||
|
||||
export { HydrationBoundary, type HydrationBoundaryProps };
|
||||
14
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.d.ts
generated
vendored
Normal file
14
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { OmitKeyof, HydrateOptions, QueryClient } from '@tanstack/query-core';
|
||||
|
||||
interface HydrationBoundaryProps {
|
||||
state?: unknown;
|
||||
options?: OmitKeyof<HydrateOptions, 'defaultOptions'> & {
|
||||
defaultOptions?: OmitKeyof<Exclude<HydrateOptions['defaultOptions'], undefined>, 'mutations'>;
|
||||
};
|
||||
children?: React.ReactNode;
|
||||
queryClient?: QueryClient;
|
||||
}
|
||||
declare const HydrationBoundary: ({ children, options, state, queryClient, }: HydrationBoundaryProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
||||
|
||||
export { HydrationBoundary, type HydrationBoundaryProps };
|
||||
61
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.js
generated
vendored
Normal file
61
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.js
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
"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 [hydrationQueue, setHydrationQueue] = React.useState();
|
||||
const optionsRef = React.useRef(options);
|
||||
optionsRef.current = options;
|
||||
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;
|
||||
const queryAlreadyQueued = hydrationQueue == null ? void 0 : hydrationQueue.find(
|
||||
(query) => query.queryHash === dehydratedQuery.queryHash
|
||||
);
|
||||
if (hydrationIsNewer && (!queryAlreadyQueued || dehydratedQuery.state.dataUpdatedAt > queryAlreadyQueued.state.dataUpdatedAt)) {
|
||||
existingQueries.push(dehydratedQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newQueries.length > 0) {
|
||||
hydrate(client, { queries: newQueries }, optionsRef.current);
|
||||
}
|
||||
if (existingQueries.length > 0) {
|
||||
setHydrationQueue(
|
||||
(prev) => prev ? [...prev, ...existingQueries] : existingQueries
|
||||
);
|
||||
}
|
||||
}
|
||||
}, [client, hydrationQueue, state]);
|
||||
React.useEffect(() => {
|
||||
if (hydrationQueue) {
|
||||
hydrate(client, { queries: hydrationQueue }, optionsRef.current);
|
||||
setHydrationQueue(void 0);
|
||||
}
|
||||
}, [client, hydrationQueue]);
|
||||
return children;
|
||||
};
|
||||
export {
|
||||
HydrationBoundary
|
||||
};
|
||||
//# sourceMappingURL=HydrationBoundary.js.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/HydrationBoundary.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
72
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.cjs
generated
vendored
Normal file
72
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.cjs
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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":[]}
|
||||
12
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.d.cts
generated
vendored
Normal file
12
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.d.cts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { QueryClient } from '@tanstack/query-core';
|
||||
|
||||
declare const QueryClientContext: React.Context<QueryClient | undefined>;
|
||||
declare const useQueryClient: (queryClient?: QueryClient) => QueryClient;
|
||||
type QueryClientProviderProps = {
|
||||
client: QueryClient;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
declare const QueryClientProvider: ({ client, children, }: QueryClientProviderProps) => React.JSX.Element;
|
||||
|
||||
export { QueryClientContext, QueryClientProvider, type QueryClientProviderProps, useQueryClient };
|
||||
12
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.d.ts
generated
vendored
Normal file
12
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { QueryClient } from '@tanstack/query-core';
|
||||
|
||||
declare const QueryClientContext: React.Context<QueryClient | undefined>;
|
||||
declare const useQueryClient: (queryClient?: QueryClient) => QueryClient;
|
||||
type QueryClientProviderProps = {
|
||||
client: QueryClient;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
declare const QueryClientProvider: ({ client, children, }: QueryClientProviderProps) => React.JSX.Element;
|
||||
|
||||
export { QueryClientContext, QueryClientProvider, type QueryClientProviderProps, useQueryClient };
|
||||
36
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.js
generated
vendored
Normal file
36
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.js
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/QueryClientProvider.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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":[]}
|
||||
67
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.cjs
generated
vendored
Normal file
67
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.cjs
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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":[]}
|
||||
19
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.d.cts
generated
vendored
Normal file
19
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.d.cts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import * as react_jsx_runtime from 'react/jsx-runtime';
|
||||
import * as React from 'react';
|
||||
|
||||
type QueryErrorResetFunction = () => void;
|
||||
type QueryErrorIsResetFunction = () => boolean;
|
||||
type QueryErrorClearResetFunction = () => void;
|
||||
interface QueryErrorResetBoundaryValue {
|
||||
clearReset: QueryErrorClearResetFunction;
|
||||
isReset: QueryErrorIsResetFunction;
|
||||
reset: QueryErrorResetFunction;
|
||||
}
|
||||
declare const useQueryErrorResetBoundary: () => QueryErrorResetBoundaryValue;
|
||||
type QueryErrorResetBoundaryFunction = (value: QueryErrorResetBoundaryValue) => React.ReactNode;
|
||||
interface QueryErrorResetBoundaryProps {
|
||||
children: QueryErrorResetBoundaryFunction | React.ReactNode;
|
||||
}
|
||||
declare const QueryErrorResetBoundary: ({ children, }: QueryErrorResetBoundaryProps) => react_jsx_runtime.JSX.Element;
|
||||
|
||||
export { type QueryErrorClearResetFunction, type QueryErrorIsResetFunction, QueryErrorResetBoundary, type QueryErrorResetBoundaryFunction, type QueryErrorResetBoundaryProps, type QueryErrorResetBoundaryValue, type QueryErrorResetFunction, useQueryErrorResetBoundary };
|
||||
19
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.d.ts
generated
vendored
Normal file
19
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import * as react_jsx_runtime from 'react/jsx-runtime';
|
||||
import * as React from 'react';
|
||||
|
||||
type QueryErrorResetFunction = () => void;
|
||||
type QueryErrorIsResetFunction = () => boolean;
|
||||
type QueryErrorClearResetFunction = () => void;
|
||||
interface QueryErrorResetBoundaryValue {
|
||||
clearReset: QueryErrorClearResetFunction;
|
||||
isReset: QueryErrorIsResetFunction;
|
||||
reset: QueryErrorResetFunction;
|
||||
}
|
||||
declare const useQueryErrorResetBoundary: () => QueryErrorResetBoundaryValue;
|
||||
type QueryErrorResetBoundaryFunction = (value: QueryErrorResetBoundaryValue) => React.ReactNode;
|
||||
interface QueryErrorResetBoundaryProps {
|
||||
children: QueryErrorResetBoundaryFunction | React.ReactNode;
|
||||
}
|
||||
declare const QueryErrorResetBoundary: ({ children, }: QueryErrorResetBoundaryProps) => react_jsx_runtime.JSX.Element;
|
||||
|
||||
export { type QueryErrorClearResetFunction, type QueryErrorIsResetFunction, QueryErrorResetBoundary, type QueryErrorResetBoundaryFunction, type QueryErrorResetBoundaryProps, type QueryErrorResetBoundaryValue, type QueryErrorResetFunction, useQueryErrorResetBoundary };
|
||||
32
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.js
generated
vendored
Normal file
32
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/QueryErrorResetBoundary.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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":[]}
|
||||
67
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.cjs
generated
vendored
Normal file
67
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.cjs
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
"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_utils = require("./utils.cjs");
|
||||
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
|
||||
if (options.suspense || options.throwOnError || options.experimental_prefetchInRender) {
|
||||
if (!errorResetBoundary.isReset()) {
|
||||
options.retryOnMount = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
var useClearResetErrorBoundary = (errorResetBoundary) => {
|
||||
React.useEffect(() => {
|
||||
errorResetBoundary.clearReset();
|
||||
}, [errorResetBoundary]);
|
||||
};
|
||||
var getHasError = ({
|
||||
result,
|
||||
errorResetBoundary,
|
||||
throwOnError,
|
||||
query
|
||||
}) => {
|
||||
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (0, import_utils.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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from './utils'\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) => {\n if (\n options.suspense ||\n options.throwOnError ||\n options.experimental_prefetchInRender\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}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n shouldThrowError(throwOnError, [result.error, query])\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,mBAAiC;AAU1B,IAAM,kCAAkC,CAO7C,SAOA,uBACG;AACH,MACE,QAAQ,YACR,QAAQ,gBACR,QAAQ,+BACR;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;AACF,MAKM;AACJ,SACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,aACA,+BAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAExD;","names":[]}
|
||||
15
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.d.cts
generated
vendored
Normal file
15
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.d.cts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { QueryKey, DefaultedQueryObserverOptions, QueryObserverResult, ThrowOnError, Query } from '@tanstack/query-core';
|
||||
import { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary.cjs';
|
||||
import 'react/jsx-runtime';
|
||||
import 'react';
|
||||
|
||||
declare const ensurePreventErrorBoundaryRetry: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue) => void;
|
||||
declare const useClearResetErrorBoundary: (errorResetBoundary: QueryErrorResetBoundaryValue) => void;
|
||||
declare const getHasError: <TData, TError, TQueryFnData, TQueryData, TQueryKey extends QueryKey>({ result, errorResetBoundary, throwOnError, query, }: {
|
||||
result: QueryObserverResult<TData, TError>;
|
||||
errorResetBoundary: QueryErrorResetBoundaryValue;
|
||||
throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>;
|
||||
query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined;
|
||||
}) => boolean | undefined;
|
||||
|
||||
export { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };
|
||||
15
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.d.ts
generated
vendored
Normal file
15
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import { QueryKey, DefaultedQueryObserverOptions, QueryObserverResult, ThrowOnError, Query } from '@tanstack/query-core';
|
||||
import { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary.js';
|
||||
import 'react/jsx-runtime';
|
||||
import 'react';
|
||||
|
||||
declare const ensurePreventErrorBoundaryRetry: <TQueryFnData, TError, TData, TQueryData, TQueryKey extends QueryKey>(options: DefaultedQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, errorResetBoundary: QueryErrorResetBoundaryValue) => void;
|
||||
declare const useClearResetErrorBoundary: (errorResetBoundary: QueryErrorResetBoundaryValue) => void;
|
||||
declare const getHasError: <TData, TError, TQueryFnData, TQueryData, TQueryKey extends QueryKey>({ result, errorResetBoundary, throwOnError, query, }: {
|
||||
result: QueryObserverResult<TData, TError>;
|
||||
errorResetBoundary: QueryErrorResetBoundaryValue;
|
||||
throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>;
|
||||
query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined;
|
||||
}) => boolean | undefined;
|
||||
|
||||
export { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };
|
||||
31
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.js
generated
vendored
Normal file
31
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
// src/errorBoundaryUtils.ts
|
||||
import * as React from "react";
|
||||
import { shouldThrowError } from "./utils.js";
|
||||
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
|
||||
if (options.suspense || options.throwOnError || options.experimental_prefetchInRender) {
|
||||
if (!errorResetBoundary.isReset()) {
|
||||
options.retryOnMount = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
var useClearResetErrorBoundary = (errorResetBoundary) => {
|
||||
React.useEffect(() => {
|
||||
errorResetBoundary.clearReset();
|
||||
}, [errorResetBoundary]);
|
||||
};
|
||||
var getHasError = ({
|
||||
result,
|
||||
errorResetBoundary,
|
||||
throwOnError,
|
||||
query
|
||||
}) => {
|
||||
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && shouldThrowError(throwOnError, [result.error, query]);
|
||||
};
|
||||
export {
|
||||
ensurePreventErrorBoundaryRetry,
|
||||
getHasError,
|
||||
useClearResetErrorBoundary
|
||||
};
|
||||
//# sourceMappingURL=errorBoundaryUtils.js.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/errorBoundaryUtils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from './utils'\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) => {\n if (\n options.suspense ||\n options.throwOnError ||\n options.experimental_prefetchInRender\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}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n shouldThrowError(throwOnError, [result.error, query])\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB,SAAS,wBAAwB;AAU1B,IAAM,kCAAkC,CAO7C,SAOA,uBACG;AACH,MACE,QAAQ,YACR,QAAQ,gBACR,QAAQ,+BACR;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;AACF,MAKM;AACJ,SACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,SACA,iBAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAExD;","names":[]}
|
||||
94
node_modules/@tanstack/react-query/build/legacy/index.cjs
generated
vendored
Normal file
94
node_modules/@tanstack/react-query/build/legacy/index.cjs
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
"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 src_exports = {};
|
||||
__export(src_exports, {
|
||||
HydrationBoundary: () => import_HydrationBoundary.HydrationBoundary,
|
||||
IsRestoringProvider: () => import_isRestoring.IsRestoringProvider,
|
||||
QueryClientContext: () => import_QueryClientProvider.QueryClientContext,
|
||||
QueryClientProvider: () => import_QueryClientProvider.QueryClientProvider,
|
||||
QueryErrorResetBoundary: () => import_QueryErrorResetBoundary.QueryErrorResetBoundary,
|
||||
infiniteQueryOptions: () => import_infiniteQueryOptions.infiniteQueryOptions,
|
||||
queryOptions: () => import_queryOptions.queryOptions,
|
||||
useInfiniteQuery: () => import_useInfiniteQuery.useInfiniteQuery,
|
||||
useIsFetching: () => import_useIsFetching.useIsFetching,
|
||||
useIsMutating: () => import_useMutationState.useIsMutating,
|
||||
useIsRestoring: () => import_isRestoring.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(src_exports);
|
||||
__reExport(src_exports, require("@tanstack/query-core"), module.exports);
|
||||
__reExport(src_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_useInfiniteQuery = require("./useInfiniteQuery.cjs");
|
||||
var import_isRestoring = require("./isRestoring.cjs");
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
HydrationBoundary,
|
||||
IsRestoringProvider,
|
||||
QueryClientContext,
|
||||
QueryClientProvider,
|
||||
QueryErrorResetBoundary,
|
||||
infiniteQueryOptions,
|
||||
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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/index.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/index.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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 { useInfiniteQuery } from './useInfiniteQuery'\nexport { useIsRestoring, IsRestoringProvider } from './isRestoring'\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;AAGA,wBAAc,iCAHd;AAMA,wBAAc,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,8BAAiC;AACjC,yBAAoD;","names":[]}
|
||||
21
node_modules/@tanstack/react-query/build/legacy/index.d.cts
generated
vendored
Normal file
21
node_modules/@tanstack/react-query/build/legacy/index.d.cts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
export * from '@tanstack/query-core';
|
||||
export { DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types.cjs';
|
||||
export { QueriesOptions, QueriesResults, useQueries } from './useQueries.cjs';
|
||||
export { useQuery } from './useQuery.cjs';
|
||||
export { useSuspenseQuery } from './useSuspenseQuery.cjs';
|
||||
export { useSuspenseInfiniteQuery } from './useSuspenseInfiniteQuery.cjs';
|
||||
export { SuspenseQueriesOptions, SuspenseQueriesResults, useSuspenseQueries } from './useSuspenseQueries.cjs';
|
||||
export { usePrefetchQuery } from './usePrefetchQuery.cjs';
|
||||
export { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery.cjs';
|
||||
export { DefinedInitialDataOptions, UndefinedInitialDataOptions, UnusedSkipTokenOptions, queryOptions } from './queryOptions.cjs';
|
||||
export { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions, UnusedSkipTokenInfiniteOptions, infiniteQueryOptions } from './infiniteQueryOptions.cjs';
|
||||
export { QueryClientContext, QueryClientProvider, QueryClientProviderProps, useQueryClient } from './QueryClientProvider.cjs';
|
||||
export { QueryErrorClearResetFunction, QueryErrorIsResetFunction, QueryErrorResetBoundary, QueryErrorResetBoundaryFunction, QueryErrorResetBoundaryProps, QueryErrorResetFunction, useQueryErrorResetBoundary } from './QueryErrorResetBoundary.cjs';
|
||||
export { HydrationBoundary, HydrationBoundaryProps } from './HydrationBoundary.cjs';
|
||||
export { useIsFetching } from './useIsFetching.cjs';
|
||||
export { useIsMutating, useMutationState } from './useMutationState.cjs';
|
||||
export { useMutation } from './useMutation.cjs';
|
||||
export { useInfiniteQuery } from './useInfiniteQuery.cjs';
|
||||
export { IsRestoringProvider, useIsRestoring } from './isRestoring.cjs';
|
||||
import 'react';
|
||||
import 'react/jsx-runtime';
|
||||
21
node_modules/@tanstack/react-query/build/legacy/index.d.ts
generated
vendored
Normal file
21
node_modules/@tanstack/react-query/build/legacy/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
export * from '@tanstack/query-core';
|
||||
export { DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult } from './types.js';
|
||||
export { QueriesOptions, QueriesResults, useQueries } from './useQueries.js';
|
||||
export { useQuery } from './useQuery.js';
|
||||
export { useSuspenseQuery } from './useSuspenseQuery.js';
|
||||
export { useSuspenseInfiniteQuery } from './useSuspenseInfiniteQuery.js';
|
||||
export { SuspenseQueriesOptions, SuspenseQueriesResults, useSuspenseQueries } from './useSuspenseQueries.js';
|
||||
export { usePrefetchQuery } from './usePrefetchQuery.js';
|
||||
export { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery.js';
|
||||
export { DefinedInitialDataOptions, UndefinedInitialDataOptions, UnusedSkipTokenOptions, queryOptions } from './queryOptions.js';
|
||||
export { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions, UnusedSkipTokenInfiniteOptions, infiniteQueryOptions } from './infiniteQueryOptions.js';
|
||||
export { QueryClientContext, QueryClientProvider, QueryClientProviderProps, useQueryClient } from './QueryClientProvider.js';
|
||||
export { QueryErrorClearResetFunction, QueryErrorIsResetFunction, QueryErrorResetBoundary, QueryErrorResetBoundaryFunction, QueryErrorResetBoundaryProps, QueryErrorResetFunction, useQueryErrorResetBoundary } from './QueryErrorResetBoundary.js';
|
||||
export { HydrationBoundary, HydrationBoundaryProps } from './HydrationBoundary.js';
|
||||
export { useIsFetching } from './useIsFetching.js';
|
||||
export { useIsMutating, useMutationState } from './useMutationState.js';
|
||||
export { useMutation } from './useMutation.js';
|
||||
export { useInfiniteQuery } from './useInfiniteQuery.js';
|
||||
export { IsRestoringProvider, useIsRestoring } from './isRestoring.js';
|
||||
import 'react';
|
||||
import 'react/jsx-runtime';
|
||||
52
node_modules/@tanstack/react-query/build/legacy/index.js
generated
vendored
Normal file
52
node_modules/@tanstack/react-query/build/legacy/index.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
// 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 { useInfiniteQuery } from "./useInfiniteQuery.js";
|
||||
import { useIsRestoring, IsRestoringProvider } from "./isRestoring.js";
|
||||
export {
|
||||
HydrationBoundary,
|
||||
IsRestoringProvider,
|
||||
QueryClientContext,
|
||||
QueryClientProvider,
|
||||
QueryErrorResetBoundary,
|
||||
infiniteQueryOptions,
|
||||
queryOptions,
|
||||
useInfiniteQuery,
|
||||
useIsFetching,
|
||||
useIsMutating,
|
||||
useIsRestoring,
|
||||
useMutation,
|
||||
useMutationState,
|
||||
usePrefetchInfiniteQuery,
|
||||
usePrefetchQuery,
|
||||
useQueries,
|
||||
useQuery,
|
||||
useQueryClient,
|
||||
useQueryErrorResetBoundary,
|
||||
useSuspenseInfiniteQuery,
|
||||
useSuspenseQueries,
|
||||
useSuspenseQuery
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/index.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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 { useInfiniteQuery } from './useInfiniteQuery'\nexport { useIsRestoring, IsRestoringProvider } from './isRestoring'\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,wBAAwB;AACjC,SAAS,gBAAgB,2BAA2B;","names":[]}
|
||||
33
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.cjs
generated
vendored
Normal file
33
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.cjs
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\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 TQueryFnData,\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<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\ntype NonUndefinedGuard<T> = T extends undefined ? never : T\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 TQueryFnData,\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>>\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>>\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>>\n}\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6JO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;","names":[]}
|
||||
24
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.d.cts
generated
vendored
Normal file
24
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.d.cts
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import { DefaultError, InfiniteData, QueryKey, InitialDataFunction, OmitKeyof, SkipToken, DataTag } from '@tanstack/query-core';
|
||||
import { UseInfiniteQueryOptions } from './types.cjs';
|
||||
|
||||
type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam> & {
|
||||
initialData?: undefined | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | InitialDataFunction<NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>>;
|
||||
};
|
||||
type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam>, 'queryFn'> & {
|
||||
queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>;
|
||||
};
|
||||
type NonUndefinedGuard<T> = T extends undefined ? never : T;
|
||||
type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam> & {
|
||||
initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined;
|
||||
};
|
||||
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>>;
|
||||
};
|
||||
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>>;
|
||||
};
|
||||
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>>;
|
||||
};
|
||||
|
||||
export { type DefinedInitialDataInfiniteOptions, type UndefinedInitialDataInfiniteOptions, type UnusedSkipTokenInfiniteOptions, infiniteQueryOptions };
|
||||
24
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.d.ts
generated
vendored
Normal file
24
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.d.ts
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import { DefaultError, InfiniteData, QueryKey, InitialDataFunction, OmitKeyof, SkipToken, DataTag } from '@tanstack/query-core';
|
||||
import { UseInfiniteQueryOptions } from './types.js';
|
||||
|
||||
type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam> & {
|
||||
initialData?: undefined | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | InitialDataFunction<NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>>;
|
||||
};
|
||||
type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam>, 'queryFn'> & {
|
||||
queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>;
|
||||
};
|
||||
type NonUndefinedGuard<T> = T extends undefined ? never : T;
|
||||
type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam> & {
|
||||
initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined;
|
||||
};
|
||||
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>>;
|
||||
};
|
||||
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>>;
|
||||
};
|
||||
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>>;
|
||||
};
|
||||
|
||||
export { type DefinedInitialDataInfiniteOptions, type UndefinedInitialDataInfiniteOptions, type UnusedSkipTokenInfiniteOptions, infiniteQueryOptions };
|
||||
8
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.js
generated
vendored
Normal file
8
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// src/infiniteQueryOptions.ts
|
||||
function infiniteQueryOptions(options) {
|
||||
return options;
|
||||
}
|
||||
export {
|
||||
infiniteQueryOptions
|
||||
};
|
||||
//# sourceMappingURL=infiniteQueryOptions.js.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/infiniteQueryOptions.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\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 TQueryFnData,\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<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryFnData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\ntype NonUndefinedGuard<T> = T extends undefined ? never : T\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 TQueryFnData,\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>>\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>>\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>>\n}\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AA6JO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;","names":[]}
|
||||
47
node_modules/@tanstack/react-query/build/legacy/isRestoring.cjs
generated
vendored
Normal file
47
node_modules/@tanstack/react-query/build/legacy/isRestoring.cjs
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
"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/isRestoring.ts
|
||||
var isRestoring_exports = {};
|
||||
__export(isRestoring_exports, {
|
||||
IsRestoringProvider: () => IsRestoringProvider,
|
||||
useIsRestoring: () => useIsRestoring
|
||||
});
|
||||
module.exports = __toCommonJS(isRestoring_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=isRestoring.cjs.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/isRestoring.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/isRestoring.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/isRestoring.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":[]}
|
||||
6
node_modules/@tanstack/react-query/build/legacy/isRestoring.d.cts
generated
vendored
Normal file
6
node_modules/@tanstack/react-query/build/legacy/isRestoring.d.cts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare const useIsRestoring: () => boolean;
|
||||
declare const IsRestoringProvider: React.Provider<boolean>;
|
||||
|
||||
export { IsRestoringProvider, useIsRestoring };
|
||||
6
node_modules/@tanstack/react-query/build/legacy/isRestoring.d.ts
generated
vendored
Normal file
6
node_modules/@tanstack/react-query/build/legacy/isRestoring.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import * as React from 'react';
|
||||
|
||||
declare const useIsRestoring: () => boolean;
|
||||
declare const IsRestoringProvider: React.Provider<boolean>;
|
||||
|
||||
export { IsRestoringProvider, useIsRestoring };
|
||||
12
node_modules/@tanstack/react-query/build/legacy/isRestoring.js
generated
vendored
Normal file
12
node_modules/@tanstack/react-query/build/legacy/isRestoring.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use client";
|
||||
|
||||
// src/isRestoring.ts
|
||||
import * as React from "react";
|
||||
var IsRestoringContext = React.createContext(false);
|
||||
var useIsRestoring = () => React.useContext(IsRestoringContext);
|
||||
var IsRestoringProvider = IsRestoringContext.Provider;
|
||||
export {
|
||||
IsRestoringProvider,
|
||||
useIsRestoring
|
||||
};
|
||||
//# sourceMappingURL=isRestoring.js.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/isRestoring.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/isRestoring.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/isRestoring.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":[]}
|
||||
33
node_modules/@tanstack/react-query/build/legacy/queryOptions.cjs
generated
vendored
Normal file
33
node_modules/@tanstack/react-query/build/legacy/queryOptions.cjs
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/queryOptions.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/queryOptions.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n OmitKeyof,\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\ntype NonUndefinedGuard<T> = T extends undefined ? never : T\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\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>\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>\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>\n}\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmFO,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;","names":[]}
|
||||
24
node_modules/@tanstack/react-query/build/legacy/queryOptions.d.cts
generated
vendored
Normal file
24
node_modules/@tanstack/react-query/build/legacy/queryOptions.d.cts
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import { DefaultError, QueryKey, InitialDataFunction, OmitKeyof, SkipToken, DataTag } from '@tanstack/query-core';
|
||||
import { UseQueryOptions } from './types.cjs';
|
||||
|
||||
type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
||||
initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>> | NonUndefinedGuard<TQueryFnData>;
|
||||
};
|
||||
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>;
|
||||
};
|
||||
type NonUndefinedGuard<T> = T extends undefined ? never : T;
|
||||
type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
||||
initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
|
||||
};
|
||||
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>;
|
||||
};
|
||||
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>;
|
||||
};
|
||||
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>;
|
||||
};
|
||||
|
||||
export { type DefinedInitialDataOptions, type UndefinedInitialDataOptions, type UnusedSkipTokenOptions, queryOptions };
|
||||
24
node_modules/@tanstack/react-query/build/legacy/queryOptions.d.ts
generated
vendored
Normal file
24
node_modules/@tanstack/react-query/build/legacy/queryOptions.d.ts
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
import { DefaultError, QueryKey, InitialDataFunction, OmitKeyof, SkipToken, DataTag } from '@tanstack/query-core';
|
||||
import { UseQueryOptions } from './types.js';
|
||||
|
||||
type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
||||
initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>> | NonUndefinedGuard<TQueryFnData>;
|
||||
};
|
||||
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>;
|
||||
};
|
||||
type NonUndefinedGuard<T> = T extends undefined ? never : T;
|
||||
type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
|
||||
initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
|
||||
};
|
||||
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>;
|
||||
};
|
||||
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>;
|
||||
};
|
||||
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>;
|
||||
};
|
||||
|
||||
export { type DefinedInitialDataOptions, type UndefinedInitialDataOptions, type UnusedSkipTokenOptions, queryOptions };
|
||||
8
node_modules/@tanstack/react-query/build/legacy/queryOptions.js
generated
vendored
Normal file
8
node_modules/@tanstack/react-query/build/legacy/queryOptions.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// src/queryOptions.ts
|
||||
function queryOptions(options) {
|
||||
return options;
|
||||
}
|
||||
export {
|
||||
queryOptions
|
||||
};
|
||||
//# sourceMappingURL=queryOptions.js.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/queryOptions.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/queryOptions.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n OmitKeyof,\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\ntype NonUndefinedGuard<T> = T extends undefined ? never : T\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\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>\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>\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>\n}\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAmFO,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;","names":[]}
|
||||
54
node_modules/@tanstack/react-query/build/legacy/suspense.cjs
generated
vendored
Normal file
54
node_modules/@tanstack/react-query/build/legacy/suspense.cjs
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
"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) {
|
||||
if (defaultedOptions.staleTime === void 0) {
|
||||
defaultedOptions.staleTime = 1e3;
|
||||
}
|
||||
if (typeof defaultedOptions.gcTime === "number") {
|
||||
defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3);
|
||||
}
|
||||
}
|
||||
};
|
||||
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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/suspense.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/suspense.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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 // Always set stale time when using suspense to prevent\n // fetching again when directly mounting after suspending\n if (defaultedOptions.staleTime === undefined) {\n defaultedOptions.staleTime = 1000\n }\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1000)\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,QAAI,iBAAiB,cAAc,QAAW;AAC5C,uBAAiB,YAAY;AAAA,IAC/B;AACA,QAAI,OAAO,iBAAiB,WAAW,UAAU;AAC/C,uBAAiB,SAAS,KAAK,IAAI,iBAAiB,QAAQ,GAAI;AAAA,IAClE;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":[]}
|
||||
12
node_modules/@tanstack/react-query/build/legacy/suspense.d.cts
generated
vendored
Normal file
12
node_modules/@tanstack/react-query/build/legacy/suspense.d.cts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { QueryKey, Query, DefaultedQueryObserverOptions, QueryObserverResult, QueryObserver } from '@tanstack/query-core';
|
||||
import { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary.cjs';
|
||||
import 'react/jsx-runtime';
|
||||
import 'react';
|
||||
|
||||
declare const defaultThrowOnError: <TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(_error: TError, query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean;
|
||||
declare const ensureSuspenseTimers: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void;
|
||||
declare const willFetch: (result: QueryObserverResult<any, any>, isRestoring: boolean) => boolean;
|
||||
declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any> | undefined, result: QueryObserverResult<any, any>) => boolean | undefined;
|
||||
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 { defaultThrowOnError, ensureSuspenseTimers, fetchOptimistic, shouldSuspend, willFetch };
|
||||
12
node_modules/@tanstack/react-query/build/legacy/suspense.d.ts
generated
vendored
Normal file
12
node_modules/@tanstack/react-query/build/legacy/suspense.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { QueryKey, Query, DefaultedQueryObserverOptions, QueryObserverResult, QueryObserver } from '@tanstack/query-core';
|
||||
import { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary.js';
|
||||
import 'react/jsx-runtime';
|
||||
import 'react';
|
||||
|
||||
declare const defaultThrowOnError: <TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(_error: TError, query: Query<TQueryFnData, TError, TData, TQueryKey>) => boolean;
|
||||
declare const ensureSuspenseTimers: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any>) => void;
|
||||
declare const willFetch: (result: QueryObserverResult<any, any>, isRestoring: boolean) => boolean;
|
||||
declare const shouldSuspend: (defaultedOptions: DefaultedQueryObserverOptions<any, any, any, any, any> | undefined, result: QueryObserverResult<any, any>) => boolean | undefined;
|
||||
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 { defaultThrowOnError, ensureSuspenseTimers, fetchOptimistic, shouldSuspend, willFetch };
|
||||
25
node_modules/@tanstack/react-query/build/legacy/suspense.js
generated
vendored
Normal file
25
node_modules/@tanstack/react-query/build/legacy/suspense.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
// src/suspense.ts
|
||||
var defaultThrowOnError = (_error, query) => query.state.data === void 0;
|
||||
var ensureSuspenseTimers = (defaultedOptions) => {
|
||||
if (defaultedOptions.suspense) {
|
||||
if (defaultedOptions.staleTime === void 0) {
|
||||
defaultedOptions.staleTime = 1e3;
|
||||
}
|
||||
if (typeof defaultedOptions.gcTime === "number") {
|
||||
defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1e3);
|
||||
}
|
||||
}
|
||||
};
|
||||
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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/suspense.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/suspense.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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 // Always set stale time when using suspense to prevent\n // fetching again when directly mounting after suspending\n if (defaultedOptions.staleTime === undefined) {\n defaultedOptions.staleTime = 1000\n }\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 1000)\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,QAAI,iBAAiB,cAAc,QAAW;AAC5C,uBAAiB,YAAY;AAAA,IAC/B;AACA,QAAI,OAAO,iBAAiB,WAAW,UAAU;AAC/C,uBAAiB,SAAS,KAAK,IAAI,iBAAiB,QAAQ,GAAI;AAAA,IAClE;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":[]}
|
||||
19
node_modules/@tanstack/react-query/build/legacy/types.cjs
generated
vendored
Normal file
19
node_modules/@tanstack/react-query/build/legacy/types.cjs
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/types.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/types.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport type {\n DefaultError,\n DefinedInfiniteQueryObserverResult,\n DefinedQueryObserverResult,\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 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\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 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 interface UseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n InfiniteQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n 'suspense'\n > {}\n\nexport interface UseSuspenseInfiniteQueryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> extends OmitKeyof<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'\n > {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\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> = OmitKeyof<\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 interface UseMutationOptions<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n> extends OmitKeyof<\n MutationObserverOptions<TData, TError, TVariables, TContext>,\n '_defaulted'\n > {}\n\nexport type UseMutateFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n> = (\n ...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>\n) => void\n\nexport type UseMutateAsyncFunction<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TContext = unknown,\n> = MutateFunction<TData, TError, TVariables, TContext>\n\nexport type UseBaseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TContext = unknown,\n> = Override<\n MutationObserverResult<TData, TError, TVariables, TContext>,\n { mutate: UseMutateFunction<TData, TError, TVariables, TContext> }\n> & { mutateAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext> }\n\nexport type UseMutationResult<\n TData = unknown,\n TError = DefaultError,\n TVariables = unknown,\n TContext = unknown,\n> = UseBaseMutationResult<TData, TError, TVariables, TContext>\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
||||
33
node_modules/@tanstack/react-query/build/legacy/types.d.cts
generated
vendored
Normal file
33
node_modules/@tanstack/react-query/build/legacy/types.d.cts
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import { DefaultError, QueryKey, QueryObserverOptions, OmitKeyof, SkipToken, InfiniteQueryObserverOptions, QueryObserverResult, DefinedQueryObserverResult, InfiniteQueryObserverResult, DefinedInfiniteQueryObserverResult, MutationObserverOptions, MutateFunction, Override, MutationObserverResult } from '@tanstack/query-core';
|
||||
|
||||
interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
|
||||
}
|
||||
interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {
|
||||
}
|
||||
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>;
|
||||
}
|
||||
interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>, 'suspense'> {
|
||||
}
|
||||
interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
|
||||
queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>['queryFn'], SkipToken>;
|
||||
}
|
||||
type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
|
||||
type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
|
||||
type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>;
|
||||
type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
|
||||
type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
|
||||
type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>;
|
||||
type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>;
|
||||
interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TContext>, '_defaulted'> {
|
||||
}
|
||||
type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>) => void;
|
||||
type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MutateFunction<TData, TError, TVariables, TContext>;
|
||||
type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TContext>, {
|
||||
mutate: UseMutateFunction<TData, TError, TVariables, TContext>;
|
||||
}> & {
|
||||
mutateAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
||||
};
|
||||
type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = UseBaseMutationResult<TData, TError, TVariables, TContext>;
|
||||
|
||||
export type { DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult };
|
||||
33
node_modules/@tanstack/react-query/build/legacy/types.d.ts
generated
vendored
Normal file
33
node_modules/@tanstack/react-query/build/legacy/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import { DefaultError, QueryKey, QueryObserverOptions, OmitKeyof, SkipToken, InfiniteQueryObserverOptions, QueryObserverResult, DefinedQueryObserverResult, InfiniteQueryObserverResult, DefinedInfiniteQueryObserverResult, MutationObserverOptions, MutateFunction, Override, MutationObserverResult } from '@tanstack/query-core';
|
||||
|
||||
interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
|
||||
}
|
||||
interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {
|
||||
}
|
||||
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>;
|
||||
}
|
||||
interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>, 'suspense'> {
|
||||
}
|
||||
interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
|
||||
queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>['queryFn'], SkipToken>;
|
||||
}
|
||||
type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
|
||||
type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
|
||||
type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>;
|
||||
type DefinedUseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>;
|
||||
type UseInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>;
|
||||
type DefinedUseInfiniteQueryResult<TData = unknown, TError = DefaultError> = DefinedInfiniteQueryObserverResult<TData, TError>;
|
||||
type UseSuspenseInfiniteQueryResult<TData = unknown, TError = DefaultError> = OmitKeyof<DefinedInfiniteQueryObserverResult<TData, TError>, 'isPlaceholderData' | 'promise'>;
|
||||
interface UseMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> extends OmitKeyof<MutationObserverOptions<TData, TError, TVariables, TContext>, '_defaulted'> {
|
||||
}
|
||||
type UseMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>) => void;
|
||||
type UseMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MutateFunction<TData, TError, TVariables, TContext>;
|
||||
type UseBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TContext>, {
|
||||
mutate: UseMutateFunction<TData, TError, TVariables, TContext>;
|
||||
}> & {
|
||||
mutateAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
||||
};
|
||||
type UseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = UseBaseMutationResult<TData, TError, TVariables, TContext>;
|
||||
|
||||
export type { DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult };
|
||||
1
node_modules/@tanstack/react-query/build/legacy/types.js
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/types.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/types.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/types.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
||||
124
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.cjs
generated
vendored
Normal file
124
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.cjs
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
"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_isRestoring = require("./isRestoring.cjs");
|
||||
var import_suspense = require("./suspense.cjs");
|
||||
var import_utils = require("./utils.cjs");
|
||||
function useBaseQuery(options, Observer, queryClient) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
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 client = (0, import_QueryClientProvider.useQueryClient)(queryClient);
|
||||
const isRestoring = (0, import_isRestoring.useIsRestoring)();
|
||||
const errorResetBoundary = (0, import_QueryErrorResetBoundary.useQueryErrorResetBoundary)();
|
||||
const defaultedOptions = client.defaultQueryOptions(options);
|
||||
(_b = (_a = client.getDefaultOptions().queries) == null ? void 0 : _a._experimental_beforeQuery) == null ? void 0 : _b.call(
|
||||
_a,
|
||||
defaultedOptions
|
||||
);
|
||||
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
||||
(0, import_suspense.ensureSuspenseTimers)(defaultedOptions);
|
||||
(0, import_errorBoundaryUtils.ensurePreventErrorBoundaryRetry)(defaultedOptions, errorResetBoundary);
|
||||
(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);
|
||||
React.useSyncExternalStore(
|
||||
React.useCallback(
|
||||
(onStoreChange) => {
|
||||
const unsubscribe = isRestoring ? import_utils.noop : observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange));
|
||||
observer.updateResult();
|
||||
return unsubscribe;
|
||||
},
|
||||
[observer, isRestoring]
|
||||
),
|
||||
() => observer.getCurrentResult(),
|
||||
() => observer.getCurrentResult()
|
||||
);
|
||||
React.useEffect(() => {
|
||||
observer.setOptions(defaultedOptions, { listeners: false });
|
||||
}, [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: client.getQueryCache().get(defaultedOptions.queryHash)
|
||||
})) {
|
||||
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.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
|
||||
(_e = client.getQueryCache().get(defaultedOptions.queryHash)) == null ? void 0 : _e.promise
|
||||
);
|
||||
promise == null ? void 0 : promise.catch(import_utils.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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.d.cts
generated
vendored
Normal file
6
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.d.cts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { QueryKey, QueryObserver, QueryClient, QueryObserverResult } from '@tanstack/query-core';
|
||||
import { UseBaseQueryOptions } from './types.cjs';
|
||||
|
||||
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>;
|
||||
|
||||
export { useBaseQuery };
|
||||
6
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.d.ts
generated
vendored
Normal file
6
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { QueryKey, QueryObserver, QueryClient, QueryObserverResult } from '@tanstack/query-core';
|
||||
import { UseBaseQueryOptions } from './types.js';
|
||||
|
||||
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>;
|
||||
|
||||
export { useBaseQuery };
|
||||
99
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.js
generated
vendored
Normal file
99
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.js
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
"use client";
|
||||
|
||||
// src/useBaseQuery.ts
|
||||
import * as React from "react";
|
||||
import { isServer, 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 "./isRestoring.js";
|
||||
import {
|
||||
ensureSuspenseTimers,
|
||||
fetchOptimistic,
|
||||
shouldSuspend,
|
||||
willFetch
|
||||
} from "./suspense.js";
|
||||
import { noop } from "./utils.js";
|
||||
function useBaseQuery(options, Observer, queryClient) {
|
||||
var _a, _b, _c, _d, _e;
|
||||
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 client = useQueryClient(queryClient);
|
||||
const isRestoring = useIsRestoring();
|
||||
const errorResetBoundary = useQueryErrorResetBoundary();
|
||||
const defaultedOptions = client.defaultQueryOptions(options);
|
||||
(_b = (_a = client.getDefaultOptions().queries) == null ? void 0 : _a._experimental_beforeQuery) == null ? void 0 : _b.call(
|
||||
_a,
|
||||
defaultedOptions
|
||||
);
|
||||
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
||||
ensureSuspenseTimers(defaultedOptions);
|
||||
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
|
||||
useClearResetErrorBoundary(errorResetBoundary);
|
||||
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
|
||||
const [observer] = React.useState(
|
||||
() => new Observer(
|
||||
client,
|
||||
defaultedOptions
|
||||
)
|
||||
);
|
||||
const result = observer.getOptimisticResult(defaultedOptions);
|
||||
React.useSyncExternalStore(
|
||||
React.useCallback(
|
||||
(onStoreChange) => {
|
||||
const unsubscribe = isRestoring ? noop : observer.subscribe(notifyManager.batchCalls(onStoreChange));
|
||||
observer.updateResult();
|
||||
return unsubscribe;
|
||||
},
|
||||
[observer, isRestoring]
|
||||
),
|
||||
() => observer.getCurrentResult(),
|
||||
() => observer.getCurrentResult()
|
||||
);
|
||||
React.useEffect(() => {
|
||||
observer.setOptions(defaultedOptions, { listeners: false });
|
||||
}, [defaultedOptions, observer]);
|
||||
if (shouldSuspend(defaultedOptions, result)) {
|
||||
throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
|
||||
}
|
||||
if (getHasError({
|
||||
result,
|
||||
errorResetBoundary,
|
||||
throwOnError: defaultedOptions.throwOnError,
|
||||
query: client.getQueryCache().get(defaultedOptions.queryHash)
|
||||
})) {
|
||||
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 && !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
|
||||
(_e = client.getQueryCache().get(defaultedOptions.queryHash)) == null ? void 0 : _e.promise
|
||||
);
|
||||
promise == null ? void 0 : promise.catch(noop).finally(() => {
|
||||
observer.updateResult();
|
||||
});
|
||||
}
|
||||
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
||||
}
|
||||
export {
|
||||
useBaseQuery
|
||||
};
|
||||
//# sourceMappingURL=useBaseQuery.js.map
|
||||
1
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/useBaseQuery.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
40
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.cjs
generated
vendored
Normal file
40
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.cjs
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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 TQueryFnData,\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;AAsEtB,SAAS,iBACd,SACA,aACA;AACA,aAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
||||
9
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.d.cts
generated
vendored
Normal file
9
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.d.cts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { DefaultError, InfiniteData, QueryKey, QueryClient } from '@tanstack/query-core';
|
||||
import { DefinedUseInfiniteQueryResult, UseInfiniteQueryResult, UseInfiniteQueryOptions } from './types.cjs';
|
||||
import { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions } from './infiniteQueryOptions.cjs';
|
||||
|
||||
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, TQueryFnData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>;
|
||||
|
||||
export { useInfiniteQuery };
|
||||
9
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.d.ts
generated
vendored
Normal file
9
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import { DefaultError, InfiniteData, QueryKey, QueryClient } from '@tanstack/query-core';
|
||||
import { DefinedUseInfiniteQueryResult, UseInfiniteQueryResult, UseInfiniteQueryOptions } from './types.js';
|
||||
import { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions } from './infiniteQueryOptions.js';
|
||||
|
||||
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, TQueryFnData, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>;
|
||||
|
||||
export { useInfiniteQuery };
|
||||
16
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.js
generated
vendored
Normal file
16
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/useInfiniteQuery.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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 TQueryFnData,\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;AAsEtB,SAAS,iBACd,SACA,aACA;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
||||
56
node_modules/@tanstack/react-query/build/legacy/useIsFetching.cjs
generated
vendored
Normal file
56
node_modules/@tanstack/react-query/build/legacy/useIsFetching.cjs
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/useIsFetching.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/useIsFetching.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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":[]}
|
||||
5
node_modules/@tanstack/react-query/build/legacy/useIsFetching.d.cts
generated
vendored
Normal file
5
node_modules/@tanstack/react-query/build/legacy/useIsFetching.d.cts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { QueryFilters, QueryClient } from '@tanstack/query-core';
|
||||
|
||||
declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number;
|
||||
|
||||
export { useIsFetching };
|
||||
5
node_modules/@tanstack/react-query/build/legacy/useIsFetching.d.ts
generated
vendored
Normal file
5
node_modules/@tanstack/react-query/build/legacy/useIsFetching.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { QueryFilters, QueryClient } from '@tanstack/query-core';
|
||||
|
||||
declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number;
|
||||
|
||||
export { useIsFetching };
|
||||
22
node_modules/@tanstack/react-query/build/legacy/useIsFetching.js
generated
vendored
Normal file
22
node_modules/@tanstack/react-query/build/legacy/useIsFetching.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/useIsFetching.js.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/useIsFetching.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"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":[]}
|
||||
75
node_modules/@tanstack/react-query/build/legacy/useMutation.cjs
generated
vendored
Normal file
75
node_modules/@tanstack/react-query/build/legacy/useMutation.cjs
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
"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");
|
||||
var import_utils = require("./utils.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_utils.noop);
|
||||
},
|
||||
[observer]
|
||||
);
|
||||
if (result.error && (0, import_utils.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
|
||||
1
node_modules/@tanstack/react-query/build/legacy/useMutation.cjs.map
generated
vendored
Normal file
1
node_modules/@tanstack/react-query/build/legacy/useMutation.cjs.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/useMutation.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { MutationObserver, notifyManager } from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport { noop, shouldThrowError } from './utils'\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 TContext = unknown,\n>(\n options: UseMutationOptions<TData, TError, TVariables, TContext>,\n queryClient?: QueryClient,\n): UseMutationResult<TData, TError, TVariables, TContext> {\n const client = useQueryClient(queryClient)\n\n const [observer] = React.useState(\n () =>\n new MutationObserver<TData, TError, TVariables, TContext>(\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, TContext>\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,wBAAgD;AAChD,iCAA+B;AAC/B,mBAAuC;AAUhC,SAAS,YAMd,SACA,aACwD;AACxD,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,iBAAI;AAAA,IACtD;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,MACE,OAAO,aACP,+BAAiB,SAAS,QAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,GAC9D;AACA,UAAM,OAAO;AAAA,EACf;AAEA,SAAO,EAAE,GAAG,QAAQ,QAAQ,aAAa,OAAO,OAAO;AACzD;","names":[]}
|
||||
6
node_modules/@tanstack/react-query/build/legacy/useMutation.d.cts
generated
vendored
Normal file
6
node_modules/@tanstack/react-query/build/legacy/useMutation.d.cts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { UseMutationOptions, UseMutationResult } from './types.cjs';
|
||||
import { DefaultError, QueryClient } from '@tanstack/query-core';
|
||||
|
||||
declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(options: UseMutationOptions<TData, TError, TVariables, TContext>, queryClient?: QueryClient): UseMutationResult<TData, TError, TVariables, TContext>;
|
||||
|
||||
export { useMutation };
|
||||
6
node_modules/@tanstack/react-query/build/legacy/useMutation.d.ts
generated
vendored
Normal file
6
node_modules/@tanstack/react-query/build/legacy/useMutation.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
import { UseMutationOptions, UseMutationResult } from './types.js';
|
||||
import { DefaultError, QueryClient } from '@tanstack/query-core';
|
||||
|
||||
declare function useMutation<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(options: UseMutationOptions<TData, TError, TVariables, TContext>, queryClient?: QueryClient): UseMutationResult<TData, TError, TVariables, TContext>;
|
||||
|
||||
export { useMutation };
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user