@povio/openapi-codegen-cli 2.0.8-rc.1 → 2.0.8-rc.3
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/assets/useCrossTabQueryInvalidation.mjs +23 -0
- package/dist/assets/useMutationEffects.mjs +56 -0
- package/dist/generator.js +42 -42
- package/dist/generators/utils/generate/generate.utils.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +3 -1
- package/dist/lib/config/queryConfig.context.d.ts +6 -3
- package/dist/lib/config/queryConfig.context.mjs +4 -1
- package/dist/sh.js +113 -131
- package/package.json +19 -19
- package/src/assets/useMutationEffects.ts +16 -6
- package/src/generators/templates/partials/query-use-mutation.hbs +1 -1
- package/src/generators/templates/query-modules.hbs +5 -1
|
@@ -11,7 +11,7 @@ export declare function getTagImportPath(...args: Parameters<typeof getTagFileNa
|
|
|
11
11
|
export declare function getTagFileName(...args: Parameters<typeof getTagFileNameWithoutExtension>): string;
|
|
12
12
|
export declare function getAppRestClientImportPath(options: GenerateOptions): string;
|
|
13
13
|
export declare function getQueryModulesImportPath(options: GenerateOptions): string;
|
|
14
|
-
export declare function getMutationEffectsImportPath(
|
|
14
|
+
export declare function getMutationEffectsImportPath(_options: GenerateOptions): string;
|
|
15
15
|
export declare function getAclCheckImportPath(options: GenerateOptions): string;
|
|
16
16
|
export declare function getZodExtendedImportPath(options: GenerateOptions): string;
|
|
17
17
|
export declare function getAppAbilitiesImportPath(options: GenerateOptions): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export type { GeneralErrorCodes, ErrorHandlerOptions, ErrorEntry } from './lib/r
|
|
|
8
8
|
export type { AppQueryOptions, AppMutationOptions, AppInfiniteQueryOptions } from './lib/react-query.types';
|
|
9
9
|
export { OpenApiRouter } from './lib/config/router.context';
|
|
10
10
|
export { OpenApiQueryConfig } from './lib/config/queryConfig.context';
|
|
11
|
+
export { useMutationEffects } from './assets/useMutationEffects';
|
|
12
|
+
export type { MutationEffectsOptions, UseMutationEffectsProps } from './assets/useMutationEffects';
|
|
11
13
|
export { ns, resources } from './lib/config/i18n';
|
|
12
14
|
export { AuthContext } from './lib/auth/auth.context';
|
|
13
15
|
export { AuthGuard } from './lib/auth/AuthGuard';
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { RestUtils } from "./lib/rest/rest.utils.mjs";
|
|
|
4
4
|
import { ApplicationException, ErrorHandler, SharedErrorHandler } from "./lib/rest/error-handling.mjs";
|
|
5
5
|
import { OpenApiRouter } from "./lib/config/router.context.mjs";
|
|
6
6
|
import { OpenApiQueryConfig } from "./lib/config/queryConfig.context.mjs";
|
|
7
|
+
import { useMutationEffects } from "./assets/useMutationEffects.mjs";
|
|
7
8
|
import { ns, resources } from "./lib/config/i18n.mjs";
|
|
8
9
|
import { AuthContext } from "./lib/auth/auth.context.mjs";
|
|
9
10
|
import { AuthGuard } from "./lib/auth/AuthGuard.mjs";
|
|
@@ -19,5 +20,6 @@ export {
|
|
|
19
20
|
RestUtils,
|
|
20
21
|
SharedErrorHandler,
|
|
21
22
|
ns,
|
|
22
|
-
resources
|
|
23
|
+
resources,
|
|
24
|
+
useMutationEffects
|
|
23
25
|
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { QueryKey } from '@tanstack/react-query';
|
|
2
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>>;
|
|
3
6
|
export declare namespace OpenApiQueryConfig {
|
|
4
7
|
interface Type {
|
|
5
8
|
preferUpdate?: boolean;
|
|
6
9
|
invalidateCurrentModule?: boolean;
|
|
7
|
-
invalidationMap?:
|
|
10
|
+
invalidationMap?: InvalidationMap;
|
|
8
11
|
crossTabInvalidation?: boolean;
|
|
9
12
|
}
|
|
10
13
|
type ProviderProps = Type;
|
|
11
|
-
export const Provider: ({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, 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;
|
|
12
15
|
export const useConfig: () => Type;
|
|
13
16
|
export {};
|
|
14
17
|
}
|
|
@@ -10,7 +10,10 @@ var OpenApiQueryConfig;
|
|
|
10
10
|
crossTabInvalidation,
|
|
11
11
|
children
|
|
12
12
|
}) => {
|
|
13
|
-
const value = useMemo(
|
|
13
|
+
const value = useMemo(
|
|
14
|
+
() => ({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation }),
|
|
15
|
+
[preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation]
|
|
16
|
+
);
|
|
14
17
|
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
15
18
|
};
|
|
16
19
|
OpenApiQueryConfig2.useConfig = () => {
|