@povio/openapi-codegen-cli 0.4.11 → 0.5.0

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": "0.4.11",
3
+ "version": "0.5.0",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"
@@ -8,8 +8,16 @@
8
8
  * @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
9
9
  */
10
10
  export const {{queryName endpoint}} = (options?: AppMutationOptions<typeof {{importedEndpointName endpoint}}, { {{{genEndpointParams endpoint}}} }>) => {
11
+ {{#if (endpointAllQueryKey endpoint endpoints)}} const queryClient = useQueryClient();{{/if}}
12
+
11
13
  return {{queryHook}}({
12
14
  mutationFn: ({{#if (endpointParams endpoint)}} { {{{endpointArgs endpoint}}} } {{/if}}) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}),
13
- ...options,
15
+ ...options, {{#if (endpointAllQueryKey endpoint endpoints)}}
16
+ onSuccess: (...args) => {
17
+ if (options?.enableInvalidateAll) {
18
+ queryClient.invalidateQueries({ queryKey: keys.{{endpointAllQueryKey endpoint endpoints}} });
19
+ }
20
+ options?.onSuccess?.(...args);
21
+ },{{/if}}
14
22
  });
15
23
  };
@@ -19,7 +19,7 @@ export namespace {{namespace}} {
19
19
 
20
20
  {{! Query export }}
21
21
  {{#each endpoints as | endpoint |}}
22
- {{{genQuery endpoint}}}
22
+ {{{genQuery endpoint ../queryEndpoints}}}
23
23
 
24
24
  {{/each}}
25
25