@tanstack/svelte-query 6.4.1 → 6.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/HydrationBoundary.svelte +1 -1
- package/dist/HydrationBoundary.svelte.d.ts +1 -1
- package/dist/HydrationBoundary.svelte.d.ts.map +1 -1
- package/dist/QueryClientProvider.svelte +1 -1
- package/dist/createBaseQuery.svelte.js +1 -1
- package/dist/createInfiniteQuery.d.ts +1 -1
- package/dist/createInfiniteQuery.d.ts.map +1 -1
- package/dist/createMutation.svelte.d.ts +1 -1
- package/dist/createMutation.svelte.d.ts.map +1 -1
- package/dist/createQueries.svelte.d.ts +1 -1
- package/dist/createQueries.svelte.d.ts.map +1 -1
- package/dist/createQueries.svelte.js +1 -1
- package/dist/createQuery.d.ts +14 -10
- package/dist/createQuery.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useIsMutating.svelte.d.ts.map +1 -1
- package/dist/useIsMutating.svelte.js +1 -1
- package/package.json +3 -3
- package/src/HydrationBoundary.svelte +1 -1
- package/src/QueryClientProvider.svelte +1 -1
- package/src/createBaseQuery.svelte.ts +1 -1
- package/src/createInfiniteQuery.ts +4 -4
- package/src/createMutation.svelte.ts +1 -2
- package/src/createQueries.svelte.ts +7 -7
- package/src/createQuery.ts +17 -13
- package/src/index.ts +27 -2
- package/src/types.ts +1 -1
- package/src/useIsMutating.svelte.ts +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useHydrate } from './useHydrate.js'
|
|
3
|
-
import type { Snippet } from 'svelte'
|
|
4
3
|
import type {
|
|
5
4
|
DehydratedState,
|
|
6
5
|
HydrateOptions,
|
|
7
6
|
QueryClient,
|
|
8
7
|
} from '@tanstack/query-core'
|
|
8
|
+
import type { Snippet } from 'svelte'
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
11
11
|
children: Snippet
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HydrationBoundary.svelte.d.ts","sourceRoot":"","sources":["../src/HydrationBoundary.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"HydrationBoundary.svelte.d.ts","sourceRoot":"","sources":["../src/HydrationBoundary.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,eAAe,EACf,cAAc,EACd,WAAW,EACZ,MAAM,sBAAsB,CAAA;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGpC,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,eAAe,CAAA;IACtB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAC;AAgBJ,QAAA,MAAM,iBAAiB,2CAAwC,CAAC;AAChE,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onDestroy, onMount } from 'svelte'
|
|
3
2
|
import { QueryClient } from '@tanstack/query-core'
|
|
3
|
+
import { onDestroy, onMount } from 'svelte'
|
|
4
4
|
import { setQueryClientContext } from './context.js'
|
|
5
5
|
import type { QueryClientProviderProps } from './types.js'
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { onDestroy } from 'svelte';
|
|
2
|
+
import { createRawRef } from './containers.svelte.js';
|
|
2
3
|
import { useIsRestoring } from './useIsRestoring.js';
|
|
3
4
|
import { useQueryClient } from './useQueryClient.js';
|
|
4
|
-
import { createRawRef } from './containers.svelte.js';
|
|
5
5
|
import { watchChanges } from './utils.svelte.js';
|
|
6
6
|
/**
|
|
7
7
|
* Base implementation for `createQuery` and `createInfiniteQuery`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DefaultError, InfiniteData, QueryClient, QueryKey } from '@tanstack/query-core';
|
|
2
|
-
import type { Accessor, CreateInfiniteQueryOptions, CreateInfiniteQueryResult, DefinedCreateInfiniteQueryResult } from './types.js';
|
|
3
2
|
import type { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions } from './infiniteQueryOptions.js';
|
|
3
|
+
import type { Accessor, CreateInfiniteQueryOptions, CreateInfiniteQueryResult, DefinedCreateInfiniteQueryResult } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The options for `createInfiniteQuery` are identical to `createQuery`, with the addition of
|
|
6
6
|
* `initialPageParam`, `getNextPageParam`, `getPreviousPageParam`, and `maxPages`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInfiniteQuery.d.ts","sourceRoot":"","sources":["../src/createInfiniteQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,QAAQ,EAET,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"createInfiniteQuery.d.ts","sourceRoot":"","sources":["../src/createInfiniteQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,QAAQ,EAET,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,iCAAiC,EACjC,mCAAmC,EACpC,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,QAAQ,EACR,0BAA0B,EAC1B,yBAAyB,EACzB,gCAAgC,EACjC,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,CAAC,YA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ationOptions, CreateMutationResult } from './types.js';
|
|
2
1
|
import type { DefaultError, QueryClient } from '@tanstack/query-core';
|
|
2
|
+
import type { Accessor, CreateMutationOptions, CreateMutationResult } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
|
|
5
5
|
* `createMutation` is the function for that.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMutation.svelte.d.ts","sourceRoot":"","sources":["../src/createMutation.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"createMutation.svelte.d.ts","sourceRoot":"","sources":["../src/createMutation.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,KAAK,EACV,QAAQ,EAER,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuJG;AACH,wBAAgB,cAAc,CAC5B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,OAAO,EAElB,OAAO,EAAE,QAAQ,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,EAC7E,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAiE3D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Accessor, CreateQueryOptions, CreateQueryResult, DefinedCreateQueryResult } from './types.js';
|
|
2
1
|
import type { DefaultError, OmitKeyof, QueriesPlaceholderDataFunction, QueryClient, QueryFunction, QueryKey, ThrowOnError } from '@tanstack/query-core';
|
|
2
|
+
import type { Accessor, CreateQueryOptions, CreateQueryResult, DefinedCreateQueryResult } from './types.js';
|
|
3
3
|
type CreateQueryOptionsForCreateQueries<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'placeholderData'> & {
|
|
4
4
|
placeholderData?: TQueryFnData | QueriesPlaceholderDataFunction<TQueryFnData>;
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQueries.svelte.d.ts","sourceRoot":"","sources":["../src/createQueries.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"createQueries.svelte.d.ts","sourceRoot":"","sources":["../src/createQueries.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EAET,8BAA8B,EAC9B,WAAW,EACX,aAAa,EACb,QAAQ,EACR,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,YAAY,CAAA;AAInB,KAAK,kCAAkC,CACrC,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,EACpB,SAAS,SAAS,QAAQ,GAAG,QAAQ,IACnC,SAAS,CACX,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAC1D,iBAAiB,CAClB,GAAG;IACF,eAAe,CAAC,EAAE,YAAY,GAAG,8BAA8B,CAAC,YAAY,CAAC,CAAA;CAC9E,CAAA;AAGD,KAAK,aAAa,GAAG,EAAE,CAAA;AAGvB,KAAK,yBAAyB,GAAG,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;;;;;;GAqEG;AACH,wBAAgB,aAAa,CAC3B,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EACpB,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,EAEnC,oBAAoB,EAAE,QAAQ,CAAC;IAC7B,OAAO,EACH,SAAS,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,GAC/B,SAAS;QACP,GAAG;aAAG,CAAC,IAAI,MAAM,CAAC,GAAG,qCAAqC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAAE;KACnE,CAAA;IACL,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,eAAe,CAAA;CACzD,CAAC,EACF,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAClC,eAAe,CAwDjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueriesObserver } from '@tanstack/query-core';
|
|
2
|
-
import { useIsRestoring } from './useIsRestoring.js';
|
|
3
2
|
import { createRawRef } from './containers.svelte.js';
|
|
3
|
+
import { useIsRestoring } from './useIsRestoring.js';
|
|
4
4
|
import { useQueryClient } from './useQueryClient.js';
|
|
5
5
|
/**
|
|
6
6
|
* The `createQueries` function can be used to fetch a variable number of queries.
|
package/dist/createQuery.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core';
|
|
2
|
-
import type { Accessor, CreateQueryOptions, CreateQueryResult, DefinedCreateQueryResult } from './types.js';
|
|
3
2
|
import type { DefinedInitialDataOptions, UndefinedInitialDataOptions } from './queryOptions.js';
|
|
3
|
+
import type { Accessor, CreateQueryOptions, CreateQueryResult, DefinedCreateQueryResult } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
6
6
|
* The query runs when the options call for it — `enabled: false` skips the initial fetch.
|
|
7
7
|
*
|
|
8
|
-
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
|
|
9
|
-
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
8
|
+
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is typed as never
|
|
9
|
+
* `undefined` (unless a `select` changes `TData` to include `undefined`). At runtime, `data` is still `undefined`
|
|
10
|
+
* if `select` throws on its first call.
|
|
10
11
|
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `createQuery`,
|
|
11
12
|
* with `initialData` known to be defined, wrapped in an {@link Accessor} so options can be reactive.
|
|
12
13
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
13
14
|
* be used.
|
|
14
|
-
* @returns The current query result, typed so that `status` is `success`
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* @returns The current query result, typed so that `status` is `success` or `error` (`status` never
|
|
16
|
+
* resolves to `pending` in this overload's type, since `initialData` guarantees data upfront). `status` is
|
|
17
|
+
* `error` if the query has an error from a fetch that failed after its retries or if `select` threw, and
|
|
18
|
+
* `success` otherwise. `isSuccess`/`isError` are derived booleans for convenience.
|
|
17
19
|
* @see {@link queryOptions} to share these options between `createQuery` and imperative APIs like `queryClient.query`.
|
|
18
20
|
* @example
|
|
19
21
|
* ```svelte
|
|
@@ -47,8 +49,9 @@ export declare function createQuery<TQueryFnData = unknown, TError = DefaultErro
|
|
|
47
49
|
* wrapped in an {@link Accessor} so options can be reactive.
|
|
48
50
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
49
51
|
* be used.
|
|
50
|
-
* @returns The current query result. `status` is `
|
|
51
|
-
*
|
|
52
|
+
* @returns The current query result. `status` is `error` if the query has an error from a fetch that failed
|
|
53
|
+
* after its retries or if `select` threw, `success` if the query has cached data (even if `select` returns
|
|
54
|
+
* `undefined`) or data from `placeholderData`, and `pending` otherwise. `isPending`/`isSuccess`/`isError`
|
|
52
55
|
* are derived booleans for convenience.
|
|
53
56
|
* @see {@link queryOptions} to share these options between `createQuery` and imperative APIs like `queryClient.query`.
|
|
54
57
|
* @example
|
|
@@ -108,8 +111,9 @@ export declare function createQuery<TQueryFnData = unknown, TError = DefaultErro
|
|
|
108
111
|
* in an {@link Accessor} so options can be reactive.
|
|
109
112
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
110
113
|
* be used.
|
|
111
|
-
* @returns The current query result. `status` is `
|
|
112
|
-
*
|
|
114
|
+
* @returns The current query result. `status` is `error` if the query has an error from a fetch that failed
|
|
115
|
+
* after its retries or if `select` threw, `success` if the query has cached data (even if `select` returns
|
|
116
|
+
* `undefined`) or data from `placeholderData`, and `pending` otherwise. `isPending`/`isSuccess`/`isError`
|
|
113
117
|
* are derived booleans for convenience.
|
|
114
118
|
* @see {@link queryOptions} to share these options between `createQuery` and imperative APIs like `queryClient.query`.
|
|
115
119
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQuery.d.ts","sourceRoot":"","sources":["../src/createQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"createQuery.d.ts","sourceRoot":"","sources":["../src/createQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,WAAW,CACzB,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,YAAY,E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type
|
|
3
|
-
export
|
|
2
|
+
export type { Accessor, CreateBaseQueryOptions, CreateBaseQueryResult, CreateQueryOptions, CreateQueryResult, CreateInfiniteQueryOptions, CreateInfiniteQueryResult, DefinedCreateInfiniteQueryResult, DefinedCreateBaseQueryResult, DefinedCreateQueryResult, CreateMutationOptions, CreateMutateFunction, CreateMutateAsyncFunction, CreateBaseMutationResult, CreateMutationResult, MutationTypeFromResult, MutationStateOptions, QueryClientProviderProps, } from './types.js';
|
|
3
|
+
export { getQueryClientContext, setQueryClientContext, getIsRestoringContext, setIsRestoringContext, } from './context.js';
|
|
4
4
|
export { createQuery } from './createQuery.js';
|
|
5
5
|
export type { QueriesResults, QueriesOptions } from './createQueries.svelte.js';
|
|
6
6
|
export type { DefinedInitialDataOptions, UndefinedInitialDataOptions, } from './queryOptions.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAA;AAGpC,YAAY,EACV,QAAQ,EACR,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,yBAAyB,EACzB,gCAAgC,EAChC,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/E,YAAY,EACV,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,YAAY,EACV,iCAAiC,EACjC,mCAAmC,GACpC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8BAA8B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
// Re-export core
|
|
3
|
+
// oxlint-disable-next-line tanstack-query/no-restricted-syntax
|
|
3
4
|
export * from '@tanstack/query-core';
|
|
4
|
-
export
|
|
5
|
+
export { getQueryClientContext, setQueryClientContext, getIsRestoringContext, setIsRestoringContext, } from './context.js';
|
|
5
6
|
export { createQuery } from './createQuery.js';
|
|
6
7
|
export { queryOptions } from './queryOptions.js';
|
|
7
8
|
export { createQueries } from './createQueries.svelte.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
1
|
import type { DefaultError, DefinedInfiniteQueryObserverResult, DefinedQueryObserverResult, InfiniteQueryObserverOptions, InfiniteQueryObserverResult, MutateFunction, Mutation, MutationFilters, MutationObserverOptions, MutationObserverResult, MutationState, OmitKeyof, Override, QueryClient, QueryKey, QueryObserverOptions, QueryObserverResult } from '@tanstack/query-core';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
3
|
/**
|
|
4
4
|
* A function that returns a value. Options passed as an accessor are read inside reactive contexts, so they
|
|
5
5
|
* update when the state they read changes.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kCAAkC,EAClC,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,cAAc,EACd,QAAQ,EACR,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,SAAS,EACT,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC;;;GAGG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAA;AAEjC,kCAAkC;AAClC,MAAM,MAAM,sBAAsB,CAChC,YAAY,GAAG,OAAO,EACtB,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,EACpB,UAAU,GAAG,YAAY,EACzB,SAAS,SAAS,QAAQ,GAAG,QAAQ,IACnC,oBAAoB,CAAC,YA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B,CACpC,KAAK,EACL,MAAM,EACN,UAAU,EACV,eAAe,CAChB,CAAA;CACF,CAAA;AAED,iCAAiC;AACjC,MAAM,MAAM,oBAAoB,CAC9B,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EACpB,eAAe,GAAG,OAAO,IACvB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,CAAC,CAAA;AAExE;;;GAGG;AACH,MAAM,MAAM,sBAAsB,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS;IAC9D,aAAa,CACX,MAAM,KAAK,EACX,MAAM,MAAM,EACZ,MAAM,UAAU,EAChB,MAAM,eAAe,CACtB;CACF,GACG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,CAAC,GACpD,QAAQ,CAAA;AAEZ,mCAAmC;AACnC,MAAM,MAAM,oBAAoB,CAC9B,OAAO,GAAG,aAAa,EACvB,SAAS,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAC5C,sBAAsB,CAAC,OAAO,CAAC,IAC/B;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAA;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,OAAO,CAAA;CAC1C,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,MAAM,EAAE,WAAW,CAAA;IACnB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMutating.svelte.d.ts","sourceRoot":"","sources":["../src/useIsMutating.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIsMutating.svelte.d.ts","sourceRoot":"","sources":["../src/useIsMutating.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,EACzC,WAAW,CAAC,EAAE,WAAW,GACxB,aAAa,CAAC,MAAM,CAAC,CAQvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useQueryClient } from './useQueryClient.js';
|
|
2
1
|
import { ReactiveValue } from './containers.svelte.js';
|
|
2
|
+
import { useQueryClient } from './useQueryClient.js';
|
|
3
3
|
/**
|
|
4
4
|
* `useIsMutating` is an optional function that returns the `number` of mutations that your application is
|
|
5
5
|
* running (useful for app-wide loading indicators).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/svelte-query",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.3",
|
|
4
4
|
"description": "Primitives for managing, caching and syncing asynchronous and remote data in Svelte",
|
|
5
5
|
"author": "Lachlan Collins",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"!src/__tests__"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@tanstack/query-core": "5.
|
|
42
|
+
"@tanstack/query-core": "5.108.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@sveltejs/package": "^2.5.8",
|
|
46
46
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
47
47
|
"@tanstack/query-test-utils": "0.0.0",
|
|
48
48
|
"@testing-library/svelte": "^5.2.8",
|
|
49
|
-
"@typescript-eslint/parser": "^8.72.
|
|
49
|
+
"@typescript-eslint/parser": "^8.72.1",
|
|
50
50
|
"eslint-plugin-svelte": "^3.23.0",
|
|
51
51
|
"svelte": "^5.57.1",
|
|
52
52
|
"svelte-check": "^4.7.7",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { useHydrate } from './useHydrate.js'
|
|
3
|
-
import type { Snippet } from 'svelte'
|
|
4
3
|
import type {
|
|
5
4
|
DehydratedState,
|
|
6
5
|
HydrateOptions,
|
|
7
6
|
QueryClient,
|
|
8
7
|
} from '@tanstack/query-core'
|
|
8
|
+
import type { Snippet } from 'svelte'
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
11
11
|
children: Snippet
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { onDestroy, onMount } from 'svelte'
|
|
3
2
|
import { QueryClient } from '@tanstack/query-core'
|
|
3
|
+
import { onDestroy, onMount } from 'svelte'
|
|
4
4
|
import { setQueryClientContext } from './context.js'
|
|
5
5
|
import type { QueryClientProviderProps } from './types.js'
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { onDestroy } from 'svelte'
|
|
2
|
+
import { createRawRef } from './containers.svelte.js'
|
|
2
3
|
import { useIsRestoring } from './useIsRestoring.js'
|
|
3
4
|
import { useQueryClient } from './useQueryClient.js'
|
|
4
|
-
import { createRawRef } from './containers.svelte.js'
|
|
5
5
|
import { watchChanges } from './utils.svelte.js'
|
|
6
6
|
import type { QueryClient, QueryKey, QueryObserver } from '@tanstack/query-core'
|
|
7
7
|
import type {
|
|
@@ -7,16 +7,16 @@ import type {
|
|
|
7
7
|
QueryKey,
|
|
8
8
|
QueryObserver,
|
|
9
9
|
} from '@tanstack/query-core'
|
|
10
|
+
import type {
|
|
11
|
+
DefinedInitialDataInfiniteOptions,
|
|
12
|
+
UndefinedInitialDataInfiniteOptions,
|
|
13
|
+
} from './infiniteQueryOptions.js'
|
|
10
14
|
import type {
|
|
11
15
|
Accessor,
|
|
12
16
|
CreateInfiniteQueryOptions,
|
|
13
17
|
CreateInfiniteQueryResult,
|
|
14
18
|
DefinedCreateInfiniteQueryResult,
|
|
15
19
|
} from './types.js'
|
|
16
|
-
import type {
|
|
17
|
-
DefinedInitialDataInfiniteOptions,
|
|
18
|
-
UndefinedInitialDataInfiniteOptions,
|
|
19
|
-
} from './infiniteQueryOptions.js'
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The options for `createInfiniteQuery` are identical to `createQuery`, with the addition of
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MutationObserver, noop, notifyManager } from '@tanstack/query-core'
|
|
2
2
|
import { useQueryClient } from './useQueryClient.js'
|
|
3
3
|
import { watchChanges } from './utils.svelte.js'
|
|
4
|
+
import type { DefaultError, QueryClient } from '@tanstack/query-core'
|
|
4
5
|
import type {
|
|
5
6
|
Accessor,
|
|
6
7
|
CreateMutateFunction,
|
|
@@ -8,8 +9,6 @@ import type {
|
|
|
8
9
|
CreateMutationResult,
|
|
9
10
|
} from './types.js'
|
|
10
11
|
|
|
11
|
-
import type { DefaultError, QueryClient } from '@tanstack/query-core'
|
|
12
|
-
|
|
13
12
|
/**
|
|
14
13
|
* Unlike queries, mutations are typically used to create/update/delete data or perform server side-effects.
|
|
15
14
|
* `createMutation` is the function for that.
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { QueriesObserver } from '@tanstack/query-core'
|
|
2
|
-
import { useIsRestoring } from './useIsRestoring.js'
|
|
3
2
|
import { createRawRef } from './containers.svelte.js'
|
|
3
|
+
import { useIsRestoring } from './useIsRestoring.js'
|
|
4
4
|
import { useQueryClient } from './useQueryClient.js'
|
|
5
|
-
import type {
|
|
6
|
-
Accessor,
|
|
7
|
-
CreateQueryOptions,
|
|
8
|
-
CreateQueryResult,
|
|
9
|
-
DefinedCreateQueryResult,
|
|
10
|
-
} from './types.js'
|
|
11
5
|
import type {
|
|
12
6
|
DefaultError,
|
|
13
7
|
OmitKeyof,
|
|
@@ -18,6 +12,12 @@ import type {
|
|
|
18
12
|
QueryKey,
|
|
19
13
|
ThrowOnError,
|
|
20
14
|
} from '@tanstack/query-core'
|
|
15
|
+
import type {
|
|
16
|
+
Accessor,
|
|
17
|
+
CreateQueryOptions,
|
|
18
|
+
CreateQueryResult,
|
|
19
|
+
DefinedCreateQueryResult,
|
|
20
|
+
} from './types.js'
|
|
21
21
|
|
|
22
22
|
// This defines the `CreateQueryOptions` that are accepted in `QueriesOptions` & `GetOptions`.
|
|
23
23
|
// `placeholderData` function always gets undefined passed
|
package/src/createQuery.ts
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
import { QueryObserver } from '@tanstack/query-core'
|
|
2
2
|
import { createBaseQuery } from './createBaseQuery.svelte.js'
|
|
3
3
|
import type { DefaultError, QueryClient, QueryKey } from '@tanstack/query-core'
|
|
4
|
+
import type {
|
|
5
|
+
DefinedInitialDataOptions,
|
|
6
|
+
UndefinedInitialDataOptions,
|
|
7
|
+
} from './queryOptions.js'
|
|
4
8
|
import type {
|
|
5
9
|
Accessor,
|
|
6
10
|
CreateQueryOptions,
|
|
7
11
|
CreateQueryResult,
|
|
8
12
|
DefinedCreateQueryResult,
|
|
9
13
|
} from './types.js'
|
|
10
|
-
import type {
|
|
11
|
-
DefinedInitialDataOptions,
|
|
12
|
-
UndefinedInitialDataOptions,
|
|
13
|
-
} from './queryOptions.js'
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Subscribes to a query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
|
|
17
17
|
* The query runs when the options call for it — `enabled: false` skips the initial fetch.
|
|
18
18
|
*
|
|
19
|
-
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is never
|
|
20
|
-
* `undefined` (unless a `select` changes `TData` to include `undefined`).
|
|
19
|
+
* This overload is selected when `initialData` is known to be defined, so the resulting `data` is typed as never
|
|
20
|
+
* `undefined` (unless a `select` changes `TData` to include `undefined`). At runtime, `data` is still `undefined`
|
|
21
|
+
* if `select` throws on its first call.
|
|
21
22
|
* @param options - The {@link DefinedInitialDataOptions} to use — everything you can pass to `createQuery`,
|
|
22
23
|
* with `initialData` known to be defined, wrapped in an {@link Accessor} so options can be reactive.
|
|
23
24
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
24
25
|
* be used.
|
|
25
|
-
* @returns The current query result, typed so that `status` is `success`
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* @returns The current query result, typed so that `status` is `success` or `error` (`status` never
|
|
27
|
+
* resolves to `pending` in this overload's type, since `initialData` guarantees data upfront). `status` is
|
|
28
|
+
* `error` if the query has an error from a fetch that failed after its retries or if `select` threw, and
|
|
29
|
+
* `success` otherwise. `isSuccess`/`isError` are derived booleans for convenience.
|
|
28
30
|
* @see {@link queryOptions} to share these options between `createQuery` and imperative APIs like `queryClient.query`.
|
|
29
31
|
* @example
|
|
30
32
|
* ```svelte
|
|
@@ -69,8 +71,9 @@ export function createQuery<
|
|
|
69
71
|
* wrapped in an {@link Accessor} so options can be reactive.
|
|
70
72
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
71
73
|
* be used.
|
|
72
|
-
* @returns The current query result. `status` is `
|
|
73
|
-
*
|
|
74
|
+
* @returns The current query result. `status` is `error` if the query has an error from a fetch that failed
|
|
75
|
+
* after its retries or if `select` threw, `success` if the query has cached data (even if `select` returns
|
|
76
|
+
* `undefined`) or data from `placeholderData`, and `pending` otherwise. `isPending`/`isSuccess`/`isError`
|
|
74
77
|
* are derived booleans for convenience.
|
|
75
78
|
* @see {@link queryOptions} to share these options between `createQuery` and imperative APIs like `queryClient.query`.
|
|
76
79
|
* @example
|
|
@@ -141,8 +144,9 @@ export function createQuery<
|
|
|
141
144
|
* in an {@link Accessor} so options can be reactive.
|
|
142
145
|
* @param queryClient - Use this to use a custom `QueryClient`. Otherwise, the one from the nearest context will
|
|
143
146
|
* be used.
|
|
144
|
-
* @returns The current query result. `status` is `
|
|
145
|
-
*
|
|
147
|
+
* @returns The current query result. `status` is `error` if the query has an error from a fetch that failed
|
|
148
|
+
* after its retries or if `select` threw, `success` if the query has cached data (even if `select` returns
|
|
149
|
+
* `undefined`) or data from `placeholderData`, and `pending` otherwise. `isPending`/`isSuccess`/`isError`
|
|
146
150
|
* are derived booleans for convenience.
|
|
147
151
|
* @see {@link queryOptions} to share these options between `createQuery` and imperative APIs like `queryClient.query`.
|
|
148
152
|
* @example
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
|
|
3
3
|
// Re-export core
|
|
4
|
+
// oxlint-disable-next-line tanstack-query/no-restricted-syntax
|
|
4
5
|
export * from '@tanstack/query-core'
|
|
5
6
|
|
|
6
7
|
// Svelte Query
|
|
7
|
-
export type
|
|
8
|
-
|
|
8
|
+
export type {
|
|
9
|
+
Accessor,
|
|
10
|
+
CreateBaseQueryOptions,
|
|
11
|
+
CreateBaseQueryResult,
|
|
12
|
+
CreateQueryOptions,
|
|
13
|
+
CreateQueryResult,
|
|
14
|
+
CreateInfiniteQueryOptions,
|
|
15
|
+
CreateInfiniteQueryResult,
|
|
16
|
+
DefinedCreateInfiniteQueryResult,
|
|
17
|
+
DefinedCreateBaseQueryResult,
|
|
18
|
+
DefinedCreateQueryResult,
|
|
19
|
+
CreateMutationOptions,
|
|
20
|
+
CreateMutateFunction,
|
|
21
|
+
CreateMutateAsyncFunction,
|
|
22
|
+
CreateBaseMutationResult,
|
|
23
|
+
CreateMutationResult,
|
|
24
|
+
MutationTypeFromResult,
|
|
25
|
+
MutationStateOptions,
|
|
26
|
+
QueryClientProviderProps,
|
|
27
|
+
} from './types.js'
|
|
28
|
+
export {
|
|
29
|
+
getQueryClientContext,
|
|
30
|
+
setQueryClientContext,
|
|
31
|
+
getIsRestoringContext,
|
|
32
|
+
setIsRestoringContext,
|
|
33
|
+
} from './context.js'
|
|
9
34
|
|
|
10
35
|
export { createQuery } from './createQuery.js'
|
|
11
36
|
export type { QueriesResults, QueriesOptions } from './createQueries.svelte.js'
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
1
|
import type {
|
|
3
2
|
DefaultError,
|
|
4
3
|
DefinedInfiniteQueryObserverResult,
|
|
@@ -18,6 +17,7 @@ import type {
|
|
|
18
17
|
QueryObserverOptions,
|
|
19
18
|
QueryObserverResult,
|
|
20
19
|
} from '@tanstack/query-core'
|
|
20
|
+
import type { Snippet } from 'svelte'
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* A function that returns a value. Options passed as an accessor are read inside reactive contexts, so they
|