@tanstack/angular-query 5.0.0-rc.3 → 5.0.0-rc.5

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 (70) hide show
  1. package/hydration-state-key.mjs +10 -13
  2. package/hydration-state-key.mjs.map +1 -1
  3. package/index.mjs +8 -20
  4. package/index.mjs.map +1 -1
  5. package/infinite-query-options.d.ts +7 -18
  6. package/infinite-query-options.mjs +6 -5
  7. package/infinite-query-options.mjs.map +1 -1
  8. package/inject-base-query.d.ts +3 -0
  9. package/inject-base-query.mjs +62 -58
  10. package/inject-base-query.mjs.map +1 -1
  11. package/inject-infinite-query.d.ts +7 -11
  12. package/inject-infinite-query.mjs +16 -32
  13. package/inject-infinite-query.mjs.map +1 -1
  14. package/inject-is-fetching.d.ts +1 -1
  15. package/inject-is-fetching.mjs +22 -15
  16. package/inject-is-fetching.mjs.map +1 -1
  17. package/inject-is-mutating.d.ts +1 -1
  18. package/inject-is-mutating.mjs +22 -15
  19. package/inject-is-mutating.mjs.map +1 -1
  20. package/inject-is-restoring.d.ts +2 -0
  21. package/inject-is-restoring.mjs +28 -17
  22. package/inject-is-restoring.mjs.map +1 -1
  23. package/inject-mutation-state.d.ts +9 -0
  24. package/inject-mutation-state.mjs +25 -23
  25. package/inject-mutation-state.mjs.map +1 -1
  26. package/inject-mutation.d.ts +2 -4
  27. package/inject-mutation.mjs +87 -67
  28. package/inject-mutation.mjs.map +1 -1
  29. package/inject-queries.d.ts +1 -3
  30. package/inject-queries.mjs +122 -114
  31. package/inject-queries.mjs.map +1 -1
  32. package/inject-queries.types.d.ts +17 -1
  33. package/inject-query.d.ts +7 -13
  34. package/inject-query.mjs +11 -14
  35. package/inject-query.mjs.map +1 -1
  36. package/internal.mjs +2 -7
  37. package/mutation-options.d.ts +2 -6
  38. package/mutation-options.mjs +6 -5
  39. package/mutation-options.mjs.map +1 -1
  40. package/package.json +2 -2
  41. package/providers.d.ts +16 -14
  42. package/providers.mjs +138 -75
  43. package/providers.mjs.map +1 -1
  44. package/query-options.d.ts +6 -16
  45. package/query-options.mjs +6 -5
  46. package/query-options.mjs.map +1 -1
  47. package/query-resource.d.ts +4 -3
  48. package/query-resource.mjs +72 -63
  49. package/query-resource.mjs.map +1 -1
  50. package/schematics/migrate-from-experimental/index.js +38 -9
  51. package/schematics/migrate-from-experimental/workspace.js +48 -12
  52. package/schematics/ng-add/index.js +1 -1
  53. package/types.d.ts +76 -16
  54. package/utils/inject-external-store.d.ts +3 -0
  55. package/utils/inject-external-store.mjs +54 -38
  56. package/utils/inject-external-store.mjs.map +1 -1
  57. package/utils/inject-pending-tasks-lifecycle.d.ts +13 -1
  58. package/utils/inject-pending-tasks-lifecycle.mjs +32 -29
  59. package/utils/inject-pending-tasks-lifecycle.mjs.map +1 -1
  60. package/utils/inject-query-zone.d.ts +4 -1
  61. package/utils/inject-query-zone.mjs +12 -7
  62. package/utils/inject-query-zone.mjs.map +1 -1
  63. package/utils/resource-types.d.ts +3 -0
  64. package/utils/result-fields.d.ts +9 -0
  65. package/utils/result-fields.mjs +55 -62
  66. package/utils/result-fields.mjs.map +1 -1
  67. package/utils/signal-proxy.d.ts +6 -0
  68. package/utils/signal-proxy.mjs +16 -9
  69. package/utils/signal-proxy.mjs.map +1 -1
  70. package/internal.mjs.map +0 -1
@@ -1,70 +1,79 @@
1
1
  import { computed, untracked } from "@angular/core";
2
+ //#region src/query-resource.ts
3
+ /**
4
+ * Converts an Angular Query result into Angular's Resource interface.
5
+ *
6
+ * Call this function once and reuse the returned resource.
7
+ * @param query - An Angular Query or infinite-query result.
8
+ * @returns A Resource-compatible view of the query result.
9
+ */
2
10
  function toResource(query) {
3
- const status = computed(() => {
4
- const fetchStatus = query.fetchStatus();
5
- const data = query.data();
6
- if (fetchStatus === "fetching" || fetchStatus === "paused") {
7
- return data === void 0 ? "loading" : "reloading";
8
- }
9
- switch (query.status()) {
10
- case "success":
11
- return "resolved";
12
- case "error":
13
- return "error";
14
- case "pending":
15
- return "idle";
16
- }
17
- });
18
- const error = computed(() => {
19
- return query.status() === "error" ? normalizeError(query.error()) : void 0;
20
- });
21
- const value = computed(() => {
22
- if (status() === "error") {
23
- throw error();
24
- }
25
- return query.data();
26
- });
27
- const snapshot = computed(() => {
28
- const currentStatus = status();
29
- if (currentStatus === "error") {
30
- return { status: "error", error: error() };
31
- }
32
- return { status: currentStatus, value: query.data() };
33
- });
34
- const hasValue = (() => status() !== "error" && query.data() !== void 0);
35
- return {
36
- value,
37
- status,
38
- error,
39
- snapshot,
40
- isLoading: computed(() => {
41
- const currentStatus = status();
42
- return currentStatus === "loading" || currentStatus === "reloading";
43
- }),
44
- hasValue,
45
- reload() {
46
- const currentStatus = untracked(status);
47
- if (currentStatus === "idle" || currentStatus === "loading" || currentStatus === "reloading") {
48
- return false;
49
- }
50
- if (!untracked(query.isStale)) {
51
- return false;
52
- }
53
- void query.refetch();
54
- return true;
55
- }
56
- };
11
+ const status = computed(() => {
12
+ const fetchStatus = query.fetchStatus();
13
+ const data = query.data();
14
+ if (fetchStatus === "fetching" || fetchStatus === "paused") return data === void 0 ? "loading" : "reloading";
15
+ switch (query.status()) {
16
+ case "success": return "resolved";
17
+ case "error": return "error";
18
+ case "pending": return "idle";
19
+ }
20
+ });
21
+ const error = computed(() => {
22
+ return query.status() === "error" ? normalizeError(query.error()) : void 0;
23
+ });
24
+ const value = computed(() => {
25
+ if (status() === "error") throw error();
26
+ return query.data();
27
+ });
28
+ const snapshot = computed(() => {
29
+ const currentStatus = status();
30
+ if (currentStatus === "error") return {
31
+ status: "error",
32
+ error: error()
33
+ };
34
+ return {
35
+ status: currentStatus,
36
+ value: query.data()
37
+ };
38
+ });
39
+ const hasValue = (() => status() !== "error" && query.data() !== void 0);
40
+ return {
41
+ value,
42
+ status,
43
+ error,
44
+ snapshot,
45
+ isLoading: computed(() => {
46
+ const currentStatus = status();
47
+ return currentStatus === "loading" || currentStatus === "reloading";
48
+ }),
49
+ hasValue,
50
+ reload() {
51
+ const currentStatus = untracked(status);
52
+ if (currentStatus === "idle" || currentStatus === "loading" || currentStatus === "reloading") return false;
53
+ if (!untracked(query.isStale)) return false;
54
+ query.refetch();
55
+ return true;
56
+ }
57
+ };
57
58
  }
