@povio/openapi-codegen-cli 0.1.2 → 0.2.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,12 +1,12 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"
7
7
  },
8
8
  "scripts": {
9
- "start": "node --import tsx/esm ./src/sh.ts",
9
+ "start": "node --import tsx ./src/sh.ts",
10
10
  "test": "vitest run",
11
11
  "test:watch": "vitest",
12
12
  "build:clean": "rm -rf ./dist",
@@ -1,5 +1,6 @@
1
- export const {{queryName endpoint}} = () => {
1
+ export const {{queryName endpoint}} = (options?: AppMutationOptions<typeof {{importedEndpointName endpoint}}, { {{{genEndpointParams endpoint}}} }>) => {
2
2
  return {{queryHook}}({
3
- mutationFn: {{#if (moreThanOneParameter endpoint)}}({ {{{endpointArgs endpoint}}} }: { {{{genEndpointParams endpoint}}} }) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}){{else}}{{importedEndpointName endpoint}}{{/if}},
3
+ mutationFn: ({ {{{endpointArgs endpoint}}} }) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}),
4
+ ...options,
4
5
  });
5
6
  };
@@ -1,6 +1,7 @@
1
- export const {{queryName endpoint}} = ({{{genEndpointParams endpoint}}}) => {
1
+ export const {{queryName endpoint}} = <TData>({{#if (endpointParams endpoint)}}{ {{{endpointArgs endpoint}}} }: { {{{genEndpointParams endpoint}}} }, {{/if}}options?: AppQueryOptions<typeof {{importedEndpointName endpoint}}, TData>) => {
2
2
  return {{queryHook}}({
3
- queryKey: keys.{{endpointName endpoint}}({{{endpointArgs endpoint}}}),
3
+ queryKey: keys.{{endpointName endpoint}}({{#if (endpointParams endpoint)}}{{{endpointArgs endpoint}}}{{/if}}),
4
4
  queryFn: {{#if (endpointParams endpoint)}}() => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}){{else}}{{importedEndpointName endpoint}}{{/if}},
5
+ ...options,
5
6
  });
6
7
  };
@@ -1,5 +1,7 @@
1
1
  {{! React query import }}
2
2
  {{{genImport queryImport}}}
3
+ {{! React query types import }}
4
+ {{{genImport queryTypesImport}}}
3
5
  {{! Models import }}
4
6
  {{#each modelsImports as | modelsImport |}}
5
7
  {{{genImport modelsImport}}}