@povio/openapi-codegen-cli 0.10.8 → 0.11.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 -1
- package/dist/commands/generate.d.ts +1 -1
- package/dist/generators/const/deps.const.d.ts +6 -4
- package/dist/generators/const/queries.const.d.ts +0 -1
- package/dist/generators/generate/generateQueryModules.d.ts +2 -0
- package/dist/generators/utils/generate/generate.endpoints.utils.d.ts +4 -1
- package/dist/generators/utils/generate/generate.utils.d.ts +2 -1
- package/dist/generators/utils/generate-files.utils.d.ts +6 -0
- package/dist/index.js +45 -45
- package/dist/sh.js +65 -65
- package/package.json +3 -2
- package/src/assets/queryConfig.context.tsx +22 -0
- package/src/assets/useMutationEffects.ts +52 -0
- package/src/generators/templates/partials/query-js-docs.hbs +2 -2
- package/src/generators/templates/partials/query-keys.hbs +1 -1
- package/src/generators/templates/partials/query-use-infinite-query.hbs +2 -2
- package/src/generators/templates/partials/query-use-mutation.hbs +12 -7
- package/src/generators/templates/queries.hbs +9 -5
- package/src/generators/templates/query-modules.hbs +5 -0
- package/dist/generators/generate/generateInvalidateQueries.d.ts +0 -2
- package/src/generators/templates/invalidate-queries.hbs +0 -34
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ yarn openapi-codegen generate --input http://localhost:3001/docs-json --standalo
|
|
|
49
49
|
|
|
50
50
|
--axiosRequestConfig Include Axios request config parameters in query hooks (default: false)
|
|
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
|
|
|
54
54
|
--standalone Generate any missing supporting classes/types, e.g., REST client class, React Query type extensions, etc. (default: false)
|
|
55
55
|
--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" | "
|
|
7
|
+
} & Pick<GenerateOptions, "input" | "output" | "tsNamespaces" | "splitByTags" | "defaultTag" | "removeOperationPrefixEndingWith" | "importPath" | "extractEnums" | "standalone" | "baseUrl" | "replaceOptionalWithNullish" | "infiniteQueries" | "axiosRequestConfig" | "mutationEffects">;
|
|
8
8
|
export declare function generate({ input, excludeTags, monorepo, prettier, verbose, ...params }: GenerateParams): Promise<void>;
|
|
@@ -24,12 +24,14 @@ export declare enum StandaloneAssetEnum {
|
|
|
24
24
|
export declare const STANDALONE_ASSETS: Record<StandaloneAssetEnum, GenerateFile>;
|
|
25
25
|
export declare const STANDALONE_APP_REST_CLIENT_FILE: GenerateFile;
|
|
26
26
|
export declare const QUERY_MODULE_ENUM = "QueryModule";
|
|
27
|
-
export declare const
|
|
28
|
-
|
|
27
|
+
export declare const QUERY_MODULES_FILE: GenerateFile;
|
|
28
|
+
export declare const QUERY_CONFIG_FILE: GenerateFile;
|
|
29
|
+
export declare const MUTATION_EFFECTS: {
|
|
29
30
|
optionsType: string;
|
|
30
|
-
|
|
31
|
+
hookName: string;
|
|
32
|
+
runFunctionName: string;
|
|
31
33
|
};
|
|
32
|
-
export declare const
|
|
34
|
+
export declare const MUTATION_EFFECTS_FILE: GenerateFile;
|
|
33
35
|
export declare const ZOD_EXTENDED: {
|
|
34
36
|
name: string;
|
|
35
37
|
properties: {
|
|
@@ -7,9 +7,11 @@ export declare function getImportedEndpointName(endpoint: Endpoint, options: Gen
|
|
|
7
7
|
export declare const getEndpointPath: (endpoint: Endpoint) => string;
|
|
8
8
|
export declare function getEndpointTag(endpoint: Endpoint, options: GenerateOptions): string;
|
|
9
9
|
export declare function mapEndpointParamsToFunctionParams(resolver: SchemaResolver, endpoint: Endpoint, options?: {
|
|
10
|
-
|
|
10
|
+
excludeBodyParam?: boolean;
|
|
11
|
+
excludePageParam?: boolean;
|
|
11
12
|
replacePageParam?: boolean;
|
|
12
13
|
includeFileParam?: boolean;
|
|
14
|
+
includeOnlyRequiredParams?: boolean;
|
|
13
15
|
}): {
|
|
14
16
|
name: string;
|
|
15
17
|
type: string;
|
|
@@ -31,3 +33,4 @@ export declare function getEndpointConfig(endpoint: Endpoint): {
|
|
|
31
33
|
bodyObject?: OpenAPIV3.RequestBodyObject | undefined;
|
|
32
34
|
}[] | undefined;
|
|
33
35
|
};
|
|
36
|
+
export declare function getUpdateQueryEndpoints(endpoint: Endpoint, endpoints: Endpoint[]): Endpoint[];
|
|
@@ -16,6 +16,7 @@ export declare const getNamespaceName: ({ type, tag, options, }: {
|
|
|
16
16
|
}) => string;
|
|
17
17
|
export declare function getAppRestClientImportPath(options: GenerateOptions): string;
|
|
18
18
|
export declare function getQueryTypesImportPath(options: GenerateOptions): string;
|
|
19
|
-
export declare function
|
|
19
|
+
export declare function getQueryModulesImportPath(options: GenerateOptions): string;
|
|
20
|
+
export declare function getMutationEffectsImportPath(options: GenerateOptions): string;
|
|
20
21
|
export declare function getZodExtendedImportPath(options: GenerateOptions): string;
|
|
21
22
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SchemaResolver } from "../core/SchemaResolver.class";
|
|
2
|
+
import { GenerateData, GenerateFileData } from "../types/generate";
|
|
3
|
+
export declare function getAclFiles(appAclTags: string[], resolver: SchemaResolver): GenerateFileData[];
|
|
4
|
+
export declare function getMutationEffectsFiles(data: GenerateData, resolver: SchemaResolver): GenerateFileData[];
|
|
5
|
+
export declare function getStandaloneFiles(resolver: SchemaResolver): GenerateFileData[];
|
|
6
|
+
export declare function getZodExtendedFiles(data: GenerateData, resolver: SchemaResolver): GenerateFileData[];
|