Add comprehensive frontend UI and distributed infrastructure

Frontend Enhancements:
- Complete React TypeScript frontend with modern UI components
- Distributed workflows management interface with real-time updates
- Socket.IO integration for live agent status monitoring
- Agent management dashboard with cluster visualization
- Project management interface with metrics and task tracking
- Responsive design with proper error handling and loading states

Backend Infrastructure:
- Distributed coordinator for multi-agent workflow orchestration
- Cluster management API with comprehensive agent operations
- Enhanced database models for agents and projects
- Project service for filesystem-based project discovery
- Performance monitoring and metrics collection
- Comprehensive API documentation and error handling

Documentation:
- Complete distributed development guide (README_DISTRIBUTED.md)
- Comprehensive development report with architecture insights
- System configuration templates and deployment guides

The platform now provides a complete web interface for managing the distributed AI cluster
with real-time monitoring, workflow orchestration, and agent coordination capabilities.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
anthonyrawlins
2025-07-10 08:41:59 +10:00
parent fc0eec91ef
commit 85bf1341f3
28348 changed files with 2646896 additions and 69 deletions

21
frontend/node_modules/@tanstack/react-query/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021-present Tanner Linsley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

48
frontend/node_modules/@tanstack/react-query/README.md generated vendored Normal file
View File

@@ -0,0 +1,48 @@
<img src="https://static.scarf.sh/a.png?x-pxid=be2d8a11-9712-4c1d-9963-580b2d4fb133" />
![TanStack Query Header](https://github.com/TanStack/query/raw/main/media/repo-header.png)
Hooks for fetching, caching and updating asynchronous data in React
<a href="https://twitter.com/intent/tweet?button_hashtag=TanStack" target="\_parent">
<img alt="#TanStack" src="https://img.shields.io/twitter/url?color=%2308a0e9&label=%23TanStack&style=social&url=https%3A%2F%2Ftwitter.com%2Fintent%2Ftweet%3Fbutton_hashtag%3DTanStack">
</a><a href="https://discord.com/invite/WrRKjPJ" target="\_parent">
<img alt="" src="https://img.shields.io/badge/Discord-TanStack-%235865F2" />
</a><a href="https://github.com/TanStack/query/actions?query=workflow%3A%22react-query+tests%22">
<img src="https://github.com/TanStack/query/workflows/react-query%20tests/badge.svg" />
</a><a href="https://www.npmjs.com/package/@tanstack/query-core" target="\_parent">
<img alt="" src="https://img.shields.io/npm/dm/@tanstack/query-core.svg" />
</a><a href="https://bundlejs.com/?q=%40tanstack%2Freact-query&config=%7B%22esbuild%22%3A%7B%22external%22%3A%5B%22react%22%2C%22react-dom%22%5D%7D%7D&badge=" target="\_parent">
<img alt="" src="https://deno.bundlejs.com/?q=@tanstack/react-query&config={%22esbuild%22:{%22external%22:[%22react%22,%22react-dom%22]}}&badge=detailed" />
</a><a href="#badge">
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
</a><a href="https://github.com/TanStack/query/discussions">
<img alt="Join the discussion on Github" src="https://img.shields.io/badge/Github%20Discussions%20%26%20Support-Chat%20now!-blue" />
</a><a href="https://bestofjs.org/projects/tanstack-query"><img alt="Best of JS" src="https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=TanStack%2Fquery%26since=daily" /></a><a href="https://github.com/TanStack/query/" target="\_parent">
<img alt="" src="https://img.shields.io/github/stars/TanStack/query.svg?style=social&label=Star" />
</a><a href="https://twitter.com/tannerlinsley" target="\_parent">
<img alt="" src="https://img.shields.io/twitter/follow/tannerlinsley.svg?style=social&label=Follow" />
</a> <a href="https://gitpod.io/from-referrer/">
<img src="https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod" alt="Gitpod Ready-to-Code"/>
</a>
Enjoy this library? Try the entire [TanStack](https://tanstack.com)! [TanStack Table](https://github.com/TanStack/table), [TanStack Router](https://github.com/tanstack/router), [TanStack Virtual](https://github.com/tanstack/virtual), [React Charts](https://github.com/TanStack/react-charts), [React Ranger](https://github.com/TanStack/ranger)
## Visit [tanstack.com/query](https://tanstack.com/query) for docs, guides, API and more!
## Quick Features
- Transport/protocol/backend agnostic data fetching (REST, GraphQL, promises, whatever!)
- Auto Caching + Refetching (stale-while-revalidate, Window Refocus, Polling/Realtime)
- Parallel + Dependent Queries
- Mutations + Reactive Query Refetching
- Multi-layer Cache + Automatic Garbage Collection
- Paginated + Cursor-based Queries
- Load-More + Infinite Scroll Queries w/ Scroll Recovery
- Request Cancellation
- [React Suspense](https://react.dev/reference/react/Suspense) + Fetch-As-You-Render Query Prefetching
- Dedicated Devtools
### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/)
<!-- Use the force, Luke -->

View 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,
},
}
}

View 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,
}
}

View 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,
}
}

