@povio/openapi-codegen-cli 0.6.5 → 0.6.6

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.6.5",
3
+ "version": "0.6.6",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"
@@ -1,5 +1,9 @@
1
1
  {{! App rest client import}}
2
2
  {{{genImport appRestClientImport}}}
3
+ {{! Axios import }}
4
+ {{#if hasAxiosImport}}
5
+ {{{genImport axiosImport}}}
6
+ {{/if}}
3
7
  {{! Zod import }}
4
8
  {{#if hasZodImport}}
5
9
  {{{genImport zodImport}}}
@@ -14,7 +18,7 @@ export namespace {{namespace}} {
14
18
  {{/if}}
15
19
  {{! Endpoints export }}
16
20
  {{#each endpoints as | endpoint |}}
17
- export const {{endpointName endpoint}} = ({{{genEndpointParams endpoint}}}) => {
21
+ export const {{endpointName endpoint}} = ({{{genEndpointParams endpoint}}}{{#if ../hasAxiosRequestConfig}}{{../axiosRequestConfigName}}?: {{../axiosRequestConfigType}}{{/if}}) => {
18
22
  return {{../restClientName}}.{{endpoint.method}}(
19
23
  {{! Response }}
20
24
  { resSchema: {{importedZodSchemaName endpoint.response}} },
@@ -1,5 +1,8 @@
1
1
  {
2
2
  {{! Query params}}
3
+ {{#if hasAxiosRequestConfig}}
4
+ ...{{axiosRequestConfigName}},
5
+ {{/if}}
3
6
  {{#if endpointConfig.params}}
4
7
  params: {
5
8
  {{#each endpointConfig.params as | param |}}
@@ -8,8 +8,7 @@
8
8
  {{/each}}{{/if}} * @param { AppInfiniteQueryOptions } options Infinite query options
9
9
  * @returns { UseInfiniteQueryResult<{{{importedZodSchemaInferedType endpoint.response}}}> } {{endpoint.responseDescription}}
10
10
  * @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
11
- */
12
- {{else}}
11
+ */{{else}}
13
12
  /**
14
13
  * {{#if (isQuery endpoint)}}Query{{else}}Mutation{{/if}} `{{queryName endpoint}}`{{#if endpoint.summary}}
15
14
  * @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
@@ -1,10 +1,10 @@
1
1
  {{! Js docs }}
2
2
  {{{genQueryJsDocs endpoint "infiniteQuery" }}}
3
3
  {{! Infinite query definition}}
4
- export const {{infiniteQueryName endpoint}} = <TData>({{#if (endpointParams endpoint)}}{ {{{endpointArgs endpoint "removePageParam"}}} }: { {{{genEndpointParams endpoint "removePageParam"}}} }, {{/if}}options?: AppInfiniteQueryOptions<typeof {{importedEndpointName endpoint}}, TData>) => {
4
+ export const {{infiniteQueryName endpoint}} = <TData>({{#if (endpointParams endpoint)}}{ {{{endpointArgs endpoint "removePageParam"}}} }: { {{{genEndpointParams endpoint "removePageParam"}}} }, {{/if}}options?: AppInfiniteQueryOptions<typeof {{importedEndpointName endpoint}}, TData>{{#if hasAxiosRequestConfig}}, {{axiosRequestConfigName}}?: {{axiosRequestConfigType}}{{/if}}) => {
5
5
  return {{infiniteQueryHook}}({
6
6
  queryKey: keys.{{endpointName endpoint}}Infinite({{#if (endpointParams endpoint)}}{{{endpointArgs endpoint "removePageParam"}}}{{/if}}),
7
- queryFn: ({ pageParam }) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint "replacePageParam"}}}),
7
+ queryFn: ({ pageParam }) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint "replacePageParam"}}}{{#if hasAxiosRequestConfig}}, {{axiosRequestConfigName}}{{/if}}),
8
8
  initialPageParam: 1,
9
9
  getNextPageParam: ({ {{pageParamName}}, {{totalItemsName}}, {{limitParamName}}: limitParam }) => {
10
10
  const pageParam = {{pageParamName}} ?? 1;
@@ -1,11 +1,11 @@
1
1
  {{! Js docs }}
2
2
  {{{genQueryJsDocs endpoint}}}
3
3
  {{! Mutation definition}}
4
- export const {{queryName endpoint}} = (options?: AppMutationOptions<typeof {{importedEndpointName endpoint}}, { {{{genEndpointParams endpoint}}} }>) => {
4
+ export const {{queryName endpoint}} = (options?: AppMutationOptions<typeof {{importedEndpointName endpoint}}, { {{{genEndpointParams endpoint}}} }>{{#if hasAxiosRequestConfig}}, {{axiosRequestConfigName}}?: {{axiosRequestConfigType}}{{/if}}) => {
5
5
  {{#if queryEndpoints}} const queryClient = useQueryClient();{{/if}}
6
6
 
7
7
  return {{queryHook}}({
8
- mutationFn: ({{#if (endpointParams endpoint)}} { {{{endpointArgs endpoint}}} } {{/if}}) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}),
8
+ mutationFn: ({{#if (endpointParams endpoint)}} { {{{endpointArgs endpoint}}} } {{/if}}) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}{{#if hasAxiosRequestConfig}}{{#if (endpointArgs endpoint)}}, {{/if}}{{axiosRequestConfigName}}{{/if}}),
9
9
  ...options, {{#if queryEndpoints}}
10
10
  onSuccess: (...args) => {
11
11
  {{! Invalidation }}
@@ -1,10 +1,10 @@
1
1
  {{! Js docs }}
2
2
  {{{genQueryJsDocs endpoint}}}
3
3
  {{! Query definition}}
4
- export const {{queryName endpoint}} = <TData>({{#if (endpointParams endpoint)}}{ {{{endpointArgs endpoint}}} }: { {{{genEndpointParams endpoint}}} }, {{/if}}options?: AppQueryOptions<typeof {{importedEndpointName endpoint}}, TData>) => {
4
+ export const {{queryName endpoint}} = <TData>({{#if (endpointParams endpoint)}}{ {{{endpointArgs endpoint}}} }: { {{{genEndpointParams endpoint}}} }, {{/if}}options?: AppQueryOptions<typeof {{importedEndpointName endpoint}}, TData>{{#if hasAxiosRequestConfig}}, {{axiosRequestConfigName}}?: {{axiosRequestConfigType}}{{/if}}) => {
5
5
  return {{queryHook}}({
6
6
  queryKey: keys.{{endpointName endpoint}}({{#if (endpointParams endpoint)}}{{{endpointArgs endpoint}}}{{/if}}),
7
- queryFn: {{#if (endpointParams endpoint)}}() => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}){{else}}{{importedEndpointName endpoint}}{{/if}},
7
+ queryFn: {{#if hasEndpointArgs}}() => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}{{#if hasAxiosRequestConfig}}{{#if (endpointArgs endpoint)}}, {{/if}}{{axiosRequestConfigName}}{{/if}}){{else}}{{importedEndpointName endpoint}}{{/if}},
8
8
  ...options,
9
9
  });
10
10
  };
@@ -1,3 +1,7 @@
1
+ {{! Axios import }}
2
+ {{#if hasAxiosImport}}
3
+ {{{genImport axiosImport}}}
4
+ {{/if}}
1
5
  {{! React query import }}
2
6
  {{{genImport queryImport}}}
3
7
  {{! React query types import }}