@povio/openapi-codegen-cli 2.0.8-rc.4 → 2.0.8-rc.41
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/generator.js +41 -41
- package/dist/generators/utils/generate/generate.endpoints.utils.d.ts +2 -0
- package/dist/lib/rest/error-handling.d.ts +3 -3
- package/dist/sh.js +155 -155
- package/package.json +9 -10
- package/src/assets/useMutationEffects.ts +30 -25
- package/src/generators/templates/partials/query-use-infinite-query.hbs +3 -2
- package/src/generators/templates/partials/query-use-query.hbs +4 -3
|
@@ -23,6 +23,8 @@ export declare function mapEndpointParamsToFunctionParams(resolver: SchemaResolv
|
|
|
23
23
|
parameterObject: import('../../types/openapi').ParameterObject | undefined;
|
|
24
24
|
bodyObject: OpenAPIV3.RequestBodyObject | undefined;
|
|
25
25
|
}[];
|
|
26
|
+
/** True when the endpoint has at least one mapped param and every mapped param is optional (safe `= {}` default on the params object). */
|
|
27
|
+
export declare function endpointParamsAllOptional(resolver: SchemaResolver, endpoint: Endpoint, mapOptions?: Parameters<typeof mapEndpointParamsToFunctionParams>[2]): boolean;
|
|
26
28
|
export declare function getEndpointConfig(endpoint: Endpoint): {
|
|
27
29
|
headers?: Record<string, string> | undefined;
|
|
28
30
|
params?: {
|
|
@@ -8,11 +8,11 @@ export declare class ApplicationException<CodeT> extends Error {
|
|
|
8
8
|
export interface ErrorEntry<CodeT> {
|
|
9
9
|
code: CodeT;
|
|
10
10
|
condition?: (error: unknown) => boolean;
|
|
11
|
-
getMessage: (t: TFunction, error: unknown) => string;
|
|
11
|
+
getMessage: (t: TFunction<string, undefined>, error: unknown) => string;
|
|
12
12
|
}
|
|
13
13
|
export interface ErrorHandlerOptions<CodeT extends string> {
|
|
14
14
|
entries: ErrorEntry<CodeT>[];
|
|
15
|
-
t?: TFunction
|
|
15
|
+
t?: TFunction<string, undefined>;
|
|
16
16
|
onRethrowError?: (error: unknown, exception: ApplicationException<CodeT | GeneralErrorCodes>) => void;
|
|
17
17
|
}
|
|
18
18
|
export declare class ErrorHandler<CodeT extends string> {
|
|
@@ -21,7 +21,7 @@ export declare class ErrorHandler<CodeT extends string> {
|
|
|
21
21
|
private onRethrowError?;
|
|
22
22
|
constructor({ entries, t, onRethrowError }: ErrorHandlerOptions<CodeT>);
|
|
23
23
|
private matchesEntry;
|
|
24
|
-
setTranslateFunction(t: TFunction): void;
|
|
24
|
+
setTranslateFunction(t: TFunction<string, undefined>): void;
|
|
25
25
|
rethrowError(error: unknown): ApplicationException<CodeT | GeneralErrorCodes>;
|
|
26
26
|
getError(error: unknown): ApplicationException<CodeT | GeneralErrorCodes> | null;
|
|
27
27
|
getErrorCode(error: unknown): CodeT | GeneralErrorCodes | null;
|