View 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,
}
}

View 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' })
}

View 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' })
}

View 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
}
}
}

View 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' })
}

View 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.

View 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' })
}

View 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

View 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' })
}

View 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

View 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

View 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,
}
}

View 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

View 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' })
}

View 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' })
}

View File

@@ -0,0 +1,89 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/HydrationBoundary.tsx
var HydrationBoundary_exports = {};
__export(HydrationBoundary_exports, {
HydrationBoundary: () => HydrationBoundary
});
module.exports = __toCommonJS(HydrationBoundary_exports);
var React = __toESM(require("react"), 1);
var import_query_core = require("@tanstack/query-core");
var import_QueryClientProvider = require("./QueryClientProvider.cjs");
var HydrationBoundary = ({
children,
options = {},
state,
queryClient
}) => {
const client = (0, import_QueryClientProvider.useQueryClient)(queryClient);
const optionsRef = React.useRef(options);
optionsRef.current = options;
const hydrationQueue = React.useMemo(() => {
if (state) {
if (typeof state !== "object") {
return;
}
const queryCache = client.getQueryCache();
const queries = state.queries || [];
const newQueries = [];
const existingQueries = [];
for (const dehydratedQuery of queries) {
const existingQuery = queryCache.get(dehydratedQuery.queryHash);
if (!existingQuery) {
newQueries.push(dehydratedQuery);
} else {
const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt;
if (hydrationIsNewer) {
existingQueries.push(dehydratedQuery);
}
}
}
if (newQueries.length > 0) {
(0, import_query_core.hydrate)(client, { queries: newQueries }, optionsRef.current);
}
if (existingQueries.length > 0) {
return existingQueries;
}
}
return void 0;
}, [client, state]);
React.useEffect(() => {
if (hydrationQueue) {
(0, import_query_core.hydrate)(client, { queries: hydrationQueue }, optionsRef.current);
}
}, [client, hydrationQueue]);
return children;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
HydrationBoundary
});
//# sourceMappingURL=HydrationBoundary.cjs.map

File diff suppressed because one or more lines are too long

View 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;
export { HydrationBoundary, type HydrationBoundaryProps };

View 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;
export { HydrationBoundary, type HydrationBoundaryProps };

View File

@@ -0,0 +1,55 @@
"use client";
// src/HydrationBoundary.tsx
import * as React from "react";
import { hydrate } from "@tanstack/query-core";
import { useQueryClient } from "./QueryClientProvider.js";
var HydrationBoundary = ({
children,
options = {},
state,
queryClient
}) => {
const client = useQueryClient(queryClient);
const optionsRef = React.useRef(options);
optionsRef.current = options;
const hydrationQueue = React.useMemo(() => {
if (state) {
if (typeof state !== "object") {
return;
}
const queryCache = client.getQueryCache();
const queries = state.queries || [];
const newQueries = [];
const existingQueries = [];
for (const dehydratedQuery of queries) {
const existingQuery = queryCache.get(dehydratedQuery.queryHash);
if (!existingQuery) {
newQueries.push(dehydratedQuery);
} else {
const hydrationIsNewer = dehydratedQuery.state.dataUpdatedAt > existingQuery.state.dataUpdatedAt || dehydratedQuery.promise && existingQuery.state.status !== "pending" && existingQuery.state.fetchStatus !== "fetching" && dehydratedQuery.dehydratedAt !== void 0 && dehydratedQuery.dehydratedAt > existingQuery.state.dataUpdatedAt;
if (hydrationIsNewer) {
existingQueries.push(dehydratedQuery);
}
}
}
if (newQueries.length > 0) {
hydrate(client, { queries: newQueries }, optionsRef.current);
}
if (existingQueries.length > 0) {
return existingQueries;
}
}
return void 0;
}, [client, state]);
React.useEffect(() => {
if (hydrationQueue) {
hydrate(client, { queries: hydrationQueue }, optionsRef.current);
}
}, [client, hydrationQueue]);
return children;
};
export {
HydrationBoundary
};
//# sourceMappingURL=HydrationBoundary.js.map

File diff suppressed because one or more lines are too long

View 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/IsRestoringProvider.ts
var IsRestoringProvider_exports = {};
__export(IsRestoringProvider_exports, {
IsRestoringProvider: () => IsRestoringProvider,
useIsRestoring: () => useIsRestoring
});
module.exports = __toCommonJS(IsRestoringProvider_exports);
var React = __toESM(require("react"), 1);
var IsRestoringContext = React.createContext(false);
var useIsRestoring = () => React.useContext(IsRestoringContext);
var IsRestoringProvider = IsRestoringContext.Provider;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
IsRestoringProvider,
useIsRestoring
});
//# sourceMappingURL=IsRestoringProvider.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AAEvB,IAAM,qBAA2B,oBAAc,KAAK;AAE7C,IAAM,iBAAiB,MAAY,iBAAW,kBAAkB;AAChE,IAAM,sBAAsB,mBAAmB;","names":[]}

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
declare const useIsRestoring: () => boolean;
declare const IsRestoringProvider: React.Provider<boolean>;
export { IsRestoringProvider, useIsRestoring };

