@tanstack/angular-query-experimental 5.83.0 → 5.84.0

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 (56) hide show
  1. package/dist/create-base-query.d.ts +8 -0
  2. package/dist/create-base-query.mjs +74 -0
  3. package/dist/create-base-query.mjs.map +1 -0
  4. package/dist/index.d.ts +26 -0
  5. package/dist/index.mjs +35 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/dist/infinite-query-options.d.ts +44 -0
  8. package/dist/infinite-query-options.mjs +7 -0
  9. package/dist/infinite-query-options.mjs.map +1 -0
  10. package/dist/inject-infinite-query.d.ts +39 -0
  11. package/dist/inject-infinite-query.mjs +18 -0
  12. package/dist/inject-infinite-query.mjs.map +1 -0
  13. package/dist/inject-is-fetching.d.ts +21 -0
  14. package/dist/inject-is-fetching.mjs +31 -0
  15. package/dist/inject-is-fetching.mjs.map +1 -0
  16. package/dist/inject-is-mutating.d.ts +20 -0
  17. package/dist/inject-is-mutating.mjs +31 -0
  18. package/dist/inject-is-mutating.mjs.map +1 -0
  19. package/dist/inject-is-restoring.d.ts +24 -0
  20. package/dist/inject-is-restoring.mjs +24 -0
  21. package/dist/inject-is-restoring.mjs.map +1 -0
  22. package/dist/inject-mutation-state.d.ts +26 -0
  23. package/dist/inject-mutation-state.mjs +51 -0
  24. package/dist/inject-mutation-state.mjs.map +1 -0
  25. package/dist/inject-mutation.d.ts +22 -0
  26. package/dist/inject-mutation.mjs +79 -0
  27. package/dist/inject-mutation.mjs.map +1 -0
  28. package/dist/inject-queries.d.ts +76 -0
  29. package/dist/inject-queries.mjs +49 -0
  30. package/dist/inject-queries.mjs.map +1 -0
  31. package/dist/inject-query-client.d.ts +19 -0
  32. package/dist/inject-query-client.mjs +9 -0
  33. package/dist/inject-query-client.mjs.map +1 -0
  34. package/dist/inject-query.d.ts +126 -0
  35. package/dist/inject-query.mjs +14 -0
  36. package/dist/inject-query.mjs.map +1 -0
  37. package/dist/mutation-options.d.ts +38 -0
  38. package/dist/mutation-options.mjs +7 -0
  39. package/dist/mutation-options.mjs.map +1 -0
  40. package/dist/providers.d.ts +219 -0
  41. package/dist/providers.mjs +109 -0
  42. package/dist/providers.mjs.map +1 -0
  43. package/dist/query-options.d.ts +87 -0
  44. package/dist/query-options.mjs +7 -0
  45. package/dist/query-options.mjs.map +1 -0
  46. package/dist/signal-proxy.d.ts +11 -0
  47. package/dist/signal-proxy.mjs +29 -0
  48. package/dist/signal-proxy.mjs.map +1 -0
  49. package/dist/types.d.ts +89 -0
  50. package/dist/util/is-dev-mode/is-dev-mode.d.ts +1 -0
  51. package/package.json +10 -11
  52. package/src/providers.ts +4 -0
  53. package/build/index.d.ts +0 -821
  54. package/build/index.mjs +0 -622
  55. package/build/index.mjs.map +0 -1
  56. package/src/test-setup.ts +0 -7
