@tanstack/angular-query-experimental 5.90.26 → 5.94.4

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.
Files changed (78) hide show
  1. package/package.json +3 -3
  2. package/create-base-query.d.ts +0 -170
  3. package/create-base-query.mjs +0 -99
  4. package/create-base-query.mjs.map +0 -1
  5. package/devtools/index.d.ts +0 -2
  6. package/devtools/index.mjs +0 -5
  7. package/devtools/index.mjs.map +0 -1
  8. package/devtools/production/index.d.ts +0 -1
  9. package/devtools/stub.d.ts +0 -2
  10. package/devtools/stub.mjs +0 -8
  11. package/devtools/stub.mjs.map +0 -1
  12. package/devtools/types.d.ts +0 -95
  13. package/devtools/with-devtools.d.ts +0 -25
  14. package/devtools/with-devtools.mjs +0 -104
  15. package/devtools/with-devtools.mjs.map +0 -1
  16. package/devtools-panel/index.d.ts +0 -2
  17. package/devtools-panel/index.mjs +0 -5
  18. package/devtools-panel/index.mjs.map +0 -1
  19. package/devtools-panel/inject-devtools-panel.d.ts +0 -14
  20. package/devtools-panel/inject-devtools-panel.mjs +0 -72
  21. package/devtools-panel/inject-devtools-panel.mjs.map +0 -1
  22. package/devtools-panel/production/index.d.ts +0 -1
  23. package/devtools-panel/stub.d.ts +0 -2
  24. package/devtools-panel/stub.mjs +0 -8
  25. package/devtools-panel/stub.mjs.map +0 -1
  26. package/devtools-panel/types.d.ts +0 -48
  27. package/index.d.ts +0 -25
  28. package/index.mjs +0 -32
  29. package/index.mjs.map +0 -1
  30. package/infinite-query-options.d.ts +0 -41
  31. package/infinite-query-options.mjs +0 -7
  32. package/infinite-query-options.mjs.map +0 -1
  33. package/inject-infinite-query.d.ts +0 -36
  34. package/inject-infinite-query.mjs +0 -18
  35. package/inject-infinite-query.mjs.map +0 -1
  36. package/inject-is-fetching.d.ts +0 -20
  37. package/inject-is-fetching.mjs +0 -31
  38. package/inject-is-fetching.mjs.map +0 -1
  39. package/inject-is-mutating.d.ts +0 -19
  40. package/inject-is-mutating.mjs +0 -31
  41. package/inject-is-mutating.mjs.map +0 -1
  42. package/inject-is-restoring.d.ts +0 -22
  43. package/inject-is-restoring.mjs +0 -21
  44. package/inject-is-restoring.mjs.map +0 -1
  45. package/inject-mutation-state.d.ts +0 -22
  46. package/inject-mutation-state.mjs +0 -51
  47. package/inject-mutation-state.mjs.map +0 -1
  48. package/inject-mutation.d.ts +0 -20
  49. package/inject-mutation.mjs +0 -94
  50. package/inject-mutation.mjs.map +0 -1
  51. package/inject-queries-experimental/index.d.ts +0 -1
  52. package/inject-queries-experimental/index.mjs +0 -5
  53. package/inject-queries-experimental/index.mjs.map +0 -1
  54. package/inject-queries.d.ts +0 -81
  55. package/inject-queries.mjs +0 -82
  56. package/inject-queries.mjs.map +0 -1
  57. package/inject-query-client.d.ts +0 -18
  58. package/inject-query-client.mjs +0 -9
  59. package/inject-query-client.mjs.map +0 -1
  60. package/inject-query.d.ts +0 -123
  61. package/inject-query.mjs +0 -14
  62. package/inject-query.mjs.map +0 -1
  63. package/mutation-options.d.ts +0 -39
  64. package/mutation-options.mjs +0 -7
  65. package/mutation-options.mjs.map +0 -1
  66. package/pending-tasks-compat.d.ts +0 -7
  67. package/pending-tasks-compat.mjs +0 -19
  68. package/pending-tasks-compat.mjs.map +0 -1
  69. package/providers.d.ts +0 -132
  70. package/providers.mjs +0 -32
  71. package/providers.mjs.map +0 -1
  72. package/query-options.d.ts +0 -84
  73. package/query-options.mjs +0 -7
  74. package/query-options.mjs.map +0 -1
  75. package/signal-proxy.d.ts +0 -11
  76. package/signal-proxy.mjs +0 -29
  77. package/signal-proxy.mjs.map +0 -1
  78. package/types.d.ts +0 -43
