@tanstack/solid-query
Advanced tools
Comparing version 5.0.0-alpha.34 to 5.0.0-alpha.38
@@ -51,2 +51,6 @@ 'use strict'; | ||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ | ||
// Had to disable the lint rule because isServer type is defined as false | ||
// in solid-js/web package. I'll create a GitHub issue with them to see | ||
// why that happens. | ||
function reconcileFn(store$1, result, reconcileOption) { | ||
@@ -297,2 +301,11 @@ if (reconcileOption === false) return result; | ||
// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`. | ||
// `placeholderData` function does not have a parameter | ||
// Avoid TS depth-limit error in case of large array literal | ||
/** | ||
* QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
*/ | ||
/** | ||
* QueriesResults reducer recursively maps type param to results | ||
*/ | ||
function createQueries(queriesOptions, queryClient) { | ||
@@ -299,0 +312,0 @@ const client = useQueryClient(queryClient?.()); |
@@ -50,2 +50,6 @@ import { notifyManager, QueryClient as QueryClient$1, hydrate, QueryObserver, InfiniteQueryObserver, MutationObserver, QueriesObserver } from '@tanstack/query-core'; | ||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */ | ||
// Had to disable the lint rule because isServer type is defined as false | ||
// in solid-js/web package. I'll create a GitHub issue with them to see | ||
// why that happens. | ||
function reconcileFn(store, result, reconcileOption) { | ||
@@ -296,2 +300,11 @@ if (reconcileOption === false) return result; | ||
// This defines the `UseQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`. | ||
// `placeholderData` function does not have a parameter | ||
// Avoid TS depth-limit error in case of large array literal | ||
/** | ||
* QueriesOptions reducer recursively unwraps function arguments to infer/enforce type param | ||
*/ | ||
/** | ||
* QueriesResults reducer recursively maps type param to results | ||
*/ | ||
function createQueries(queriesOptions, queryClient) { | ||
@@ -298,0 +311,0 @@ const client = useQueryClient(queryClient?.()); |
@@ -1,3 +0,3 @@ | ||
export declare type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false; | ||
export declare type Expect<T extends true> = T; | ||
export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false; | ||
export type Expect<T extends true> = T; | ||
//# sourceMappingURL=createQuery.types.test.d.ts.map |
@@ -10,4 +10,4 @@ /// <reference types="node" /> | ||
export declare function createQueryClient(config?: QueryClientConfig): QueryClient; | ||
export declare function mockVisibilityState(value: DocumentVisibilityState): import("vitest/dist/index-1cfc7f58").S<[], DocumentVisibilityState>; | ||
export declare function mockNavigatorOnLine(value: boolean): import("vitest/dist/index-1cfc7f58").S<[], boolean>; | ||
export declare function mockVisibilityState(value: DocumentVisibilityState): import("vitest/dist/index-2dd51af4").S<[], DocumentVisibilityState>; | ||
export declare function mockNavigatorOnLine(value: boolean): import("vitest/dist/index-2dd51af4").S<[], boolean>; | ||
export declare function sleep(timeout: number): Promise<void>; | ||
@@ -14,0 +14,0 @@ export declare function setActTimeout(fn: () => void, ms?: number): NodeJS.Timeout; |
@@ -5,7 +5,7 @@ import type { QueriesPlaceholderDataFunction, QueryFunction, QueryKey, DefaultError } from '@tanstack/query-core'; | ||
import type { CreateQueryResult, SolidQueryOptions } from './types'; | ||
declare type CreateQueryOptionsForCreateQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData'> & { | ||
type CreateQueryOptionsForCreateQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData'> & { | ||
placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>; | ||
}; | ||
declare type MAXIMUM_DEPTH = 20; | ||
declare type GetOptions<T> = T extends { | ||
type MAXIMUM_DEPTH = 20; | ||
type GetOptions<T> = T extends { | ||
queryFnData: infer TQueryFnData; | ||
@@ -26,3 +26,3 @@ error?: infer TError; | ||
} ? CreateQueryOptionsForCreateQueries<TQueryFnData, Error, TQueryFnData, TQueryKey> : CreateQueryOptionsForCreateQueries; | ||
declare type GetResults<T> = T extends { | ||
type GetResults<T> = T extends { | ||
queryFnData: any; | ||
@@ -46,7 +46,7 @@ error?: infer TError; | ||
*/ | ||
export declare type QueriesOptions<T extends any[], Result extends any[] = [], Depth extends ReadonlyArray<number> = []> = Depth['length'] extends MAXIMUM_DEPTH ? CreateQueryOptionsForCreateQueries[] : T extends [] ? [] : T extends [infer Head] ? [...Result, GetOptions<Head>] : T extends [infer Head, ...infer Tail] ? QueriesOptions<[...Tail], [...Result, GetOptions<Head>], [...Depth, 1]> : unknown[] extends T ? T : T extends CreateQueryOptionsForCreateQueries<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>[] ? CreateQueryOptionsForCreateQueries<TQueryFnData, TError, TData, TQueryKey>[] : CreateQueryOptionsForCreateQueries[]; | ||
export type QueriesOptions<T extends any[], Result extends any[] = [], Depth extends ReadonlyArray<number> = []> = Depth['length'] extends MAXIMUM_DEPTH ? CreateQueryOptionsForCreateQueries[] : T extends [] ? [] : T extends [infer Head] ? [...Result, GetOptions<Head>] : T extends [infer Head, ...infer Tail] ? QueriesOptions<[...Tail], [...Result, GetOptions<Head>], [...Depth, 1]> : unknown[] extends T ? T : T extends CreateQueryOptionsForCreateQueries<infer TQueryFnData, infer TError, infer TData, infer TQueryKey>[] ? CreateQueryOptionsForCreateQueries<TQueryFnData, TError, TData, TQueryKey>[] : CreateQueryOptionsForCreateQueries[]; | ||
/** | ||
* QueriesResults reducer recursively maps type param to results | ||
*/ | ||
export declare type QueriesResults<T extends any[], Result extends any[] = [], Depth extends ReadonlyArray<number> = []> = Depth['length'] extends MAXIMUM_DEPTH ? CreateQueryResult[] : T extends [] ? [] : T extends [infer Head] ? [...Result, GetResults<Head>] : T extends [infer Head, ...infer Tail] ? QueriesResults<[...Tail], [...Result, GetResults<Head>], [...Depth, 1]> : T extends CreateQueryOptionsForCreateQueries<infer TQueryFnData, infer TError, infer TData, any>[] ? CreateQueryResult<unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError>[] : CreateQueryResult[]; | ||
export type QueriesResults<T extends any[], Result extends any[] = [], Depth extends ReadonlyArray<number> = []> = Depth['length'] extends MAXIMUM_DEPTH ? CreateQueryResult[] : T extends [] ? [] : T extends [infer Head] ? [...Result, GetResults<Head>] : T extends [infer Head, ...infer Tail] ? QueriesResults<[...Tail], [...Result, GetResults<Head>], [...Depth, 1]> : T extends CreateQueryOptionsForCreateQueries<infer TQueryFnData, infer TError, infer TData, any>[] ? CreateQueryResult<unknown extends TData ? TQueryFnData : TData, unknown extends TError ? DefaultError : TError>[] : CreateQueryResult[]; | ||
export declare function createQueries<T extends any[], TCombinedResult = QueriesResults<T>>(queriesOptions: Accessor<{ | ||
@@ -53,0 +53,0 @@ queries: readonly [...QueriesOptions<T>]; |
import type { QueryKey, DefaultError } from '@tanstack/query-core'; | ||
import type { QueryClient } from './QueryClient'; | ||
import type { CreateQueryResult, DefinedCreateQueryResult, FunctionedParams, SolidQueryOptions } from './types'; | ||
declare type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = FunctionedParams<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = FunctionedParams<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
initialData?: undefined; | ||
}>; | ||
declare type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = FunctionedParams<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = FunctionedParams<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey> & { | ||
initialData: TQueryFnData | (() => TQueryFnData); | ||
@@ -9,0 +9,0 @@ }>; |
@@ -5,3 +5,3 @@ import type { QueryClient } from './QueryClient'; | ||
export declare const useQueryClient: (queryClient?: QueryClient) => QueryClient; | ||
export declare type QueryClientProviderProps = { | ||
export type QueryClientProviderProps = { | ||
client: QueryClient; | ||
@@ -8,0 +8,0 @@ children?: JSX.Element; |
import type { QueryKey, QueryObserverResult, MutateFunction, MutationObserverOptions, MutationObserverResult, DefinedQueryObserverResult, InfiniteQueryObserverResult, WithRequired, DefaultError } from '@tanstack/query-core'; | ||
import type { QueryObserverOptions, InfiniteQueryObserverOptions } from './QueryClient'; | ||
export declare type FunctionedParams<T> = () => T; | ||
export type FunctionedParams<T> = () => T; | ||
export interface CreateBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends WithRequired<QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey>, 'queryKey'> { | ||
@@ -9,7 +9,7 @@ deferStream?: boolean; | ||
} | ||
export declare type CreateQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = FunctionedParams<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>>; | ||
export declare type CreateBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>; | ||
export declare type CreateQueryResult<TData = unknown, TError = DefaultError> = CreateBaseQueryResult<TData, TError>; | ||
export declare type DefinedCreateBaseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>; | ||
export declare type DefinedCreateQueryResult<TData = unknown, TError = DefaultError> = DefinedCreateBaseQueryResult<TData, TError>; | ||
export type CreateQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = FunctionedParams<SolidQueryOptions<TQueryFnData, TError, TData, TQueryKey>>; | ||
export type CreateBaseQueryResult<TData = unknown, TError = DefaultError> = QueryObserverResult<TData, TError>; | ||
export type CreateQueryResult<TData = unknown, TError = DefaultError> = CreateBaseQueryResult<TData, TError>; | ||
export type DefinedCreateBaseQueryResult<TData = unknown, TError = DefaultError> = DefinedQueryObserverResult<TData, TError>; | ||
export type DefinedCreateQueryResult<TData = unknown, TError = DefaultError> = DefinedCreateBaseQueryResult<TData, TError>; | ||
export interface SolidInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends Omit<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey, TPageParam>, 'queryKey'> { | ||
@@ -19,10 +19,10 @@ queryKey: TQueryKey; | ||
} | ||
export declare type CreateInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = FunctionedParams<SolidInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam>>; | ||
export declare type CreateInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>; | ||
export type CreateInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = FunctionedParams<SolidInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey, TPageParam>>; | ||
export type CreateInfiniteQueryResult<TData = unknown, TError = DefaultError> = InfiniteQueryObserverResult<TData, TError>; | ||
export interface SolidMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> extends Omit<MutationObserverOptions<TData, TError, TVariables, TContext>, '_defaulted' | 'variables'> { | ||
} | ||
export declare type CreateMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = FunctionedParams<SolidMutationOptions<TData, TError, TVariables, TContext>>; | ||
export declare type CreateMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>) => void; | ||
export declare type CreateMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MutateFunction<TData, TError, TVariables, TContext>; | ||
export declare type CreateBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TContext>, { | ||
export type CreateMutationOptions<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = FunctionedParams<SolidMutationOptions<TData, TError, TVariables, TContext>>; | ||
export type CreateMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>) => void; | ||
export type CreateMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MutateFunction<TData, TError, TVariables, TContext>; | ||
export type CreateBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TContext>, { | ||
mutate: CreateMutateFunction<TData, TError, TVariables, TContext>; | ||
@@ -32,4 +32,4 @@ }> & { | ||
}; | ||
export declare type CreateMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = CreateBaseMutationResult<TData, TError, TVariables, TContext>; | ||
declare type Override<A, B> = { | ||
export type CreateMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = CreateBaseMutationResult<TData, TError, TVariables, TContext>; | ||
type Override<A, B> = { | ||
[K in keyof A]: K extends keyof B ? B[K] : A[K]; | ||
@@ -36,0 +36,0 @@ }; |
{ | ||
"name": "@tanstack/solid-query", | ||
"version": "5.0.0-alpha.34", | ||
"version": "5.0.0-alpha.38", | ||
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Solid", | ||
@@ -42,8 +42,8 @@ "author": "tannerlinsley", | ||
], | ||
"dependencies": { | ||
"@tanstack/query-core": "5.0.0-alpha.38" | ||
}, | ||
"devDependencies": { | ||
"vite-plugin-solid": "^2.3.9" | ||
"vite-plugin-solid": "^2.5.0" | ||
}, | ||
"dependencies": { | ||
"@tanstack/query-core": "5.0.0-alpha.34" | ||
}, | ||
"peerDependencies": { | ||
@@ -50,0 +50,0 @@ "solid-js": "^1.6.13" |
@@ -11,4 +11,3 @@ /* eslint-disable @typescript-eslint/no-unnecessary-condition */ | ||
import type { QueryClient } from './QueryClient' | ||
import { hydrate } from '@tanstack/query-core' | ||
import { notifyManager } from '@tanstack/query-core' | ||
import { hydrate, notifyManager } from '@tanstack/query-core' | ||
import type { Accessor } from 'solid-js' | ||
@@ -15,0 +14,0 @@ import { isServer } from 'solid-js/web' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
849049
104
20647
5
135
+ Added@tanstack/query-core@5.0.0-alpha.38(transitive)
- Removed@tanstack/query-core@5.0.0-alpha.34(transitive)