@inventreedb/ui 0.9.0 → 0.10.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 (23) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/.vite/manifest.json +12 -4
  3. package/dist/node_modules/@tanstack/query-core/build/modern/environmentManager.js +22 -0
  4. package/dist/node_modules/@tanstack/query-core/build/modern/environmentManager.js.map +1 -0
  5. package/dist/node_modules/@tanstack/query-core/build/modern/focusManager.js +1 -2
  6. package/dist/node_modules/@tanstack/query-core/build/modern/focusManager.js.map +1 -1
  7. package/dist/node_modules/@tanstack/query-core/build/modern/onlineManager.js +1 -2
  8. package/dist/node_modules/@tanstack/query-core/build/modern/onlineManager.js.map +1 -1
  9. package/dist/node_modules/@tanstack/query-core/build/modern/query.js.map +1 -1
  10. package/dist/node_modules/@tanstack/query-core/build/modern/queryObserver.js +5 -4
  11. package/dist/node_modules/@tanstack/query-core/build/modern/queryObserver.js.map +1 -1
  12. package/dist/node_modules/@tanstack/query-core/build/modern/retryer.js.map +1 -1
  13. package/dist/node_modules/@tanstack/query-core/build/modern/timeoutManager.js +2 -1
  14. package/dist/node_modules/@tanstack/query-core/build/modern/timeoutManager.js.map +1 -1
  15. package/dist/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js +3 -2
  16. package/dist/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js.map +1 -1
  17. package/dist/types/Forms.d.ts +2 -0
  18. package/dist/types/Plugins.d.ts +11 -0
  19. package/dist/types/Plugins.js +1 -1
  20. package/dist/types/Plugins.js.map +1 -1
  21. package/lib/types/Forms.tsx +2 -0
  22. package/lib/types/Plugins.tsx +10 -0
  23. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file contains historical changelog information for the InvenTree UI components library.
4
4
 
5
+ ### 0.10.0 - April 2026
6
+
7
+ Exposes the `importer` object to the plugin context, allow plugins to initialize a data import session using the data importer wizard.
8
+
5
9
  ### 0.9.0 - March 2026
6
10
 
7
11
  Exposes the `useMonitorBackgroundTask` hook, which allows plugins to monitor the status of a background task and display notifications when the task is complete. This is useful for plugins that offload long-running tasks to the background and want to provide feedback to the user when the task is complete.
@@ -316,13 +316,20 @@
316
316
  "node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs"
317
317
  ]
318
318
  },
319
+ "node_modules/@tanstack/query-core/build/modern/environmentManager.js": {
320
+ "file": "node_modules/@tanstack/query-core/build/modern/environmentManager.js",
321
+ "name": "node_modules/@tanstack/query-core/build/modern/environmentManager",
322
+ "src": "node_modules/@tanstack/query-core/build/modern/environmentManager.js",
323
+ "imports": [
324
+ "node_modules/@tanstack/query-core/build/modern/utils.js"
325
+ ]
326
+ },
319
327
  "node_modules/@tanstack/query-core/build/modern/focusManager.js": {
320
328
  "file": "node_modules/@tanstack/query-core/build/modern/focusManager.js",
321
329
  "name": "node_modules/@tanstack/query-core/build/modern/focusManager",
322
330
  "src": "node_modules/@tanstack/query-core/build/modern/focusManager.js",
323
331
  "imports": [
324
- "node_modules/@tanstack/query-core/build/modern/subscribable.js",
325
- "node_modules/@tanstack/query-core/build/modern/utils.js"
332
+ "node_modules/@tanstack/query-core/build/modern/subscribable.js"
326
333
  ]
327
334
  },
328
335
  "node_modules/@tanstack/query-core/build/modern/notifyManager.js": {
@@ -338,8 +345,7 @@
338
345
  "name": "node_modules/@tanstack/query-core/build/modern/onlineManager",
339
346
  "src": "node_modules/@tanstack/query-core/build/modern/onlineManager.js",
340
347
  "imports": [
341
- "node_modules/@tanstack/query-core/build/modern/subscribable.js",
342
- "node_modules/@tanstack/query-core/build/modern/utils.js"
348
+ "node_modules/@tanstack/query-core/build/modern/subscribable.js"
343
349
  ]
344
350
  },