View File

@@ -0,0 +1,6 @@
import * as React from 'react';
declare const useIsRestoring: () => boolean;
declare const IsRestoringProvider: React.Provider<boolean>;
export { IsRestoringProvider, useIsRestoring };

View File

@@ -0,0 +1,12 @@
"use client";
// src/IsRestoringProvider.ts
import * as React from "react";
var IsRestoringContext = React.createContext(false);
var useIsRestoring = () => React.useContext(IsRestoringContext);
var IsRestoringProvider = IsRestoringContext.Provider;
export {
IsRestoringProvider,
useIsRestoring
};
//# sourceMappingURL=IsRestoringProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/IsRestoringProvider.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\n\nconst IsRestoringContext = React.createContext(false)\n\nexport const useIsRestoring = () => React.useContext(IsRestoringContext)\nexport const IsRestoringProvider = IsRestoringContext.Provider\n"],"mappings":";;;AACA,YAAY,WAAW;AAEvB,IAAM,qBAA2B,oBAAc,KAAK;AAE7C,IAAM,iBAAiB,MAAY,iBAAW,kBAAkB;AAChE,IAAM,sBAAsB,mBAAmB;","names":[]}

View 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

View 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":[]}

View 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 };

View 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 };

View 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

View 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":[]}

View 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

View 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":[]}

View 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 };

View 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 };

View 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

View 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":[]}

View File

@@ -0,0 +1,68 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/errorBoundaryUtils.ts
var errorBoundaryUtils_exports = {};
__export(errorBoundaryUtils_exports, {
ensurePreventErrorBoundaryRetry: () => ensurePreventErrorBoundaryRetry,
getHasError: () => getHasError,
useClearResetErrorBoundary: () => useClearResetErrorBoundary
});
module.exports = __toCommonJS(errorBoundaryUtils_exports);
var React = __toESM(require("react"), 1);
var import_query_core = require("@tanstack/query-core");
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
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,
suspense
}) => {
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || (0, import_query_core.shouldThrowError)(throwOnError, [result.error, query]));
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ensurePreventErrorBoundaryRetry,
getHasError,
useClearResetErrorBoundary
});
//# sourceMappingURL=errorBoundaryUtils.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\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 suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,YAAuB;AACvB,wBAAiC;AAU1B,IAAM,kCAAkC,CAO7C,SAOA,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;AAAA,EACA;AACF,MAMM;AACJ,SACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,cAC5B,oCAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D;","names":[]}

View File

@@ -0,0 +1,16 @@
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, suspense, }: {
result: QueryObserverResult<TData, TError>;
errorResetBoundary: QueryErrorResetBoundaryValue;
throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>;
query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined;
suspense: boolean | undefined;
}) => boolean | undefined;
export { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };

View File

@@ -0,0 +1,16 @@
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, suspense, }: {
result: QueryObserverResult<TData, TError>;
errorResetBoundary: QueryErrorResetBoundaryValue;
throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>;
query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined;
suspense: boolean | undefined;
}) => boolean | undefined;
export { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };

View File

@@ -0,0 +1,32 @@
"use client";
// src/errorBoundaryUtils.ts
import * as React from "react";
import { shouldThrowError } from "@tanstack/query-core";
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,
suspense
}) => {
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
};
export {
ensurePreventErrorBoundaryRetry,
getHasError,
useClearResetErrorBoundary
};
//# sourceMappingURL=errorBoundaryUtils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/errorBoundaryUtils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { shouldThrowError } from '@tanstack/query-core'\nimport type {\n DefaultedQueryObserverOptions,\n Query,\n QueryKey,\n QueryObserverResult,\n ThrowOnError,\n} from '@tanstack/query-core'\nimport type { QueryErrorResetBoundaryValue } from './QueryErrorResetBoundary'\n\nexport const ensurePreventErrorBoundaryRetry = <\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey extends QueryKey,\n>(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n errorResetBoundary: QueryErrorResetBoundaryValue,\n) => {\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 suspense,\n}: {\n result: QueryObserverResult<TData, TError>\n errorResetBoundary: QueryErrorResetBoundaryValue\n throwOnError: ThrowOnError<TQueryFnData, TError, TQueryData, TQueryKey>\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey> | undefined\n suspense: boolean | undefined\n}) => {\n return (\n result.isError &&\n !errorResetBoundary.isReset() &&\n !result.isFetching &&\n query &&\n ((suspense && result.data === undefined) ||\n shouldThrowError(throwOnError, [result.error, query]))\n )\n}\n"],"mappings":";;;AACA,YAAY,WAAW;AACvB,SAAS,wBAAwB;AAU1B,IAAM,kCAAkC,CAO7C,SAOA,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;AAAA,EACA;AACF,MAMM;AACJ,SACE,OAAO,WACP,CAAC,mBAAmB,QAAQ,KAC5B,CAAC,OAAO,cACR,UACE,YAAY,OAAO,SAAS,UAC5B,iBAAiB,cAAc,CAAC,OAAO,OAAO,KAAK,CAAC;AAE1D;","names":[]}

