@ventlio/tanstack-query 0.5.6 → 0.5.8
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.
- package/dist/_virtual/index.js +8 -0
- package/dist/{index.js.map → _virtual/index.js.map} +1 -1
- package/dist/_virtual/use-sync-external-store-shim.development.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js.map +1 -0
- package/dist/_virtual/with-selector.development.js +4 -0
- package/dist/_virtual/with-selector.development.js.map +1 -0
- package/dist/_virtual/with-selector.js +8 -0
- package/dist/_virtual/with-selector.js.map +1 -0
- package/dist/_virtual/with-selector.production.js +4 -0
- package/dist/_virtual/with-selector.production.js.map +1 -0
- package/dist/config/bootStore.d.ts +3 -0
- package/dist/config/bootstrapQueryRequest.d.ts +1 -1
- package/dist/config/index.d.ts +0 -1
- package/dist/index.mjs +724 -49
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/@tanstack/react-store/dist/esm/index.js +48 -0
- package/dist/node_modules/@tanstack/react-store/dist/esm/index.js.map +1 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +110 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +98 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +1 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +107 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +78 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/shim/index.js +22 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/shim/index.js.map +1 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/shim/with-selector.js +13 -0
- package/dist/node_modules/@tanstack/react-store/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
- package/dist/node_modules/@tanstack/store/dist/esm/derived.js +119 -0
- package/dist/node_modules/@tanstack/store/dist/esm/derived.js.map +1 -0
- package/dist/node_modules/@tanstack/store/dist/esm/scheduler.js +88 -0
- package/dist/node_modules/@tanstack/store/dist/esm/scheduler.js.map +1 -0
- package/dist/node_modules/@tanstack/store/dist/esm/store.js +29 -0
- package/dist/node_modules/@tanstack/store/dist/esm/store.js.map +1 -0
- package/dist/src/config/bootStore.js +16 -0
- package/dist/src/config/bootStore.js.map +1 -0
- package/dist/src/config/bootstrapQueryRequest.js +11 -0
- package/dist/{config → src/config}/bootstrapQueryRequest.js.map +1 -1
- package/dist/src/config/useReactNativeEnv.js +13 -0
- package/dist/{config → src/config}/useReactNativeEnv.js.map +1 -1
- package/dist/{index.js → src/index.js} +0 -1
- package/dist/src/index.js.map +1 -0
- package/dist/{model → src/model}/useQueryModel.js +4 -7
- package/dist/{model → src/model}/useQueryModel.js.map +1 -1
- package/dist/{queries → src/queries}/useDeleteRequest.js +5 -4
- package/dist/{queries → src/queries}/useDeleteRequest.js.map +1 -1
- package/dist/{queries → src/queries}/useGetInfiniteRequest.js +5 -4
- package/dist/{queries → src/queries}/useGetInfiniteRequest.js.map +1 -1
- package/dist/{queries → src/queries}/useGetRequest.js +5 -4
- package/dist/{queries → src/queries}/useGetRequest.js.map +1 -1
- package/dist/{queries → src/queries}/usePatchRequest.js +7 -6
- package/dist/{queries → src/queries}/usePatchRequest.js.map +1 -1
- package/dist/{queries → src/queries}/usePostRequest.js +7 -6
- package/dist/{queries → src/queries}/usePostRequest.js.map +1 -1
- package/dist/types/index.d.ts +14 -3
- package/package.json +2 -1
- package/src/config/bootStore.ts +14 -0
- package/src/config/bootstrapQueryRequest.ts +4 -15
- package/src/config/index.ts +0 -1
- package/src/config/useReactNativeEnv.ts +6 -5
- package/src/model/useQueryModel.ts +4 -4
- package/src/queries/useDeleteRequest.ts +16 -7
- package/src/queries/useGetInfiniteRequest.ts +16 -7
- package/src/queries/useGetRequest.ts +16 -7
- package/src/queries/usePatchRequest.ts +9 -8
- package/src/queries/usePostRequest.ts +15 -10
- package/src/queries/usePutRequest.ts +15 -10
- package/src/types/index.ts +15 -3
- package/dist/config/bootstrapQueryRequest.js +0 -21
- package/dist/config/useQueryConfig.d.ts +0 -2
- package/dist/config/useQueryConfig.js +0 -11
- package/dist/config/useQueryConfig.js.map +0 -1
- package/dist/config/useReactNativeEnv.js +0 -12
- package/src/config/useQueryConfig.ts +0 -11
- /package/dist/{config → src/config}/useEnvironmentVariables.js +0 -0
- /package/dist/{config → src/config}/useEnvironmentVariables.js.map +0 -0
- /package/dist/{config → src/config}/useQueryHeaders.js +0 -0
- /package/dist/{config → src/config}/useQueryHeaders.js.map +0 -0
- /package/dist/{helpers → src/helpers}/scrollToTop.js +0 -0
- /package/dist/{helpers → src/helpers}/scrollToTop.js.map +0 -0
- /package/dist/{helpers → src/helpers}/timeFuncs.js +0 -0
- /package/dist/{helpers → src/helpers}/timeFuncs.js.map +0 -0
- /package/dist/{hooks → src/hooks}/useUploadProgress.js +0 -0
- /package/dist/{hooks → src/hooks}/useUploadProgress.js.map +0 -0
- /package/dist/{model → src/model}/useKeyTrackerModel.js +0 -0
- /package/dist/{model → src/model}/useKeyTrackerModel.js.map +0 -0
- /package/dist/{model → src/model}/useRefetchQuery.js +0 -0
- /package/dist/{model → src/model}/useRefetchQuery.js.map +0 -0
- /package/dist/{request → src/request}/axios-instance.js +0 -0
- /package/dist/{request → src/request}/axios-instance.js.map +0 -0
- /package/dist/{request → src/request}/buildFormData.js +0 -0
- /package/dist/{request → src/request}/buildFormData.js.map +0 -0
- /package/dist/{request → src/request}/make-request.js +0 -0
- /package/dist/{request → src/request}/make-request.js.map +0 -0
- /package/dist/{request → src/request}/request.enum.js +0 -0
- /package/dist/{request → src/request}/request.enum.js.map +0 -0
- /package/dist/{request → src/request}/transformer.js +0 -0
- /package/dist/{request → src/request}/transformer.js.map +0 -0
- /package/dist/{stores → src/stores}/useHeaderStore.js +0 -0
- /package/dist/{stores → src/stores}/useHeaderStore.js.map +0 -0
- /package/dist/{stores → src/stores}/usePauseFutureRequests.js +0 -0
- /package/dist/{stores → src/stores}/usePauseFutureRequests.js.map +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../node_modules/@tanstack/react-store/node_modules/use-sync-external-store/shim/index.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n"],"names":["require$$0","require$$1"],"mappings":";;;;;;;;;;AACA;AACA,EAAA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;IACzC,MAAA,CAAA,OAAA,GAAiBA,4CAA4D,CAAC;AAChF,GAAC,MAAM;IACL,MAAA,CAAA,OAAA,GAAiBC,6CAA6D,CAAC;AACjF,GAAA;;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { __module as withSelector, exports as withSelectorExports } from '../../../../../../_virtual/with-selector.js';
|
|
2
|
+
import { __require as requireWithSelector_production } from '../cjs/use-sync-external-store-shim/with-selector.production.js';
|
|
3
|
+
import { __require as requireWithSelector_development } from '../cjs/use-sync-external-store-shim/with-selector.development.js';
|
|
4
|
+
|
|
5
|
+
(function (module) {
|
|
6
|
+
|
|
7
|
+
if (process.env.NODE_ENV === 'production') {
|
|
8
|
+
module.exports = requireWithSelector_production();
|
|
9
|
+
} else {
|
|
10
|
+
module.exports = requireWithSelector_development();
|
|
11
|
+
}
|
|
12
|
+
} (withSelector));
|
|
13
|
+
//# sourceMappingURL=with-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-selector.js","sources":["../../../../../../../node_modules/@tanstack/react-store/node_modules/use-sync-external-store/shim/with-selector.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n"],"names":["require$$0","require$$1"],"mappings":";;;;;AACA;AACA,CAAA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;GACzC,MAAA,CAAA,OAAA,GAAiBA,gCAA0E,CAAC;AAC9F,EAAC,MAAM;GACL,MAAA,CAAA,OAAA,GAAiBC,iCAA2E,CAAC;AAC/F,EAAA;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Store } from './store.js';
|
|
2
|
+
import { __storeToDerived, __derivedToStore } from './scheduler.js';
|
|
3
|
+
|
|
4
|
+
class Derived {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
7
|
+
this._subscriptions = [];
|
|
8
|
+
this.lastSeenDepValues = [];
|
|
9
|
+
this.getDepVals = () => {
|
|
10
|
+
const prevDepVals = [];
|
|
11
|
+
const currDepVals = [];
|
|
12
|
+
for (const dep of this.options.deps) {
|
|
13
|
+
prevDepVals.push(dep.prevState);
|
|
14
|
+
currDepVals.push(dep.state);
|
|
15
|
+
}
|
|
16
|
+
this.lastSeenDepValues = currDepVals;
|
|
17
|
+
return {
|
|
18
|
+
prevDepVals,
|
|
19
|
+
currDepVals,
|
|
20
|
+
prevVal: this.prevState ?? void 0
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
this.recompute = () => {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
this.prevState = this.state;
|
|
26
|
+
const { prevDepVals, currDepVals, prevVal } = this.getDepVals();
|
|
27
|
+
this.state = this.options.fn({
|
|
28
|
+
prevDepVals,
|
|
29
|
+
currDepVals,
|
|
30
|
+
prevVal
|
|
31
|
+
});
|
|
32
|
+
(_b = (_a = this.options).onUpdate) == null ? void 0 : _b.call(_a);
|
|
33
|
+
};
|
|
34
|
+
this.checkIfRecalculationNeededDeeply = () => {
|
|
35
|
+
for (const dep of this.options.deps) {
|
|
36
|
+
if (dep instanceof Derived) {
|
|
37
|
+
dep.checkIfRecalculationNeededDeeply();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
let shouldRecompute = false;
|
|
41
|
+
const lastSeenDepValues = this.lastSeenDepValues;
|
|
42
|
+
const { currDepVals } = this.getDepVals();
|
|
43
|
+
for (let i = 0; i < currDepVals.length; i++) {
|
|
44
|
+
if (currDepVals[i] !== lastSeenDepValues[i]) {
|
|
45
|
+
shouldRecompute = true;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (shouldRecompute) {
|
|
50
|
+
this.recompute();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
this.mount = () => {
|
|
54
|
+
this.registerOnGraph();
|
|
55
|
+
this.checkIfRecalculationNeededDeeply();
|
|
56
|
+
return () => {
|
|
57
|
+
this.unregisterFromGraph();
|
|
58
|
+
for (const cleanup of this._subscriptions) {
|
|
59
|
+
cleanup();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
this.subscribe = (listener) => {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
this.listeners.add(listener);
|
|
66
|
+
const unsub = (_b = (_a = this.options).onSubscribe) == null ? void 0 : _b.call(_a, listener, this);
|
|
67
|
+
return () => {
|
|
68
|
+
this.listeners.delete(listener);
|
|
69
|
+
unsub == null ? void 0 : unsub();
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
this.options = options;
|
|
73
|
+
this.state = options.fn({
|
|
74
|
+
prevDepVals: void 0,
|
|
75
|
+
prevVal: void 0,
|
|
76
|
+
currDepVals: this.getDepVals().currDepVals
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
registerOnGraph(deps = this.options.deps) {
|
|
80
|
+
for (const dep of deps) {
|
|
81
|
+
if (dep instanceof Derived) {
|
|
82
|
+
dep.registerOnGraph();
|
|
83
|
+
this.registerOnGraph(dep.options.deps);
|
|
84
|
+
} else if (dep instanceof Store) {
|
|
85
|
+
let relatedLinkedDerivedVals = __storeToDerived.get(dep);
|
|
86
|
+
if (!relatedLinkedDerivedVals) {
|
|
87
|
+
relatedLinkedDerivedVals = /* @__PURE__ */ new Set();
|
|
88
|
+
__storeToDerived.set(dep, relatedLinkedDerivedVals);
|
|
89
|
+
}
|
|
90
|
+
relatedLinkedDerivedVals.add(this);
|
|
91
|
+
let relatedStores = __derivedToStore.get(this);
|
|
92
|
+
if (!relatedStores) {
|
|
93
|
+
relatedStores = /* @__PURE__ */ new Set();
|
|
94
|
+
__derivedToStore.set(this, relatedStores);
|
|
95
|
+
}
|
|
96
|
+
relatedStores.add(dep);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
unregisterFromGraph(deps = this.options.deps) {
|
|
101
|
+
for (const dep of deps) {
|
|
102
|
+
if (dep instanceof Derived) {
|
|
103
|
+
this.unregisterFromGraph(dep.options.deps);
|
|
104
|
+
} else if (dep instanceof Store) {
|
|
105
|
+
const relatedLinkedDerivedVals = __storeToDerived.get(dep);
|
|
106
|
+
if (relatedLinkedDerivedVals) {
|
|
107
|
+
relatedLinkedDerivedVals.delete(this);
|
|
108
|
+
}
|
|
109
|
+
const relatedStores = __derivedToStore.get(this);
|
|
110
|
+
if (relatedStores) {
|
|
111
|
+
relatedStores.delete(dep);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { Derived };
|
|
119
|
+
//# sourceMappingURL=derived.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derived.js","sources":["../../../../../../node_modules/@tanstack/store/dist/esm/derived.js"],"sourcesContent":["import { Store } from \"./store.js\";\nimport { __storeToDerived, __derivedToStore } from \"./scheduler.js\";\nclass Derived {\n constructor(options) {\n this.listeners = /* @__PURE__ */ new Set();\n this._subscriptions = [];\n this.lastSeenDepValues = [];\n this.getDepVals = () => {\n const prevDepVals = [];\n const currDepVals = [];\n for (const dep of this.options.deps) {\n prevDepVals.push(dep.prevState);\n currDepVals.push(dep.state);\n }\n this.lastSeenDepValues = currDepVals;\n return {\n prevDepVals,\n currDepVals,\n prevVal: this.prevState ?? void 0\n };\n };\n this.recompute = () => {\n var _a, _b;\n this.prevState = this.state;\n const { prevDepVals, currDepVals, prevVal } = this.getDepVals();\n this.state = this.options.fn({\n prevDepVals,\n currDepVals,\n prevVal\n });\n (_b = (_a = this.options).onUpdate) == null ? void 0 : _b.call(_a);\n };\n this.checkIfRecalculationNeededDeeply = () => {\n for (const dep of this.options.deps) {\n if (dep instanceof Derived) {\n dep.checkIfRecalculationNeededDeeply();\n }\n }\n let shouldRecompute = false;\n const lastSeenDepValues = this.lastSeenDepValues;\n const { currDepVals } = this.getDepVals();\n for (let i = 0; i < currDepVals.length; i++) {\n if (currDepVals[i] !== lastSeenDepValues[i]) {\n shouldRecompute = true;\n break;\n }\n }\n if (shouldRecompute) {\n this.recompute();\n }\n };\n this.mount = () => {\n this.registerOnGraph();\n this.checkIfRecalculationNeededDeeply();\n return () => {\n this.unregisterFromGraph();\n for (const cleanup of this._subscriptions) {\n cleanup();\n }\n };\n };\n this.subscribe = (listener) => {\n var _a, _b;\n this.listeners.add(listener);\n const unsub = (_b = (_a = this.options).onSubscribe) == null ? void 0 : _b.call(_a, listener, this);\n return () => {\n this.listeners.delete(listener);\n unsub == null ? void 0 : unsub();\n };\n };\n this.options = options;\n this.state = options.fn({\n prevDepVals: void 0,\n prevVal: void 0,\n currDepVals: this.getDepVals().currDepVals\n });\n }\n registerOnGraph(deps = this.options.deps) {\n for (const dep of deps) {\n if (dep instanceof Derived) {\n dep.registerOnGraph();\n this.registerOnGraph(dep.options.deps);\n } else if (dep instanceof Store) {\n let relatedLinkedDerivedVals = __storeToDerived.get(dep);\n if (!relatedLinkedDerivedVals) {\n relatedLinkedDerivedVals = /* @__PURE__ */ new Set();\n __storeToDerived.set(dep, relatedLinkedDerivedVals);\n }\n relatedLinkedDerivedVals.add(this);\n let relatedStores = __derivedToStore.get(this);\n if (!relatedStores) {\n relatedStores = /* @__PURE__ */ new Set();\n __derivedToStore.set(this, relatedStores);\n }\n relatedStores.add(dep);\n }\n }\n }\n unregisterFromGraph(deps = this.options.deps) {\n for (const dep of deps) {\n if (dep instanceof Derived) {\n this.unregisterFromGraph(dep.options.deps);\n } else if (dep instanceof Store) {\n const relatedLinkedDerivedVals = __storeToDerived.get(dep);\n if (relatedLinkedDerivedVals) {\n relatedLinkedDerivedVals.delete(this);\n }\n const relatedStores = __derivedToStore.get(this);\n if (relatedStores) {\n relatedStores.delete(dep);\n }\n }\n }\n }\n}\nexport {\n Derived\n};\n//# sourceMappingURL=derived.js.map\n"],"names":[],"mappings":";;;AAEA,MAAM,OAAO,CAAC;AACd,EAAE,WAAW,CAAC,OAAO,EAAE;AACvB,IAAI,IAAI,CAAC,SAAS,mBAAmB,IAAI,GAAG,EAAE,CAAC;AAC/C,IAAI,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;AAC7B,IAAI,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,CAAC,UAAU,GAAG,MAAM;AAC5B,MAAM,MAAM,WAAW,GAAG,EAAE,CAAC;AAC7B,MAAM,MAAM,WAAW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I,CAAC,aAAa,EAAE;AAC5B,UAAU,aAAa,mBAAmB,IAAI,GAAG,EAAE,CAAC;AACpD,UAAU,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AACpD,SAAS;AACT,QAAQ,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC/B,OAAO;AACP,KAAK;AACL,GAAG;AACH,EAAE,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;AAChD,IAAI,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;AAC5B,MAAM,IAAI,GAAG,YAAY,OAAO,EAAE;AAClC,QAAQ,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACnD,OAAO,MAAM,IAAI,GAAG,YAAY,KAAK,EAAE;AACvC,QAAQ,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnE,QAAQ,IAAI,wBAAwB,EAAE;AACtC,UAAU,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChD,SAAS;AACT,QAAQ,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACzD,QAAQ,IAAI,aAAa,EAAE;AAC3B,UAAU,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACpC,SAAS;AACT,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Derived } from './derived.js';
|
|
2
|
+
|
|
3
|
+
const __storeToDerived = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
const __derivedToStore = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
const __depsThatHaveWrittenThisTick = {
|
|
6
|
+
current: []
|
|
7
|
+
};
|
|
8
|
+
let __isFlushing = false;
|
|
9
|
+
let __batchDepth = 0;
|
|
10
|
+
const __pendingUpdates = /* @__PURE__ */ new Set();
|
|
11
|
+
const __initialBatchValues = /* @__PURE__ */ new Map();
|
|
12
|
+
function __flush_internals(relatedVals) {
|
|
13
|
+
const sorted = Array.from(relatedVals).sort((a, b) => {
|
|
14
|
+
if (a instanceof Derived && a.options.deps.includes(b)) return 1;
|
|
15
|
+
if (b instanceof Derived && b.options.deps.includes(a)) return -1;
|
|
16
|
+
return 0;
|
|
17
|
+
});
|
|
18
|
+
for (const derived of sorted) {
|
|
19
|
+
if (__depsThatHaveWrittenThisTick.current.includes(derived)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
__depsThatHaveWrittenThisTick.current.push(derived);
|
|
23
|
+
derived.recompute();
|
|
24
|
+
const stores = __derivedToStore.get(derived);
|
|
25
|
+
if (stores) {
|
|
26
|
+
for (const store of stores) {
|
|
27
|
+
const relatedLinkedDerivedVals = __storeToDerived.get(store);
|
|
28
|
+
if (!relatedLinkedDerivedVals) continue;
|
|
29
|
+
__flush_internals(relatedLinkedDerivedVals);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function __notifyListeners(store) {
|
|
35
|
+
store.listeners.forEach(
|
|
36
|
+
(listener) => listener({
|
|
37
|
+
prevVal: store.prevState,
|
|
38
|
+
currentVal: store.state
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function __notifyDerivedListeners(derived) {
|
|
43
|
+
derived.listeners.forEach(
|
|
44
|
+
(listener) => listener({
|
|
45
|
+
prevVal: derived.prevState,
|
|
46
|
+
currentVal: derived.state
|
|
47
|
+
})
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function __flush(store) {
|
|
51
|
+
if (__batchDepth > 0 && !__initialBatchValues.has(store)) {
|
|
52
|
+
__initialBatchValues.set(store, store.prevState);
|
|
53
|
+
}
|
|
54
|
+
__pendingUpdates.add(store);
|
|
55
|
+
if (__isFlushing) return;
|
|
56
|
+
try {
|
|
57
|
+
__isFlushing = true;
|
|
58
|
+
while (__pendingUpdates.size > 0) {
|
|
59
|
+
const stores = Array.from(__pendingUpdates);
|
|
60
|
+
__pendingUpdates.clear();
|
|
61
|
+
for (const store2 of stores) {
|
|
62
|
+
const prevState = __initialBatchValues.get(store2) ?? store2.prevState;
|
|
63
|
+
store2.prevState = prevState;
|
|
64
|
+
__notifyListeners(store2);
|
|
65
|
+
}
|
|
66
|
+
for (const store2 of stores) {
|
|
67
|
+
const derivedVals = __storeToDerived.get(store2);
|
|
68
|
+
if (!derivedVals) continue;
|
|
69
|
+
__depsThatHaveWrittenThisTick.current.push(store2);
|
|
70
|
+
__flush_internals(derivedVals);
|
|
71
|
+
}
|
|
72
|
+
for (const store2 of stores) {
|
|
73
|
+
const derivedVals = __storeToDerived.get(store2);
|
|
74
|
+
if (!derivedVals) continue;
|
|
75
|
+
for (const derived of derivedVals) {
|
|
76
|
+
__notifyDerivedListeners(derived);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} finally {
|
|
81
|
+
__isFlushing = false;
|
|
82
|
+
__depsThatHaveWrittenThisTick.current = [];
|
|
83
|
+
__initialBatchValues.clear();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export { __depsThatHaveWrittenThisTick, __derivedToStore, __flush, __storeToDerived };
|
|
88
|
+
//# sourceMappingURL=scheduler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.js","sources":["../../../../../../node_modules/@tanstack/store/dist/esm/scheduler.js"],"sourcesContent":["import { Derived } from \"./derived.js\";\nconst __storeToDerived = /* @__PURE__ */ new WeakMap();\nconst __derivedToStore = /* @__PURE__ */ new WeakMap();\nconst __depsThatHaveWrittenThisTick = {\n current: []\n};\nlet __isFlushing = false;\nlet __batchDepth = 0;\nconst __pendingUpdates = /* @__PURE__ */ new Set();\nconst __initialBatchValues = /* @__PURE__ */ new Map();\nfunction __flush_internals(relatedVals) {\n const sorted = Array.from(relatedVals).sort((a, b) => {\n if (a instanceof Derived && a.options.deps.includes(b)) return 1;\n if (b instanceof Derived && b.options.deps.includes(a)) return -1;\n return 0;\n });\n for (const derived of sorted) {\n if (__depsThatHaveWrittenThisTick.current.includes(derived)) {\n continue;\n }\n __depsThatHaveWrittenThisTick.current.push(derived);\n derived.recompute();\n const stores = __derivedToStore.get(derived);\n if (stores) {\n for (const store of stores) {\n const relatedLinkedDerivedVals = __storeToDerived.get(store);\n if (!relatedLinkedDerivedVals) continue;\n __flush_internals(relatedLinkedDerivedVals);\n }\n }\n }\n}\nfunction __notifyListeners(store) {\n store.listeners.forEach(\n (listener) => listener({\n prevVal: store.prevState,\n currentVal: store.state\n })\n );\n}\nfunction __notifyDerivedListeners(derived) {\n derived.listeners.forEach(\n (listener) => listener({\n prevVal: derived.prevState,\n currentVal: derived.state\n })\n );\n}\nfunction __flush(store) {\n if (__batchDepth > 0 && !__initialBatchValues.has(store)) {\n __initialBatchValues.set(store, store.prevState);\n }\n __pendingUpdates.add(store);\n if (__batchDepth > 0) return;\n if (__isFlushing) return;\n try {\n __isFlushing = true;\n while (__pendingUpdates.size > 0) {\n const stores = Array.from(__pendingUpdates);\n __pendingUpdates.clear();\n for (const store2 of stores) {\n const prevState = __initialBatchValues.get(store2) ?? store2.prevState;\n store2.prevState = prevState;\n __notifyListeners(store2);\n }\n for (const store2 of stores) {\n const derivedVals = __storeToDerived.get(store2);\n if (!derivedVals) continue;\n __depsThatHaveWrittenThisTick.current.push(store2);\n __flush_internals(derivedVals);\n }\n for (const store2 of stores) {\n const derivedVals = __storeToDerived.get(store2);\n if (!derivedVals) continue;\n for (const derived of derivedVals) {\n __notifyDerivedListeners(derived);\n }\n }\n }\n } finally {\n __isFlushing = false;\n __depsThatHaveWrittenThisTick.current = [];\n __initialBatchValues.clear();\n }\n}\nfunction batch(fn) {\n __batchDepth++;\n try {\n fn();\n } finally {\n __batchDepth--;\n if (__batchDepth === 0) {\n const pendingUpdateToFlush = Array.from(__pendingUpdates)[0];\n if (pendingUpdateToFlush) {\n __flush(pendingUpdateToFlush);\n }\n }\n }\n}\nexport {\n __depsThatHaveWrittenThisTick,\n __derivedToStore,\n __flush,\n __storeToDerived,\n batch\n};\n//# sourceMappingURL=scheduler.js.map\n"],"names":[],"mappings":";;AACK,MAAC,gBAAgB,mBAAmB,IAAI,OAAO,GAAG;AAClD,MAAC,gBAAgB,mBAAmB,IAAI,OAAO,GAAG;AAClD,MAAC,6BAA6B,GAAG;AACtC,EAAE,OAAO,EAAE,EAAE;AACb,EAAE;AACF,IAAI,YAAY,GAAG,KAAK,CAAC;AACzB,IAAI,YAAY,GAAG,CAAC,CAAC;AACrB,MAAM,gBAAgB,mBAAmB,IAAI,GAAG,EAAE,CAAC;AACnD,MAAM,oBAAoB,mBAAmB,IAAI,GAAG,EAAE,CAAC;AACvD,SAAS,iBAAiB,CAAC,WAAW,EAAE;AACxC,EAAE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK;AACxD,IAAI,IAAI,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACrE,IAAI,IAAI,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AACtE,IAAI,OAAO,CAAC,CAAC;AACb,GAAG,CAAC,CAAC;AACL,EAAE,KAAK,MAAM,OAAO,IAAI,MAAM,EAAE;AAChC,IAAI,IAAI,6BAA6B,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;AACjE,MAAM,SAAS;AACf,KAAK;AACL,IAAI,6BAA6B,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,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,KAAK,EAAE,CAAC;AACjC,GAAG;AACH;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __flush } from './scheduler.js';
|
|
2
|
+
|
|
3
|
+
class Store {
|
|
4
|
+
constructor(initialState, options) {
|
|
5
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
this.subscribe = (listener) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
this.listeners.add(listener);
|
|
9
|
+
const unsub = (_b = (_a = this.options) == null ? void 0 : _a.onSubscribe) == null ? void 0 : _b.call(_a, listener, this);
|
|
10
|
+
return () => {
|
|
11
|
+
this.listeners.delete(listener);
|
|
12
|
+
unsub == null ? void 0 : unsub();
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
this.setState = (updater) => {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
this.prevState = this.state;
|
|
18
|
+
this.state = ((_a = this.options) == null ? void 0 : _a.updateFn) ? this.options.updateFn(this.prevState)(updater) : updater(this.prevState);
|
|
19
|
+
(_c = (_b = this.options) == null ? void 0 : _b.onUpdate) == null ? void 0 : _c.call(_b);
|
|
20
|
+
__flush(this);
|
|
21
|
+
};
|
|
22
|
+
this.prevState = initialState;
|
|
23
|
+
this.state = initialState;
|
|
24
|
+
this.options = options;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Store };
|
|
29
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../../../../../../node_modules/@tanstack/store/dist/esm/store.js"],"sourcesContent":["import { __flush } from \"./scheduler.js\";\nclass Store {\n constructor(initialState, options) {\n this.listeners = /* @__PURE__ */ new Set();\n this.subscribe = (listener) => {\n var _a, _b;\n this.listeners.add(listener);\n const unsub = (_b = (_a = this.options) == null ? void 0 : _a.onSubscribe) == null ? void 0 : _b.call(_a, listener, this);\n return () => {\n this.listeners.delete(listener);\n unsub == null ? void 0 : unsub();\n };\n };\n this.setState = (updater) => {\n var _a, _b, _c;\n this.prevState = this.state;\n this.state = ((_a = this.options) == null ? void 0 : _a.updateFn) ? this.options.updateFn(this.prevState)(updater) : updater(this.prevState);\n (_c = (_b = this.options) == null ? void 0 : _b.onUpdate) == null ? void 0 : _c.call(_b);\n __flush(this);\n };\n this.prevState = initialState;\n this.state = initialState;\n this.options = options;\n }\n}\nexport {\n Store\n};\n//# sourceMappingURL=store.js.map\n"],"names":[],"mappings":";;AACA,MAAM,KAAK,CAAC;AACZ,EAAE,WAAW,CAAC,YAAY,EAAE,OAAO,EAAE;AACrC,IAAI,IAAI,CAAC,SAAS,mBAAmB,IAAI,GAAG,EAAE,CAAC;AAC/C,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,QAAQ,KAAK;AACnC,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;AACjB,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACnC,MAAM,MAAM,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,WAAW,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;AAChI,MAAM,OAAO,MAAM;AACnB,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACxC,QAAQ,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,EAAE,CAAC;AACzC,OAAO,CAAC;AACR,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,OAAO,KAAK;AACjC,MAAM,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AACrB,MAAM,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;AAClC,MAAM,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACnJ,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/F,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC;AAClC,IAAI,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;AAC9B,IAAI,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,GAAG;AACH;;;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Store } from '../../node_modules/@tanstack/store/dist/esm/store.js';
|
|
2
|
+
|
|
3
|
+
const bootStore = new Store({
|
|
4
|
+
context: 'web',
|
|
5
|
+
environments: {
|
|
6
|
+
appBaseUrl: undefined,
|
|
7
|
+
appTimeout: 30000,
|
|
8
|
+
},
|
|
9
|
+
middleware: (next) => {
|
|
10
|
+
return next();
|
|
11
|
+
},
|
|
12
|
+
modelConfig: undefined,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { bootStore };
|
|
16
|
+
//# sourceMappingURL=bootStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootStore.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'url-search-params-polyfill';
|
|
2
|
+
import { bootStore } from './bootStore.js';
|
|
3
|
+
|
|
4
|
+
const bootstrapQueryRequest = async (queryClient, options) => {
|
|
5
|
+
// set default query config
|
|
6
|
+
await queryClient.resumePausedMutations();
|
|
7
|
+
bootStore.setState(() => options);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { bootstrapQueryRequest };
|
|
11
|
+
//# sourceMappingURL=bootstrapQueryRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrapQueryRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrapQueryRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useStore } from '../../node_modules/@tanstack/react-store/dist/esm/index.js';
|
|
2
|
+
import { bootStore } from './bootStore.js';
|
|
3
|
+
|
|
4
|
+
const useReactNativeEnv = () => {
|
|
5
|
+
const { environments, context } = useStore(bootStore);
|
|
6
|
+
const appUrl = environments?.appBaseUrl;
|
|
7
|
+
const appTimeout = environments?.appTimeout;
|
|
8
|
+
const isApp = context === 'app';
|
|
9
|
+
return { appUrl, appTimeout, isApp };
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { useReactNativeEnv };
|
|
13
|
+
//# sourceMappingURL=useReactNativeEnv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactNativeEnv.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useReactNativeEnv.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { bootstrapQueryRequest } from './config/bootstrapQueryRequest.js';
|
|
2
2
|
export { useEnvironmentVariables } from './config/useEnvironmentVariables.js';
|
|
3
|
-
export { useQueryConfig } from './config/useQueryConfig.js';
|
|
4
3
|
export { useQueryHeaders } from './config/useQueryHeaders.js';
|
|
5
4
|
export { useReactNativeEnv } from './config/useReactNativeEnv.js';
|
|
6
5
|
export { scrollToTop } from './helpers/scrollToTop.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useStore } from '../../node_modules/@tanstack/react-store/dist/esm/index.js';
|
|
2
3
|
import result from 'lodash.result';
|
|
3
4
|
import lodashSet from 'lodash.set';
|
|
4
|
-
import '
|
|
5
|
-
import { useQueryConfig } from '../config/useQueryConfig.js';
|
|
6
|
-
import '../stores/useHeaderStore.js';
|
|
7
|
-
import '../stores/usePauseFutureRequests.js';
|
|
5
|
+
import { bootStore } from '../config/bootStore.js';
|
|
8
6
|
import { useKeyTrackerModel } from './useKeyTrackerModel.js';
|
|
9
7
|
|
|
10
8
|
const useQueryModel = (keyTracker) => {
|
|
11
9
|
const queryClient = useQueryClient();
|
|
12
10
|
const { getQueryKey } = useKeyTrackerModel(keyTracker);
|
|
13
11
|
const queryKey = getQueryKey();
|
|
14
|
-
const config =
|
|
12
|
+
const config = useStore(bootStore);
|
|
15
13
|
const add = (data, position, path) => {
|
|
16
14
|
let records = (findAll(path) ?? []);
|
|
17
15
|
if (!position || position === 'end') {
|
|
@@ -67,8 +65,7 @@ const useQueryModel = (keyTracker) => {
|
|
|
67
65
|
return queryClient.setQueryData(queryKey, () => newData);
|
|
68
66
|
};
|
|
69
67
|
const getModelConfig = () => {
|
|
70
|
-
const {
|
|
71
|
-
const { modelConfig } = options ?? {};
|
|
68
|
+
const { modelConfig } = config;
|
|
72
69
|
return modelConfig;
|
|
73
70
|
};
|
|
74
71
|
const update = (id, data, path) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQueryModel.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useQueryModel.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useStore } from '../../node_modules/@tanstack/react-store/dist/esm/index.js';
|
|
2
3
|
import { useState, useEffect } from 'react';
|
|
3
4
|
import 'url-search-params-polyfill';
|
|
5
|
+
import { bootStore } from '../config/bootStore.js';
|
|
4
6
|
import { useEnvironmentVariables } from '../config/useEnvironmentVariables.js';
|
|
5
|
-
import { useQueryConfig } from '../config/useQueryConfig.js';
|
|
6
7
|
import { useHeaderStore } from '../stores/useHeaderStore.js';
|
|
7
8
|
import { usePauseFutureRequests } from '../stores/usePauseFutureRequests.js';
|
|
8
9
|
import 'axios';
|
|
@@ -13,7 +14,7 @@ const useDeleteRequest = (deleteOptions) => {
|
|
|
13
14
|
const { baseUrl, headers } = deleteOptions ?? {};
|
|
14
15
|
const [requestPath, setRequestPath] = useState('');
|
|
15
16
|
const [options, setOptions] = useState();
|
|
16
|
-
const {
|
|
17
|
+
const { middleware } = useStore(bootStore);
|
|
17
18
|
const [requestPayload, setRequestPayload] = useState();
|
|
18
19
|
const isFutureQueriesPaused = usePauseFutureRequests((state) => state.isFutureQueriesPaused);
|
|
19
20
|
const { API_URL, TIMEOUT } = useEnvironmentVariables();
|
|
@@ -29,9 +30,9 @@ const useDeleteRequest = (deleteOptions) => {
|
|
|
29
30
|
timeout: TIMEOUT,
|
|
30
31
|
};
|
|
31
32
|
let deleteResponse;
|
|
32
|
-
if (
|
|
33
|
+
if (middleware) {
|
|
33
34
|
// perform global middleware
|
|
34
|
-
deleteResponse = await
|
|
35
|
+
deleteResponse = await middleware(async (middlewareOptions) => await makeRequest(middlewareOptions ? { ...requestOptions, ...middlewareOptions } : requestOptions), {
|
|
35
36
|
path: requestUrl,
|
|
36
37
|
baseUrl: baseUrl ?? API_URL,
|
|
37
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeleteRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDeleteRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useQueryClient, useInfiniteQuery } from '@tanstack/react-query';
|
|
2
2
|
import { useState, useMemo, useEffect, startTransition } from 'react';
|
|
3
3
|
import 'url-search-params-polyfill';
|
|
4
|
+
import { bootStore } from '../config/bootStore.js';
|
|
4
5
|
import { useEnvironmentVariables } from '../config/useEnvironmentVariables.js';
|
|
5
|
-
import { useQueryConfig } from '../config/useQueryConfig.js';
|
|
6
6
|
import { useHeaderStore } from '../stores/useHeaderStore.js';
|
|
7
7
|
import { usePauseFutureRequests } from '../stores/usePauseFutureRequests.js';
|
|
8
|
+
import { useStore } from '../../node_modules/@tanstack/react-store/dist/esm/index.js';
|
|
8
9
|
import 'axios';
|
|
9
10
|
import { makeRequest } from '../request/make-request.js';
|
|
10
11
|
import '../request/request.enum.js';
|
|
@@ -14,7 +15,7 @@ const useGetInfiniteRequest = ({ path, load = false, queryOptions, keyTracker, b
|
|
|
14
15
|
const globalHeaders = useHeaderStore((state) => state.headers);
|
|
15
16
|
const [requestPath, setRequestPath] = useState(path);
|
|
16
17
|
const [options, setOptions] = useState(queryOptions);
|
|
17
|
-
const {
|
|
18
|
+
const { middleware } = useStore(bootStore);
|
|
18
19
|
const [requestPayload, setRequestPayload] = useState();
|
|
19
20
|
const isFutureQueriesPaused = usePauseFutureRequests((state) => state.isFutureQueriesPaused);
|
|
20
21
|
let queryClient = useQueryClient();
|
|
@@ -30,9 +31,9 @@ const useGetInfiniteRequest = ({ path, load = false, queryOptions, keyTracker, b
|
|
|
30
31
|
timeout: TIMEOUT,
|
|
31
32
|
};
|
|
32
33
|
let getResponse;
|
|
33
|
-
if (
|
|
34
|
+
if (middleware) {
|
|
34
35
|
// perform global middleware
|
|
35
|
-
getResponse = await
|
|
36
|
+
getResponse = await middleware(async (middlewareOptions) => await makeRequest(middlewareOptions ? { ...requestOptions, ...middlewareOptions } : requestOptions), {
|
|
36
37
|
path,
|
|
37
38
|
baseUrl: baseUrl ?? API_URL,
|
|
38
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetInfiniteRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetInfiniteRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useQueryClient, useQuery } from '@tanstack/react-query';
|
|
2
2
|
import { useState, useMemo, useEffect, startTransition } from 'react';
|
|
3
3
|
import 'url-search-params-polyfill';
|
|
4
|
+
import { bootStore } from '../config/bootStore.js';
|
|
4
5
|
import { useEnvironmentVariables } from '../config/useEnvironmentVariables.js';
|
|
5
|
-
import { useQueryConfig } from '../config/useQueryConfig.js';
|
|
6
6
|
import { useHeaderStore } from '../stores/useHeaderStore.js';
|
|
7
7
|
import { usePauseFutureRequests } from '../stores/usePauseFutureRequests.js';
|
|
8
|
+
import { useStore } from '../../node_modules/@tanstack/react-store/dist/esm/index.js';
|
|
8
9
|
import 'axios';
|
|
9
10
|
import { makeRequest } from '../request/make-request.js';
|
|
10
11
|
import '../request/request.enum.js';
|
|
@@ -14,8 +15,8 @@ const useGetRequest = ({ path, load = false, queryOptions, keyTracker, baseUrl,
|
|
|
14
15
|
const [options, setOptions] = useState(queryOptions);
|
|
15
16
|
const [page, setPage] = useState(1);
|
|
16
17
|
const { API_URL, TIMEOUT } = useEnvironmentVariables();
|
|
18
|
+
const { middleware } = useStore(bootStore);
|
|
17
19
|
const globalHeaders = useHeaderStore((state) => state.headers);
|
|
18
|
-
const { options: queryConfigOptions } = useQueryConfig();
|
|
19
20
|
const [requestPayload, setRequestPayload] = useState();
|
|
20
21
|
const isFutureQueriesPaused = usePauseFutureRequests((state) => state.isFutureQueriesPaused);
|
|
21
22
|
let queryClient = useQueryClient();
|
|
@@ -31,9 +32,9 @@ const useGetRequest = ({ path, load = false, queryOptions, keyTracker, baseUrl,
|
|
|
31
32
|
timeout: TIMEOUT,
|
|
32
33
|
};
|
|
33
34
|
let getResponse;
|
|
34
|
-
if (
|
|
35
|
+
if (middleware) {
|
|
35
36
|
// perform global middleware
|
|
36
|
-
getResponse = await
|
|
37
|
+
getResponse = await middleware(async (middlewareOptions) => await makeRequest(middlewareOptions ? { ...requestOptions, ...middlewareOptions } : requestOptions), {
|
|
37
38
|
path,
|
|
38
39
|
baseUrl: baseUrl ?? API_URL,
|
|
39
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { useStore } from '../../node_modules/@tanstack/react-store/dist/esm/index.js';
|
|
2
3
|
import { useState, useEffect } from 'react';
|
|
3
4
|
import 'url-search-params-polyfill';
|
|
5
|
+
import { bootStore } from '../config/bootStore.js';
|
|
4
6
|
import { useEnvironmentVariables } from '../config/useEnvironmentVariables.js';
|
|
5
|
-
import { useQueryConfig } from '../config/useQueryConfig.js';
|
|
6
7
|
import { useHeaderStore } from '../stores/useHeaderStore.js';
|
|
7
8
|
import { usePauseFutureRequests } from '../stores/usePauseFutureRequests.js';
|
|
8
9
|
import { scrollToTop } from '../helpers/scrollToTop.js';
|
|
@@ -17,7 +18,7 @@ const usePatchRequest = ({ path, baseUrl, headers }) => {
|
|
|
17
18
|
const globalHeaders = useHeaderStore((state) => state.headers);
|
|
18
19
|
const [requestPayload, setRequestPayload] = useState();
|
|
19
20
|
const isFutureMutationsPaused = usePauseFutureRequests((state) => state.isFutureMutationsPaused);
|
|
20
|
-
const
|
|
21
|
+
const { middleware, context } = useStore(bootStore);
|
|
21
22
|
const sendRequest = async (res, rej, data) => {
|
|
22
23
|
// get request headers
|
|
23
24
|
const requestOptions = {
|
|
@@ -30,9 +31,9 @@ const usePatchRequest = ({ path, baseUrl, headers }) => {
|
|
|
30
31
|
onUploadProgress,
|
|
31
32
|
};
|
|
32
33
|
let patchResponse;
|
|
33
|
-
if (
|
|
34
|
+
if (middleware) {
|
|
34
35
|
// perform global middleware
|
|
35
|
-
const middlewareResponse = await
|
|
36
|
+
const middlewareResponse = await middleware(async (options) => await makeRequest(options ? { ...requestOptions, ...options } : requestOptions), {
|
|
36
37
|
path,
|
|
37
38
|
baseUrl: baseUrl ?? API_URL,
|
|
38
39
|
body: data,
|
|
@@ -44,14 +45,14 @@ const usePatchRequest = ({ path, baseUrl, headers }) => {
|
|
|
44
45
|
}
|
|
45
46
|
if (patchResponse.status) {
|
|
46
47
|
// scroll to top after success
|
|
47
|
-
if (
|
|
48
|
+
if (context !== 'app') {
|
|
48
49
|
scrollToTop();
|
|
49
50
|
}
|
|
50
51
|
res(patchResponse);
|
|
51
52
|
}
|
|
52
53
|
else {
|
|
53
54
|
// scroll to top after error
|
|
54
|
-
if (
|
|
55
|
+
if (context !== 'app') {
|
|
55
56
|
scrollToTop();
|
|
56
57
|
}
|
|
57
58
|
rej(patchResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePatchRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePatchRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import 'url-search-params-polyfill';
|
|
3
|
+
import { bootStore } from '../config/bootStore.js';
|
|
3
4
|
import { useEnvironmentVariables } from '../config/useEnvironmentVariables.js';
|
|
4
|
-
import { useQueryConfig } from '../config/useQueryConfig.js';
|
|
5
5
|
import { useHeaderStore } from '../stores/useHeaderStore.js';
|
|
6
6
|
import { usePauseFutureRequests } from '../stores/usePauseFutureRequests.js';
|
|
7
7
|
import { useReactNativeEnv } from '../config/useReactNativeEnv.js';
|
|
8
|
+
import { useStore } from '../../node_modules/@tanstack/react-store/dist/esm/index.js';
|
|
8
9
|
import { useState, useEffect } from 'react';
|
|
9
10
|
import { scrollToTop } from '../helpers/scrollToTop.js';
|
|
10
11
|
import { useUploadProgress } from '../hooks/useUploadProgress.js';
|
|
@@ -14,7 +15,7 @@ import { HttpMethod } from '../request/request.enum.js';
|
|
|
14
15
|
|
|
15
16
|
const usePostRequest = ({ path, isFormData = false, baseUrl, headers, fileSelectors, }) => {
|
|
16
17
|
const { API_URL, TIMEOUT } = useEnvironmentVariables();
|
|
17
|
-
const
|
|
18
|
+
const { middleware, context } = useStore(bootStore);
|
|
18
19
|
const globalHeaders = useHeaderStore((state) => state.headers);
|
|
19
20
|
const { isApp } = useReactNativeEnv();
|
|
20
21
|
const { uploadProgressPercent, onUploadProgress } = useUploadProgress();
|
|
@@ -40,9 +41,9 @@ const usePostRequest = ({ path, isFormData = false, baseUrl, headers, fileSelect
|
|
|
40
41
|
...requestConfig,
|
|
41
42
|
};
|
|
42
43
|
let postResponse;
|
|
43
|
-
if (
|
|
44
|
+
if (middleware) {
|
|
44
45
|
// perform global middleware
|
|
45
|
-
postResponse = await
|
|
46
|
+
postResponse = await middleware(async (options) => await makeRequest(options ? { ...requestOptions, ...options } : requestOptions), {
|
|
46
47
|
path,
|
|
47
48
|
baseUrl: baseUrl ?? API_URL,
|
|
48
49
|
body: data,
|
|
@@ -53,14 +54,14 @@ const usePostRequest = ({ path, isFormData = false, baseUrl, headers, fileSelect
|
|
|
53
54
|
}
|
|
54
55
|
if (postResponse.status) {
|
|
55
56
|
// scroll to top after success
|
|
56
|
-
if (
|
|
57
|
+
if (context !== 'app') {
|
|
57
58
|
scrollToTop();
|
|
58
59
|
}
|
|
59
60
|
res(postResponse);
|
|
60
61
|
}
|
|
61
62
|
else {
|
|
62
63
|
// scroll to top after error
|
|
63
|
-
if (
|
|
64
|
+
if (context !== 'app') {
|
|
64
65
|
scrollToTop();
|
|
65
66
|
}
|
|
66
67
|
rej(postResponse);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePostRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePostRequest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|