fets 0.4.14 → 0.4.15
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/cjs/Response.js +80 -0
- package/cjs/client/auth/oauth.js +34 -0
- package/cjs/client/createClient.js +133 -0
- package/cjs/client/index.js +6 -0
- package/cjs/client/plugins/useClientCookieStore.js +31 -0
- package/cjs/client/types.js +0 -0
- package/cjs/createRouter.js +299 -0
- package/cjs/index.js +16 -0
- package/cjs/plugins/ajv.js +213 -0
- package/cjs/plugins/openapi.js +171 -0
- package/cjs/plugins/utils.js +31 -0
- package/cjs/swagger-ui-html.js +3 -0
- package/cjs/typed-fetch.js +0 -0
- package/cjs/types.js +0 -0
- package/cjs/utils.js +73 -0
- package/cjs/zod/types.js +7 -0
- package/cjs/zod/zod.js +92 -0
- package/esm/Response.js +74 -0
- package/esm/client/auth/oauth.js +31 -0
- package/esm/client/createClient.js +128 -0
- package/esm/client/index.js +3 -0
- package/esm/client/plugins/useClientCookieStore.js +27 -0
- package/esm/client/types.js +0 -0
- package/esm/createRouter.js +293 -0
- package/esm/index.js +7 -0
- package/esm/plugins/ajv.js +208 -0
- package/esm/plugins/openapi.js +166 -0
- package/esm/plugins/utils.js +27 -0
- package/esm/swagger-ui-html.js +1 -0
- package/esm/typed-fetch.js +0 -0
- package/esm/types.js +0 -0
- package/esm/utils.js +69 -0
- package/esm/zod/types.js +3 -0
- package/esm/zod/zod.js +88 -0
- package/package.json +1 -1
- package/typings/Response.d.cts +28 -0
- package/typings/Response.d.ts +28 -0
- package/typings/client/auth/oauth.d.cts +150 -0
- package/typings/client/auth/oauth.d.ts +150 -0
- package/typings/client/createClient.d.cts +34 -0
- package/typings/client/createClient.d.ts +34 -0
- package/typings/client/index.d.cts +3 -0
- package/typings/client/index.d.ts +3 -0
- package/typings/client/plugins/useClientCookieStore.d.cts +3 -0
- package/typings/client/plugins/useClientCookieStore.d.ts +3 -0
- package/typings/client/types.d.cts +426 -0
- package/typings/client/types.d.ts +426 -0
- package/typings/createRouter.d.cts +6 -0
- package/typings/createRouter.d.ts +6 -0
- package/typings/index.d.cts +7 -0
- package/typings/index.d.ts +7 -0
- package/typings/plugins/ajv.d.cts +4 -0
- package/typings/plugins/ajv.d.ts +4 -0
- package/typings/plugins/openapi.d.cts +33 -0
- package/typings/plugins/openapi.d.ts +33 -0
- package/typings/plugins/utils.d.cts +1 -0
- package/typings/plugins/utils.d.ts +1 -0
- package/typings/swagger-ui-html.d.cts +2 -0
- package/typings/swagger-ui-html.d.ts +2 -0
- package/typings/typed-fetch.d.cts +232 -0
- package/typings/typed-fetch.d.ts +232 -0
- package/typings/types.d.cts +261 -0
- package/typings/types.d.ts +261 -0
- package/typings/utils.d.cts +31 -0
- package/typings/utils.d.ts +31 -0
- package/typings/zod/types.d.cts +39 -0
- package/typings/zod/types.d.ts +39 -0
- package/typings/zod/zod.d.cts +2 -0
- package/typings/zod/zod.d.ts +2 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { TypedResponseWithJSONStatusMap } from '../../typed-fetch.cjs';
|
|
2
|
+
export type OAuth2AuthParams<TSecurityScheme> = TSecurityScheme extends {
|
|
3
|
+
type: 'oauth2';
|
|
4
|
+
} ? {
|
|
5
|
+
/**
|
|
6
|
+
* `Authorization` header is required for OAuth2.
|
|
7
|
+
*/
|
|
8
|
+
headers: {
|
|
9
|
+
/**
|
|
10
|
+
* The access token string as issued by the authorization server.
|
|
11
|
+
* @example `Authorization: Bearer <access_token>`
|
|
12
|
+
*/
|
|
13
|
+
Authorization: `Bearer ${string}`;
|
|
14
|
+
};
|
|
15
|
+
} : {};
|
|
16
|
+
export type OASOAuthPathRequestParamsWithHeader = {
|
|
17
|
+
formUrlEncoded: {
|
|
18
|
+
/**
|
|
19
|
+
* The Client Credentials grant is used when applications request an access token to access their own resources, not on behalf of a user.
|
|
20
|
+
*
|
|
21
|
+
* The `grant_type` parameter must be set to `client_credentials`.
|
|
22
|
+
*
|
|
23
|
+
* @see https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/
|
|
24
|
+
*/
|
|
25
|
+
grant_type: 'client_credentials';
|
|
26
|
+
/**
|
|
27
|
+
* Your service can support different scopes for the client credentials grant. In practice, not many services actually support this.
|
|
28
|
+
*/
|
|
29
|
+
scope?: string | string[];
|
|
30
|
+
};
|
|
31
|
+
headers: {
|
|
32
|
+
/**
|
|
33
|
+
* The client ID and secret can be sent in the HTTP Basic auth header.
|
|
34
|
+
* @example `Authorization: Basic <base64 encoded client_id:client_secret>`
|
|
35
|
+
*/
|
|
36
|
+
Authorization: `Basic ${string}`;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type OASOAuthPathRequestParamsWithoutHeader = {
|
|
40
|
+
grant_type: 'client_credentials';
|
|
41
|
+
client_id: string;
|
|
42
|
+
client_secret: string;
|
|
43
|
+
};
|
|
44
|
+
export type OASOAuthPath<TOAS> = TOAS extends {
|
|
45
|
+
components: {
|
|
46
|
+
securitySchemes: {
|
|
47
|
+
[key: string]: {
|
|
48
|
+
type: 'oauth2';
|
|
49
|
+
flows: {
|
|
50
|
+
authorizationCode: {
|
|
51
|
+
tokenUrl: infer TTokenURL;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
} ? {
|
|
58
|
+
[TPath in TTokenURL extends string ? TTokenURL : never]: {
|
|
59
|
+
/**
|
|
60
|
+
* The client needs to authenticate themselves for this request.
|
|
61
|
+
* Typically the service will allow either additional request parameters `client_id` and `client_secret`,
|
|
62
|
+
* or accept the client ID and secret in the HTTP Basic auth header.
|
|
63
|
+
*/
|
|
64
|
+
post(requestParams: OASOAuthPathRequestParamsWithHeader | OASOAuthPathRequestParamsWithoutHeader, requestInit?: RequestInit): Promise<TypedResponseWithJSONStatusMap<{
|
|
65
|
+
200: OAuthPathSuccessResponse;
|
|
66
|
+
400: OAuthPathFailedResponse;
|
|
67
|
+
}>>;
|
|
68
|
+
};
|
|
69
|
+
} : {};
|
|
70
|
+
/**
|
|
71
|
+
* If the request for an access token is valid, the authorization server needs to generate an access token (and optional refresh token) and return these to the client, typically along with some additional properties about the authorization.
|
|
72
|
+
* @see https://www.oauth.com/oauth2-servers/access-tokens/access-token-response/#page-202
|
|
73
|
+
*/
|
|
74
|
+
export type OAuthPathSuccessResponse = {
|
|
75
|
+
/**
|
|
76
|
+
* The access token string as issued by the authorization server.
|
|
77
|
+
*/
|
|
78
|
+
access_token: string;
|
|
79
|
+
/**
|
|
80
|
+
* The type of token this is, typically just the string “Bearer”.
|
|
81
|
+
*/
|
|
82
|
+
token_type: 'Bearer' | 'bearer';
|
|
83
|
+
/**
|
|
84
|
+
* If the access token expires, the server should reply with the duration of time the access token is granted for.
|
|
85
|
+
*/
|
|
86
|
+
expires_in?: number;
|
|
87
|
+
/**
|
|
88
|
+
* If the access token will expire,
|
|
89
|
+
* then it is useful to return a refresh token which applications can use to obtain another access token.
|
|
90
|
+
* However, tokens issued with the implicit grant cannot be issued a refresh token.
|
|
91
|
+
*/
|
|
92
|
+
refresh_token?: string;
|
|
93
|
+
/**
|
|
94
|
+
* If the scope the user granted is identical to the scope the app requested, this parameter is optional.
|
|
95
|
+
* If the granted scope is different from the requested scope,
|
|
96
|
+
* such as if the user modified the scope, then this parameter is required.
|
|
97
|
+
*/
|
|
98
|
+
scope?: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* If the access token request is invalid, such as the redirect URL didn’t match the one used during authorization, then the server needs to return an error response.
|
|
102
|
+
*
|
|
103
|
+
* Error responses are returned with an HTTP 400 status code (unless specified otherwise), with error and error_description parameters. The error parameter will always be one of the values listed below.
|
|
104
|
+
*/
|
|
105
|
+
export interface OAuthPathFailedResponse {
|
|
106
|
+
/**
|
|
107
|
+
* Error responses are returned with an HTTP 400 status code (unless specified otherwise), with `error` and `error_description`.
|
|
108
|
+
*
|
|
109
|
+
* @see https://www.oauth.com/oauth2-servers/access-tokens/access-token-response/#error
|
|
110
|
+
*/
|
|
111
|
+
error: OAuthPathErrorType;
|
|
112
|
+
/**
|
|
113
|
+
* The error_description parameter can only include ASCII characters, and should be a sentence or two at most describing the circumstance of the error.
|
|
114
|
+
*/
|
|
115
|
+
error_description?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The error_uri is a great place to link to your API documentation for information about how to correct the specific error that was encountered.
|
|
118
|
+
*/
|
|
119
|
+
error_uri?: string;
|
|
120
|
+
}
|
|
121
|
+
export declare enum OAuthPathErrorType {
|
|
122
|
+
/**
|
|
123
|
+
* The request is missing a parameter so the server can’t proceed with the request.
|
|
124
|
+
* This may also be returned if the request includes an unsupported parameter or repeats a parameter.
|
|
125
|
+
*/
|
|
126
|
+
invalid_request = "invalid_request",
|
|
127
|
+
/**
|
|
128
|
+
* Client authentication failed, such as if the request contains an invalid client ID or secret.
|
|
129
|
+
* Send an HTTP 401 response in this case.
|
|
130
|
+
*/
|
|
131
|
+
invalid_client = "invalid_client",
|
|
132
|
+
/**
|
|
133
|
+
* The authorization code (or user’s password for the password grant type) is invalid or expired.
|
|
134
|
+
* This is also the error you would return if the redirect URL given in the authorization grant does not match the URL provided in this access token request.
|
|
135
|
+
*/
|
|
136
|
+
invalid_grant = "invalid_grant",
|
|
137
|
+
/**
|
|
138
|
+
* For access token requests that include a scope (password or client_credentials grants), this error indicates an invalid scope value in the request.
|
|
139
|
+
*/
|
|
140
|
+
invalid_scope = "invalid_scope",
|
|
141
|
+
/**
|
|
142
|
+
* This client is not authorized to use the requested grant type. For example, if you restrict which applications can use the Implicit grant, you would return this error for the other apps.
|
|
143
|
+
*/
|
|
144
|
+
unauthorized_client = "unauthorized_client",
|
|
145
|
+
/**
|
|
146
|
+
* If a grant type is requested that the authorization server doesn’t recognize, use this code.
|
|
147
|
+
* Note that unknown grant types also use this specific error code rather than using the `invalid_request` above.
|
|
148
|
+
*/
|
|
149
|
+
unsupported_grant_type = "unsupported_grant_type"
|
|
150
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { TypedResponseWithJSONStatusMap } from '../../typed-fetch.js';
|
|
2
|
+
export type OAuth2AuthParams<TSecurityScheme> = TSecurityScheme extends {
|
|
3
|
+
type: 'oauth2';
|
|
4
|
+
} ? {
|
|
5
|
+
/**
|
|
6
|
+
* `Authorization` header is required for OAuth2.
|
|
7
|
+
*/
|
|
8
|
+
headers: {
|
|
9
|
+
/**
|
|
10
|
+
* The access token string as issued by the authorization server.
|
|
11
|
+
* @example `Authorization: Bearer <access_token>`
|
|
12
|
+
*/
|
|
13
|
+
Authorization: `Bearer ${string}`;
|
|
14
|
+
};
|
|
15
|
+
} : {};
|
|
16
|
+
export type OASOAuthPathRequestParamsWithHeader = {
|
|
17
|
+
formUrlEncoded: {
|
|
18
|
+
/**
|
|
19
|
+
* The Client Credentials grant is used when applications request an access token to access their own resources, not on behalf of a user.
|
|
20
|
+
*
|
|
21
|
+
* The `grant_type` parameter must be set to `client_credentials`.
|
|
22
|
+
*
|
|
23
|
+
* @see https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/
|
|
24
|
+
*/
|
|
25
|
+
grant_type: 'client_credentials';
|
|
26
|
+
/**
|
|
27
|
+
* Your service can support different scopes for the client credentials grant. In practice, not many services actually support this.
|
|
28
|
+
*/
|
|
29
|
+
scope?: string | string[];
|
|
30
|
+
};
|
|
31
|
+
headers: {
|
|
32
|
+
/**
|
|
33
|
+
* The client ID and secret can be sent in the HTTP Basic auth header.
|
|
34
|
+
* @example `Authorization: Basic <base64 encoded client_id:client_secret>`
|
|
35
|
+
*/
|
|
36
|
+
Authorization: `Basic ${string}`;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type OASOAuthPathRequestParamsWithoutHeader = {
|
|
40
|
+
grant_type: 'client_credentials';
|
|
41
|
+
client_id: string;
|
|
42
|
+
client_secret: string;
|
|
43
|
+
};
|
|
44
|
+
export type OASOAuthPath<TOAS> = TOAS extends {
|
|
45
|
+
components: {
|
|
46
|
+
securitySchemes: {
|
|
47
|
+
[key: string]: {
|
|
48
|
+
type: 'oauth2';
|
|
49
|
+
flows: {
|
|
50
|
+
authorizationCode: {
|
|
51
|
+
tokenUrl: infer TTokenURL;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
} ? {
|
|
58
|
+
[TPath in TTokenURL extends string ? TTokenURL : never]: {
|
|
59
|
+
/**
|
|
60
|
+
* The client needs to authenticate themselves for this request.
|
|
61
|
+
* Typically the service will allow either additional request parameters `client_id` and `client_secret`,
|
|
62
|
+
* or accept the client ID and secret in the HTTP Basic auth header.
|
|
63
|
+
*/
|
|
64
|
+
post(requestParams: OASOAuthPathRequestParamsWithHeader | OASOAuthPathRequestParamsWithoutHeader, requestInit?: RequestInit): Promise<TypedResponseWithJSONStatusMap<{
|
|
65
|
+
200: OAuthPathSuccessResponse;
|
|
66
|
+
400: OAuthPathFailedResponse;
|
|
67
|
+
}>>;
|
|
68
|
+
};
|
|
69
|
+
} : {};
|
|
70
|
+
/**
|
|
71
|
+
* If the request for an access token is valid, the authorization server needs to generate an access token (and optional refresh token) and return these to the client, typically along with some additional properties about the authorization.
|
|
72
|
+
* @see https://www.oauth.com/oauth2-servers/access-tokens/access-token-response/#page-202
|
|
73
|
+
*/
|
|
74
|
+
export type OAuthPathSuccessResponse = {
|
|
75
|
+
/**
|
|
76
|
+
* The access token string as issued by the authorization server.
|
|
77
|
+
*/
|
|
78
|
+
access_token: string;
|
|
79
|
+
/**
|
|
80
|
+
* The type of token this is, typically just the string “Bearer”.
|
|
81
|
+
*/
|
|
82
|
+
token_type: 'Bearer' | 'bearer';
|
|
83
|
+
/**
|
|
84
|
+
* If the access token expires, the server should reply with the duration of time the access token is granted for.
|
|
85
|
+
*/
|
|
86
|
+
expires_in?: number;
|
|
87
|
+
/**
|
|
88
|
+
* If the access token will expire,
|
|
89
|
+
* then it is useful to return a refresh token which applications can use to obtain another access token.
|
|
90
|
+
* However, tokens issued with the implicit grant cannot be issued a refresh token.
|
|
91
|
+
*/
|
|
92
|
+
refresh_token?: string;
|
|
93
|
+
/**
|
|
94
|
+
* If the scope the user granted is identical to the scope the app requested, this parameter is optional.
|
|
95
|
+
* If the granted scope is different from the requested scope,
|
|
96
|
+
* such as if the user modified the scope, then this parameter is required.
|
|
97
|
+
*/
|
|
98
|
+
scope?: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* If the access token request is invalid, such as the redirect URL didn’t match the one used during authorization, then the server needs to return an error response.
|
|
102
|
+
*
|
|
103
|
+
* Error responses are returned with an HTTP 400 status code (unless specified otherwise), with error and error_description parameters. The error parameter will always be one of the values listed below.
|
|
104
|
+
*/
|
|
105
|
+
export interface OAuthPathFailedResponse {
|
|
106
|
+
/**
|
|
107
|
+
* Error responses are returned with an HTTP 400 status code (unless specified otherwise), with `error` and `error_description`.
|
|
108
|
+
*
|
|
109
|
+
* @see https://www.oauth.com/oauth2-servers/access-tokens/access-token-response/#error
|
|
110
|
+
*/
|
|
111
|
+
error: OAuthPathErrorType;
|
|
112
|
+
/**
|
|
113
|
+
* The error_description parameter can only include ASCII characters, and should be a sentence or two at most describing the circumstance of the error.
|
|
114
|
+
*/
|
|
115
|
+
error_description?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The error_uri is a great place to link to your API documentation for information about how to correct the specific error that was encountered.
|
|
118
|
+
*/
|
|
119
|
+
error_uri?: string;
|
|
120
|
+
}
|
|
121
|
+
export declare enum OAuthPathErrorType {
|
|
122
|
+
/**
|
|
123
|
+
* The request is missing a parameter so the server can’t proceed with the request.
|
|
124
|
+
* This may also be returned if the request includes an unsupported parameter or repeats a parameter.
|
|
125
|
+
*/
|
|
126
|
+
invalid_request = "invalid_request",
|
|
127
|
+
/**
|
|
128
|
+
* Client authentication failed, such as if the request contains an invalid client ID or secret.
|
|
129
|
+
* Send an HTTP 401 response in this case.
|
|
130
|
+
*/
|
|
131
|
+
invalid_client = "invalid_client",
|
|
132
|
+
/**
|
|
133
|
+
* The authorization code (or user’s password for the password grant type) is invalid or expired.
|
|
134
|
+
* This is also the error you would return if the redirect URL given in the authorization grant does not match the URL provided in this access token request.
|
|
135
|
+
*/
|
|
136
|
+
invalid_grant = "invalid_grant",
|
|
137
|
+
/**
|
|
138
|
+
* For access token requests that include a scope (password or client_credentials grants), this error indicates an invalid scope value in the request.
|
|
139
|
+
*/
|
|
140
|
+
invalid_scope = "invalid_scope",
|
|
141
|
+
/**
|
|
142
|
+
* This client is not authorized to use the requested grant type. For example, if you restrict which applications can use the Implicit grant, you would return this error for the other apps.
|
|
143
|
+
*/
|
|
144
|
+
unauthorized_client = "unauthorized_client",
|
|
145
|
+
/**
|
|
146
|
+
* If a grant type is requested that the authorization server doesn’t recognize, use this code.
|
|
147
|
+
* Note that unknown grant types also use this specific error code rather than using the `invalid_request` above.
|
|
148
|
+
*/
|
|
149
|
+
unsupported_grant_type = "unsupported_grant_type"
|
|
150
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HTTPMethod } from '../typed-fetch.cjs';
|
|
2
|
+
import { OpenAPIDocument, Router } from '../types.cjs';
|
|
3
|
+
import { ClientOptions, ClientOptionsWithStrictEndpoint, OASClient } from './types.cjs';
|
|
4
|
+
export declare class ClientValidationError extends Error implements AggregateError {
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly method: HTTPMethod;
|
|
7
|
+
errors: any[];
|
|
8
|
+
response: Response;
|
|
9
|
+
constructor(path: string, method: HTTPMethod, errors: any[], response: Response);
|
|
10
|
+
[Symbol.iterator](): IterableIterator<any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a client for an OpenAPI document
|
|
14
|
+
* You need to pass the imported OpenAPI document as a generic
|
|
15
|
+
*
|
|
16
|
+
* We recommend using the `NormalizeOAS` type to normalize the OpenAPI document
|
|
17
|
+
*
|
|
18
|
+
* @see https://the-guild.dev/openapi/fets/client/quick-start#usage-with-existing-rest-api
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { createClient, type NormalizeOAS } from 'fets';
|
|
23
|
+
* import type oas from './oas.ts';
|
|
24
|
+
*
|
|
25
|
+
* const client = createClient<NormalizeOAS<typeof oas>>({});
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function createClient<TOAS extends OpenAPIDocument>(options: ClientOptionsWithStrictEndpoint<TOAS>): OASClient<TOAS>;
|
|
29
|
+
/**
|
|
30
|
+
* Create a client from a typed `Router`
|
|
31
|
+
*
|
|
32
|
+
* @see https://the-guild.dev/openapi/fets/client/quick-start#usage-with-fets-server
|
|
33
|
+
*/
|
|
34
|
+
export declare function createClient<TRouter extends Router<any, any, any>>(options: ClientOptions): TRouter['__client'];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HTTPMethod } from '../typed-fetch.js';
|
|
2
|
+
import { OpenAPIDocument, Router } from '../types.js';
|
|
3
|
+
import { ClientOptions, ClientOptionsWithStrictEndpoint, OASClient } from './types.js';
|
|
4
|
+
export declare class ClientValidationError extends Error implements AggregateError {
|
|
5
|
+
readonly path: string;
|
|
6
|
+
readonly method: HTTPMethod;
|
|
7
|
+
errors: any[];
|
|
8
|
+
response: Response;
|
|
9
|
+
constructor(path: string, method: HTTPMethod, errors: any[], response: Response);
|
|
10
|
+
[Symbol.iterator](): IterableIterator<any>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a client for an OpenAPI document
|
|
14
|
+
* You need to pass the imported OpenAPI document as a generic
|
|
15
|
+
*
|
|
16
|
+
* We recommend using the `NormalizeOAS` type to normalize the OpenAPI document
|
|
17
|
+
*
|
|
18
|
+
* @see https://the-guild.dev/openapi/fets/client/quick-start#usage-with-existing-rest-api
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { createClient, type NormalizeOAS } from 'fets';
|
|
23
|
+
* import type oas from './oas.ts';
|
|
24
|
+
*
|
|
25
|
+
* const client = createClient<NormalizeOAS<typeof oas>>({});
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function createClient<TOAS extends OpenAPIDocument>(options: ClientOptionsWithStrictEndpoint<TOAS>): OASClient<TOAS>;
|
|
29
|
+
/**
|
|
30
|
+
* Create a client from a typed `Router`
|
|
31
|
+
*
|
|
32
|
+
* @see https://the-guild.dev/openapi/fets/client/quick-start#usage-with-fets-server
|
|
33
|
+
*/
|
|
34
|
+
export declare function createClient<TRouter extends Router<any, any, any>>(options: ClientOptions): TRouter['__client'];
|