View 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 index_exports = {};
__export(index_exports, {
HydrationBoundary: () => import_HydrationBoundary.HydrationBoundary,
IsRestoringProvider: () => import_IsRestoringProvider.IsRestoringProvider,
QueryClientContext: () => import_QueryClientProvider.QueryClientContext,
QueryClientProvider: () => import_QueryClientProvider.QueryClientProvider,
QueryErrorResetBoundary: () => import_QueryErrorResetBoundary.QueryErrorResetBoundary,
infiniteQueryOptions: () => import_infiniteQueryOptions.infiniteQueryOptions,
queryOptions: () => import_queryOptions.queryOptions,
useInfiniteQuery: () => import_useInfiniteQuery.useInfiniteQuery,
useIsFetching: () => import_useIsFetching.useIsFetching,
useIsMutating: () => import_useMutationState.useIsMutating,
useIsRestoring: () => import_IsRestoringProvider.useIsRestoring,
useMutation: () => import_useMutation.useMutation,
useMutationState: () => import_useMutationState.useMutationState,
usePrefetchInfiniteQuery: () => import_usePrefetchInfiniteQuery.usePrefetchInfiniteQuery,
usePrefetchQuery: () => import_usePrefetchQuery.usePrefetchQuery,
useQueries: () => import_useQueries.useQueries,
useQuery: () => import_useQuery.useQuery,
useQueryClient: () => import_QueryClientProvider.useQueryClient,
useQueryErrorResetBoundary: () => import_QueryErrorResetBoundary.useQueryErrorResetBoundary,
useSuspenseInfiniteQuery: () => import_useSuspenseInfiniteQuery.useSuspenseInfiniteQuery,
useSuspenseQueries: () => import_useSuspenseQueries.useSuspenseQueries,
useSuspenseQuery: () => import_useSuspenseQuery.useSuspenseQuery
});
module.exports = __toCommonJS(index_exports);
__reExport(index_exports, require("@tanstack/query-core"), module.exports);
__reExport(index_exports, require("./types.cjs"), module.exports);
var import_useQueries = require("./useQueries.cjs");
var import_useQuery = require("./useQuery.cjs");
var import_useSuspenseQuery = require("./useSuspenseQuery.cjs");
var import_useSuspenseInfiniteQuery = require("./useSuspenseInfiniteQuery.cjs");
var import_useSuspenseQueries = require("./useSuspenseQueries.cjs");
var import_usePrefetchQuery = require("./usePrefetchQuery.cjs");
var import_usePrefetchInfiniteQuery = require("./usePrefetchInfiniteQuery.cjs");
var import_queryOptions = require("./queryOptions.cjs");
var import_infiniteQueryOptions = require("./infiniteQueryOptions.cjs");
var import_QueryClientProvider = require("./QueryClientProvider.cjs");
var import_HydrationBoundary = require("./HydrationBoundary.cjs");
var import_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs");
var import_useIsFetching = require("./useIsFetching.cjs");
var import_useMutationState = require("./useMutationState.cjs");
var import_useMutation = require("./useMutation.cjs");
var import_useInfiniteQuery = require("./useInfiniteQuery.cjs");
var import_IsRestoringProvider = require("./IsRestoringProvider.cjs");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
HydrationBoundary,
IsRestoringProvider,
QueryClientContext,
QueryClientProvider,
QueryErrorResetBoundary,
infiniteQueryOptions,
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

View 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 './IsRestoringProvider'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAc,iCAHd;AAMA,0BAAc,wBANd;AAOA,wBAA2B;AAE3B,sBAAyB;AACzB,8BAAiC;AACjC,sCAAyC;AACzC,gCAAmC;AAKnC,8BAAiC;AACjC,sCAAyC;AACzC,0BAA6B;AAM7B,kCAAqC;AAMrC,iCAIO;AAGP,+BAAkC;AAQlC,qCAGO;AACP,2BAA8B;AAC9B,8BAAgD;AAChD,yBAA4B;AAC5B,8BAAiC;AACjC,iCAAoD;","names":[]}

View File

@@ -0,0 +1,21 @@
export * from '@tanstack/query-core';
export { AnyUseBaseQueryOptions, AnyUseInfiniteQueryOptions, AnyUseMutationOptions, AnyUseQueryOptions, AnyUseSuspenseInfiniteQueryOptions, AnyUseSuspenseQueryOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UsePrefetchQueryOptions, 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 './IsRestoringProvider.cjs';
import 'react';
import 'react/jsx-runtime';

View File

@@ -0,0 +1,21 @@
export * from '@tanstack/query-core';
export { AnyUseBaseQueryOptions, AnyUseInfiniteQueryOptions, AnyUseMutationOptions, AnyUseQueryOptions, AnyUseSuspenseInfiniteQueryOptions, AnyUseSuspenseQueryOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UsePrefetchQueryOptions, 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 './IsRestoringProvider.js';
import 'react';
import 'react/jsx-runtime';

View 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 "./IsRestoringProvider.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

View 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 './IsRestoringProvider'\n"],"mappings":";AAGA,cAAc;AAGd,cAAc;AACd,SAAS,kBAAkB;AAE3B,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AAKnC,SAAS,wBAAwB;AACjC,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAM7B,SAAS,4BAA4B;AAMrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,yBAAyB;AAQlC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAS,eAAe,wBAAwB;AAChD,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,gBAAgB,2BAA2B;","names":[]}

View 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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData?:\n | undefined\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData:\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkJO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;","names":[]}

View File

@@ -0,0 +1,23 @@
import { DefaultError, InfiniteData, QueryKey, NonUndefinedGuard, DataTag, OmitKeyof, SkipToken, InitialDataFunction } 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, 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, TQueryKey, TPageParam>, 'queryFn'> & {
queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>;
};
type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined;
};
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
};
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
};
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
};
export { type DefinedInitialDataInfiniteOptions, type UndefinedInitialDataInfiniteOptions, type UnusedSkipTokenInfiniteOptions, infiniteQueryOptions };