@@ -1,72 +0,0 @@
1
- import { assertInInjectionContext, inject, Injector, runInInjectionContext, DestroyRef, PLATFORM_ID, computed, effect, untracked } from "@angular/core";
2
- import { QueryClient, onlineManager } from "@tanstack/query-core";
3
- import { isPlatformBrowser } from "@angular/common";
4
- const injectDevtoolsPanel = (injectDevtoolsPanelFn, options) => {
5
- !(options == null ? void 0 : options.injector) && assertInInjectionContext(injectDevtoolsPanel);
6
- const currentInjector = (options == null ? void 0 : options.injector) ?? inject(Injector);
7
- return runInInjectionContext(currentInjector, () => {
8
- const destroyRef = inject(DestroyRef);
9
- const isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
10
- const injectedClient = inject(QueryClient, { optional: true });
11
- const queryOptions = computed(injectDevtoolsPanelFn);
12
- let devtools = null;
13
- const destroy = () => {
14
- devtools == null ? void 0 : devtools.unmount();
15
- devtools = null;
16
- };
17
- if (!isBrowser)
18
- return {
19
- destroy
20
- };
21
- effect(() => {
22
- const {
23
- client = injectedClient,
24
- errorTypes = [],
25
- styleNonce,
26
- shadowDOMTarget,
27
- onClose,
28
- hostElement
29
- } = queryOptions();
30
- untracked(() => {
31
- if (!client) throw new Error("No QueryClient found");
32
- if (!devtools && hostElement) {
33
- import("@tanstack/query-devtools").then((queryDevtools) => {
34
- devtools = new queryDevtools.TanstackQueryDevtoolsPanel({
35
- client,
36
- queryFlavor: "Angular Query",
37
- version: "5",
38
- buttonPosition: "bottom-left",
39
- position: "bottom",
40
- initialIsOpen: true,
41
- errorTypes,
42
- styleNonce,
43
- shadowDOMTarget,
44
- onClose,
45
- onlineManager
46
- });
47
- devtools.mount(hostElement.nativeElement);
48
- }).catch((error) => {
49
- console.error(
50
- "Install @tanstack/query-devtools or reinstall without --omit=optional.",
51
- error
52
- );
53
- });
54
- } else if (devtools && hostElement) {
55
- devtools.setClient(client);
56
- devtools.setErrorTypes(errorTypes);
57
- onClose && devtools.setOnClose(onClose);
58
- } else if (devtools && !hostElement) {
59
- destroy();
60
- }
61
- });
62
- });
63
- destroyRef.onDestroy(destroy);
64
- return {
65
- destroy
66
- };
67
- });
68
- };
69
- export {
70
- injectDevtoolsPanel
71
- };
72
- //# sourceMappingURL=inject-devtools-panel.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject-devtools-panel.mjs","sources":["../../src/devtools-panel/inject-devtools-panel.ts"],"sourcesContent":["import {\n DestroyRef,\n Injector,\n PLATFORM_ID,\n assertInInjectionContext,\n computed,\n effect,\n inject,\n runInInjectionContext,\n untracked,\n} from '@angular/core'\nimport { QueryClient, onlineManager } from '@tanstack/query-core'\nimport { isPlatformBrowser } from '@angular/common'\nimport type { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'\nimport type {\n DevtoolsPanelOptions,\n InjectDevtoolsPanel,\n InjectDevtoolsPanelOptions,\n} from './types'\n\n/**\n * Inject a TanStack Query devtools panel and render it in the DOM.\n *\n * Devtools panel allows programmatic control over the devtools, for example if you want to render\n * the devtools as part of your own devtools.\n *\n * Consider `withDevtools` instead if you don't need this.\n * @param injectDevtoolsPanelFn - A function that returns devtools panel options.\n * @param options - Additional configuration\n * @returns DevtoolsPanelRef\n * @see https://tanstack.com/query/v5/docs/framework/angular/devtools\n */\nexport const injectDevtoolsPanel: InjectDevtoolsPanel = (\n injectDevtoolsPanelFn: () => DevtoolsPanelOptions,\n options?: InjectDevtoolsPanelOptions,\n) => {\n !options?.injector && assertInInjectionContext(injectDevtoolsPanel)\n const currentInjector = options?.injector ?? inject(Injector)\n\n return runInInjectionContext(currentInjector, () => {\n const destroyRef = inject(DestroyRef)\n const isBrowser = isPlatformBrowser(inject(PLATFORM_ID))\n const injectedClient = inject(QueryClient, { optional: true })\n\n const queryOptions = computed(injectDevtoolsPanelFn)\n let devtools: TanstackQueryDevtoolsPanel | null = null\n\n const destroy = () => {\n devtools?.unmount()\n devtools = null\n }\n\n if (!isBrowser)\n return {\n destroy,\n }\n\n effect(() => {\n const {\n client = injectedClient,\n errorTypes = [],\n styleNonce,\n shadowDOMTarget,\n onClose,\n hostElement,\n } = queryOptions()\n\n untracked(() => {\n if (!client) throw new Error('No QueryClient found')\n if (!devtools && hostElement) {\n import('@tanstack/query-devtools')\n .then((queryDevtools) => {\n devtools = new queryDevtools.TanstackQueryDevtoolsPanel({\n client,\n queryFlavor: 'Angular Query',\n version: '5',\n buttonPosition: 'bottom-left',\n position: 'bottom',\n initialIsOpen: true,\n errorTypes,\n styleNonce,\n shadowDOMTarget,\n onClose,\n onlineManager,\n })\n devtools.mount(hostElement.nativeElement)\n })\n .catch((error) => {\n console.error(\n 'Install @tanstack/query-devtools or reinstall without --omit=optional.',\n error,\n )\n })\n } else if (devtools && hostElement) {\n devtools.setClient(client)\n devtools.setErrorTypes(errorTypes)\n onClose && devtools.setOnClose(onClose)\n } else if (devtools && !hostElement) {\n destroy()\n }\n })\n })\n\n destroyRef.onDestroy(destroy)\n\n return {\n destroy,\n }\n })\n}\n"],"names":[],"mappings":";;;AAgCO,MAAM,sBAA2C,CACtD,uBACA,YACG;AACH,IAAC,mCAAS,aAAY,yBAAyB,mBAAmB;AAClE,QAAM,mBAAkB,mCAAS,aAAY,OAAO,QAAQ;AAE5D,SAAO,sBAAsB,iBAAiB,MAAM;AAClD,UAAM,aAAa,OAAO,UAAU;AACpC,UAAM,YAAY,kBAAkB,OAAO,WAAW,CAAC;AACvD,UAAM,iBAAiB,OAAO,aAAa,EAAE,UAAU,MAAM;AAE7D,UAAM,eAAe,SAAS,qBAAqB;AACnD,QAAI,WAA8C;AAElD,UAAM,UAAU,MAAM;AACpB,2CAAU;AACV,iBAAW;AAAA,IACb;AAEA,QAAI,CAAC;AACH,aAAO;AAAA,QACL;AAAA,MAAA;AAGJ,WAAO,MAAM;AACX,YAAM;AAAA,QACJ,SAAS;AAAA,QACT,aAAa,CAAA;AAAA,QACb;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA,IACE,aAAA;AAEJ,gBAAU,MAAM;AACd,YAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,sBAAsB;AACnD,YAAI,CAAC,YAAY,aAAa;AAC5B,iBAAO,0BAA0B,EAC9B,KAAK,CAAC,kBAAkB;AACvB,uBAAW,IAAI,cAAc,2BAA2B;AAAA,cACtD;AAAA,cACA,aAAa;AAAA,cACb,SAAS;AAAA,cACT,gBAAgB;AAAA,cAChB,UAAU;AAAA,cACV,eAAe;AAAA,cACf;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YAAA,CACD;AACD,qBAAS,MAAM,YAAY,aAAa;AAAA,UAC1C,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,oBAAQ;AAAA,cACN;AAAA,cACA;AAAA,YAAA;AAAA,UAEJ,CAAC;AAAA,QACL,WAAW,YAAY,aAAa;AAClC,mBAAS,UAAU,MAAM;AACzB,mBAAS,cAAc,UAAU;AACjC,qBAAW,SAAS,WAAW,OAAO;AAAA,QACxC,WAAW,YAAY,CAAC,aAAa;AACnC,kBAAA;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AAED,eAAW,UAAU,OAAO;AAE5B,WAAO;AAAA,MACL;AAAA,IAAA;AAAA,EAEJ,CAAC;AACH;"}
@@ -1 +0,0 @@
1
- export * from '..';
@@ -1,2 +0,0 @@
1
- import { InjectDevtoolsPanel } from './types.js';
2
- export declare const injectDevtoolsPanel: InjectDevtoolsPanel;
@@ -1,8 +0,0 @@
1
- import { noop } from "@tanstack/query-core";
2
- const injectDevtoolsPanel = () => ({
3
- destroy: noop
4
- });
5
- export {
6
- injectDevtoolsPanel
7
- };
8
- //# sourceMappingURL=stub.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stub.mjs","sources":["../../src/devtools-panel/stub.ts"],"sourcesContent":["import { noop } from '@tanstack/query-core'\nimport type { InjectDevtoolsPanel } from './types'\n\n// Stub which replaces `injectDevtoolsPanel` in production builds\nexport const injectDevtoolsPanel: InjectDevtoolsPanel = () => ({\n destroy: noop,\n})\n"],"names":[],"mappings":";AAIO,MAAM,sBAA2C,OAAO;AAAA,EAC7D,SAAS;AACX;"}
@@ -1,48 +0,0 @@
1
- import { DevtoolsErrorType } from '@tanstack/query-devtools';
2
- import { ElementRef, Injector } from '@angular/core';
3
- import { QueryClient } from '@tanstack/query-core';
4
- export interface InjectDevtoolsPanelOptions {
5
- /**
6
- * The `Injector` in which to create the devtools panel.
7
- *
8
- * If this is not provided, the current injection context will be used instead (via `inject`).
9
- */
10
- injector?: Injector;
11
- }
12
- /**
13
- * A devtools panel, which can be manually destroyed.
14
- */
15
- export interface DevtoolsPanelRef {
16
- /**
17
- * Destroy the panel, removing it from the DOM and stops listening to signal changes.
18
- */
19
- destroy: () => void;
20
- }
21
- export interface DevtoolsPanelOptions {
22
- /**
23
- * Custom instance of QueryClient
24
- */
25
- client?: QueryClient;
26
- /**
27
- * Use this so you can define custom errors that can be shown in the devtools.
28
- */
29
- errorTypes?: Array<DevtoolsErrorType>;
30
- /**
31
- * Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
32
- */
33
- styleNonce?: string;
34
- /**
35
- * Use this so you can attach the devtool's styles to specific element in the DOM.
36
- */
37
- shadowDOMTarget?: ShadowRoot;
38
- /**
39
- * Callback function that is called when the devtools panel is closed
40
- */
41
- onClose?: () => unknown;
42
- /**
43
- * Element where to render the devtools panel. When set to undefined or null, the devtools panel will not be created, or destroyed if existing.
44
- * If changed from undefined to a ElementRef, the devtools panel will be created.
45
- */
46
- hostElement?: ElementRef;
47
- }
48
- export type InjectDevtoolsPanel = (injectDevtoolsPanelFn: () => DevtoolsPanelOptions, options?: InjectDevtoolsPanelOptions) => DevtoolsPanelRef;
package/index.d.ts DELETED
@@ -1,25 +0,0 @@
1
- export * from '@tanstack/query-core';
2
- export * from './types.js';
3
- export type { DefinedInitialDataOptions, UndefinedInitialDataOptions, UnusedSkipTokenOptions, } from './query-options.js';
4
- export { queryOptions } from './query-options.js';
5
- export type { CreateMutationOptions } from './types.js';
6
- export { mutationOptions } from './mutation-options.js';
7
- export type { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions, UnusedSkipTokenInfiniteOptions, } from './infinite-query-options.js';
8
- export { infiniteQueryOptions } from './infinite-query-options.js';
9
- export type { InjectInfiniteQueryOptions } from './inject-infinite-query.js';
10
- export { injectInfiniteQuery } from './inject-infinite-query.js';
11
- export type { InjectIsFetchingOptions } from './inject-is-fetching.js';
12
- export { injectIsFetching } from './inject-is-fetching.js';
13
- export type { InjectIsMutatingOptions } from './inject-is-mutating.js';
14
- export { injectIsMutating } from './inject-is-mutating.js';
15
- export { injectIsRestoring, provideIsRestoring } from './inject-is-restoring.js';
16
- export type { InjectMutationOptions } from './inject-mutation.js';
17
- export { injectMutation } from './inject-mutation.js';
18
- export type { InjectMutationStateOptions } from './inject-mutation-state.js';
19
- export { injectMutationState } from './inject-mutation-state.js';
20
- export type { QueriesOptions, QueriesResults } from './inject-queries.js';
21
- export type { InjectQueryOptions } from './inject-query.js';
22
- export { injectQuery } from './inject-query.js';
23
- export { injectQueryClient } from './inject-query-client.js';
24
- export type { DevtoolsFeature, PersistQueryClientFeature, QueryFeature, QueryFeatures, } from './providers.js';
25
- export { provideAngularQuery, provideQueryClient, provideTanStackQuery, queryFeature, } from './providers.js';
package/index.mjs DELETED
@@ -1,32 +0,0 @@
1
- export * from "@tanstack/query-core";
2
- import { queryOptions } from "./query-options.mjs";
3
- import { mutationOptions } from "./mutation-options.mjs";
4
- import { infiniteQueryOptions } from "./infinite-query-options.mjs";
5
- import { injectInfiniteQuery } from "./inject-infinite-query.mjs";
6
- import { injectIsFetching } from "./inject-is-fetching.mjs";
7
- import { injectIsMutating } from "./inject-is-mutating.mjs";
8
- import { injectIsRestoring, provideIsRestoring } from "./inject-is-restoring.mjs";
9
- import { injectMutation } from "./inject-mutation.mjs";
10
- import { injectMutationState } from "./inject-mutation-state.mjs";
11
- import { injectQuery } from "./inject-query.mjs";
12
- import { injectQueryClient } from "./inject-query-client.mjs";
13
- import { provideAngularQuery, provideQueryClient, provideTanStackQuery, queryFeature } from "./providers.mjs";
14
- export {
15
- infiniteQueryOptions,
16
- injectInfiniteQuery,
17
- injectIsFetching,
18
- injectIsMutating,
19
- injectIsRestoring,
20
- injectMutation,
21
- injectMutationState,
22
- injectQuery,
23
- injectQueryClient,
24
- mutationOptions,
25
- provideAngularQuery,
26
- provideIsRestoring,
27
- provideQueryClient,
28
- provideTanStackQuery,
29
- queryFeature,
30
- queryOptions
31
- };
32
- //# sourceMappingURL=index.mjs.map
package/index.mjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -1,41 +0,0 @@
1
- import { DataTag, DefaultError, InfiniteData, InitialDataFunction, NonUndefinedGuard, OmitKeyof, QueryKey, SkipToken } from '@tanstack/query-core';
2
- import { CreateInfiniteQueryOptions } from './types.js';
3
- export type UndefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
4
- initialData?: undefined | NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | InitialDataFunction<NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>>;
5
- };
6
- export type UnusedSkipTokenInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = OmitKeyof<CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'queryFn'> & {
7
- queryFn?: Exclude<CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>['queryFn'], SkipToken | undefined>;
8
- };
9
- export type DefinedInitialDataInfiniteOptions<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> = CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam> & {
10
- initialData: NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>> | (() => NonUndefinedGuard<InfiniteData<TQueryFnData, TPageParam>>) | undefined;
11
- };
12
- /**
13
- * Allows to share and re-use infinite query options in a type-safe way.
14
- *
15
- * The `queryKey` will be tagged with the type from `queryFn`.
16
- * @param options - The infinite query options to tag with the type from `queryFn`.
17
- * @returns The tagged infinite query options.
18
- */
19
- export 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> & {
20
- queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
21
- };
22
- /**
23
- * Allows to share and re-use infinite query options in a type-safe way.
24
- *
25
- * The `queryKey` will be tagged with the type from `queryFn`.
26
- * @param options - The infinite query options to tag with the type from `queryFn`.
27
- * @returns The tagged infinite query options.
28
- */
29
- export 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> & {
30
- queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
31
- };
32
- /**
33
- * Allows to share and re-use infinite query options in a type-safe way.
34
- *
35
- * The `queryKey` will be tagged with the type from `queryFn`.
36
- * @param options - The infinite query options to tag with the type from `queryFn`.
37
- * @returns The tagged infinite query options.
38
- */
39
- export 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> & {
40
- queryKey: DataTag<TQueryKey, InfiniteData<TQueryFnData>, TError>;
41
- };
@@ -1,7 +0,0 @@
1
- function infiniteQueryOptions(options) {
2
- return options;
3
- }
4
- export {
5
- infiniteQueryOptions
6
- };
7
- //# sourceMappingURL=infinite-query-options.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"infinite-query-options.mjs","sources":["../src/infinite-query-options.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 { CreateInfiniteQueryOptions } from './types'\n\nexport type UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n> = CreateInfiniteQueryOptions<\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 CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n CreateInfiniteQueryOptions<\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> = CreateInfiniteQueryOptions<\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\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\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\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\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\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\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\n/**\n * Allows to share and re-use infinite query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n * @param options - The infinite query options to tag with the type from `queryFn`.\n * @returns The tagged infinite query options.\n */\nexport function infiniteQueryOptions(options: unknown) {\n return options\n}\n"],"names":[],"mappings":"AAoLO,SAAS,qBAAqB,SAAkB;AACrD,SAAO;AACT;"}
@@ -1,36 +0,0 @@
1
- import { Injector } from '@angular/core';
2
- import { DefaultError, InfiniteData, QueryKey } from '@tanstack/query-core';
3
- import { CreateInfiniteQueryOptions, CreateInfiniteQueryResult, DefinedCreateInfiniteQueryResult } from './types.js';
4
- import { DefinedInitialDataInfiniteOptions, UndefinedInitialDataInfiniteOptions } from './infinite-query-options.js';
5
- export interface InjectInfiniteQueryOptions {
6
- /**
7
- * The `Injector` in which to create the infinite query.
8
- *
9
- * If this is not provided, the current injection context will be used instead (via `inject`).
10
- */
11
- injector?: Injector;
12
- }
13
- /**
14
- * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
15
- * Infinite queries can additively "load more" data onto an existing set of data or "infinite scroll"
16
- * @param injectInfiniteQueryFn - A function that returns infinite query options.
17
- * @param options - Additional configuration.
18
- * @returns The infinite query result.
19
- */
20
- export declare function injectInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(injectInfiniteQueryFn: () => DefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, options?: InjectInfiniteQueryOptions): DefinedCreateInfiniteQueryResult<TData, TError>;
21
- /**
22
- * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
23
- * Infinite queries can additively "load more" data onto an existing set of data or "infinite scroll"
24
- * @param injectInfiniteQueryFn - A function that returns infinite query options.
25
- * @param options - Additional configuration.
26
- * @returns The infinite query result.
27
- */
28
- export declare function injectInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(injectInfiniteQueryFn: () => UndefinedInitialDataInfiniteOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, options?: InjectInfiniteQueryOptions): CreateInfiniteQueryResult<TData, TError>;
29
- /**
30
- * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.
31
- * Infinite queries can additively "load more" data onto an existing set of data or "infinite scroll"
32
- * @param injectInfiniteQueryFn - A function that returns infinite query options.
33
- * @param options - Additional configuration.
34
- * @returns The infinite query result.
35
- */
36
- export declare function injectInfiniteQuery<TQueryFnData, TError = DefaultError, TData = InfiniteData<TQueryFnData>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(injectInfiniteQueryFn: () => CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, options?: InjectInfiniteQueryOptions): CreateInfiniteQueryResult<TData, TError>;
@@ -1,18 +0,0 @@
1
- import { InfiniteQueryObserver } from "@tanstack/query-core";
2
- import { assertInInjectionContext, inject, Injector, runInInjectionContext } from "@angular/core";
3
- import { createBaseQuery } from "./create-base-query.mjs";
4
- function injectInfiniteQuery(injectInfiniteQueryFn, options) {
5
- !(options == null ? void 0 : options.injector) && assertInInjectionContext(injectInfiniteQuery);
6
- const injector = (options == null ? void 0 : options.injector) ?? inject(Injector);
7
- return runInInjectionContext(
8
- injector,
9
- () => createBaseQuery(
10
- injectInfiniteQueryFn,
11
- InfiniteQueryObserver
12
- )
13
- );
14
- }
15
- export {
16
- injectInfiniteQuery
17
- };
18
- //# sourceMappingURL=inject-infinite-query.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject-infinite-query.mjs","sources":["../src/inject-infinite-query.ts"],"sourcesContent":["import { InfiniteQueryObserver } from '@tanstack/query-core'\nimport {\n Injector,\n assertInInjectionContext,\n inject,\n runInInjectionContext,\n} from '@angular/core'\nimport { createBaseQuery } from './create-base-query'\nimport type {\n DefaultError,\n InfiniteData,\n QueryKey,\n QueryObserver,\n} from '@tanstack/query-core'\nimport type {\n CreateInfiniteQueryOptions,\n CreateInfiniteQueryResult,\n DefinedCreateInfiniteQueryResult,\n} from './types'\nimport type {\n DefinedInitialDataInfiniteOptions,\n UndefinedInitialDataInfiniteOptions,\n} from './infinite-query-options'\n\nexport interface InjectInfiniteQueryOptions {\n /**\n * The `Injector` in which to create the infinite query.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => DefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): DefinedCreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => UndefinedInitialDataInfiniteOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): CreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n */\nexport function injectInfiniteQuery<\n TQueryFnData,\n TError = DefaultError,\n TData = InfiniteData<TQueryFnData>,\n TQueryKey extends QueryKey = QueryKey,\n TPageParam = unknown,\n>(\n injectInfiniteQueryFn: () => CreateInfiniteQueryOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryKey,\n TPageParam\n >,\n options?: InjectInfiniteQueryOptions,\n): CreateInfiniteQueryResult<TData, TError>\n\n/**\n * Injects an infinite query: a declarative dependency on an asynchronous source of data that is tied to a unique key.\n * Infinite queries can additively \"load more\" data onto an existing set of data or \"infinite scroll\"\n * @param injectInfiniteQueryFn - A function that returns infinite query options.\n * @param options - Additional configuration.\n * @returns The infinite query result.\n */\nexport function injectInfiniteQuery(\n injectInfiniteQueryFn: () => CreateInfiniteQueryOptions,\n options?: InjectInfiniteQueryOptions,\n) {\n !options?.injector && assertInInjectionContext(injectInfiniteQuery)\n const injector = options?.injector ?? inject(Injector)\n return runInInjectionContext(injector, () =>\n createBaseQuery(\n injectInfiniteQueryFn,\n InfiniteQueryObserver as typeof QueryObserver,\n ),\n )\n}\n"],"names":[],"mappings":";;;AAgHO,SAAS,oBACd,uBACA,SACA;AACA,IAAC,mCAAS,aAAY,yBAAyB,mBAAmB;AAClE,QAAM,YAAW,mCAAS,aAAY,OAAO,QAAQ;AACrD,SAAO;AAAA,IAAsB;AAAA,IAAU,MACrC;AAAA,MACE;AAAA,MACA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -1,20 +0,0 @@
1
- import { Injector, Signal } from '@angular/core';
2
- import { QueryFilters } from '@tanstack/query-core';
3
- export interface InjectIsFetchingOptions {
4
- /**
5
- * The `Injector` in which to create the isFetching signal.
6
- *
7
- * If this is not provided, the current injection context will be used instead (via `inject`).
8
- */
9
- injector?: Injector;
10
- }
11
- /**
12
- * Injects a signal that tracks the number of queries that your application is loading or
13
- * fetching in the background.
14
- *
15
- * Can be used for app-wide loading indicators
16
- * @param filters - The filters to apply to the query.
17
- * @param options - Additional configuration
18
- * @returns signal with number of loading or fetching queries.
19
- */
20
- export declare function injectIsFetching(filters?: QueryFilters, options?: InjectIsFetchingOptions): Signal<number>;
@@ -1,31 +0,0 @@
1
- import { assertInInjectionContext, inject, Injector, DestroyRef, NgZone, signal } from "@angular/core";
2
- import { QueryClient, notifyManager } from "@tanstack/query-core";
3
- function injectIsFetching(filters, options) {
4
- !(options == null ? void 0 : options.injector) && assertInInjectionContext(injectIsFetching);
5
- const injector = (options == null ? void 0 : options.injector) ?? inject(Injector);
6
- const destroyRef = injector.get(DestroyRef);
7
- const ngZone = injector.get(NgZone);
8
- const queryClient = injector.get(QueryClient);
9
- const cache = queryClient.getQueryCache();
10
- let isFetching = queryClient.isFetching(filters);
11
- const result = signal(isFetching);
12
- const unsubscribe = ngZone.runOutsideAngular(
13
- () => cache.subscribe(
14
- notifyManager.batchCalls(() => {
15
- const newIsFetching = queryClient.isFetching(filters);
16
- if (isFetching !== newIsFetching) {
17
- isFetching = newIsFetching;
18
- ngZone.run(() => {
19
- result.set(isFetching);
20
- });
21
- }
22
- })
23
- )
24
- );
25
- destroyRef.onDestroy(unsubscribe);
26
- return result;
27
- }
28
- export {
29
- injectIsFetching
30
- };
31
- //# sourceMappingURL=inject-is-fetching.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject-is-fetching.mjs","sources":["../src/inject-is-fetching.ts"],"sourcesContent":["import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport { QueryClient, notifyManager } from '@tanstack/query-core'\nimport type { QueryFilters } from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\n\nexport interface InjectIsFetchingOptions {\n /**\n * The `Injector` in which to create the isFetching signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the number of queries that your application is loading or\n * fetching in the background.\n *\n * Can be used for app-wide loading indicators\n * @param filters - The filters to apply to the query.\n * @param options - Additional configuration\n * @returns signal with number of loading or fetching queries.\n */\nexport function injectIsFetching(\n filters?: QueryFilters,\n options?: InjectIsFetchingOptions,\n): Signal<number> {\n !options?.injector && assertInInjectionContext(injectIsFetching)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n\n const cache = queryClient.getQueryCache()\n // isFetching is the prev value initialized on mount *\n let isFetching = queryClient.isFetching(filters)\n\n const result = signal(isFetching)\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n cache.subscribe(\n notifyManager.batchCalls(() => {\n const newIsFetching = queryClient.isFetching(filters)\n if (isFetching !== newIsFetching) {\n // * and update with each change\n isFetching = newIsFetching\n ngZone.run(() => {\n result.set(isFetching)\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return result\n}\n"],"names":[],"mappings":";;AA8BO,SAAS,iBACd,SACA,SACgB;AAChB,IAAC,mCAAS,aAAY,yBAAyB,gBAAgB;AAC/D,QAAM,YAAW,mCAAS,aAAY,OAAO,QAAQ;AACrD,QAAM,aAAa,SAAS,IAAI,UAAU;AAC1C,QAAM,SAAS,SAAS,IAAI,MAAM;AAClC,QAAM,cAAc,SAAS,IAAI,WAAW;AAE5C,QAAM,QAAQ,YAAY,cAAA;AAE1B,MAAI,aAAa,YAAY,WAAW,OAAO;AAE/C,QAAM,SAAS,OAAO,UAAU;AAEhC,QAAM,cAAc,OAAO;AAAA,IAAkB,MAC3C,MAAM;AAAA,MACJ,cAAc,WAAW,MAAM;AAC7B,cAAM,gBAAgB,YAAY,WAAW,OAAO;AACpD,YAAI,eAAe,eAAe;AAEhC,uBAAa;AACb,iBAAO,IAAI,MAAM;AACf,mBAAO,IAAI,UAAU;AAAA,UACvB,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IAAA;AAAA,EACH;AAGF,aAAW,UAAU,WAAW;AAEhC,SAAO;AACT;"}
@@ -1,19 +0,0 @@
1
- import { Injector, Signal } from '@angular/core';
2
- import { MutationFilters } from '@tanstack/query-core';
3
- export interface InjectIsMutatingOptions {
4
- /**
5
- * The `Injector` in which to create the isMutating signal.
6
- *
7
- * If this is not provided, the current injection context will be used instead (via `inject`).
8
- */
9
- injector?: Injector;
10
- }
11
- /**
12
- * Injects a signal that tracks the number of mutations that your application is fetching.
13
- *
14
- * Can be used for app-wide loading indicators
15
- * @param filters - The filters to apply to the query.
16
- * @param options - Additional configuration
17
- * @returns A read-only signal with the number of fetching mutations.
18
- */
19
- export declare function injectIsMutating(filters?: MutationFilters, options?: InjectIsMutatingOptions): Signal<number>;
@@ -1,31 +0,0 @@
1
- import { assertInInjectionContext, inject, Injector, DestroyRef, NgZone, signal } from "@angular/core";
2
- import { QueryClient, notifyManager } from "@tanstack/query-core";
3
- function injectIsMutating(filters, options) {
4
- !(options == null ? void 0 : options.injector) && assertInInjectionContext(injectIsMutating);
5
- const injector = (options == null ? void 0 : options.injector) ?? inject(Injector);
6
- const destroyRef = injector.get(DestroyRef);
7
- const ngZone = injector.get(NgZone);
8
- const queryClient = injector.get(QueryClient);
9
- const cache = queryClient.getMutationCache();
10
- let isMutating = queryClient.isMutating(filters);
11
- const result = signal(isMutating);
12
- const unsubscribe = ngZone.runOutsideAngular(
13
- () => cache.subscribe(
14
- notifyManager.batchCalls(() => {
15
- const newIsMutating = queryClient.isMutating(filters);
16
- if (isMutating !== newIsMutating) {
17
- isMutating = newIsMutating;
18
- ngZone.run(() => {
19
- result.set(isMutating);
20
- });
21
- }
22
- })
23
- )
24
- );
25
- destroyRef.onDestroy(unsubscribe);
26
- return result.asReadonly();
27
- }
28
- export {
29
- injectIsMutating
30
- };
31
- //# sourceMappingURL=inject-is-mutating.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject-is-mutating.mjs","sources":["../src/inject-is-mutating.ts"],"sourcesContent":["import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport { QueryClient, notifyManager } from '@tanstack/query-core'\nimport type { MutationFilters } from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\n\nexport interface InjectIsMutatingOptions {\n /**\n * The `Injector` in which to create the isMutating signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the number of mutations that your application is fetching.\n *\n * Can be used for app-wide loading indicators\n * @param filters - The filters to apply to the query.\n * @param options - Additional configuration\n * @returns A read-only signal with the number of fetching mutations.\n */\nexport function injectIsMutating(\n filters?: MutationFilters,\n options?: InjectIsMutatingOptions,\n): Signal<number> {\n !options?.injector && assertInInjectionContext(injectIsMutating)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n\n const cache = queryClient.getMutationCache()\n // isMutating is the prev value initialized on mount *\n let isMutating = queryClient.isMutating(filters)\n\n const result = signal(isMutating)\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n cache.subscribe(\n notifyManager.batchCalls(() => {\n const newIsMutating = queryClient.isMutating(filters)\n if (isMutating !== newIsMutating) {\n // * and update with each change\n isMutating = newIsMutating\n ngZone.run(() => {\n result.set(isMutating)\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return result.asReadonly()\n}\n"],"names":[],"mappings":";;AA6BO,SAAS,iBACd,SACA,SACgB;AAChB,IAAC,mCAAS,aAAY,yBAAyB,gBAAgB;AAC/D,QAAM,YAAW,mCAAS,aAAY,OAAO,QAAQ;AACrD,QAAM,aAAa,SAAS,IAAI,UAAU;AAC1C,QAAM,SAAS,SAAS,IAAI,MAAM;AAClC,QAAM,cAAc,SAAS,IAAI,WAAW;AAE5C,QAAM,QAAQ,YAAY,iBAAA;AAE1B,MAAI,aAAa,YAAY,WAAW,OAAO;AAE/C,QAAM,SAAS,OAAO,UAAU;AAEhC,QAAM,cAAc,OAAO;AAAA,IAAkB,MAC3C,MAAM;AAAA,MACJ,cAAc,WAAW,MAAM;AAC7B,cAAM,gBAAgB,YAAY,WAAW,OAAO;AACpD,YAAI,eAAe,eAAe;AAEhC,uBAAa;AACb,iBAAO,IAAI,MAAM;AACf,mBAAO,IAAI,UAAU;AAAA,UACvB,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IAAA;AAAA,EACH;AAGF,aAAW,UAAU,WAAW;AAEhC,SAAO,OAAO,WAAA;AAChB;"}
@@ -1,22 +0,0 @@
1
- import { Injector, Provider, Signal } from '@angular/core';
2
- interface InjectIsRestoringOptions {
3
- /**
4
- * The `Injector` to use to get the isRestoring signal.
5
- *
6
- * If this is not provided, the current injection context will be used instead (via `inject`).
7
- */
8
- injector?: Injector;
9
- }
10
- /**
11
- * Injects a signal that tracks whether a restore is currently in progress. {@link injectQuery} and friends also check this internally to avoid race conditions between the restore and initializing queries.
12
- * @param options - Options for injectIsRestoring.
13
- * @returns readonly signal with boolean that indicates whether a restore is in progress.
14
- */
15
- export declare function injectIsRestoring(options?: InjectIsRestoringOptions): Signal<boolean>;
16
- /**
17
- * Used by TanStack Query Angular persist client plugin to provide the signal that tracks the restore state
18
- * @param isRestoring - a readonly signal that returns a boolean
19
- * @returns Provider for the `isRestoring` signal
20
- */
21
- export declare function provideIsRestoring(isRestoring: Signal<boolean>): Provider;
22
- export {};
@@ -1,21 +0,0 @@
1
- import { assertInInjectionContext, inject, Injector, InjectionToken, signal } from "@angular/core";
2
- const IS_RESTORING = new InjectionToken("", {
3
- // Default value when not provided
4
- factory: () => signal(false).asReadonly()
5
- });
6
- function injectIsRestoring(options) {
7
- !(options == null ? void 0 : options.injector) && assertInInjectionContext(injectIsRestoring);
8
- const injector = (options == null ? void 0 : options.injector) ?? inject(Injector);
9
- return injector.get(IS_RESTORING);
10
- }
11
- function provideIsRestoring(isRestoring) {
12
- return {
13
- provide: IS_RESTORING,
14
- useValue: isRestoring
15
- };
16
- }
17
- export {
18
- injectIsRestoring,
19
- provideIsRestoring
20
- };
21
- //# sourceMappingURL=inject-is-restoring.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject-is-restoring.mjs","sources":["../src/inject-is-restoring.ts"],"sourcesContent":["import {\n InjectionToken,\n Injector,\n assertInInjectionContext,\n inject,\n signal,\n} from '@angular/core'\nimport type { Provider, Signal } from '@angular/core'\n\n/**\n * Internal token used to track isRestoring state, accessible in public API through `injectIsRestoring` and set via `provideIsRestoring`\n */\nconst IS_RESTORING = new InjectionToken('', {\n // Default value when not provided\n factory: () => signal(false).asReadonly(),\n})\n\ninterface InjectIsRestoringOptions {\n /**\n * The `Injector` to use to get the isRestoring signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks whether a restore is currently in progress. {@link injectQuery} and friends also check this internally to avoid race conditions between the restore and initializing queries.\n * @param options - Options for injectIsRestoring.\n * @returns readonly signal with boolean that indicates whether a restore is in progress.\n */\nexport function injectIsRestoring(options?: InjectIsRestoringOptions) {\n !options?.injector && assertInInjectionContext(injectIsRestoring)\n const injector = options?.injector ?? inject(Injector)\n return injector.get(IS_RESTORING)\n}\n\n/**\n * Used by TanStack Query Angular persist client plugin to provide the signal that tracks the restore state\n * @param isRestoring - a readonly signal that returns a boolean\n * @returns Provider for the `isRestoring` signal\n */\nexport function provideIsRestoring(isRestoring: Signal<boolean>): Provider {\n return {\n provide: IS_RESTORING,\n useValue: isRestoring,\n }\n}\n"],"names":[],"mappings":";AAYA,MAAM,eAAe,IAAI,eAAe,IAAI;AAAA;AAAA,EAE1C,SAAS,MAAM,OAAO,KAAK,EAAE,WAAA;AAC/B,CAAC;AAgBM,SAAS,kBAAkB,SAAoC;AACpE,IAAC,mCAAS,aAAY,yBAAyB,iBAAiB;AAChE,QAAM,YAAW,mCAAS,aAAY,OAAO,QAAQ;AACrD,SAAO,SAAS,IAAI,YAAY;AAClC;AAOO,SAAS,mBAAmB,aAAwC;AACzE,SAAO;AAAA,IACL,SAAS;AAAA,IACT,UAAU;AAAA,EAAA;AAEd;"}
@@ -1,22 +0,0 @@
1
- import { Injector, Signal } from '@angular/core';
2
- import { Mutation, MutationFilters, MutationState } from '@tanstack/query-core';
3
- type MutationStateOptions<TResult = MutationState> = {
4
- filters?: MutationFilters;
5
- select?: (mutation: Mutation) => TResult;
6
- };
7
- export interface InjectMutationStateOptions {
8
- /**
9
- * The `Injector` in which to create the mutation state signal.
10
- *
11
- * If this is not provided, the current injection context will be used instead (via `inject`).
12
- */
13
- injector?: Injector;
14
- }
15
- /**
16
- * Injects a signal that tracks the state of all mutations.
17
- * @param injectMutationStateFn - A function that returns mutation state options.
18
- * @param options - The Angular injector to use.
19
- * @returns The signal that tracks the state of all mutations.
20
- */
21
- export declare function injectMutationState<TResult = MutationState>(injectMutationStateFn?: () => MutationStateOptions<TResult>, options?: InjectMutationStateOptions): Signal<Array<TResult>>;
22
- export {};
@@ -1,51 +0,0 @@
1
- import { assertInInjectionContext, inject, Injector, DestroyRef, NgZone, computed, signal } from "@angular/core";
2
- import { QueryClient, notifyManager, replaceEqualDeep } from "@tanstack/query-core";
3
- function getResult(mutationCache, options) {
4
- return mutationCache.findAll(options.filters).map(
5
- (mutation) => options.select ? options.select(mutation) : mutation.state
6
- );
7
- }
8
- function injectMutationState(injectMutationStateFn = () => ({}), options) {
9
- !(options == null ? void 0 : options.injector) && assertInInjectionContext(injectMutationState);
10
- const injector = (options == null ? void 0 : options.injector) ?? inject(Injector);
11
- const destroyRef = injector.get(DestroyRef);
12
- const ngZone = injector.get(NgZone);
13
- const queryClient = injector.get(QueryClient);
14
- const mutationCache = queryClient.getMutationCache();
15
- const resultFromOptionsSignal = computed(() => {
16
- return [
17
- getResult(mutationCache, injectMutationStateFn()),
18
- performance.now()
19
- ];
20
- });
21
- const resultFromSubscriberSignal = signal(
22
- null
23
- );
24
- const effectiveResultSignal = computed(() => {
25
- const optionsResult = resultFromOptionsSignal();
26
- const subscriberResult = resultFromSubscriberSignal();
27
- return subscriberResult && subscriberResult[1] > optionsResult[1] ? subscriberResult[0] : optionsResult[0];
28
- });
29
- const unsubscribe = ngZone.runOutsideAngular(
30
- () => mutationCache.subscribe(
31
- notifyManager.batchCalls(() => {
32
- const [lastResult] = effectiveResultSignal();
33
- const nextResult = replaceEqualDeep(
34
- lastResult,
35
- getResult(mutationCache, injectMutationStateFn())
36
- );
37
- if (lastResult !== nextResult) {
38
- ngZone.run(() => {
39
- resultFromSubscriberSignal.set([nextResult, performance.now()]);
40
- });
41
- }
42
- })
43
- )
44
- );
45
- destroyRef.onDestroy(unsubscribe);
46
- return effectiveResultSignal;
47
- }
48
- export {
49
- injectMutationState
50
- };
51
- //# sourceMappingURL=inject-mutation-state.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inject-mutation-state.mjs","sources":["../src/inject-mutation-state.ts"],"sourcesContent":["import {\n DestroyRef,\n Injector,\n NgZone,\n assertInInjectionContext,\n computed,\n inject,\n signal,\n} from '@angular/core'\nimport {\n QueryClient,\n notifyManager,\n replaceEqualDeep,\n} from '@tanstack/query-core'\nimport type { Signal } from '@angular/core'\nimport type {\n Mutation,\n MutationCache,\n MutationFilters,\n MutationState,\n} from '@tanstack/query-core'\n\ntype MutationStateOptions<TResult = MutationState> = {\n filters?: MutationFilters\n select?: (mutation: Mutation) => TResult\n}\n\n/**\n *\n * @param mutationCache\n * @param options\n */\nfunction getResult<TResult = MutationState>(\n mutationCache: MutationCache,\n options: MutationStateOptions<TResult>,\n): Array<TResult> {\n return mutationCache\n .findAll(options.filters)\n .map(\n (mutation): TResult =>\n (options.select ? options.select(mutation) : mutation.state) as TResult,\n )\n}\n\nexport interface InjectMutationStateOptions {\n /**\n * The `Injector` in which to create the mutation state signal.\n *\n * If this is not provided, the current injection context will be used instead (via `inject`).\n */\n injector?: Injector\n}\n\n/**\n * Injects a signal that tracks the state of all mutations.\n * @param injectMutationStateFn - A function that returns mutation state options.\n * @param options - The Angular injector to use.\n * @returns The signal that tracks the state of all mutations.\n */\nexport function injectMutationState<TResult = MutationState>(\n injectMutationStateFn: () => MutationStateOptions<TResult> = () => ({}),\n options?: InjectMutationStateOptions,\n): Signal<Array<TResult>> {\n !options?.injector && assertInInjectionContext(injectMutationState)\n const injector = options?.injector ?? inject(Injector)\n const destroyRef = injector.get(DestroyRef)\n const ngZone = injector.get(NgZone)\n const queryClient = injector.get(QueryClient)\n const mutationCache = queryClient.getMutationCache()\n\n /**\n * Computed signal that gets result from mutation cache based on passed options\n * First element is the result, second element is the time when the result was set\n */\n const resultFromOptionsSignal = computed(() => {\n return [\n getResult(mutationCache, injectMutationStateFn()),\n performance.now(),\n ] as const\n })\n\n /**\n * Signal that contains result set by subscriber\n * First element is the result, second element is the time when the result was set\n */\n const resultFromSubscriberSignal = signal<[Array<TResult>, number] | null>(\n null,\n )\n\n /**\n * Returns the last result by either subscriber or options\n */\n const effectiveResultSignal = computed(() => {\n const optionsResult = resultFromOptionsSignal()\n const subscriberResult = resultFromSubscriberSignal()\n return subscriberResult && subscriberResult[1] > optionsResult[1]\n ? subscriberResult[0]\n : optionsResult[0]\n })\n\n const unsubscribe = ngZone.runOutsideAngular(() =>\n mutationCache.subscribe(\n notifyManager.batchCalls(() => {\n const [lastResult] = effectiveResultSignal()\n const nextResult = replaceEqualDeep(\n lastResult,\n getResult(mutationCache, injectMutationStateFn()),\n )\n if (lastResult !== nextResult) {\n ngZone.run(() => {\n resultFromSubscriberSignal.set([nextResult, performance.now()])\n })\n }\n }),\n ),\n )\n\n destroyRef.onDestroy(unsubscribe)\n\n return effectiveResultSignal\n}\n"],"names":[],"mappings":";;AAgCA,SAAS,UACP,eACA,SACgB;AAChB,SAAO,cACJ,QAAQ,QAAQ,OAAO,EACvB;AAAA,IACC,CAAC,aACE,QAAQ,SAAS,QAAQ,OAAO,QAAQ,IAAI,SAAS;AAAA,EAAA;AAE9D;AAiBO,SAAS,oBACd,wBAA6D,OAAO,CAAA,IACpE,SACwB;AACxB,IAAC,mCAAS,aAAY,yBAAyB,mBAAmB;AAClE,QAAM,YAAW,mCAAS,aAAY,OAAO,QAAQ;AACrD,QAAM,aAAa,SAAS,IAAI,UAAU;AAC1C,QAAM,SAAS,SAAS,IAAI,MAAM;AAClC,QAAM,cAAc,SAAS,IAAI,WAAW;AAC5C,QAAM,gBAAgB,YAAY,iBAAA;AAMlC,QAAM,0BAA0B,SAAS,MAAM;AAC7C,WAAO;AAAA,MACL,UAAU,eAAe,uBAAuB;AAAA,MAChD,YAAY,IAAA;AAAA,IAAI;AAAA,EAEpB,CAAC;AAMD,QAAM,6BAA6B;AAAA,IACjC;AAAA,EAAA;AAMF,QAAM,wBAAwB,SAAS,MAAM;AAC3C,UAAM,gBAAgB,wBAAA;AACtB,UAAM,mBAAmB,2BAAA;AACzB,WAAO,oBAAoB,iBAAiB,CAAC,IAAI,cAAc,CAAC,IAC5D,iBAAiB,CAAC,IAClB,cAAc,CAAC;AAAA,EACrB,CAAC;AAED,QAAM,cAAc,OAAO;AAAA,IAAkB,MAC3C,cAAc;AAAA,MACZ,cAAc,WAAW,MAAM;AAC7B,cAAM,CAAC,UAAU,IAAI,sBAAA;AACrB,cAAM,aAAa;AAAA,UACjB;AAAA,UACA,UAAU,eAAe,sBAAA,CAAuB;AAAA,QAAA;AAElD,YAAI,eAAe,YAAY;AAC7B,iBAAO,IAAI,MAAM;AACf,uCAA2B,IAAI,CAAC,YAAY,YAAY,IAAA,CAAK,CAAC;AAAA,UAChE,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAAA,IAAA;AAAA,EACH;AAGF,aAAW,UAAU,WAAW;AAEhC,SAAO;AACT;"}