59
+ /**
60
+ * Converts an unknown rejection reason to an Error-compatible value.
61
+ * @param error - The rejected value.
62
+ * @returns The existing error-like value, or an Error wrapping the rejection.
63
+ */
58
64
  function normalizeError(error) {
59
- if (isErrorLike(error)) {
60
- return error;
61
- }
62
- return new Error(String(error), { cause: error });
65
+ if (isErrorLike(error)) return error;
66
+ return new Error(String(error), { cause: error });
63
67
  }
68
+ /**
69
+ * Checks whether a value provides the name and message of an Error.
70
+ * @param error - The value to inspect.
71
+ * @returns Whether the value can be used as an Error.
72
+ */
64
73
  function isErrorLike(error) {
65
- return error instanceof Error || typeof error === "object" && error !== null && typeof error.name === "string" && typeof error.message === "string";
74
+ return error instanceof Error || typeof error === "object" && error !== null && typeof error.name === "string" && typeof error.message === "string";
66
75
  }
67
- export {
68
- toResource
69
- };
70
- //# sourceMappingURL=query-resource.mjs.map
76
+ //#endregion
77
+ export { toResource };
78
+
79
+ //# sourceMappingURL=query-resource.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-resource.mjs","sources":["../src/query-resource.ts"],"sourcesContent":["import { computed, untracked } from '@angular/core'\nimport type { QueryObserverResult } from '@tanstack/query-core'\nimport type { ResourceSnapshot } from './utils/resource-types'\nimport type { Resource, ResourceStatus, Signal } from '@angular/core'\n\nexport interface QueryResource<TValue> extends Resource<TValue> {\n /**\n * The current query state as a single snapshot.\n */\n readonly snapshot: Signal<ResourceSnapshot<TValue>>\n\n /**\n * Requests a new query fetch only when the current query data is stale.\n *\n * Used for compatibility with Angular APIs that might want to reload a resource,\n * like Signal Forms' validateAsync resource interface.\n *\n * @returns `true` if a reload was initiated, `false` if a reload was unnecessary or unsupported.\n */\n reload: () => boolean\n}\n\ntype QueryResourceSource<TValue> = {\n readonly data: Signal<TValue>\n readonly status: Signal<QueryObserverResult['status']>\n readonly fetchStatus: Signal<QueryObserverResult['fetchStatus']>\n readonly error: Signal<unknown>\n readonly isStale: Signal<boolean>\n readonly refetch: () => unknown\n}\n\n/**\n * Converts an Angular Query result into Angular's Resource interface.\n *\n * Call this function once and reuse the returned resource.\n *\n * @param query An Angular Query or infinite-query result.\n * @returns A Resource-compatible view of the query result.\n */\nexport function toResource<TValue>(\n query: QueryResourceSource<TValue>,\n): QueryResource<TValue> {\n // Intentionally does not use resource from snapshot to have\n // support for the reload method for compatible libraries\n const status = computed<ResourceStatus>(() => {\n const fetchStatus = query.fetchStatus()\n const data = query.data()\n\n if (fetchStatus === 'fetching' || fetchStatus === 'paused') {\n return data === undefined ? 'loading' : 'reloading'\n }\n\n switch (query.status()) {\n case 'success':\n return 'resolved'\n case 'error':\n return 'error'\n case 'pending':\n return 'idle'\n }\n })\n\n const error = computed<Error | undefined>(() => {\n return query.status() === 'error'\n ? normalizeError(query.error())\n : undefined\n })\n\n const value = computed(() => {\n if (status() === 'error') {\n throw error()\n }\n\n return query.data()\n })\n\n const snapshot = computed<ResourceSnapshot<TValue>>(() => {\n const currentStatus = status()\n\n if (currentStatus === 'error') {\n return { status: 'error', error: error()! }\n }\n\n return { status: currentStatus, value: query.data() }\n })\n\n const hasValue = (() =>\n status() !== 'error' &&\n query.data() !== undefined) as QueryResource<TValue>['hasValue']\n\n return {\n value,\n status,\n error,\n snapshot,\n isLoading: computed(() => {\n const currentStatus = status()\n return currentStatus === 'loading' || currentStatus === 'reloading'\n }),\n hasValue,\n reload(): boolean {\n const currentStatus = untracked(status)\n if (\n currentStatus === 'idle' ||\n currentStatus === 'loading' ||\n currentStatus === 'reloading'\n ) {\n return false\n }\n\n if (!untracked(query.isStale)) {\n return false\n }\n\n void query.refetch()\n return true\n },\n }\n}\n\nfunction normalizeError(error: unknown): Error {\n if (isErrorLike(error)) {\n return error\n }\n\n return new Error(String(error), { cause: error })\n}\n\nfunction isErrorLike(error: unknown): error is Error {\n return (\n error instanceof Error ||\n (typeof error === 'object' &&\n error !== null &&\n typeof (error as Error).name === 'string' &&\n typeof (error as Error).message === 'string')\n )\n}\n"],"names":[],"mappings":";AAuCO,SAAS,WACd,OACuB;AAGvB,QAAM,SAAS,SAAyB,MAAM;AAC5C,UAAM,cAAc,MAAM,YAAA;AAC1B,UAAM,OAAO,MAAM,KAAA;AAEnB,QAAI,gBAAgB,cAAc,gBAAgB,UAAU;AAC1D,aAAO,SAAS,SAAY,YAAY;AAAA,IAC1C;AAEA,YAAQ,MAAM,UAAO;AAAA,MACnB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,IAAA;AAAA,EAEb,CAAC;AAED,QAAM,QAAQ,SAA4B,MAAM;AAC9C,WAAO,MAAM,aAAa,UACtB,eAAe,MAAM,MAAA,CAAO,IAC5B;AAAA,EACN,CAAC;AAED,QAAM,QAAQ,SAAS,MAAM;AAC3B,QAAI,OAAA,MAAa,SAAS;AACxB,YAAM,MAAA;AAAA,IACR;AAEA,WAAO,MAAM,KAAA;AAAA,EACf,CAAC;AAED,QAAM,WAAW,SAAmC,MAAM;AACxD,UAAM,gBAAgB,OAAA;AAEtB,QAAI,kBAAkB,SAAS;AAC7B,aAAO,EAAE,QAAQ,SAAS,OAAO,QAAM;AAAA,IACzC;AAEA,WAAO,EAAE,QAAQ,eAAe,OAAO,MAAM,OAAK;AAAA,EACpD,CAAC;AAED,QAAM,YAAY,MAChB,OAAA,MAAa,WACb,MAAM,WAAW;AAEnB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,SAAS,MAAM;AACxB,YAAM,gBAAgB,OAAA;AACtB,aAAO,kBAAkB,aAAa,kBAAkB;AAAA,IAC1D,CAAC;AAAA,IACD;AAAA,IACA,SAAkB;AAChB,YAAM,gBAAgB,UAAU,MAAM;AACtC,UACE,kBAAkB,UAClB,kBAAkB,aAClB,kBAAkB,aAClB;AACA,eAAO;AAAA,MACT;AAEA,UAAI,CAAC,UAAU,MAAM,OAAO,GAAG;AAC7B,eAAO;AAAA,MACT;AAEA,WAAK,MAAM,QAAA;AACX,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;AAEA,SAAS,eAAe,OAAuB;AAC7C,MAAI,YAAY,KAAK,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,SAAO,IAAI,MAAM,OAAO,KAAK,GAAG,EAAE,OAAO,OAAO;AAClD;AAEA,SAAS,YAAY,OAAgC;AACnD,SACE,iBAAiB,SAChB,OAAO,UAAU,YAChB,UAAU,QACV,OAAQ,MAAgB,SAAS,YACjC,OAAQ,MAAgB,YAAY;AAE1C;"}
1
+ {"version":3,"file":"query-resource.mjs","names":[],"sources":["../src/query-resource.ts"],"sourcesContent":["import { computed, untracked } from '@angular/core'\nimport type { QueryObserverResult } from '@tanstack/query-core'\nimport type { ResourceSnapshot } from './utils/resource-types'\nimport type { Resource, ResourceStatus, Signal } from '@angular/core'\n\n/**\n * A query-backed Angular Resource that also exposes an atomic state snapshot.\n */\nexport interface QueryResource<TValue> extends Resource<TValue> {\n /**\n * The current query state as a single snapshot.\n */\n readonly snapshot: Signal<ResourceSnapshot<TValue>>\n\n /**\n * Requests a new query fetch only when the current query data is stale.\n *\n * Used for compatibility with Angular APIs that might want to reload a resource,\n * like Signal Forms' validateAsync resource interface.\n * @returns `true` if a reload was initiated, `false` if a reload was unnecessary or unsupported.\n */\n reload: () => boolean\n}\n\ntype QueryResourceSource<TValue> = {\n readonly data: Signal<TValue>\n readonly status: Signal<QueryObserverResult['status']>\n readonly fetchStatus: Signal<QueryObserverResult['fetchStatus']>\n readonly error: Signal<unknown>\n readonly isStale: Signal<boolean>\n readonly refetch: () => unknown\n}\n\n/**\n * Converts an Angular Query result into Angular's Resource interface.\n *\n * Call this function once and reuse the returned resource.\n * @param query - An Angular Query or infinite-query result.\n * @returns A Resource-compatible view of the query result.\n */\nexport function toResource<TValue>(\n query: QueryResourceSource<TValue>,\n): QueryResource<TValue> {\n // Intentionally does not use resource from snapshot to have\n // support for the reload method for compatible libraries\n const status = computed<ResourceStatus>(() => {\n const fetchStatus = query.fetchStatus()\n const data = query.data()\n\n if (fetchStatus === 'fetching' || fetchStatus === 'paused') {\n return data === undefined ? 'loading' : 'reloading'\n }\n\n switch (query.status()) {\n case 'success':\n return 'resolved'\n case 'error':\n return 'error'\n case 'pending':\n return 'idle'\n }\n })\n\n const error = computed<Error | undefined>(() => {\n return query.status() === 'error'\n ? normalizeError(query.error())\n : undefined\n })\n\n const value = computed(() => {\n if (status() === 'error') {\n throw error()\n }\n\n return query.data()\n })\n\n const snapshot = computed<ResourceSnapshot<TValue>>(() => {\n const currentStatus = status()\n\n if (currentStatus === 'error') {\n return { status: 'error', error: error()! }\n }\n\n return { status: currentStatus, value: query.data() }\n })\n\n const hasValue = (() =>\n status() !== 'error' &&\n query.data() !== undefined) as QueryResource<TValue>['hasValue']\n\n return {\n value,\n status,\n error,\n snapshot,\n isLoading: computed(() => {\n const currentStatus = status()\n return currentStatus === 'loading' || currentStatus === 'reloading'\n }),\n hasValue,\n reload(): boolean {\n const currentStatus = untracked(status)\n if (\n currentStatus === 'idle' ||\n currentStatus === 'loading' ||\n currentStatus === 'reloading'\n ) {\n return false\n }\n\n if (!untracked(query.isStale)) {\n return false\n }\n\n void query.refetch()\n return true\n },\n }\n}\n\n/**\n * Converts an unknown rejection reason to an Error-compatible value.\n * @param error - The rejected value.\n * @returns The existing error-like value, or an Error wrapping the rejection.\n */\nfunction normalizeError(error: unknown): Error {\n if (isErrorLike(error)) {\n return error\n }\n\n return new Error(String(error), { cause: error })\n}\n\n/**\n * Checks whether a value provides the name and message of an Error.\n * @param error - The value to inspect.\n * @returns Whether the value can be used as an Error.\n */\nfunction isErrorLike(error: unknown): error is Error {\n return (\n error instanceof Error ||\n (typeof error === 'object' &&\n error !== null &&\n typeof (error as Error).name === 'string' &&\n typeof (error as Error).message === 'string')\n )\n}\n"],"mappings":";;;;;;;;;AAwCA,SAAgB,WACd,OACuB;CAGvB,MAAM,SAAS,eAA+B;EAC5C,MAAM,cAAc,MAAM,YAAY;EACtC,MAAM,OAAO,MAAM,KAAK;EAExB,IAAI,gBAAgB,cAAc,gBAAgB,UAChD,OAAO,SAAS,KAAA,IAAY,YAAY;EAG1C,QAAQ,MAAM,OAAO,GAArB;GACE,KAAK,WACH,OAAO;GACT,KAAK,SACH,OAAO;GACT,KAAK,WACH,OAAO;EACX;CACF,CAAC;CAED,MAAM,QAAQ,eAAkC;EAC9C,OAAO,MAAM,OAAO,MAAM,UACtB,eAAe,MAAM,MAAM,CAAC,IAC5B,KAAA;CACN,CAAC;CAED,MAAM,QAAQ,eAAe;EAC3B,IAAI,OAAO,MAAM,SACf,MAAM,MAAM;EAGd,OAAO,MAAM,KAAK;CACpB,CAAC;CAED,MAAM,WAAW,eAAyC;EACxD,MAAM,gBAAgB,OAAO;EAE7B,IAAI,kBAAkB,SACpB,OAAO;GAAE,QAAQ;GAAS,OAAO,MAAM;EAAG;EAG5C,OAAO;GAAE,QAAQ;GAAe,OAAO,MAAM,KAAK;EAAE;CACtD,CAAC;CAED,MAAM,kBACJ,OAAO,MAAM,WACb,MAAM,KAAK,MAAM,KAAA;CAEnB,OAAO;EACL;EACA;EACA;EACA;EACA,WAAW,eAAe;GACxB,MAAM,gBAAgB,OAAO;GAC7B,OAAO,kBAAkB,aAAa,kBAAkB;EAC1D,CAAC;EACD;EACA,SAAkB;GAChB,MAAM,gBAAgB,UAAU,MAAM;GACtC,IACE,kBAAkB,UAClB,kBAAkB,aAClB,kBAAkB,aAElB,OAAO;GAGT,IAAI,CAAC,UAAU,MAAM,OAAO,GAC1B,OAAO;GAGT,MAAW,QAAQ;GACnB,OAAO;EACT;CACF;AACF;;;;;;AAOA,SAAS,eAAe,OAAuB;CAC7C,IAAI,YAAY,KAAK,GACnB,OAAO;CAGT,OAAO,IAAI,MAAM,OAAO,KAAK,GAAG,EAAE,OAAO,MAAM,CAAC;AAClD;;;;;;AAOA,SAAS,YAAY,OAAgC;CACnD,OACE,iBAAiB,SAChB,OAAO,UAAU,YAChB,UAAU,QACV,OAAQ,MAAgB,SAAS,YACjC,OAAQ,MAAgB,YAAY;AAE1C"}
@@ -6,9 +6,9 @@ const tasks_1 = require("@angular-devkit/schematics/tasks");
6
6
  const source_1 = require("./source");