View File

@@ -0,0 +1,23 @@
import { DefaultError, InfiniteData, QueryKey, NonUndefinedGuard, DataTag, OmitKeyof, SkipToken, InitialDataFunction } 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, 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, TQueryKey, TPageParam>, 'queryFn'> & {
queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>;
};
type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined;
};
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
};
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UnusedSkipTokenInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
};
declare function infiniteQueryOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(options: UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>): UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
};
export { type DefinedInitialDataInfiniteOptions, type UndefinedInitialDataInfiniteOptions, type UnusedSkipTokenInfiniteOptions, infiniteQueryOptions };

View File

@@ -0,0 +1,8 @@
// src/infiniteQueryOptions.ts
function infiniteQueryOptions(options) {
return options;
}
export {
infiniteQueryOptions
};
//# sourceMappingURL=infiniteQueryOptions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/infiniteQueryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InfiniteData,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData?:\n | undefined\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | InitialDataFunction<\n NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n >\n}\n\nexport type UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = OmitKeyof<\n UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = UseInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n initialData:\n | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>\n | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>)\n | undefined\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UnusedSkipTokenInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n options: UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n): UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n> & {\n queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>\n}\n\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAkJO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;","names":[]}

View 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

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoFO,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;","names":[]}

View File

@@ -0,0 +1,24 @@
import { DefaultError, QueryKey, NonUndefinedGuard, QueryFunction, InitialDataFunction, DataTag, OmitKeyof, SkipToken } 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 DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {
initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
queryFn?: QueryFunction<TQueryFnData, TQueryKey>;
};
declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
};
declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {
queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
};
declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
};
export { type DefinedInitialDataOptions, type UndefinedInitialDataOptions, type UnusedSkipTokenOptions, queryOptions };

View File

@@ -0,0 +1,24 @@
import { DefaultError, QueryKey, NonUndefinedGuard, QueryFunction, InitialDataFunction, DataTag, OmitKeyof, SkipToken } 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 DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {
initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
queryFn?: QueryFunction<TQueryFnData, TQueryKey>;
};
declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
};
declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {
queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
};
declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
};
export { type DefinedInitialDataOptions, type UndefinedInitialDataOptions, type UnusedSkipTokenOptions, queryOptions };

View File

@@ -0,0 +1,8 @@
// src/queryOptions.ts
function queryOptions(options) {
return options;
}
export {
queryOptions
};
//# sourceMappingURL=queryOptions.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/queryOptions.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { UseQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = UseQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"mappings":";AAoFO,SAAS,aAAa,SAAkB;AAC7C,SAAO;AACT;","names":[]}

