generator-kodly-react-app 1.0.15 → 1.0.16
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/generators/app/index.js +4 -0
- package/generators/app/templates/I18N_MIGRATION.md +13 -13
- package/generators/app/templates/STRUCTURE.md +26 -26
- package/generators/app/templates/index.html +6 -14
- package/generators/app/templates/openapi-ts.config.ts +12 -12
- package/generators/app/templates/postcss.config.js +0 -1
- package/generators/app/templates/src/app.tsx +20 -20
- package/generators/app/templates/src/components/layout/language-switcher.tsx +20 -16
- package/generators/app/templates/src/components/layout/page-layout.tsx +31 -0
- package/generators/app/templates/src/components/layout/theme-switcher.tsx +15 -14
- package/generators/app/templates/src/components/theme/theme-provider.tsx +20 -13
- package/generators/app/templates/src/components/ui/button.tsx +15 -14
- package/generators/app/templates/src/components/ui/card.tsx +23 -16
- package/generators/app/templates/src/components/ui/field.tsx +35 -35
- package/generators/app/templates/src/components/ui/form.tsx +66 -30
- package/generators/app/templates/src/components/ui/input-group.tsx +24 -24
- package/generators/app/templates/src/components/ui/input.tsx +8 -8
- package/generators/app/templates/src/components/ui/label.tsx +9 -9
- package/generators/app/templates/src/components/ui/select.tsx +0 -1
- package/generators/app/templates/src/components/ui/separator.tsx +10 -10
- package/generators/app/templates/src/components/ui/textarea.tsx +7 -7
- package/generators/app/templates/src/index.css +12 -2
- package/generators/app/templates/src/lib/i18n.ts +16 -14
- package/generators/app/templates/src/lib/routes.ts +2 -3
- package/generators/app/templates/src/lib/utils/error-handler.ts +21 -14
- package/generators/app/templates/src/lib/utils.ts +3 -3
- package/generators/app/templates/src/locales/index.ts +12 -12
- package/generators/app/templates/src/locales/ja/theme.json +0 -1
- package/generators/app/templates/src/main.tsx +10 -12
- package/generators/app/templates/src/modules/app/layouts/app-layout.tsx +14 -25
- package/generators/app/templates/src/modules/app/locales/app-en.json +0 -1
- package/generators/app/templates/src/modules/app/locales/app-ja.json +0 -1
- package/generators/app/templates/src/modules/auth/components/auth-form.tsx +83 -0
- package/generators/app/templates/src/modules/auth/components/forgot-password-form.tsx +27 -52
- package/generators/app/templates/src/modules/auth/components/login-form.tsx +42 -72
- package/generators/app/templates/src/modules/auth/components/login-link.tsx +12 -0
- package/generators/app/templates/src/modules/auth/components/reset-password-form.tsx +46 -92
- package/generators/app/templates/src/modules/auth/components/signup-form.tsx +35 -71
- package/generators/app/templates/src/modules/auth/contexts/auth-context.tsx +10 -6
- package/generators/app/templates/src/modules/auth/hooks/use-auth-hook.ts +51 -36
- package/generators/app/templates/src/modules/auth/layouts/auth-layout.tsx +12 -15
- package/generators/app/templates/src/modules/auth/locales/auth-en.json +0 -1
- package/generators/app/templates/src/modules/auth/locales/auth-ja.json +0 -1
- package/generators/app/templates/src/modules/auth/schemas/form-schemas.ts +14 -10
- package/generators/app/templates/src/modules/landing/components/auth-hero.tsx +20 -18
- package/generators/app/templates/src/modules/landing/components/welcome-hero.tsx +13 -11
- package/generators/app/templates/src/modules/landing/landing-page-layout.tsx +1 -24
- package/generators/app/templates/src/modules/landing/landing-page.tsx +11 -6
- package/generators/app/templates/src/modules/landing/layouts/landing-page-layout.tsx +2 -21
- package/generators/app/templates/src/modules/landing/locales/landing-en.json +0 -1
- package/generators/app/templates/src/openapi-client-config.ts +1 -1
- package/generators/app/templates/src/routeTree.gen.ts +188 -188
- package/generators/app/templates/src/router.tsx +2 -2
- package/generators/app/templates/src/routes/$.tsx +0 -1
- package/generators/app/templates/src/routes/__root.tsx +2 -2
- package/generators/app/templates/src/routes/_landing/index.tsx +3 -3
- package/generators/app/templates/src/routes/_landing/route.tsx +3 -3
- package/generators/app/templates/src/routes/app/index.tsx +6 -6
- package/generators/app/templates/src/routes/app/route.tsx +4 -4
- package/generators/app/templates/src/routes/auth/forgot-password.tsx +1 -1
- package/generators/app/templates/src/routes/auth/login.tsx +3 -3
- package/generators/app/templates/src/routes/auth/reset-password.tsx +3 -3
- package/generators/app/templates/src/routes/auth/route.tsx +12 -7
- package/generators/app/templates/src/routes/auth/signup.tsx +1 -2
- package/generators/app/templates/src/sdk/@tanstack/react-query.gen.ts +157 -76
- package/generators/app/templates/src/sdk/client/client.gen.ts +35 -37
- package/generators/app/templates/src/sdk/client/index.ts +8 -8
- package/generators/app/templates/src/sdk/client/types.gen.ts +22 -19
- package/generators/app/templates/src/sdk/client/utils.gen.ts +53 -45
- package/generators/app/templates/src/sdk/client.gen.ts +18 -5
- package/generators/app/templates/src/sdk/core/auth.gen.ts +6 -6
- package/generators/app/templates/src/sdk/core/bodySerializer.gen.ts +25 -27
- package/generators/app/templates/src/sdk/core/params.gen.ts +12 -12
- package/generators/app/templates/src/sdk/core/pathSerializer.gen.ts +40 -41
- package/generators/app/templates/src/sdk/core/queryKeySerializer.gen.ts +12 -29
- package/generators/app/templates/src/sdk/core/serverSentEvents.gen.ts +26 -24
- package/generators/app/templates/src/sdk/core/types.gen.ts +17 -15
- package/generators/app/templates/src/sdk/core/utils.gen.ts +18 -18
- package/generators/app/templates/src/sdk/index.ts +40 -2
- package/generators/app/templates/src/sdk/schemas.gen.ts +108 -166
- package/generators/app/templates/src/sdk/sdk.gen.ts +145 -63
- package/generators/app/templates/src/sdk/types.gen.ts +90 -84
- package/generators/app/templates/src/sdk/zod.gen.ts +57 -74
- package/generators/app/templates/src/types/i18n.d.ts +0 -1
- package/generators/app/templates/tailwind.config.js +0 -1
- package/generators/app/templates/tsconfig.app.json +0 -1
- package/generators/app/templates/tsconfig.json +0 -1
- package/generators/app/templates/tsr.config.json +4 -0
- package/generators/app/templates/vite.config.js +12 -12
- package/package.json +2 -4
|
@@ -1,91 +1,172 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
|
-
import type { DefaultError, UseMutationOptions } from
|
|
4
|
-
import type { AxiosError } from
|
|
3
|
+
import type { DefaultError, UseMutationOptions } from "@tanstack/react-query";
|
|
4
|
+
import type { AxiosError } from "axios";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
loginUserAuth,
|
|
8
|
+
logoutUserAuth,
|
|
9
|
+
type Options,
|
|
10
|
+
registerUserAuth,
|
|
11
|
+
resetPasswordUserAuth,
|
|
12
|
+
sendOtpUserAuth,
|
|
13
|
+
validateTokenUserAuth,
|
|
14
|
+
} from "../sdk.gen";
|
|
15
|
+
import type {
|
|
16
|
+
LoginUserAuthData,
|
|
17
|
+
LoginUserAuthResponse,
|
|
18
|
+
LogoutUserAuthData,
|
|
19
|
+
LogoutUserAuthResponse,
|
|
20
|
+
RegisterUserAuthData,
|
|
21
|
+
RegisterUserAuthResponse,
|
|
22
|
+
ResetPasswordUserAuthData,
|
|
23
|
+
ResetPasswordUserAuthResponse,
|
|
24
|
+
SendOtpUserAuthData,
|
|
25
|
+
SendOtpUserAuthResponse,
|
|
26
|
+
ValidateTokenUserAuthData,
|
|
27
|
+
ValidateTokenUserAuthResponse,
|
|
28
|
+
} from "../types.gen";
|
|
8
29
|
|
|
9
|
-
export const validateTokenUserAuthMutation = (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
export const validateTokenUserAuthMutation = (
|
|
31
|
+
options?: Partial<Options<ValidateTokenUserAuthData>>,
|
|
32
|
+
): UseMutationOptions<
|
|
33
|
+
ValidateTokenUserAuthResponse,
|
|
34
|
+
AxiosError<DefaultError>,
|
|
35
|
+
Options<ValidateTokenUserAuthData>
|
|
36
|
+
> => {
|
|
37
|
+
const mutationOptions: UseMutationOptions<
|
|
38
|
+
ValidateTokenUserAuthResponse,
|
|
39
|
+
AxiosError<DefaultError>,
|
|
40
|
+
Options<ValidateTokenUserAuthData>
|
|
41
|
+
> = {
|
|
42
|
+
mutationFn: async (fnOptions) => {
|
|
43
|
+
const { data } = await validateTokenUserAuth({
|
|
44
|
+
...options,
|
|
45
|
+
...fnOptions,
|
|
46
|
+
throwOnError: true,
|
|
47
|
+
});
|
|
48
|
+
return data;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
return mutationOptions;
|
|
21
52
|
};
|
|
22
53
|
|
|
23
|
-
export const sendOtpUserAuthMutation = (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
54
|
+
export const sendOtpUserAuthMutation = (
|
|
55
|
+
options?: Partial<Options<SendOtpUserAuthData>>,
|
|
56
|
+
): UseMutationOptions<
|
|
57
|
+
SendOtpUserAuthResponse,
|
|
58
|
+
AxiosError<DefaultError>,
|
|
59
|
+
Options<SendOtpUserAuthData>
|
|
60
|
+
> => {
|
|
61
|
+
const mutationOptions: UseMutationOptions<
|
|
62
|
+
SendOtpUserAuthResponse,
|
|
63
|
+
AxiosError<DefaultError>,
|
|
64
|
+
Options<SendOtpUserAuthData>
|
|
65
|
+
> = {
|
|
66
|
+
mutationFn: async (fnOptions) => {
|
|
67
|
+
const { data } = await sendOtpUserAuth({
|
|
68
|
+
...options,
|
|
69
|
+
...fnOptions,
|
|
70
|
+
throwOnError: true,
|
|
71
|
+
});
|
|
72
|
+
return data;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
return mutationOptions;
|
|
35
76
|
};
|
|
36
77
|
|
|
37
|
-
export const resetPasswordUserAuthMutation = (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
78
|
+
export const resetPasswordUserAuthMutation = (
|
|
79
|
+
options?: Partial<Options<ResetPasswordUserAuthData>>,
|
|
80
|
+
): UseMutationOptions<
|
|
81
|
+
ResetPasswordUserAuthResponse,
|
|
82
|
+
AxiosError<DefaultError>,
|
|
83
|
+
Options<ResetPasswordUserAuthData>
|
|
84
|
+
> => {
|
|
85
|
+
const mutationOptions: UseMutationOptions<
|
|
86
|
+
ResetPasswordUserAuthResponse,
|
|
87
|
+
AxiosError<DefaultError>,
|
|
88
|
+
Options<ResetPasswordUserAuthData>
|
|
89
|
+
> = {
|
|
90
|
+
mutationFn: async (fnOptions) => {
|
|
91
|
+
const { data } = await resetPasswordUserAuth({
|
|
92
|
+
...options,
|
|
93
|
+
...fnOptions,
|
|
94
|
+
throwOnError: true,
|
|
95
|
+
});
|
|
96
|
+
return data;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
return mutationOptions;
|
|
49
100
|
};
|
|
50
101
|
|
|
51
|
-
export const registerUserAuthMutation = (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
102
|
+
export const registerUserAuthMutation = (
|
|
103
|
+
options?: Partial<Options<RegisterUserAuthData>>,
|
|
104
|
+
): UseMutationOptions<
|
|
105
|
+
RegisterUserAuthResponse,
|
|
106
|
+
AxiosError<DefaultError>,
|
|
107
|
+
Options<RegisterUserAuthData>
|
|
108
|
+
> => {
|
|
109
|
+
const mutationOptions: UseMutationOptions<
|
|
110
|
+
RegisterUserAuthResponse,
|
|
111
|
+
AxiosError<DefaultError>,
|
|
112
|
+
Options<RegisterUserAuthData>
|
|
113
|
+
> = {
|
|
114
|
+
mutationFn: async (fnOptions) => {
|
|
115
|
+
const { data } = await registerUserAuth({
|
|
116
|
+
...options,
|
|
117
|
+
...fnOptions,
|
|
118
|
+
throwOnError: true,
|
|
119
|
+
});
|
|
120
|
+
return data;
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
return mutationOptions;
|
|
63
124
|
};
|
|
64
125
|
|
|
65
|
-
export const logoutUserAuthMutation = (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
126
|
+
export const logoutUserAuthMutation = (
|
|
127
|
+
options?: Partial<Options<LogoutUserAuthData>>,
|
|
128
|
+
): UseMutationOptions<
|
|
129
|
+
LogoutUserAuthResponse,
|
|
130
|
+
AxiosError<DefaultError>,
|
|
131
|
+
Options<LogoutUserAuthData>
|
|
132
|
+
> => {
|
|
133
|
+
const mutationOptions: UseMutationOptions<
|
|
134
|
+
LogoutUserAuthResponse,
|
|
135
|
+
AxiosError<DefaultError>,
|
|
136
|
+
Options<LogoutUserAuthData>
|
|
137
|
+
> = {
|
|
138
|
+
mutationFn: async (fnOptions) => {
|
|
139
|
+
const { data } = await logoutUserAuth({
|
|
140
|
+
...options,
|
|
141
|
+
...fnOptions,
|
|
142
|
+
throwOnError: true,
|
|
143
|
+
});
|
|
144
|
+
return data;
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
return mutationOptions;
|
|
77
148
|
};
|
|
78
149
|
|
|
79
|
-
export const loginUserAuthMutation = (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
150
|
+
export const loginUserAuthMutation = (
|
|
151
|
+
options?: Partial<Options<LoginUserAuthData>>,
|
|
152
|
+
): UseMutationOptions<
|
|
153
|
+
LoginUserAuthResponse,
|
|
154
|
+
AxiosError<DefaultError>,
|
|
155
|
+
Options<LoginUserAuthData>
|
|
156
|
+
> => {
|
|
157
|
+
const mutationOptions: UseMutationOptions<
|
|
158
|
+
LoginUserAuthResponse,
|
|
159
|
+
AxiosError<DefaultError>,
|
|
160
|
+
Options<LoginUserAuthData>
|
|
161
|
+
> = {
|
|
162
|
+
mutationFn: async (fnOptions) => {
|
|
163
|
+
const { data } = await loginUserAuth({
|
|
164
|
+
...options,
|
|
165
|
+
...fnOptions,
|
|
166
|
+
throwOnError: true,
|
|
167
|
+
});
|
|
168
|
+
return data;
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
return mutationOptions;
|
|
91
172
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
|
-
import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from
|
|
4
|
-
import axios from
|
|
3
|
+
import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from "axios";
|
|
4
|
+
import axios from "axios";
|
|
5
5
|
|
|
6
|
-
import { createSseClient } from
|
|
7
|
-
import type { HttpMethod } from
|
|
8
|
-
import { getValidRequestBody } from
|
|
9
|
-
import type { Client, Config, RequestOptions } from
|
|
6
|
+
import { createSseClient } from "../core/serverSentEvents.gen";
|
|
7
|
+
import type { HttpMethod } from "../core/types.gen";
|
|
8
|
+
import { getValidRequestBody } from "../core/utils.gen";
|
|
9
|
+
import type { Client, Config, RequestOptions } from "./types.gen";
|
|
10
10
|
import {
|
|
11
11
|
buildUrl,
|
|
12
12
|
createConfig,
|
|
13
13
|
mergeConfigs,
|
|
14
14
|
mergeHeaders,
|
|
15
15
|
setAuthParams,
|
|
16
|
-
} from
|
|
16
|
+
} from "./utils.gen";
|
|
17
17
|
|
|
18
18
|
export const createClient = (config: Config = {}): Client => {
|
|
19
19
|
let _config = mergeConfigs(createConfig(), config);
|
|
20
20
|
|
|
21
21
|
let instance: AxiosInstance;
|
|
22
22
|
|
|
23
|
-
if (_config.axios && !(
|
|
23
|
+
if (_config.axios && !("Axios" in _config.axios)) {
|
|
24
24
|
instance = _config.axios;
|
|
25
25
|
} else {
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -35,7 +35,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
35
35
|
instance.defaults = {
|
|
36
36
|
...instance.defaults,
|
|
37
37
|
..._config,
|
|
38
|
-
// @ts-expect-error
|
|
38
|
+
// @ts-expect-error Axios defaults require method-specific headers; merged values retain those entries.
|
|
39
39
|
headers: mergeHeaders(instance.defaults.headers, _config.headers),
|
|
40
40
|
};
|
|
41
41
|
return getConfig();
|
|
@@ -69,9 +69,9 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
69
69
|
return { opts, url };
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
// @ts-expect-error
|
|
73
|
-
const request: Client[
|
|
74
|
-
// @ts-expect-error
|
|
72
|
+
// @ts-expect-error The generic client return type depends on the selected throwOnError option.
|
|
73
|
+
const request: Client["request"] = async (options) => {
|
|
74
|
+
// @ts-expect-error The method generic is narrower than the shared request options at runtime.
|
|
75
75
|
const { opts, url } = await beforeRequest(options);
|
|
76
76
|
try {
|
|
77
77
|
// assign Axios here for consistency with fetch
|
|
@@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
80
80
|
const { auth, ...optsWithoutAuth } = opts;
|
|
81
81
|
const response = await _axios({
|
|
82
82
|
...optsWithoutAuth,
|
|
83
|
-
baseURL:
|
|
83
|
+
baseURL: "", // the baseURL is already included in `url`
|
|
84
84
|
data: getValidRequestBody(opts),
|
|
85
85
|
headers: opts.headers as RawAxiosRequestHeaders,
|
|
86
86
|
// let `paramsSerializer()` handle query params if it exists
|
|
@@ -90,7 +90,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
90
90
|
|
|
91
91
|
let { data } = response;
|
|
92
92
|
|
|
93
|
-
if (opts.responseType ===
|
|
93
|
+
if (opts.responseType === "json") {
|
|
94
94
|
if (opts.responseValidator) {
|
|
95
95
|
await opts.responseValidator(data);
|
|
96
96
|
}
|
|
@@ -109,7 +109,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
109
109
|
if (opts.throwOnError) {
|
|
110
110
|
throw e;
|
|
111
111
|
}
|
|
112
|
-
// @ts-expect-error
|
|
112
|
+
// @ts-expect-error The client adds the documented error payload to the Axios error.
|
|
113
113
|
e.error = e.response?.data ?? {};
|
|
114
114
|
return e;
|
|
115
115
|
}
|
|
@@ -128,10 +128,8 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
128
128
|
headers: opts.headers as Record<string, string>,
|
|
129
129
|
method,
|
|
130
130
|
serializedBody: getValidRequestBody(opts) as
|
|
131
|
-
|
|
|
132
|
-
|
|
133
|
-
| undefined,
|
|
134
|
-
// @ts-expect-error
|
|
131
|
+
BodyInit | null | undefined,
|
|
132
|
+
// @ts-expect-error Axios also accepts its legacy signal type; SSE requires a browser AbortSignal.
|
|
135
133
|
signal: opts.signal,
|
|
136
134
|
url,
|
|
137
135
|
});
|
|
@@ -139,29 +137,29 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
139
137
|
|
|
140
138
|
return {
|
|
141
139
|
buildUrl,
|
|
142
|
-
connect: makeMethodFn(
|
|
143
|
-
delete: makeMethodFn(
|
|
144
|
-
get: makeMethodFn(
|
|
140
|
+
connect: makeMethodFn("CONNECT"),
|
|
141
|
+
delete: makeMethodFn("DELETE"),
|
|
142
|
+
get: makeMethodFn("GET"),
|
|
145
143
|
getConfig,
|
|
146
|
-
head: makeMethodFn(
|
|
144
|
+
head: makeMethodFn("HEAD"),
|
|
147
145
|
instance,
|
|
148
|
-
options: makeMethodFn(
|
|
149
|
-
patch: makeMethodFn(
|
|
150
|
-
post: makeMethodFn(
|
|
151
|
-
put: makeMethodFn(
|
|
146
|
+
options: makeMethodFn("OPTIONS"),
|
|
147
|
+
patch: makeMethodFn("PATCH"),
|
|
148
|
+
post: makeMethodFn("POST"),
|
|
149
|
+
put: makeMethodFn("PUT"),
|
|
152
150
|
request,
|
|
153
151
|
setConfig,
|
|
154
152
|
sse: {
|
|
155
|
-
connect: makeSseFn(
|
|
156
|
-
delete: makeSseFn(
|
|
157
|
-
get: makeSseFn(
|
|
158
|
-
head: makeSseFn(
|
|
159
|
-
options: makeSseFn(
|
|
160
|
-
patch: makeSseFn(
|
|
161
|
-
post: makeSseFn(
|
|
162
|
-
put: makeSseFn(
|
|
163
|
-
trace: makeSseFn(
|
|
153
|
+
connect: makeSseFn("CONNECT"),
|
|
154
|
+
delete: makeSseFn("DELETE"),
|
|
155
|
+
get: makeSseFn("GET"),
|
|
156
|
+
head: makeSseFn("HEAD"),
|
|
157
|
+
options: makeSseFn("OPTIONS"),
|
|
158
|
+
patch: makeSseFn("PATCH"),
|
|
159
|
+
post: makeSseFn("POST"),
|
|
160
|
+
put: makeSseFn("PUT"),
|
|
161
|
+
trace: makeSseFn("TRACE"),
|
|
164
162
|
},
|
|
165
|
-
trace: makeMethodFn(
|
|
163
|
+
trace: makeMethodFn("TRACE"),
|
|
166
164
|
} as Client;
|
|
167
165
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
2
|
|
|
3
|
-
export type { Auth } from
|
|
4
|
-
export type { QuerySerializerOptions } from
|
|
3
|
+
export type { Auth } from "../core/auth.gen";
|
|
4
|
+
export type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
|
5
5
|
export {
|
|
6
6
|
formDataBodySerializer,
|
|
7
7
|
jsonBodySerializer,
|
|
8
8
|
urlSearchParamsBodySerializer,
|
|
9
|
-
} from
|
|
10
|
-
export { buildClientParams } from
|
|
11
|
-
export { serializeQueryKeyValue } from
|
|
12
|
-
export { createClient } from
|
|
9
|
+
} from "../core/bodySerializer.gen";
|
|
10
|
+
export { buildClientParams } from "../core/params.gen";
|
|
11
|
+
export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen";
|
|
12
|
+
export { createClient } from "./client.gen";
|
|
13
13
|
export type {
|
|
14
14
|
Client,
|
|
15
15
|
ClientOptions,
|
|
@@ -19,5 +19,5 @@ export type {
|
|
|
19
19
|
RequestOptions,
|
|
20
20
|
RequestResult,
|
|
21
21
|
TDataShape,
|
|
22
|
-
} from
|
|
23
|
-
export { createConfig } from
|
|
22
|
+
} from "./types.gen";
|
|
23
|
+
export { createConfig } from "./utils.gen";
|
|
@@ -7,20 +7,21 @@ import type {
|
|
|
7
7
|
AxiosResponse,
|
|
8
8
|
AxiosStatic,
|
|
9
9
|
CreateAxiosDefaults,
|
|
10
|
-
} from
|
|
10
|
+
} from "axios";
|
|
11
11
|
|
|
12
|
-
import type { Auth } from
|
|
12
|
+
import type { Auth } from "../core/auth.gen";
|
|
13
13
|
import type {
|
|
14
14
|
ServerSentEventsOptions,
|
|
15
15
|
ServerSentEventsResult,
|
|
16
|
-
} from
|
|
16
|
+
} from "../core/serverSentEvents.gen";
|
|
17
17
|
import type {
|
|
18
18
|
Client as CoreClient,
|
|
19
19
|
Config as CoreConfig,
|
|
20
|
-
} from
|
|
20
|
+
} from "../core/types.gen";
|
|
21
21
|
|
|
22
22
|
export interface Config<T extends ClientOptions = ClientOptions>
|
|
23
|
-
extends
|
|
23
|
+
extends
|
|
24
|
+
Omit<CreateAxiosDefaults, "auth" | "baseURL" | "headers" | "method">,
|
|
24
25
|
CoreConfig {
|
|
25
26
|
/**
|
|
26
27
|
* Axios implementation. You can use this option to provide either an
|
|
@@ -32,7 +33,7 @@ export interface Config<T extends ClientOptions = ClientOptions>
|
|
|
32
33
|
/**
|
|
33
34
|
* Base URL for all requests made by this client.
|
|
34
35
|
*/
|
|
35
|
-
baseURL?: T[
|
|
36
|
+
baseURL?: T["baseURL"];
|
|
36
37
|
/**
|
|
37
38
|
* An object containing any HTTP headers that you want to pre-populate your
|
|
38
39
|
* `Headers` object with.
|
|
@@ -56,23 +57,25 @@ export interface Config<T extends ClientOptions = ClientOptions>
|
|
|
56
57
|
*
|
|
57
58
|
* @default false
|
|
58
59
|
*/
|
|
59
|
-
throwOnError?: T[
|
|
60
|
+
throwOnError?: T["throwOnError"];
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
export interface RequestOptions<
|
|
63
64
|
TData = unknown,
|
|
64
65
|
ThrowOnError extends boolean = boolean,
|
|
65
66
|
Url extends string = string,
|
|
66
|
-
>
|
|
67
|
+
>
|
|
68
|
+
extends
|
|
69
|
+
Config<{
|
|
67
70
|
throwOnError: ThrowOnError;
|
|
68
71
|
}>,
|
|
69
72
|
Pick<
|
|
70
73
|
ServerSentEventsOptions<TData>,
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
74
|
+
| "onSseError"
|
|
75
|
+
| "onSseEvent"
|
|
76
|
+
| "sseDefaultRetryDelay"
|
|
77
|
+
| "sseMaxRetryAttempts"
|
|
78
|
+
| "sseMaxRetryDelay"
|
|
76
79
|
> {
|
|
77
80
|
/**
|
|
78
81
|
* Any body that you want to add to your request.
|
|
@@ -123,7 +126,7 @@ type MethodFn = <
|
|
|
123
126
|
TError = unknown,
|
|
124
127
|
ThrowOnError extends boolean = false,
|
|
125
128
|
>(
|
|
126
|
-
options: Omit<RequestOptions<TData, ThrowOnError>,
|
|
129
|
+
options: Omit<RequestOptions<TData, ThrowOnError>, "method">,
|
|
127
130
|
) => RequestResult<TData, TError, ThrowOnError>;
|
|
128
131
|
|
|
129
132
|
type SseFn = <
|
|
@@ -131,7 +134,7 @@ type SseFn = <
|
|
|
131
134
|
TError = unknown,
|
|
132
135
|
ThrowOnError extends boolean = false,
|
|
133
136
|
>(
|
|
134
|
-
options: Omit<RequestOptions<TData, ThrowOnError>,
|
|
137
|
+
options: Omit<RequestOptions<TData, ThrowOnError>, "method">,
|
|
135
138
|
) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
136
139
|
|
|
137
140
|
type RequestFn = <
|
|
@@ -139,8 +142,8 @@ type RequestFn = <
|
|
|
139
142
|
TError = unknown,
|
|
140
143
|
ThrowOnError extends boolean = false,
|
|
141
144
|
>(
|
|
142
|
-
options: Omit<RequestOptions<TData, ThrowOnError>,
|
|
143
|
-
Pick<Required<RequestOptions<TData, ThrowOnError>>,
|
|
145
|
+
options: Omit<RequestOptions<TData, ThrowOnError>, "method"> &
|
|
146
|
+
Pick<Required<RequestOptions<TData, ThrowOnError>>, "method">,
|
|
144
147
|
) => RequestResult<TData, TError, ThrowOnError>;
|
|
145
148
|
|
|
146
149
|
type BuildUrlFn = <
|
|
@@ -192,6 +195,6 @@ export type Options<
|
|
|
192
195
|
TResponse = unknown,
|
|
193
196
|
> = OmitKeys<
|
|
194
197
|
RequestOptions<TResponse, ThrowOnError>,
|
|
195
|
-
|
|
198
|
+
"body" | "path" | "query" | "url"
|
|
196
199
|
> &
|
|
197
|
-
([TData] extends [never] ? unknown : Omit<TData,
|
|
200
|
+
([TData] extends [never] ? unknown : Omit<TData, "url">);
|