@cartanova/qgrid-cli 1.0.2 → 1.0.4
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/bundle/dist/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js +9 -0
- package/bundle/dist/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js +6 -0
- package/bundle/dist/dist/_virtual/_rolldown/runtime.js +15 -0
- package/bundle/dist/dist/application/qgrid/oauth.js +140 -0
- package/bundle/dist/dist/application/qgrid/pool.js +100 -0
- package/bundle/dist/dist/application/qgrid/qgrid.frame.js +280 -0
- package/bundle/dist/dist/application/qgrid/qgrid.types.js +79 -0
- package/bundle/dist/dist/application/qgrid/worker.js +183 -0
- package/bundle/dist/dist/application/queries.generated.js +31 -0
- package/bundle/dist/dist/application/request-log/request-log.model.js +113 -0
- package/bundle/dist/dist/application/request-log/request-log.types.js +13 -0
- package/bundle/dist/dist/application/sonamu.generated.js +99 -0
- package/bundle/dist/dist/application/sonamu.generated.sso.js +34 -0
- package/bundle/dist/dist/application/token/token.model.js +157 -0
- package/bundle/dist/dist/application/token/token.types.js +22 -0
- package/bundle/dist/dist/i18n/en.js +63 -0
- package/bundle/dist/dist/i18n/ko.js +62 -0
- package/bundle/dist/dist/i18n/sd.generated.js +272 -0
- package/bundle/dist/dist/index.js +11 -0
- package/bundle/dist/dist/migrations/20260410171405_create__request_logs.js +26 -0
- package/bundle/dist/dist/migrations/20260410171406_create__tokens.js +24 -0
- package/bundle/dist/dist/migrations/20260411120624_alter_tokens_alter2.js +16 -0
- package/bundle/dist/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.js +155 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_expect@4.1.2/node_modules/@vitest/expect/dist/index.js +1484 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_pretty-format@4.1.2/node_modules/@vitest/pretty-format/dist/index.js +887 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/chunk-artifact.js +2746 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/index.js +8 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_runner@4.1.2/node_modules/@vitest/runner/dist/utils.js +8 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_snapshot@4.1.2/node_modules/@vitest/snapshot/dist/index.js +662 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_spy@4.1.2/node_modules/@vitest/spy/dist/index.js +386 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +82 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/constants.js +48 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/diff.js +1307 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/display.js +558 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/error.js +33 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/helpers.js +226 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/offset.js +27 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/serialize.js +77 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/source-map.js +374 -0
- package/bundle/dist/dist/node_modules/.pnpm/@vitest_utils@4.1.2/node_modules/@vitest/utils/dist/timers.js +37 -0
- package/bundle/dist/dist/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.js +2886 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/branding.js +10 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/index.js +109 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/messages.js +10 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/overloads.js +10 -0
- package/bundle/dist/dist/node_modules/.pnpm/expect-type@1.3.0/node_modules/expect-type/dist/utils.js +10 -0
- package/bundle/dist/dist/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.js +1127 -0
- package/bundle/dist/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.js +21 -0
- package/bundle/dist/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.js +432 -0
- package/bundle/dist/dist/node_modules/.pnpm/tinybench@2.9.0/node_modules/tinybench/dist/index.js +506 -0
- package/bundle/dist/dist/node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.js +86 -0
- package/bundle/dist/dist/node_modules/.pnpm/vite@8.0.3_@emnapi_core@1.9.2_@emnapi_runtime@1.9.2_@types_node@25.0.7_esbuild@0.27.4_jiti@2.6.1_sass@1.98.0_tsx@4.21.0/node_modules/vite/dist/node/module-runner.js +426 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js +6 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js +41 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/evaluatedModules.Dg1zASAC.js +19 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/index.Chj8NDwU.js +202 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/index.DOa3dzoN.js +16 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js +59 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/test.p_J6dB8a.js +2910 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js +44 -0
- package/bundle/dist/dist/node_modules/.pnpm/vitest@4.1.2_@opentelemetry_api@1.9.0_@types_node@25.0.7_vite@8.0.3_@emnapi_core@1.9.2__bb31087278f97a39b31b92010beab980/node_modules/vitest/dist/index.js +28 -0
- package/bundle/dist/dist/sonamu.config.js +196 -0
- package/bundle/dist/dist/testing/fixture.js +8 -0
- package/bundle/dist/dist/testing/global.js +9 -0
- package/bundle/dist/dist/testing/setup-mocks.js +17 -0
- package/bundle/dist/dist/utils/subset-loaders.js +12 -0
- package/bundle/src/src/application/qgrid/oauth.ts +181 -0
- package/bundle/src/src/application/qgrid/pool.ts +132 -0
- package/bundle/src/src/application/qgrid/qgrid.frame.ts +275 -0
- package/bundle/src/src/application/qgrid/qgrid.types.ts +117 -0
- package/bundle/src/src/application/qgrid/worker.ts +234 -0
- package/bundle/src/src/application/queries.generated.ts +59 -0
- package/bundle/src/src/application/request-log/request-log.entity.json +75 -0
- package/bundle/src/src/application/request-log/request-log.model.ts +155 -0
- package/bundle/src/src/application/request-log/request-log.types.ts +15 -0
- package/bundle/src/src/application/sonamu.generated.http +187 -0
- package/bundle/src/src/application/sonamu.generated.sso.ts +66 -0
- package/bundle/src/src/application/sonamu.generated.ts +135 -0
- package/bundle/src/src/application/token/token.entity.json +37 -0
- package/bundle/src/src/application/token/token.model.ts +160 -0
- package/bundle/src/src/application/token/token.types.ts +26 -0
- package/bundle/src/src/i18n/en.ts +59 -0
- package/bundle/src/src/i18n/ko.ts +59 -0
- package/bundle/src/src/i18n/sd.generated.ts +384 -0
- package/bundle/src/src/index.ts +6 -0
- package/bundle/src/src/migrations/20260410171405_create__request_logs.ts +23 -0
- package/bundle/src/src/migrations/20260410171406_create__tokens.ts +21 -0
- package/bundle/src/src/migrations/20260411120624_alter_tokens_alter2.ts +15 -0
- package/bundle/src/src/sonamu.config.ts +248 -0
- package/bundle/src/src/testing/fixture.ts +6 -0
- package/bundle/src/src/testing/global.ts +6 -0
- package/bundle/src/src/testing/setup-mocks.ts +44 -0
- package/bundle/src/src/typings/fastify.d.ts +8 -0
- package/bundle/src/src/typings/sonamu.d.ts +17 -0
- package/bundle/src/src/utils/subset-loaders.ts +11 -0
- package/bundle/web-dist/web-dist/client/assets/index-DlPchHBY.js +116 -0
- package/bundle/web-dist/web-dist/client/assets/index-vZsvyuFn.css +1 -0
- package/bundle/web-dist/web-dist/client/assets/rolldown-runtime-Dw2cE7zH.js +1 -0
- package/bundle/web-dist/web-dist/client/assets/routes-CagDz23B.js +1 -0
- package/bundle/web-dist/web-dist/client/assets/sd.generated-BrQoQXvv.js +47 -0
- package/bundle/web-dist/web-dist/client/assets/services.generated-BspO2L0j.js +1 -0
- package/bundle/web-dist/web-dist/client/assets/show-aXUGa0gm.js +29 -0
- package/bundle/web-dist/web-dist/client/assets/tokens-DRkXtZ3Q.js +1 -0
- package/bundle/web-dist/web-dist/client/assets/vendor-react-DH4kUfK2.js +9 -0
- package/bundle/web-dist/web-dist/client/assets/vendor-tanstack-CUxlo6YN.js +1 -0
- package/bundle/web-dist/web-dist/client/index.html +18 -0
- package/bundle/web-dist/web-dist/server/assets/react-dom-CGIzOSuj.js +335 -0
- package/bundle/web-dist/web-dist/server/assets/routes-ClzReRep.js +490 -0
- package/bundle/web-dist/web-dist/server/assets/sd.generated-BnonqqKr.js +21694 -0
- package/bundle/web-dist/web-dist/server/assets/services.generated-D5ABD5fr.js +836 -0
- package/bundle/web-dist/web-dist/server/assets/show-C9pcdSxc.js +23364 -0
- package/bundle/web-dist/web-dist/server/assets/tokens-JH6FsnWZ.js +860 -0
- package/bundle/web-dist/web-dist/server/entry-server.generated.js +44646 -0
- package/package.json +10 -9
|
@@ -0,0 +1,836 @@
|
|
|
1
|
+
import { B as noop, C as getDefaultState, D as notifyManager, F as hashKey, G as shallowEqualObjects, H as replaceData, J as timeUntilStale, K as shouldThrowError, L as isValidTimeout, O as pendingThenable, T as fetchState, U as resolveEnabled, W as resolveStaleTime, X as focusManager, Y as timeoutManager, Z as Subscribable, _ as require_lib, a as fetch, b as require_jsx_runtime, k as environmentManager, tt as __toESM, x as require_react, y as useQueryClient } from "./sd.generated-BnonqqKr.js";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.95.2/node_modules/@tanstack/query-core/build/modern/queryObserver.js
|
|
3
|
+
var QueryObserver = class extends Subscribable {
|
|
4
|
+
constructor(client, options) {
|
|
5
|
+
super();
|
|
6
|
+
this.options = options;
|
|
7
|
+
this.#client = client;
|
|
8
|
+
this.#selectError = null;
|
|
9
|
+
this.#currentThenable = pendingThenable();
|
|
10
|
+
this.bindMethods();
|
|
11
|
+
this.setOptions(options);
|
|
12
|
+
}
|
|
13
|
+
#client;
|
|
14
|
+
#currentQuery = void 0;
|
|
15
|
+
#currentQueryInitialState = void 0;
|
|
16
|
+
#currentResult = void 0;
|
|
17
|
+
#currentResultState;
|
|
18
|
+
#currentResultOptions;
|
|
19
|
+
#currentThenable;
|
|
20
|
+
#selectError;
|
|
21
|
+
#selectFn;
|
|
22
|
+
#selectResult;
|
|
23
|
+
#lastQueryWithDefinedData;
|
|
24
|
+
#staleTimeoutId;
|
|
25
|
+
#refetchIntervalId;
|
|
26
|
+
#currentRefetchInterval;
|
|
27
|
+
#trackedProps = /* @__PURE__ */ new Set();
|
|
28
|
+
bindMethods() {
|
|
29
|
+
this.refetch = this.refetch.bind(this);
|
|
30
|
+
}
|
|
31
|
+
onSubscribe() {
|
|
32
|
+
if (this.listeners.size === 1) {
|
|
33
|
+
this.#currentQuery.addObserver(this);
|
|
34
|
+
if (shouldFetchOnMount(this.#currentQuery, this.options)) this.#executeFetch();
|
|
35
|
+
else this.updateResult();
|
|
36
|
+
this.#updateTimers();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
onUnsubscribe() {
|
|
40
|
+
if (!this.hasListeners()) this.destroy();
|
|
41
|
+
}
|
|
42
|
+
shouldFetchOnReconnect() {
|
|
43
|
+
return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnReconnect);
|
|
44
|
+
}
|
|
45
|
+
shouldFetchOnWindowFocus() {
|
|
46
|
+
return shouldFetchOn(this.#currentQuery, this.options, this.options.refetchOnWindowFocus);
|
|
47
|
+
}
|
|
48
|
+
destroy() {
|
|
49
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
50
|
+
this.#clearStaleTimeout();
|
|
51
|
+
this.#clearRefetchInterval();
|
|
52
|
+
this.#currentQuery.removeObserver(this);
|
|
53
|
+
}
|
|
54
|
+
setOptions(options) {
|
|
55
|
+
const prevOptions = this.options;
|
|
56
|
+
const prevQuery = this.#currentQuery;
|
|
57
|
+
this.options = this.#client.defaultQueryOptions(options);
|
|
58
|
+
if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== "boolean") throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");
|
|
59
|
+
this.#updateQuery();
|
|
60
|
+
this.#currentQuery.setOptions(this.options);
|
|
61
|
+
if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) this.#client.getQueryCache().notify({
|
|
62
|
+
type: "observerOptionsUpdated",
|
|
63
|
+
query: this.#currentQuery,
|
|
64
|
+
observer: this
|
|
65
|
+
});
|
|
66
|
+
const mounted = this.hasListeners();
|
|
67
|
+
if (mounted && shouldFetchOptionally(this.#currentQuery, prevQuery, this.options, prevOptions)) this.#executeFetch();
|
|
68
|
+
this.updateResult();
|
|
69
|
+
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))) this.#updateStaleTimeout();
|
|
70
|
+
const nextRefetchInterval = this.#computeRefetchInterval();
|
|
71
|
+
if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) this.#updateRefetchInterval(nextRefetchInterval);
|
|
72
|
+
}
|
|
73
|
+
getOptimisticResult(options) {
|
|
74
|
+
const query = this.#client.getQueryCache().build(this.#client, options);
|
|
75
|
+
const result = this.createResult(query, options);
|
|
76
|
+
if (shouldAssignObserverCurrentProperties(this, result)) {
|
|
77
|
+
this.#currentResult = result;
|
|
78
|
+
this.#currentResultOptions = this.options;
|
|
79
|
+
this.#currentResultState = this.#currentQuery.state;
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
getCurrentResult() {
|
|
84
|
+
return this.#currentResult;
|
|
85
|
+
}
|
|
86
|
+
trackResult(result, onPropTracked) {
|
|
87
|
+
return new Proxy(result, { get: (target, key) => {
|
|
88
|
+
this.trackProp(key);
|
|
89
|
+
onPropTracked?.(key);
|
|
90
|
+
if (key === "promise") {
|
|
91
|
+
this.trackProp("data");
|
|
92
|
+
if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") this.#currentThenable.reject(/* @__PURE__ */ new Error("experimental_prefetchInRender feature flag is not enabled"));
|
|
93
|
+
}
|
|
94
|
+
return Reflect.get(target, key);
|
|
95
|
+
} });
|
|
96
|
+
}
|
|
97
|
+
trackProp(key) {
|
|
98
|
+
this.#trackedProps.add(key);
|
|
99
|
+
}
|
|
100
|
+
getCurrentQuery() {
|
|
101
|
+
return this.#currentQuery;
|
|
102
|
+
}
|
|
103
|
+
refetch({ ...options } = {}) {
|
|
104
|
+
return this.fetch({ ...options });
|
|
105
|
+
}
|
|
106
|
+
fetchOptimistic(options) {
|
|
107
|
+
const defaultedOptions = this.#client.defaultQueryOptions(options);
|
|
108
|
+
const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
|
|
109
|
+
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
110
|
+
}
|
|
111
|
+
fetch(fetchOptions) {
|
|
112
|
+
return this.#executeFetch({
|
|
113
|
+
...fetchOptions,
|
|
114
|
+
cancelRefetch: fetchOptions.cancelRefetch ?? true
|
|
115
|
+
}).then(() => {
|
|
116
|
+
this.updateResult();
|
|
117
|
+
return this.#currentResult;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
#executeFetch(fetchOptions) {
|
|
121
|
+
this.#updateQuery();
|
|
122
|
+
let promise = this.#currentQuery.fetch(this.options, fetchOptions);
|
|
123
|
+
if (!fetchOptions?.throwOnError) promise = promise.catch(noop);
|
|
124
|
+
return promise;
|
|
125
|
+
}
|
|
126
|
+
#updateStaleTimeout() {
|
|
127
|
+
this.#clearStaleTimeout();
|
|
128
|
+
const staleTime = resolveStaleTime(this.options.staleTime, this.#currentQuery);
|
|
129
|
+
if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) return;
|
|
130
|
+
const timeout = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime) + 1;
|
|
131
|
+
this.#staleTimeoutId = timeoutManager.setTimeout(() => {
|
|
132
|
+
if (!this.#currentResult.isStale) this.updateResult();
|
|
133
|
+
}, timeout);
|
|
134
|
+
}
|
|
135
|
+
#computeRefetchInterval() {
|
|
136
|
+
return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
|
|
137
|
+
}
|
|
138
|
+
#updateRefetchInterval(nextInterval) {
|
|
139
|
+
this.#clearRefetchInterval();
|
|
140
|
+
this.#currentRefetchInterval = nextInterval;
|
|
141
|
+
if (environmentManager.isServer() || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) return;
|
|
142
|
+
this.#refetchIntervalId = timeoutManager.setInterval(() => {
|
|
143
|
+
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) this.#executeFetch();
|
|
144
|
+
}, this.#currentRefetchInterval);
|
|
145
|
+
}
|
|
146
|
+
#updateTimers() {
|
|
147
|
+
this.#updateStaleTimeout();
|
|
148
|
+
this.#updateRefetchInterval(this.#computeRefetchInterval());
|
|
149
|
+
}
|
|
150
|
+
#clearStaleTimeout() {
|
|
151
|
+
if (this.#staleTimeoutId) {
|
|
152
|
+
timeoutManager.clearTimeout(this.#staleTimeoutId);
|
|
153
|
+
this.#staleTimeoutId = void 0;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
#clearRefetchInterval() {
|
|
157
|
+
if (this.#refetchIntervalId) {
|
|
158
|
+
timeoutManager.clearInterval(this.#refetchIntervalId);
|
|
159
|
+
this.#refetchIntervalId = void 0;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
createResult(query, options) {
|
|
163
|
+
const prevQuery = this.#currentQuery;
|
|
164
|
+
const prevOptions = this.options;
|
|
165
|
+
const prevResult = this.#currentResult;
|
|
166
|
+
const prevResultState = this.#currentResultState;
|
|
167
|
+
const prevResultOptions = this.#currentResultOptions;
|
|
168
|
+
const queryInitialState = query !== prevQuery ? query.state : this.#currentQueryInitialState;
|
|
169
|
+
const { state } = query;
|
|
170
|
+
let newState = { ...state };
|
|
171
|
+
let isPlaceholderData = false;
|
|
172
|
+
let data;
|
|
173
|
+
if (options._optimisticResults) {
|
|
174
|
+
const mounted = this.hasListeners();
|
|
175
|
+
const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
176
|
+
const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
177
|
+
if (fetchOnMount || fetchOptionally) newState = {
|
|
178
|
+
...newState,
|
|
179
|
+
...fetchState(state.data, query.options)
|
|
180
|
+
};
|
|
181
|
+
if (options._optimisticResults === "isRestoring") newState.fetchStatus = "idle";
|
|
182
|
+
}
|
|
183
|
+
let { error, errorUpdatedAt, status } = newState;
|
|
184
|
+
data = newState.data;
|
|
185
|
+
let skipSelect = false;
|
|
186
|
+
if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
|
|
187
|
+
let placeholderData;
|
|
188
|
+
if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
|
|
189
|
+
placeholderData = prevResult.data;
|
|
190
|
+
skipSelect = true;
|
|
191
|
+
} else placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(this.#lastQueryWithDefinedData?.state.data, this.#lastQueryWithDefinedData) : options.placeholderData;
|
|
192
|
+
if (placeholderData !== void 0) {
|
|
193
|
+
status = "success";
|
|
194
|
+
data = replaceData(prevResult?.data, placeholderData, options);
|
|
195
|
+
isPlaceholderData = true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (options.select && data !== void 0 && !skipSelect) if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) data = this.#selectResult;
|
|
199
|
+
else try {
|
|
200
|
+
this.#selectFn = options.select;
|
|
201
|
+
data = options.select(data);
|
|
202
|
+
data = replaceData(prevResult?.data, data, options);
|
|
203
|
+
this.#selectResult = data;
|
|
204
|
+
this.#selectError = null;
|
|
205
|
+
} catch (selectError) {
|
|
206
|
+
this.#selectError = selectError;
|
|
207
|
+
}
|
|
208
|
+
if (this.#selectError) {
|
|
209
|
+
error = this.#selectError;
|
|
210
|
+
data = this.#selectResult;
|
|
211
|
+
errorUpdatedAt = Date.now();
|
|
212
|
+
status = "error";
|
|
213
|
+
}
|
|
214
|
+
const isFetching = newState.fetchStatus === "fetching";
|
|
215
|
+
const isPending = status === "pending";
|
|
216
|
+
const isError = status === "error";
|
|
217
|
+
const isLoading = isPending && isFetching;
|
|
218
|
+
const hasData = data !== void 0;
|
|
219
|
+
const nextResult = {
|
|
220
|
+
status,
|
|
221
|
+
fetchStatus: newState.fetchStatus,
|
|
222
|
+
isPending,
|
|
223
|
+
isSuccess: status === "success",
|
|
224
|
+
isError,
|
|
225
|
+
isInitialLoading: isLoading,
|
|
226
|
+
isLoading,
|
|
227
|
+
data,
|
|
228
|
+
dataUpdatedAt: newState.dataUpdatedAt,
|
|
229
|
+
error,
|
|
230
|
+
errorUpdatedAt,
|
|
231
|
+
failureCount: newState.fetchFailureCount,
|
|
232
|
+
failureReason: newState.fetchFailureReason,
|
|
233
|
+
errorUpdateCount: newState.errorUpdateCount,
|
|
234
|
+
isFetched: query.isFetched(),
|
|
235
|
+
isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
236
|
+
isFetching,
|
|
237
|
+
isRefetching: isFetching && !isPending,
|
|
238
|
+
isLoadingError: isError && !hasData,
|
|
239
|
+
isPaused: newState.fetchStatus === "paused",
|
|
240
|
+
isPlaceholderData,
|
|
241
|
+
isRefetchError: isError && hasData,
|
|
242
|
+
isStale: isStale(query, options),
|
|
243
|
+
refetch: this.refetch,
|
|
244
|
+
promise: this.#currentThenable,
|
|
245
|
+
isEnabled: resolveEnabled(options.enabled, query) !== false
|
|
246
|
+
};
|
|
247
|
+
if (this.options.experimental_prefetchInRender) {
|
|
248
|
+
const hasResultData = nextResult.data !== void 0;
|
|
249
|
+
const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
|
|
250
|
+
const finalizeThenableIfPossible = (thenable) => {
|
|
251
|
+
if (isErrorWithoutData) thenable.reject(nextResult.error);
|
|
252
|
+
else if (hasResultData) thenable.resolve(nextResult.data);
|
|
253
|
+
};
|
|
254
|
+
const recreateThenable = () => {
|
|
255
|
+
finalizeThenableIfPossible(this.#currentThenable = nextResult.promise = pendingThenable());
|
|
256
|
+
};
|
|
257
|
+
const prevThenable = this.#currentThenable;
|
|
258
|
+
switch (prevThenable.status) {
|
|
259
|
+
case "pending":
|
|
260
|
+
if (query.queryHash === prevQuery.queryHash) finalizeThenableIfPossible(prevThenable);
|
|
261
|
+
break;
|
|
262
|
+
case "fulfilled":
|
|
263
|
+
if (isErrorWithoutData || nextResult.data !== prevThenable.value) recreateThenable();
|
|
264
|
+
break;
|
|
265
|
+
case "rejected":
|
|
266
|
+
if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) recreateThenable();
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return nextResult;
|
|
271
|
+
}
|
|
272
|
+
updateResult() {
|
|
273
|
+
const prevResult = this.#currentResult;
|
|
274
|
+
const nextResult = this.createResult(this.#currentQuery, this.options);
|
|
275
|
+
this.#currentResultState = this.#currentQuery.state;
|
|
276
|
+
this.#currentResultOptions = this.options;
|
|
277
|
+
if (this.#currentResultState.data !== void 0) this.#lastQueryWithDefinedData = this.#currentQuery;
|
|
278
|
+
if (shallowEqualObjects(nextResult, prevResult)) return;
|
|
279
|
+
this.#currentResult = nextResult;
|
|
280
|
+
const shouldNotifyListeners = () => {
|
|
281
|
+
if (!prevResult) return true;
|
|
282
|
+
const { notifyOnChangeProps } = this.options;
|
|
283
|
+
const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
|
|
284
|
+
if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) return true;
|
|
285
|
+
const includedProps = new Set(notifyOnChangePropsValue ?? this.#trackedProps);
|
|
286
|
+
if (this.options.throwOnError) includedProps.add("error");
|
|
287
|
+
return Object.keys(this.#currentResult).some((key) => {
|
|
288
|
+
const typedKey = key;
|
|
289
|
+
return this.#currentResult[typedKey] !== prevResult[typedKey] && includedProps.has(typedKey);
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
this.#notify({ listeners: shouldNotifyListeners() });
|
|
293
|
+
}
|
|
294
|
+
#updateQuery() {
|
|
295
|
+
const query = this.#client.getQueryCache().build(this.#client, this.options);
|
|
296
|
+
if (query === this.#currentQuery) return;
|
|
297
|
+
const prevQuery = this.#currentQuery;
|
|
298
|
+
this.#currentQuery = query;
|
|
299
|
+
this.#currentQueryInitialState = query.state;
|
|
300
|
+
if (this.hasListeners()) {
|
|
301
|
+
prevQuery?.removeObserver(this);
|
|
302
|
+
query.addObserver(this);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
onQueryUpdate() {
|
|
306
|
+
this.updateResult();
|
|
307
|
+
if (this.hasListeners()) this.#updateTimers();
|
|
308
|
+
}
|
|
309
|
+
#notify(notifyOptions) {
|
|
310
|
+
notifyManager.batch(() => {
|
|
311
|
+
if (notifyOptions.listeners) this.listeners.forEach((listener) => {
|
|
312
|
+
listener(this.#currentResult);
|
|
313
|
+
});
|
|
314
|
+
this.#client.getQueryCache().notify({
|
|
315
|
+
query: this.#currentQuery,
|
|
316
|
+
type: "observerResultsUpdated"
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
function shouldLoadOnMount(query, options) {
|
|
322
|
+
return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
|
|
323
|
+
}
|
|
324
|
+
function shouldFetchOnMount(query, options) {
|
|
325
|
+
return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
326
|
+
}
|
|
327
|
+
function shouldFetchOn(query, options, field) {
|
|
328
|
+
if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
|
|
329
|
+
const value = typeof field === "function" ? field(query) : field;
|
|
330
|
+
return value === "always" || value !== false && isStale(query, options);
|
|
331
|
+
}
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
335
|
+
return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
|
|
336
|
+
}
|
|
337
|
+
function isStale(query, options) {
|
|
338
|
+
return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
|
|
339
|
+
}
|
|
340
|
+
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
|
|
341
|
+
if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) return true;
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region ../../node_modules/.pnpm/@tanstack+query-core@5.95.2/node_modules/@tanstack/query-core/build/modern/mutationObserver.js
|
|
346
|
+
var MutationObserver = class extends Subscribable {
|
|
347
|
+
#client;
|
|
348
|
+
#currentResult = void 0;
|
|
349
|
+
#currentMutation;
|
|
350
|
+
#mutateOptions;
|
|
351
|
+
constructor(client, options) {
|
|
352
|
+
super();
|
|
353
|
+
this.#client = client;
|
|
354
|
+
this.setOptions(options);
|
|
355
|
+
this.bindMethods();
|
|
356
|
+
this.#updateResult();
|
|
357
|
+
}
|
|
358
|
+
bindMethods() {
|
|
359
|
+
this.mutate = this.mutate.bind(this);
|
|
360
|
+
this.reset = this.reset.bind(this);
|
|
361
|
+
}
|
|
362
|
+
setOptions(options) {
|
|
363
|
+
const prevOptions = this.options;
|
|
364
|
+
this.options = this.#client.defaultMutationOptions(options);
|
|
365
|
+
if (!shallowEqualObjects(this.options, prevOptions)) this.#client.getMutationCache().notify({
|
|
366
|
+
type: "observerOptionsUpdated",
|
|
367
|
+
mutation: this.#currentMutation,
|
|
368
|
+
observer: this
|
|
369
|
+
});
|
|
370
|
+
if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) this.reset();
|
|
371
|
+
else if (this.#currentMutation?.state.status === "pending") this.#currentMutation.setOptions(this.options);
|
|
372
|
+
}
|
|
373
|
+
onUnsubscribe() {
|
|
374
|
+
if (!this.hasListeners()) this.#currentMutation?.removeObserver(this);
|
|
375
|
+
}
|
|
376
|
+
onMutationUpdate(action) {
|
|
377
|
+
this.#updateResult();
|
|
378
|
+
this.#notify(action);
|
|
379
|
+
}
|
|
380
|
+
getCurrentResult() {
|
|
381
|
+
return this.#currentResult;
|
|
382
|
+
}
|
|
383
|
+
reset() {
|
|
384
|
+
this.#currentMutation?.removeObserver(this);
|
|
385
|
+
this.#currentMutation = void 0;
|
|
386
|
+
this.#updateResult();
|
|
387
|
+
this.#notify();
|
|
388
|
+
}
|
|
389
|
+
mutate(variables, options) {
|
|
390
|
+
this.#mutateOptions = options;
|
|
391
|
+
this.#currentMutation?.removeObserver(this);
|
|
392
|
+
this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);
|
|
393
|
+
this.#currentMutation.addObserver(this);
|
|
394
|
+
return this.#currentMutation.execute(variables);
|
|
395
|
+
}
|
|
396
|
+
#updateResult() {
|
|
397
|
+
const state = this.#currentMutation?.state ?? getDefaultState();
|
|
398
|
+
this.#currentResult = {
|
|
399
|
+
...state,
|
|
400
|
+
isPending: state.status === "pending",
|
|
401
|
+
isSuccess: state.status === "success",
|
|
402
|
+
isError: state.status === "error",
|
|
403
|
+
isIdle: state.status === "idle",
|
|
404
|
+
mutate: this.mutate,
|
|
405
|
+
reset: this.reset
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
#notify(action) {
|
|
409
|
+
notifyManager.batch(() => {
|
|
410
|
+
if (this.#mutateOptions && this.hasListeners()) {
|
|
411
|
+
const variables = this.#currentResult.variables;
|
|
412
|
+
const onMutateResult = this.#currentResult.context;
|
|
413
|
+
const context = {
|
|
414
|
+
client: this.#client,
|
|
415
|
+
meta: this.options.meta,
|
|
416
|
+
mutationKey: this.options.mutationKey
|
|
417
|
+
};
|
|
418
|
+
if (action?.type === "success") {
|
|
419
|
+
try {
|
|
420
|
+
this.#mutateOptions.onSuccess?.(action.data, variables, onMutateResult, context);
|
|
421
|
+
} catch (e) {
|
|
422
|
+
Promise.reject(e);
|
|
423
|
+
}
|
|
424
|
+
try {
|
|
425
|
+
this.#mutateOptions.onSettled?.(action.data, null, variables, onMutateResult, context);
|
|
426
|
+
} catch (e) {
|
|
427
|
+
Promise.reject(e);
|
|
428
|
+
}
|
|
429
|
+
} else if (action?.type === "error") {
|
|
430
|
+
try {
|
|
431
|
+
this.#mutateOptions.onError?.(action.error, variables, onMutateResult, context);
|
|
432
|
+
} catch (e) {
|
|
433
|
+
Promise.reject(e);
|
|
434
|
+
}
|
|
435
|
+
try {
|
|
436
|
+
this.#mutateOptions.onSettled?.(void 0, action.error, variables, onMutateResult, context);
|
|
437
|
+
} catch (e) {
|
|
438
|
+
Promise.reject(e);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
this.listeners.forEach((listener) => {
|
|
443
|
+
listener(this.#currentResult);
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.95.2_react@19.2.4/node_modules/@tanstack/react-query/build/modern/IsRestoringProvider.js
|
|
450
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
451
|
+
var IsRestoringContext = import_react.createContext(false);
|
|
452
|
+
var useIsRestoring = () => import_react.useContext(IsRestoringContext);
|
|
453
|
+
IsRestoringContext.Provider;
|
|
454
|
+
require_jsx_runtime();
|
|
455
|
+
function createValue() {
|
|
456
|
+
let isReset = false;
|
|
457
|
+
return {
|
|
458
|
+
clearReset: () => {
|
|
459
|
+
isReset = false;
|
|
460
|
+
},
|
|
461
|
+
reset: () => {
|
|
462
|
+
isReset = true;
|
|
463
|
+
},
|
|
464
|
+
isReset: () => {
|
|
465
|
+
return isReset;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
var QueryErrorResetBoundaryContext = import_react.createContext(createValue());
|
|
470
|
+
var useQueryErrorResetBoundary = () => import_react.useContext(QueryErrorResetBoundaryContext);
|
|
471
|
+
//#endregion
|
|
472
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.95.2_react@19.2.4/node_modules/@tanstack/react-query/build/modern/errorBoundaryUtils.js
|
|
473
|
+
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
|
|
474
|
+
const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
|
|
475
|
+
if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
|
|
476
|
+
if (!errorResetBoundary.isReset()) options.retryOnMount = false;
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
var useClearResetErrorBoundary = (errorResetBoundary) => {
|
|
480
|
+
import_react.useEffect(() => {
|
|
481
|
+
errorResetBoundary.clearReset();
|
|
482
|
+
}, [errorResetBoundary]);
|
|
483
|
+
};
|
|
484
|
+
var getHasError = ({ result, errorResetBoundary, throwOnError, query, suspense }) => {
|
|
485
|
+
return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
|
|
486
|
+
};
|
|
487
|
+
//#endregion
|
|
488
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.95.2_react@19.2.4/node_modules/@tanstack/react-query/build/modern/suspense.js
|
|
489
|
+
var ensureSuspenseTimers = (defaultedOptions) => {
|
|
490
|
+
if (defaultedOptions.suspense) {
|
|
491
|
+
const MIN_SUSPENSE_TIME_MS = 1e3;
|
|
492
|
+
const clamp = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
|
|
493
|
+
const originalStaleTime = defaultedOptions.staleTime;
|
|
494
|
+
defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp(originalStaleTime(...args)) : clamp(originalStaleTime);
|
|
495
|
+
if (typeof defaultedOptions.gcTime === "number") defaultedOptions.gcTime = Math.max(defaultedOptions.gcTime, MIN_SUSPENSE_TIME_MS);
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
|
|
499
|
+
var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
|
|
500
|
+
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
|
|
501
|
+
errorResetBoundary.clearReset();
|
|
502
|
+
});
|
|
503
|
+
//#endregion
|
|
504
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.95.2_react@19.2.4/node_modules/@tanstack/react-query/build/modern/useBaseQuery.js
|
|
505
|
+
function useBaseQuery(options, Observer, queryClient) {
|
|
506
|
+
if (process.env.NODE_ENV !== "production") {
|
|
507
|
+
if (typeof options !== "object" || Array.isArray(options)) throw new Error("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");
|
|
508
|
+
}
|
|
509
|
+
const isRestoring = useIsRestoring();
|
|
510
|
+
const errorResetBoundary = useQueryErrorResetBoundary();
|
|
511
|
+
const client = useQueryClient(queryClient);
|
|
512
|
+
const defaultedOptions = client.defaultQueryOptions(options);
|
|
513
|
+
client.getDefaultOptions().queries?._experimental_beforeQuery?.(defaultedOptions);
|
|
514
|
+
const query = client.getQueryCache().get(defaultedOptions.queryHash);
|
|
515
|
+
if (process.env.NODE_ENV !== "production") {
|
|
516
|
+
if (!defaultedOptions.queryFn) console.error(`[${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`);
|
|
517
|
+
}
|
|
518
|
+
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
|
519
|
+
ensureSuspenseTimers(defaultedOptions);
|
|
520
|
+
ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
|
|
521
|
+
useClearResetErrorBoundary(errorResetBoundary);
|
|
522
|
+
const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
|
|
523
|
+
const [observer] = import_react.useState(() => new Observer(client, defaultedOptions));
|
|
524
|
+
const result = observer.getOptimisticResult(defaultedOptions);
|
|
525
|
+
const shouldSubscribe = !isRestoring && options.subscribed !== false;
|
|
526
|
+
import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => {
|
|
527
|
+
const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop;
|
|
528
|
+
observer.updateResult();
|
|
529
|
+
return unsubscribe;
|
|
530
|
+
}, [observer, shouldSubscribe]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
|
|
531
|
+
import_react.useEffect(() => {
|
|
532
|
+
observer.setOptions(defaultedOptions);
|
|
533
|
+
}, [defaultedOptions, observer]);
|
|
534
|
+
if (shouldSuspend(defaultedOptions, result)) throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
|
|
535
|
+
if (getHasError({
|
|
536
|
+
result,
|
|
537
|
+
errorResetBoundary,
|
|
538
|
+
throwOnError: defaultedOptions.throwOnError,
|
|
539
|
+
query,
|
|
540
|
+
suspense: defaultedOptions.suspense
|
|
541
|
+
})) throw result.error;
|
|
542
|
+
client.getDefaultOptions().queries?._experimental_afterQuery?.(defaultedOptions, result);
|
|
543
|
+
if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) (isNewCacheEntry ? fetchOptimistic(defaultedOptions, observer, errorResetBoundary) : query?.promise)?.catch(noop).finally(() => {
|
|
544
|
+
observer.updateResult();
|
|
545
|
+
});
|
|
546
|
+
return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
|
|
547
|
+
}
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.95.2_react@19.2.4/node_modules/@tanstack/react-query/build/modern/useQuery.js
|
|
550
|
+
function useQuery(options, queryClient) {
|
|
551
|
+
return useBaseQuery(options, QueryObserver, queryClient);
|
|
552
|
+
}
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.95.2_react@19.2.4/node_modules/@tanstack/react-query/build/modern/queryOptions.js
|
|
555
|
+
function queryOptions(options) {
|
|
556
|
+
return options;
|
|
557
|
+
}
|
|
558
|
+
//#endregion
|
|
559
|
+
//#region ../../node_modules/.pnpm/@tanstack+react-query@5.95.2_react@19.2.4/node_modules/@tanstack/react-query/build/modern/useMutation.js
|
|
560
|
+
function useMutation(options, queryClient) {
|
|
561
|
+
const client = useQueryClient(queryClient);
|
|
562
|
+
const [observer] = import_react.useState(() => new MutationObserver(client, options));
|
|
563
|
+
import_react.useEffect(() => {
|
|
564
|
+
observer.setOptions(options);
|
|
565
|
+
}, [observer, options]);
|
|
566
|
+
const result = import_react.useSyncExternalStore(import_react.useCallback((onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)), [observer]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
|
|
567
|
+
const mutate = import_react.useCallback((variables, mutateOptions) => {
|
|
568
|
+
observer.mutate(variables, mutateOptions).catch(noop);
|
|
569
|
+
}, [observer]);
|
|
570
|
+
if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) throw result.error;
|
|
571
|
+
return {
|
|
572
|
+
...result,
|
|
573
|
+
mutate,
|
|
574
|
+
mutateAsync: result.mutate
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region src/services/services.generated.ts
|
|
579
|
+
var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
|
|
580
|
+
var TokenService;
|
|
581
|
+
(function(_TokenService) {
|
|
582
|
+
async function getToken(subset, id) {
|
|
583
|
+
return fetch({
|
|
584
|
+
method: "GET",
|
|
585
|
+
url: `/api/token/findById?${import_lib.default.stringify({
|
|
586
|
+
subset,
|
|
587
|
+
id
|
|
588
|
+
})}`
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
_TokenService.getToken = getToken;
|
|
592
|
+
const getTokenQueryOptions = _TokenService.getTokenQueryOptions = (subset, id) => queryOptions({
|
|
593
|
+
queryKey: [
|
|
594
|
+
"Token",
|
|
595
|
+
"getToken",
|
|
596
|
+
subset,
|
|
597
|
+
id
|
|
598
|
+
],
|
|
599
|
+
queryFn: () => getToken(subset, id)
|
|
600
|
+
});
|
|
601
|
+
_TokenService.useToken = (subset, id, options) => useQuery({
|
|
602
|
+
...getTokenQueryOptions(subset, id),
|
|
603
|
+
...options
|
|
604
|
+
});
|
|
605
|
+
async function getTokens(subset, rawParams) {
|
|
606
|
+
return fetch({
|
|
607
|
+
method: "GET",
|
|
608
|
+
url: `/api/token/findMany?${import_lib.default.stringify({
|
|
609
|
+
subset,
|
|
610
|
+
rawParams
|
|
611
|
+
})}`
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
_TokenService.getTokens = getTokens;
|
|
615
|
+
const getTokensQueryOptions = _TokenService.getTokensQueryOptions = (subset, rawParams) => queryOptions({
|
|
616
|
+
queryKey: [
|
|
617
|
+
"Token",
|
|
618
|
+
"getTokens",
|
|
619
|
+
subset,
|
|
620
|
+
rawParams
|
|
621
|
+
],
|
|
622
|
+
queryFn: () => getTokens(subset, rawParams)
|
|
623
|
+
});
|
|
624
|
+
_TokenService.useTokens = (subset, rawParams, options) => useQuery({
|
|
625
|
+
...getTokensQueryOptions(subset, rawParams),
|
|
626
|
+
...options
|
|
627
|
+
});
|
|
628
|
+
async function save(spa) {
|
|
629
|
+
return fetch({
|
|
630
|
+
method: "POST",
|
|
631
|
+
url: `/api/token/save`,
|
|
632
|
+
data: { spa }
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
_TokenService.save = save;
|
|
636
|
+
_TokenService.useSaveMutation = () => useMutation({ mutationFn: (params) => save(params.spa) });
|
|
637
|
+
async function del(ids) {
|
|
638
|
+
return fetch({
|
|
639
|
+
method: "POST",
|
|
640
|
+
url: `/api/token/del`,
|
|
641
|
+
data: { ids }
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
_TokenService.del = del;
|
|
645
|
+
_TokenService.useDelMutation = () => useMutation({ mutationFn: (params) => del(params.ids) });
|
|
646
|
+
})(TokenService || (TokenService = {}));
|
|
647
|
+
var RequestLogService;
|
|
648
|
+
(function(_RequestLogService) {
|
|
649
|
+
async function getRequestLog(subset, id) {
|
|
650
|
+
return fetch({
|
|
651
|
+
method: "GET",
|
|
652
|
+
url: `/api/requestLog/findById?${import_lib.default.stringify({
|
|
653
|
+
subset,
|
|
654
|
+
id
|
|
655
|
+
})}`
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
_RequestLogService.getRequestLog = getRequestLog;
|
|
659
|
+
const getRequestLogQueryOptions = _RequestLogService.getRequestLogQueryOptions = (subset, id) => queryOptions({
|
|
660
|
+
queryKey: [
|
|
661
|
+
"RequestLog",
|
|
662
|
+
"getRequestLog",
|
|
663
|
+
subset,
|
|
664
|
+
id
|
|
665
|
+
],
|
|
666
|
+
queryFn: () => getRequestLog(subset, id)
|
|
667
|
+
});
|
|
668
|
+
_RequestLogService.useRequestLog = (subset, id, options) => useQuery({
|
|
669
|
+
...getRequestLogQueryOptions(subset, id),
|
|
670
|
+
...options
|
|
671
|
+
});
|
|
672
|
+
async function getRequestLogs(subset, rawParams) {
|
|
673
|
+
return fetch({
|
|
674
|
+
method: "GET",
|
|
675
|
+
url: `/api/requestLog/findMany?${import_lib.default.stringify({
|
|
676
|
+
subset,
|
|
677
|
+
rawParams
|
|
678
|
+
})}`
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
_RequestLogService.getRequestLogs = getRequestLogs;
|
|
682
|
+
const getRequestLogsQueryOptions = _RequestLogService.getRequestLogsQueryOptions = (subset, rawParams) => queryOptions({
|
|
683
|
+
queryKey: [
|
|
684
|
+
"RequestLog",
|
|
685
|
+
"getRequestLogs",
|
|
686
|
+
subset,
|
|
687
|
+
rawParams
|
|
688
|
+
],
|
|
689
|
+
queryFn: () => getRequestLogs(subset, rawParams)
|
|
690
|
+
});
|
|
691
|
+
_RequestLogService.useRequestLogs = (subset, rawParams, options) => useQuery({
|
|
692
|
+
...getRequestLogsQueryOptions(subset, rawParams),
|
|
693
|
+
...options
|
|
694
|
+
});
|
|
695
|
+
async function save(spa) {
|
|
696
|
+
return fetch({
|
|
697
|
+
method: "POST",
|
|
698
|
+
url: `/api/requestLog/save`,
|
|
699
|
+
data: { spa }
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
_RequestLogService.save = save;
|
|
703
|
+
_RequestLogService.useSaveMutation = () => useMutation({ mutationFn: (params) => save(params.spa) });
|
|
704
|
+
async function del(ids) {
|
|
705
|
+
return fetch({
|
|
706
|
+
method: "POST",
|
|
707
|
+
url: `/api/requestLog/del`,
|
|
708
|
+
data: { ids }
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
_RequestLogService.del = del;
|
|
712
|
+
_RequestLogService.useDelMutation = () => useMutation({ mutationFn: (params) => del(params.ids) });
|
|
713
|
+
})(RequestLogService || (RequestLogService = {}));
|
|
714
|
+
var QgridService;
|
|
715
|
+
(function(_QgridService) {
|
|
716
|
+
async function query(prompt, system, timeout) {
|
|
717
|
+
return fetch({
|
|
718
|
+
method: "POST",
|
|
719
|
+
url: `/api/qgrid/query`,
|
|
720
|
+
data: {
|
|
721
|
+
prompt,
|
|
722
|
+
system,
|
|
723
|
+
timeout
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
_QgridService.query = query;
|
|
728
|
+
_QgridService.useQueryMutation = () => useMutation({ mutationFn: (params) => query(params.prompt, params.system, params.timeout) });
|
|
729
|
+
async function stats() {
|
|
730
|
+
return fetch({
|
|
731
|
+
method: "GET",
|
|
732
|
+
url: `/api/qgrid/stats`
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
_QgridService.stats = stats;
|
|
736
|
+
const statsQueryOptions = _QgridService.statsQueryOptions = () => queryOptions({
|
|
737
|
+
queryKey: ["Qgrid", "stats"],
|
|
738
|
+
queryFn: () => stats()
|
|
739
|
+
});
|
|
740
|
+
_QgridService.useStats = (options) => useQuery({
|
|
741
|
+
...statsQueryOptions(),
|
|
742
|
+
...options
|
|
743
|
+
});
|
|
744
|
+
async function addToken(token, name, refreshToken) {
|
|
745
|
+
return fetch({
|
|
746
|
+
method: "POST",
|
|
747
|
+
url: `/api/qgrid/addToken`,
|
|
748
|
+
data: {
|
|
749
|
+
token,
|
|
750
|
+
name,
|
|
751
|
+
refreshToken
|
|
752
|
+
}
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
_QgridService.addToken = addToken;
|
|
756
|
+
_QgridService.useAddTokenMutation = () => useMutation({ mutationFn: (params) => addToken(params.token, params.name, params.refreshToken) });
|
|
757
|
+
async function updateToken(token, name, newToken, refreshToken) {
|
|
758
|
+
return fetch({
|
|
759
|
+
method: "POST",
|
|
760
|
+
url: `/api/qgrid/updateToken`,
|
|
761
|
+
data: {
|
|
762
|
+
token,
|
|
763
|
+
name,
|
|
764
|
+
newToken,
|
|
765
|
+
refreshToken
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
_QgridService.updateToken = updateToken;
|
|
770
|
+
_QgridService.useUpdateTokenMutation = () => useMutation({ mutationFn: (params) => updateToken(params.token, params.name, params.newToken, params.refreshToken) });
|
|
771
|
+
async function removeToken(token) {
|
|
772
|
+
return fetch({
|
|
773
|
+
method: "POST",
|
|
774
|
+
url: `/api/qgrid/removeToken`,
|
|
775
|
+
data: { token }
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
_QgridService.removeToken = removeToken;
|
|
779
|
+
_QgridService.useRemoveTokenMutation = () => useMutation({ mutationFn: (params) => removeToken(params.token) });
|
|
780
|
+
async function toggleToken(id) {
|
|
781
|
+
return fetch({
|
|
782
|
+
method: "POST",
|
|
783
|
+
url: `/api/qgrid/toggleToken`,
|
|
784
|
+
data: { id }
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
_QgridService.toggleToken = toggleToken;
|
|
788
|
+
_QgridService.useToggleTokenMutation = () => useMutation({ mutationFn: (params) => toggleToken(params.id) });
|
|
789
|
+
async function oauthStart(name) {
|
|
790
|
+
return fetch({
|
|
791
|
+
method: "POST",
|
|
792
|
+
url: `/api/qgrid/oauthStart`,
|
|
793
|
+
data: { name }
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
_QgridService.oauthStart = oauthStart;
|
|
797
|
+
_QgridService.useOauthStartMutation = () => useMutation({ mutationFn: (params) => oauthStart(params.name) });
|
|
798
|
+
async function usage(tokenName) {
|
|
799
|
+
return fetch({
|
|
800
|
+
method: "GET",
|
|
801
|
+
url: `/api/qgrid/usage?${import_lib.default.stringify({ tokenName })}`
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
_QgridService.usage = usage;
|
|
805
|
+
const usageQueryOptions = _QgridService.usageQueryOptions = (tokenName) => queryOptions({
|
|
806
|
+
queryKey: [
|
|
807
|
+
"Qgrid",
|
|
808
|
+
"usage",
|
|
809
|
+
tokenName
|
|
810
|
+
],
|
|
811
|
+
queryFn: () => usage(tokenName)
|
|
812
|
+
});
|
|
813
|
+
_QgridService.useUsage = (tokenName, options) => useQuery({
|
|
814
|
+
...usageQueryOptions(tokenName),
|
|
815
|
+
...options
|
|
816
|
+
});
|
|
817
|
+
async function health() {
|
|
818
|
+
return fetch({
|
|
819
|
+
method: "GET",
|
|
820
|
+
url: `/api/qgrid/health`
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
_QgridService.health = health;
|
|
824
|
+
const healthQueryOptions = _QgridService.healthQueryOptions = () => queryOptions({
|
|
825
|
+
queryKey: ["Qgrid", "health"],
|
|
826
|
+
queryFn: () => health()
|
|
827
|
+
});
|
|
828
|
+
_QgridService.useHealth = (options) => useQuery({
|
|
829
|
+
...healthQueryOptions(),
|
|
830
|
+
...options
|
|
831
|
+
});
|
|
832
|
+
})(QgridService || (QgridService = {}));
|
|
833
|
+
RequestLogService.useRequestLogs;
|
|
834
|
+
TokenService.useTokens;
|
|
835
|
+
//#endregion
|
|
836
|
+
export { RequestLogService as n, TokenService as r, QgridService as t };
|