@povio/openapi-codegen-cli 2.0.7 → 2.0.8-rc.2
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/generator.js +37 -37
- package/dist/generators/const/deps.const.d.ts +1 -0
- package/dist/lib/config/queryConfig.context.d.ts +7 -1
- package/dist/lib/config/queryConfig.context.mjs +11 -2
- package/dist/sh.js +126 -144
- package/package.json +19 -19
- package/src/assets/useCrossTabQueryInvalidation.ts +40 -0
- package/src/assets/useMutationEffects.ts +41 -7
- package/src/generators/templates/partials/query-use-mutation.hbs +1 -1
- package/src/generators/templates/query-modules.hbs +5 -1
|
@@ -27,6 +27,7 @@ export declare const MUTATION_EFFECTS: {
|
|
|
27
27
|
runFunctionName: string;
|
|
28
28
|
};
|
|
29
29
|
export declare const MUTATION_EFFECTS_FILE: GenerateFile;
|
|
30
|
+
export declare const CROSS_TAB_QUERY_INVALIDATION_FILE: GenerateFile;
|
|
30
31
|
export declare const ZOD_EXTENDED: {
|
|
31
32
|
namespace: string;
|
|
32
33
|
exports: {
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { QueryKey } from '@tanstack/react-query';
|
|
3
|
+
export type QueryModule = string | number | symbol;
|
|
4
|
+
export type InvalidationMapFunc<TData = any, TVariables = any> = (data: TData, variables: TVariables) => QueryKey[];
|
|
5
|
+
export type InvalidationMap<TData = any, TVariables = any> = Record<QueryModule, InvalidationMapFunc<TData, TVariables>>;
|
|
2
6
|
export declare namespace OpenApiQueryConfig {
|
|
3
7
|
interface Type {
|
|
4
8
|
preferUpdate?: boolean;
|
|
5
9
|
invalidateCurrentModule?: boolean;
|
|
10
|
+
invalidationMap?: InvalidationMap;
|
|
11
|
+
crossTabInvalidation?: boolean;
|
|
6
12
|
}
|
|
7
13
|
type ProviderProps = Type;
|
|
8
|
-
export const Provider: ({ preferUpdate, invalidateCurrentModule, children }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export const Provider: ({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, children, }: PropsWithChildren<ProviderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
9
15
|
export const useConfig: () => Type;
|
|
10
16
|
export {};
|
|
11
17
|
}
|
|
@@ -3,8 +3,17 @@ import { createContext, useMemo, use } from "react";
|
|
|
3
3
|
var OpenApiQueryConfig;
|
|
4
4
|
((OpenApiQueryConfig2) => {
|
|
5
5
|
const Context = createContext({});
|
|
6
|
-
OpenApiQueryConfig2.Provider = ({
|
|
7
|
-
|
|
6
|
+
OpenApiQueryConfig2.Provider = ({
|
|
7
|
+
preferUpdate,
|
|
8
|
+
invalidateCurrentModule,
|
|
9
|
+
invalidationMap,
|
|
10
|
+
crossTabInvalidation,
|
|
11
|
+
children
|
|
12
|
+
}) => {
|
|
13
|
+
const value = useMemo(
|
|
14
|
+
() => ({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation }),
|
|
15
|
+
[preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation]
|
|
16
|
+
);
|
|
8
17
|
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
9
18
|
};
|
|
10
19
|
OpenApiQueryConfig2.useConfig = () => {
|