@@ -0,0 +1,219 @@
1
+ import { InjectionToken, Provider } from '@angular/core';
2
+ import { QueryClient } from '@tanstack/query-core';
3
+ import { DevtoolsButtonPosition, DevtoolsErrorType, DevtoolsPosition } from '@tanstack/query-devtools';
4
+ /**
5
+ * Usually {@link provideTanStackQuery} is used once to set up TanStack Query and the
6
+ * {@link https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient}
7
+ * for the entire application. Internally it calls `provideQueryClient`.
8
+ * You can use `provideQueryClient` to provide a different `QueryClient` instance for a part
9
+ * of the application or for unit testing purposes.
10
+ * @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
11
+ * @returns a provider object that can be used to provide the `QueryClient` instance.
12
+ */
13
+ export declare function provideQueryClient(queryClient: QueryClient | InjectionToken<QueryClient>): Provider;
14
+ /**
15
+ * Sets up providers necessary to enable TanStack Query functionality for Angular applications.
16
+ *
17
+ * Allows to configure a `QueryClient` and optional features such as developer tools.
18
+ *
19
+ * **Example - standalone**
20
+ *
21
+ * ```ts
22
+ * import {
23
+ * provideTanStackQuery,
24
+ * QueryClient,
25
+ * } from '@tanstack/angular-query-experimental'
26
+ *
27
+ * bootstrapApplication(AppComponent, {
28
+ * providers: [provideTanStackQuery(new QueryClient())],
29
+ * })
30
+ * ```
31
+ *
32
+ * **Example - NgModule-based**
33
+ *
34
+ * ```ts
35
+ * import {
36
+ * provideTanStackQuery,
37
+ * QueryClient,
38
+ * } from '@tanstack/angular-query-experimental'
39
+ *
40
+ * @NgModule({
41
+ * declarations: [AppComponent],
42
+ * imports: [BrowserModule],
43
+ * providers: [provideTanStackQuery(new QueryClient())],
44
+ * bootstrap: [AppComponent],
45
+ * })
46
+ * export class AppModule {}
47
+ * ```
48
+ *
49
+ * You can also enable optional developer tools by adding `withDevtools`. By
50
+ * default the tools will then be loaded when your app is in development mode.
51
+ * ```ts
52
+ * import {
53
+ * provideTanStackQuery,
54
+ * withDevtools
55
+ * QueryClient,
56
+ * } from '@tanstack/angular-query-experimental'
57
+ *
58
+ * bootstrapApplication(AppComponent,
59
+ * {
60
+ * providers: [
61
+ * provideTanStackQuery(new QueryClient(), withDevtools())
62
+ * ]
63
+ * }
64
+ * )
65
+ * ```
66
+ *
67
+ * **Example: using an InjectionToken**
68
+ *
69
+ * ```ts
70
+ * export const MY_QUERY_CLIENT = new InjectionToken('', {
71
+ * factory: () => new QueryClient(),
72
+ * })
73
+ *
74
+ * // In a lazy loaded route or lazy loaded component's providers array:
75
+ * providers: [provideTanStackQuery(MY_QUERY_CLIENT)]
76
+ * ```
77
+ * @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.
78
+ * @param features - Optional features to configure additional Query functionality.
79
+ * @returns A set of providers to set up TanStack Query.
80
+ * @see https://tanstack.com/query/v5/docs/framework/angular/quick-start
81
+ * @see withDevtools
82
+ */
83
+ export declare function provideTanStackQuery(queryClient: QueryClient | InjectionToken<QueryClient>, ...features: Array<QueryFeatures>): Array<Provider>;
84
+ /**
85
+ * Sets up providers necessary to enable TanStack Query functionality for Angular applications.
86
+ *
87
+ * Allows to configure a `QueryClient`.
88
+ * @param queryClient - A `QueryClient` instance.
89
+ * @returns A set of providers to set up TanStack Query.
90
+ * @public
91
+ * @see https://tanstack.com/query/v5/docs/framework/angular/quick-start
92
+ * @deprecated Use `provideTanStackQuery` instead.
93
+ */
94
+ export declare function provideAngularQuery(queryClient: QueryClient): Array<Provider>;
95
+ /**
96
+ * Helper type to represent a Query feature.
97
+ */
98
+ export interface QueryFeature<TFeatureKind extends QueryFeatureKind> {
99
+ ɵkind: TFeatureKind;
100
+ ɵproviders: Array<Provider>;
101
+ }
102
+ /**
103
+ * Helper function to create an object that represents a Query feature.
104
+ * @param kind -
105
+ * @param providers -
106
+ * @returns A Query feature.
107
+ */
108
+ export declare function queryFeature<TFeatureKind extends QueryFeatureKind>(kind: TFeatureKind, providers: Array<Provider>): QueryFeature<TFeatureKind>;
109
+ /**
110
+ * A type alias that represents a feature which enables developer tools.
111
+ * The type is used to describe the return value of the `withDevtools` function.
112
+ * @public
113
+ * @see {@link withDevtools}
114
+ */
115
+ export type DeveloperToolsFeature = QueryFeature<'DeveloperTools'>;
116
+ /**
117
+ * A type alias that represents a feature which enables persistence.
118
+ * The type is used to describe the return value of the `withPersistQueryClient` function.
119
+ * @public
120
+ */
121
+ export type PersistQueryClientFeature = QueryFeature<'PersistQueryClient'>;
122
+ /**
123
+ * Options for configuring the TanStack Query devtools.
124
+ * @public
125
+ */
126
+ export interface DevtoolsOptions {
127
+ /**
128
+ * Set this true if you want the devtools to default to being open
129
+ */
130
+ initialIsOpen?: boolean;
131
+ /**
132
+ * The position of the TanStack logo to open and close the devtools panel.
133
+ * `top-left` | `top-right` | `bottom-left` | `bottom-right` | `relative`
134
+ * Defaults to `bottom-right`.
135
+ */
136
+ buttonPosition?: DevtoolsButtonPosition;
137
+ /**
138
+ * The position of the TanStack Query devtools panel.
139
+ * `top` | `bottom` | `left` | `right`
140
+ * Defaults to `bottom`.
141
+ */
142
+ position?: DevtoolsPosition;
143
+ /**
144
+ * Custom instance of QueryClient
145
+ */
146
+ client?: QueryClient;
147
+ /**
148
+ * Use this so you can define custom errors that can be shown in the devtools.
149
+ */
150
+ errorTypes?: Array<DevtoolsErrorType>;
151
+ /**
152
+ * 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.
153
+ */
154
+ styleNonce?: string;
155
+ /**
156
+ * Use this so you can attach the devtool's styles to a specific element in the DOM.
157
+ */
158
+ shadowDOMTarget?: ShadowRoot;
159
+ /**
160
+ * Set this to true to hide disabled queries from the devtools panel.
161
+ */
162
+ hideDisabledQueries?: boolean;
163
+ /**
164
+ * Whether the developer tools should load.
165
+ * - `auto`- (Default) Lazily loads devtools when in development mode. Skips loading in production mode.
166
+ * - `true`- Always load the devtools, regardless of the environment.
167
+ * - `false`- Never load the devtools, regardless of the environment.
168
+ *
169
+ * You can use `true` and `false` to override loading developer tools from an environment file.
170
+ * For example, a test environment might run in production mode but you may want to load developer tools.
171
+ *
172
+ * Additionally, you can use a signal in the callback to dynamically load the devtools based on a condition. For example,
173
+ * a signal created from a RxJS observable that listens for a keyboard shortcut.
174
+ *
175
+ * **Example**
176
+ * ```ts
177
+ * withDevtools(() => ({
178
+ * initialIsOpen: true,
179
+ * loadDevtools: inject(ExampleService).loadDevtools()
180
+ * }))
181
+ * ```
182
+ */
183
+ loadDevtools?: 'auto' | boolean;
184
+ }
185
+ /**
186
+ * Enables developer tools.
187
+ *
188
+ * **Example**
189
+ *
190
+ * ```ts
191
+ * export const appConfig: ApplicationConfig = {
192
+ * providers: [
193
+ * provideTanStackQuery(new QueryClient(), withDevtools())
194
+ * ]
195
+ * }
196
+ * ```
197
+ * By default the devtools will be loaded when Angular runs in development mode and rendered in `<body>`.
198
+ *
199
+ * If you need more control over when devtools are loaded, you can use the `loadDevtools` option. This is particularly useful if you want to load devtools based on environment configurations. For instance, you might have a test environment running in production mode but still require devtools to be available.
200
+ *
201
+ * If you need more control over where devtools are rendered, consider `injectDevtoolsPanel`. This allows rendering devtools inside your own devtools for example.
202
+ * @param withDevtoolsFn - A function that returns `DevtoolsOptions`.
203
+ * @returns A set of providers for use with `provideTanStackQuery`.
204
+ * @public
205
+ * @see {@link provideTanStackQuery}
206
+ * @see {@link DevtoolsOptions}
207
+ */
208
+ export declare function withDevtools(withDevtoolsFn?: () => DevtoolsOptions): DeveloperToolsFeature;
209
+ /**
210
+ * A type alias that represents all Query features available for use with `provideTanStackQuery`.
211
+ * Features can be enabled by adding special functions to the `provideTanStackQuery` call.
212
+ * See documentation for each symbol to find corresponding function name. See also `provideTanStackQuery`
213
+ * documentation on how to use those functions.
214
+ * @public
215
+ * @see {@link provideTanStackQuery}
216
+ */
217
+ export type QueryFeatures = DeveloperToolsFeature | PersistQueryClientFeature;
218
+ export declare const queryFeatures: readonly ["DeveloperTools", "PersistQueryClient"];
219
+ export type QueryFeatureKind = (typeof queryFeatures)[number];
@@ -0,0 +1,109 @@
1
+ import { InjectionToken, inject, DestroyRef, isDevMode, ENVIRONMENT_INITIALIZER, PLATFORM_ID, computed, effect } from "@angular/core";
2
+ import { QueryClient, noop, onlineManager } from "@tanstack/query-core";
3
+ import { isPlatformBrowser } from "@angular/common";
4
+ function provideQueryClient(queryClient) {
5
+ return {
6
+ provide: QueryClient,
7
+ useFactory: () => {
8
+ const client = queryClient instanceof InjectionToken ? inject(queryClient) : queryClient;
9
+ inject(DestroyRef).onDestroy(() => client.unmount());
10
+ client.mount();
11
+ return client;
12
+ }
13
+ };
14
+ }
15
+ function provideTanStackQuery(queryClient, ...features) {
16
+ return [
17
+ provideQueryClient(queryClient),
18
+ features.map((feature) => feature.ɵproviders)
19
+ ];
20
+ }
21
+ function queryFeature(kind, providers) {
22
+ return { ɵkind: kind, ɵproviders: providers };
23
+ }
24
+ function withDevtools(withDevtoolsFn) {
25
+ let providers = [];
26
+ if (!isDevMode() && !withDevtoolsFn) {
27
+ providers = [];
28
+ } else {
29
+ providers = [
30
+ {
31
+ // Do not use provideEnvironmentInitializer while Angular < v19 is supported
32
+ provide: ENVIRONMENT_INITIALIZER,
33
+ multi: true,
34
+ useFactory: () => {
35
+ if (!isPlatformBrowser(inject(PLATFORM_ID))) return noop;
36
+ const injectedClient = inject(QueryClient, {
37
+ optional: true
38
+ });
39
+ const destroyRef = inject(DestroyRef);
40
+ const options = computed(() => (withDevtoolsFn == null ? void 0 : withDevtoolsFn()) ?? {});
41
+ let devtools = null;
42
+ let el = null;
43
+ const shouldLoadToolsSignal = computed(() => {
44
+ const { loadDevtools } = options();
45
+ return typeof loadDevtools === "boolean" ? loadDevtools : isDevMode();
46
+ });
47
+ const getResolvedQueryClient = () => {
48
+ const client = options().client ?? injectedClient;
49
+ if (!client) {
50
+ throw new Error("No QueryClient found");
51
+ }
52
+ return client;
53
+ };
54
+ const destroyDevtools = () => {
55
+ devtools == null ? void 0 : devtools.unmount();
56
+ el == null ? void 0 : el.remove();
57
+ devtools = null;
58
+ };
59
+ return () => effect(() => {
60
+ const shouldLoadTools = shouldLoadToolsSignal();
61
+ const {
62
+ client,
63
+ position,
64
+ errorTypes,
65
+ buttonPosition,
66
+ initialIsOpen
67
+ } = options();
68
+ if (devtools && !shouldLoadTools) {
69
+ destroyDevtools();
70
+ return;
71
+ } else if (devtools && shouldLoadTools) {
72
+ client && devtools.setClient(client);
73
+ position && devtools.setPosition(position);
74
+ errorTypes && devtools.setErrorTypes(errorTypes);
75
+ buttonPosition && devtools.setButtonPosition(buttonPosition);
76
+ initialIsOpen && devtools.setInitialIsOpen(initialIsOpen);
77
+ return;
78
+ } else if (!shouldLoadTools) {
79
+ return;
80
+ }
81
+ el = document.body.appendChild(document.createElement("div"));
82
+ el.classList.add("tsqd-parent-container");
83
+ import("@tanstack/query-devtools").then((queryDevtools) => {
84
+ devtools = new queryDevtools.TanstackQueryDevtools({
85
+ ...options(),
86
+ client: getResolvedQueryClient(),
87
+ queryFlavor: "Angular Query",
88
+ version: "5",
89
+ onlineManager
90
+ });
91
+ el && devtools.mount(el);
92
+ destroyRef.onDestroy(destroyDevtools);
93
+ });
94
+ });
95
+ }
96
+ }
97
+ ];
98
+ }
99
+ return queryFeature("DeveloperTools", providers);
100
+ }
101
+ const queryFeatures = ["DeveloperTools", "PersistQueryClient"];
102
+ export {
103
+ provideQueryClient,
104
+ provideTanStackQuery,
105
+ queryFeature,
106
+ queryFeatures,
107
+ withDevtools
108
+ };
109
+ //# sourceMappingURL=providers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.mjs","sources":["../src/providers.ts"],"sourcesContent":["import {\n DestroyRef,\n ENVIRONMENT_INITIALIZER,\n InjectionToken,\n PLATFORM_ID,\n computed,\n effect,\n inject,\n} from '@angular/core'\nimport { QueryClient, noop, onlineManager } from '@tanstack/query-core'\nimport { isPlatformBrowser } from '@angular/common'\nimport { isDevMode } from './util/is-dev-mode/is-dev-mode'\nimport type { Provider } from '@angular/core'\nimport type {\n DevtoolsButtonPosition,\n DevtoolsErrorType,\n DevtoolsPosition,\n TanstackQueryDevtools,\n} from '@tanstack/query-devtools'\n\n/**\n * Usually {@link provideTanStackQuery} is used once to set up TanStack Query and the\n * {@link https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient}\n * for the entire application. Internally it calls `provideQueryClient`.\n * You can use `provideQueryClient` to provide a different `QueryClient` instance for a part\n * of the application or for unit testing purposes.\n * @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.\n * @returns a provider object that can be used to provide the `QueryClient` instance.\n */\nexport function provideQueryClient(\n queryClient: QueryClient | InjectionToken<QueryClient>,\n): Provider {\n return {\n provide: QueryClient,\n useFactory: () => {\n const client =\n queryClient instanceof InjectionToken\n ? inject(queryClient)\n : queryClient\n // Unmount the query client on injector destroy\n inject(DestroyRef).onDestroy(() => client.unmount())\n client.mount()\n return client\n },\n }\n}\n\n/**\n * Sets up providers necessary to enable TanStack Query functionality for Angular applications.\n *\n * Allows to configure a `QueryClient` and optional features such as developer tools.\n *\n * **Example - standalone**\n *\n * ```ts\n * import {\n * provideTanStackQuery,\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * bootstrapApplication(AppComponent, {\n * providers: [provideTanStackQuery(new QueryClient())],\n * })\n * ```\n *\n * **Example - NgModule-based**\n *\n * ```ts\n * import {\n * provideTanStackQuery,\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * @NgModule({\n * declarations: [AppComponent],\n * imports: [BrowserModule],\n * providers: [provideTanStackQuery(new QueryClient())],\n * bootstrap: [AppComponent],\n * })\n * export class AppModule {}\n * ```\n *\n * You can also enable optional developer tools by adding `withDevtools`. By\n * default the tools will then be loaded when your app is in development mode.\n * ```ts\n * import {\n * provideTanStackQuery,\n * withDevtools\n * QueryClient,\n * } from '@tanstack/angular-query-experimental'\n *\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideTanStackQuery(new QueryClient(), withDevtools())\n * ]\n * }\n * )\n * ```\n *\n * **Example: using an InjectionToken**\n *\n * ```ts\n * export const MY_QUERY_CLIENT = new InjectionToken('', {\n * factory: () => new QueryClient(),\n * })\n *\n * // In a lazy loaded route or lazy loaded component's providers array:\n * providers: [provideTanStackQuery(MY_QUERY_CLIENT)]\n * ```\n * @param queryClient - A `QueryClient` instance, or an `InjectionToken` which provides a `QueryClient`.\n * @param features - Optional features to configure additional Query functionality.\n * @returns A set of providers to set up TanStack Query.\n * @see https://tanstack.com/query/v5/docs/framework/angular/quick-start\n * @see withDevtools\n */\nexport function provideTanStackQuery(\n queryClient: QueryClient | InjectionToken<QueryClient>,\n ...features: Array<QueryFeatures>\n): Array<Provider> {\n return [\n provideQueryClient(queryClient),\n features.map((feature) => feature.ɵproviders),\n ]\n}\n\n/**\n * Sets up providers necessary to enable TanStack Query functionality for Angular applications.\n *\n * Allows to configure a `QueryClient`.\n * @param queryClient - A `QueryClient` instance.\n * @returns A set of providers to set up TanStack Query.\n * @public\n * @see https://tanstack.com/query/v5/docs/framework/angular/quick-start\n * @deprecated Use `provideTanStackQuery` instead.\n */\nexport function provideAngularQuery(queryClient: QueryClient): Array<Provider> {\n return provideTanStackQuery(queryClient)\n}\n\n/**\n * Helper type to represent a Query feature.\n */\nexport interface QueryFeature<TFeatureKind extends QueryFeatureKind> {\n ɵkind: TFeatureKind\n ɵproviders: Array<Provider>\n}\n\n/**\n * Helper function to create an object that represents a Query feature.\n * @param kind -\n * @param providers -\n * @returns A Query feature.\n */\nexport function queryFeature<TFeatureKind extends QueryFeatureKind>(\n kind: TFeatureKind,\n providers: Array<Provider>,\n): QueryFeature<TFeatureKind> {\n return { ɵkind: kind, ɵproviders: providers }\n}\n\n/**\n * A type alias that represents a feature which enables developer tools.\n * The type is used to describe the return value of the `withDevtools` function.\n * @public\n * @see {@link withDevtools}\n */\nexport type DeveloperToolsFeature = QueryFeature<'DeveloperTools'>\n\n/**\n * A type alias that represents a feature which enables persistence.\n * The type is used to describe the return value of the `withPersistQueryClient` function.\n * @public\n */\nexport type PersistQueryClientFeature = QueryFeature<'PersistQueryClient'>\n\n/**\n * Options for configuring the TanStack Query devtools.\n * @public\n */\nexport interface DevtoolsOptions {\n /**\n * Set this true if you want the devtools to default to being open\n */\n initialIsOpen?: boolean\n /**\n * The position of the TanStack logo to open and close the devtools panel.\n * `top-left` | `top-right` | `bottom-left` | `bottom-right` | `relative`\n * Defaults to `bottom-right`.\n */\n buttonPosition?: DevtoolsButtonPosition\n /**\n * The position of the TanStack Query devtools panel.\n * `top` | `bottom` | `left` | `right`\n * Defaults to `bottom`.\n */\n position?: DevtoolsPosition\n /**\n * Custom instance of QueryClient\n */\n client?: QueryClient\n /**\n * Use this so you can define custom errors that can be shown in the devtools.\n */\n errorTypes?: Array<DevtoolsErrorType>\n /**\n * 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.\n */\n styleNonce?: string\n /**\n * Use this so you can attach the devtool's styles to a specific element in the DOM.\n */\n shadowDOMTarget?: ShadowRoot\n /**\n * Set this to true to hide disabled queries from the devtools panel.\n */\n hideDisabledQueries?: boolean\n\n /**\n * Whether the developer tools should load.\n * - `auto`- (Default) Lazily loads devtools when in development mode. Skips loading in production mode.\n * - `true`- Always load the devtools, regardless of the environment.\n * - `false`- Never load the devtools, regardless of the environment.\n *\n * You can use `true` and `false` to override loading developer tools from an environment file.\n * For example, a test environment might run in production mode but you may want to load developer tools.\n *\n * Additionally, you can use a signal in the callback to dynamically load the devtools based on a condition. For example,\n * a signal created from a RxJS observable that listens for a keyboard shortcut.\n *\n * **Example**\n * ```ts\n * withDevtools(() => ({\n * initialIsOpen: true,\n * loadDevtools: inject(ExampleService).loadDevtools()\n * }))\n * ```\n */\n loadDevtools?: 'auto' | boolean\n}\n\n/**\n * Enables developer tools.\n *\n * **Example**\n *\n * ```ts\n * export const appConfig: ApplicationConfig = {\n * providers: [\n * provideTanStackQuery(new QueryClient(), withDevtools())\n * ]\n * }\n * ```\n * By default the devtools will be loaded when Angular runs in development mode and rendered in `<body>`.\n *\n * If you need more control over when devtools are loaded, you can use the `loadDevtools` option. This is particularly useful if you want to load devtools based on environment configurations. For instance, you might have a test environment running in production mode but still require devtools to be available.\n *\n * If you need more control over where devtools are rendered, consider `injectDevtoolsPanel`. This allows rendering devtools inside your own devtools for example.\n * @param withDevtoolsFn - A function that returns `DevtoolsOptions`.\n * @returns A set of providers for use with `provideTanStackQuery`.\n * @public\n * @see {@link provideTanStackQuery}\n * @see {@link DevtoolsOptions}\n */\nexport function withDevtools(\n withDevtoolsFn?: () => DevtoolsOptions,\n): DeveloperToolsFeature {\n let providers: Array<Provider> = []\n if (!isDevMode() && !withDevtoolsFn) {\n providers = []\n } else {\n providers = [\n {\n // Do not use provideEnvironmentInitializer while Angular < v19 is supported\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory: () => {\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return noop\n const injectedClient = inject(QueryClient, {\n optional: true,\n })\n const destroyRef = inject(DestroyRef)\n\n const options = computed(() => withDevtoolsFn?.() ?? {})\n\n let devtools: TanstackQueryDevtools | null = null\n let el: HTMLElement | null = null\n\n const shouldLoadToolsSignal = computed(() => {\n const { loadDevtools } = options()\n return typeof loadDevtools === 'boolean'\n ? loadDevtools\n : isDevMode()\n })\n\n const getResolvedQueryClient = () => {\n const client = options().client ?? injectedClient\n if (!client) {\n throw new Error('No QueryClient found')\n }\n return client\n }\n\n const destroyDevtools = () => {\n devtools?.unmount()\n el?.remove()\n devtools = null\n }\n\n return () =>\n effect(() => {\n const shouldLoadTools = shouldLoadToolsSignal()\n const {\n client,\n position,\n errorTypes,\n buttonPosition,\n initialIsOpen,\n } = options()\n\n if (devtools && !shouldLoadTools) {\n destroyDevtools()\n return\n } else if (devtools && shouldLoadTools) {\n client && devtools.setClient(client)\n position && devtools.setPosition(position)\n errorTypes && devtools.setErrorTypes(errorTypes)\n buttonPosition && devtools.setButtonPosition(buttonPosition)\n initialIsOpen && devtools.setInitialIsOpen(initialIsOpen)\n return\n } else if (!shouldLoadTools) {\n return\n }\n\n el = document.body.appendChild(document.createElement('div'))\n el.classList.add('tsqd-parent-container')\n\n import('@tanstack/query-devtools').then((queryDevtools) => {\n devtools = new queryDevtools.TanstackQueryDevtools({\n ...options(),\n client: getResolvedQueryClient(),\n queryFlavor: 'Angular Query',\n version: '5',\n onlineManager,\n })\n\n el && devtools.mount(el)\n\n // Unmount the devtools on application destroy\n destroyRef.onDestroy(destroyDevtools)\n })\n })\n },\n },\n ]\n }\n return queryFeature('DeveloperTools', providers)\n}\n\n/**\n * A type alias that represents all Query features available for use with `provideTanStackQuery`.\n * Features can be enabled by adding special functions to the `provideTanStackQuery` call.\n * See documentation for each symbol to find corresponding function name. See also `provideTanStackQuery`\n * documentation on how to use those functions.\n * @public\n * @see {@link provideTanStackQuery}\n */\nexport type QueryFeatures = DeveloperToolsFeature | PersistQueryClientFeature\n\nexport const queryFeatures = ['DeveloperTools', 'PersistQueryClient'] as const\n\nexport type QueryFeatureKind = (typeof queryFeatures)[number]\n"],"names":[],"mappings":";;;AA6BO,SAAS,mBACd,aACU;AACH,SAAA;AAAA,IACL,SAAS;AAAA,IACT,YAAY,MAAM;AAChB,YAAM,SACJ,uBAAuB,iBACnB,OAAO,WAAW,IAClB;AAEN,aAAO,UAAU,EAAE,UAAU,MAAM,OAAO,SAAS;AACnD,aAAO,MAAM;AACN,aAAA;AAAA,IAAA;AAAA,EAEX;AACF;AAuEgB,SAAA,qBACd,gBACG,UACc;AACV,SAAA;AAAA,IACL,mBAAmB,WAAW;AAAA,IAC9B,SAAS,IAAI,CAAC,YAAY,QAAQ,UAAU;AAAA,EAC9C;AACF;AA8BgB,SAAA,aACd,MACA,WAC4B;AAC5B,SAAO,EAAE,OAAO,MAAM,YAAY,UAAU;AAC9C;AAyGO,SAAS,aACd,gBACuB;AACvB,MAAI,YAA6B,CAAC;AAClC,MAAI,CAAC,eAAe,CAAC,gBAAgB;AACnC,gBAAY,CAAC;AAAA,EAAA,OACR;AACO,gBAAA;AAAA,MACV;AAAA;AAAA,QAEE,SAAS;AAAA,QACT,OAAO;AAAA,QACP,YAAY,MAAM;AAChB,cAAI,CAAC,kBAAkB,OAAO,WAAW,CAAC,EAAU,QAAA;AAC9C,gBAAA,iBAAiB,OAAO,aAAa;AAAA,YACzC,UAAU;AAAA,UAAA,CACX;AACK,gBAAA,aAAa,OAAO,UAAU;AAEpC,gBAAM,UAAU,SAAS,OAAM,uDAAsB,CAAA,CAAE;AAEvD,cAAI,WAAyC;AAC7C,cAAI,KAAyB;AAEvB,gBAAA,wBAAwB,SAAS,MAAM;AACrC,kBAAA,EAAE,aAAa,IAAI,QAAQ;AACjC,mBAAO,OAAO,iBAAiB,YAC3B,eACA,UAAU;AAAA,UAAA,CACf;AAED,gBAAM,yBAAyB,MAAM;AAC7B,kBAAA,SAAS,UAAU,UAAU;AACnC,gBAAI,CAAC,QAAQ;AACL,oBAAA,IAAI,MAAM,sBAAsB;AAAA,YAAA;AAEjC,mBAAA;AAAA,UACT;AAEA,gBAAM,kBAAkB,MAAM;AAC5B,iDAAU;AACV,qCAAI;AACO,uBAAA;AAAA,UACb;AAEO,iBAAA,MACL,OAAO,MAAM;AACX,kBAAM,kBAAkB,sBAAsB;AACxC,kBAAA;AAAA,cACJ;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,gBACE,QAAQ;AAER,gBAAA,YAAY,CAAC,iBAAiB;AAChB,8BAAA;AAChB;AAAA,YAAA,WACS,YAAY,iBAAiB;AAC5B,wBAAA,SAAS,UAAU,MAAM;AACvB,0BAAA,SAAS,YAAY,QAAQ;AAC3B,4BAAA,SAAS,cAAc,UAAU;AAC7B,gCAAA,SAAS,kBAAkB,cAAc;AAC1C,+BAAA,SAAS,iBAAiB,aAAa;AACxD;AAAA,YAAA,WACS,CAAC,iBAAiB;AAC3B;AAAA,YAAA;AAGF,iBAAK,SAAS,KAAK,YAAY,SAAS,cAAc,KAAK,CAAC;AACzD,eAAA,UAAU,IAAI,uBAAuB;AAExC,mBAAO,0BAA0B,EAAE,KAAK,CAAC,kBAAkB;AAC9C,yBAAA,IAAI,cAAc,sBAAsB;AAAA,gBACjD,GAAG,QAAQ;AAAA,gBACX,QAAQ,uBAAuB;AAAA,gBAC/B,aAAa;AAAA,gBACb,SAAS;AAAA,gBACT;AAAA,cAAA,CACD;AAEK,oBAAA,SAAS,MAAM,EAAE;AAGvB,yBAAW,UAAU,eAAe;AAAA,YAAA,CACrC;AAAA,UAAA,CACF;AAAA,QAAA;AAAA,MACL;AAAA,IAEJ;AAAA,EAAA;AAEK,SAAA,aAAa,kBAAkB,SAAS;AACjD;AAYa,MAAA,gBAAgB,CAAC,kBAAkB,oBAAoB;"}
@@ -0,0 +1,87 @@
1
+ import { DataTag, DefaultError, InitialDataFunction, NonUndefinedGuard, OmitKeyof, QueryFunction, QueryKey, SkipToken } from '@tanstack/query-core';
2
+ import { CreateQueryOptions } from './types.js';
3
+ export type UndefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
4
+ initialData?: undefined | InitialDataFunction<NonUndefinedGuard<TQueryFnData>> | NonUndefinedGuard<TQueryFnData>;
5
+ };
6
+ export type UnusedSkipTokenOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {
7
+ queryFn?: Exclude<CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'], SkipToken | undefined>;
8
+ };
9
+ export type DefinedInitialDataOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryFn'> & {
10
+ initialData: NonUndefinedGuard<TQueryFnData> | (() => NonUndefinedGuard<TQueryFnData>);
11
+ queryFn?: QueryFunction<TQueryFnData, TQueryKey>;
12
+ };
13
+ /**
14
+ * Allows to share and re-use query options in a type-safe way.
15
+ *
16
+ * The `queryKey` will be tagged with the type from `queryFn`.
17
+ *
18
+ * **Example**
19
+ *
20
+ * ```ts
21
+ * const { queryKey } = queryOptions({
22
+ * queryKey: ['key'],
23
+ * queryFn: () => Promise.resolve(5),
24
+ * // ^? Promise<number>
25
+ * })
26
+ *
27
+ * const queryClient = new QueryClient()
28
+ * const data = queryClient.getQueryData(queryKey)
29
+ * // ^? number | undefined
30
+ * ```
31
+ * @param options - The query options to tag with the type from `queryFn`.
32
+ * @returns The tagged query options.
33
+ * @public
34
+ */
35
+ export declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
36
+ queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
37
+ };
38
+ /**
39
+ * Allows to share and re-use query options in a type-safe way.
40
+ *
41
+ * The `queryKey` will be tagged with the type from `queryFn`.
42
+ *
43
+ * **Example**
44
+ *
45
+ * ```ts
46
+ * const { queryKey } = queryOptions({
47
+ * queryKey: ['key'],
48
+ * queryFn: () => Promise.resolve(5),
49
+ * // ^? Promise<number>
50
+ * })
51
+ *
52
+ * const queryClient = new QueryClient()
53
+ * const data = queryClient.getQueryData(queryKey)
54
+ * // ^? number | undefined
55
+ * ```
56
+ * @param options - The query options to tag with the type from `queryFn`.
57
+ * @returns The tagged query options.
58
+ * @public
59
+ */
60
+ export declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {
61
+ queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
62
+ };
63
+ /**
64
+ * Allows to share and re-use query options in a type-safe way.
65
+ *
66
+ * The `queryKey` will be tagged with the type from `queryFn`.
67
+ *
68
+ * **Example**
69
+ *
70
+ * ```ts
71
+ * const { queryKey } = queryOptions({
72
+ * queryKey: ['key'],
73
+ * queryFn: () => Promise.resolve(5),
74
+ * // ^? Promise<number>
75
+ * })
76
+ *
77
+ * const queryClient = new QueryClient()
78
+ * const data = queryClient.getQueryData(queryKey)
79
+ * // ^? number | undefined
80
+ * ```
81
+ * @param options - The query options to tag with the type from `queryFn`.
82
+ * @returns The tagged query options.
83
+ * @public
84
+ */
85
+ export declare function queryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {
86
+ queryKey: DataTag<TQueryKey, TQueryFnData, TError>;
87
+ };
@@ -0,0 +1,7 @@
1
+ function queryOptions(options) {
2
+ return options;
3
+ }
4
+ export {
5
+ queryOptions
6
+ };
7
+ //# sourceMappingURL=query-options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-options.mjs","sources":["../src/query-options.ts"],"sourcesContent":["import type {\n DataTag,\n DefaultError,\n InitialDataFunction,\n NonUndefinedGuard,\n OmitKeyof,\n QueryFunction,\n QueryKey,\n SkipToken,\n} from '@tanstack/query-core'\nimport type { CreateQueryOptions } from './types'\n\nexport type UndefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {\n initialData?:\n | undefined\n | InitialDataFunction<NonUndefinedGuard<TQueryFnData>>\n | NonUndefinedGuard<TQueryFnData>\n}\n\nexport type UnusedSkipTokenOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = OmitKeyof<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n queryFn?: Exclude<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>['queryFn'],\n SkipToken | undefined\n >\n}\n\nexport type DefinedInitialDataOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> = Omit<\n CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey>,\n 'queryFn'\n> & {\n initialData:\n | NonUndefinedGuard<TQueryFnData>\n | (() => NonUndefinedGuard<TQueryFnData>)\n queryFn?: QueryFunction<TQueryFnData, TQueryKey>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UnusedSkipTokenOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n>(\n options: UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey>,\n): UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> & {\n queryKey: DataTag<TQueryKey, TQueryFnData, TError>\n}\n\n/**\n * Allows to share and re-use query options in a type-safe way.\n *\n * The `queryKey` will be tagged with the type from `queryFn`.\n *\n * **Example**\n *\n * ```ts\n * const { queryKey } = queryOptions({\n * queryKey: ['key'],\n * queryFn: () => Promise.resolve(5),\n * // ^? Promise<number>\n * })\n *\n * const queryClient = new QueryClient()\n * const data = queryClient.getQueryData(queryKey)\n * // ^? number | undefined\n * ```\n * @param options - The query options to tag with the type from `queryFn`.\n * @returns The tagged query options.\n * @public\n */\nexport function queryOptions(options: unknown) {\n return options\n}\n"],"names":[],"mappings":"AA+KO,SAAS,aAAa,SAAkB;AACtC,SAAA;AACT;"}
@@ -0,0 +1,11 @@
1
+ import { Signal } from '@angular/core';
2
+ export type MapToSignals<T> = {
3
+ [K in keyof T]: T[K] extends Function ? T[K] : Signal<T[K]>;
4
+ };
5
+ /**
6
+ * Exposes fields of an object passed via an Angular `Signal` as `Computed` signals.
7
+ * Functions on the object are passed through as-is.
8
+ * @param inputSignal - `Signal` that must return an object.
9
+ * @returns A proxy object with the same fields as the input object, but with each field wrapped in a `Computed` signal.
10
+ */
11
+ export declare function signalProxy<TInput extends Record<string | symbol, any>>(inputSignal: Signal<TInput>): MapToSignals<TInput>;
@@ -0,0 +1,29 @@
1
+ import { untracked, computed } from "@angular/core";
2
+ function signalProxy(inputSignal) {
3
+ const internalState = {};
4
+ return new Proxy(internalState, {
5
+ get(target, prop) {
6
+ const computedField = target[prop];
7
+ if (computedField) return computedField;
8
+ const targetField = untracked(inputSignal)[prop];
9
+ if (typeof targetField === "function") return targetField;
10
+ return target[prop] = computed(() => inputSignal()[prop]);
11
+ },
12
+ has(_, prop) {
13
+ return !!untracked(inputSignal)[prop];
14
+ },
15
+ ownKeys() {
16
+ return Reflect.ownKeys(untracked(inputSignal));
17
+ },
18
+ getOwnPropertyDescriptor() {
19
+ return {
20
+ enumerable: true,
21
+ configurable: true
22
+ };
23
+ }
24
+ });
25
+ }
26
+ export {
27
+ signalProxy
28
+ };
29
+ //# sourceMappingURL=signal-proxy.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-proxy.mjs","sources":["../src/signal-proxy.ts"],"sourcesContent":["import { computed, untracked } from '@angular/core'\nimport type { Signal } from '@angular/core'\n\nexport type MapToSignals<T> = {\n [K in keyof T]: T[K] extends Function ? T[K] : Signal<T[K]>\n}\n\n/**\n * Exposes fields of an object passed via an Angular `Signal` as `Computed` signals.\n * Functions on the object are passed through as-is.\n * @param inputSignal - `Signal` that must return an object.\n * @returns A proxy object with the same fields as the input object, but with each field wrapped in a `Computed` signal.\n */\nexport function signalProxy<TInput extends Record<string | symbol, any>>(\n inputSignal: Signal<TInput>,\n) {\n const internalState = {} as MapToSignals<TInput>\n\n return new Proxy<MapToSignals<TInput>>(internalState, {\n get(target, prop) {\n // first check if we have it in our internal state and return it\n const computedField = target[prop]\n if (computedField) return computedField\n\n // then, check if it's a function on the resultState and return it\n const targetField = untracked(inputSignal)[prop]\n if (typeof targetField === 'function') return targetField\n\n // finally, create a computed field, store it and return it\n // @ts-expect-error\n return (target[prop] = computed(() => inputSignal()[prop]))\n },\n has(_, prop) {\n return !!untracked(inputSignal)[prop]\n },\n ownKeys() {\n return Reflect.ownKeys(untracked(inputSignal))\n },\n getOwnPropertyDescriptor() {\n return {\n enumerable: true,\n configurable: true,\n }\n },\n })\n}\n"],"names":[],"mappings":";AAaO,SAAS,YACd,aACA;AACA,QAAM,gBAAgB,CAAC;AAEhB,SAAA,IAAI,MAA4B,eAAe;AAAA,IACpD,IAAI,QAAQ,MAAM;AAEV,YAAA,gBAAgB,OAAO,IAAI;AACjC,UAAI,cAAsB,QAAA;AAG1B,YAAM,cAAc,UAAU,WAAW,EAAE,IAAI;AAC3C,UAAA,OAAO,gBAAgB,WAAmB,QAAA;AAItC,aAAA,OAAO,IAAI,IAAI,SAAS,MAAM,YAAY,EAAE,IAAI,CAAC;AAAA,IAC3D;AAAA,IACA,IAAI,GAAG,MAAM;AACX,aAAO,CAAC,CAAC,UAAU,WAAW,EAAE,IAAI;AAAA,IACtC;AAAA,IACA,UAAU;AACR,aAAO,QAAQ,QAAQ,UAAU,WAAW,CAAC;AAAA,IAC/C;AAAA,IACA,2BAA2B;AAClB,aAAA;AAAA,QACL,YAAY;AAAA,QACZ,cAAc;AAAA,MAChB;AAAA,IAAA;AAAA,EACF,CACD;AACH;"}
@@ -0,0 +1,89 @@
1
+ import { DefaultError, DefinedInfiniteQueryObserverResult, DefinedQueryObserverResult, InfiniteQueryObserverOptions, InfiniteQueryObserverResult, MutateFunction, MutationObserverResult, OmitKeyof, Override, QueryKey, QueryObserverOptions, QueryObserverResult } from '@tanstack/query-core';
2
+ import { Signal } from '@angular/core';
3
+ import { MapToSignals } from './signal-proxy.js';
4
+ /**
5
+ * @public
6
+ */
7
+ export interface CreateBaseQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends QueryObserverOptions<TQueryFnData, TError, TData, TQueryData, TQueryKey> {
8
+ }
9
+ /**
10
+ * @public
11
+ */
12
+ export interface CreateQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> extends OmitKeyof<CreateBaseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'suspense'> {
13
+ }
14
+ /**
15
+ * @public
16
+ */
17
+ type CreateStatusBasedQueryResult<TStatus extends QueryObserverResult['status'], TData = unknown, TError = DefaultError> = Extract<QueryObserverResult<TData, TError>, {
18
+ status: TStatus;
19
+ }>;
20
+ /**
21
+ * @public
22
+ */
23
+ export interface BaseQueryNarrowing<TData = unknown, TError = DefaultError> {
24
+ isSuccess: (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'success', TData, TError>>;
25
+ isError: (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'error', TData, TError>>;
26
+ isPending: (this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'pending', TData, TError>>;
27
+ }
28
+ /**
29
+ * @public
30
+ */
31
+ export interface CreateInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'suspense'> {
32
+ }
33
+ /**
34
+ * @public
35
+ */
36
+ export type CreateBaseQueryResult<TData = unknown, TError = DefaultError, TState = QueryObserverResult<TData, TError>> = BaseQueryNarrowing<TData, TError> & MapToSignals<OmitKeyof<TState, keyof BaseQueryNarrowing, 'safely'>>;
37
+ /**
38
+ * @public
39
+ */
40
+ export type CreateQueryResult<TData = unknown, TError = DefaultError> = CreateBaseQueryResult<TData, TError>;
41
+ /**
42
+ * @public
43
+ */
44
+ export type DefinedCreateQueryResult<TData = unknown, TError = DefaultError, TState = DefinedQueryObserverResult<TData, TError>> = BaseQueryNarrowing<TData, TError> & MapToSignals<OmitKeyof<TState, keyof BaseQueryNarrowing, 'safely'>>;
45
+ /**
46
+ * @public
47
+ */
48
+ export type CreateInfiniteQueryResult<TData = unknown, TError = DefaultError> = BaseQueryNarrowing<TData, TError> & MapToSignals<InfiniteQueryObserverResult<TData, TError>>;
49
+ /**
50
+ * @public
51
+ */
52
+ export type DefinedCreateInfiniteQueryResult<TData = unknown, TError = DefaultError, TDefinedInfiniteQueryObserver = DefinedInfiniteQueryObserverResult<TData, TError>> = MapToSignals<TDefinedInfiniteQueryObserver>;
53
+ /**
54
+ * @public
55
+ */
56
+ export type CreateMutateFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = (...args: Parameters<MutateFunction<TData, TError, TVariables, TContext>>) => void;
57
+ /**
58
+ * @public
59
+ */
60
+ export type CreateMutateAsyncFunction<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown> = MutateFunction<TData, TError, TVariables, TContext>;
61
+ /**
62
+ * @public
63
+ */
64
+ export type CreateBaseMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = Override<MutationObserverResult<TData, TError, TVariables, TContext>, {
65
+ mutate: CreateMutateFunction<TData, TError, TVariables, TContext>;
66
+ }> & {
67
+ mutateAsync: CreateMutateAsyncFunction<TData, TError, TVariables, TContext>;
68
+ };
69
+ /**
70
+ * @public
71
+ */
72
+ type CreateStatusBasedMutationResult<TStatus extends CreateBaseMutationResult['status'], TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> = Extract<CreateBaseMutationResult<TData, TError, TVariables, TContext>, {
73
+ status: TStatus;
74
+ }>;
75
+ type SignalFunction<T extends () => any> = T & Signal<ReturnType<T>>;
76
+ /**
77
+ * @public
78
+ */
79
+ export interface BaseMutationNarrowing<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown> {
80
+ isSuccess: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TContext>) => this is CreateMutationResult<TData, TError, TVariables, TContext, CreateStatusBasedMutationResult<'success', TData, TError, TVariables, TContext>>>;
81
+ isError: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TContext>) => this is CreateMutationResult<TData, TError, TVariables, TContext, CreateStatusBasedMutationResult<'error', TData, TError, TVariables, TContext>>>;
82
+ isPending: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TContext>) => this is CreateMutationResult<TData, TError, TVariables, TContext, CreateStatusBasedMutationResult<'pending', TData, TError, TVariables, TContext>>>;
83
+ isIdle: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TContext>) => this is CreateMutationResult<TData, TError, TVariables, TContext, CreateStatusBasedMutationResult<'idle', TData, TError, TVariables, TContext>>>;
84
+ }
85
+ /**
86
+ * @public
87
+ */
88
+ export type CreateMutationResult<TData = unknown, TError = DefaultError, TVariables = unknown, TContext = unknown, TState = CreateStatusBasedMutationResult<CreateBaseMutationResult['status'], TData, TError, TVariables, TContext>> = BaseMutationNarrowing<TData, TError, TVariables, TContext> & MapToSignals<OmitKeyof<TState, keyof BaseMutationNarrowing, 'safely'>>;
89
+ export {};
@@ -0,0 +1 @@
1
+ export { isDevMode } from '@angular/core';