@townco/fly 0.1.26 → 0.1.28
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/api/client/client.gen.js +0 -1
- package/dist/api/client/utils.gen.js +0 -1
- package/dist/api/types.gen.d.ts +5 -5
- package/package.json +4 -10
- package/dist/client/client.gen.d.ts +0 -2
- package/dist/client/client.gen.js +0 -228
- package/dist/client/index.d.ts +0 -8
- package/dist/client/index.js +0 -6
- package/dist/client/types.gen.d.ts +0 -117
- package/dist/client/types.gen.js +0 -2
- package/dist/client/utils.gen.d.ts +0 -33
- package/dist/client/utils.gen.js +0 -231
- package/dist/client.gen.d.ts +0 -12
- package/dist/client.gen.js +0 -3
- package/dist/core/auth.gen.d.ts +0 -18
- package/dist/core/auth.gen.js +0 -14
- package/dist/core/bodySerializer.gen.d.ts +0 -25
- package/dist/core/bodySerializer.gen.js +0 -57
- package/dist/core/params.gen.d.ts +0 -43
- package/dist/core/params.gen.js +0 -100
- package/dist/core/pathSerializer.gen.d.ts +0 -33
- package/dist/core/pathSerializer.gen.js +0 -114
- package/dist/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/core/queryKeySerializer.gen.js +0 -99
- package/dist/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/core/serverSentEvents.gen.js +0 -135
- package/dist/core/types.gen.d.ts +0 -78
- package/dist/core/types.gen.js +0 -2
- package/dist/core/utils.gen.d.ts +0 -19
- package/dist/core/utils.gen.js +0 -87
- package/dist/sdk.gen.d.ts +0 -379
- package/dist/sdk.gen.js +0 -557
- package/dist/types.gen.d.ts +0 -2592
- package/dist/types.gen.js +0 -2
package/dist/api/types.gen.d.ts
CHANGED
|
@@ -1168,7 +1168,7 @@ export type AppIpAssignmentsDeleteResponses = {
|
|
|
1168
1168
|
/**
|
|
1169
1169
|
* No Content
|
|
1170
1170
|
*/
|
|
1171
|
-
204:
|
|
1171
|
+
204: undefined;
|
|
1172
1172
|
};
|
|
1173
1173
|
export type AppIpAssignmentsDeleteResponse = AppIpAssignmentsDeleteResponses[keyof AppIpAssignmentsDeleteResponses];
|
|
1174
1174
|
export type MachinesListData = {
|
|
@@ -1542,7 +1542,7 @@ export type MachinesPatchMetadataResponses = {
|
|
|
1542
1542
|
/**
|
|
1543
1543
|
* No Content
|
|
1544
1544
|
*/
|
|
1545
|
-
204:
|
|
1545
|
+
204: undefined;
|
|
1546
1546
|
};
|
|
1547
1547
|
export type MachinesPatchMetadataResponse = MachinesPatchMetadataResponses[keyof MachinesPatchMetadataResponses];
|
|
1548
1548
|
export type MachinesDeleteMetadataData = {
|
|
@@ -1568,7 +1568,7 @@ export type MachinesDeleteMetadataResponses = {
|
|
|
1568
1568
|
/**
|
|
1569
1569
|
* No Content
|
|
1570
1570
|
*/
|
|
1571
|
-
204:
|
|
1571
|
+
204: undefined;
|
|
1572
1572
|
};
|
|
1573
1573
|
export type MachinesDeleteMetadataResponse = MachinesDeleteMetadataResponses[keyof MachinesDeleteMetadataResponses];
|
|
1574
1574
|
export type MachinesUpdateMetadataData = {
|
|
@@ -1601,7 +1601,7 @@ export type MachinesUpdateMetadataResponses = {
|
|
|
1601
1601
|
/**
|
|
1602
1602
|
* No Content
|
|
1603
1603
|
*/
|
|
1604
|
-
204:
|
|
1604
|
+
204: undefined;
|
|
1605
1605
|
};
|
|
1606
1606
|
export type MachinesUpdateMetadataResponse = MachinesUpdateMetadataResponses[keyof MachinesUpdateMetadataResponses];
|
|
1607
1607
|
export type MachinesListProcessesData = {
|
|
@@ -2152,7 +2152,7 @@ export type SecretkeyVerifyResponses = {
|
|
|
2152
2152
|
/**
|
|
2153
2153
|
* No Content
|
|
2154
2154
|
*/
|
|
2155
|
-
204:
|
|
2155
|
+
204: undefined;
|
|
2156
2156
|
};
|
|
2157
2157
|
export type SecretkeyVerifyResponse = SecretkeyVerifyResponses[keyof SecretkeyVerifyResponses];
|
|
2158
2158
|
export type SecretsListData = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/fly",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.28",
|
|
5
5
|
"description": "flyapi",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -18,15 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@biomejs/biome": "^2.3.8",
|
|
21
|
-
"@hey-api/client-fetch": "^0.13.1",
|
|
22
21
|
"@hey-api/openapi-ts": "^0.88.0",
|
|
23
|
-
"@
|
|
24
|
-
"@optique/run": "^0.7.2",
|
|
25
|
-
"@townco/core": "0.0.54",
|
|
26
|
-
"@townco/tsconfig": "0.1.73",
|
|
22
|
+
"@townco/tsconfig": "0.1.75",
|
|
27
23
|
"@types/node": "^24.10.1",
|
|
28
|
-
"openapi-types": "^12.1.3",
|
|
29
|
-
"ts-pattern": "^5.9.0",
|
|
30
24
|
"typescript": "^5.9.3"
|
|
31
25
|
},
|
|
32
26
|
"scripts": {
|
|
@@ -34,9 +28,9 @@
|
|
|
34
28
|
"check": "tsc --noEmit",
|
|
35
29
|
"fetch-spec": "bun spectool",
|
|
36
30
|
"gen": "turbo gen:api",
|
|
37
|
-
"gen:api": "openapi-ts"
|
|
31
|
+
"gen:api": "openapi-ts && biome check --write --unsafe"
|
|
38
32
|
},
|
|
39
33
|
"dependencies": {
|
|
40
|
-
"@townco/env": "0.1.
|
|
34
|
+
"@townco/env": "0.1.28"
|
|
41
35
|
}
|
|
42
36
|
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
import { createSseClient } from "../core/serverSentEvents.gen";
|
|
3
|
-
import { getValidRequestBody } from "../core/utils.gen";
|
|
4
|
-
import { buildUrl, createConfig, createInterceptors, getParseAs, mergeConfigs, mergeHeaders, setAuthParams, } from "./utils.gen";
|
|
5
|
-
export const createClient = (config = {}) => {
|
|
6
|
-
let _config = mergeConfigs(createConfig(), config);
|
|
7
|
-
const getConfig = () => ({ ..._config });
|
|
8
|
-
const setConfig = (config) => {
|
|
9
|
-
_config = mergeConfigs(_config, config);
|
|
10
|
-
return getConfig();
|
|
11
|
-
};
|
|
12
|
-
const interceptors = createInterceptors();
|
|
13
|
-
const beforeRequest = async (options) => {
|
|
14
|
-
const opts = {
|
|
15
|
-
..._config,
|
|
16
|
-
...options,
|
|
17
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
18
|
-
headers: mergeHeaders(_config.headers, options.headers),
|
|
19
|
-
serializedBody: undefined,
|
|
20
|
-
};
|
|
21
|
-
if (opts.security) {
|
|
22
|
-
await setAuthParams({
|
|
23
|
-
...opts,
|
|
24
|
-
security: opts.security,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
if (opts.requestValidator) {
|
|
28
|
-
await opts.requestValidator(opts);
|
|
29
|
-
}
|
|
30
|
-
if (opts.body !== undefined && opts.bodySerializer) {
|
|
31
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
32
|
-
}
|
|
33
|
-
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
34
|
-
if (opts.body === undefined || opts.serializedBody === "") {
|
|
35
|
-
opts.headers.delete("Content-Type");
|
|
36
|
-
}
|
|
37
|
-
const url = buildUrl(opts);
|
|
38
|
-
return { opts, url };
|
|
39
|
-
};
|
|
40
|
-
const request = async (options) => {
|
|
41
|
-
// @ts-expect-error
|
|
42
|
-
const { opts, url } = await beforeRequest(options);
|
|
43
|
-
const requestInit = {
|
|
44
|
-
redirect: "follow",
|
|
45
|
-
...opts,
|
|
46
|
-
body: getValidRequestBody(opts),
|
|
47
|
-
};
|
|
48
|
-
let request = new Request(url, requestInit);
|
|
49
|
-
for (const fn of interceptors.request.fns) {
|
|
50
|
-
if (fn) {
|
|
51
|
-
request = await fn(request, opts);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// fetch must be assigned here, otherwise it would throw the error:
|
|
55
|
-
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
56
|
-
const _fetch = opts.fetch;
|
|
57
|
-
let response;
|
|
58
|
-
try {
|
|
59
|
-
response = await _fetch(request);
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
// Handle fetch exceptions (AbortError, network errors, etc.)
|
|
63
|
-
let finalError = error;
|
|
64
|
-
for (const fn of interceptors.error.fns) {
|
|
65
|
-
if (fn) {
|
|
66
|
-
finalError = (await fn(error, undefined, request, opts));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
finalError = finalError || {};
|
|
70
|
-
if (opts.throwOnError) {
|
|
71
|
-
throw finalError;
|
|
72
|
-
}
|
|
73
|
-
// Return error response
|
|
74
|
-
return opts.responseStyle === "data"
|
|
75
|
-
? undefined
|
|
76
|
-
: {
|
|
77
|
-
error: finalError,
|
|
78
|
-
request,
|
|
79
|
-
response: undefined,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
for (const fn of interceptors.response.fns) {
|
|
83
|
-
if (fn) {
|
|
84
|
-
response = await fn(response, request, opts);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const result = {
|
|
88
|
-
request,
|
|
89
|
-
response,
|
|
90
|
-
};
|
|
91
|
-
if (response.ok) {
|
|
92
|
-
const parseAs = (opts.parseAs === "auto"
|
|
93
|
-
? getParseAs(response.headers.get("Content-Type"))
|
|
94
|
-
: opts.parseAs) ?? "json";
|
|
95
|
-
if (response.status === 204 ||
|
|
96
|
-
response.headers.get("Content-Length") === "0") {
|
|
97
|
-
let emptyData;
|
|
98
|
-
switch (parseAs) {
|
|
99
|
-
case "arrayBuffer":
|
|
100
|
-
case "blob":
|
|
101
|
-
case "text":
|
|
102
|
-
emptyData = await response[parseAs]();
|
|
103
|
-
break;
|
|
104
|
-
case "formData":
|
|
105
|
-
emptyData = new FormData();
|
|
106
|
-
break;
|
|
107
|
-
case "stream":
|
|
108
|
-
emptyData = response.body;
|
|
109
|
-
break;
|
|
110
|
-
case "json":
|
|
111
|
-
default:
|
|
112
|
-
emptyData = {};
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
return opts.responseStyle === "data"
|
|
116
|
-
? emptyData
|
|
117
|
-
: {
|
|
118
|
-
data: emptyData,
|
|
119
|
-
...result,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
let data;
|
|
123
|
-
switch (parseAs) {
|
|
124
|
-
case "arrayBuffer":
|
|
125
|
-
case "blob":
|
|
126
|
-
case "formData":
|
|
127
|
-
case "json":
|
|
128
|
-
case "text":
|
|
129
|
-
data = await response[parseAs]();
|
|
130
|
-
break;
|
|
131
|
-
case "stream":
|
|
132
|
-
return opts.responseStyle === "data"
|
|
133
|
-
? response.body
|
|
134
|
-
: {
|
|
135
|
-
data: response.body,
|
|
136
|
-
...result,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
if (parseAs === "json") {
|
|
140
|
-
if (opts.responseValidator) {
|
|
141
|
-
await opts.responseValidator(data);
|
|
142
|
-
}
|
|
143
|
-
if (opts.responseTransformer) {
|
|
144
|
-
data = await opts.responseTransformer(data);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return opts.responseStyle === "data"
|
|
148
|
-
? data
|
|
149
|
-
: {
|
|
150
|
-
data,
|
|
151
|
-
...result,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
const textError = await response.text();
|
|
155
|
-
let jsonError;
|
|
156
|
-
try {
|
|
157
|
-
jsonError = JSON.parse(textError);
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
// noop
|
|
161
|
-
}
|
|
162
|
-
const error = jsonError ?? textError;
|
|
163
|
-
let finalError = error;
|
|
164
|
-
for (const fn of interceptors.error.fns) {
|
|
165
|
-
if (fn) {
|
|
166
|
-
finalError = (await fn(error, response, request, opts));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
finalError = finalError || {};
|
|
170
|
-
if (opts.throwOnError) {
|
|
171
|
-
throw finalError;
|
|
172
|
-
}
|
|
173
|
-
// TODO: we probably want to return error and improve types
|
|
174
|
-
return opts.responseStyle === "data"
|
|
175
|
-
? undefined
|
|
176
|
-
: {
|
|
177
|
-
error: finalError,
|
|
178
|
-
...result,
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
const makeMethodFn = (method) => (options) => request({ ...options, method });
|
|
182
|
-
const makeSseFn = (method) => async (options) => {
|
|
183
|
-
const { opts, url } = await beforeRequest(options);
|
|
184
|
-
return createSseClient({
|
|
185
|
-
...opts,
|
|
186
|
-
body: opts.body,
|
|
187
|
-
headers: opts.headers,
|
|
188
|
-
method,
|
|
189
|
-
onRequest: async (url, init) => {
|
|
190
|
-
let request = new Request(url, init);
|
|
191
|
-
for (const fn of interceptors.request.fns) {
|
|
192
|
-
if (fn) {
|
|
193
|
-
request = await fn(request, opts);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return request;
|
|
197
|
-
},
|
|
198
|
-
url,
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
|
-
return {
|
|
202
|
-
buildUrl,
|
|
203
|
-
connect: makeMethodFn("CONNECT"),
|
|
204
|
-
delete: makeMethodFn("DELETE"),
|
|
205
|
-
get: makeMethodFn("GET"),
|
|
206
|
-
getConfig,
|
|
207
|
-
head: makeMethodFn("HEAD"),
|
|
208
|
-
interceptors,
|
|
209
|
-
options: makeMethodFn("OPTIONS"),
|
|
210
|
-
patch: makeMethodFn("PATCH"),
|
|
211
|
-
post: makeMethodFn("POST"),
|
|
212
|
-
put: makeMethodFn("PUT"),
|
|
213
|
-
request,
|
|
214
|
-
setConfig,
|
|
215
|
-
sse: {
|
|
216
|
-
connect: makeSseFn("CONNECT"),
|
|
217
|
-
delete: makeSseFn("DELETE"),
|
|
218
|
-
get: makeSseFn("GET"),
|
|
219
|
-
head: makeSseFn("HEAD"),
|
|
220
|
-
options: makeSseFn("OPTIONS"),
|
|
221
|
-
patch: makeSseFn("PATCH"),
|
|
222
|
-
post: makeSseFn("POST"),
|
|
223
|
-
put: makeSseFn("PUT"),
|
|
224
|
-
trace: makeSseFn("TRACE"),
|
|
225
|
-
},
|
|
226
|
-
trace: makeMethodFn("TRACE"),
|
|
227
|
-
};
|
|
228
|
-
};
|
package/dist/client/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type { Auth } from "../core/auth.gen";
|
|
2
|
-
export type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
|
3
|
-
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen";
|
|
4
|
-
export { buildClientParams } from "../core/params.gen";
|
|
5
|
-
export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen";
|
|
6
|
-
export { createClient } from "./client.gen";
|
|
7
|
-
export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from "./types.gen";
|
|
8
|
-
export { createConfig, mergeHeaders } from "./utils.gen";
|
package/dist/client/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from "../core/bodySerializer.gen";
|
|
3
|
-
export { buildClientParams } from "../core/params.gen";
|
|
4
|
-
export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen";
|
|
5
|
-
export { createClient } from "./client.gen";
|
|
6
|
-
export { createConfig, mergeHeaders } from "./utils.gen";
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import type { Auth } from "../core/auth.gen";
|
|
2
|
-
import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen";
|
|
3
|
-
import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen";
|
|
4
|
-
import type { Middleware } from "./utils.gen";
|
|
5
|
-
export type ResponseStyle = "data" | "fields";
|
|
6
|
-
export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, "body" | "headers" | "method">, CoreConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Base URL for all requests made by this client.
|
|
9
|
-
*/
|
|
10
|
-
baseUrl?: T["baseUrl"];
|
|
11
|
-
/**
|
|
12
|
-
* Fetch API implementation. You can use this option to provide a custom
|
|
13
|
-
* fetch instance.
|
|
14
|
-
*
|
|
15
|
-
* @default globalThis.fetch
|
|
16
|
-
*/
|
|
17
|
-
fetch?: typeof fetch;
|
|
18
|
-
/**
|
|
19
|
-
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
20
|
-
* options won't have any effect.
|
|
21
|
-
*
|
|
22
|
-
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
23
|
-
*/
|
|
24
|
-
next?: never;
|
|
25
|
-
/**
|
|
26
|
-
* Return the response data parsed in a specified format. By default, `auto`
|
|
27
|
-
* will infer the appropriate method from the `Content-Type` response header.
|
|
28
|
-
* You can override this behavior with any of the {@link Body} methods.
|
|
29
|
-
* Select `stream` if you don't want to parse response data at all.
|
|
30
|
-
*
|
|
31
|
-
* @default 'auto'
|
|
32
|
-
*/
|
|
33
|
-
parseAs?: "arrayBuffer" | "auto" | "blob" | "formData" | "json" | "stream" | "text";
|
|
34
|
-
/**
|
|
35
|
-
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
36
|
-
*
|
|
37
|
-
* @default 'fields'
|
|
38
|
-
*/
|
|
39
|
-
responseStyle?: ResponseStyle;
|
|
40
|
-
/**
|
|
41
|
-
* Throw an error instead of returning it in the response?
|
|
42
|
-
*
|
|
43
|
-
* @default false
|
|
44
|
-
*/
|
|
45
|
-
throwOnError?: T["throwOnError"];
|
|
46
|
-
}
|
|
47
|
-
export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
48
|
-
responseStyle: TResponseStyle;
|
|
49
|
-
throwOnError: ThrowOnError;
|
|
50
|
-
}>, Pick<ServerSentEventsOptions<TData>, "onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay"> {
|
|
51
|
-
/**
|
|
52
|
-
* Any body that you want to add to your request.
|
|
53
|
-
*
|
|
54
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
55
|
-
*/
|
|
56
|
-
body?: unknown;
|
|
57
|
-
path?: Record<string, unknown>;
|
|
58
|
-
query?: Record<string, unknown>;
|
|
59
|
-
/**
|
|
60
|
-
* Security mechanism(s) to use for the request.
|
|
61
|
-
*/
|
|
62
|
-
security?: ReadonlyArray<Auth>;
|
|
63
|
-
url: Url;
|
|
64
|
-
}
|
|
65
|
-
export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = "fields", ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
66
|
-
serializedBody?: string;
|
|
67
|
-
}
|
|
68
|
-
export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = "fields"> = ThrowOnError extends true ? Promise<TResponseStyle extends "data" ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
|
|
69
|
-
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
70
|
-
request: Request;
|
|
71
|
-
response: Response;
|
|
72
|
-
}> : Promise<TResponseStyle extends "data" ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
73
|
-
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
74
|
-
error: undefined;
|
|
75
|
-
} | {
|
|
76
|
-
data: undefined;
|
|
77
|
-
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
78
|
-
}) & {
|
|
79
|
-
request: Request;
|
|
80
|
-
response: Response;
|
|
81
|
-
}>;
|
|
82
|
-
export interface ClientOptions {
|
|
83
|
-
baseUrl?: string;
|
|
84
|
-
responseStyle?: ResponseStyle;
|
|
85
|
-
throwOnError?: boolean;
|
|
86
|
-
}
|
|
87
|
-
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
88
|
-
type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method">) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
89
|
-
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = "fields">(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method"> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, "method">) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
90
|
-
type BuildUrlFn = <TData extends {
|
|
91
|
-
body?: unknown;
|
|
92
|
-
path?: Record<string, unknown>;
|
|
93
|
-
query?: Record<string, unknown>;
|
|
94
|
-
url: string;
|
|
95
|
-
}>(options: TData & Options<TData>) => string;
|
|
96
|
-
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
97
|
-
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* The `createClientConfig()` function will be called on client initialization
|
|
101
|
-
* and the returned object will become the client's initial configuration.
|
|
102
|
-
*
|
|
103
|
-
* You may want to initialize your client this way instead of calling
|
|
104
|
-
* `setConfig()`. This is useful for example if you're using Next.js
|
|
105
|
-
* to ensure your client always has the correct values.
|
|
106
|
-
*/
|
|
107
|
-
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
|
|
108
|
-
export interface TDataShape {
|
|
109
|
-
body?: unknown;
|
|
110
|
-
headers?: unknown;
|
|
111
|
-
path?: unknown;
|
|
112
|
-
query?: unknown;
|
|
113
|
-
url: string;
|
|
114
|
-
}
|
|
115
|
-
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
116
|
-
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = "fields"> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, "body" | "path" | "query" | "url"> & ([TData] extends [never] ? unknown : Omit<TData, "url">);
|
|
117
|
-
export {};
|
package/dist/client/types.gen.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
|
2
|
-
import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen";
|
|
3
|
-
export declare const createQuerySerializer: <T = unknown>({ parameters, ...args }?: QuerySerializerOptions) => (queryParams: T) => string;
|
|
4
|
-
/**
|
|
5
|
-
* Infers parseAs value from provided Content-Type header.
|
|
6
|
-
*/
|
|
7
|
-
export declare const getParseAs: (contentType: string | null) => Exclude<Config["parseAs"], "auto">;
|
|
8
|
-
export declare const setAuthParams: ({ security, ...options }: Pick<Required<RequestOptions>, "security"> & Pick<RequestOptions, "auth" | "query"> & {
|
|
9
|
-
headers: Headers;
|
|
10
|
-
}) => Promise<void>;
|
|
11
|
-
export declare const buildUrl: Client["buildUrl"];
|
|
12
|
-
export declare const mergeConfigs: (a: Config, b: Config) => Config;
|
|
13
|
-
export declare const mergeHeaders: (...headers: Array<Required<Config>["headers"] | undefined>) => Headers;
|
|
14
|
-
type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
|
|
15
|
-
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
16
|
-
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
17
|
-
declare class Interceptors<Interceptor> {
|
|
18
|
-
fns: Array<Interceptor | null>;
|
|
19
|
-
clear(): void;
|
|
20
|
-
eject(id: number | Interceptor): void;
|
|
21
|
-
exists(id: number | Interceptor): boolean;
|
|
22
|
-
getInterceptorIndex(id: number | Interceptor): number;
|
|
23
|
-
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
24
|
-
use(fn: Interceptor): number;
|
|
25
|
-
}
|
|
26
|
-
export interface Middleware<Req, Res, Err, Options> {
|
|
27
|
-
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
28
|
-
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
29
|
-
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
30
|
-
}
|
|
31
|
-
export declare const createInterceptors: <Req, Res, Err, Options>() => Middleware<Req, Res, Err, Options>;
|
|
32
|
-
export declare const createConfig: <T extends ClientOptions = ClientOptions>(override?: Config<Omit<ClientOptions, keyof T> & T>) => Config<Omit<ClientOptions, keyof T> & T>;
|
|
33
|
-
export {};
|