345
351
  "node_modules/@tanstack/query-core/build/modern/query.js": {
@@ -356,6 +362,7 @@
356
362
  "src": "node_modules/@tanstack/query-core/build/modern/queryObserver.js",
357
363
  "imports": [
358
364
  "node_modules/@tanstack/query-core/build/modern/focusManager.js",
365
+ "node_modules/@tanstack/query-core/build/modern/environmentManager.js",
359
366
  "node_modules/@tanstack/query-core/build/modern/notifyManager.js",
360
367
  "node_modules/@tanstack/query-core/build/modern/query.js",
361
368
  "node_modules/@tanstack/query-core/build/modern/subscribable.js",
@@ -431,6 +438,7 @@
431
438
  "name": "node_modules/@tanstack/react-query/build/modern/useBaseQuery",
432
439
  "src": "node_modules/@tanstack/react-query/build/modern/useBaseQuery.js",
433
440
  "imports": [
441
+ "node_modules/@tanstack/query-core/build/modern/environmentManager.js",
434
442
  "node_modules/@tanstack/query-core/build/modern/notifyManager.js",
435
443
  "node_modules/@tanstack/query-core/build/modern/utils.js",
436
444
  "node_modules/@tanstack/react-query/build/modern/QueryClientProvider.js",
@@ -0,0 +1,22 @@
1
+ import { isServer } from "./utils.js";
2
+ var environmentManager = /* @__PURE__ */ (() => {
3
+ let isServerFn = () => isServer;
4
+ return {
5
+ /**
6
+ * Returns whether the current runtime should be treated as a server environment.
7
+ */
8
+ isServer() {
9
+ return isServerFn();
10
+ },
11
+ /**
12
+ * Overrides the server check globally.
13
+ */
14
+ setIsServer(isServerValue) {
15
+ isServerFn = isServerValue;
16
+ }
17
+ };
18
+ })();
19
+ export {
20
+ environmentManager
21
+ };
22
+ //# sourceMappingURL=environmentManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environmentManager.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/environmentManager.js"],"sourcesContent":["// src/environmentManager.ts\nimport { isServer } from \"./utils.js\";\nvar environmentManager = /* @__PURE__ */ (() => {\n let isServerFn = () => isServer;\n return {\n /**\n * Returns whether the current runtime should be treated as a server environment.\n */\n isServer() {\n return isServerFn();\n },\n /**\n * Overrides the server check globally.\n */\n setIsServer(isServerValue) {\n isServerFn = isServerValue;\n }\n };\n})();\nexport {\n environmentManager\n};\n//# sourceMappingURL=environmentManager.js.map"],"names":[],"mappings":";AAEG,IAAC,qBAAsC,uBAAM;AAC9C,MAAI,aAAa,MAAM;AACvB,SAAO;AAAA;AAAA;AAAA;AAAA,IAIL,WAAW;AACT,aAAO,WAAU;AAAA,IACnB;AAAA;AAAA;AAAA;AAAA,IAIA,YAAY,eAAe;AACzB,mBAAa;AAAA,IACf;AAAA,EACJ;AACA,GAAC;","x_google_ignoreList":[0]}
@@ -1,5 +1,4 @@
1
1
  import { Subscribable } from "./subscribable.js";
2
- import { isServer } from "./utils.js";
3
2
  var FocusManager = class extends Subscribable {
4
3
  #focused;
5
4
  #cleanup;
@@ -7,7 +6,7 @@ var FocusManager = class extends Subscribable {
7
6
  constructor() {
8
7
  super();
9
8
  this.#setup = (onFocus) => {
10
- if (!isServer && window.addEventListener) {
9
+ if (typeof window !== "undefined" && window.addEventListener) {
11
10
  const listener = () => onFocus();
12
11
  window.addEventListener("visibilitychange", listener, false);
13
12
  return () => {
@@ -1 +1 @@
1
- {"version":3,"file":"focusManager.js","sources":["../../../../../../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":[],"mappings":";;AAGG,IAAC,eAAe,cAAc,aAAa;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AACZ,UAAK;AACL,SAAK,SAAS,CAAC,YAAY;AACzB,UAAI,CAAC,YAAY,OAAO,kBAAkB;AACxC,cAAM,WAAW,MAAM,QAAO;AAC9B,eAAO,iBAAiB,oBAAoB,UAAU,KAAK;AAC3D,eAAO,MAAM;AACX,iBAAO,oBAAoB,oBAAoB,QAAQ;AAAA,QACzD;AAAA,MACF;AACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,cAAc;AACZ,QAAI,CAAC,KAAK,UAAU;AAClB,WAAK,iBAAiB,KAAK,MAAM;AAAA,IACnC;AAAA,EACF;AAAA,EACA,gBAAgB;AACd,QAAI,CAAC,KAAK,gBAAgB;AACxB,WAAK,WAAQ;AACb,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA,EACA,iBAAiB,OAAO;AACtB,SAAK,SAAS;AACd,SAAK,WAAQ;AACb,SAAK,WAAW,MAAM,CAAC,YAAY;AACjC,UAAI,OAAO,YAAY,WAAW;AAChC,aAAK,WAAW,OAAO;AAAA,MACzB,OAAO;AACL,aAAK,QAAO;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,WAAW,SAAS;AAClB,UAAM,UAAU,KAAK,aAAa;AAClC,QAAI,SAAS;AACX,WAAK,WAAW;AAChB,WAAK,QAAO;AAAA,IACd;AAAA,EACF;AAAA,EACA,UAAU;AACR,UAAM,YAAY,KAAK,UAAS;AAChC,SAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,eAAS,SAAS;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EACA,YAAY;AACV,QAAI,OAAO,KAAK,aAAa,WAAW;AACtC,aAAO,KAAK;AAAA,IACd;AACA,WAAO,WAAW,UAAU,oBAAoB;AAAA,EAClD;AACF;AACG,IAAC,eAAe,IAAI,aAAY;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"focusManager.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/focusManager.js"],"sourcesContent":["// src/focusManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nvar FocusManager = class extends Subscribable {\n #focused;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onFocus) => {\n if (typeof window !== \"undefined\" && 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":[],"mappings":";AAEG,IAAC,eAAe,cAAc,aAAa;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AACZ,UAAK;AACL,SAAK,SAAS,CAAC,YAAY;AACzB,UAAI,OAAO,WAAW,eAAe,OAAO,kBAAkB;AAC5D,cAAM,WAAW,MAAM,QAAO;AAC9B,eAAO,iBAAiB,oBAAoB,UAAU,KAAK;AAC3D,eAAO,MAAM;AACX,iBAAO,oBAAoB,oBAAoB,QAAQ;AAAA,QACzD;AAAA,MACF;AACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,cAAc;AACZ,QAAI,CAAC,KAAK,UAAU;AAClB,WAAK,iBAAiB,KAAK,MAAM;AAAA,IACnC;AAAA,EACF;AAAA,EACA,gBAAgB;AACd,QAAI,CAAC,KAAK,gBAAgB;AACxB,WAAK,WAAQ;AACb,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA,EACA,iBAAiB,OAAO;AACtB,SAAK,SAAS;AACd,SAAK,WAAQ;AACb,SAAK,WAAW,MAAM,CAAC,YAAY;AACjC,UAAI,OAAO,YAAY,WAAW;AAChC,aAAK,WAAW,OAAO;AAAA,MACzB,OAAO;AACL,aAAK,QAAO;AAAA,MACd;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,WAAW,SAAS;AAClB,UAAM,UAAU,KAAK,aAAa;AAClC,QAAI,SAAS;AACX,WAAK,WAAW;AAChB,WAAK,QAAO;AAAA,IACd;AAAA,EACF;AAAA,EACA,UAAU;AACR,UAAM,YAAY,KAAK,UAAS;AAChC,SAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,eAAS,SAAS;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EACA,YAAY;AACV,QAAI,OAAO,KAAK,aAAa,WAAW;AACtC,aAAO,KAAK;AAAA,IACd;AACA,WAAO,WAAW,UAAU,oBAAoB;AAAA,EAClD;AACF;AACG,IAAC,eAAe,IAAI,aAAY;","x_google_ignoreList":[0]}
@@ -1,5 +1,4 @@
1
1
  import { Subscribable } from "./subscribable.js";
2
- import { isServer } from "./utils.js";
3
2
  var OnlineManager = class extends Subscribable {
4
3
  #online = true;
5
4
  #cleanup;
@@ -7,7 +6,7 @@ var OnlineManager = class extends Subscribable {
7
6
  constructor() {
8
7
  super();
9
8
  this.#setup = (onOnline) => {
10
- if (!isServer && window.addEventListener) {
9
+ if (typeof window !== "undefined" && window.addEventListener) {
11
10
  const onlineListener = () => onOnline(true);
12
11
  const offlineListener = () => onOnline(false);
13
12
  window.addEventListener("online", onlineListener, false);
@@ -1 +1 @@
1
- {"version":3,"file":"onlineManager.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/onlineManager.js"],"sourcesContent":["// src/onlineManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nimport { isServer } from \"./utils.js\";\nvar OnlineManager = class extends Subscribable {\n #online = true;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onOnline) => {\n if (!isServer && window.addEventListener) {\n const onlineListener = () => onOnline(true);\n const offlineListener = () => onOnline(false);\n window.addEventListener(\"online\", onlineListener, false);\n window.addEventListener(\"offline\", offlineListener, false);\n return () => {\n window.removeEventListener(\"online\", onlineListener);\n window.removeEventListener(\"offline\", offlineListener);\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(this.setOnline.bind(this));\n }\n setOnline(online) {\n const changed = this.#online !== online;\n if (changed) {\n this.#online = online;\n this.listeners.forEach((listener) => {\n listener(online);\n });\n }\n }\n isOnline() {\n return this.#online;\n }\n};\nvar onlineManager = new OnlineManager();\nexport {\n OnlineManager,\n onlineManager\n};\n//# sourceMappingURL=onlineManager.js.map"],"names":[],"mappings":";;AAGG,IAAC,gBAAgB,cAAc,aAAa;AAAA,EAC7C,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,cAAc;AACZ,UAAK;AACL,SAAK,SAAS,CAAC,aAAa;AAC1B,UAAI,CAAC,YAAY,OAAO,kBAAkB;AACxC,cAAM,iBAAiB,MAAM,SAAS,IAAI;AAC1C,cAAM,kBAAkB,MAAM,SAAS,KAAK;AAC5C,eAAO,iBAAiB,UAAU,gBAAgB,KAAK;AACvD,eAAO,iBAAiB,WAAW,iBAAiB,KAAK;AACzD,eAAO,MAAM;AACX,iBAAO,oBAAoB,UAAU,cAAc;AACnD,iBAAO,oBAAoB,WAAW,eAAe;AAAA,QACvD;AAAA,MACF;AACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,cAAc;AACZ,QAAI,CAAC,KAAK,UAAU;AAClB,WAAK,iBAAiB,KAAK,MAAM;AAAA,IACnC;AAAA,EACF;AAAA,EACA,gBAAgB;AACd,QAAI,CAAC,KAAK,gBAAgB;AACxB,WAAK,WAAQ;AACb,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA,EACA,iBAAiB,OAAO;AACtB,SAAK,SAAS;AACd,SAAK,WAAQ;AACb,SAAK,WAAW,MAAM,KAAK,UAAU,KAAK,IAAI,CAAC;AAAA,EACjD;AAAA,EACA,UAAU,QAAQ;AAChB,UAAM,UAAU,KAAK,YAAY;AACjC,QAAI,SAAS;AACX,WAAK,UAAU;AACf,WAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,iBAAS,MAAM;AAAA,MACjB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EACA,WAAW;AACT,WAAO,KAAK;AAAA,EACd;AACF;AACG,IAAC,gBAAgB,IAAI,cAAa;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"onlineManager.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/onlineManager.js"],"sourcesContent":["// src/onlineManager.ts\nimport { Subscribable } from \"./subscribable.js\";\nvar OnlineManager = class extends Subscribable {\n #online = true;\n #cleanup;\n #setup;\n constructor() {\n super();\n this.#setup = (onOnline) => {\n if (typeof window !== \"undefined\" && window.addEventListener) {\n const onlineListener = () => onOnline(true);\n const offlineListener = () => onOnline(false);\n window.addEventListener(\"online\", onlineListener, false);\n window.addEventListener(\"offline\", offlineListener, false);\n return () => {\n window.removeEventListener(\"online\", onlineListener);\n window.removeEventListener(\"offline\", offlineListener);\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(this.setOnline.bind(this));\n }\n setOnline(online) {\n const changed = this.#online !== online;\n if (changed) {\n this.#online = online;\n this.listeners.forEach((listener) => {\n listener(online);\n });\n }\n }\n isOnline() {\n return this.#online;\n }\n};\nvar onlineManager = new OnlineManager();\nexport {\n OnlineManager,\n onlineManager\n};\n//# sourceMappingURL=onlineManager.js.map"],"names":[],"mappings":";AAEG,IAAC,gBAAgB,cAAc,aAAa;AAAA,EAC7C,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,cAAc;AACZ,UAAK;AACL,SAAK,SAAS,CAAC,aAAa;AAC1B,UAAI,OAAO,WAAW,eAAe,OAAO,kBAAkB;AAC5D,cAAM,iBAAiB,MAAM,SAAS,IAAI;AAC1C,cAAM,kBAAkB,MAAM,SAAS,KAAK;AAC5C,eAAO,iBAAiB,UAAU,gBAAgB,KAAK;AACvD,eAAO,iBAAiB,WAAW,iBAAiB,KAAK;AACzD,eAAO,MAAM;AACX,iBAAO,oBAAoB,UAAU,cAAc;AACnD,iBAAO,oBAAoB,WAAW,eAAe;AAAA,QACvD;AAAA,MACF;AACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,cAAc;AACZ,QAAI,CAAC,KAAK,UAAU;AAClB,WAAK,iBAAiB,KAAK,MAAM;AAAA,IACnC;AAAA,EACF;AAAA,EACA,gBAAgB;AACd,QAAI,CAAC,KAAK,gBAAgB;AACxB,WAAK,WAAQ;AACb,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA,EACA,iBAAiB,OAAO;AACtB,SAAK,SAAS;AACd,SAAK,WAAQ;AACb,SAAK,WAAW,MAAM,KAAK,UAAU,KAAK,IAAI,CAAC;AAAA,EACjD;AAAA,EACA,UAAU,QAAQ;AAChB,UAAM,UAAU,KAAK,YAAY;AACjC,QAAI,SAAS;AACX,WAAK,UAAU;AACf,WAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,iBAAS,MAAM;AAAA,MACjB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EACA,WAAW;AACT,WAAO,KAAK;AAAA,EACd;AACF;AACG,IAAC,gBAAgB,IAAI,cAAa;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/query.js"],"sourcesContent":["// src/query.ts\nimport {\n ensureQueryFn,\n noop,\n replaceData,\n resolveEnabled,\n resolveStaleTime,\n skipToken,\n timeUntilStale\n} from \"./utils.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { CancelledError, canFetch, createRetryer } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\nvar Query = class extends Removable {\n #initialState;\n #revertState;\n #cache;\n #client;\n #retryer;\n #defaultOptions;\n #abortSignalConsumed;\n constructor(config) {\n super();\n this.#abortSignalConsumed = false;\n this.#defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.#client = config.client;\n this.#cache = this.#client.getQueryCache();\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.#initialState = getDefaultState(this.options);\n this.state = config.state ?? this.#initialState;\n this.scheduleGc();\n }\n get meta() {\n return this.options.meta;\n }\n get promise() {\n return this.#retryer?.promise;\n }\n setOptions(options) {\n this.options = { ...this.#defaultOptions, ...options };\n this.updateGcTime(this.options.gcTime);\n if (this.state && this.state.data === void 0) {\n const defaultState = getDefaultState(this.options);\n if (defaultState.data !== void 0) {\n this.setState(\n successState(defaultState.data, defaultState.dataUpdatedAt)\n );\n this.#initialState = defaultState;\n }\n }\n }\n optionalRemove() {\n if (!this.observers.length && this.state.fetchStatus === \"idle\") {\n this.#cache.remove(this);\n }\n }\n setData(newData, options) {\n const data = replaceData(this.state.data, newData, this.options);\n this.#dispatch({\n data,\n type: \"success\",\n dataUpdatedAt: options?.updatedAt,\n manual: options?.manual\n });\n return data;\n }\n setState(state, setStateOptions) {\n this.#dispatch({ type: \"setState\", state, setStateOptions });\n }\n cancel(options) {\n const promise = this.#retryer?.promise;\n this.#retryer?.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n }\n destroy() {\n super.destroy();\n this.cancel({ silent: true });\n }\n reset() {\n this.destroy();\n this.setState(this.#initialState);\n }\n isActive() {\n return this.observers.some(\n (observer) => resolveEnabled(observer.options.enabled, this) !== false\n );\n }\n isDisabled() {\n if (this.getObserversCount() > 0) {\n return !this.isActive();\n }\n return this.options.queryFn === skipToken || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;\n }\n isStatic() {\n if (this.getObserversCount() > 0) {\n return this.observers.some(\n (observer) => resolveStaleTime(observer.options.staleTime, this) === \"static\"\n );\n }\n return false;\n }\n isStale() {\n if (this.getObserversCount() > 0) {\n return this.observers.some(\n (observer) => observer.getCurrentResult().isStale\n );\n }\n return this.state.data === void 0 || this.state.isInvalidated;\n }\n isStaleByTime(staleTime = 0) {\n if (this.state.data === void 0) {\n return true;\n }\n if (staleTime === \"static\") {\n return false;\n }\n if (this.state.isInvalidated) {\n return true;\n }\n return !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n }\n onFocus() {\n const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());\n observer?.refetch({ cancelRefetch: false });\n this.#retryer?.continue();\n }\n onOnline() {\n const observer = this.observers.find((x) => x.shouldFetchOnReconnect());\n observer?.refetch({ cancelRefetch: false });\n this.#retryer?.continue();\n }\n addObserver(observer) {\n if (!this.observers.includes(observer)) {\n this.observers.push(observer);\n this.clearGcTimeout();\n this.#cache.notify({ type: \"observerAdded\", query: this, observer });\n }\n }\n removeObserver(observer) {\n if (this.observers.includes(observer)) {\n this.observers = this.observers.filter((x) => x !== observer);\n if (!this.observers.length) {\n if (this.#retryer) {\n if (this.#abortSignalConsumed) {\n this.#retryer.cancel({ revert: true });\n } else {\n this.#retryer.cancelRetry();\n }\n }\n this.scheduleGc();\n }\n this.#cache.notify({ type: \"observerRemoved\", query: this, observer });\n }\n }\n getObserversCount() {\n return this.observers.length;\n }\n invalidate() {\n if (!this.state.isInvalidated) {\n this.#dispatch({ type: \"invalidate\" });\n }\n }\n async fetch(options, fetchOptions) {\n if (this.state.fetchStatus !== \"idle\" && // If the promise in the retryer is already rejected, we have to definitely\n // re-start the fetch; there is a chance that the query is still in a\n // pending state when that happens\n this.#retryer?.status() !== \"rejected\") {\n if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {\n this.cancel({ silent: true });\n } else if (this.#retryer) {\n this.#retryer.continueRetry();\n return this.#retryer.promise;\n }\n }\n if (options) {\n this.setOptions(options);\n }\n if (!this.options.queryFn) {\n const observer = this.observers.find((x) => x.options.queryFn);\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (!Array.isArray(this.options.queryKey)) {\n console.error(\n `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`\n );\n }\n }\n const abortController = new AbortController();\n const addSignalProperty = (object) => {\n Object.defineProperty(object, \"signal\", {\n enumerable: true,\n get: () => {\n this.#abortSignalConsumed = true;\n return abortController.signal;\n }\n });\n };\n const fetchFn = () => {\n const queryFn = ensureQueryFn(this.options, fetchOptions);\n const createQueryFnContext = () => {\n const queryFnContext2 = {\n client: this.#client,\n queryKey: this.queryKey,\n meta: this.meta\n };\n addSignalProperty(queryFnContext2);\n return queryFnContext2;\n };\n const queryFnContext = createQueryFnContext();\n this.#abortSignalConsumed = false;\n if (this.options.persister) {\n return this.options.persister(\n queryFn,\n queryFnContext,\n this\n );\n }\n return queryFn(queryFnContext);\n };\n const createFetchContext = () => {\n const context2 = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n client: this.#client,\n state: this.state,\n fetchFn\n };\n addSignalProperty(context2);\n return context2;\n };\n const context = createFetchContext();\n this.options.behavior?.onFetch(context, this);\n this.#revertState = this.state;\n if (this.state.fetchStatus === \"idle\" || this.state.fetchMeta !== context.fetchOptions?.meta) {\n this.#dispatch({ type: \"fetch\", meta: context.fetchOptions?.meta });\n }\n this.#retryer = createRetryer({\n initialPromise: fetchOptions?.initialPromise,\n fn: context.fetchFn,\n onCancel: (error) => {\n if (error instanceof CancelledError && error.revert) {\n this.setState({\n ...this.#revertState,\n fetchStatus: \"idle\"\n });\n }\n abortController.abort();\n },\n onFail: (failureCount, error) => {\n this.#dispatch({ type: \"failed\", failureCount, error });\n },\n onPause: () => {\n this.#dispatch({ type: \"pause\" });\n },\n onContinue: () => {\n this.#dispatch({ type: \"continue\" });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode,\n canRun: () => true\n });\n try {\n const data = await this.#retryer.start();\n if (data === void 0) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\n `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`\n );\n }\n throw new Error(`${this.queryHash} data is undefined`);\n }\n this.setData(data);\n this.#cache.config.onSuccess?.(data, this);\n this.#cache.config.onSettled?.(\n data,\n this.state.error,\n this\n );\n return data;\n } catch (error) {\n if (error instanceof CancelledError) {\n if (error.silent) {\n return this.#retryer.promise;\n } else if (error.revert) {\n if (this.state.data === void 0) {\n throw error;\n }\n return this.state.data;\n }\n }\n this.#dispatch({\n type: \"error\",\n error\n });\n this.#cache.config.onError?.(\n error,\n this\n );\n this.#cache.config.onSettled?.(\n this.state.data,\n error,\n this\n );\n throw error;\n } finally {\n this.scheduleGc();\n }\n }\n #dispatch(action) {\n const reducer = (state) => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n fetchFailureCount: action.failureCount,\n fetchFailureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n fetchStatus: \"paused\"\n };\n case \"continue\":\n return {\n ...state,\n fetchStatus: \"fetching\"\n };\n case \"fetch\":\n return {\n ...state,\n ...fetchState(state.data, this.options),\n fetchMeta: action.meta ?? null\n };\n case \"success\":\n const newState = {\n ...state,\n ...successState(action.data, action.dataUpdatedAt),\n dataUpdateCount: state.dataUpdateCount + 1,\n ...!action.manual && {\n fetchStatus: \"idle\",\n fetchFailureCount: 0,\n fetchFailureReason: null\n }\n };\n this.#revertState = action.manual ? newState : void 0;\n return newState;\n case \"error\":\n const error = action.error;\n return {\n ...state,\n error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchFailureReason: error,\n fetchStatus: \"idle\",\n status: \"error\",\n // flag existing data as invalidated if we get a background error\n // note that \"no data\" always means stale so we can set unconditionally here\n isInvalidated: true\n };\n case \"invalidate\":\n return {\n ...state,\n isInvalidated: true\n };\n case \"setState\":\n return {\n ...state,\n ...action.state\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach((observer) => {\n observer.onQueryUpdate();\n });\n this.#cache.notify({ query: this, type: \"updated\", action });\n });\n }\n};\nfunction fetchState(data, options) {\n return {\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchStatus: canFetch(options.networkMode) ? \"fetching\" : \"paused\",\n ...data === void 0 && {\n error: null,\n status: \"pending\"\n }\n };\n}\nfunction successState(data, dataUpdatedAt) {\n return {\n data,\n dataUpdatedAt: dataUpdatedAt ?? Date.now(),\n error: null,\n isInvalidated: false,\n status: \"success\"\n };\n}\nfunction getDefaultState(options) {\n const data = typeof options.initialData === \"function\" ? options.initialData() : options.initialData;\n const hasData = data !== void 0;\n const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === \"function\" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? \"success\" : \"pending\",\n fetchStatus: \"idle\"\n };\n}\nexport {\n Query,\n fetchState\n};\n//# sourceMappingURL=query.js.map"],"names":[],"mappings":";AAsYA,SAAS,WAAW,MAAM,SAAS;AACjC,SAAO;AAAA,IACL,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,aAAa,SAAS,QAAQ,WAAW,IAAI,aAAa;AAAA,IAC1D,GAAG,SAAS,UAAU;AAAA,MACpB,OAAO;AAAA,MACP,QAAQ;AAAA,IACd;AAAA,EACA;AACA;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"query.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/query.js"],"sourcesContent":["// src/query.ts\nimport {\n ensureQueryFn,\n noop,\n replaceData,\n resolveEnabled,\n resolveStaleTime,\n skipToken,\n timeUntilStale\n} from \"./utils.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { CancelledError, canFetch, createRetryer } from \"./retryer.js\";\nimport { Removable } from \"./removable.js\";\nvar Query = class extends Removable {\n #initialState;\n #revertState;\n #cache;\n #client;\n #retryer;\n #defaultOptions;\n #abortSignalConsumed;\n constructor(config) {\n super();\n this.#abortSignalConsumed = false;\n this.#defaultOptions = config.defaultOptions;\n this.setOptions(config.options);\n this.observers = [];\n this.#client = config.client;\n this.#cache = this.#client.getQueryCache();\n this.queryKey = config.queryKey;\n this.queryHash = config.queryHash;\n this.#initialState = getDefaultState(this.options);\n this.state = config.state ?? this.#initialState;\n this.scheduleGc();\n }\n get meta() {\n return this.options.meta;\n }\n get promise() {\n return this.#retryer?.promise;\n }\n setOptions(options) {\n this.options = { ...this.#defaultOptions, ...options };\n this.updateGcTime(this.options.gcTime);\n if (this.state && this.state.data === void 0) {\n const defaultState = getDefaultState(this.options);\n if (defaultState.data !== void 0) {\n this.setState(\n successState(defaultState.data, defaultState.dataUpdatedAt)\n );\n this.#initialState = defaultState;\n }\n }\n }\n optionalRemove() {\n if (!this.observers.length && this.state.fetchStatus === \"idle\") {\n this.#cache.remove(this);\n }\n }\n setData(newData, options) {\n const data = replaceData(this.state.data, newData, this.options);\n this.#dispatch({\n data,\n type: \"success\",\n dataUpdatedAt: options?.updatedAt,\n manual: options?.manual\n });\n return data;\n }\n setState(state, setStateOptions) {\n this.#dispatch({ type: \"setState\", state, setStateOptions });\n }\n cancel(options) {\n const promise = this.#retryer?.promise;\n this.#retryer?.cancel(options);\n return promise ? promise.then(noop).catch(noop) : Promise.resolve();\n }\n destroy() {\n super.destroy();\n this.cancel({ silent: true });\n }\n get resetState() {\n return this.#initialState;\n }\n reset() {\n this.destroy();\n this.setState(this.resetState);\n }\n isActive() {\n return this.observers.some(\n (observer) => resolveEnabled(observer.options.enabled, this) !== false\n );\n }\n isDisabled() {\n if (this.getObserversCount() > 0) {\n return !this.isActive();\n }\n return this.options.queryFn === skipToken || !this.isFetched();\n }\n isFetched() {\n return this.state.dataUpdateCount + this.state.errorUpdateCount > 0;\n }\n isStatic() {\n if (this.getObserversCount() > 0) {\n return this.observers.some(\n (observer) => resolveStaleTime(observer.options.staleTime, this) === \"static\"\n );\n }\n return false;\n }\n isStale() {\n if (this.getObserversCount() > 0) {\n return this.observers.some(\n (observer) => observer.getCurrentResult().isStale\n );\n }\n return this.state.data === void 0 || this.state.isInvalidated;\n }\n isStaleByTime(staleTime = 0) {\n if (this.state.data === void 0) {\n return true;\n }\n if (staleTime === \"static\") {\n return false;\n }\n if (this.state.isInvalidated) {\n return true;\n }\n return !timeUntilStale(this.state.dataUpdatedAt, staleTime);\n }\n onFocus() {\n const observer = this.observers.find((x) => x.shouldFetchOnWindowFocus());\n observer?.refetch({ cancelRefetch: false });\n this.#retryer?.continue();\n }\n onOnline() {\n const observer = this.observers.find((x) => x.shouldFetchOnReconnect());\n observer?.refetch({ cancelRefetch: false });\n this.#retryer?.continue();\n }\n addObserver(observer) {\n if (!this.observers.includes(observer)) {\n this.observers.push(observer);\n this.clearGcTimeout();\n this.#cache.notify({ type: \"observerAdded\", query: this, observer });\n }\n }\n removeObserver(observer) {\n if (this.observers.includes(observer)) {\n this.observers = this.observers.filter((x) => x !== observer);\n if (!this.observers.length) {\n if (this.#retryer) {\n if (this.#abortSignalConsumed || this.#isInitialPausedFetch()) {\n this.#retryer.cancel({ revert: true });\n } else {\n this.#retryer.cancelRetry();\n }\n }\n this.scheduleGc();\n }\n this.#cache.notify({ type: \"observerRemoved\", query: this, observer });\n }\n }\n getObserversCount() {\n return this.observers.length;\n }\n #isInitialPausedFetch() {\n return this.state.fetchStatus === \"paused\" && this.state.status === \"pending\";\n }\n invalidate() {\n if (!this.state.isInvalidated) {\n this.#dispatch({ type: \"invalidate\" });\n }\n }\n async fetch(options, fetchOptions) {\n if (this.state.fetchStatus !== \"idle\" && // If the promise in the retryer is already rejected, we have to definitely\n // re-start the fetch; there is a chance that the query is still in a\n // pending state when that happens\n this.#retryer?.status() !== \"rejected\") {\n if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {\n this.cancel({ silent: true });\n } else if (this.#retryer) {\n this.#retryer.continueRetry();\n return this.#retryer.promise;\n }\n }\n if (options) {\n this.setOptions(options);\n }\n if (!this.options.queryFn) {\n const observer = this.observers.find((x) => x.options.queryFn);\n if (observer) {\n this.setOptions(observer.options);\n }\n }\n if (process.env.NODE_ENV !== \"production\") {\n if (!Array.isArray(this.options.queryKey)) {\n console.error(\n `As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']`\n );\n }\n }\n const abortController = new AbortController();\n const addSignalProperty = (object) => {\n Object.defineProperty(object, \"signal\", {\n enumerable: true,\n get: () => {\n this.#abortSignalConsumed = true;\n return abortController.signal;\n }\n });\n };\n const fetchFn = () => {\n const queryFn = ensureQueryFn(this.options, fetchOptions);\n const createQueryFnContext = () => {\n const queryFnContext2 = {\n client: this.#client,\n queryKey: this.queryKey,\n meta: this.meta\n };\n addSignalProperty(queryFnContext2);\n return queryFnContext2;\n };\n const queryFnContext = createQueryFnContext();\n this.#abortSignalConsumed = false;\n if (this.options.persister) {\n return this.options.persister(\n queryFn,\n queryFnContext,\n this\n );\n }\n return queryFn(queryFnContext);\n };\n const createFetchContext = () => {\n const context2 = {\n fetchOptions,\n options: this.options,\n queryKey: this.queryKey,\n client: this.#client,\n state: this.state,\n fetchFn\n };\n addSignalProperty(context2);\n return context2;\n };\n const context = createFetchContext();\n this.options.behavior?.onFetch(context, this);\n this.#revertState = this.state;\n if (this.state.fetchStatus === \"idle\" || this.state.fetchMeta !== context.fetchOptions?.meta) {\n this.#dispatch({ type: \"fetch\", meta: context.fetchOptions?.meta });\n }\n this.#retryer = createRetryer({\n initialPromise: fetchOptions?.initialPromise,\n fn: context.fetchFn,\n onCancel: (error) => {\n if (error instanceof CancelledError && error.revert) {\n this.setState({\n ...this.#revertState,\n fetchStatus: \"idle\"\n });\n }\n abortController.abort();\n },\n onFail: (failureCount, error) => {\n this.#dispatch({ type: \"failed\", failureCount, error });\n },\n onPause: () => {\n this.#dispatch({ type: \"pause\" });\n },\n onContinue: () => {\n this.#dispatch({ type: \"continue\" });\n },\n retry: context.options.retry,\n retryDelay: context.options.retryDelay,\n networkMode: context.options.networkMode,\n canRun: () => true\n });\n try {\n const data = await this.#retryer.start();\n if (data === void 0) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(\n `Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`\n );\n }\n throw new Error(`${this.queryHash} data is undefined`);\n }\n this.setData(data);\n this.#cache.config.onSuccess?.(data, this);\n this.#cache.config.onSettled?.(\n data,\n this.state.error,\n this\n );\n return data;\n } catch (error) {\n if (error instanceof CancelledError) {\n if (error.silent) {\n return this.#retryer.promise;\n } else if (error.revert) {\n if (this.state.data === void 0) {\n throw error;\n }\n return this.state.data;\n }\n }\n this.#dispatch({\n type: \"error\",\n error\n });\n this.#cache.config.onError?.(\n error,\n this\n );\n this.#cache.config.onSettled?.(\n this.state.data,\n error,\n this\n );\n throw error;\n } finally {\n this.scheduleGc();\n }\n }\n #dispatch(action) {\n const reducer = (state) => {\n switch (action.type) {\n case \"failed\":\n return {\n ...state,\n fetchFailureCount: action.failureCount,\n fetchFailureReason: action.error\n };\n case \"pause\":\n return {\n ...state,\n fetchStatus: \"paused\"\n };\n case \"continue\":\n return {\n ...state,\n fetchStatus: \"fetching\"\n };\n case \"fetch\":\n return {\n ...state,\n ...fetchState(state.data, this.options),\n fetchMeta: action.meta ?? null\n };\n case \"success\":\n const newState = {\n ...state,\n ...successState(action.data, action.dataUpdatedAt),\n dataUpdateCount: state.dataUpdateCount + 1,\n ...!action.manual && {\n fetchStatus: \"idle\",\n fetchFailureCount: 0,\n fetchFailureReason: null\n }\n };\n this.#revertState = action.manual ? newState : void 0;\n return newState;\n case \"error\":\n const error = action.error;\n return {\n ...state,\n error,\n errorUpdateCount: state.errorUpdateCount + 1,\n errorUpdatedAt: Date.now(),\n fetchFailureCount: state.fetchFailureCount + 1,\n fetchFailureReason: error,\n fetchStatus: \"idle\",\n status: \"error\",\n // flag existing data as invalidated if we get a background error\n // note that \"no data\" always means stale so we can set unconditionally here\n isInvalidated: true\n };\n case \"invalidate\":\n return {\n ...state,\n isInvalidated: true\n };\n case \"setState\":\n return {\n ...state,\n ...action.state\n };\n }\n };\n this.state = reducer(this.state);\n notifyManager.batch(() => {\n this.observers.forEach((observer) => {\n observer.onQueryUpdate();\n });\n this.#cache.notify({ query: this, type: \"updated\", action });\n });\n }\n};\nfunction fetchState(data, options) {\n return {\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchStatus: canFetch(options.networkMode) ? \"fetching\" : \"paused\",\n ...data === void 0 && {\n error: null,\n status: \"pending\"\n }\n };\n}\nfunction successState(data, dataUpdatedAt) {\n return {\n data,\n dataUpdatedAt: dataUpdatedAt ?? Date.now(),\n error: null,\n isInvalidated: false,\n status: \"success\"\n };\n}\nfunction getDefaultState(options) {\n const data = typeof options.initialData === \"function\" ? options.initialData() : options.initialData;\n const hasData = data !== void 0;\n const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === \"function\" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;\n return {\n data,\n dataUpdateCount: 0,\n dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,\n error: null,\n errorUpdateCount: 0,\n errorUpdatedAt: 0,\n fetchFailureCount: 0,\n fetchFailureReason: null,\n fetchMeta: null,\n isInvalidated: false,\n status: hasData ? \"success\" : \"pending\",\n fetchStatus: \"idle\"\n };\n}\nexport {\n Query,\n fetchState\n};\n//# sourceMappingURL=query.js.map"],"names":[],"mappings":";AA+YA,SAAS,WAAW,MAAM,SAAS;AACjC,SAAO;AAAA,IACL,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,aAAa,SAAS,QAAQ,WAAW,IAAI,aAAa;AAAA,IAC1D,GAAG,SAAS,UAAU;AAAA,MACpB,OAAO;AAAA,MACP,QAAQ;AAAA,IACd;AAAA,EACA;AACA;","x_google_ignoreList":[0]}
@@ -1,9 +1,10 @@
1
1
  import { focusManager } from "./focusManager.js";
2
+ import { environmentManager } from "./environmentManager.js";
2
3
  import { notifyManager } from "./notifyManager.js";
3
4
  import { fetchState } from "./query.js";
4
5
  import { Subscribable } from "./subscribable.js";
5
6
  import { pendingThenable } from "./thenable.js";
6
- import { resolveEnabled, shallowEqualObjects, resolveStaleTime, noop, isServer, isValidTimeout, timeUntilStale, replaceData } from "./utils.js";
7
+ import { resolveEnabled, shallowEqualObjects, resolveStaleTime, noop, isValidTimeout, timeUntilStale, replaceData } from "./utils.js";
7
8
  import { timeoutManager } from "./timeoutManager.js";
8
9
  var QueryObserver = class extends Subscribable {
9
10
  constructor(client, options) {
@@ -181,7 +182,7 @@ var QueryObserver = class extends Subscribable {
181
182
  this.options.staleTime,
182
183
  this.#currentQuery
183
184
  );
184
- if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
185
+ if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
185
186
  return;
186
187
  }
187
188
  const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
@@ -198,7 +199,7 @@ var QueryObserver = class extends Subscribable {
198
199
  #updateRefetchInterval(nextInterval) {
199
200
  this.#clearRefetchInterval();
200
201
  this.#currentRefetchInterval = nextInterval;
201
- if (isServer || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
202
+ if (environmentManager.isServer() || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
202
203
  return;
203
204
  }
204
205
  this.#refetchIntervalId = timeoutManager.setInterval(() => {
@@ -314,7 +315,7 @@ var QueryObserver = class extends Subscribable {
314
315
  failureCount: newState.fetchFailureCount,
315
316
  failureReason: newState.fetchFailureReason,
316
317
  errorUpdateCount: newState.errorUpdateCount,
317
- isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
318
+ isFetched: query.isFetched(),
318
319
  isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
319
320
  isFetching,
320
321
  isRefetching: isFetching && !isPending,
@@ -1 +1 @@
1
- {"version":3,"file":"queryObserver.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/queryObserver.js"],"sourcesContent":["// src/queryObserver.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { fetchState } from \"./query.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport {\n isServer,\n isValidTimeout,\n noop,\n replaceData,\n resolveEnabled,\n resolveStaleTime,\n shallowEqualObjects,\n timeUntilStale\n} from \"./utils.js\";\nimport { timeoutManager } from \"./timeoutManager.js\";\nvar QueryObserver = class extends Subscribable {\n constructor(client, options) {\n super();\n this.options = options;\n this.#client = client;\n this.#selectError = null;\n this.#currentThenable = pendingThenable();\n this.bindMethods();\n this.setOptions(options);\n }\n #client;\n #currentQuery = void 0;\n #currentQueryInitialState = void 0;\n #currentResult = void 0;\n #currentResultState;\n #currentResultOptions;\n #currentThenable;\n #selectError;\n #selectFn;\n #selectResult;\n // This property keeps track of the last query with defined data.\n // It will be used to pass the previous data and query to the placeholder function between renders.\n #lastQueryWithDefinedData;\n #staleTimeoutId;\n #refetchIntervalId;\n #currentRefetchInterval;\n #trackedProps = /* @__PURE__ */ new Set();\n bindMethods() {\n this.refetch = this.refetch.bind(this);\n }\n onSubscribe() {\n if (this.listeners.size === 1) {\n this.#currentQuery.addObserver(this);\n if (shouldFetchOnMount(this.#currentQuery, this.options)) {\n this.#executeFetch();\n } else {\n this.updateResult();\n }\n this.#updateTimers();\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.destroy();\n }\n }\n shouldFetchOnReconnect() {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnReconnect\n );\n }\n shouldFetchOnWindowFocus() {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnWindowFocus\n );\n }\n destroy() {\n this.listeners = /* @__PURE__ */ new Set();\n this.#clearStaleTimeout();\n this.#clearRefetchInterval();\n this.#currentQuery.removeObserver(this);\n }\n setOptions(options) {\n const prevOptions = this.options;\n const prevQuery = this.#currentQuery;\n this.options = this.#client.defaultQueryOptions(options);\n if (this.options.enabled !== void 0 && typeof this.options.enabled !== \"boolean\" && typeof this.options.enabled !== \"function\" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== \"boolean\") {\n throw new Error(\n \"Expected enabled to be a boolean or a callback that returns a boolean\"\n );\n }\n this.#updateQuery();\n this.#currentQuery.setOptions(this.options);\n if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getQueryCache().notify({\n type: \"observerOptionsUpdated\",\n query: this.#currentQuery,\n observer: this\n });\n }\n const mounted = this.hasListeners();\n if (mounted && shouldFetchOptionally(\n this.#currentQuery,\n prevQuery,\n this.options,\n prevOptions\n )) {\n this.#executeFetch();\n }\n this.updateResult();\n if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {\n this.#updateStaleTimeout();\n }\n const nextRefetchInterval = this.#computeRefetchInterval();\n if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {\n this.#updateRefetchInterval(nextRefetchInterval);\n }\n }\n getOptimisticResult(options) {\n const query = this.#client.getQueryCache().build(this.#client, options);\n const result = this.createResult(query, options);\n if (shouldAssignObserverCurrentProperties(this, result)) {\n this.#currentResult = result;\n this.#currentResultOptions = this.options;\n this.#currentResultState = this.#currentQuery.state;\n }\n return result;\n }\n getCurrentResult() {\n return this.#currentResult;\n }\n trackResult(result, onPropTracked) {\n return new Proxy(result, {\n get: (target, key) => {\n this.trackProp(key);\n onPropTracked?.(key);\n if (key === \"promise\") {\n this.trackProp(\"data\");\n if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === \"pending\") {\n this.#currentThenable.reject(\n new Error(\n \"experimental_prefetchInRender feature flag is not enabled\"\n )\n );\n }\n }\n return Reflect.get(target, key);\n }\n });\n }\n trackProp(key) {\n this.#trackedProps.add(key);\n }\n getCurrentQuery() {\n return this.#currentQuery;\n }\n refetch({ ...options } = {}) {\n return this.fetch({\n ...options\n });\n }\n fetchOptimistic(options) {\n const defaultedOptions = this.#client.defaultQueryOptions(options);\n const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);\n return query.fetch().then(() => this.createResult(query, defaultedOptions));\n }\n fetch(fetchOptions) {\n return this.#executeFetch({\n ...fetchOptions,\n cancelRefetch: fetchOptions.cancelRefetch ?? true\n }).then(() => {\n this.updateResult();\n return this.#currentResult;\n });\n }\n #executeFetch(fetchOptions) {\n this.#updateQuery();\n let promise = this.#currentQuery.fetch(\n this.options,\n fetchOptions\n );\n if (!fetchOptions?.throwOnError) {\n promise = promise.catch(noop);\n }\n return promise;\n }\n #updateStaleTimeout() {\n this.#clearStaleTimeout();\n const staleTime = resolveStaleTime(\n this.options.staleTime,\n this.#currentQuery\n );\n if (isServer || this.#currentResult.isStale || !isValidTimeout(staleTime)) {\n return;\n }\n const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);\n const timeout = time + 1;\n this.#staleTimeoutId = timeoutManager.setTimeout(() => {\n if (!this.#currentResult.isStale) {\n this.updateResult();\n }\n }, timeout);\n }\n #computeRefetchInterval() {\n return (typeof this.options.refetchInterval === \"function\" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;\n }\n #updateRefetchInterval(nextInterval) {\n this.#clearRefetchInterval();\n this.#currentRefetchInterval = nextInterval;\n if (isServer || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {\n return;\n }\n this.#refetchIntervalId = timeoutManager.setInterval(() => {\n if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {\n this.#executeFetch();\n }\n }, this.#currentRefetchInterval);\n }\n #updateTimers() {\n this.#updateStaleTimeout();\n this.#updateRefetchInterval(this.#computeRefetchInterval());\n }\n #clearStaleTimeout() {\n if (this.#staleTimeoutId) {\n timeoutManager.clearTimeout(this.#staleTimeoutId);\n this.#staleTimeoutId = void 0;\n }\n }\n #clearRefetchInterval() {\n if (this.#refetchIntervalId) {\n timeoutManager.clearInterval(this.#refetchIntervalId);\n this.#refetchIntervalId = void 0;\n }\n }\n createResult(query, options) {\n const prevQuery = this.#currentQuery;\n const prevOptions = this.options;\n const prevResult = this.#currentResult;\n const prevResultState = this.#currentResultState;\n const prevResultOptions = this.#currentResultOptions;\n const queryChange = query !== prevQuery;\n const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;\n const { state } = query;\n let newState = { ...state };\n let isPlaceholderData = false;\n let data;\n if (options._optimisticResults) {\n const mounted = this.hasListeners();\n const fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n if (fetchOnMount || fetchOptionally) {\n newState = {\n ...newState,\n ...fetchState(state.data, query.options)\n };\n }\n if (options._optimisticResults === \"isRestoring\") {\n newState.fetchStatus = \"idle\";\n }\n }\n let { error, errorUpdatedAt, status } = newState;\n data = newState.data;\n let skipSelect = false;\n if (options.placeholderData !== void 0 && data === void 0 && status === \"pending\") {\n let placeholderData;\n if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {\n placeholderData = prevResult.data;\n skipSelect = true;\n } else {\n placeholderData = typeof options.placeholderData === \"function\" ? options.placeholderData(\n this.#lastQueryWithDefinedData?.state.data,\n this.#lastQueryWithDefinedData\n ) : options.placeholderData;\n }\n if (placeholderData !== void 0) {\n status = \"success\";\n data = replaceData(\n prevResult?.data,\n placeholderData,\n options\n );\n isPlaceholderData = true;\n }\n }\n if (options.select && data !== void 0 && !skipSelect) {\n if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) {\n data = this.#selectResult;\n } else {\n try {\n this.#selectFn = options.select;\n data = options.select(data);\n data = replaceData(prevResult?.data, data, options);\n this.#selectResult = data;\n this.#selectError = null;\n } catch (selectError) {\n this.#selectError = selectError;\n }\n }\n }\n if (this.#selectError) {\n error = this.#selectError;\n data = this.#selectResult;\n errorUpdatedAt = Date.now();\n status = \"error\";\n }\n const isFetching = newState.fetchStatus === \"fetching\";\n const isPending = status === \"pending\";\n const isError = status === \"error\";\n const isLoading = isPending && isFetching;\n const hasData = data !== void 0;\n const result = {\n status,\n fetchStatus: newState.fetchStatus,\n isPending,\n isSuccess: status === \"success\",\n isError,\n isInitialLoading: isLoading,\n isLoading,\n data,\n dataUpdatedAt: newState.dataUpdatedAt,\n error,\n errorUpdatedAt,\n failureCount: newState.fetchFailureCount,\n failureReason: newState.fetchFailureReason,\n errorUpdateCount: newState.errorUpdateCount,\n isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,\n isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching,\n isRefetching: isFetching && !isPending,\n isLoadingError: isError && !hasData,\n isPaused: newState.fetchStatus === \"paused\",\n isPlaceholderData,\n isRefetchError: isError && hasData,\n isStale: isStale(query, options),\n refetch: this.refetch,\n promise: this.#currentThenable,\n isEnabled: resolveEnabled(options.enabled, query) !== false\n };\n const nextResult = result;\n if (this.options.experimental_prefetchInRender) {\n const hasResultData = nextResult.data !== void 0;\n const isErrorWithoutData = nextResult.status === \"error\" && !hasResultData;\n const finalizeThenableIfPossible = (thenable) => {\n if (isErrorWithoutData) {\n thenable.reject(nextResult.error);\n } else if (hasResultData) {\n thenable.resolve(nextResult.data);\n }\n };\n const recreateThenable = () => {\n const pending = this.#currentThenable = nextResult.promise = pendingThenable();\n finalizeThenableIfPossible(pending);\n };\n const prevThenable = this.#currentThenable;\n switch (prevThenable.status) {\n case \"pending\":\n if (query.queryHash === prevQuery.queryHash) {\n finalizeThenableIfPossible(prevThenable);\n }\n break;\n case \"fulfilled\":\n if (isErrorWithoutData || nextResult.data !== prevThenable.value) {\n recreateThenable();\n }\n break;\n case \"rejected\":\n if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {\n recreateThenable();\n }\n break;\n }\n }\n return nextResult;\n }\n updateResult() {\n const prevResult = this.#currentResult;\n const nextResult = this.createResult(this.#currentQuery, this.options);\n this.#currentResultState = this.#currentQuery.state;\n this.#currentResultOptions = this.options;\n if (this.#currentResultState.data !== void 0) {\n this.#lastQueryWithDefinedData = this.#currentQuery;\n }\n if (shallowEqualObjects(nextResult, prevResult)) {\n return;\n }\n this.#currentResult = nextResult;\n const shouldNotifyListeners = () => {\n if (!prevResult) {\n return true;\n }\n const { notifyOnChangeProps } = this.options;\n const notifyOnChangePropsValue = typeof notifyOnChangeProps === \"function\" ? notifyOnChangeProps() : notifyOnChangeProps;\n if (notifyOnChangePropsValue === \"all\" || !notifyOnChangePropsValue && !this.#trackedProps.size) {\n return true;\n }\n const includedProps = new Set(\n notifyOnChangePropsValue ?? this.#trackedProps\n );\n if (this.options.throwOnError) {\n includedProps.add(\"error\");\n }\n return Object.keys(this.#currentResult).some((key) => {\n const typedKey = key;\n const changed = this.#currentResult[typedKey] !== prevResult[typedKey];\n return changed && includedProps.has(typedKey);\n });\n };\n this.#notify({ listeners: shouldNotifyListeners() });\n }\n #updateQuery() {\n const query = this.#client.getQueryCache().build(this.#client, this.options);\n if (query === this.#currentQuery) {\n return;\n }\n const prevQuery = this.#currentQuery;\n this.#currentQuery = query;\n this.#currentQueryInitialState = query.state;\n if (this.hasListeners()) {\n prevQuery?.removeObserver(this);\n query.addObserver(this);\n }\n }\n onQueryUpdate() {\n this.updateResult();\n if (this.hasListeners()) {\n this.#updateTimers();\n }\n }\n #notify(notifyOptions) {\n notifyManager.batch(() => {\n if (notifyOptions.listeners) {\n this.listeners.forEach((listener) => {\n listener(this.#currentResult);\n });\n }\n this.#client.getQueryCache().notify({\n query: this.#currentQuery,\n type: \"observerResultsUpdated\"\n });\n });\n }\n};\nfunction shouldLoadOnMount(query, options) {\n return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === \"error\" && options.retryOnMount === false);\n}\nfunction shouldFetchOnMount(query, options) {\n return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\nfunction shouldFetchOn(query, options, field) {\n if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== \"static\") {\n const value = typeof field === \"function\" ? field(query) : field;\n return value === \"always\" || value !== false && isStale(query, options);\n }\n return false;\n}\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== \"error\") && isStale(query, options);\n}\nfunction isStale(query, options) {\n return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));\n}\nfunction shouldAssignObserverCurrentProperties(observer, optimisticResult) {\n if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {\n return true;\n }\n return false;\n}\nexport {\n QueryObserver\n};\n//# sourceMappingURL=queryObserver.js.map"],"names":[],"mappings":";;;;;;;AAiBG,IAAC,gBAAgB,cAAc,aAAa;AAAA,EAC7C,YAAY,QAAQ,SAAS;AAC3B,UAAK;AACL,SAAK,UAAU;AACf,SAAK,UAAU;AACf,SAAK,eAAe;AACpB,SAAK,mBAAmB,gBAAe;AACvC,SAAK,YAAW;AAChB,SAAK,WAAW,OAAO;AAAA,EACzB;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,4BAA4B;AAAA,EAC5B,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgC,oBAAI,IAAG;AAAA,EACvC,cAAc;AACZ,SAAK,UAAU,KAAK,QAAQ,KAAK,IAAI;AAAA,EACvC;AAAA,EACA,cAAc;AACZ,QAAI,KAAK,UAAU,SAAS,GAAG;AAC7B,WAAK,cAAc,YAAY,IAAI;AACnC,UAAI,mBAAmB,KAAK,eAAe,KAAK,OAAO,GAAG;AACxD,aAAK,cAAa;AAAA,MACpB,OAAO;AACL,aAAK,aAAY;AAAA,MACnB;AACA,WAAK,cAAa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I,eAAe,QAAQ,SAAS,KAAK,MAAM,SAAS,iBAAiB,QAAQ,WAAW,KAAK,MAAM,UAAU;AAC/G,UAAM,QAAQ,OAAO,UAAU,aAAa,MAAM,KAAK,IAAI;AAC3D,WAAO,UAAU,YAAY,UAAU,SAAS,QAAQ,OAAO,OAAO;AAAA,EACxE;AACA,SAAO;AACT;AACA,SAAS,sBAAsB,OAAO,WAAW,SAAS,aAAa;AACrE,UAAQ,UAAU,aAAa,eAAe,YAAY,SAAS,KAAK,MAAM,WAAW,CAAC,QAAQ,YAAY,MAAM,MAAM,WAAW,YAAY,QAAQ,OAAO,OAAO;AACzK;AACA,SAAS,QAAQ,OAAO,SAAS;AAC/B,SAAO,eAAe,QAAQ,SAAS,KAAK,MAAM,SAAS,MAAM,cAAc,iBAAiB,QAAQ,WAAW,KAAK,CAAC;AAC3H;AACA,SAAS,sCAAsC,UAAU,kBAAkB;AACzE,MAAI,CAAC,oBAAoB,SAAS,iBAAgB,GAAI,gBAAgB,GAAG;AACvE,WAAO;AAAA,EACT;AACA,SAAO;AACT;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"queryObserver.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/queryObserver.js"],"sourcesContent":["// src/queryObserver.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { environmentManager } from \"./environmentManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { fetchState } from \"./query.js\";\nimport { Subscribable } from \"./subscribable.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport {\n isValidTimeout,\n noop,\n replaceData,\n resolveEnabled,\n resolveStaleTime,\n shallowEqualObjects,\n timeUntilStale\n} from \"./utils.js\";\nimport { timeoutManager } from \"./timeoutManager.js\";\nvar QueryObserver = class extends Subscribable {\n constructor(client, options) {\n super();\n this.options = options;\n this.#client = client;\n this.#selectError = null;\n this.#currentThenable = pendingThenable();\n this.bindMethods();\n this.setOptions(options);\n }\n #client;\n #currentQuery = void 0;\n #currentQueryInitialState = void 0;\n #currentResult = void 0;\n #currentResultState;\n #currentResultOptions;\n #currentThenable;\n #selectError;\n #selectFn;\n #selectResult;\n // This property keeps track of the last query with defined data.\n // It will be used to pass the previous data and query to the placeholder function between renders.\n #lastQueryWithDefinedData;\n #staleTimeoutId;\n #refetchIntervalId;\n #currentRefetchInterval;\n #trackedProps = /* @__PURE__ */ new Set();\n bindMethods() {\n this.refetch = this.refetch.bind(this);\n }\n onSubscribe() {\n if (this.listeners.size === 1) {\n this.#currentQuery.addObserver(this);\n if (shouldFetchOnMount(this.#currentQuery, this.options)) {\n this.#executeFetch();\n } else {\n this.updateResult();\n }\n this.#updateTimers();\n }\n }\n onUnsubscribe() {\n if (!this.hasListeners()) {\n this.destroy();\n }\n }\n shouldFetchOnReconnect() {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnReconnect\n );\n }\n shouldFetchOnWindowFocus() {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnWindowFocus\n );\n }\n destroy() {\n this.listeners = /* @__PURE__ */ new Set();\n this.#clearStaleTimeout();\n this.#clearRefetchInterval();\n this.#currentQuery.removeObserver(this);\n }\n setOptions(options) {\n const prevOptions = this.options;\n const prevQuery = this.#currentQuery;\n this.options = this.#client.defaultQueryOptions(options);\n if (this.options.enabled !== void 0 && typeof this.options.enabled !== \"boolean\" && typeof this.options.enabled !== \"function\" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== \"boolean\") {\n throw new Error(\n \"Expected enabled to be a boolean or a callback that returns a boolean\"\n );\n }\n this.#updateQuery();\n this.#currentQuery.setOptions(this.options);\n if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getQueryCache().notify({\n type: \"observerOptionsUpdated\",\n query: this.#currentQuery,\n observer: this\n });\n }\n const mounted = this.hasListeners();\n if (mounted && shouldFetchOptionally(\n this.#currentQuery,\n prevQuery,\n this.options,\n prevOptions\n )) {\n this.#executeFetch();\n }\n this.updateResult();\n if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {\n this.#updateStaleTimeout();\n }\n const nextRefetchInterval = this.#computeRefetchInterval();\n if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {\n this.#updateRefetchInterval(nextRefetchInterval);\n }\n }\n getOptimisticResult(options) {\n const query = this.#client.getQueryCache().build(this.#client, options);\n const result = this.createResult(query, options);\n if (shouldAssignObserverCurrentProperties(this, result)) {\n this.#currentResult = result;\n this.#currentResultOptions = this.options;\n this.#currentResultState = this.#currentQuery.state;\n }\n return result;\n }\n getCurrentResult() {\n return this.#currentResult;\n }\n trackResult(result, onPropTracked) {\n return new Proxy(result, {\n get: (target, key) => {\n this.trackProp(key);\n onPropTracked?.(key);\n if (key === \"promise\") {\n this.trackProp(\"data\");\n if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === \"pending\") {\n this.#currentThenable.reject(\n new Error(\n \"experimental_prefetchInRender feature flag is not enabled\"\n )\n );\n }\n }\n return Reflect.get(target, key);\n }\n });\n }\n trackProp(key) {\n this.#trackedProps.add(key);\n }\n getCurrentQuery() {\n return this.#currentQuery;\n }\n refetch({ ...options } = {}) {\n return this.fetch({\n ...options\n });\n }\n fetchOptimistic(options) {\n const defaultedOptions = this.#client.defaultQueryOptions(options);\n const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);\n return query.fetch().then(() => this.createResult(query, defaultedOptions));\n }\n fetch(fetchOptions) {\n return this.#executeFetch({\n ...fetchOptions,\n cancelRefetch: fetchOptions.cancelRefetch ?? true\n }).then(() => {\n this.updateResult();\n return this.#currentResult;\n });\n }\n #executeFetch(fetchOptions) {\n this.#updateQuery();\n let promise = this.#currentQuery.fetch(\n this.options,\n fetchOptions\n );\n if (!fetchOptions?.throwOnError) {\n promise = promise.catch(noop);\n }\n return promise;\n }\n #updateStaleTimeout() {\n this.#clearStaleTimeout();\n const staleTime = resolveStaleTime(\n this.options.staleTime,\n this.#currentQuery\n );\n if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {\n return;\n }\n const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);\n const timeout = time + 1;\n this.#staleTimeoutId = timeoutManager.setTimeout(() => {\n if (!this.#currentResult.isStale) {\n this.updateResult();\n }\n }, timeout);\n }\n #computeRefetchInterval() {\n return (typeof this.options.refetchInterval === \"function\" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;\n }\n #updateRefetchInterval(nextInterval) {\n this.#clearRefetchInterval();\n this.#currentRefetchInterval = nextInterval;\n if (environmentManager.isServer() || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {\n return;\n }\n this.#refetchIntervalId = timeoutManager.setInterval(() => {\n if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {\n this.#executeFetch();\n }\n }, this.#currentRefetchInterval);\n }\n #updateTimers() {\n this.#updateStaleTimeout();\n this.#updateRefetchInterval(this.#computeRefetchInterval());\n }\n #clearStaleTimeout() {\n if (this.#staleTimeoutId) {\n timeoutManager.clearTimeout(this.#staleTimeoutId);\n this.#staleTimeoutId = void 0;\n }\n }\n #clearRefetchInterval() {\n if (this.#refetchIntervalId) {\n timeoutManager.clearInterval(this.#refetchIntervalId);\n this.#refetchIntervalId = void 0;\n }\n }\n createResult(query, options) {\n const prevQuery = this.#currentQuery;\n const prevOptions = this.options;\n const prevResult = this.#currentResult;\n const prevResultState = this.#currentResultState;\n const prevResultOptions = this.#currentResultOptions;\n const queryChange = query !== prevQuery;\n const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;\n const { state } = query;\n let newState = { ...state };\n let isPlaceholderData = false;\n let data;\n if (options._optimisticResults) {\n const mounted = this.hasListeners();\n const fetchOnMount = !mounted && shouldFetchOnMount(query, options);\n const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);\n if (fetchOnMount || fetchOptionally) {\n newState = {\n ...newState,\n ...fetchState(state.data, query.options)\n };\n }\n if (options._optimisticResults === \"isRestoring\") {\n newState.fetchStatus = \"idle\";\n }\n }\n let { error, errorUpdatedAt, status } = newState;\n data = newState.data;\n let skipSelect = false;\n if (options.placeholderData !== void 0 && data === void 0 && status === \"pending\") {\n let placeholderData;\n if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {\n placeholderData = prevResult.data;\n skipSelect = true;\n } else {\n placeholderData = typeof options.placeholderData === \"function\" ? options.placeholderData(\n this.#lastQueryWithDefinedData?.state.data,\n this.#lastQueryWithDefinedData\n ) : options.placeholderData;\n }\n if (placeholderData !== void 0) {\n status = \"success\";\n data = replaceData(\n prevResult?.data,\n placeholderData,\n options\n );\n isPlaceholderData = true;\n }\n }\n if (options.select && data !== void 0 && !skipSelect) {\n if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) {\n data = this.#selectResult;\n } else {\n try {\n this.#selectFn = options.select;\n data = options.select(data);\n data = replaceData(prevResult?.data, data, options);\n this.#selectResult = data;\n this.#selectError = null;\n } catch (selectError) {\n this.#selectError = selectError;\n }\n }\n }\n if (this.#selectError) {\n error = this.#selectError;\n data = this.#selectResult;\n errorUpdatedAt = Date.now();\n status = \"error\";\n }\n const isFetching = newState.fetchStatus === \"fetching\";\n const isPending = status === \"pending\";\n const isError = status === \"error\";\n const isLoading = isPending && isFetching;\n const hasData = data !== void 0;\n const result = {\n status,\n fetchStatus: newState.fetchStatus,\n isPending,\n isSuccess: status === \"success\",\n isError,\n isInitialLoading: isLoading,\n isLoading,\n data,\n dataUpdatedAt: newState.dataUpdatedAt,\n error,\n errorUpdatedAt,\n failureCount: newState.fetchFailureCount,\n failureReason: newState.fetchFailureReason,\n errorUpdateCount: newState.errorUpdateCount,\n isFetched: query.isFetched(),\n isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching,\n isRefetching: isFetching && !isPending,\n isLoadingError: isError && !hasData,\n isPaused: newState.fetchStatus === \"paused\",\n isPlaceholderData,\n isRefetchError: isError && hasData,\n isStale: isStale(query, options),\n refetch: this.refetch,\n promise: this.#currentThenable,\n isEnabled: resolveEnabled(options.enabled, query) !== false\n };\n const nextResult = result;\n if (this.options.experimental_prefetchInRender) {\n const hasResultData = nextResult.data !== void 0;\n const isErrorWithoutData = nextResult.status === \"error\" && !hasResultData;\n const finalizeThenableIfPossible = (thenable) => {\n if (isErrorWithoutData) {\n thenable.reject(nextResult.error);\n } else if (hasResultData) {\n thenable.resolve(nextResult.data);\n }\n };\n const recreateThenable = () => {\n const pending = this.#currentThenable = nextResult.promise = pendingThenable();\n finalizeThenableIfPossible(pending);\n };\n const prevThenable = this.#currentThenable;\n switch (prevThenable.status) {\n case \"pending\":\n if (query.queryHash === prevQuery.queryHash) {\n finalizeThenableIfPossible(prevThenable);\n }\n break;\n case \"fulfilled\":\n if (isErrorWithoutData || nextResult.data !== prevThenable.value) {\n recreateThenable();\n }\n break;\n case \"rejected\":\n if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {\n recreateThenable();\n }\n break;\n }\n }\n return nextResult;\n }\n updateResult() {\n const prevResult = this.#currentResult;\n const nextResult = this.createResult(this.#currentQuery, this.options);\n this.#currentResultState = this.#currentQuery.state;\n this.#currentResultOptions = this.options;\n if (this.#currentResultState.data !== void 0) {\n this.#lastQueryWithDefinedData = this.#currentQuery;\n }\n if (shallowEqualObjects(nextResult, prevResult)) {\n return;\n }\n this.#currentResult = nextResult;\n const shouldNotifyListeners = () => {\n if (!prevResult) {\n return true;\n }\n const { notifyOnChangeProps } = this.options;\n const notifyOnChangePropsValue = typeof notifyOnChangeProps === \"function\" ? notifyOnChangeProps() : notifyOnChangeProps;\n if (notifyOnChangePropsValue === \"all\" || !notifyOnChangePropsValue && !this.#trackedProps.size) {\n return true;\n }\n const includedProps = new Set(\n notifyOnChangePropsValue ?? this.#trackedProps\n );\n if (this.options.throwOnError) {\n includedProps.add(\"error\");\n }\n return Object.keys(this.#currentResult).some((key) => {\n const typedKey = key;\n const changed = this.#currentResult[typedKey] !== prevResult[typedKey];\n return changed && includedProps.has(typedKey);\n });\n };\n this.#notify({ listeners: shouldNotifyListeners() });\n }\n #updateQuery() {\n const query = this.#client.getQueryCache().build(this.#client, this.options);\n if (query === this.#currentQuery) {\n return;\n }\n const prevQuery = this.#currentQuery;\n this.#currentQuery = query;\n this.#currentQueryInitialState = query.state;\n if (this.hasListeners()) {\n prevQuery?.removeObserver(this);\n query.addObserver(this);\n }\n }\n onQueryUpdate() {\n this.updateResult();\n if (this.hasListeners()) {\n this.#updateTimers();\n }\n }\n #notify(notifyOptions) {\n notifyManager.batch(() => {\n if (notifyOptions.listeners) {\n this.listeners.forEach((listener) => {\n listener(this.#currentResult);\n });\n }\n this.#client.getQueryCache().notify({\n query: this.#currentQuery,\n type: \"observerResultsUpdated\"\n });\n });\n }\n};\nfunction shouldLoadOnMount(query, options) {\n return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === \"error\" && options.retryOnMount === false);\n}\nfunction shouldFetchOnMount(query, options) {\n return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);\n}\nfunction shouldFetchOn(query, options, field) {\n if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== \"static\") {\n const value = typeof field === \"function\" ? field(query) : field;\n return value === \"always\" || value !== false && isStale(query, options);\n }\n return false;\n}\nfunction shouldFetchOptionally(query, prevQuery, options, prevOptions) {\n return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== \"error\") && isStale(query, options);\n}\nfunction isStale(query, options) {\n return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));\n}\nfunction shouldAssignObserverCurrentProperties(observer, optimisticResult) {\n if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {\n return true;\n }\n return false;\n}\nexport {\n QueryObserver\n};\n//# sourceMappingURL=queryObserver.js.map"],"names":[],"mappings":";;;;;;;;AAiBG,IAAC,gBAAgB,cAAc,aAAa;AAAA,EAC7C,YAAY,QAAQ,SAAS;AAC3B,UAAK;AACL,SAAK,UAAU;AACf,SAAK,UAAU;AACf,SAAK,eAAe;AACpB,SAAK,mBAAmB,gBAAe;AACvC,SAAK,YAAW;AAChB,SAAK,WAAW,OAAO;AAAA,EACzB;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,4BAA4B;AAAA,EAC5B,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgC,oBAAI,IAAG;AAAA,EACvC,cAAc;AACZ,SAAK,UAAU,KAAK,QAAQ,KAAK,IAAI;AAAA,EACvC;AAAA,EACA,cAAc;AACZ,QAAI,KAAK,UAAU,SAAS,GAAG;AAC7B,WAAK,cAAc,YAAY,IAAI;AACnC,UAAI,mBAAmB,KAAK,eAAe,KAAK,OAAO,GAAG;AACxD,aAAK,cAAa;AAAA,MACpB,OAAO;AACL,aAAK,aAAY;AAAA,MACnB;AACA,WAAK,cAAa;AAAA,IACpB;AAAA,EACF;AAAA,EACA,gBAAgB;AACd,QAAI,CAAC,KAAK,gBAAgB;AACxB,WAAK,QAAO;AAAA,IACd;AAAA,EACF;AAAA,EACA,yBAAyB;AACvB,WAAO;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK,QAAQ;AAAA,IACnB;AAAA,EACE;AAAA,EACA,2BAA2B;AAC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O,WAAW,SAAS,aAAa;AACrE,UAAQ,UAAU,aAAa,eAAe,YAAY,SAAS,KAAK,MAAM,WAAW,CAAC,QAAQ,YAAY,MAAM,MAAM,WAAW,YAAY,QAAQ,OAAO,OAAO;AACzK;AACA,SAAS,QAAQ,OAAO,SAAS;AAC/B,SAAO,eAAe,QAAQ,SAAS,KAAK,MAAM,SAAS,MAAM,cAAc,iBAAiB,QAAQ,WAAW,KAAK,CAAC;AAC3H;AACA,SAAS,sCAAsC,UAAU,kBAAkB;AACzE,MAAI,CAAC,oBAAoB,SAAS,iBAAgB,GAAI,gBAAgB,GAAG;AACvE,WAAO;AAAA,EACT;AACA,SAAO;AACT;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"retryer.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/retryer.js"],"sourcesContent":["// src/retryer.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport { isServer, sleep } from \"./utils.js\";\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1e3 * 2 ** failureCount, 3e4);\n}\nfunction canFetch(networkMode) {\n return (networkMode ?? \"online\") === \"online\" ? onlineManager.isOnline() : true;\n}\nvar CancelledError = class extends Error {\n constructor(options) {\n super(\"CancelledError\");\n this.revert = options?.revert;\n this.silent = options?.silent;\n }\n};\nfunction isCancelledError(value) {\n return value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n let isRetryCancelled = false;\n let failureCount = 0;\n let continueFn;\n const thenable = pendingThenable();\n const isResolved = () => thenable.status !== \"pending\";\n const cancel = (cancelOptions) => {\n if (!isResolved()) {\n const error = new CancelledError(cancelOptions);\n reject(error);\n config.onCancel?.(error);\n }\n };\n const cancelRetry = () => {\n isRetryCancelled = true;\n };\n const continueRetry = () => {\n isRetryCancelled = false;\n };\n const canContinue = () => focusManager.isFocused() && (config.networkMode === \"always\" || onlineManager.isOnline()) && config.canRun();\n const canStart = () => canFetch(config.networkMode) && config.canRun();\n const resolve = (value) => {\n if (!isResolved()) {\n continueFn?.();\n thenable.resolve(value);\n }\n };\n const reject = (value) => {\n if (!isResolved()) {\n continueFn?.();\n thenable.reject(value);\n }\n };\n const pause = () => {\n return new Promise((continueResolve) => {\n continueFn = (value) => {\n if (isResolved() || canContinue()) {\n continueResolve(value);\n }\n };\n config.onPause?.();\n }).then(() => {\n continueFn = void 0;\n if (!isResolved()) {\n config.onContinue?.();\n }\n });\n };\n const run = () => {\n if (isResolved()) {\n return;\n }\n let promiseOrValue;\n const initialPromise = failureCount === 0 ? config.initialPromise : void 0;\n try {\n promiseOrValue = initialPromise ?? config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n }\n Promise.resolve(promiseOrValue).then(resolve).catch((error) => {\n if (isResolved()) {\n return;\n }\n const retry = config.retry ?? (isServer ? 0 : 3);\n const retryDelay = config.retryDelay ?? defaultRetryDelay;\n const delay = typeof retryDelay === \"function\" ? retryDelay(failureCount, error) : retryDelay;\n const shouldRetry = retry === true || typeof retry === \"number\" && failureCount < retry || typeof retry === \"function\" && retry(failureCount, error);\n if (isRetryCancelled || !shouldRetry) {\n reject(error);\n return;\n }\n failureCount++;\n config.onFail?.(failureCount, error);\n sleep(delay).then(() => {\n return canContinue() ? void 0 : pause();\n }).then(() => {\n if (isRetryCancelled) {\n reject(error);\n } else {\n run();\n }\n });\n });\n };\n return {\n promise: thenable,\n status: () => thenable.status,\n cancel,\n continue: () => {\n continueFn?.();\n return thenable;\n },\n cancelRetry,\n continueRetry,\n canStart,\n start: () => {\n if (canStart()) {\n run();\n } else {\n pause().then(run);\n }\n return thenable;\n }\n };\n}\nexport {\n CancelledError,\n canFetch,\n createRetryer,\n isCancelledError\n};\n//# sourceMappingURL=retryer.js.map"],"names":[],"mappings":";AAQA,SAAS,SAAS,aAAa;AAC7B,UAAQ,eAAe,cAAc,WAAW,cAAc,SAAQ,IAAK;AAC7E;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"retryer.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/retryer.js"],"sourcesContent":["// src/retryer.ts\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { pendingThenable } from \"./thenable.js\";\nimport { environmentManager } from \"./environmentManager.js\";\nimport { sleep } from \"./utils.js\";\nfunction defaultRetryDelay(failureCount) {\n return Math.min(1e3 * 2 ** failureCount, 3e4);\n}\nfunction canFetch(networkMode) {\n return (networkMode ?? \"online\") === \"online\" ? onlineManager.isOnline() : true;\n}\nvar CancelledError = class extends Error {\n constructor(options) {\n super(\"CancelledError\");\n this.revert = options?.revert;\n this.silent = options?.silent;\n }\n};\nfunction isCancelledError(value) {\n return value instanceof CancelledError;\n}\nfunction createRetryer(config) {\n let isRetryCancelled = false;\n let failureCount = 0;\n let continueFn;\n const thenable = pendingThenable();\n const isResolved = () => thenable.status !== \"pending\";\n const cancel = (cancelOptions) => {\n if (!isResolved()) {\n const error = new CancelledError(cancelOptions);\n reject(error);\n config.onCancel?.(error);\n }\n };\n const cancelRetry = () => {\n isRetryCancelled = true;\n };\n const continueRetry = () => {\n isRetryCancelled = false;\n };\n const canContinue = () => focusManager.isFocused() && (config.networkMode === \"always\" || onlineManager.isOnline()) && config.canRun();\n const canStart = () => canFetch(config.networkMode) && config.canRun();\n const resolve = (value) => {\n if (!isResolved()) {\n continueFn?.();\n thenable.resolve(value);\n }\n };\n const reject = (value) => {\n if (!isResolved()) {\n continueFn?.();\n thenable.reject(value);\n }\n };\n const pause = () => {\n return new Promise((continueResolve) => {\n continueFn = (value) => {\n if (isResolved() || canContinue()) {\n continueResolve(value);\n }\n };\n config.onPause?.();\n }).then(() => {\n continueFn = void 0;\n if (!isResolved()) {\n config.onContinue?.();\n }\n });\n };\n const run = () => {\n if (isResolved()) {\n return;\n }\n let promiseOrValue;\n const initialPromise = failureCount === 0 ? config.initialPromise : void 0;\n try {\n promiseOrValue = initialPromise ?? config.fn();\n } catch (error) {\n promiseOrValue = Promise.reject(error);\n }\n Promise.resolve(promiseOrValue).then(resolve).catch((error) => {\n if (isResolved()) {\n return;\n }\n const retry = config.retry ?? (environmentManager.isServer() ? 0 : 3);\n const retryDelay = config.retryDelay ?? defaultRetryDelay;\n const delay = typeof retryDelay === \"function\" ? retryDelay(failureCount, error) : retryDelay;\n const shouldRetry = retry === true || typeof retry === \"number\" && failureCount < retry || typeof retry === \"function\" && retry(failureCount, error);\n if (isRetryCancelled || !shouldRetry) {\n reject(error);\n return;\n }\n failureCount++;\n config.onFail?.(failureCount, error);\n sleep(delay).then(() => {\n return canContinue() ? void 0 : pause();\n }).then(() => {\n if (isRetryCancelled) {\n reject(error);\n } else {\n run();\n }\n });\n });\n };\n return {\n promise: thenable,\n status: () => thenable.status,\n cancel,\n continue: () => {\n continueFn?.();\n return thenable;\n },\n cancelRetry,\n continueRetry,\n canStart,\n start: () => {\n if (canStart()) {\n run();\n } else {\n pause().then(run);\n }\n return thenable;\n }\n };\n}\nexport {\n CancelledError,\n canFetch,\n createRetryer,\n isCancelledError\n};\n//# sourceMappingURL=retryer.js.map"],"names":[],"mappings":";AASA,SAAS,SAAS,aAAa;AAC7B,UAAQ,eAAe,cAAc,WAAW,cAAc,SAAQ,IAAK;AAC7E;","x_google_ignoreList":[0]}
@@ -17,7 +17,8 @@ var defaultTimeoutProvider = {
17
17
  var TimeoutManager = class {
18
18
  // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
19
19
  // type at app boot; and if we leave that type, then any new timer provider
20
- // would need to support ReturnType<typeof setTimeout>, which is infeasible.
20
+ // would need to support the default provider's concrete timer ID, which is
21
+ // infeasible across environments.
21
22
  //
22
23
  // We settle for type safety for the TimeoutProvider type, and accept that
23
24
  // this class is unsafe internally to allow for extension.
@@ -1 +1 @@
1
- {"version":3,"file":"timeoutManager.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/timeoutManager.js"],"sourcesContent":["// src/timeoutManager.ts\nvar defaultTimeoutProvider = {\n // We need the wrapper function syntax below instead of direct references to\n // global setTimeout etc.\n //\n // BAD: `setTimeout: setTimeout`\n // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`\n //\n // If we use direct references here, then anything that wants to spy on or\n // replace the global setTimeout (like tests) won't work since we'll already\n // have a hard reference to the original implementation at the time when this\n // file was imported.\n setTimeout: (callback, delay) => setTimeout(callback, delay),\n clearTimeout: (timeoutId) => clearTimeout(timeoutId),\n setInterval: (callback, delay) => setInterval(callback, delay),\n clearInterval: (intervalId) => clearInterval(intervalId)\n};\nvar TimeoutManager = class {\n // We cannot have TimeoutManager<T> as we must instantiate it with a concrete\n // type at app boot; and if we leave that type, then any new timer provider\n // would need to support ReturnType<typeof setTimeout>, which is infeasible.\n //\n // We settle for type safety for the TimeoutProvider type, and accept that\n // this class is unsafe internally to allow for extension.\n #provider = defaultTimeoutProvider;\n #providerCalled = false;\n setTimeoutProvider(provider) {\n if (process.env.NODE_ENV !== \"production\") {\n if (this.#providerCalled && provider !== this.#provider) {\n console.error(\n `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,\n { previous: this.#provider, provider }\n );\n }\n }\n this.#provider = provider;\n if (process.env.NODE_ENV !== \"production\") {\n this.#providerCalled = false;\n }\n }\n setTimeout(callback, delay) {\n if (process.env.NODE_ENV !== \"production\") {\n this.#providerCalled = true;\n }\n return this.#provider.setTimeout(callback, delay);\n }\n clearTimeout(timeoutId) {\n this.#provider.clearTimeout(timeoutId);\n }\n setInterval(callback, delay) {\n if (process.env.NODE_ENV !== \"production\") {\n this.#providerCalled = true;\n }\n return this.#provider.setInterval(callback, delay);\n }\n clearInterval(intervalId) {\n this.#provider.clearInterval(intervalId);\n }\n};\nvar timeoutManager = new TimeoutManager();\nfunction systemSetTimeoutZero(callback) {\n setTimeout(callback, 0);\n}\nexport {\n TimeoutManager,\n defaultTimeoutProvider,\n systemSetTimeoutZero,\n timeoutManager\n};\n//# sourceMappingURL=timeoutManager.js.map"],"names":[],"mapp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oreList":[0]}
1
+ {"version":3,"file":"timeoutManager.js","sources":["../../../../../../node_modules/@tanstack/query-core/build/modern/timeoutManager.js"],"sourcesContent":["// src/timeoutManager.ts\nvar defaultTimeoutProvider = {\n // We need the wrapper function syntax below instead of direct references to\n // global setTimeout etc.\n //\n // BAD: `setTimeout: setTimeout`\n // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`\n //\n // If we use direct references here, then anything that wants to spy on or\n // replace the global setTimeout (like tests) won't work since we'll already\n // have a hard reference to the original implementation at the time when this\n // file was imported.\n setTimeout: (callback, delay) => setTimeout(callback, delay),\n clearTimeout: (timeoutId) => clearTimeout(timeoutId),\n setInterval: (callback, delay) => setInterval(callback, delay),\n clearInterval: (intervalId) => clearInterval(intervalId)\n};\nvar TimeoutManager = class {\n // We cannot have TimeoutManager<T> as we must instantiate it with a concrete\n // type at app boot; and if we leave that type, then any new timer provider\n // would need to support the default provider's concrete timer ID, which is\n // infeasible across environments.\n //\n // We settle for type safety for the TimeoutProvider type, and accept that\n // this class is unsafe internally to allow for extension.\n #provider = defaultTimeoutProvider;\n #providerCalled = false;\n setTimeoutProvider(provider) {\n if (process.env.NODE_ENV !== \"production\") {\n if (this.#providerCalled && provider !== this.#provider) {\n console.error(\n `[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.`,\n { previous: this.#provider, provider }\n );\n }\n }\n this.#provider = provider;\n if (process.env.NODE_ENV !== \"production\") {\n this.#providerCalled = false;\n }\n }\n setTimeout(callback, delay) {\n if (process.env.NODE_ENV !== \"production\") {\n this.#providerCalled = true;\n }\n return this.#provider.setTimeout(callback, delay);\n }\n clearTimeout(timeoutId) {\n this.#provider.clearTimeout(timeoutId);\n }\n setInterval(callback, delay) {\n if (process.env.NODE_ENV !== \"production\") {\n this.#providerCalled = true;\n }\n return this.#provider.setInterval(callback, delay);\n }\n clearInterval(intervalId) {\n this.#provider.clearInterval(intervalId);\n }\n};\nvar timeoutManager = new TimeoutManager();\nfunction systemSetTimeoutZero(callback) {\n setTimeout(callback, 0);\n}\nexport {\n TimeoutManager,\n defaultTimeoutProvider,\n systemSetTimeoutZero,\n timeoutManager\n};\n//# sourceMappingURL=timeoutManager.js.map"],"names":[],"mappings":"AACG,IAAC,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW3B,YAAY,CAAC,UAAU,UAAU,WAAW,UAAU,KAAK;AAAA,EAC3D,cAAc,CAAC,cAAc,aAAa,SAAS;AAAA,EACnD,aAAa,CAAC,UAAU,UAAU,YAAY,UAAU,KAAK;AAAA,EAC7D,eAAe,CAAC,eAAe,cAAc,UAAU;AACzD;AACG,IAAC,iBAAiB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQzB,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,mBAAmB,UAAU;AAC3B,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,UAAI,KAAK,mBAAmB,aAAa,KAAK,WAAW;AACvD,gBAAQ;AAAA,UACN;AAAA,UACA,EAAE,UAAU,KAAK,WAAW,SAAQ;AAAA,QAC9C;AAAA,MACM;AAAA,IACF;AACA,SAAK,YAAY;AACjB,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,WAAK,kBAAkB;AAAA,IACzB;AAAA,EACF;AAAA,EACA,WAAW,UAAU,OAAO;AAC1B,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,WAAK,kBAAkB;AAAA,IACzB;AACA,WAAO,KAAK,UAAU,WAAW,UAAU,KAAK;AAAA,EAClD;AAAA,EACA,aAAa,WAAW;AACtB,SAAK,UAAU,aAAa,SAAS;AAAA,EACvC;AAAA,EACA,YAAY,UAAU,OAAO;AAC3B,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,WAAK,kBAAkB;AAAA,IACzB;AACA,WAAO,KAAK,UAAU,YAAY,UAAU,KAAK;AAAA,EACnD;AAAA,EACA,cAAc,YAAY;AACxB,SAAK,UAAU,cAAc,UAAU;AAAA,EACzC;AACF;AACG,IAAC,iBAAiB,IAAI,eAAc;AACvC,SAAS,qBAAqB,UAAU;AACtC,aAAW,UAAU,CAAC;AACxB;","x_google_ignoreList":[0]}
@@ -1,5 +1,6 @@
1
+ import { environmentManager } from "../../../query-core/build/modern/environmentManager.js";
1
2
  import { notifyManager } from "../../../query-core/build/modern/notifyManager.js";
2
- import { noop, isServer } from "../../../query-core/build/modern/utils.js";
3
+ import { noop } from "../../../query-core/build/modern/utils.js";
3
4
  import { useQueryClient } from "./QueryClientProvider.js";
4
5
  import { useQueryErrorResetBoundary } from "./QueryErrorResetBoundary.js";
5
6
  import { ensurePreventErrorBoundaryRetry, useClearResetErrorBoundary, getHasError } from "./errorBoundaryUtils.js";
@@ -73,7 +74,7 @@ function useBaseQuery(options, Observer, queryClient) {
73
74
  defaultedOptions,
74
75
  result
75
76
  );
76
- if (defaultedOptions.experimental_prefetchInRender && !isServer && willFetch(result, isRestoring)) {
77
+ if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
77
78
  const promise = isNewCacheEntry ? (
78
79
  // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
79
80
  fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseQuery.js","sources":["../../../../../../node_modules/@tanstack/react-query/build/modern/useBaseQuery.js"],"sourcesContent":["\"use client\";\n\n// src/useBaseQuery.ts\nimport * as React from \"react\";\nimport { isServer, noop, notifyManager } from \"@tanstack/query-core\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport { useQueryErrorResetBoundary } from \"./QueryErrorResetBoundary.js\";\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary\n} from \"./errorBoundaryUtils.js\";\nimport { useIsRestoring } from \"./IsRestoringProvider.js\";\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n willFetch\n} from \"./suspense.js\";\nfunction useBaseQuery(options, Observer, queryClient) {\n if (process.env.NODE_ENV !== \"production\") {\n if (typeof options !== \"object\" || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'\n );\n }\n }\n const isRestoring = useIsRestoring();\n const errorResetBoundary = useQueryErrorResetBoundary();\n const client = useQueryClient(queryClient);\n const defaultedOptions = client.defaultQueryOptions(options);\n client.getDefaultOptions().queries?._experimental_beforeQuery?.(\n defaultedOptions\n );\n const query = client.getQueryCache().get(defaultedOptions.queryHash);\n if (process.env.NODE_ENV !== \"production\") {\n if (!defaultedOptions.queryFn) {\n console.error(\n `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`\n );\n }\n }\n defaultedOptions._optimisticResults = isRestoring ? \"isRestoring\" : \"optimistic\";\n ensureSuspenseTimers(defaultedOptions);\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);\n useClearResetErrorBoundary(errorResetBoundary);\n const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);\n const [observer] = React.useState(\n () => new Observer(\n client,\n defaultedOptions\n )\n );\n const result = observer.getOptimisticResult(defaultedOptions);\n const shouldSubscribe = !isRestoring && options.subscribed !== false;\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;\n observer.updateResult();\n return unsubscribe;\n },\n [observer, shouldSubscribe]\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult()\n );\n React.useEffect(() => {\n observer.setOptions(defaultedOptions);\n }, [defaultedOptions, observer]);\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);\n }\n if (getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query,\n suspense: defaultedOptions.suspense\n })) {\n throw result.error;\n }\n ;\n client.getDefaultOptions().queries?._experimental_afterQuery?.(\n defaultedOptions,\n result\n );\n if (defaultedOptions.experimental_prefetchInRender && !isServer && willFetch(result, isRestoring)) {\n const promise = isNewCacheEntry ? (\n // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted\n fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n ) : (\n // subscribe to the \"cache promise\" so that we can finalize the currentThenable once data comes in\n query?.promise\n );\n promise?.catch(noop).finally(() => {\n observer.updateResult();\n });\n }\n return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;\n}\nexport {\n useBaseQuery\n};\n//# sourceMappingURL=useBaseQuery.js.map"],"names":[],"mappings":";;;;;;;AAGA,MAAA,QAAA,OAAA,OAAA;AAgBA,SAAS,aAAa,SAAS,UAAU,aAAa;AACpD,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,OAAO,YAAY,YAAY,MAAM,QAAQ,OAAO,GAAG;AACzD,YAAM,IAAI;AAAA,QACR;AAAA,MACR;AAAA,IACI;AAAA,EACF;AACA,QAAM,cAAc,eAAc;AAClC,QAAM,qBAAqB,2BAA0B;AACrD,QAAM,SAAS,eAAe,WAAW;AACzC,QAAM,mBAAmB,OAAO,oBAAoB,OAAO;AAC3D,SAAO,oBAAoB,SAAS;AAAA,IAClC;AAAA,EACJ;AACE,QAAM,QAAQ,OAAO,cAAa,EAAG,IAAI,iBAAiB,SAAS;AACnE,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,CAAC,iBAAiB,SAAS;AAC7B,cAAQ;AAAA,QACN,IAAI,iBAAiB,SAAS;AAAA,MACtC;AAAA,IACI;AAAA,EACF;AACA,mBAAiB,qBAAqB,cAAc,gBAAgB;AACpE,uBAAqB,gBAAgB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,eAAS,aAAY;AAAA,IACvB,CAAC;AAAA,EACH;AACA,SAAO,CAAC,iBAAiB,sBAAsB,SAAS,YAAY,MAAM,IAAI;AAChF;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"useBaseQuery.js","sources":["../../../../../../node_modules/@tanstack/react-query/build/modern/useBaseQuery.js"],"sourcesContent":["\"use client\";\n\n// src/useBaseQuery.ts\nimport * as React from \"react\";\nimport { environmentManager, noop, notifyManager } from \"@tanstack/query-core\";\nimport { useQueryClient } from \"./QueryClientProvider.js\";\nimport { useQueryErrorResetBoundary } from \"./QueryErrorResetBoundary.js\";\nimport {\n ensurePreventErrorBoundaryRetry,\n getHasError,\n useClearResetErrorBoundary\n} from \"./errorBoundaryUtils.js\";\nimport { useIsRestoring } from \"./IsRestoringProvider.js\";\nimport {\n ensureSuspenseTimers,\n fetchOptimistic,\n shouldSuspend,\n willFetch\n} from \"./suspense.js\";\nfunction useBaseQuery(options, Observer, queryClient) {\n if (process.env.NODE_ENV !== \"production\") {\n if (typeof options !== \"object\" || Array.isArray(options)) {\n throw new Error(\n 'Bad argument type. Starting with v5, only the \"Object\" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'\n );\n }\n }\n const isRestoring = useIsRestoring();\n const errorResetBoundary = useQueryErrorResetBoundary();\n const client = useQueryClient(queryClient);\n const defaultedOptions = client.defaultQueryOptions(options);\n client.getDefaultOptions().queries?._experimental_beforeQuery?.(\n defaultedOptions\n );\n const query = client.getQueryCache().get(defaultedOptions.queryHash);\n if (process.env.NODE_ENV !== \"production\") {\n if (!defaultedOptions.queryFn) {\n console.error(\n `[${defaultedOptions.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`\n );\n }\n }\n defaultedOptions._optimisticResults = isRestoring ? \"isRestoring\" : \"optimistic\";\n ensureSuspenseTimers(defaultedOptions);\n ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);\n useClearResetErrorBoundary(errorResetBoundary);\n const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);\n const [observer] = React.useState(\n () => new Observer(\n client,\n defaultedOptions\n )\n );\n const result = observer.getOptimisticResult(defaultedOptions);\n const shouldSubscribe = !isRestoring && options.subscribed !== false;\n React.useSyncExternalStore(\n React.useCallback(\n (onStoreChange) => {\n const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;\n observer.updateResult();\n return unsubscribe;\n },\n [observer, shouldSubscribe]\n ),\n () => observer.getCurrentResult(),\n () => observer.getCurrentResult()\n );\n React.useEffect(() => {\n observer.setOptions(defaultedOptions);\n }, [defaultedOptions, observer]);\n if (shouldSuspend(defaultedOptions, result)) {\n throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);\n }\n if (getHasError({\n result,\n errorResetBoundary,\n throwOnError: defaultedOptions.throwOnError,\n query,\n suspense: defaultedOptions.suspense\n })) {\n throw result.error;\n }\n ;\n client.getDefaultOptions().queries?._experimental_afterQuery?.(\n defaultedOptions,\n result\n );\n if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {\n const promise = isNewCacheEntry ? (\n // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted\n fetchOptimistic(defaultedOptions, observer, errorResetBoundary)\n ) : (\n // subscribe to the \"cache promise\" so that we can finalize the currentThenable once data comes in\n query?.promise\n );\n promise?.catch(noop).finally(() => {\n observer.updateResult();\n });\n }\n return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;\n}\nexport {\n useBaseQuery\n};\n//# sourceMappingURL=useBaseQuery.js.map"],"names":[],"mappings":";;;;;;;;AAGA,MAAA,QAAA,OAAA,OAAA;AAgBA,SAAS,aAAa,SAAS,UAAU,aAAa;AACpD,MAAI,QAAQ,IAAI,aAAa,cAAc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AAC,kBAAkB,QAAQ,CAAC;AAC/B,MAAI,cAAc,kBAAkB,MAAM,GAAG;AAC3C,UAAM,gBAAgB,kBAAkB,UAAU,kBAAkB;AAAA,EACtE;AACA,MAAI,YAAY;AAAA,IACd;AAAA,IACA;AAAA,IACA,cAAc,iBAAiB;AAAA,IAC/B;AAAA,IACA,UAAU,iBAAiB;AAAA,EAC/B,CAAG,GAAG;AACF,UAAM,OAAO;AAAA,EACf;AAEA,SAAO,oBAAoB,SAAS;AAAA,IAClC;AAAA,IACA;AAAA,EACJ;AACE,MAAI,iBAAiB,iCAAiC,CAAC,mBAAmB,SAAQ,KAAM,UAAU,QAAQ,WAAW,GAAG;AACtH,UAAM,UAAU;AAAA;AAAA,MAEd,gBAAgB,kBAAkB,UAAU,kBAAkB;AAAA;AAAA;AAAA,MAG9D,OAAO;AAAA;AAET,aAAS,MAAM,IAAI,EAAE,QAAQ,MAAM;AACjC,eAAS,aAAY;AAAA,IACvB,CAAC;AAAA,EACH;AACA,SAAO,CAAC,iBAAiB,sBAAsB,SAAS,YAAY,MAAM,IAAI;AAChF;","x_google_ignoreList":[0]}
@@ -155,6 +155,8 @@ export interface ApiFormProps {
155
155
  follow?: boolean;
156
156
  actions?: ApiFormAction[];
157
157
  timeout?: number;
158
+ keepOpenOption?: boolean;
159
+ onKeepOpenChange?: (keepOpen: boolean) => void;
158
160
  }
159
161
  /**
160
162
  * @param title : The title to display in the modal header
@@ -39,6 +39,14 @@ export type InvenTreeFormsContext = {
39
39
  edit: (props: ApiFormModalProps) => UseModalReturn;
40
40
  stockActions: StockAdjustmentFormsContext;
41
41
  };
42
+ export type ImporterDrawerContext = {
43
+ open: (sessionId: number, options?: {
44
+ onClose?: () => void;
45
+ }) => void;
46
+ close: () => void;
47
+ isOpen: () => boolean;
48
+ sessionId: () => number | null;
49
+ };
42
50
  /**
43
51
  * A set of properties which are passed to a plugin,
44
52
  * for rendering an element in the user interface.
@@ -50,6 +58,8 @@ export type InvenTreeFormsContext = {
50
58
  * @param globalSettings - The global settings (see ../states/SettingsState.tsx)
51
59
  * @param navigate - The navigation function (see react-router-dom)
52
60
  * @param theme - The current Mantine theme
61
+ * @param forms - A set of functions for opening various API forms (see ../components/Forms.tsx)
62
+ * @param importer - A set of functions for controlling the global importer drawer (see ../components/importer/GlobalImporterDrawer.tsx)
53
63
  * @param colorScheme - The current Mantine color scheme (e.g. 'light' / 'dark')
54
64
  * @param host - The current host URL
55
65
  * @param i18n - The i18n instance for translations (from @lingui/core)
@@ -78,6 +88,7 @@ export type InvenTreePluginContext = {
78
88
  navigate: NavigateFunction;
79
89
  theme: MantineTheme;
80
90
  forms: InvenTreeFormsContext;
91
+ importer: ImporterDrawerContext;
81
92
  colorScheme: MantineColorScheme;
82
93
  model?: ModelType | string;
83
94
  id?: string | number | null;
@@ -1,4 +1,4 @@
1
- const INVENTREE_PLUGIN_VERSION = "0.9.0";
1
+ const INVENTREE_PLUGIN_VERSION = "0.10.0";
2
2
  const INVENTREE_REACT_VERSION = "19.2.4";
3
3
  const INVENTREE_REACT_DOM_VERSION = (
4
4
  // @ts-ignore
@@ -1 +1 @@
1
- {"version":3,"file":"Plugins.js","sources":["../../lib/types/Plugins.tsx"],"sourcesContent":["import type { I18n } from '@lingui/core';\nimport type { MantineColorScheme, MantineTheme } from '@mantine/core';\nimport type { QueryClient } from '@tanstack/react-query';\nimport type { AxiosInstance } from 'axios';\nimport type { NavigateFunction } from 'react-router-dom';\nimport type { ModelDict } from '../enums/ModelInformation';\nimport type { ModelType } from '../enums/ModelType';\nimport type {\n ApiFormModalProps,\n BulkEditApiFormModalProps,\n StockOperationProps\n} from './Forms';\nimport type { UseModalReturn } from './Modals';\nimport type { RenderInstanceProps } from './Rendering';\nimport type { SettingsStateProps } from './Settings';\nimport type { UserStateProps } from './User';\n\nexport interface PluginProps {\n name: string;\n slug: string;\n version: null | string;\n}\n\nexport interface PluginVersion {\n inventree: string;\n react: string;\n reactDom: string;\n mantine: string;\n}\n\nexport type StockAdjustmentFormsContext = {\n addStock: (props: StockOperationProps) => UseModalReturn;\n assignStock: (props: StockOperationProps) => UseModalReturn;\n changeStatus: (props: StockOperationProps) => UseModalReturn;\n countStock: (props: StockOperationProps) => UseModalReturn;\n deleteStock: (props: StockOperationProps) => UseModalReturn;\n mergeStock: (props: StockOperationProps) => UseModalReturn;\n removeStock: (props: StockOperationProps) => UseModalReturn;\n transferStock: (props: StockOperationProps) => UseModalReturn;\n returnStock: (props: StockOperationProps) => UseModalReturn;\n};\n\nexport type InvenTreeFormsContext = {\n bulkEdit: (props: BulkEditApiFormModalProps) => UseModalReturn;\n create: (props: ApiFormModalProps) => UseModalReturn;\n delete: (props: ApiFormModalProps) => UseModalReturn;\n edit: (props: ApiFormModalProps) => UseModalReturn;\n stockActions: StockAdjustmentFormsContext;\n};\n\n/**\n * A set of properties which are passed to a plugin,\n * for rendering an element in the user interface.\n *\n * @param version - The version of the running InvenTree software stack\n * @param api - The Axios API instance (see ../states/ApiState.tsx)\n * @param user - The current user instance (see ../states/UserState.tsx)\n * @param userSettings - The current user settings (see ../states/SettingsState.tsx)\n * @param globalSettings - The global settings (see ../states/SettingsState.tsx)\n * @param navigate - The navigation function (see react-router-dom)\n * @param theme - The current Mantine theme\n * @param colorScheme - The current Mantine color scheme (e.g. 'light' / 'dark')\n * @param host - The current host URL\n * @param i18n - The i18n instance for translations (from @lingui/core)\n * @param locale - The current locale string (e.g. 'en' / 'de')\n * @param model - The model type associated with the rendered component (if applicable)\n * @param modelInformation - A dictionary of available model information\n * @param renderInstance - A component function for rendering a model instance\n * @param id - The ID (primary key) of the model instance for the plugin (if applicable)\n * @param instance - The model instance data (if available)\n * @param reloadContent - A function which can be called to reload the plugin content\n * @param reloadInstance - A function which can be called to reload the model instance\n * @param context - Any additional context data which may be passed to the plugin\n */\nexport type InvenTreePluginContext = {\n version: PluginVersion;\n api: AxiosInstance;\n queryClient: QueryClient;\n user: UserStateProps;\n userSettings: SettingsStateProps;\n globalSettings: SettingsStateProps;\n modelInformation: ModelDict;\n renderInstance: (props: Readonly<RenderInstanceProps>) => React.ReactNode;\n host: string;\n i18n: I18n;\n locale: string;\n navigate: NavigateFunction;\n theme: MantineTheme;\n forms: InvenTreeFormsContext;\n colorScheme: MantineColorScheme;\n model?: ModelType | string;\n id?: string | number | null;\n instance?: any;\n reloadContent?: () => void;\n reloadInstance?: () => void;\n context?: any;\n};\n\n/*\n * The version of the InvenTree plugin context interface.\n * This number should be incremented if the interface changes.\n */\n\n// @ts-ignore\nexport const INVENTREE_PLUGIN_VERSION: string = __INVENTREE_LIB_VERSION__;\n// @ts-ignore\nexport const INVENTREE_REACT_VERSION: string = __INVENTREE_REACT_VERSION__;\n// @ts-ignore\nexport const INVENTREE_REACT_DOM_VERSION: string =\n // @ts-ignore\n __INVENTREE_REACT_DOM_VERSION__;\n// @ts-ignore\nexport const INVENTREE_MANTINE_VERSION: string = __INVENTREE_MANTINE_VERSION__;\n"],"names":["INVENTREE_PLUGIN_VERSION","__INVENTREE_LIB_VERSION__","INVENTREE_REACT_VERSION","__INVENTREE_REACT_VERSION__","INVENTREE_REACT_DOM_VERSION","__INVENTREE_REACT_DOM_VERSION__","INVENTREE_MANTINE_VERSION","__INVENTREE_MANTINE_VERSION__"],"mappings":"AAwGO,MAAMA,2BAAmCC;AAEzC,MAAMC,0BAAkCC;AAExC,MAAMC;AAAAA;AAAAA,EAEXC;AAAAA;AAEK,MAAMC,4BAAoCC;"}
1
+ {"version":3,"file":"Plugins.js","sources":["../../lib/types/Plugins.tsx"],"sourcesContent":["import type { I18n } from '@lingui/core';\nimport type { MantineColorScheme, MantineTheme } from '@mantine/core';\nimport type { QueryClient } from '@tanstack/react-query';\nimport type { AxiosInstance } from 'axios';\nimport type { NavigateFunction } from 'react-router-dom';\nimport type { ModelDict } from '../enums/ModelInformation';\nimport type { ModelType } from '../enums/ModelType';\nimport type {\n ApiFormModalProps,\n BulkEditApiFormModalProps,\n StockOperationProps\n} from './Forms';\nimport type { UseModalReturn } from './Modals';\nimport type { RenderInstanceProps } from './Rendering';\nimport type { SettingsStateProps } from './Settings';\nimport type { UserStateProps } from './User';\n\nexport interface PluginProps {\n name: string;\n slug: string;\n version: null | string;\n}\n\nexport interface PluginVersion {\n inventree: string;\n react: string;\n reactDom: string;\n mantine: string;\n}\n\nexport type StockAdjustmentFormsContext = {\n addStock: (props: StockOperationProps) => UseModalReturn;\n assignStock: (props: StockOperationProps) => UseModalReturn;\n changeStatus: (props: StockOperationProps) => UseModalReturn;\n countStock: (props: StockOperationProps) => UseModalReturn;\n deleteStock: (props: StockOperationProps) => UseModalReturn;\n mergeStock: (props: StockOperationProps) => UseModalReturn;\n removeStock: (props: StockOperationProps) => UseModalReturn;\n transferStock: (props: StockOperationProps) => UseModalReturn;\n returnStock: (props: StockOperationProps) => UseModalReturn;\n};\n\nexport type InvenTreeFormsContext = {\n bulkEdit: (props: BulkEditApiFormModalProps) => UseModalReturn;\n create: (props: ApiFormModalProps) => UseModalReturn;\n delete: (props: ApiFormModalProps) => UseModalReturn;\n edit: (props: ApiFormModalProps) => UseModalReturn;\n stockActions: StockAdjustmentFormsContext;\n};\n\nexport type ImporterDrawerContext = {\n open: (sessionId: number, options?: { onClose?: () => void }) => void;\n close: () => void;\n isOpen: () => boolean;\n sessionId: () => number | null;\n};\n\n/**\n * A set of properties which are passed to a plugin,\n * for rendering an element in the user interface.\n *\n * @param version - The version of the running InvenTree software stack\n * @param api - The Axios API instance (see ../states/ApiState.tsx)\n * @param user - The current user instance (see ../states/UserState.tsx)\n * @param userSettings - The current user settings (see ../states/SettingsState.tsx)\n * @param globalSettings - The global settings (see ../states/SettingsState.tsx)\n * @param navigate - The navigation function (see react-router-dom)\n * @param theme - The current Mantine theme\n * @param forms - A set of functions for opening various API forms (see ../components/Forms.tsx)\n * @param importer - A set of functions for controlling the global importer drawer (see ../components/importer/GlobalImporterDrawer.tsx)\n * @param colorScheme - The current Mantine color scheme (e.g. 'light' / 'dark')\n * @param host - The current host URL\n * @param i18n - The i18n instance for translations (from @lingui/core)\n * @param locale - The current locale string (e.g. 'en' / 'de')\n * @param model - The model type associated with the rendered component (if applicable)\n * @param modelInformation - A dictionary of available model information\n * @param renderInstance - A component function for rendering a model instance\n * @param id - The ID (primary key) of the model instance for the plugin (if applicable)\n * @param instance - The model instance data (if available)\n * @param reloadContent - A function which can be called to reload the plugin content\n * @param reloadInstance - A function which can be called to reload the model instance\n * @param context - Any additional context data which may be passed to the plugin\n */\nexport type InvenTreePluginContext = {\n version: PluginVersion;\n api: AxiosInstance;\n queryClient: QueryClient;\n user: UserStateProps;\n userSettings: SettingsStateProps;\n globalSettings: SettingsStateProps;\n modelInformation: ModelDict;\n renderInstance: (props: Readonly<RenderInstanceProps>) => React.ReactNode;\n host: string;\n i18n: I18n;\n locale: string;\n navigate: NavigateFunction;\n theme: MantineTheme;\n forms: InvenTreeFormsContext;\n importer: ImporterDrawerContext;\n colorScheme: MantineColorScheme;\n model?: ModelType | string;\n id?: string | number | null;\n instance?: any;\n reloadContent?: () => void;\n reloadInstance?: () => void;\n context?: any;\n};\n\n/*\n * The version of the InvenTree plugin context interface.\n * This number should be incremented if the interface changes.\n */\n\n// @ts-ignore\nexport const INVENTREE_PLUGIN_VERSION: string = __INVENTREE_LIB_VERSION__;\n// @ts-ignore\nexport const INVENTREE_REACT_VERSION: string = __INVENTREE_REACT_VERSION__;\n// @ts-ignore\nexport const INVENTREE_REACT_DOM_VERSION: string =\n // @ts-ignore\n __INVENTREE_REACT_DOM_VERSION__;\n// @ts-ignore\nexport const INVENTREE_MANTINE_VERSION: string = __INVENTREE_MANTINE_VERSION__;\n"],"names":["INVENTREE_PLUGIN_VERSION","__INVENTREE_LIB_VERSION__","INVENTREE_REACT_VERSION","__INVENTREE_REACT_VERSION__","INVENTREE_REACT_DOM_VERSION","__INVENTREE_REACT_DOM_VERSION__","INVENTREE_MANTINE_VERSION","__INVENTREE_MANTINE_VERSION__"],"mappings":"AAkHO,MAAMA,2BAAmCC;AAEzC,MAAMC,0BAAkCC;AAExC,MAAMC;AAAAA;AAAAA,EAEXC;AAAAA;AAEK,MAAMC,4BAAoCC;"}
@@ -180,6 +180,8 @@ export interface ApiFormProps {
180
180
  follow?: boolean;
181
181
  actions?: ApiFormAction[];
182
182
  timeout?: number;
183
+ keepOpenOption?: boolean;
184
+ onKeepOpenChange?: (keepOpen: boolean) => void;
183
185
  }
184
186
 
185
187
  /**
@@ -48,6 +48,13 @@ export type InvenTreeFormsContext = {
48
48
  stockActions: StockAdjustmentFormsContext;
49
49
  };
50
50
 
51
+ export type ImporterDrawerContext = {
52
+ open: (sessionId: number, options?: { onClose?: () => void }) => void;
53
+ close: () => void;
54
+ isOpen: () => boolean;
55
+ sessionId: () => number | null;
56
+ };
57
+
51
58
  /**
52
59
  * A set of properties which are passed to a plugin,
53
60
  * for rendering an element in the user interface.
@@ -59,6 +66,8 @@ export type InvenTreeFormsContext = {
59
66
  * @param globalSettings - The global settings (see ../states/SettingsState.tsx)
60
67
  * @param navigate - The navigation function (see react-router-dom)
61
68
  * @param theme - The current Mantine theme
69
+ * @param forms - A set of functions for opening various API forms (see ../components/Forms.tsx)
70
+ * @param importer - A set of functions for controlling the global importer drawer (see ../components/importer/GlobalImporterDrawer.tsx)
62
71
  * @param colorScheme - The current Mantine color scheme (e.g. 'light' / 'dark')
63
72
  * @param host - The current host URL
64
73
  * @param i18n - The i18n instance for translations (from @lingui/core)
@@ -87,6 +96,7 @@ export type InvenTreePluginContext = {
87
96
  navigate: NavigateFunction;
88
97
  theme: MantineTheme;
89
98
  forms: InvenTreeFormsContext;
99
+ importer: ImporterDrawerContext;
90
100
  colorScheme: MantineColorScheme;
91
101
  model?: ModelType | string;
92
102
  id?: string | number | null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inventreedb/ui",
3
3
  "description": "UI components for the InvenTree project",
4
- "version": "0.9.0",
4
+ "version": "0.10.0",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -40,15 +40,14 @@
40
40
  "compile": "lingui compile --typescript"
41
41
  },
42
42
  "dependencies": {
43
- "@codecov/vite-plugin": "^1.9.1",
44
43
  "@codemirror/autocomplete": "^6.20.1",
45
44
  "@codemirror/lang-liquid": "^6.3.2",
46
45
  "@codemirror/language": "^6.12.2",
47
46
  "@codemirror/lint": "^6.9.5",
48
47
  "@codemirror/search": "^6.6.0",
49
- "@codemirror/state": "^6.5.4",
48
+ "@codemirror/state": "^6.6.0",
50
49
  "@codemirror/theme-one-dark": "^6.1.3",
51
- "@codemirror/view": "6.39.16",
50
+ "@codemirror/view": "^6.40.0",
52
51
  "@emotion/react": "^11.13.3",
53
52
  "@fortawesome/fontawesome-svg-core": "^7.0.0",
54
53
  "@fortawesome/free-regular-svg-icons": "^7.0.0",
@@ -76,13 +75,13 @@
76
75
  "@sentry/react": "^10.43.0",
77
76
  "@tabler/icons-react": "^3.17.0",
78
77
  "@tanstack/react-query": "^5.56.2",
79
- "@uiw/codemirror-theme-vscode": "4.25.7",
80
- "@uiw/react-codemirror": "^4.25.7",
81
- "@uiw/react-split": "^5.9.3",
78
+ "@uiw/codemirror-theme-vscode": "^4.25.8",
79
+ "@uiw/react-codemirror": "^4.25.8",
80
+ "@uiw/react-split": "^5.9.4",
82
81
  "@vanilla-extract/css": "^1.18.0",
83
82
  "axios": "^1.13.6",
84
83
  "clsx": "^2.1.1",
85
- "codemirror": "6.0.2",
84
+ "codemirror": "^6.0.2",
86
85
  "dayjs": "^1.11.13",
87
86
  "dompurify": "^3.2.4",
88
87
  "easymde": "^2.18.0",
@@ -110,6 +109,7 @@
110
109
  "@babel/preset-react": "^7.28.5",
111
110
  "@babel/preset-typescript": "^7.28.5",
112
111
  "@babel/runtime": "^7.28.6",
112
+ "@codecov/vite-plugin": "^1.9.1",
113
113
  "@lingui/babel-plugin-lingui-macro": "^5.9.2",
114
114
  "@lingui/cli": "^5.9.2",
115
115
  "@lingui/macro": "^5.9.2",