@povio/openapi-codegen-cli 1.0.2 → 1.1.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/README.md +2 -1
- package/dist/generators/const/acl.const.d.ts +0 -1
- package/dist/generators/core/zod/ZodSchema.class.d.ts +2 -1
- package/dist/generators/core/zod/getZodSchemaRefs.d.ts +4 -0
- package/dist/generators/generate/generateAcl.d.ts +1 -2
- package/dist/generators/utils/generate/generate.acl.utils.d.ts +15 -3
- package/dist/generators/utils/generate-files.utils.d.ts +1 -1
- package/dist/index.js +48 -48
- package/dist/sh.js +170 -170
- package/package.json +1 -1
- package/src/generators/templates/acl.hbs +1 -9
- package/src/generators/templates/app-acl.hbs +8 -8
- package/src/generators/templates/models.hbs +1 -2
- package/src/generators/templates/partials/casl-ability-function.hbs +2 -2
- package/src/generators/templates/partials/casl-ability-type.hbs +1 -5
- package/dist/generators/core/zod/wrapCircularZodSchemas.d.ts +0 -2
package/package.json
CHANGED
|
@@ -8,14 +8,6 @@
|
|
|
8
8
|
{{#if includeNamespace}}
|
|
9
9
|
export namespace {{namespace}} {
|
|
10
10
|
{{/if}}
|
|
11
|
-
{{! Ability types }}
|
|
12
|
-
{{#each endpoints as | endpoint |}}
|
|
13
|
-
{{{genCaslAbilityType endpoint}}}
|
|
14
|
-
|
|
15
|
-
{{/each}}
|
|
16
|
-
{{! All abilities type }}
|
|
17
|
-
export type AllAbilities =
|
|
18
|
-
{{#each endpoints as | endpoint |}} | {{abilityTypeName endpoint}} {{/each}};
|
|
19
11
|
|
|
20
12
|
{{! Ability functions }}
|
|
21
13
|
{{#each endpoints as | endpoint |}}
|
|
@@ -24,4 +16,4 @@ export type AllAbilities =
|
|
|
24
16
|
{{/each}}
|
|
25
17
|
{{#if includeNamespace}}
|
|
26
18
|
}
|
|
27
|
-
{{/if}}
|
|
19
|
+
{{/if}}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{{! Casl AbilityTuple import}}
|
|
2
2
|
{{{genImport caslAbilityTupleImport}}}
|
|
3
|
-
{{!
|
|
4
|
-
{{#each
|
|
5
|
-
{{{genImport
|
|
3
|
+
{{! Models import }}
|
|
4
|
+
{{#each modelsImports as | modelsImport |}}
|
|
5
|
+
{{{genImport modelsImport}}}
|
|
6
6
|
{{/each}}
|
|
7
7
|
|
|
8
8
|
{{! AppAbilities union type }}
|
|
9
|
-
export type {{appAbilities}} =
|
|
10
|
-
{{#
|
|
11
|
-
{{
|
|
12
|
-
{{
|
|
9
|
+
export type {{appAbilities}} = {{#if appAbilitiesType}}
|
|
10
|
+
{{#each appAbilitiesType as | appAbilityType |}}
|
|
11
|
+
| {{../abilityTuple}}<"{{@key}}", {{{union appAbilityType}}}>
|
|
12
|
+
{{/each}}
|
|
13
13
|
{{else}}
|
|
14
14
|
{{abilityTuple}}<string, {{subjectType}}>;
|
|
15
15
|
{{/if}}
|
|
16
16
|
|
|
17
|
-
export type AppAbility = PureAbility<{{appAbilities}}>;
|
|
17
|
+
export type AppAbility = PureAbility<{{appAbilities}}>;
|
|
@@ -12,8 +12,7 @@ export namespace {{namespace}} {
|
|
|
12
12
|
{{! Js docs }}
|
|
13
13
|
{{{genModelJsDocs @key zodSchema ../tag}}}
|
|
14
14
|
{{! Zod schema export }}
|
|
15
|
-
export const {{@key}}{{
|
|
16
|
-
= {{{zodSchema.code}}};
|
|
15
|
+
export const {{@key}} = {{{zodSchema.code}}};
|
|
17
16
|
{{! Zod schema infered type export }}
|
|
18
17
|
export type {{zodInferedType @key}} = z.infer<typeof {{@key}}>;
|
|
19
18
|
{{#if zodSchema.isEnum}}export const {{zodInferedType @key}} = {{@key}}.enum;{{/if}}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Use for {{{genCaslAbilityQuery endpoint}}} ability. {{#if (hasAbilityConditions endpoint)}}For global ability, omit the object parameter.{{/if}}{{#if (abilityDescription endpoint)}}
|
|
3
3
|
* @description {{abilityDescription endpoint}}{{/if}}
|
|
4
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 {
|
|
5
|
+
{{/each}}{{/if}} * @returns { AbilityTuple } An ability tuple indicating the user's ability to use {{{genCaslAbilityQuery endpoint}}}
|
|
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}}
|
|
9
9
|
) => [
|
|
10
10
|
"{{ablityAction endpoint}}",
|
|
11
11
|
{{#if (hasAbilityConditions endpoint)}}object ? subject("{{ablitySubject endpoint}}", object) : "{{ablitySubject endpoint}}"{{else}}"{{ablitySubject endpoint}}"{{/if}}
|
|
12
|
-
] as {{
|
|
12
|
+
] as {{{genCaslAbilityType endpoint}}};
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
"{{ablityAction endpoint}}",
|
|
3
|
-
"{{ablitySubject endpoint}}"
|
|
4
|
-
{{#if (hasAbilityConditions endpoint)}}| (ForcedSubject<"{{ablitySubject endpoint}}"> & { {{#each (abilityConditionsTypes endpoint) as | propertyType |}}{{propertyType.name}}{{#unless propertyType.required}}?{{/unless}}: {{propertyType.type}}{{propertyType.zodSchemaName}}, {{/each}} }){{/if}}
|
|
5
|
-
>;
|
|
1
|
+
{{abilityTuple}}<"{{ablityAction endpoint}}", {{{union (abilitySubjectTypes endpoint)}}}>
|