View 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) {
const clamp = (value) => value === "static" ? value : Math.max(value ?? 1e3, 1e3);
const originalStaleTime = defaultedOptions.staleTime;
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
if (typeof defaultedOptions.gcTime === "number") {
defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 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

View 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 // Handle staleTime to ensure minimum 1000ms in Suspense mode\n // This prevents unnecessary refetching when components remount after suspending\n\n const clamp = (value: number | 'static' | undefined) =>\n value === 'static' ? value : Math.max(value ?? 1000, 1000)\n\n const originalStaleTime = defaultedOptions.staleTime\n defaultedOptions.staleTime =\n typeof originalStaleTime === 'function'\n ? (...args) => clamp(originalStaleTime(...args))\n : clamp(originalStaleTime)\n\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(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;AAI7B,UAAM,QAAQ,CAAC,UACb,UAAU,WAAW,QAAQ,KAAK,IAAI,SAAS,KAAM,GAAI;AAE3D,UAAM,oBAAoB,iBAAiB;AAC3C,qBAAiB,YACf,OAAO,sBAAsB,aACzB,IAAI,SAAS,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAC7C,MAAM,iBAAiB;AAE7B,QAAI,OAAO,iBAAiB,WAAW,UAAU;AAC/C,uBAAiB,SAAS,KAAK,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":[]}

View File

@@ -0,0 +1,12 @@
import { DefaultError, 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 = DefaultError, 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 };

View File

@@ -0,0 +1,12 @@
import { DefaultError, 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 = DefaultError, 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 };

View File

@@ -0,0 +1,25 @@
// src/suspense.ts
var defaultThrowOnError = (_error, query) => query.state.data === void 0;
var ensureSuspenseTimers = (defaultedOptions) => {
if (defaultedOptions.suspense) {
const clamp = (value) => value === "static" ? value : Math.max(value ?? 1e3, 1e3);
const originalStaleTime = defaultedOptions.staleTime;
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
if (typeof defaultedOptions.gcTime === "number") {
defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, 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

View 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 // Handle staleTime to ensure minimum 1000ms in Suspense mode\n // This prevents unnecessary refetching when components remount after suspending\n\n const clamp = (value: number | 'static' | undefined) =>\n value === 'static' ? value : Math.max(value ?? 1000, 1000)\n\n const originalStaleTime = defaultedOptions.staleTime\n defaultedOptions.staleTime =\n typeof originalStaleTime === 'function'\n ? (...args) => clamp(originalStaleTime(...args))\n : clamp(originalStaleTime)\n\n if (typeof defaultedOptions.gcTime === 'number') {\n defaultedOptions.gcTime = Math.max(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;AAI7B,UAAM,QAAQ,CAAC,UACb,UAAU,WAAW,QAAQ,KAAK,IAAI,SAAS,KAAM,GAAI;AAE3D,UAAM,oBAAoB,iBAAiB;AAC3C,qBAAiB,YACf,OAAO,sBAAsB,aACzB,IAAI,SAAS,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAC7C,MAAM,iBAAiB;AAE7B,QAAI,OAAO,iBAAiB,WAAW,UAAU;AAC/C,uBAAiB,SAAS,KAAK,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":[]}

View 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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,52 @@
import { DefaultError, QueryObserverResult, DefinedQueryObserverResult, QueryKey, OmitKeyof, QueryObserverOptions, SkipToken, DistributiveOmit, InfiniteQueryObserverOptions, DefinedInfiniteQueryObserverResult, FetchQueryOptions, MutationObserverOptions, Override, MutationObserverResult, MutateFunction, InfiniteQueryObserverResult } from '@tanstack/query-core';
type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>;
interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
/**
* Set this to `false` to unsubscribe this observer from updates to the query cache.
* Defaults to `true`.
*/
subscribed?: boolean;
}
interface UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> {
queryFn?: Exclude<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>;
}
type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>;
interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {
}
type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>;
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>;
}
type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>;
interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> {
/**
* Set this to `false` to unsubscribe this observer from updates to the query cache.
* Defaults to `true`.
*/
subscribed?: boolean;
}
type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>;
interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken>;
}
type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<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'>;
type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
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 { AnyUseBaseQueryOptions, AnyUseInfiniteQueryOptions, AnyUseMutationOptions, AnyUseQueryOptions, AnyUseSuspenseInfiniteQueryOptions, AnyUseSuspenseQueryOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UsePrefetchQueryOptions, UseQueryOptions, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult };

View File

@@ -0,0 +1,52 @@
import { DefaultError, QueryObserverResult, DefinedQueryObserverResult, QueryKey, OmitKeyof, QueryObserverOptions, SkipToken, DistributiveOmit, InfiniteQueryObserverOptions, DefinedInfiniteQueryObserverResult, FetchQueryOptions, MutationObserverOptions, Override, MutationObserverResult, MutateFunction, InfiniteQueryObserverResult } from '@tanstack/query-core';
type AnyUseBaseQueryOptions = UseBaseQueryOptions<any, any, any, any, any>;
interface UseBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
/**
* Set this to `false` to unsubscribe this observer from updates to the query cache.
* Defaults to `true`.
*/
subscribed?: boolean;
}
interface UsePrefetchQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> {
queryFn?: Exclude<FetchQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken>;
}
type AnyUseQueryOptions = UseQueryOptions<any, any, any, any>;
interface UseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<UseBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {
}
type AnyUseSuspenseQueryOptions = UseSuspenseQueryOptions<any, any, any, any>;
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>;
}
type AnyUseInfiniteQueryOptions = UseInfiniteQueryOptions<any, any, any, any, any>;
interface UseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> {
/**
* Set this to `false` to unsubscribe this observer from updates to the query cache.
* Defaults to `true`.
*/
subscribed?: boolean;
}
type AnyUseSuspenseInfiniteQueryOptions = UseSuspenseInfiniteQueryOptions<any, any, any, any, any>;
interface UseSuspenseInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn' | 'enabled' | 'throwOnError' | 'placeholderData'> {
queryFn?: Exclude<UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken>;
}
type UseBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>;
type UseQueryResult<TData = unknown, TError = DefaultError> = UseBaseQueryResult<TData, TError>;
type UseSuspenseQueryResult<TData = unknown, TError = DefaultError> = DistributiveOmit<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'>;
type AnyUseMutationOptions = UseMutationOptions<any, any, any, any>;
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 { AnyUseBaseQueryOptions, AnyUseInfiniteQueryOptions, AnyUseMutationOptions, AnyUseQueryOptions, AnyUseSuspenseInfiniteQueryOptions, AnyUseSuspenseQueryOptions, DefinedUseInfiniteQueryResult, DefinedUseQueryResult, UseBaseMutationResult, UseBaseQueryOptions, UseBaseQueryResult, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutateAsyncFunction, UseMutateFunction, UseMutationOptions, UseMutationResult, UsePrefetchQueryOptions, UseQueryOptions, UseQueryResult, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult, UseSuspenseQueryOptions, UseSuspenseQueryResult };

