@shopify/shop-minis-react 0.3.4 → 0.4.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 (167) hide show
  1. package/dist/components/MinisContainer.js +11 -10
  2. package/dist/components/MinisContainer.js.map +1 -1
  3. package/dist/hooks/content/useContent.js +12 -18
  4. package/dist/hooks/content/useContent.js.map +1 -1
  5. package/dist/hooks/product/useCuratedProducts.js +9 -11
  6. package/dist/hooks/product/useCuratedProducts.js.map +1 -1
  7. package/dist/hooks/product/usePopularProducts.js +9 -11
  8. package/dist/hooks/product/usePopularProducts.js.map +1 -1
  9. package/dist/hooks/product/useProduct.js +11 -17
  10. package/dist/hooks/product/useProduct.js.map +1 -1
  11. package/dist/hooks/product/useProductList.js +10 -21
  12. package/dist/hooks/product/useProductList.js.map +1 -1
  13. package/dist/hooks/product/useProductLists.js +11 -13
  14. package/dist/hooks/product/useProductLists.js.map +1 -1
  15. package/dist/hooks/product/useProductMedia.js +12 -18
  16. package/dist/hooks/product/useProductMedia.js.map +1 -1
  17. package/dist/hooks/product/useProductSearch.js +34 -27
  18. package/dist/hooks/product/useProductSearch.js.map +1 -1
  19. package/dist/hooks/product/useProductVariants.js +11 -14
  20. package/dist/hooks/product/useProductVariants.js.map +1 -1
  21. package/dist/hooks/product/useProducts.js +12 -11
  22. package/dist/hooks/product/useProducts.js.map +1 -1
  23. package/dist/hooks/product/useRecommendedProducts.js +11 -13
  24. package/dist/hooks/product/useRecommendedProducts.js.map +1 -1
  25. package/dist/hooks/shop/useRecommendedShops.js +11 -13
  26. package/dist/hooks/shop/useRecommendedShops.js.map +1 -1
  27. package/dist/hooks/shop/useShop.js +12 -11
  28. package/dist/hooks/shop/useShop.js.map +1 -1
  29. package/dist/hooks/user/useBuyerAttributes.js +8 -10
  30. package/dist/hooks/user/useBuyerAttributes.js.map +1 -1
  31. package/dist/hooks/user/useCurrentUser.js +7 -9
  32. package/dist/hooks/user/useCurrentUser.js.map +1 -1
  33. package/dist/hooks/user/useFollowedShops.js +11 -14
  34. package/dist/hooks/user/useFollowedShops.js.map +1 -1
  35. package/dist/hooks/user/useOrders.js +7 -9
  36. package/dist/hooks/user/useOrders.js.map +1 -1
  37. package/dist/hooks/user/useRecentProducts.js +11 -13
  38. package/dist/hooks/user/useRecentProducts.js.map +1 -1
  39. package/dist/hooks/user/useRecentShops.js +10 -13
  40. package/dist/hooks/user/useRecentShops.js.map +1 -1
  41. package/dist/hooks/user/useSavedProducts.js +10 -13
  42. package/dist/hooks/user/useSavedProducts.js.map +1 -1
  43. package/dist/internal/reactQuery/MinisQueryProvider.js +11 -0
  44. package/dist/internal/reactQuery/MinisQueryProvider.js.map +1 -0
  45. package/dist/internal/reactQuery/queryClient.js +33 -0
  46. package/dist/internal/reactQuery/queryClient.js.map +1 -0
  47. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js +52 -0
  48. package/dist/internal/reactQuery/useShopActionInfiniteQuery.js.map +1 -0
  49. package/dist/internal/reactQuery/useShopActionQuery.js +37 -0
  50. package/dist/internal/reactQuery/useShopActionQuery.js.map +1 -0
  51. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js +45 -0
  52. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js.map +1 -0
  53. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js +89 -0
  54. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js.map +1 -0
  55. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js +55 -0
  56. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js.map +1 -0
  57. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js +198 -0
  58. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js.map +1 -0
  59. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js +99 -0
  60. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js.map +1 -0
  61. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js +67 -0
  62. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js.map +1 -0
  63. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js +39 -0
  64. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/onlineManager.js.map +1 -0
  65. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/query.js +299 -0
  66. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -0
  67. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryCache.js +80 -0
  68. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryCache.js.map +1 -0
  69. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js +215 -0
  70. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryClient.js.map +1 -0
  71. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js +300 -0
  72. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/queryObserver.js.map +1 -0
  73. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js +25 -0
  74. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/removable.js.map +1 -0
  75. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js +76 -0
  76. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/retryer.js.map +1 -0
  77. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js +21 -0
  78. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/subscribable.js.map +1 -0
  79. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js +26 -0
  80. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/thenable.js.map +1 -0
  81. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/utils.js +176 -0
  82. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/utils.js.map +1 -0
  83. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js +7 -0
  84. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js.map +1 -0
  85. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js +17 -0
  86. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js.map +1 -0
  87. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js +19 -0
  88. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/QueryErrorResetBoundary.js.map +1 -0
  89. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js +21 -0
  90. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js.map +1 -0
  91. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/suspense.js +18 -0
  92. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/suspense.js.map +1 -0
  93. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js +64 -0
  94. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js.map +1 -0
  95. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js +13 -0
  96. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useInfiniteQuery.js.map +1 -0
  97. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js +9 -0
  98. package/dist/shop-minis-react/node_modules/.pnpm/@tanstack_react-query@5.86.0_react@19.1.0/node_modules/@tanstack/react-query/build/modern/useQuery.js.map +1 -0
  99. package/package.json +2 -7
  100. package/src/components/MinisContainer.tsx +6 -3
  101. package/src/hooks/content/useContent.ts +6 -17
  102. package/src/hooks/product/useCuratedProducts.ts +4 -6
  103. package/src/hooks/product/usePopularProducts.ts +4 -6
  104. package/src/hooks/product/useProduct.ts +6 -17
  105. package/src/hooks/product/useProductList.ts +4 -19
  106. package/src/hooks/product/useProductLists.ts +4 -6
  107. package/src/hooks/product/useProductMedia.ts +6 -17
  108. package/src/hooks/product/useProductSearch.ts +19 -15
  109. package/src/hooks/product/useProductVariants.ts +5 -13
  110. package/src/hooks/product/useProducts.ts +8 -12
  111. package/src/hooks/product/useRecommendedProducts.ts +4 -6
  112. package/src/hooks/shop/useRecommendedShops.ts +4 -6
  113. package/src/hooks/shop/useShop.ts +8 -12
  114. package/src/hooks/user/useBuyerAttributes.ts +4 -6
  115. package/src/hooks/user/useCurrentUser.ts +4 -6
  116. package/src/hooks/user/useFollowedShops.ts +5 -13
  117. package/src/hooks/user/useOrders.ts +4 -6
  118. package/src/hooks/user/useRecentProducts.ts +4 -6
  119. package/src/hooks/user/useRecentShops.ts +5 -13
  120. package/src/hooks/user/useSavedProducts.ts +5 -13
  121. package/src/internal/reactQuery/MinisQueryProvider.test.tsx +38 -0
  122. package/src/internal/reactQuery/MinisQueryProvider.tsx +16 -0
  123. package/src/internal/reactQuery/index.ts +8 -0
  124. package/src/internal/reactQuery/queryClient.test.tsx +91 -0
  125. package/src/internal/reactQuery/queryClient.ts +43 -0
  126. package/src/internal/reactQuery/useShopActionInfiniteQuery.test.tsx +357 -0
  127. package/src/internal/reactQuery/useShopActionInfiniteQuery.ts +129 -0
  128. package/src/internal/reactQuery/useShopActionQuery.test.tsx +184 -0
  129. package/src/internal/reactQuery/useShopActionQuery.ts +74 -0
  130. package/dist/internal/useShopActionsDataFetching.js +0 -79
  131. package/dist/internal/useShopActionsDataFetching.js.map +0 -1
  132. package/dist/internal/useShopActionsPaginatedDataFetching.js +0 -96
  133. package/dist/internal/useShopActionsPaginatedDataFetching.js.map +0 -1
  134. package/src/hooks/product/useProductSearch.test.ts +0 -470
  135. package/src/internal/useShopActionsDataFetching.test.ts +0 -465
  136. package/src/internal/useShopActionsDataFetching.ts +0 -150
  137. package/src/internal/useShopActionsPaginatedDataFetching.ts +0 -188
  138. package/src/stories/Accordion.stories.tsx +0 -124
  139. package/src/stories/AddToCart.stories.tsx +0 -251
  140. package/src/stories/Alert.stories.tsx +0 -38
  141. package/src/stories/AlertDialog.stories.tsx +0 -48
  142. package/src/stories/Avatar.stories.tsx +0 -29
  143. package/src/stories/Badge.stories.tsx +0 -46
  144. package/src/stories/Button.stories.tsx +0 -81
  145. package/src/stories/Card.stories.tsx +0 -40
  146. package/src/stories/Checkbox.stories.tsx +0 -44
  147. package/src/stories/FavoriteButton.stories.tsx +0 -58
  148. package/src/stories/IconButton.stories.tsx +0 -68
  149. package/src/stories/ImageContentWrapper.stories.tsx +0 -65
  150. package/src/stories/Input.stories.tsx +0 -44
  151. package/src/stories/Label.stories.tsx +0 -19
  152. package/src/stories/List.stories.tsx +0 -64
  153. package/src/stories/MerchantCard.stories.tsx +0 -127
  154. package/src/stories/ProductCard.stories.tsx +0 -92
  155. package/src/stories/ProductLink.stories.tsx +0 -46
  156. package/src/stories/ProductVariantPrice.stories.tsx +0 -70
  157. package/src/stories/Progress.stories.tsx +0 -30
  158. package/src/stories/PullToRefreshList.stories.tsx +0 -122
  159. package/src/stories/QuantitySelector.stories.tsx +0 -78
  160. package/src/stories/RadioGroup.stories.tsx +0 -51
  161. package/src/stories/Search.stories.tsx +0 -37
  162. package/src/stories/Select.stories.tsx +0 -85
  163. package/src/stories/Skeleton.stories.tsx +0 -19
  164. package/src/stories/TextInput.stories.tsx +0 -26
  165. package/src/stories/Toaster.stories.tsx +0 -46
  166. package/src/stories/Touchable.stories.tsx +0 -40
  167. package/src/stories/VideoPlayer.stories.tsx +0 -129
