@povio/openapi-codegen-cli 2.0.8-rc.16 → 2.0.8-rc.18

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/index.mjs CHANGED
@@ -1,192 +1,10 @@
1
- import { n as OpenApiRouter, t as AuthContext } from "./auth.context-DKjzWiaA.mjs";
2
- import axios, { isAxiosError, isCancel } from "axios";
1
+ import { a as SharedErrorHandler, c as resources, i as ErrorHandler, n as OpenApiRouter, o as RestUtils, r as ApplicationException, s as ns, t as AuthContext } from "./auth.context-HV1I5QMx.mjs";
2
+ import axios from "axios";
3
3
  import { z } from "zod";
4
- import i18next from "i18next";
5
- import { createContext, use, useEffect, useMemo, useState } from "react";
4
+ import { createContext, use, useCallback, useEffect, useMemo, useState } from "react";
5
+ import { useQueryClient } from "@tanstack/react-query";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
 
8
- //#region src/lib/assets/locales/en/translation.json
9
- var translation_default$1 = { openapi: { "sharedErrors": {
10
- "dataValidation": "An error occurred while validating the data",
11
- "internalError": "An internal error occurred. This is most likely a bug on our end. Please try again later.",
12
- "networkError": "A network error occurred. Are you connected to the internet?",
13
- "canceledError": "The request was canceled.",
14
- "unknownError": "An unknown error occurred. Please try again later.",
15
- "unknownErrorWithCode": "An unknown error occurred. Error code: \"{{code}}\""
16
- } } };
17
-
18
- //#endregion
19
- //#region src/lib/assets/locales/sl/translation.json
20
- var translation_default = { openapi: { "sharedErrors": {
21
- "dataValidation": "Pri preverjanju podatkov je prišlo do napake",
22
- "internalError": "Prišlo je do notranje napake.",
23
- "networkError": "Prišlo je do napake v omrežju.",
24
- "canceledError": "Zahteva je bila preklicana.",
25
- "unknownError": "Prišlo je do neznane napake.",
26
- "unknownErrorWithCode": "Prišlo je do neznane napake. Koda napake: \"{{code}}\""
27
- } } };
28
-
29
- //#endregion
30
- //#region src/lib/config/i18n.ts
31
- const ns = "openapi";
32
- const resources = {
33
- en: { [ns]: translation_default$1 },
34
- sl: { [ns]: translation_default }
35
- };
36
- const defaultLanguage = "en";
37
- const i18n = i18next.createInstance();
38
- i18n.init({
39
- compatibilityJSON: "v4",
40
- lng: defaultLanguage,
41
- fallbackLng: defaultLanguage,
42
- resources,
43
- ns: Object.keys(resources.en),
44
- defaultNS: ns,
45
- interpolation: { escapeValue: false }
46
- });
47
- const defaultT = i18n.t.bind(i18n);
48
-
49
- //#endregion
50
- //#region src/lib/rest/rest.utils.ts
51
- let RestUtils;
52
- (function(_RestUtils) {
53
- _RestUtils.extractServerResponseCode = (e) => {
54
- if (e instanceof z.ZodError) return "validation-exception";
55
- if (!isAxiosError(e)) return null;
56
- if (!e.response) return null;
57
- const data = e.response.data;
58
- if (typeof data?.code === "string") return data.code;
59
- return null;
60
- };
61
- _RestUtils.doesServerErrorMessageContain = (e, text) => {
62
- const message = extractServerErrorMessage(e);
63
- if (message === null || message === void 0) return false;
64
- return message.toLowerCase().includes(text.toLowerCase());
65
- };
66
- const extractServerErrorMessage = _RestUtils.extractServerErrorMessage = (e) => {
67
- if (e instanceof z.ZodError) return e.message;
68
- if (!isAxiosError(e)) return null;
69
- if (!e.response) return null;
70
- const data = e.response.data;
71
- if (typeof data?.message === "string") return data.message;
72
- return null;
73
- };
74
- _RestUtils.extractContentDispositionFilename = (headers) => {
75
- const contentDisposition = headers["content-disposition"];
76
- return contentDisposition ? /filename=["']?([^"';]+)/i.exec(contentDisposition)?.[1] : void 0;
77
- };
78
- })(RestUtils || (RestUtils = {}));
79
-
80
- //#endregion
81
- //#region src/lib/rest/error-handling.ts
82
- var ApplicationException = class extends Error {
83
- code;
84
- serverMessage = null;
85
- constructor(message, code, serverMessage) {
86
- super(message);
87
- this.code = code;
88
- this.serverMessage = serverMessage;
89
- }
90
- };
91
- var ErrorHandler = class {
92
- entries = [];
93
- t;
94
- onRethrowError;
95
- constructor({ entries, t = defaultT, onRethrowError }) {
96
- this.t = t;
97
- this.onRethrowError = onRethrowError;
98
- const dataValidationError = {
99
- code: "DATA_VALIDATION_ERROR",
100
- condition: (e) => {
101
- return e instanceof z.ZodError;
102
- },
103
- getMessage: () => this.t("openapi.sharedErrors.dataValidation")
104
- };
105
- const internalError = {
106
- code: "INTERNAL_ERROR",
107
- condition: (e) => {
108
- if (isAxiosError(e)) return e.response?.status != null && e.response.status >= 500 && e.response.status < 600;
109
- return false;
110
- },
111
- getMessage: () => this.t("openapi.sharedErrors.internalError")
112
- };
113
- const networkError = {
114
- code: "NETWORK_ERROR",
115
- condition: (e) => {
116
- if (isAxiosError(e)) return e.code === "ERR_NETWORK";
117
- return false;
118
- },
119
- getMessage: () => this.t("openapi.sharedErrors.networkError")
120
- };
121
- const canceledError = {
122
- code: "CANCELED_ERROR",
123
- condition: (e) => {
124
- if (isCancel(e)) return true;
125
- if (isAxiosError(e) && e.code === "ECONNABORTED") return true;
126
- return false;
127
- },
128
- getMessage: () => this.t("openapi.sharedErrors.canceledError")
129
- };
130
- const unknownError = {
131
- code: "UNKNOWN_ERROR",
132
- condition: () => true,
133
- getMessage: (_, e) => {
134
- const code = RestUtils.extractServerResponseCode(e);
135
- const serverMessage = RestUtils.extractServerErrorMessage(e);
136
- if (code) {
137
- let message = `Unknown error, message from server: ${code}`;
138
- if (serverMessage) message += ` ${serverMessage}`;
139
- return message;
140
- }
141
- return this.t("openapi.sharedErrors.unknownError");
142
- }
143
- };
144
- this.entries = [
145
- ...entries,
146
- dataValidationError,
147
- internalError,
148
- networkError,
149
- canceledError,
150
- unknownError
151
- ];
152
- }
153
- matchesEntry(error, entry, code) {
154
- if (entry.condition) return entry.condition(error);
155
- return code === entry.code;
156
- }
157
- setTranslateFunction(t) {
158
- this.t = t;
159
- }
160
- rethrowError(error) {
161
- const code = RestUtils.extractServerResponseCode(error);
162
- const errorEntry = this.entries.find((entry) => this.matchesEntry(error, entry, code));
163
- const serverMessage = RestUtils.extractServerErrorMessage(error);
164
- const exception = new ApplicationException(errorEntry.getMessage(this.t, error), errorEntry.code, serverMessage);
165
- this.onRethrowError?.(error, exception);
166
- throw exception;
167
- }
168
- getError(error) {
169
- if (error instanceof ApplicationException) return error;
170
- return null;
171
- }
172
- getErrorCode(error) {
173
- if (error instanceof ApplicationException) return error.code;
174
- return null;
175
- }
176
- static getErrorMessage(error, fallbackToUnknown = true) {
177
- if (typeof error === "string") return error;
178
- if (error instanceof Error) return error.message;
179
- if (error instanceof ApplicationException) {
180
- if (error.serverMessage != null) return error.serverMessage;
181
- return error.message;
182
- }
183
- if (fallbackToUnknown) return defaultT("openapi.sharedErrors.unknownError");
184
- return null;
185
- }
186
- };
187
- const SharedErrorHandler = new ErrorHandler({ entries: [] });
188
-
189
- //#endregion
190
8
  //#region src/lib/rest/rest-client.ts
191
9
  var RestClient = class {
192
10
  client;
@@ -294,7 +112,7 @@ var RestInterceptor = class {
294
112
  let OpenApiQueryConfig;
295
113
  (function(_OpenApiQueryConfig) {
296
114
  const Context = createContext({});
297
- _OpenApiQueryConfig.Provider = ({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, onError, children }) => {
115
+ function Provider({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, onError, children }) {
298
116
  const value = useMemo(() => ({
299
117
  preferUpdate,
300
118
  invalidateCurrentModule,
@@ -312,12 +130,79 @@ let OpenApiQueryConfig;
312
130
  value,
313
131
  children
314
132
  });
315
- };
133
+ }
134
+ _OpenApiQueryConfig.Provider = Provider;
316
135
  _OpenApiQueryConfig.useConfig = () => {
317
136
  return use(Context) ?? {};
318
137
  };
319
138
  })(OpenApiQueryConfig || (OpenApiQueryConfig = {}));
320
139
 
140
+ //#endregion
141
+ //#region src/lib/react-query/cross-tab-invalidation.ts
142
+ const CROSS_TAB_INVALIDATE_KEY = "__rq_invalidate__";
143
+ const broadcastQueryInvalidation = (queryKeys) => {
144
+ localStorage.setItem(CROSS_TAB_INVALIDATE_KEY, JSON.stringify({
145
+ keys: queryKeys,
146
+ timestamp: Date.now()
147
+ }));
148
+ };
149
+ let isListenerSetUp = false;
150
+ const setupCrossTabListener = (queryClient) => {
151
+ if (isListenerSetUp) return;
152
+ isListenerSetUp = true;
153
+ window.addEventListener("storage", (e) => {
154
+ if (e.key !== CROSS_TAB_INVALIDATE_KEY || !e.newValue) return;
155
+ try {
156
+ const { keys } = JSON.parse(e.newValue);
157
+ for (const queryKey of keys) queryClient.invalidateQueries({ queryKey });
158
+ } catch {}
159
+ });
160
+ };
161
+
162
+ //#endregion
163
+ //#region src/lib/react-query/useMutationEffects.ts
164
+ function useMutationEffects({ currentModule }) {
165
+ const queryClient = useQueryClient();
166
+ const config = OpenApiQueryConfig.useConfig();
167
+ useEffect(() => {
168
+ if (!config.crossTabInvalidation) return;
169
+ setupCrossTabListener(queryClient);
170
+ }, [queryClient, config.crossTabInvalidation]);
171
+ return { runMutationEffects: useCallback(async (data, variables, options = {}, updateKeys) => {
172
+ const { invalidateCurrentModule, invalidationMap, invalidateModules, invalidateKeys, preferUpdate } = options;
173
+ const shouldUpdate = preferUpdate ?? config.preferUpdate ?? false;
174
+ const shouldInvalidateCurrentModule = invalidateCurrentModule ?? config.invalidateCurrentModule ?? true;
175
+ const isQueryKeyEqual = (keyA, keyB) => keyA.length === keyB.length && keyA.every((item, index) => item === keyB[index]);
176
+ const isQueryKeyPrefix = (queryKey, prefixKey) => prefixKey.length <= queryKey.length && prefixKey.every((item, index) => item === queryKey[index]);
177
+ const mappedInvalidationKeys = invalidationMap?.[currentModule]?.(data, variables) ?? config.invalidationMap?.[currentModule]?.(data, variables);
178
+ const shouldInvalidateQuery = (queryKey) => {
179
+ const isUpdateKey = updateKeys?.some((key) => isQueryKeyEqual(queryKey, key));
180
+ if (shouldUpdate && isUpdateKey) return false;
181
+ const isCurrentModule = shouldInvalidateCurrentModule && queryKey[0] === currentModule;
182
+ const isInvalidateModule = !!invalidateModules && invalidateModules.some((module) => queryKey[0] === module);
183
+ const isInvalidateKey = !!invalidateKeys && invalidateKeys.some((key) => isQueryKeyPrefix(queryKey, key));
184
+ const isMappedKey = !!mappedInvalidationKeys && mappedInvalidationKeys.some((key) => isQueryKeyPrefix(queryKey, key));
185
+ return isCurrentModule || isInvalidateModule || isInvalidateKey || isMappedKey;
186
+ };
187
+ const invalidatedQueryKeys = [];
188
+ const shouldBroadcast = options.crossTabInvalidation ?? config.crossTabInvalidation;
189
+ queryClient.invalidateQueries({ predicate: ({ queryKey }) => {
190
+ const shouldInvalidate = shouldInvalidateQuery(queryKey);
191
+ if (shouldInvalidate && shouldBroadcast) invalidatedQueryKeys.push([...queryKey]);
192
+ return shouldInvalidate;
193
+ } });
194
+ if (shouldBroadcast && invalidatedQueryKeys.length > 0) broadcastQueryInvalidation(invalidatedQueryKeys);
195
+ if (shouldUpdate && updateKeys) updateKeys.map((queryKey) => queryClient.setQueryData(queryKey, data));
196
+ }, [
197
+ queryClient,
198
+ currentModule,
199
+ config.preferUpdate,
200
+ config.invalidateCurrentModule,
201
+ config.invalidationMap,
202
+ config.crossTabInvalidation
203
+ ]) };
204
+ }
205
+
321
206
  //#endregion
322
207
  //#region src/lib/config/workspace.context.tsx
323
208
  let OpenApiWorkspaceContext;
@@ -363,4 +248,4 @@ const AuthGuard = ({ type, redirectTo, children }) => {
363
248
  };
364
249
 
365
250
  //#endregion
366
- export { ApplicationException, AuthContext, AuthGuard, ErrorHandler, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, RestClient, RestInterceptor, RestUtils, SharedErrorHandler, ns, resources };
251
+ export { ApplicationException, AuthContext, AuthGuard, ErrorHandler, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, RestClient, RestInterceptor, RestUtils, SharedErrorHandler, ns, resources, useMutationEffects };
package/dist/sh.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { S as VALIDATION_ERROR_TYPE_TITLE, g as groupByType, h as GenerateType, i as getDataFromOpenAPIDoc, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-ao1R1u57.mjs";
3
- import { n as resolveConfig, t as runGenerate } from "./generate.runner-DF2eZ4P-.mjs";
2
+ import { S as VALIDATION_ERROR_TYPE_TITLE, g as groupByType, h as GenerateType, i as getDataFromOpenAPIDoc, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-BP7F6YJP.mjs";
3
+ import { n as resolveConfig, t as runGenerate } from "./generate.runner-C93djZ78.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import yargs from "yargs";
6
6
  import { hideBin } from "yargs/helpers";
@@ -39,7 +39,7 @@ function logBanner(message) {
39
39
  * Fetch the version from package.json
40
40
  */
41
41
  function getVersion() {
42
- return "2.0.8-rc.16";
42
+ return "2.0.8-rc.18";
43
43
  }
44
44
 
45
45
  //#endregion
package/dist/vite.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import "./options-DBz5YE3s.mjs";
2
- import { t as OpenAPICodegenConfig } from "./config-Cu_GYfai.mjs";
1
+ import "./options-Bvmh6rai.mjs";
2
+ import { t as OpenAPICodegenConfig } from "./config-B4HK4BLi.mjs";
3
3
  import { Plugin } from "vite";
4
4
 
5
5
  //#region src/vite/openapi-codegen.plugin.d.ts
package/dist/vite.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { x as Profiler } from "./generateCodeFromOpenAPIDoc-ao1R1u57.mjs";
2
- import { t as runGenerate } from "./generate.runner-DF2eZ4P-.mjs";
1
+ import { x as Profiler } from "./generateCodeFromOpenAPIDoc-BP7F6YJP.mjs";
2
+ import { t as runGenerate } from "./generate.runner-C93djZ78.mjs";
3
3
  import path from "path";
4
4
 
5
5
  //#region src/vite/openapi-codegen.plugin.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "2.0.8-rc.16",
3
+ "version": "2.0.8-rc.18",
4
4
  "keywords": [
5
5
  "codegen",
6
6
  "openapi",
@@ -42,6 +42,10 @@
42
42
  "./acl": {
43
43
  "types": "./dist/acl.d.mts",
44
44
  "import": "./dist/acl.mjs"
45
+ },
46
+ "./zod": {
47
+ "types": "./dist/zod.d.mts",
48
+ "import": "./dist/zod.mjs"
45
49
  }
46
50
  },
47
51
  "scripts": {
@@ -1,59 +0,0 @@
1
- import { createContext, use, useMemo } from "react";
2
- import { jsx } from "react/jsx-runtime";
3
-
4
- //#region src/lib/config/router.context.tsx
5
- let OpenApiRouter;
6
- (function(_OpenApiRouter) {
7
- const Context = createContext(null);
8
- _OpenApiRouter.Provider = ({ children, replace }) => {
9
- return /* @__PURE__ */ jsx(Context, {
10
- value: useMemo(() => ({ replace }), [replace]),
11
- children
12
- });
13
- };
14
- _OpenApiRouter.useRouter = () => {
15
- const context = use(Context);
16
- if (!context) throw new Error("useRouter must be used within an OpenApiRouter.Provider");
17
- return context;
18
- };
19
- })(OpenApiRouter || (OpenApiRouter = {}));
20
-
21
- //#endregion
22
- //#region src/lib/auth/auth.context.tsx
23
- let AuthContext;
24
- (function(_AuthContext) {
25
- const Context = createContext({});
26
- _AuthContext.Provider = ({ isAuthenticated, isInitializing, logout, updateTokens, accessToken, user, userPromise, routes, loadingState, children }) => {
27
- const value = useMemo(() => ({
28
- isAuthenticated,
29
- isInitializing,
30
- logout,
31
- updateTokens,
32
- accessToken,
33
- user,
34
- userPromise,
35
- routes,
36
- loadingState
37
- }), [
38
- isAuthenticated,
39
- isInitializing,
40
- logout,
41
- updateTokens,
42
- accessToken,
43
- user,
44
- userPromise,
45
- routes,
46
- loadingState
47
- ]);
48
- return /* @__PURE__ */ jsx(Context.Provider, {
49
- value,
50
- children
51
- });
52
- };
53
- _AuthContext.useAuth = () => {
54
- return use(Context);
55
- };
56
- })(AuthContext || (AuthContext = {}));
57
-
58
- //#endregion
59
- export { OpenApiRouter as n, AuthContext as t };
@@ -1,40 +0,0 @@
1
- import type { QueryClient, QueryKey } from "@tanstack/react-query";
2
-
3
- const CROSS_TAB_INVALIDATE_KEY = "__rq_invalidate__";
4
-
5
- /**
6
- * Broadcasts a query invalidation event to all other open tabs via localStorage.
7
- *
8
- * @param queryKeys - An array of query keys to invalidate (array of arrays).
9
- *
10
- * NOTE: The `storage` event only fires in *other* tabs — the calling tab
11
- * must invalidate its own queryClient separately if needed.
12
- */
13
- export const broadcastQueryInvalidation = (queryKeys: QueryKey[]) => {
14
- localStorage.setItem(CROSS_TAB_INVALIDATE_KEY, JSON.stringify({ keys: queryKeys, timestamp: Date.now() }));
15
- };
16
-
17
- /**
18
- * Registers a one-time global `storage` event listener that reacts to
19
- * cross-tab invalidation broadcasts. Safe to call from multiple hooks —
20
- * only the first call sets up the listener.
21
- */
22
- let isListenerSetUp = false;
23
-
24
- export const setupCrossTabListener = (queryClient: QueryClient) => {
25
- if (isListenerSetUp) return;
26
- isListenerSetUp = true;
27
-
28
- window.addEventListener("storage", (e: StorageEvent) => {
29
- if (e.key !== CROSS_TAB_INVALIDATE_KEY || !e.newValue) return;
30
-
31
- try {
32
- const { keys } = JSON.parse(e.newValue) as { keys: QueryKey[] };
33
- for (const queryKey of keys) {
34
- queryClient.invalidateQueries({ queryKey });
35
- }
36
- } catch {
37
- // Ignore malformed payloads
38
- }
39
- });
40
- };
@@ -1,94 +0,0 @@
1
- import { useCallback, useEffect } from "react";
2
-
3
- import { QueryKey, useQueryClient } from "@tanstack/react-query";
4
- import { OpenApiQueryConfig, QueryModule, InvalidationMap } from "../lib/config/queryConfig.context";
5
- import { broadcastQueryInvalidation, setupCrossTabListener } from "./useCrossTabQueryInvalidation";
6
-
7
- export interface MutationEffectsOptions {
8
- invalidateCurrentModule?: boolean;
9
- crossTabInvalidation?: boolean;
10
- invalidationMap?: InvalidationMap;
11
- invalidateModules?: QueryModule[];
12
- invalidateKeys?: QueryKey[];
13
- preferUpdate?: boolean;
14
- }
15
-
16
- export interface UseMutationEffectsProps {
17
- currentModule: QueryModule;
18
- }
19
-
20
- export function useMutationEffects({ currentModule }: UseMutationEffectsProps) {
21
- const queryClient = useQueryClient();
22
- const config = OpenApiQueryConfig.useConfig();
23
-
24
- useEffect(() => {
25
- if (!config.crossTabInvalidation) return;
26
- setupCrossTabListener(queryClient);
27
- }, [queryClient, config.crossTabInvalidation]);
28
-
29
- const runMutationEffects = useCallback(
30
- async <TData, TVariables>(
31
- data: TData,
32
- variables: TVariables,
33
- options: MutationEffectsOptions = {},
34
- updateKeys?: QueryKey[],
35
- ) => {
36
- const { invalidateCurrentModule, invalidateModules, invalidateKeys, preferUpdate } = options;
37
- const shouldUpdate = preferUpdate ?? config.preferUpdate ?? false;
38
- const shouldInvalidateCurrentModule = invalidateCurrentModule ?? config.invalidateCurrentModule ?? true;
39
-
40
- const isQueryKeyEqual = (keyA: QueryKey, keyB: QueryKey) =>
41
- keyA.length === keyB.length && keyA.every((item, index) => item === keyB[index]);
42
- const isQueryKeyPrefix = (queryKey: QueryKey, prefixKey: QueryKey) =>
43
- prefixKey.length <= queryKey.length && prefixKey.every((item, index) => item === queryKey[index]);
44
- const mappedInvalidationKeys = config.invalidationMap?.[currentModule]?.(data, variables);
45
-
46
- const shouldInvalidateQuery = (queryKey: QueryKey) => {
47
- const isUpdateKey = updateKeys?.some((key) => isQueryKeyEqual(queryKey, key));
48
- if (shouldUpdate && isUpdateKey) {
49
- return false;
50
- }
51
-
52
- const isCurrentModule = shouldInvalidateCurrentModule && queryKey[0] === currentModule;
53
- const isInvalidateModule = !!invalidateModules && invalidateModules.some((module) => queryKey[0] === module);
54
- const isInvalidateKey = !!invalidateKeys && invalidateKeys.some((key) => isQueryKeyPrefix(queryKey, key));
55
- const isMappedKey =
56
- !!mappedInvalidationKeys && mappedInvalidationKeys.some((key) => isQueryKeyPrefix(queryKey, key));
57
-
58
- return isCurrentModule || isInvalidateModule || isInvalidateKey || isMappedKey;
59
- };
60
-
61
- const invalidatedQueryKeys: QueryKey[] = [];
62
-
63
- queryClient.invalidateQueries({
64
- predicate: ({ queryKey }) => {
65
- const shouldInvalidate = shouldInvalidateQuery(queryKey);
66
-
67
- if (shouldInvalidate && config.crossTabInvalidation) {
68
- invalidatedQueryKeys.push([...queryKey]);
69
- }
70
-
71
- return shouldInvalidate;
72
- },
73
- });
74
-
75
- if (config.crossTabInvalidation && invalidatedQueryKeys.length > 0) {
76
- broadcastQueryInvalidation(invalidatedQueryKeys);
77
- }
78
-
79
- if (shouldUpdate && updateKeys) {
80
- updateKeys.map((queryKey) => queryClient.setQueryData(queryKey, data));
81
- }
82
- },
83
- [
84
- queryClient,
85
- currentModule,
86
- config.preferUpdate,
87
- config.invalidateCurrentModule,
88
- config.invalidationMap,
89
- config.crossTabInvalidation,
90
- ],
91
- );
92
-
93
- return { runMutationEffects };
94
- }