@povio/openapi-codegen-cli 0.12.1 → 0.13.1
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 +1 -0
- package/dist/commands/generate.d.ts +1 -1
- package/dist/generators/const/acl.const.d.ts +3 -0
- package/dist/generators/const/deps.const.d.ts +2 -0
- package/dist/generators/generate/generateAclCheck.d.ts +2 -0
- package/dist/generators/utils/generate/generate.utils.d.ts +2 -0
- package/dist/generators/utils/query.utils.d.ts +2 -0
- package/dist/index.js +46 -46
- package/dist/sh.js +65 -65
- package/package.json +2 -2
- package/src/assets/useMutationEffects.ts +2 -2
- package/src/generators/templates/acl-check.hbs +23 -0
- package/src/generators/templates/app-acl.hbs +2 -2
- package/src/generators/templates/partials/acl-check-params.hbs +1 -0
- package/src/generators/templates/partials/endpoint-param-parse.hbs +1 -1
- package/src/generators/templates/partials/query-use-infinite-query.hbs +7 -1
- package/src/generators/templates/partials/query-use-mutation.hbs +11 -5
- package/src/generators/templates/partials/query-use-query.hbs +7 -1
- package/src/generators/templates/queries.hbs +4 -0
- package/src/generators/templates/zod.hbs +11 -2
package/README.md
CHANGED
|
@@ -51,6 +51,7 @@ yarn openapi-codegen generate --input http://localhost:3001/docs-json --standalo
|
|
|
51
51
|
--infiniteQueries Generate infinite queries for paginated API endpoints (default: false)
|
|
52
52
|
--mutationEffects Add mutation effects options to mutation hooks (default: true)
|
|
53
53
|
--parseRequestParams Add Zod parsing to API endpoints (default: false)
|
|
54
|
+
--checkAcl Add ACL check to queries (default: false)
|
|
54
55
|
|
|
55
56
|
--standalone Generate any missing supporting classes/types, e.g., REST client class, React Query type extensions, etc. (default: false)
|
|
56
57
|
--baseUrl (Requires `--standalone`) Base URL for the REST client; falls back to the OpenAPI spec if not provided
|
|
@@ -4,5 +4,5 @@ export type GenerateParams = {
|
|
|
4
4
|
monorepo: boolean;
|
|
5
5
|
prettier: boolean;
|
|
6
6
|
verbose: boolean;
|
|
7
|
-
} & Pick<GenerateOptions, "input" | "output" | "tsNamespaces" | "splitByTags" | "defaultTag" | "removeOperationPrefixEndingWith" | "importPath" | "extractEnums" | "standalone" | "baseUrl" | "replaceOptionalWithNullish" | "infiniteQueries" | "axiosRequestConfig" | "mutationEffects" | "parseRequestParams">;
|
|
7
|
+
} & Pick<GenerateOptions, "input" | "output" | "tsNamespaces" | "splitByTags" | "defaultTag" | "removeOperationPrefixEndingWith" | "importPath" | "extractEnums" | "standalone" | "baseUrl" | "replaceOptionalWithNullish" | "infiniteQueries" | "axiosRequestConfig" | "mutationEffects" | "parseRequestParams" | "checkAcl">;
|
|
8
8
|
export declare function generate({ input, excludeTags, monorepo, prettier, verbose, ...params }: GenerateParams): Promise<void>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { GenerateFile, Import } from "../types/generate";
|
|
2
2
|
export declare const ACL_APP_ABILITY_FILE: GenerateFile;
|
|
3
3
|
export declare const ACL_ALL_ABILITIES = "AllAbilities";
|
|
4
|
+
export declare const ACL_APP_ABILITIES = "AppAbilities";
|
|
5
|
+
export declare const ACL_CHECK_FILE: GenerateFile;
|
|
6
|
+
export declare const ACL_CHECK_HOOK = "useAclCheck";
|
|
4
7
|
export declare const CASL_ABILITY_BINDING: {
|
|
5
8
|
abilityTuple: string;
|
|
6
9
|
pureAbility: string;
|
|
@@ -16,6 +16,8 @@ export declare const ERROR_HANDLERS: {
|
|
|
16
16
|
SharedErrorHandler: string;
|
|
17
17
|
};
|
|
18
18
|
export declare const ERROR_HANDLING_IMPORT: Import;
|
|
19
|
+
export declare const ABILITY_CONTEXT = "AbilityContext";
|
|
20
|
+
export declare const ABILITY_CONTEXT_IMPORT: Import;
|
|
19
21
|
export declare enum StandaloneAssetEnum {
|
|
20
22
|
ReactQueryTypes = "reactQueryTypes",
|
|
21
23
|
RestClient = "restClient",
|
|
@@ -18,5 +18,7 @@ export declare function getAppRestClientImportPath(options: GenerateOptions): st
|
|
|
18
18
|
export declare function getQueryTypesImportPath(options: GenerateOptions): string;
|
|
19
19
|
export declare function getQueryModulesImportPath(options: GenerateOptions): string;
|
|
20
20
|
export declare function getMutationEffectsImportPath(options: GenerateOptions): string;
|
|
21
|
+
export declare function getAclCheckImportPath(options: GenerateOptions): string;
|
|
21
22
|
export declare function getZodExtendedImportPath(options: GenerateOptions): string;
|
|
23
|
+
export declare function getAppAbilitiesImportPath(): string;
|
|
22
24
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { SchemaResolver } from "../core/SchemaResolver.class";
|
|
1
2
|
import { Endpoint } from "../types/endpoint";
|
|
2
3
|
export declare const isQuery: (endpoint: Endpoint) => boolean;
|
|
3
4
|
export declare const isMutation: (endpoint: Endpoint) => boolean;
|
|
4
5
|
export declare const isInfiniteQuery: (endpoint: Endpoint, infiniteQueryParams?: string[]) => boolean;
|
|
6
|
+
export declare const getDestructuredVariables: (resolver: SchemaResolver, endpoint: Endpoint, updateQueryEndpoints: Endpoint[]) => string[];
|