@hey-api/openapi-ts 0.75.0 → 0.77.0
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 +8 -0
- package/dist/chunk-EH476QS3.js +39 -0
- package/dist/chunk-EH476QS3.js.map +1 -0
- package/dist/clients/axios/client.ts +4 -0
- package/dist/clients/core/types.ts +6 -0
- package/dist/clients/fetch/client.ts +4 -0
- package/dist/clients/next/client.ts +4 -0
- package/dist/clients/nuxt/client.ts +19 -8
- package/dist/index.cjs +59 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +11 -11
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +1 -1
- package/dist/{types.d-CjrgVCUn.d.cts → types.d-CBVwu8Hi.d.cts} +5102 -4078
- package/dist/{types.d-CjrgVCUn.d.ts → types.d-CBVwu8Hi.d.ts} +5102 -4078
- package/package.json +1 -1
- package/dist/chunk-D24GAR6J.js +0 -39
- package/dist/chunk-D24GAR6J.js.map +0 -1
|
@@ -84,6 +84,12 @@ export interface Config {
|
|
|
84
84
|
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
85
85
|
*/
|
|
86
86
|
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
87
|
+
/**
|
|
88
|
+
* A function validating request data. This is useful if you want to ensure
|
|
89
|
+
* the request conforms to the desired shape, so it can be safely sent to
|
|
90
|
+
* the server.
|
|
91
|
+
*/
|
|
92
|
+
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
87
93
|
/**
|
|
88
94
|
* A function transforming response data before it's returned. This is useful
|
|
89
95
|
* for post-processing data, e.g. converting ISO strings into Date objects.
|
|
@@ -43,19 +43,30 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
43
43
|
onResponse: mergeInterceptors(_config.onResponse, options.onResponse),
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
const {
|
|
47
|
-
|
|
46
|
+
const {
|
|
47
|
+
requestValidator,
|
|
48
|
+
responseTransformer,
|
|
49
|
+
responseValidator,
|
|
50
|
+
security,
|
|
51
|
+
} = opts;
|
|
52
|
+
if (requestValidator || security) {
|
|
48
53
|
// auth must happen in interceptors otherwise we'd need to require
|
|
49
54
|
// asyncContext enabled
|
|
50
55
|
// https://nuxt.com/docs/guide/going-further/experimental-features#asynccontext
|
|
51
56
|
opts.onRequest = [
|
|
52
57
|
async ({ options }) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
if (security) {
|
|
59
|
+
await setAuthParams({
|
|
60
|
+
auth: opts.auth,
|
|
61
|
+
headers: options.headers,
|
|
62
|
+
query: options.query,
|
|
63
|
+
security,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (requestValidator) {
|
|
68
|
+
await requestValidator(options);
|
|
69
|
+
}
|
|
59
70
|
},
|
|
60
71
|
...opts.onRequest,
|
|
61
72
|
];
|