View File

@@ -0,0 +1 @@
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}

View File

@@ -0,0 +1,132 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/useBaseQuery.ts
var useBaseQuery_exports = {};
__export(useBaseQuery_exports, {
useBaseQuery: () => useBaseQuery
});
module.exports = __toCommonJS(useBaseQuery_exports);
var React = __toESM(require("react"), 1);
var import_query_core = require("@tanstack/query-core");
var import_QueryClientProvider = require("./QueryClientProvider.cjs");
var import_QueryErrorResetBoundary = require("./QueryErrorResetBoundary.cjs");
var import_errorBoundaryUtils = require("./errorBoundaryUtils.cjs");
var import_IsRestoringProvider = require("./IsRestoringProvider.cjs");
var import_suspense = require("./suspense.cjs");
function useBaseQuery(options, Observer, queryClient) {
var _a, _b, _c, _d, _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 isRestoring = (0, import_IsRestoringProvider.useIsRestoring)();
const errorResetBoundary = (0, import_QueryErrorResetBoundary.useQueryErrorResetBoundary)();
const client = (0, import_QueryClientProvider.useQueryClient)(queryClient);
const defaultedOptions = client.defaultQueryOptions(options);
(_b = (_a = client.getDefaultOptions().queries) == null ? void 0 : _a._experimental_beforeQuery) == null ? void 0 : _b.call(
_a,
defaultedOptions
);
if (process.env.NODE_ENV !== "production") {
if (!defaultedOptions.queryFn) {
console.error(
`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
);
}
}
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
(0, import_suspense.ensureSuspenseTimers)(defaultedOptions);
(0, import_errorBoundaryUtils.ensurePreventErrorBoundaryRetry)(defaultedOptions, errorResetBoundary);
(0, import_errorBoundaryUtils.useClearResetErrorBoundary)(errorResetBoundary);
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
const [observer] = React.useState(
() => new Observer(
client,
defaultedOptions
)
);
const result = observer.getOptimisticResult(defaultedOptions);
const shouldSubscribe = !isRestoring && options.subscribed !== false;
React.useSyncExternalStore(
React.useCallback(
(onStoreChange) => {
const unsubscribe = shouldSubscribe ? observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)) : import_query_core.noop;
observer.updateResult();
return unsubscribe;
},
[observer, shouldSubscribe]
),
() => observer.getCurrentResult(),
() => observer.getCurrentResult()
);
React.useEffect(() => {
observer.setOptions(defaultedOptions);
}, [defaultedOptions, observer]);
if ((0, import_suspense.shouldSuspend)(defaultedOptions, result)) {
throw (0, import_suspense.fetchOptimistic)(defaultedOptions, observer, errorResetBoundary);
}
if ((0, import_errorBoundaryUtils.getHasError)({
result,
errorResetBoundary,
throwOnError: defaultedOptions.throwOnError,
query: client.getQueryCache().get(defaultedOptions.queryHash),
suspense: defaultedOptions.suspense
})) {
throw result.error;
}
;
(_d = (_c = client.getDefaultOptions().queries) == null ? void 0 : _c._experimental_afterQuery) == null ? void 0 : _d.call(
_c,
defaultedOptions,
result
);
if (defaultedOptions.experimental_prefetchInRender && !import_query_core.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_query_core.noop).finally(() => {
observer.updateResult();
});
}
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useBaseQuery
});
//# sourceMappingURL=useBaseQuery.cjs.map

File diff suppressed because one or more lines are too long

View 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 };

View 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 };

View File

@@ -0,0 +1,107 @@
"use client";
// src/useBaseQuery.ts
import * as React from "react";
import { isServer, noop, notifyManager } from "@tanstack/query-core";
import { useQueryClient } from "./QueryClientProvider.js";
import { useQueryErrorResetBoundary } from "./QueryErrorResetBoundary.js";
import {
ensurePreventErrorBoundaryRetry,
getHasError,
useClearResetErrorBoundary
} from "./errorBoundaryUtils.js";
import { useIsRestoring } from "./IsRestoringProvider.js";
import {
ensureSuspenseTimers,
fetchOptimistic,
shouldSuspend,
willFetch
} from "./suspense.js";
function useBaseQuery(options, Observer, queryClient) {
var _a, _b, _c, _d, _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 isRestoring = useIsRestoring();
const errorResetBoundary = useQueryErrorResetBoundary();
const client = useQueryClient(queryClient);
const defaultedOptions = client.defaultQueryOptions(options);
(_b = (_a = client.getDefaultOptions().queries) == null ? void 0 : _a._experimental_beforeQuery) == null ? void 0 : _b.call(
_a,
defaultedOptions
);
if (process.env.NODE_ENV !== "production") {
if (!defaultedOptions.queryFn) {
console.error(
`[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`
);
}
}
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
ensureSuspenseTimers(defaultedOptions);
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
useClearResetErrorBoundary(errorResetBoundary);
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
const [observer] = React.useState(
() => new Observer(
client,
defaultedOptions
)
);
const result = observer.getOptimisticResult(defaultedOptions);
const shouldSubscribe = !isRestoring && options.subscribed !== false;
React.useSyncExternalStore(
React.useCallback(
(onStoreChange) => {
const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
observer.updateResult();
return unsubscribe;
},
[observer, shouldSubscribe]
),
() => observer.getCurrentResult(),
() => observer.getCurrentResult()
);
React.useEffect(() => {
observer.setOptions(defaultedOptions);
}, [defaultedOptions, observer]);
if (shouldSuspend(defaultedOptions, result)) {
throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
}
if (getHasError({
result,
errorResetBoundary,
throwOnError: defaultedOptions.throwOnError,
query: client.getQueryCache().get(defaultedOptions.queryHash),
suspense: defaultedOptions.suspense
})) {
throw result.error;
}
;
(_d = (_c = client.getDefaultOptions().queries) == null ? void 0 : _c._experimental_afterQuery) == null ? void 0 : _d.call(
_c,
defaultedOptions,
result
);
if (defaultedOptions.experimental_prefetchInRender && !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

File diff suppressed because one or more lines are too long

View 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

View 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 TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAAsC;AACtC,0BAA6B;AAqEtB,SAAS,iBACd,SACA,aACA;AACA,aAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}

View 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, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>;
export { useInfiniteQuery };

View 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, TQueryKey, TPageParam>, queryClient?: QueryClient): UseInfiniteQueryResult<TData, TError>;
export { useInfiniteQuery };

View 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

View 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 TQueryKey,\n TPageParam\n >,\n queryClient?: QueryClient,\n): UseInfiniteQueryResult<TData, TError>\n\nexport function useInfiniteQuery(\n options: UseInfiniteQueryOptions,\n queryClient?: QueryClient,\n) {\n return useBaseQuery(\n options,\n InfiniteQueryObserver as typeof QueryObserver,\n queryClient,\n )\n}\n"],"mappings":";;;AACA,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAqEtB,SAAS,iBACd,SACA,aACA;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}

View 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

View 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":[]}

View File

@@ -0,0 +1,5 @@
import { QueryFilters, QueryClient } from '@tanstack/query-core';
declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number;
export { useIsFetching };

View File

@@ -0,0 +1,5 @@
import { QueryFilters, QueryClient } from '@tanstack/query-core';
declare function useIsFetching(filters?: QueryFilters, queryClient?: QueryClient): number;
export { useIsFetching };

View 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

View 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":[]}

View File

@@ -0,0 +1,74 @@
"use strict";
"use client";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/useMutation.ts
var useMutation_exports = {};
__export(useMutation_exports, {
useMutation: () => useMutation
});
module.exports = __toCommonJS(useMutation_exports);
var React = __toESM(require("react"), 1);
var import_query_core = require("@tanstack/query-core");
var import_QueryClientProvider = require("./QueryClientProvider.cjs");
function useMutation(options, queryClient) {
const client = (0, import_QueryClientProvider.useQueryClient)(queryClient);
const [observer] = React.useState(
() => new import_query_core.MutationObserver(
client,
options
)
);
React.useEffect(() => {
observer.setOptions(options);
}, [observer, options]);
const result = React.useSyncExternalStore(
React.useCallback(
(onStoreChange) => observer.subscribe(import_query_core.notifyManager.batchCalls(onStoreChange)),
[observer]
),
() => observer.getCurrentResult(),
() => observer.getCurrentResult()
);
const mutate = React.useCallback(
(variables, mutateOptions) => {
observer.mutate(variables, mutateOptions).catch(import_query_core.noop);
},
[observer]
);
if (result.error && (0, import_query_core.shouldThrowError)(observer.options.throwOnError, [result.error])) {
throw result.error;
}
return { ...result, mutate, mutateAsync: result.mutate };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useMutation
});
//# sourceMappingURL=useMutation.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../src/useMutation.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport {\n MutationObserver,\n noop,\n notifyManager,\n shouldThrowError,\n} from '@tanstack/query-core'\nimport { useQueryClient } from './QueryClientProvider'\nimport type {\n UseMutateFunction,\n UseMutationOptions,\n UseMutationResult,\n} from './types'\nimport type { DefaultError, QueryClient } from '@tanstack/query-core'\n\n// HOOK\n\nexport function useMutation<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n 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,wBAKO;AACP,iCAA+B;AAUxB,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,sBAAI;AAAA,IACtD;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,MACE,OAAO,aACP,oCAAiB,SAAS,QAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,GAC9D;AACA,UAAM,OAAO;AAAA,EACf;AAEA,SAAO,EAAE,GAAG,QAAQ,QAAQ,aAAa,OAAO,OAAO;AACzD;","names":[]}

Some files were not shown because too many files have changed in this diff Show More