@povio/openapi-codegen-cli 0.4.6 → 0.4.7
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/dist/generators/utils/generate/generate.acl.utils.d.ts +1 -0
- package/dist/generators/utils/generate/generate.endpoints.utils.d.ts +2 -0
- package/dist/generators/utils/string.utils.d.ts +1 -0
- package/dist/generators/utils/validation.utils.d.ts +4 -2
- package/dist/index.js +53 -52
- package/dist/sh.js +67 -66
- package/package.json +1 -1
- package/src/generators/templates/partials/casl-ability-function.hbs +4 -4
- package/src/generators/templates/partials/query-use-mutation.hbs +9 -0
- package/src/generators/templates/partials/query-use-query.hbs +9 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Use for `{{queryName endpoint}}` {{#if (isQuery endpoint)}}query{{else}}mutation{{/if}} ability. {{#if (hasAbilityConditions endpoint)}}For global ability, omit the object parameter.{{/if}}
|
|
3
|
-
* {{
|
|
4
|
-
{{#each (abilityConditionsTypes endpoint) as | propertyType |}}* @param
|
|
5
|
-
* @returns An ability tuple indicating the user's ability to use `{{queryName endpoint}}` {{#if (isQuery endpoint)}}query{{else}}mutation{{/if}}
|
|
2
|
+
* Use for `{{queryName endpoint}}` {{#if (isQuery endpoint)}}query{{else}}mutation{{/if}} ability. {{#if (hasAbilityConditions endpoint)}}For global ability, omit the object parameter.{{/if}}{{#if (abilityDescription endpoint)}}
|
|
3
|
+
* @description {{abilityDescription endpoint}}{{/if}}
|
|
4
|
+
{{#if (hasAbilityConditions endpoint)}}{{#each (abilityConditionsTypes endpoint) as | propertyType |}} * @param { {{propertyType.type}}{{propertyType.zodSchemaName}} } object.{{propertyType.name}} {{propertyType.name}} from {{propertyType.info}}
|
|
5
|
+
{{/each}}{{/if}} * @returns { {{abilityTypeName endpoint}} } An ability tuple indicating the user's ability to use `{{queryName endpoint}}` {{#if (isQuery endpoint)}}query{{else}}mutation{{/if}}
|
|
6
6
|
*/
|
|
7
7
|
export const {{abilityFunctionName endpoint}} = (
|
|
8
8
|
{{#if (hasAbilityConditions endpoint)}}object?: { {{#each (abilityConditionsTypes endpoint) as | propertyType |}}{{propertyType.name}}{{#unless propertyType.required}}?{{/unless}}: {{propertyType.type}}{{propertyType.zodSchemaName}}, {{/each}} } {{/if}}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation `{{queryName endpoint}}`{{#if endpoint.summary}}
|
|
3
|
+
* @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
|
|
4
|
+
* @description {{addAsteriskAfterNewLine endpoint.description}}{{/if}}{{#if endpoint.acl}}
|
|
5
|
+
* @permission Requires `{{abilityFunctionName endpoint}}` ability {{/if}}
|
|
6
|
+
{{#if (endpointParams endpoint)}}{{#each (endpointParams endpoint) as | endpointParam |}} * @param { {{endpointParam.type}} } mutation.{{endpointParam.name}} {{{endpointParamDescription endpointParam}}}
|
|
7
|
+
{{/each}}{{/if}} * @param { AppMutationOptions } options Mutation options
|
|
8
|
+
* @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
|
|
9
|
+
*/
|
|
1
10
|
export const {{queryName endpoint}} = (options?: AppMutationOptions<typeof {{importedEndpointName endpoint}}, { {{{genEndpointParams endpoint}}} }>) => {
|
|
2
11
|
return {{queryHook}}({
|
|
3
12
|
mutationFn: ({{#if (endpointParams endpoint)}} { {{{endpointArgs endpoint}}} } {{/if}}) => {{importedEndpointName endpoint}}({{{endpointArgs endpoint}}}),
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query `{{queryName endpoint}}`{{#if endpoint.summary}}
|
|
3
|
+
* @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
|
|
4
|
+
* @description {{addAsteriskAfterNewLine endpoint.description}}{{/if}}{{#if endpoint.acl}}
|
|
5
|
+
* @permission Requires `{{abilityFunctionName endpoint}}` ability {{/if}}
|
|
6
|
+
{{#if (endpointParams endpoint)}}{{#each (endpointParams endpoint) as | endpointParam |}} * @param { {{endpointParam.type}} } object.{{endpointParam.name}} {{{endpointParamDescription endpointParam}}}
|
|
7
|
+
{{/each}}{{/if}} * @param { AppQueryOptions } options Query options
|
|
8
|
+
* @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
|
|
9
|
+
*/
|
|
1
10
|
export const {{queryName endpoint}} = <TData>({{#if (endpointParams endpoint)}}{ {{{endpointArgs endpoint}}} }: { {{{genEndpointParams endpoint}}} }, {{/if}}options?: AppQueryOptions<typeof {{importedEndpointName endpoint}}, TData>) => {
|
|
2
11
|
return {{queryHook}}({
|
|
3
12
|
queryKey: keys.{{endpointName endpoint}}({{#if (endpointParams endpoint)}}{{{endpointArgs endpoint}}}{{/if}}),
|