@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "2.0.8-rc.1",
3
+ "version": "2.0.8-rc.3",
4
4
  "keywords": [
5
5
  "codegen",
6
6
  "openapi",
@@ -63,39 +63,39 @@
63
63
  "dev:check": "yarn start check --config ./test/config.ts"
64
64
  },
65
65
  "dependencies": {
66
- "i18next": "^25.7.3",
66
+ "i18next": "^25.8.10",
67
67
  "import-fresh": "^3.3.1"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@apidevtools/swagger-parser": "^10.1.0",
71
- "@casl/ability": "^6.7.3",
72
- "@casl/react": "^5.0.0",
71
+ "@casl/ability": "^6.8.0",
72
+ "@casl/react": "^5.0.1",
73
73
  "@tanstack/react-query": "~5.90.21",
74
- "@types/node": "^20.12.12",
74
+ "@types/node": "^20.19.33",
75
75
  "@types/prompt-sync": "^4.2.3",
76
- "@types/react": "^19.1.0",
77
- "@types/yargs": "^17.0.32",
78
- "@vitejs/plugin-react": "^5.1.3",
79
- "axios": "^1.13.1",
80
- "esbuild": "0.25.0",
76
+ "@types/react": "^19.2.14",
77
+ "@types/yargs": "^17.0.35",
78
+ "@vitejs/plugin-react": "^5.1.4",
79
+ "axios": "^1.13.5",
80
+ "esbuild": "0.25.12",
81
81
  "handlebars": "^4.7.8",
82
82
  "openapi-types": "^12.1.3",
83
- "oxfmt": "^0.27.0",
84
- "oxlint": "^1.41.0",
85
- "oxlint-tsgolint": "^0.11.4",
83
+ "oxfmt": "^0.33.0",
84
+ "oxlint": "^1.48.0",
85
+ "oxlint-tsgolint": "^0.14.0",
86
86
  "prompt-sync": "^4.2.0",
87
- "react": "^19.1.0",
87
+ "react": "^19.2.4",
88
88
  "reflect-metadata": "^0.2.2",
89
89
  "ts-node": "^10.9.2",
90
- "ts-pattern": "^5.3.1",
91
- "tsx": "^4.10.5",
92
- "type-fest": "^4.26.0",
90
+ "ts-pattern": "^5.9.0",
91
+ "tsx": "^4.21.0",
92
+ "type-fest": "^4.41.0",
93
93
  "typescript": "^5.9.3",
94
94
  "vite": "^7.3.1",
95
95
  "vite-plugin-dts": "^4.5.4",
96
- "vitest": "^2.0.5",
96
+ "vitest": "3.2.4",
97
97
  "yargs": "^17.7.2",
98
- "zod": "^4.1.12"
98
+ "zod": "^4.3.6"
99
99
  },
100
100
  "peerDependencies": {
101
101
  "@casl/ability": "^6.7.3",
@@ -1,15 +1,14 @@
1
1
  import { useCallback, useEffect } from "react";
2
2
 
3
- import { OpenApiQueryConfig } from "@povio/openapi-codegen-cli";
4
3
  import { QueryKey, useQueryClient } from "@tanstack/react-query";
5
4
 
6
- import { QueryModule } from "./queryModules";
5
+ import { OpenApiQueryConfig, QueryModule, InvalidationMap } from "../lib/config/queryConfig.context";
7
6
  import { broadcastQueryInvalidation, setupCrossTabListener } from "./useCrossTabQueryInvalidation";
8
7
 
9
8
  export interface MutationEffectsOptions {
10
9
  invalidateCurrentModule?: boolean;
11
10
  crossTabInvalidation?: boolean;
12
- invalidationMap?: Record<string, (context: Record<string, string>) => QueryKey[]>;
11
+ invalidationMap?: InvalidationMap;
13
12
  invalidateModules?: QueryModule[];
14
13
  invalidateKeys?: QueryKey[];
15
14
  preferUpdate?: boolean;
@@ -29,8 +28,19 @@ export function useMutationEffects({ currentModule }: UseMutationEffectsProps) {
29
28
  }, [queryClient, config.crossTabInvalidation]);
30
29
 
31
30
  const runMutationEffects = useCallback(
32
- async <TData>(data: TData, options: MutationEffectsOptions = {}, updateKeys?: QueryKey[]) => {
33
- const { invalidateCurrentModule = true, invalidateModules, invalidateKeys, preferUpdate } = options;
31
+ async <TData, TVariables>(
32
+ data: TData,
33
+ variables: TVariables,
34
+ options: MutationEffectsOptions = {},
35
+ updateKeys?: QueryKey[],
36
+ ) => {
37
+ const {
38
+ invalidateCurrentModule = true,
39
+ invalidateModules,
40
+ invalidateKeys,
41
+ preferUpdate,
42
+ invalidationMap,
43
+ } = options;
34
44
  const shouldUpdate = preferUpdate || (preferUpdate === undefined && config.preferUpdate);
35
45
  const shouldInvalidateCurrentModule =
36
46
  invalidateCurrentModule || (invalidateCurrentModule === undefined && config.invalidateCurrentModule);
@@ -51,7 +61,7 @@ export function useMutationEffects({ currentModule }: UseMutationEffectsProps) {
51
61
  const isInvalidateModule = !!invalidateModules && invalidateModules.some((module) => queryKey[0] === module);
52
62
  const isInvalidateKey = !!invalidateKeys && invalidateKeys.some((key) => isQueryKeyEqual(queryKey, key));
53
63
 
54
- const map = config.invalidationMap?.[currentModule]?.(data);
64
+ const map = (invalidationMap || config.invalidationMap)?.[currentModule]?.(data, variables);
55
65
  const isMappedKey = !!map && map.some((key) => isQueryKeyEqual(queryKey, key));
56
66
 
57
67
  const shouldInvalidate = isCurrentModule || isInvalidateModule || isInvalidateKey || isMappedKey;
@@ -47,7 +47,7 @@ export const {{queryName endpoint mutation=true}} = (options?: AppMutationOption
47
47
  {{#if destructuredVariables}}const { {{commaSeparated destructuredVariables }} } = variables;{{/if}}
48
48
  const updateKeys = [{{#each updateQueryEndpoints as | endpoint |}}keys.{{endpointName endpoint}}({{{endpointArgs endpoint includeOnlyRequiredParams=true}}}), {{/each}}];
49
49
  {{/if}}
50
- await runMutationEffects(resData, options{{#if updateQueryEndpoints}}, updateKeys{{/if}});
50
+ await runMutationEffects(resData, variables, options{{#if updateQueryEndpoints}}, updateKeys{{/if}});
51
51
  options?.onSuccess?.(resData, variables, onMutateResult, context);
52
52
  },{{/if}}
53
53
  });
@@ -1,5 +1,9 @@
1
+ import { QueryModule as BaseQueryModule } from "../lib/config/queryConfig.context";
2
+
1
3
  export const enum QueryModule {
2
4
  {{#each modules as | module |}}
3
5
  {{module.tag}} = "{{module.namespace}}",
4
6
  {{/each}}
5
- }
7
+ }
8
+
9
+ export type QueryModuleType = QueryModule | BaseQueryModule;