@povio/openapi-codegen-cli 2.0.4-rc.1 → 2.0.4-rc.3

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": "2.0.4-rc.1",
3
+ "version": "2.0.4-rc.3",
4
4
  "keywords": [
5
5
  "codegen",
6
6
  "openapi",
@@ -1,8 +1,11 @@
1
- import { useCallback } from "react";
2
- {{! Ability context import }}
3
- {{{genImport abilityContextImport}}}
1
+ {{! CASL ability import }}
2
+ {{{genImport abilityTupleImport}}}
4
3
  {{! Error handling import }}
5
4
  {{{genImport errorHandlingImport}}}
5
+ {{! Ability context import }}
6
+ {{{genImport abilityContextImport}}}
7
+ import { useCallback } from "react";
8
+
6
9
  {{! App abilities import }}
7
10
  {{{genImport appAbilitiesImport}}}
8
11
 
@@ -13,11 +16,14 @@ interface UseAclCheckProps {
13
16
  export function {{aclCheckHook}}({ errorHandler }: UseAclCheckProps = {}) {
14
17
  const ability = {{abilityContext}}.useAbility{{#if hasGenericAppAbilities}}<{{appAbilities}}>{{/if}}();
15
18
 
16
- const checkAcl = useCallback((appAbility: {{appAbilities}}) => {
17
- if (!ability.can(...appAbility)) {
18
- (errorHandler ?? {{sharedErrorHandler}}).rethrowError(new Error("ACL check failed"));
19
- }
20
- }, [ability, errorHandler]);
19
+ const checkAcl = useCallback(
20
+ (appAbility: {{appAbilities}}) => {
21
+ if (!ability.can(...(appAbility as {{abilityTuple}}))) {
22
+ (errorHandler ?? {{sharedErrorHandler}}).rethrowError(new Error("ACL check failed"));
23
+ }
24
+ },
25
+ [ability, errorHandler],
26
+ );
21
27
 
22
28
  return { checkAcl };
23
29
  }
@@ -1 +1 @@
1
- {{abilityTuple}}<"{{ablityAction endpoint}}", "{{ablitySubject endpoint}}">
1
+ {{abilityTuple}}<"{{ablityAction endpoint}}", {{{union (abilitySubjectTypes endpoint)}}}>