7
7
  const workspace_1 = require("./workspace");
8
8
  const PACKAGE_NAME = '@tanstack/angular-query';
9
- const PACKAGE_VERSION = '5.0.0-rc.3';
9
+ const PACKAGE_VERSION = '5.0.0-rc.5';
10
10
  const DEVTOOLS_PACKAGE_NAME = '@tanstack/angular-query-devtools';
11
- const DEVTOOLS_PACKAGE_VERSION = '5.0.0-rc.3';
11
+ const DEVTOOLS_PACKAGE_VERSION = '5.0.0-rc.5';
12
12
  const MIGRATION_GUIDE = 'https://tanstack.com/query/latest/docs/framework/angular/guides/migrating-from-experimental';
13
13
  const dependencyTypes = [
14
14
  dependencies_1.NodeDependencyType.Default,
@@ -78,19 +78,29 @@ function migrateDependencies(tree, manifest, needsDevtools, report, migrateCore,
78
78
  if (!dependencies)
79
79
  continue;
80
80
  const experimental = dependencies[source_1.OLD_PACKAGE];
81
- const core = migrateCore && dependencies[source_1.CORE_PACKAGE];
82
- if (!experimental && !core)
83
- continue;
81
+ const core = migrateCore ? dependencies[source_1.CORE_PACKAGE] : undefined;
82
+ const queryAlias = experimentalAlias(dependencies[PACKAGE_NAME]);
83
+ const devtoolsAlias = experimentalAlias(dependencies[DEVTOOLS_PACKAGE_NAME]);
84
84
  if (experimental)
85
85
  changes++;
86
86
  if (core && !remainingCoreReference)
87
87
  changes++;
88
- if (!dependencies[PACKAGE_NAME]) {
88
+ if (queryAlias !== undefined ||
89
+ ((experimental || core) && !dependencies[PACKAGE_NAME])) {
89
90
  (0, dependencies_1.addPackageJsonDependency)(tree, {
90
91
  type,
91
92
  name: PACKAGE_NAME,
92
- version: `^${PACKAGE_VERSION}`,
93
- overwrite: false,
93
+ version: replacementVersion(queryAlias ?? experimental ?? core, PACKAGE_VERSION),
94
+ overwrite: queryAlias !== undefined,
95
+ }, manifest);
96
+ changes++;
97
+ }
98
+ if (devtoolsAlias !== undefined) {
99
+ (0, dependencies_1.addPackageJsonDependency)(tree, {
100
+ type,
101
+ name: DEVTOOLS_PACKAGE_NAME,
102
+ version: replacementVersion(devtoolsAlias, DEVTOOLS_PACKAGE_VERSION),
103
+ overwrite: true,
94
104
  }, manifest);
95
105
  changes++;
96
106
  }
@@ -113,7 +123,12 @@ function migrateDependencies(tree, manifest, needsDevtools, report, migrateCore,
113
123
  (0, dependencies_1.addPackageJsonDependency)(tree, {
114
124
  type,
115
125
  name: DEVTOOLS_PACKAGE_NAME,
116
- version: `^${DEVTOOLS_PACKAGE_VERSION}`,
126
+ version: replacementVersion(experimentalAlias(pkg[type]?.[PACKAGE_NAME]) ??
127
+ pkg[type]?.[source_1.OLD_PACKAGE] ??
128
+ current[type]?.[PACKAGE_NAME] ??
129
+ dependencyTypes
130
+ .map((group) => current[group]?.[PACKAGE_NAME])
131
+ .find(Boolean), DEVTOOLS_PACKAGE_VERSION),
117
132
  overwrite: false,
118
133
  }, manifest);
119
134
  changes++;
@@ -127,3 +142,17 @@ function migrateDependencies(tree, manifest, needsDevtools, report, migrateCore,
127
142
  report(`${manifest}: Rename peerDependenciesMeta["${name}"] to "${PACKAGE_NAME}" and review the optional peer configuration.`);
128
143
  return changes;
129
144
  }
145
+ function experimentalAlias(version) {
146
+ if (version === `npm:${source_1.OLD_PACKAGE}`)
147
+ return '*';
148
+ const prefix = `npm:${source_1.OLD_PACKAGE}@`;
149
+ return version?.startsWith(prefix) ? version.slice(prefix.length) : undefined;
150
+ }
151
+ /** Preserve exact pins; retain the existing caret policy for other specifiers. */
152
+ function replacementVersion(previous, version) {
153
+ const normalized = previous?.trim().replace(/^(?:=\s*)?v?/, '');
154
+ return normalized &&
155
+ /^\d+\.\d+\.\d+(?:-[\dA-Za-z.-]+)?(?:\+[\dA-Za-z.-]+)?$/.test(normalized)
156
+ ? version
157
+ : `^${version}`;
158
+ }
@@ -88,7 +88,10 @@ function configPattern(root, pattern) {
88
88
  .join('');
89
89
  return new RegExp(`^${expression}$`);
90
90
  }
91
- function configuredSources(tree, configPath) {
91
+ function configuredSources(tree, configPath, visited = new Set()) {
92
+ if (visited.has(configPath))
93
+ return [];
94
+ visited.add(configPath);
92
95
  const readFile = (path) => tree.exists(path) ? tree.readText(path) : undefined;
93
96
  const config = typescript_1.default.getParsedCommandLineOfConfigFile(configPath, { noLib: true }, {
94
97
  useCaseSensitiveFileNames: true,
@@ -119,6 +122,9 @@ function configuredSources(tree, configPath) {
119
122
  host.readFile = readFile;
120
123
  host.realpath = (path) => path;
121
124
  host.directoryExists = (path) => {
125
+ // TypeScript also probes file paths here; `getDir` throws on those.
126
+ if (tree.exists(path))
127
+ return false;
122
128
  const directory = tree.getDir(path);
123
129
  return directory.subfiles.length > 0 || directory.subdirs.length > 0;
124
130
  };
@@ -130,11 +136,15 @@ function configuredSources(tree, configPath) {
130
136
  ? undefined
131
137
  : typescript_1.default.createSourceFile(path, text, typescript_1.default.ScriptTarget.Latest, true);
132
138
  };
133
- return typescript_1.default
139
+ const sources = typescript_1.default
134
140
  .createProgram(config.fileNames, config.options, host)
135
141
  .getSourceFiles()
136
142
  .map((source) => source.fileName)
137
143
  .filter(isSource);
144
+ return [
145
+ ...sources,
146
+ ...(config.projectReferences ?? []).flatMap((reference) => configuredSources(tree, typescript_1.default.resolveProjectReferencePath(reference), visited)),
147
+ ];
138
148
  }
139
149
  /** Use Angular/Nx projects and their declared configs, including inherited configs and local imports. */
140
150
  async function migrationWorkspace(tree) {
@@ -147,49 +157,75 @@ async function migrationWorkspace(tree) {
147
157
  const project = projects.get(root) ?? {
148
158
  sourceRoot,
149
159
  configs: new Set(),
160
+ hasExplicitTestConfig: false,
150
161
  };
151
162
  project.sourceRoot ??= sourceRoot;
152
163
  projects.set(root, project);
153
164
  const manifest = node_path_1.posix.join(root, 'package.json');
154
165
  if (tree.exists(manifest))
155
166
  manifests.add(manifest);
156
- for (const target of targets) {
167
+ for (const [name, target] of targets) {
157
168
  for (const options of [
158
169
  target.options,
159
170
  ...Object.values(target.configurations ?? {}),
160
171
  ]) {
161
- if (typeof options?.tsConfig === 'string' &&
162
- tree.exists(options.tsConfig))
163
- project.configs.add(node_path_1.posix.resolve('/', options.tsConfig));
172
+ const tsConfig = options?.tsConfig;
173
+ if (typeof tsConfig !== 'string')
174
+ continue;
175
+ if (name === 'test' || name.startsWith('test:'))
176
+ project.hasExplicitTestConfig = true;
177
+ const config = node_path_1.posix.resolve('/', tsConfig);
178
+ if (tree.exists(config))
179
+ project.configs.add(config);
164
180
  }
165
181
  }
166
182
  };
167
183
  if (tree.exists('/angular.json') || tree.exists('/.angular.json')) {
168
184
  const workspace = await (0, workspace_1.getWorkspace)(tree, tree.exists('/angular.json') ? '/angular.json' : '/.angular.json');
169
185
  for (const project of workspace.projects.values())
170
- addProject(project.root, project.sourceRoot, project.targets.values());
186
+ addProject(project.root, project.sourceRoot, project.targets.entries());
171
187
  }
172
188
  if (tree.exists('/nx.json')) {
173
189
  for (const path of filesUnder(tree, '/')) {
174
190
  if (node_path_1.posix.basename(path) === 'project.json') {
175
191
  const project = tree.readJson(path);
176
- addProject(project.root ?? node_path_1.posix.dirname(path), project.sourceRoot, Object.values(project.targets ?? {}));
192
+ addProject(project.root ?? node_path_1.posix.dirname(path), project.sourceRoot, Object.entries(project.targets ?? {}));
177
193
  }
178
194
  else if (node_path_1.posix.basename(path) === 'package.json') {
179
195
  const pkg = tree.readJson(path);
180
196
  if (pkg.nx)
181
- addProject(node_path_1.posix.dirname(path), pkg.nx.sourceRoot, Object.values(pkg.nx.targets ?? {}));
197
+ addProject(node_path_1.posix.dirname(path), pkg.nx.sourceRoot, Object.entries(pkg.nx.targets ?? {}));
182
198
  }
183
199
  }
184
200
  }
185
201
  if (!projects.size)
186
- return { files: sourcesUnder(tree, '/'), manifests: [...manifests] };
202
+ addProject('/', undefined, []);
187
203
  const files = new Set();
188
204
  for (const [root, project] of projects) {
205
+ // Infer defaults only after Angular and Nx declarations have been merged.
206
+ if (!project.configs.size) {
207
+ for (const name of [
208
+ 'tsconfig.json',
209
+ 'tsconfig.app.json',
210
+ 'tsconfig.lib.json',
211
+ ]) {
212
+ const config = node_path_1.posix.join(root, name);
213
+ if (tree.exists(config))
214
+ project.configs.add(config);
215
+ }
216
+ }
217
+ const testConfigs = project.hasExplicitTestConfig
218
+ ? []
219
+ : ['tsconfig.spec.json', 'tsconfig.test.json']
220
+ .map((name) => node_path_1.posix.join(root, name))
221
+ .filter((path) => tree.exists(path));
189
222
  const sources = project.configs.size
190
223
  ? [...project.configs].flatMap((path) => configuredSources(tree, path))
191
- : sourcesUnder(tree, node_path_1.posix.resolve('/', project.sourceRoot ?? root));
192
- for (const path of sources)
224
+ : sourcesUnder(tree, node_path_1.posix.resolve('/', project.sourceRoot ?? root)).filter((path) => !testConfigs.length || !/\.(spec|test)\.[cm]?tsx?$/.test(path));
225
+ for (const path of [
226
+ ...sources,
227
+ ...testConfigs.flatMap((configPath) => configuredSources(tree, configPath)),
228
+ ])
193
229
  files.add(path);
194
230
  }
195
231
  return { files: [...files], manifests: [...manifests] };
@@ -16,7 +16,7 @@ const typescript_1 = __importDefault(require("typescript"));
16
16
  // The published schematic contains literal values and does not read package.json.
17
17
  const PACKAGE_NAME = '@tanstack/angular-query';
18
18
  const DEVTOOLS_PACKAGE_NAME = '@tanstack/angular-query-devtools';
19
- const DEVTOOLS_PACKAGE_VERSION = '5.0.0-rc.3';
19
+ const DEVTOOLS_PACKAGE_VERSION = '5.0.0-rc.5';
20
20
  function hasPackageDependency(tree, name) {
21
21
  const packageJsonPath = tree.exists('/package.json')
22
22
  ? '/package.json'
package/types.d.ts CHANGED
@@ -3,6 +3,10 @@ import { Signal } from '@angular/core';
3
3
  import { MapToSignals } from './utils/signal-proxy.js';
4
4
  import { InfiniteQueryResultFields, MutationResultFields, QueryResultFields } from './utils/result-fields.js';
5
5
  type SignalFunction<T extends () => any> = T & Signal<ReturnType<T>>;
6
+ /**
7
+ * Options accepted by `injectQuery`, with cache data projected through an optional `select`.
8
+ * Angular owns result notifications and exposes errors through signals rather than error boundaries.
9
+ */
6
10
  export type CreateQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = OmitKeyof<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, 'notifyOnChangeProps' | 'suspense' | 'throwOnError'>;
7
11
  type CreateStatusBasedQueryResult<TStatus extends QueryObserverResult['status'], TData = unknown, TError = DefaultError> = Extract<QueryObserverResult<TData, TError>, {
8
12
  status: TStatus;
@@ -16,26 +20,77 @@ type CreateStatusBasedInfiniteQueryResult<TStatus extends InfiniteQueryObserverR
16
20
  type CreateStatusBasedDefinedInfiniteQueryResult<TStatus extends DefinedInfiniteQueryObserverResult['status'], TData = unknown, TError = DefaultError> = Extract<DefinedInfiniteQueryObserverResult<TData, TError>, {
17
21
  status: TStatus;
18
22
  }>;
23
+ /**
24
+ * Signal-backed guards that narrow a query result and its data and error fields by status.
25
+ */
19
26
  export interface BaseQueryNarrowing<TData = unknown, TError = DefaultError> {
20
- isSuccess: SignalFunction<(this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'success', TData, TError>>>;
21
- isError: SignalFunction<(this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'error', TData, TError>>>;
22
- isPending: SignalFunction<(this: CreateBaseQueryResult<TData, TError>) => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'pending', TData, TError>>>;
27
+ /**
28
+ * Returns whether the result is successful and narrows its data and error signals.
29
+ */
30
+ isSuccess: SignalFunction<() => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'success', TData, TError>>>;
31
+ /**
32
+ * Returns whether the result failed and narrows its data and error signals.
33
+ */
34
+ isError: SignalFunction<() => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'error', TData, TError>>>;
35
+ /**
36
+ * Narrows the result to the pending state when that state is possible.
37
+ */
38
+ isPending: SignalFunction<() => this is CreateBaseQueryResult<TData, TError, CreateStatusBasedQueryResult<'pending', TData, TError>>>;
23
39
  }
40
+ /**
41
+ * Signal-backed guards for a query whose initial data excludes the pending state.
42
+ */
24
43
  export interface DefinedQueryNarrowing<TData = unknown, TError = DefaultError> {
25
- isSuccess: SignalFunction<(this: DefinedCreateQueryResult<TData, TError>) => this is DefinedCreateQueryResult<TData, TError, CreateStatusBasedDefinedQueryResult<'success', TData, TError>>>;
26
- isError: SignalFunction<(this: DefinedCreateQueryResult<TData, TError>) => this is DefinedCreateQueryResult<TData, TError, CreateStatusBasedDefinedQueryResult<'error', TData, TError>>>;
27
- isPending: SignalFunction<(this: DefinedCreateQueryResult<TData, TError>) => this is never>;
44
+ /**
45
+ * Returns whether the result is successful and narrows its data and error signals.
46
+ */
47
+ isSuccess: SignalFunction<() => this is DefinedCreateQueryResult<TData, TError, CreateStatusBasedDefinedQueryResult<'success', TData, TError>>>;
48
+ /**
49
+ * Returns whether the result failed and narrows its data and error signals.
50
+ */
51
+ isError: SignalFunction<() => this is DefinedCreateQueryResult<TData, TError, CreateStatusBasedDefinedQueryResult<'error', TData, TError>>>;
52
+ /**
53
+ * Narrows the result to the pending state when that state is possible.
54
+ */
55
+ isPending: SignalFunction<() => this is never>;
28
56
  }
57
+ /**
58
+ * Signal-backed guards that narrow a paginated query result by its current status.
59
+ */
29
60
  export interface BaseInfiniteQueryNarrowing<TData = unknown, TError = DefaultError> {
61
+ /**
62
+ * Returns whether the result is successful and narrows its data and error signals.
63
+ */
30
64
  isSuccess: SignalFunction<(this: CreateInfiniteQueryResult<TData, TError>) => this is CreateInfiniteQueryResult<TData, TError, CreateStatusBasedInfiniteQueryResult<'success', TData, TError>>>;
65
+ /**
66
+ * Returns whether the result failed and narrows its data and error signals.
67
+ */
31
68
  isError: SignalFunction<(this: CreateInfiniteQueryResult<TData, TError>) => this is CreateInfiniteQueryResult<TData, TError, CreateStatusBasedInfiniteQueryResult<'error', TData, TError>>>;
69
+ /**
70
+ * Narrows the result to the pending state when that state is possible.
71
+ */
32
72
  isPending: SignalFunction<(this: CreateInfiniteQueryResult<TData, TError>) => this is CreateInfiniteQueryResult<TData, TError, CreateStatusBasedInfiniteQueryResult<'pending', TData, TError>>>;
33
73
  }
74
+ /**
75
+ * Signal-backed guards for a paginated query whose initial data excludes the pending state.
76
+ */
34
77
  export interface DefinedInfiniteQueryNarrowing<TData = unknown, TError = DefaultError> {
78
+ /**
79
+ * Returns whether the result is successful and narrows its data and error signals.
80
+ */
35
81
  isSuccess: SignalFunction<(this: DefinedCreateInfiniteQueryResult<TData, TError>) => this is DefinedCreateInfiniteQueryResult<TData, TError, CreateStatusBasedDefinedInfiniteQueryResult<'success', TData, TError>>>;
82
+ /**
83
+ * Returns whether the result failed and narrows its data and error signals.
84
+ */
36
85
  isError: SignalFunction<(this: DefinedCreateInfiniteQueryResult<TData, TError>) => this is DefinedCreateInfiniteQueryResult<TData, TError, CreateStatusBasedDefinedInfiniteQueryResult<'error', TData, TError>>>;
86
+ /**
87
+ * Narrows the result to the pending state when that state is possible.
88
+ */
37
89
  isPending: SignalFunction<(this: DefinedCreateInfiniteQueryResult<TData, TError>) => this is never>;
38
90
  }
91
+ /**
92
+ * Options accepted by `injectInfiniteQuery`, including page parameters and pagination callbacks.
93
+ */
39
94
  export interface CreateInfiniteQueryOptions<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown> extends OmitKeyof<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, 'notifyOnChangeProps' | 'suspense' | 'throwOnError'> {
40
95
  }
41
96
  /**
@@ -45,14 +100,12 @@ export interface CreateInfiniteQueryOptions<TQueryFnData = unknown, TError = Def
45
100
  * while function fields (like `refetch`) are called directly, unchanged. `isSuccess`/`isError`/`isPending`
46
101
  * are {@link BaseQueryNarrowing} type-guard methods rather than plain booleans.
47
102
  * `injectInfiniteQuery` returns {@link CreateInfiniteQueryResult} instead.
48
- *
49
103
  * @template TData - The type `data` ends up as after `select` runs.
50
104
  * @template TError - The type of errors your `queryFn` may throw.
51
105
  */
52
106
  export type CreateBaseQueryResult<TData = unknown, TError = DefaultError, TState extends QueryObserverResult<TData, TError> = QueryObserverResult<TData, TError>> = BaseQueryNarrowing<TData, TError> & MapToSignals<OmitKeyof<TState, keyof BaseQueryNarrowing, 'safely'>, QueryResultFields>;
53
107
  /**
54
108
  * The result of `injectQuery`. Same as {@link CreateBaseQueryResult}.
55
- *
56
109
  * @template TData - The type `data` ends up as after `select` runs.
57
110
  * @template TError - The type of errors your `queryFn` may throw.
58
111
  */
@@ -61,7 +114,6 @@ export type CreateQueryResult<TData = unknown, TError = DefaultError> = CreateBa
61
114
  * The result of `injectQuery` when `initialData` is set — `data` is never `undefined`. Same shape as
62
115
  * {@link DefinedQueryObserverResult} from `@tanstack/query-core`, but value fields are exposed as a
63
116
  * `Signal` while function fields are called directly, unchanged.
64
- *
65
117
  * @template TData - The type `data` ends up as after `select` runs.
66
118
  * @template TError - The type of errors your `queryFn` may throw.
67
119
  */
@@ -71,7 +123,6 @@ export type DefinedCreateQueryResult<TData = unknown, TError = DefaultError, TSt
71
123
  * query is `pending`. Same shape as {@link InfiniteQueryObserverResult} from `@tanstack/query-core`, but
72
124
  * value fields are exposed as a `Signal` while function fields (like `fetchNextPage`) are called directly,
73
125
  * unchanged.
74
- *
75
126
  * @template TData - The type `data` ends up as after `select` runs.
76
127
  * @template TError - The type of errors your `queryFn` may throw.
77
128
  */
@@ -80,7 +131,6 @@ export type CreateInfiniteQueryResult<TData = unknown, TError = DefaultError, TS
80
131
  * The result of `injectInfiniteQuery` when `initialData` is set — `data` is never `undefined`. Same shape as
81
132
  * {@link DefinedInfiniteQueryObserverResult} from `@tanstack/query-core`, but value fields are exposed as a
82
133
  * `Signal` while function fields are called directly, unchanged.
83
- *
84
134
  * @template TData - The type `data` ends up as after `select` runs.
85
135
  * @template TError - The type of errors your `queryFn` may throw.
86
136
  */
@@ -88,7 +138,6 @@ export type DefinedCreateInfiniteQueryResult<TData = unknown, TError = DefaultEr
88
138
  /**
89
139
  * The options accepted by `injectMutation`. Same as {@link MutationObserverOptions} from
90
140
  * `@tanstack/query-core`, minus the internal `_defaulted` flag.
91
- *
92
141
  * @template TData - The type your mutation function resolves to.
93
142
  * @template TError - The type of errors your mutation function may throw.
94
143
  * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.
@@ -101,7 +150,6 @@ export interface CreateMutationOptions<TData = unknown, TError = DefaultError, T
101
150
  * The type of `mutate`, as returned by `injectMutation`. Forwards the variables (and an optional per-call
102
151
  * `onSuccess`/`onError`/`onSettled`) to the underlying `mutate` call. Fire-and-forget — errors are surfaced
103
152
  * through the mutation result, not thrown.
104
- *
105
153
  * @template TData - The type your mutation function resolves to.
106
154
  * @template TError - The type of errors your mutation function may throw.
107
155
  * @template TVariables - The type of the variable passed to `mutate`.
@@ -112,7 +160,6 @@ export type CreateMutateFunction<TData = unknown, TError = DefaultError, TVariab
112
160
  /**
113
161
  * The type of `mutateAsync`, as returned by `injectMutation`. Similar to {@link CreateMutateFunction}, but
114
162
  * returns a promise which can be awaited.
115
- *
116
163
  * @template TData - The type your mutation function resolves to.
117
164
  * @template TError - The type of errors your mutation function may throw.
118
165
  * @template TVariables - The type of the variable passed to `mutateAsync`.
@@ -124,7 +171,6 @@ export type CreateMutateAsyncFunction<TData = unknown, TError = DefaultError, TV
124
171
  * The pre-`Signal` shape {@link CreateMutationResult} is built from — not what `injectMutation` actually
125
172
  * returns. Same as {@link MutationObserverResult} from `@tanstack/query-core`, with `mutate` narrowed to the
126
173
  * fire-and-forget {@link CreateMutateFunction} signature, plus the added `mutateAsync`.
127
- *
128
174
  * @template TData - The type your mutation function resolves to.
129
175
  * @template TError - The type of errors your mutation function may throw.
130
176
  * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.
@@ -142,10 +188,25 @@ export type CreateBaseMutationResult<TData = unknown, TError = DefaultError, TVa
142
188
  type CreateStatusBasedMutationResult<TStatus extends CreateBaseMutationResult['status'], TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = Extract<CreateBaseMutationResult<TData, TError, TVariables, TOnMutateResult>, {
143
189
  status: TStatus;
144
190
  }>;
191
+ /**
192
+ * Signal-backed guards that narrow mutation data, errors, and variables by the current status.
193
+ */
145
194
  export interface BaseMutationNarrowing<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> {
195
+ /**
196
+ * Whether the mutation is in the `success` state. Calling it narrows the result to that state.
197
+ */
146
198
  isSuccess: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TOnMutateResult>) => this is CreateMutationResult<TData, TError, TVariables, TOnMutateResult, CreateStatusBasedMutationResult<'success', TData, TError, TVariables, TOnMutateResult>>>;
199
+ /**
200
+ * Whether the mutation is in the `error` state. Calling it narrows the result to that state.
201
+ */
147
202
  isError: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TOnMutateResult>) => this is CreateMutationResult<TData, TError, TVariables, TOnMutateResult, CreateStatusBasedMutationResult<'error', TData, TError, TVariables, TOnMutateResult>>>;
203
+ /**
204
+ * Whether the mutation is in the `pending` state. Calling it narrows the result to that state.
205
+ */
148
206
  isPending: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TOnMutateResult>) => this is CreateMutationResult<TData, TError, TVariables, TOnMutateResult, CreateStatusBasedMutationResult<'pending', TData, TError, TVariables, TOnMutateResult>>>;
207
+ /**
208
+ * Whether the mutation is in the `idle` state. Calling it narrows the result to that state.
209
+ */
149
210
  isIdle: SignalFunction<(this: CreateMutationResult<TData, TError, TVariables, TOnMutateResult>) => this is CreateMutationResult<TData, TError, TVariables, TOnMutateResult, CreateStatusBasedMutationResult<'idle', TData, TError, TVariables, TOnMutateResult>>>;
150
211
  }
151
212
  /**
@@ -153,7 +214,6 @@ export interface BaseMutationNarrowing<TData = unknown, TError = DefaultError, T
153
214
  * a `Signal` — read them with `mutation.data()`, not `mutation.data` — while function fields (`mutate`,
154
215
  * `mutateAsync`, `reset`) are called directly, unchanged. `isSuccess`/`isError`/`isPending`/`isIdle` are
155
216
  * {@link BaseMutationNarrowing} type-guard methods rather than plain booleans.
156
- *
157
217
  * @template TData - The type your mutation function resolves to.
158
218
  * @template TError - The type of errors your mutation function may throw.
159
219
  * @template TVariables - The type of the variable passed to `mutate`/`mutateAsync`.
@@ -28,6 +28,9 @@ interface ExternalStoreOptions<T> {
28
28
  * errors follow Angular's normal effect error handling; the helper does not store
29
29
  * them or implement retries. Destruction stops observation without changing the
30
30
  * cached snapshot.
31
+ * @param binding - Produces the current snapshot reader and optional subscription.
32
+ * @param options - Optional equality comparison for snapshots.
33
+ * @returns A readonly signal containing the latest external snapshot.
31
34
  */
32
35
  export declare function injectExternalStore<T>(binding: () => ExternalBinding<T>, options?: ExternalStoreOptions<T>): Signal<T>;
33
36
  export {};