@@ -0,0 +1,45 @@
1
+ import { Subscribable as i } from "./subscribable.js";
2
+ import { isServer as t } from "./utils.js";
3
+ var n = class extends i {
4
+ #e;
5
+ #s;
6
+ #i;
7
+ constructor() {
8
+ super(), this.#i = (s) => {
9
+ if (!t && window.addEventListener) {
10
+ const e = () => s();
11
+ return window.addEventListener("visibilitychange", e, !1), () => {
12
+ window.removeEventListener("visibilitychange", e);
13
+ };
14
+ }
15
+ };
16
+ }
17
+ onSubscribe() {
18
+ this.#s || this.setEventListener(this.#i);
19
+ }
20
+ onUnsubscribe() {
21
+ this.hasListeners() || (this.#s?.(), this.#s = void 0);
22
+ }
23
+ setEventListener(s) {
24
+ this.#i = s, this.#s?.(), this.#s = s((e) => {
25
+ typeof e == "boolean" ? this.setFocused(e) : this.onFocus();
26
+ });
27
+ }
28
+ setFocused(s) {
29
+ this.#e !== s && (this.#e = s, this.onFocus());
30
+ }
31
+ onFocus() {
32
+ const s = this.isFocused();
33
+ this.listeners.forEach((e) => {
34
+ e(s);
35
+ });
36
+ }
37
+ isFocused() {
38
+ return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
39
+ }
40
+ }, h = new n();
41
+ export {
42
+ n as FocusManager,
43
+ h as focusManager
44
+ };
45
+ //# sourceMappingURL=focusManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"focusManager.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/focusManager.js"],"sourcesContent":["// src/focusManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nimport { isServer } from \"./utils.js\";\nvar FocusManager = class extends Subscribable {\n #focused;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onFocus) => {\n if (!isServer && window.addEventListener) {\n const listener = () => onFocus();\n window.addEventListener(\"visibilitychange\", listener, false);\n return () => {\n window.removeEventListener(\"visibilitychange\", listener);\n };\n }\n return;\n };\n }\n onSubscribe() {\n if (!this.#cleanup) {\n this.setEventListener(this.#setup);\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.#cleanup?.();\n this.#cleanup = void 0;\n }\n }\n setEventListener(setup) {\n this.#setup = setup;\n this.#cleanup?.();\n this.#cleanup = setup((focused) => {\n if (typeof focused === \"boolean\") {\n this.setFocused(focused);\n } else {\n this.onFocus();\n }\n });\n }\n setFocused(focused) {\n const changed = this.#focused !== focused;\n if (changed) {\n this.#focused = focused;\n this.onFocus();\n }\n }\n onFocus() {\n const isFocused = this.isFocused();\n this.listeners.forEach((listener) => {\n listener(isFocused);\n });\n }\n isFocused() {\n if (typeof this.#focused === \"boolean\") {\n return this.#focused;\n }\n return globalThis.document?.visibilityState !== \"hidden\";\n }\n};\nvar focusManager = new FocusManager();\nexport {\n FocusManager,\n focusManager\n};\n//# sourceMappingURL=focusManager.js.map"],"names":["FocusManager","Subscribable","#focused","#cleanup","#setup","onFocus","isServer","listener","setup","focused","isFocused","focusManager"],"mappings":";;AAGG,IAACA,IAAe,cAAcC,EAAa;AAAA,EAC5CC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA,cAAc;AACZ,UAAO,GACP,KAAKA,KAAS,CAACC,MAAY;AACzB,UAAI,CAACC,KAAY,OAAO,kBAAkB;AACxC,cAAMC,IAAW,MAAMF,EAAS;AAChC,sBAAO,iBAAiB,oBAAoBE,GAAU,EAAK,GACpD,MAAM;AACX,iBAAO,oBAAoB,oBAAoBA,CAAQ;AAAA,QACxD;AAAA,MACT;AAAA,IAEK;AAAA,EACL;AAAA,EACE,cAAc;AACZ,IAAK,KAAKJ,MACR,KAAK,iBAAiB,KAAKC,EAAM;AAAA,EAEvC;AAAA,EACE,gBAAgB;AACd,IAAK,KAAK,mBACR,KAAKD,KAAY,GACjB,KAAKA,KAAW;AAAA,EAEtB;AAAA,EACE,iBAAiBK,GAAO;AACtB,SAAKJ,KAASI,GACd,KAAKL,KAAY,GACjB,KAAKA,KAAWK,EAAM,CAACC,MAAY;AACjC,MAAI,OAAOA,KAAY,YACrB,KAAK,WAAWA,CAAO,IAEvB,KAAK,QAAS;AAAA,IAEtB,CAAK;AAAA,EACL;AAAA,EACE,WAAWA,GAAS;AAElB,IADgB,KAAKP,OAAaO,MAEhC,KAAKP,KAAWO,GAChB,KAAK,QAAS;AAAA,EAEpB;AAAA,EACE,UAAU;AACR,UAAMC,IAAY,KAAK,UAAW;AAClC,SAAK,UAAU,QAAQ,CAACH,MAAa;AACnC,MAAAA,EAASG,CAAS;AAAA,IACxB,CAAK;AAAA,EACL;AAAA,EACE,YAAY;AACV,WAAI,OAAO,KAAKR,MAAa,YACpB,KAAKA,KAEP,WAAW,UAAU,oBAAoB;AAAA,EACpD;AACA,GACIS,IAAe,IAAIX,EAAY;","x_google_ignoreList":[0]}
@@ -0,0 +1,89 @@
1
+ import { ensureQueryFn as K, addToStart as Q, addToEnd as k } from "./utils.js";
2
+ function O(a) {
3
+ return {
4
+ onFetch: (e, t) => {
5
+ const s = e.options, c = e.fetchOptions?.meta?.fetchMore?.direction, u = e.state.data?.pages || [], f = e.state.data?.pageParams || [];
6
+ let i = { pages: [], pageParams: [] }, l = 0;
7
+ const d = async () => {
8
+ let g = !1;
9
+ const b = (r) => {
10
+ Object.defineProperty(r, "signal", {
11
+ enumerable: !0,
12
+ get: () => (e.signal.aborted ? g = !0 : e.signal.addEventListener("abort", () => {
13
+ g = !0;
14
+ }), e.signal)
15
+ });
16
+ }, q = K(e.options, e.fetchOptions), m = async (r, n, o) => {
17
+ if (g)
18
+ return Promise.reject();
19
+ if (n == null && r.pages.length)
20
+ return Promise.resolve(r);
21
+ const w = (() => {
22
+ const F = {
23
+ client: e.client,
24
+ queryKey: e.queryKey,
25
+ pageParam: n,
26
+ direction: o ? "backward" : "forward",
27
+ meta: e.options.meta
28
+ };
29
+ return b(F), F;
30
+ })(), C = await q(w), { maxPages: y } = e.options, h = o ? Q : k;
31
+ return {
32
+ pages: h(r.pages, C, y),
33
+ pageParams: h(r.pageParams, n, y)
34
+ };
35
+ };
36
+ if (c && u.length) {
37
+ const r = c === "backward", n = r ? v : P, o = {
38
+ pages: u,
39
+ pageParams: f
40
+ }, p = n(s, o);
41
+ i = await m(o, p, r);
42
+ } else {
43
+ const r = a ?? u.length;
44
+ do {
45
+ const n = l === 0 ? f[0] ?? s.initialPageParam : P(s, i);
46
+ if (l > 0 && n == null)
47
+ break;
48
+ i = await m(i, n), l++;
49
+ } while (l < r);
50
+ }
51
+ return i;
52
+ };
53
+ e.options.persister ? e.fetchFn = () => e.options.persister?.(
54
+ d,
55
+ {
56
+ client: e.client,
57
+ queryKey: e.queryKey,
58
+ meta: e.options.meta,
59
+ signal: e.signal
60
+ },
61
+ t
62
+ ) : e.fetchFn = d;
63
+ }
64
+ };
65
+ }
66
+ function P(a, { pages: e, pageParams: t }) {
67
+ const s = e.length - 1;
68
+ return e.length > 0 ? a.getNextPageParam(
69
+ e[s],
70
+ e,
71
+ t[s],
72
+ t
73
+ ) : void 0;
74
+ }
75
+ function v(a, { pages: e, pageParams: t }) {
76
+ return e.length > 0 ? a.getPreviousPageParam?.(e[0], e, t[0], t) : void 0;
77
+ }
78
+ function T(a, e) {
79
+ return e ? P(a, e) != null : !1;
80
+ }
81
+ function j(a, e) {
82
+ return !e || !a.getPreviousPageParam ? !1 : v(a, e) != null;
83
+ }
84
+ export {
85
+ T as hasNextPage,
86
+ j as hasPreviousPage,
87
+ O as infiniteQueryBehavior
88
+ };
89
+ //# sourceMappingURL=infiniteQueryBehavior.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infiniteQueryBehavior.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryBehavior.js"],"sourcesContent":["// src/infiniteQueryBehavior.ts\nimport { addToEnd, addToStart, ensureQueryFn } from \"./utils.js\";\nfunction infiniteQueryBehavior(pages) {\n return {\n onFetch: (context, query) => {\n const options = context.options;\n const direction = context.fetchOptions?.meta?.fetchMore?.direction;\n const oldPages = context.state.data?.pages || [];\n const oldPageParams = context.state.data?.pageParams || [];\n let result = { pages: [], pageParams: [] };\n let currentPage = 0;\n const fetchFn = async () => {\n let cancelled = false;\n const addSignalProperty = (object) => {\n Object.defineProperty(object, \"signal\", {\n enumerable: true,\n get: () => {\n if (context.signal.aborted) {\n cancelled = true;\n } else {\n context.signal.addEventListener(\"abort\", () => {\n cancelled = true;\n });\n }\n return context.signal;\n }\n });\n };\n const queryFn = ensureQueryFn(context.options, context.fetchOptions);\n const fetchPage = async (data, param, previous) => {\n if (cancelled) {\n return Promise.reject();\n }\n if (param == null && data.pages.length) {\n return Promise.resolve(data);\n }\n const createQueryFnContext = () => {\n const queryFnContext2 = {\n client: context.client,\n queryKey: context.queryKey,\n pageParam: param,\n direction: previous ? \"backward\" : \"forward\",\n meta: context.options.meta\n };\n addSignalProperty(queryFnContext2);\n return queryFnContext2;\n };\n const queryFnContext = createQueryFnContext();\n const page = await queryFn(queryFnContext);\n const { maxPages } = context.options;\n const addTo = previous ? addToStart : addToEnd;\n return {\n pages: addTo(data.pages, page, maxPages),\n pageParams: addTo(data.pageParams, param, maxPages)\n };\n };\n if (direction && oldPages.length) {\n const previous = direction === \"backward\";\n const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n const oldData = {\n pages: oldPages,\n pageParams: oldPageParams\n };\n const param = pageParamFn(options, oldData);\n result = await fetchPage(oldData, param, previous);\n } else {\n const remainingPages = pages ?? oldPages.length;\n do {\n const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);\n if (currentPage > 0 && param == null) {\n break;\n }\n result = await fetchPage(result, param);\n currentPage++;\n } while (currentPage < remainingPages);\n }\n return result;\n };\n if (context.options.persister) {\n context.fetchFn = () => {\n return context.options.persister?.(\n fetchFn,\n {\n client: context.client,\n queryKey: context.queryKey,\n meta: context.options.meta,\n signal: context.signal\n },\n query\n );\n };\n } else {\n context.fetchFn = fetchFn;\n }\n }\n };\n}\nfunction getNextPageParam(options, { pages, pageParams }) {\n const lastIndex = pages.length - 1;\n return pages.length > 0 ? options.getNextPageParam(\n pages[lastIndex],\n pages,\n pageParams[lastIndex],\n pageParams\n ) : void 0;\n}\nfunction getPreviousPageParam(options, { pages, pageParams }) {\n return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;\n}\nfunction hasNextPage(options, data) {\n if (!data) return false;\n return getNextPageParam(options, data) != null;\n}\nfunction hasPreviousPage(options, data) {\n if (!data || !options.getPreviousPageParam) return false;\n return getPreviousPageParam(options, data) != null;\n}\nexport {\n hasNextPage,\n hasPreviousPage,\n infiniteQueryBehavior\n};\n//# sourceMappingURL=infiniteQueryBehavior.js.map"],"names":["infiniteQueryBehavior","pages","context","query","options","direction","oldPages","oldPageParams","result","currentPage","fetchFn","cancelled","addSignalProperty","object","queryFn","ensureQueryFn","fetchPage","data","param","previous","queryFnContext","queryFnContext2","page","maxPages","addTo","addToStart","addToEnd","pageParamFn","getPreviousPageParam","getNextPageParam","oldData","remainingPages","pageParams","lastIndex","hasNextPage","hasPreviousPage"],"mappings":";AAEA,SAASA,EAAsBC,GAAO;AACpC,SAAO;AAAA,IACL,SAAS,CAACC,GAASC,MAAU;AAC3B,YAAMC,IAAUF,EAAQ,SAClBG,IAAYH,EAAQ,cAAc,MAAM,WAAW,WACnDI,IAAWJ,EAAQ,MAAM,MAAM,SAAS,CAAE,GAC1CK,IAAgBL,EAAQ,MA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,KAAK,OADxB;AAEpB;AACA,SAASkB,EAAgB/B,GAASa,GAAM;AACtC,SAAI,CAACA,KAAQ,CAACb,EAAQ,uBAA6B,KAC5CwB,EAAqBxB,GAASa,CAAI,KAAK;AAChD;","x_google_ignoreList":[0]}
@@ -0,0 +1,55 @@
1
+ import { QueryObserver as d } from "./queryObserver.js";
2
+ import { infiniteQueryBehavior as u, hasPreviousPage as v, hasNextPage as b } from "./infiniteQueryBehavior.js";
3
+ var R = class extends d {
4
+ constructor(e, t) {
5
+ super(e, t);
6
+ }
7
+ bindMethods() {
8
+ super.bindMethods(), this.fetchNextPage = this.fetchNextPage.bind(this), this.fetchPreviousPage = this.fetchPreviousPage.bind(this);
9
+ }
10
+ setOptions(e) {
11
+ super.setOptions({
12
+ ...e,
13
+ behavior: u()
14
+ });
15
+ }
16
+ getOptimisticResult(e) {
17
+ return e.behavior = u(), super.getOptimisticResult(e);
18
+ }
19
+ fetchNextPage(e) {
20
+ return this.fetch({
21
+ ...e,
22
+ meta: {
23
+ fetchMore: { direction: "forward" }
24
+ }
25
+ });
26
+ }
27
+ fetchPreviousPage(e) {
28
+ return this.fetch({
29
+ ...e,
30
+ meta: {
31
+ fetchMore: { direction: "backward" }
32
+ }
33
+ });
34
+ }
35
+ createResult(e, t) {
36
+ const { state: s } = e, i = super.createResult(e, t), { isFetching: c, isRefetching: P, isError: a, isRefetchError: g } = i, r = s.fetchMeta?.fetchMore?.direction, h = a && r === "forward", o = c && r === "forward", n = a && r === "backward", f = c && r === "backward";
37
+ return {
38
+ ...i,
39
+ fetchNextPage: this.fetchNextPage,
40
+ fetchPreviousPage: this.fetchPreviousPage,
41
+ hasNextPage: b(t, s.data),
42
+ hasPreviousPage: v(t, s.data),
43
+ isFetchNextPageError: h,
44
+ isFetchingNextPage: o,
45
+ isFetchPreviousPageError: n,
46
+ isFetchingPreviousPage: f,
47
+ isRefetchError: g && !h && !n,
48
+ isRefetching: P && !o && !f
49
+ };
50
+ }
51
+ };
52
+ export {
53
+ R as InfiniteQueryObserver
54
+ };
55
+ //# sourceMappingURL=infiniteQueryObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infiniteQueryObserver.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/infiniteQueryObserver.js"],"sourcesContent":["// src/infiniteQueryObserver.ts\nimport { QueryObserver } from \"./queryObserver.js\";\nimport {\n hasNextPage,\n hasPreviousPage,\n infiniteQueryBehavior\n} from \"./infiniteQueryBehavior.js\";\nvar InfiniteQueryObserver = class extends QueryObserver {\n constructor(client, options) {\n super(client, options);\n }\n bindMethods() {\n super.bindMethods();\n this.fetchNextPage = this.fetchNextPage.bind(this);\n this.fetchPreviousPage = this.fetchPreviousPage.bind(this);\n }\n setOptions(options) {\n super.setOptions({\n ...options,\n behavior: infiniteQueryBehavior()\n });\n }\n getOptimisticResult(options) {\n options.behavior = infiniteQueryBehavior();\n return super.getOptimisticResult(options);\n }\n fetchNextPage(options) {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: \"forward\" }\n }\n });\n }\n fetchPreviousPage(options) {\n return this.fetch({\n ...options,\n meta: {\n fetchMore: { direction: \"backward\" }\n }\n });\n }\n createResult(query, options) {\n const { state } = query;\n const parentResult = super.createResult(query, options);\n const { isFetching, isRefetching, isError, isRefetchError } = parentResult;\n const fetchDirection = state.fetchMeta?.fetchMore?.direction;\n const isFetchNextPageError = isError && fetchDirection === \"forward\";\n const isFetchingNextPage = isFetching && fetchDirection === \"forward\";\n const isFetchPreviousPageError = isError && fetchDirection === \"backward\";\n const isFetchingPreviousPage = isFetching && fetchDirection === \"backward\";\n const result = {\n ...parentResult,\n fetchNextPage: this.fetchNextPage,\n fetchPreviousPage: this.fetchPreviousPage,\n hasNextPage: hasNextPage(options, state.data),\n hasPreviousPage: hasPreviousPage(options, state.data),\n isFetchNextPageError,\n isFetchingNextPage,\n isFetchPreviousPageError,\n isFetchingPreviousPage,\n isRefetchError: isRefetchError && !isFetchNextPageError && !isFetchPreviousPageError,\n isRefetching: isRefetching && !isFetchingNextPage && !isFetchingPreviousPage\n };\n return result;\n }\n};\nexport {\n InfiniteQueryObserver\n};\n//# sourceMappingURL=infiniteQueryObserver.js.map"],"names":["InfiniteQueryObserver","QueryObserver","client","options","infiniteQueryBehavior","query","state","parentResult","isFetching","isRefetching","isError","isRefetchError","fetchDirection","isFetchNextPageError","isFetchingNextPage","isFetchPreviousPageError","isFetchingPreviousPage","hasNextPage","hasPreviousPage"],"mappings":";;AAOG,IAACA,IAAwB,cAAcC,EAAc;AAAA,EACtD,YAAYC,GAAQC,GAAS;AAC3B,UAAMD,GAAQC,CAAO;AAAA,EACzB;AAAA,EACE,cAAc;AACZ,UAAM,YAAa,GACnB,KAAK,gBAAgB,KAAK,cAAc,KAAK,IAAI,GACjD,KAAK,oBAAoB,KAAK,kBAAkB,KAAK,IAAI;AAAA,EAC7D;AAAA,EACE,WAAWA,GAAS;AAClB,UAAM,WAAW;AAAA,MACf,GAAGA;AAAA,MACH,UAAUC,EAAqB;AAAA,IACrC,CAAK;AAAA,EACL;AAAA,EACE,oBAAoBD,GAAS;AAC3B,WAAAA,EAAQ,WAAWC,EAAuB,GACnC,MAAM,oBAAoBD,CAAO;AAAA,EAC5C;AAAA,EACE,cAAcA,GAAS;AACrB,WAAO,KAAK,MAAM;AAAA,MAChB,GAAGA;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,UAAS;AAAA,MACzC;AAAA,IACA,CAAK;AAAA,EACL;AAAA,EACE,kBAAkBA,GAAS;AACzB,WAAO,KAAK,MAAM;AAAA,MAChB,GAAGA;AAAA,MACH,MAAM;AAAA,QACJ,WAAW,EAAE,WAAW,WAAU;AAAA,MAC1C;AAAA,IACA,CAAK;AAAA,EACL;AAAA,EACE,aAAaE,GAAOF,GAAS;AAC3B,UAAM,EAAE,OAAAG,EAAK,IAAKD,GACZE,IAAe,MAAM,aAAaF,GAAOF,CAAO,GAChD,EAAE,YAAAK,GAAY,cAAAC,GAAc,SAAAC,GAAS,gBAAAC,EAAgB,IAAGJ,GACxDK,IAAiBN,EAAM,WAAW,WAAW,WAC7CO,IAAuBH,KAAWE,MAAmB,WACrDE,IAAqBN,KAAcI,MAAmB,WACtDG,IAA2BL,KAAWE,MAAmB,YACzDI,IAAyBR,KAAcI,MAAmB;AAchE,WAbe;AAAA,MACb,GAAGL;AAAA,MACH,eAAe,KAAK;AAAA,MACpB,mBAAmB,KAAK;AAAA,MACxB,aAAaU,EAAYd,GAASG,EAAM,IAAI;AAAA,MAC5C,iBAAiBY,EAAgBf,GAASG,EAAM,IAAI;AAAA,MACpD,sBAAAO;AAAA,MACA,oBAAAC;AAAA,MACA,0BAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,gBAAgBL,KAAkB,CAACE,KAAwB,CAACE;AAAA,MAC5D,cAAcN,KAAgB,CAACK,KAAsB,CAACE;AAAA,IACvD;AAAA,EAEL;AACA;","x_google_ignoreList":[0]}
@@ -0,0 +1,198 @@
1
+ import { notifyManager as r } from "./notifyManager.js";
2
+ import { Removable as a } from "./removable.js";
3
+ import { createRetryer as u } from "./retryer.js";
4
+ var p = class extends a {
5
+ #e;
6
+ #t;
7
+ #i;
8
+ constructor(t) {
9
+ super(), this.mutationId = t.mutationId, this.#t = t.mutationCache, this.#e = [], this.state = t.state || h(), this.setOptions(t.options), this.scheduleGc();
10
+ }
11
+ setOptions(t) {
12
+ this.options = t, this.updateGcTime(this.options.gcTime);
13
+ }
14
+ get meta() {
15
+ return this.options.meta;
16
+ }
17
+ addObserver(t) {
18
+ this.#e.includes(t) || (this.#e.push(t), this.clearGcTimeout(), this.#t.notify({
19
+ type: "observerAdded",
20
+ mutation: this,
21
+ observer: t
22
+ }));
23
+ }
24
+ removeObserver(t) {
25
+ this.#e = this.#e.filter((i) => i !== t), this.scheduleGc(), this.#t.notify({
26
+ type: "observerRemoved",
27
+ mutation: this,
28
+ observer: t
29
+ });
30
+ }
31
+ optionalRemove() {
32
+ this.#e.length || (this.state.status === "pending" ? this.scheduleGc() : this.#t.remove(this));
33
+ }
34
+ continue() {
35
+ return this.#i?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
36
+ this.execute(this.state.variables);
37
+ }
38
+ async execute(t) {
39
+ const i = () => {
40
+ this.#s({ type: "continue" });
41
+ };
42
+ this.#i = u({
43
+ fn: () => this.options.mutationFn ? this.options.mutationFn(t) : Promise.reject(new Error("No mutationFn found")),
44
+ onFail: (e, o) => {
45
+ this.#s({ type: "failed", failureCount: e, error: o });
46
+ },
47
+ onPause: () => {
48
+ this.#s({ type: "pause" });
49
+ },
50
+ onContinue: i,
51
+ retry: this.options.retry ?? 0,
52
+ retryDelay: this.options.retryDelay,
53
+ networkMode: this.options.networkMode,
54
+ canRun: () => this.#t.canRun(this)
55
+ });
56
+ const s = this.state.status === "pending", n = !this.#i.canStart();
57
+ try {
58
+ if (s)
59
+ i();
60
+ else {
61
+ this.#s({ type: "pending", variables: t, isPaused: n }), await this.#t.config.onMutate?.(
62
+ t,
63
+ this
64
+ );
65
+ const o = await this.options.onMutate?.(t);
66
+ o !== this.state.context && this.#s({
67
+ type: "pending",
68
+ context: o,
69
+ variables: t,
70
+ isPaused: n
71
+ });
72
+ }
73
+ const e = await this.#i.start();
74
+ return await this.#t.config.onSuccess?.(
75
+ e,
76
+ t,
77
+ this.state.context,
78
+ this
79
+ ), await this.options.onSuccess?.(e, t, this.state.context), await this.#t.config.onSettled?.(
80
+ e,
81
+ null,
82
+ this.state.variables,
83
+ this.state.context,
84
+ this
85
+ ), await this.options.onSettled?.(e, null, t, this.state.context), this.#s({ type: "success", data: e }), e;
86
+ } catch (e) {
87
+ try {
88
+ throw await this.#t.config.onError?.(
89
+ e,
90
+ t,
91
+ this.state.context,
92
+ this
93
+ ), await this.options.onError?.(
94
+ e,
95
+ t,
96
+ this.state.context
97
+ ), await this.#t.config.onSettled?.(
98
+ void 0,
99
+ e,
100
+ this.state.variables,
101
+ this.state.context,
102
+ this
103
+ ), await this.options.onSettled?.(
104
+ void 0,
105
+ e,
106
+ t,
107
+ this.state.context
108
+ ), e;
109
+ } finally {
110
+ this.#s({ type: "error", error: e });
111
+ }
112
+ } finally {
113
+ this.#t.runNext(this);
114
+ }
115
+ }
116
+ #s(t) {
117
+ const i = (s) => {
118
+ switch (t.type) {
119
+ case "failed":
120
+ return {
121
+ ...s,
122
+ failureCount: t.failureCount,
123
+ failureReason: t.error
124
+ };
125
+ case "pause":
126
+ return {
127
+ ...s,
128
+ isPaused: !0
129
+ };
130
+ case "continue":
131
+ return {
132
+ ...s,
133
+ isPaused: !1
134
+ };
135
+ case "pending":
136
+ return {
137
+ ...s,
138
+ context: t.context,
139
+ data: void 0,
140
+ failureCount: 0,
141
+ failureReason: null,
142
+ error: null,
143
+ isPaused: t.isPaused,
144
+ status: "pending",
145
+ variables: t.variables,
146
+ submittedAt: Date.now()
147
+ };
148
+ case "success":
149
+ return {
150
+ ...s,
151
+ data: t.data,
152
+ failureCount: 0,
153
+ failureReason: null,
154
+ error: null,
155
+ status: "success",
156
+ isPaused: !1
157
+ };
158
+ case "error":
159
+ return {
160
+ ...s,
161
+ data: void 0,
162
+ error: t.error,
163
+ failureCount: s.failureCount + 1,
164
+ failureReason: t.error,
165
+ isPaused: !1,
166
+ status: "error"
167
+ };
168
+ }
169
+ };
170
+ this.state = i(this.state), r.batch(() => {
171
+ this.#e.forEach((s) => {
172
+ s.onMutationUpdate(t);
173
+ }), this.#t.notify({
174
+ mutation: this,
175
+ type: "updated",
176
+ action: t
177
+ });
178
+ });
179
+ }
180
+ };
181
+ function h() {
182
+ return {
183
+ context: void 0,
184
+ data: void 0,
185
+ error: null,
186
+ failureCount: 0,
187
+ failureReason: null,
188
+ isPaused: !1,
189
+ status: "idle",
190
+ variables: void 0,
191
+ submittedAt: 0
192
+ };
193
+ }
194
+ export {
195
+ p as Mutation,
196
+ h as getDefaultState
197
+ };
198
+ //# sourceMappingURL=mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutation.js"],"sourcesContent":["// src/mutation.ts\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Removable } from \"./removable.js\";\nimport { createRetryer } from \"./retryer.js\";\nvar Mutation = class extends Removable {\n #observers;\n #mutationCache;\n #retryer;\n constructor(config) {\n super();\n this.mutationId = config.mutationId;\n this.#mutationCache = config.mutationCache;\n this.#observers = [];\n this.state = config.state || getDefaultState();\n this.setOptions(config.options);\n this.scheduleGc();\n }\n setOptions(options) {\n this.options = options;\n this.updateGcTime(this.options.gcTime);\n }\n get meta() {\n return this.options.meta;\n }\n addObserver(observer) {\n if (!this.#observers.includes(observer)) {\n this.#observers.push(observer);\n this.clearGcTimeout();\n this.#mutationCache.notify({\n type: \"observerAdded\",\n mutation: this,\n observer\n });\n }\n }\n removeObserver(observer) {\n this.#observers = this.#observers.filter((x) => x !== observer);\n this.scheduleGc();\n this.#mutationCache.notify({\n type: \"observerRemoved\",\n mutation: this,\n observer\n });\n }\n optionalRemove() {\n if (!this.#observers.length) {\n if (this.state.status === \"pending\") {\n this.scheduleGc();\n } else {\n this.#mutationCache.remove(this);\n }\n }\n }\n continue() {\n return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before\n this.execute(this.state.variables);\n }\n async execute(variables) {\n const onContinue = () => {\n this.#dispatch({ type: \"continue\" });\n };\n this.#retryer = createRetryer({\n fn: () => {\n if (!this.options.mutationFn) {\n return Promise.reject(new Error(\"No mutationFn found\"));\n }\n return this.options.mutationFn(variables);\n },\n onFail: (failureCount, error) => {\n this.#dispatch({ type: \"failed\", failureCount, error });\n },\n onPause: () => {\n this.#dispatch({ type: \"pause\" });\n },\n onContinue,\n retry: this.options.retry ?? 0,\n retryDelay: this.options.retryDelay,\n networkMode: this.options.networkMode,\n canRun: () => this.#mutationCache.canRun(this)\n });\n const restored = this.state.status === \"pending\";\n const isPaused = !this.#retryer.canStart();\n try {\n if (restored) {\n onContinue();\n } else {\n this.#dispatch({ type: \"pending\", variables, isPaused });\n await this.#mutationCache.config.onMutate?.(\n variables,\n this\n );\n const context = await this.options.onMutate?.(variables);\n if (context !== this.state.context) {\n this.#dispatch({\n type: \"pending\",\n context,\n variables,\n isPaused\n });\n }\n }\n const data = await this.#retryer.start();\n await this.#mutationCache.config.onSuccess?.(\n data,\n variables,\n this.state.context,\n this\n );\n await this.options.onSuccess?.(data, variables, this.state.context);\n await this.#mutationCache.config.onSettled?.(\n data,\n null,\n this.state.variables,\n this.state.context,\n this\n );\n await this.options.onSettled?.(data, null, variables, this.state.context);\n this.#dispatch({ type: \"success\", data });\n return data;\n } catch (error) {\n try {\n await this.#mutationCache.config.onError?.(\n error,\n variables,\n this.state.context,\n this\n );\n await this.options.onError?.(\n error,\n variables,\n this.state.context\n );\n await this.#mutationCache.config.onSettled?.(\n void 0,\n error,\n this.state.variables,\n this.state.context,\n this\n );\n await this.options.onSettled?.(\n void 0,\n error,\n variables,\n this.state.context\n );\n throw error;\n } finally {\n this.#dispatch({ type: \"error\", error });\n }\n } finally {\n this.#mutationCache.runNext(this);\n }\n }\n #dispatch(action) {\n const reducer = (state) => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n failureCount: action.failureCount,\n failureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n isPaused: true\n };\n case \"continue\":\n return {\n ...state,\n isPaused: false\n };\n case \"pending\":\n return {\n ...state,\n context: action.context,\n data: void 0,\n failureCount: 0,\n failureReason: null,\n error: null,\n isPaused: action.isPaused,\n status: \"pending\",\n variables: action.variables,\n submittedAt: Date.now()\n };\n case \"success\":\n return {\n ...state,\n data: action.data,\n failureCount: 0,\n failureReason: null,\n error: null,\n status: \"success\",\n isPaused: false\n };\n case \"error\":\n return {\n ...state,\n data: void 0,\n error: action.error,\n failureCount: state.failureCount + 1,\n failureReason: action.error,\n isPaused: false,\n status: \"error\"\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.#observers.forEach((observer) => {\n observer.onMutationUpdate(action);\n });\n this.#mutationCache.notify({\n mutation: this,\n type: \"updated\",\n action\n });\n });\n }\n};\nfunction getDefaultState() {\n return {\n context: void 0,\n data: void 0,\n error: null,\n failureCount: 0,\n failureReason: null,\n isPaused: false,\n status: \"idle\",\n variables: void 0,\n submittedAt: 0\n };\n}\nexport {\n Mutation,\n getDefaultState\n};\n//# sourceMappingURL=mutation.js.map"],"names":["Mutation","Removable","#observers","#mutationCache","#retryer","config","getDefaultState","options","observer","x","variables","onContinue","#dispatch","createRetryer","failureCount","error","restored","isPaused","context","data","action","reducer","state","notifyManager"],"mappings":";;;AAIG,IAACA,IAAW,cAAcC,EAAU;AAAA,EACrCC;AAAA,EACAC;AAAA,EACAC;AAAA,EACA,YAAYC,GAAQ;AAClB,UAAO,GACP,KAAK,aAAaA,EAAO,YACzB,KAAKF,KAAiBE,EAAO,eAC7B,KAAKH,KAAa,CAAE,GACpB,KAAK,QAAQG,EAAO,SAASC,EAAiB,GAC9C,KAAK,WAAWD,EAAO,OAAO,GAC9B,KAAK,WAAY;AAAA,EACrB;AAAA,EACE,WAAWE,GAAS;AAClB,SAAK,UAAUA,GACf,KAAK,aAAa,KAAK,QAAQ,MAAM;AAAA,EACzC;AAAA,EACE,IAAI,OAAO;AACT,WAAO,KAAK,QAAQ;AAAA,EACxB;AAAA,EACE,YAAYC,GAAU;AACpB,IAAK,KAAKN,GAAW,SAASM,CAAQ,MACpC,KAAKN,GAAW,KAAKM,CAAQ,GAC7B,KAAK,eAAgB,GACrB,KAAKL,GAAe,OAAO;AAAA,MACzB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,UAAAK;AAAA,IACR,CAAO;AAAA,EAEP;AAAA,EACE,eAAeA,GAAU;AACvB,SAAKN,KAAa,KAAKA,GAAW,OAAO,CAACO,MAAMA,MAAMD,CAAQ,GAC9D,KAAK,WAAY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AAA,QACN,QAAAiB;AAAA,MACR,CAAO;AAAA,IACP,CAAK;AAAA,EACL;AACA;AACA,SAASd,IAAkB;AACzB,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,IACP,cAAc;AAAA,IACd,eAAe;AAAA,IACf,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,aAAa;AAAA,EACd;AACH;","x_google_ignoreList":[0]}
@@ -0,0 +1,99 @@
1
+ import { notifyManager as n } from "./notifyManager.js";
2
+ import { Mutation as a } from "./mutation.js";
3
+ import { matchMutation as r, noop as f } from "./utils.js";
4
+ import { Subscribable as u } from "./subscribable.js";
5
+ var g = class extends u {
6
+ constructor(t = {}) {
7
+ super(), this.config = t, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#s = 0;
8
+ }
9
+ #e;
10
+ #t;
11
+ #s;
12
+ build(t, e, s) {
13
+ const i = new a({
14
+ mutationCache: this,
15
+ mutationId: ++this.#s,
16
+ options: t.defaultMutationOptions(e),
17
+ state: s
18
+ });
19
+ return this.add(i), i;
20
+ }
21
+ add(t) {
22
+ this.#e.add(t);
23
+ const e = o(t);
24
+ if (typeof e == "string") {
25
+ const s = this.#t.get(e);
26
+ s ? s.push(t) : this.#t.set(e, [t]);
27
+ }
28
+ this.notify({ type: "added", mutation: t });
29
+ }
30
+ remove(t) {
31
+ if (this.#e.delete(t)) {
32
+ const e = o(t);
33
+ if (typeof e == "string") {
34
+ const s = this.#t.get(e);
35
+ if (s)
36
+ if (s.length > 1) {
37
+ const i = s.indexOf(t);
38
+ i !== -1 && s.splice(i, 1);
39
+ } else s[0] === t && this.#t.delete(e);
40
+ }
41
+ }
42
+ this.notify({ type: "removed", mutation: t });
43
+ }
44
+ canRun(t) {
45
+ const e = o(t);
46
+ if (typeof e == "string") {
47
+ const i = this.#t.get(e)?.find(
48
+ (c) => c.state.status === "pending"
49
+ );
50
+ return !i || i === t;
51
+ } else
52
+ return !0;
53
+ }
54
+ runNext(t) {
55
+ const e = o(t);
56
+ return typeof e == "string" ? this.#t.get(e)?.find((i) => i !== t && i.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
57
+ }
58
+ clear() {
59
+ n.batch(() => {
60
+ this.#e.forEach((t) => {
61
+ this.notify({ type: "removed", mutation: t });
62
+ }), this.#e.clear(), this.#t.clear();
63
+ });
64
+ }
65
+ getAll() {
66
+ return Array.from(this.#e);
67
+ }
68
+ find(t) {
69
+ const e = { exact: !0, ...t };
70
+ return this.getAll().find(
71
+ (s) => r(e, s)
72
+ );
73
+ }
74
+ findAll(t = {}) {
75
+ return this.getAll().filter((e) => r(t, e));
76
+ }
77
+ notify(t) {
78
+ n.batch(() => {
79
+ this.listeners.forEach((e) => {
80
+ e(t);
81
+ });
82
+ });
83
+ }
84
+ resumePausedMutations() {
85
+ const t = this.getAll().filter((e) => e.state.isPaused);
86
+ return n.batch(
87
+ () => Promise.all(
88
+ t.map((e) => e.continue().catch(f))
89
+ )
90
+ );
91
+ }
92
+ };
93
+ function o(t) {
94
+ return t.options.scope?.id;
95
+ }
96
+ export {
97
+ g as MutationCache
98
+ };
99
+ //# sourceMappingURL=mutationCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutationCache.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/mutationCache.js"],"sourcesContent":["// src/mutationCache.ts\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Mutation } from \"./mutation.js\";\nimport { matchMutation, noop } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nvar MutationCache = class extends Subscribable {\n constructor(config = {}) {\n super();\n this.config = config;\n this.#mutations = /* @__PURE__ */ new Set();\n this.#scopes = /* @__PURE__ */ new Map();\n this.#mutationId = 0;\n }\n #mutations;\n #scopes;\n #mutationId;\n build(client, options, state) {\n const mutation = new Mutation({\n mutationCache: this,\n mutationId: ++this.#mutationId,\n options: client.defaultMutationOptions(options),\n state\n });\n this.add(mutation);\n return mutation;\n }\n add(mutation) {\n this.#mutations.add(mutation);\n const scope = scopeFor(mutation);\n if (typeof scope === \"string\") {\n const scopedMutations = this.#scopes.get(scope);\n if (scopedMutations) {\n scopedMutations.push(mutation);\n } else {\n this.#scopes.set(scope, [mutation]);\n }\n }\n this.notify({ type: \"added\", mutation });\n }\n remove(mutation) {\n if (this.#mutations.delete(mutation)) {\n const scope = scopeFor(mutation);\n if (typeof scope === \"string\") {\n const scopedMutations = this.#scopes.get(scope);\n if (scopedMutations) {\n if (scopedMutations.length > 1) {\n const index = scopedMutations.indexOf(mutation);\n if (index !== -1) {\n scopedMutations.splice(index, 1);\n }\n } else if (scopedMutations[0] === mutation) {\n this.#scopes.delete(scope);\n }\n }\n }\n }\n this.notify({ type: \"removed\", mutation });\n }\n canRun(mutation) {\n const scope = scopeFor(mutation);\n if (typeof scope === \"string\") {\n const mutationsWithSameScope = this.#scopes.get(scope);\n const firstPendingMutation = mutationsWithSameScope?.find(\n (m) => m.state.status === \"pending\"\n );\n return !firstPendingMutation || firstPendingMutation === mutation;\n } else {\n return true;\n }\n }\n runNext(mutation) {\n const scope = scopeFor(mutation);\n if (typeof scope === \"string\") {\n const foundMutation = this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused);\n return foundMutation?.continue() ?? Promise.resolve();\n } else {\n return Promise.resolve();\n }\n }\n clear() {\n notifyManager.batch(() => {\n this.#mutations.forEach((mutation) => {\n this.notify({ type: \"removed\", mutation });\n });\n this.#mutations.clear();\n this.#scopes.clear();\n });\n }\n getAll() {\n return Array.from(this.#mutations);\n }\n find(filters) {\n const defaultedFilters = { exact: true, ...filters };\n return this.getAll().find(\n (mutation) => matchMutation(defaultedFilters, mutation)\n );\n }\n findAll(filters = {}) {\n return this.getAll().filter((mutation) => matchMutation(filters, mutation));\n }\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach((listener) => {\n listener(event);\n });\n });\n }\n resumePausedMutations() {\n const pausedMutations = this.getAll().filter((x) => x.state.isPaused);\n return notifyManager.batch(\n () => Promise.all(\n pausedMutations.map((mutation) => mutation.continue().catch(noop))\n )\n );\n }\n};\nfunction scopeFor(mutation) {\n return mutation.options.scope?.id;\n}\nexport {\n MutationCache\n};\n//# sourceMappingURL=mutationCache.js.map"],"names":["MutationCache","Subscribable","config","#mutations","#scopes","#mutationId","client","options","state","mutation","Mutation","scope","scopeFor","scopedMutations","index","firstPendingMutation","m","notifyManager","filters","defaultedFilters","matchMutation","event","listener","pausedMutations","x","noop"],"mappings":";;;;AAKG,IAACA,IAAgB,cAAcC,EAAa;AAAA,EAC7C,YAAYC,IAAS,IAAI;AACvB,UAAO,GACP,KAAK,SAASA,GACd,KAAKC,KAA6B,oBAAI,IAAK,GAC3C,KAAKC,KAA0B,oBAAI,IAAK,GACxC,KAAKC,KAAc;AAAA,EACvB;AAAA,EACEF;AAAA,EACAC;AAAA,EACAC;AAAA,EACA,MAAMC,GAAQC,GAASC,GAAO;AAC5B,UAAMC,IAAW,IAAIC,EAAS;AAAA,MAC5B,eAAe;AAAA,MACf,YAAY,EAAE,KAAKL;AAAA,MACnB,SAASC,EAAO,uBAAuBC,CAAO;AAAA,MAC9C,OAAAC;AAAA,IACN,CAAK;AACD,gBAAK,IAAIC,CAAQ,GACVA;AAAA,EACX;AAAA,EACE,IAAIA,GAAU;AACZ,SAAKN,GAAW,IAAIM,CAAQ;AAC5B,UAAME,IAAQC,EAASH,CAAQ;AAC/B,QAAI,OAAOE,KAAU,UAAU;AAC7B,YAAME,IAAkB,KAAKT,GAAQ,IAAIO,CAAK;AAC9C,MAAIE,IACFA,EAAgB,KAAKJ,CAAQ,IAE7B,KAAKL,GAAQ,IAAIO,GAAO,CAACF,CAAQ,CAAC;AAAA,IAE1C;AACI,SAAK,OAAO,EAAE,MAAM,SAAS,UAAAA,EAAQ,CAAE;AAAA,EAC3C;AAAA,EACE,OAAOA,GAAU;AACf,QAAI,KAAK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M,KAAK,KAAKD,EAAU;AAAA,EACrC;AAAA,EACE,KAAKe,GAAS;AACZ,UAAMC,IAAmB,EAAE,OAAO,IAAM,GAAGD,EAAS;AACpD,WAAO,KAAK,OAAM,EAAG;AAAA,MACnB,CAACT,MAAaW,EAAcD,GAAkBV,CAAQ;AAAA,IACvD;AAAA,EACL;AAAA,EACE,QAAQS,IAAU,IAAI;AACpB,WAAO,KAAK,OAAM,EAAG,OAAO,CAACT,MAAaW,EAAcF,GAAST,CAAQ,CAAC;AAAA,EAC9E;AAAA,EACE,OAAOY,GAAO;AACZ,IAAAJ,EAAc,MAAM,MAAM;AACxB,WAAK,UAAU,QAAQ,CAACK,MAAa;AACnC,QAAAA,EAASD,CAAK;AAAA,MACtB,CAAO;AAAA,IACP,CAAK;AAAA,EACL;AAAA,EACE,wBAAwB;AACtB,UAAME,IAAkB,KAAK,SAAS,OAAO,CAACC,MAAMA,EAAE,MAAM,QAAQ;AACpE,WAAOP,EAAc;AAAA,MACnB,MAAM,QAAQ;AAAA,QACZM,EAAgB,IAAI,CAACd,MAAaA,EAAS,SAAU,EAAC,MAAMgB,CAAI,CAAC;AAAA,MACzE;AAAA,IACK;AAAA,EACL;AACA;AACA,SAASb,EAASH,GAAU;AAC1B,SAAOA,EAAS,QAAQ,OAAO;AACjC;","x_google_ignoreList":[0]}
@@ -0,0 +1,67 @@
1
+ var s = (n) => setTimeout(n, 0);
2
+ function c() {
3
+ let n = [], r = 0, u = (t) => {
4
+ t();
5
+ }, i = (t) => {
6
+ t();
7
+ }, l = s;
8
+ const o = (t) => {
9
+ r ? n.push(t) : l(() => {
10
+ u(t);
11
+ });
12
+ }, a = () => {
13
+ const t = n;
14
+ n = [], t.length && l(() => {
15
+ i(() => {
16
+ t.forEach((e) => {
17
+ u(e);
18
+ });
19
+ });
20
+ });
21
+ };
22
+ return {
23
+ batch: (t) => {
24
+ let e;
25
+ r++;
26
+ try {
27
+ e = t();
28
+ } finally {
29
+ r--, r || a();
30
+ }
31
+ return e;
32
+ },
33
+ /**
34
+ * All calls to the wrapped function will be batched.
35
+ */
36
+ batchCalls: (t) => (...e) => {
37
+ o(() => {
38
+ t(...e);
39
+ });
40
+ },
41
+ schedule: o,
42
+ /**
43
+ * Use this method to set a custom notify function.
44
+ * This can be used to for example wrap notifications with `React.act` while running tests.
45
+ */
46
+ setNotifyFunction: (t) => {
47
+ u = t;
48
+ },
49
+ /**
50
+ * Use this method to set a custom function to batch notifications together into a single tick.
51
+ * By default React Query will use the batch function provided by ReactDOM or React Native.
52
+ */
53
+ setBatchNotifyFunction: (t) => {
54
+ i = t;
55
+ },
56
+ setScheduler: (t) => {
57
+ l = t;
58
+ }
59
+ };
60
+ }
61
+ var f = c();
62
+ export {
63
+ c as createNotifyManager,
64
+ s as defaultScheduler,
65
+ f as notifyManager
66
+ };
67
+ //# sourceMappingURL=notifyManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifyManager.js","sources":["../../../../../../../../../../node_modules/.pnpm/@tanstack+query-core@5.86.0/node_modules/@tanstack/query-core/build/modern/notifyManager.js"],"sourcesContent":["// src/notifyManager.ts\nvar defaultScheduler = (cb) => setTimeout(cb, 0);\nfunction createNotifyManager() {\n let queue = [];\n let transactions = 0;\n let notifyFn = (callback) => {\n callback();\n };\n let batchNotifyFn = (callback) => {\n callback();\n };\n let scheduleFn = defaultScheduler;\n const schedule = (callback) => {\n if (transactions) {\n queue.push(callback);\n } else {\n scheduleFn(() => {\n notifyFn(callback);\n });\n }\n };\n const flush = () => {\n const originalQueue = queue;\n queue = [];\n if (originalQueue.length) {\n scheduleFn(() => {\n batchNotifyFn(() => {\n originalQueue.forEach((callback) => {\n notifyFn(callback);\n });\n });\n });\n }\n };\n return {\n batch: (callback) => {\n let result;\n transactions++;\n try {\n result = callback();\n } finally {\n transactions--;\n if (!transactions) {\n flush();\n }\n }\n return result;\n },\n /**\n * All calls to the wrapped function will be batched.\n */\n batchCalls: (callback) => {\n return (...args) => {\n schedule(() => {\n callback(...args);\n });\n };\n },\n schedule,\n /**\n * Use this method to set a custom notify function.\n * This can be used to for example wrap notifications with `React.act` while running tests.\n */\n setNotifyFunction: (fn) => {\n notifyFn = fn;\n },\n /**\n * Use this method to set a custom function to batch notifications together into a single tick.\n * By default React Query will use the batch function provided by ReactDOM or React Native.\n */\n setBatchNotifyFunction: (fn) => {\n batchNotifyFn = fn;\n },\n setScheduler: (fn) => {\n scheduleFn = fn;\n }\n };\n}\nvar notifyManager = createNotifyManager();\nexport {\n createNotifyManager,\n defaultScheduler,\n notifyManager\n};\n//# sourceMappingURL=notifyManager.js.map"],"names":["defaultScheduler","cb","createNotifyManager","queue","transactions","notifyFn","callback","batchNotifyFn","scheduleFn","schedule","flush","originalQueue","result","args","fn","notifyManager"],"mappings":"AACG,IAACA,IAAmB,CAACC,MAAO,WAAWA,GAAI,CAAC;AAC/C,SAASC,IAAsB;AAC7B,MAAIC,IAAQ,CAAE,GACVC,IAAe,GACfC,IAAW,CAACC,MAAa;AAC3B,IAAAA,EAAU;AAAA,EACX,GACGC,IAAgB,CAACD,MAAa;AAChC,IAAAA,EAAU;AAAA,EACX,GACGE,IAAaR;AACjB,QAAMS,IAAW,CAACH,MAAa;AAC7B,IAAIF,IACFD,EAAM,KAAKG,CAAQ,IAEnBE,EAAW,MAAM;AACf,MAAAH,EAASC,CAAQ;AAAA,IACzB,CAAO;AAAA,EAEJ,GACKI,IAAQ,MAAM;AAClB,UAAMC,IAAgBR;AACtB,IAAAA,IAAQ,CAAE,GACNQ,EAAc,UAChBH,EAAW,MAAM;AACf,MAAAD,EAAc,MAAM;AAClB,QAAAI,EAAc,QAAQ,CAACL,MAAa;AAClC,UAAAD,EAASC,CAAQ;AAAA,QAC7B,CAAW;AAAA,MACX,CAAS;AAAA,IACT,CAAO;AAAA,EAEJ;AACD,SAAO;AAAA,IACL,OAAO,CAACA,MAAa;AACnB,UAAIM;AACJ,MAAAR;AACA,UAAI;AACF,QAAAQ,IAASN,EAAU;AAAA,MAC3B,UAA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