@povio/openapi-codegen-cli 0.5.1 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"
@@ -1,8 +1,6 @@
1
1
  export const keys = {
2
- {{#each (allQueryKeys endpoints) as | queryKey |}}
3
- {{queryKey.name}}: ["{{queryKey.path}}"] as const,
4
- {{/each}}
5
- {{#each endpoints as | endpoint |}}
6
- {{endpointName endpoint}}: ({{{genEndpointParams endpoint}}}) => [{{{commaSeparated (endpointPathQueryKeys endpoint ../endpoints)}}}, {{{endpointArgs endpoint}}}] as const,
2
+ all: ["{{namespace}}"] as const,
3
+ {{#each queryEndpoints as | endpoint |}}
4
+ {{endpointName endpoint}}: ({{{genEndpointParams endpoint}}}) => [...keys.all, "{{endpoint.path}}", {{{endpointArgs endpoint}}}] as const,
7
5
  {{/each}}
8
6
  };
@@ -8,14 +8,14 @@
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}}
11
+ {{#if queryEndpoints}} const queryClient = useQueryClient();{{/if}}
12
12
 
13
13
  return {{queryHook}}({
14
14
  mutationFn: ({{#if (endpointParams endpoint)}} { {{{endpointArgs endpoint}}} } {{/if}}) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}),
15
- ...options, {{#if (endpointAllQueryKey endpoint endpoints)}}
15
+ ...options, {{#if queryEndpoints}}
16
16
  onSuccess: (...args) => {
17
17
  if (options?.enableInvalidateAll) {
18
- queryClient.invalidateQueries({ queryKey: keys.{{endpointAllQueryKey endpoint endpoints}} });
18
+ queryClient.invalidateQueries({ queryKey: keys.all });
19
19
  }
20
20
  options?.onSuccess?.(...args);
21
21
  },{{/if}}
@@ -15,7 +15,7 @@
15
15
  export namespace {{namespace}} {
16
16
  {{/if}}
17
17
  {{! Query keys export}}
18
- {{{genQueryKeys queryEndpoints}}}
18
+ {{{genQueryKeys queryEndpoints namespace}}}
19
19
 
20
20
  {{! Query export }}
21
21
  {{#each endpoints as | endpoint |}}