@povio/openapi-codegen-cli 3.2.0-rc.8 → 3.3.0-rc.1
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 +2 -51
- package/dist/acl.d.mts +19 -6
- package/dist/acl.mjs +7 -6
- package/dist/{auth.context-YFWzkwoN.mjs → auth.context-BAz8frX9.mjs} +1 -2
- package/dist/{config-DgrOddSC.d.mts → config-BQqze8rU.d.mts} +2 -1
- package/dist/{error-handling-BMXC5P08.mjs → error-handling-CsnufAil.mjs} +12 -22
- package/dist/{error-handling-CNOHs4Fc.d.mts → error-handling-D6ZYITQ3.d.mts} +4 -1
- package/dist/generate.runner-BeCGJ1ar.mjs +87 -0
- package/dist/{generateCodeFromOpenAPIDoc-CZT3sThI.cjs → generateCodeFromOpenAPIDoc-KQT4kYxY.mjs} +2375 -1403
- package/dist/generator.d.mts +10 -3
- package/dist/generator.mjs +4 -6
- package/dist/index.d.mts +47 -12
- package/dist/index.mjs +3 -6
- package/dist/metro.cjs +4861 -112
- package/dist/metro.d.mts +4 -3
- package/dist/metro.mjs +3 -3
- package/dist/{openapi-codegen.runner-C93V7SGj.mjs → openapi-codegen.runner-nPBssrBL.mjs} +2 -2
- package/dist/{openapi-source.runner-BZ6ZLgRO.mjs → openapi-source.runner-8kCe-g9S.mjs} +6 -18
- package/dist/{openapi-source.runner-ykstqlPC.d.mts → openapi-source.runner-B6KKrXw7.d.mts} +8 -2
- package/dist/{options-KPf-Fti5.d.mts → options-DdQJ9BSc.d.mts} +1 -6
- package/dist/sh.d.mts +1 -1
- package/dist/sh.mjs +53 -36
- package/dist/tiny.d.mts +1 -1
- package/dist/tiny.mjs +1 -1
- package/dist/vite.d.mts +4 -3
- package/dist/vite.mjs +4 -5
- package/dist/zod.d.mts +7 -2
- package/dist/zod.mjs +1 -1
- package/package.json +22 -32
- package/dist/generate.runner-BvSprH6D.mjs +0 -1683
- package/dist/generate.utils-CH2U2Dpr.cjs +0 -2314
- package/dist/generateCodeFromOpenAPIDoc-glAKBEGP.mjs +0 -2036
- package/dist/getDataFromOpenAPIDoc-7RxjULpB.mjs +0 -2011
- package/dist/native-rest-interceptor-CAWR8H5Y.mjs +0 -208
- package/dist/native-rest-interceptor-Cz6saoq5.d.mts +0 -46
- package/dist/native.d.mts +0 -3
- package/dist/native.mjs +0 -3
- package/dist/openapi-codegen-native-darwin-arm64.node +0 -0
- package/dist/openapi-codegen-native-linux-x64.node +0 -0
- package/dist/openapi-codegen-native-win32-x64.node +0 -0
- package/dist/rest-transport.types-DM5-qyOJ.d.mts +0 -66
- package/dist/rest-transport.types-DxitRtsB.mjs +0 -11
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -2
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { t as HttpError } from "./rest-transport.types-DxitRtsB.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
//#region src/lib/rest/native-rest-client.ts
|
|
4
|
-
var NativeRestClient = class {
|
|
5
|
-
interceptors;
|
|
6
|
-
constructor({ config, interceptors = [] } = {}) {
|
|
7
|
-
this.baseURL = config?.baseURL ?? "";
|
|
8
|
-
this.headers = config?.headers;
|
|
9
|
-
this.credentials = config?.credentials;
|
|
10
|
-
this.fetch = config?.fetch ?? globalThis.fetch.bind(globalThis);
|
|
11
|
-
this.interceptors = [...interceptors];
|
|
12
|
-
}
|
|
13
|
-
baseURL;
|
|
14
|
-
headers;
|
|
15
|
-
credentials;
|
|
16
|
-
fetch;
|
|
17
|
-
attachInterceptor(interceptor) {
|
|
18
|
-
this.interceptors.push(interceptor);
|
|
19
|
-
}
|
|
20
|
-
ejectInterceptor(interceptor) {
|
|
21
|
-
const index = this.interceptors.indexOf(interceptor);
|
|
22
|
-
if (index >= 0) this.interceptors.splice(index, 1);
|
|
23
|
-
}
|
|
24
|
-
get(info, url, config) {
|
|
25
|
-
return this.request(info, "GET", url, void 0, config);
|
|
26
|
-
}
|
|
27
|
-
post(info, url, data, config) {
|
|
28
|
-
return this.request(info, "POST", url, data, config);
|
|
29
|
-
}
|
|
30
|
-
patch(info, url, data, config) {
|
|
31
|
-
return this.request(info, "PATCH", url, data, config);
|
|
32
|
-
}
|
|
33
|
-
put(info, url, data, config) {
|
|
34
|
-
return this.request(info, "PUT", url, data, config);
|
|
35
|
-
}
|
|
36
|
-
delete(info, url, data, config) {
|
|
37
|
-
return this.request(info, "DELETE", url, data, config);
|
|
38
|
-
}
|
|
39
|
-
async upload(url, data, config = {}, method = "put") {
|
|
40
|
-
if (config.onUploadProgress && typeof XMLHttpRequest !== "undefined") {
|
|
41
|
-
await this.uploadWithXhr(url, data, config, method);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
await this.execute({
|
|
45
|
-
url,
|
|
46
|
-
method: method.toUpperCase(),
|
|
47
|
-
body: data,
|
|
48
|
-
headers: new Headers(config.headers),
|
|
49
|
-
signal: config.signal
|
|
50
|
-
}, config, false);
|
|
51
|
-
}
|
|
52
|
-
async request(info, method, path, data, config = {}) {
|
|
53
|
-
const errorStack = (/* @__PURE__ */ new Error()).stack;
|
|
54
|
-
try {
|
|
55
|
-
const headers = new Headers(this.headers);
|
|
56
|
-
new Headers(config.headers).forEach((value, key) => headers.set(key, value));
|
|
57
|
-
let body;
|
|
58
|
-
if (data != null) if (data instanceof FormData || data instanceof Blob || typeof data === "string") body = data;
|
|
59
|
-
else {
|
|
60
|
-
body = JSON.stringify(data);
|
|
61
|
-
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
62
|
-
}
|
|
63
|
-
const request = {
|
|
64
|
-
url: this.resolveUrl(path, config.params),
|
|
65
|
-
method,
|
|
66
|
-
headers,
|
|
67
|
-
body,
|
|
68
|
-
signal: config.signal,
|
|
69
|
-
credentials: config.credentials ?? this.credentials
|
|
70
|
-
};
|
|
71
|
-
const response = await this.execute(request, config);
|
|
72
|
-
const parseResult = info.resSchema.safeParse(response.data);
|
|
73
|
-
let dataResult;
|
|
74
|
-
if (parseResult.success) dataResult = parseResult.data;
|
|
75
|
-
else if (config.allowInvalidResponseData && method === "GET") {
|
|
76
|
-
parseResult.error.name = "BE Response schema mismatch - ZodError";
|
|
77
|
-
parseResult.error.stack = [parseResult.error.stack, ...errorStack?.split("\n").slice(2) ?? []].join("\n");
|
|
78
|
-
console.error(parseResult.error);
|
|
79
|
-
dataResult = response.data;
|
|
80
|
-
} else throw parseResult.error;
|
|
81
|
-
return config.rawResponse ? {
|
|
82
|
-
...response,
|
|
83
|
-
data: dataResult
|
|
84
|
-
} : dataResult;
|
|
85
|
-
} catch (error) {
|
|
86
|
-
if (error instanceof z.ZodError) error.name = "BE Response schema mismatch - ZodError";
|
|
87
|
-
throw await this.runErrorInterceptors(error);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async execute(request, config = {}, applyInterceptors = true) {
|
|
91
|
-
let next = request;
|
|
92
|
-
if (applyInterceptors) for (const interceptor of this.interceptors) next = await interceptor.onRequest?.(next) ?? next;
|
|
93
|
-
const timeoutController = config.timeout ? new AbortController() : void 0;
|
|
94
|
-
const timer = timeoutController ? setTimeout(() => timeoutController.abort(), config.timeout) : void 0;
|
|
95
|
-
if (timeoutController && next.signal) if (next.signal.aborted) timeoutController.abort(next.signal.reason);
|
|
96
|
-
else next.signal.addEventListener("abort", () => timeoutController.abort(next.signal?.reason), { once: true });
|
|
97
|
-
const signal = timeoutController?.signal ?? next.signal;
|
|
98
|
-
try {
|
|
99
|
-
const res = await this.fetch(next.url, {
|
|
100
|
-
method: next.method,
|
|
101
|
-
headers: next.headers,
|
|
102
|
-
body: next.body,
|
|
103
|
-
signal,
|
|
104
|
-
credentials: next.credentials
|
|
105
|
-
});
|
|
106
|
-
let response = {
|
|
107
|
-
data: await this.readResponse(res, config.responseType),
|
|
108
|
-
status: res.status,
|
|
109
|
-
statusText: res.statusText,
|
|
110
|
-
headers: res.headers,
|
|
111
|
-
url: res.url
|
|
112
|
-
};
|
|
113
|
-
if (!res.ok) throw new HttpError(`Request failed with status ${res.status}`, response);
|
|
114
|
-
if (applyInterceptors) for (const interceptor of this.interceptors) response = await interceptor.onResponse?.(response) ?? response;
|
|
115
|
-
return response;
|
|
116
|
-
} catch (error) {
|
|
117
|
-
if (!applyInterceptors) throw error;
|
|
118
|
-
const context = {
|
|
119
|
-
request: next,
|
|
120
|
-
response: error instanceof HttpError ? error.response : void 0,
|
|
121
|
-
retry: (request = next) => this.execute({
|
|
122
|
-
...request,
|
|
123
|
-
retryCount: (next.retryCount ?? 0) + 1
|
|
124
|
-
}, config, true)
|
|
125
|
-
};
|
|
126
|
-
const transformed = await this.runErrorInterceptors(error, context);
|
|
127
|
-
if (this.isTransportResponse(transformed)) return transformed;
|
|
128
|
-
throw transformed;
|
|
129
|
-
} finally {
|
|
130
|
-
if (timer) clearTimeout(timer);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
async readResponse(response, type) {
|
|
134
|
-
if (response.status === 204) return void 0;
|
|
135
|
-
if (type === "blob") return response.blob();
|
|
136
|
-
if (type === "arrayBuffer") return response.arrayBuffer();
|
|
137
|
-
if (type === "text") return response.text();
|
|
138
|
-
const text = await response.text();
|
|
139
|
-
if (text === "") return void 0;
|
|
140
|
-
if (!response.headers.get("content-type")?.includes("json")) try {
|
|
141
|
-
return JSON.parse(text);
|
|
142
|
-
} catch {
|
|
143
|
-
return text;
|
|
144
|
-
}
|
|
145
|
-
return JSON.parse(text);
|
|
146
|
-
}
|
|
147
|
-
resolveUrl(path, params) {
|
|
148
|
-
const baseURL = this.baseURL && !this.baseURL.endsWith("/") ? `${this.baseURL}/` : this.baseURL;
|
|
149
|
-
const url = /^https?:\/\//.test(path) ? new URL(path) : new URL(path.replace(/^\//, ""), baseURL || globalThis.location?.origin);
|
|
150
|
-
for (const [key, value] of Object.entries(params ?? {})) {
|
|
151
|
-
if (value == null) continue;
|
|
152
|
-
if (Array.isArray(value)) value.forEach((item) => url.searchParams.append(key, String(item)));
|
|
153
|
-
else url.searchParams.append(key, String(value));
|
|
154
|
-
}
|
|
155
|
-
return url.toString();
|
|
156
|
-
}
|
|
157
|
-
async runErrorInterceptors(error, context) {
|
|
158
|
-
let next = error;
|
|
159
|
-
if (!context) return next;
|
|
160
|
-
for (const interceptor of [...this.interceptors].reverse()) if (interceptor.onError) try {
|
|
161
|
-
next = await interceptor.onError(next, context);
|
|
162
|
-
} catch (transformed) {
|
|
163
|
-
next = transformed;
|
|
164
|
-
}
|
|
165
|
-
return next;
|
|
166
|
-
}
|
|
167
|
-
isTransportResponse(value) {
|
|
168
|
-
return !!value && typeof value === "object" && "status" in value && "headers" in value && "data" in value;
|
|
169
|
-
}
|
|
170
|
-
uploadWithXhr(url, data, config, method) {
|
|
171
|
-
return new Promise((resolve, reject) => {
|
|
172
|
-
const xhr = new XMLHttpRequest();
|
|
173
|
-
xhr.open(method.toUpperCase(), url);
|
|
174
|
-
new Headers(config.headers).forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
175
|
-
if (config.timeout) xhr.timeout = config.timeout;
|
|
176
|
-
xhr.upload.onprogress = ({ loaded, total }) => config.onUploadProgress?.({
|
|
177
|
-
loaded,
|
|
178
|
-
total
|
|
179
|
-
});
|
|
180
|
-
xhr.onload = () => xhr.status >= 200 && xhr.status < 300 ? resolve() : reject(/* @__PURE__ */ new Error(`Upload failed with status ${xhr.status}`));
|
|
181
|
-
xhr.onerror = () => reject(/* @__PURE__ */ new TypeError("Network request failed"));
|
|
182
|
-
xhr.ontimeout = () => reject(new DOMException("Request timed out", "TimeoutError"));
|
|
183
|
-
config.signal?.addEventListener("abort", () => xhr.abort(), { once: true });
|
|
184
|
-
xhr.onabort = () => reject(config.signal?.reason ?? new DOMException("Request aborted", "AbortError"));
|
|
185
|
-
xhr.send(data);
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/lib/rest/native-rest-interceptor.ts
|
|
191
|
-
var NativeRestInterceptor = class {
|
|
192
|
-
interceptor;
|
|
193
|
-
constructor(interceptor) {
|
|
194
|
-
this.interceptor = interceptor;
|
|
195
|
-
}
|
|
196
|
-
onRequest(request) {
|
|
197
|
-
return this.interceptor.onRequest?.(request) ?? request;
|
|
198
|
-
}
|
|
199
|
-
onResponse(response) {
|
|
200
|
-
return this.interceptor.onResponse?.(response) ?? response;
|
|
201
|
-
}
|
|
202
|
-
onError(error, context) {
|
|
203
|
-
if (!this.interceptor.onError) throw error;
|
|
204
|
-
return this.interceptor.onError(error, context);
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
//#endregion
|
|
208
|
-
export { NativeRestClient as n, NativeRestInterceptor as t };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { a as RestTransport, c as TransportFetch, d as TransportResponse, l as TransportRequest, o as RestTransportInterceptor, r as RestRequestInfo, s as TransportErrorContext, t as GeneralTransportErrorCode, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
|
|
2
|
-
//#region src/lib/rest/native-rest-client.d.ts
|
|
3
|
-
type NativeResult<T, IsRawRes extends boolean> = IsRawRes extends true ? TransportResponse<T> : T;
|
|
4
|
-
declare class NativeRestClient implements RestTransport {
|
|
5
|
-
private readonly interceptors;
|
|
6
|
-
constructor({ config, interceptors }?: {
|
|
7
|
-
config?: {
|
|
8
|
-
baseURL?: string;
|
|
9
|
-
headers?: HeadersInit;
|
|
10
|
-
credentials?: RequestCredentials;
|
|
11
|
-
fetch?: TransportFetch;
|
|
12
|
-
};
|
|
13
|
-
interceptors?: RestTransportInterceptor[];
|
|
14
|
-
});
|
|
15
|
-
private readonly baseURL;
|
|
16
|
-
private readonly headers?;
|
|
17
|
-
private readonly credentials?;
|
|
18
|
-
private readonly fetch;
|
|
19
|
-
attachInterceptor(interceptor: RestTransportInterceptor): void;
|
|
20
|
-
ejectInterceptor(interceptor: RestTransportInterceptor): void;
|
|
21
|
-
get<T, E extends string = GeneralTransportErrorCode, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, config?: TransportRequestConfig<R>): Promise<NativeResult<T, R>>;
|
|
22
|
-
post<T, E extends string = GeneralTransportErrorCode, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, data?: unknown, config?: TransportRequestConfig<R>): Promise<NativeResult<T, R>>;
|
|
23
|
-
patch<T, E extends string = GeneralTransportErrorCode, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, data?: unknown, config?: TransportRequestConfig<R>): Promise<NativeResult<T, R>>;
|
|
24
|
-
put<T, E extends string = GeneralTransportErrorCode, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, data?: unknown, config?: TransportRequestConfig<R>): Promise<NativeResult<T, R>>;
|
|
25
|
-
delete<T, E extends string = GeneralTransportErrorCode, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, data?: unknown, config?: TransportRequestConfig<R>): Promise<NativeResult<T, R>>;
|
|
26
|
-
upload(url: string, data: BodyInit, config?: TransportRequestConfig, method?: "put" | "post"): Promise<void>;
|
|
27
|
-
private request;
|
|
28
|
-
private execute;
|
|
29
|
-
private readResponse;
|
|
30
|
-
private resolveUrl;
|
|
31
|
-
private runErrorInterceptors;
|
|
32
|
-
private isTransportResponse;
|
|
33
|
-
private uploadWithXhr;
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/lib/rest/native-rest-interceptor.d.ts
|
|
37
|
-
type NativeInterceptor = RestTransportInterceptor;
|
|
38
|
-
declare class NativeRestInterceptor implements RestTransportInterceptor {
|
|
39
|
-
private readonly interceptor;
|
|
40
|
-
constructor(interceptor: RestTransportInterceptor);
|
|
41
|
-
onRequest(request: TransportRequest): Promise<TransportRequest> | TransportRequest;
|
|
42
|
-
onResponse<T>(response: TransportResponse<T>): Promise<TransportResponse<T>> | TransportResponse<T>;
|
|
43
|
-
onError(error: unknown, context: TransportErrorContext): unknown;
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
export { NativeRestInterceptor as n, NativeRestClient as r, NativeInterceptor as t };
|
package/dist/native.d.mts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { a as RestTransport, d as TransportResponse, f as TransportResult, i as RestResponseType, l as TransportRequest, n as HttpError, o as RestTransportInterceptor, p as UploadProgress, r as RestRequestInfo, t as GeneralTransportErrorCode, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
|
|
2
|
-
import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-Cz6saoq5.mjs";
|
|
3
|
-
export { type GeneralTransportErrorCode, HttpError, HttpError as NativeHttpError, type NativeInterceptor, type TransportRequest as NativeRequest, type TransportRequest, type TransportRequestConfig as NativeRequestConfig, type TransportRequestConfig, type TransportResponse as NativeResponse, type TransportResponse, NativeRestClient, NativeRestInterceptor, type UploadProgress as NativeUploadProgress, type UploadProgress, type RestRequestInfo, type RestResponseType, type RestTransport, type RestTransportInterceptor, type TransportResult };
|
package/dist/native.mjs
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region src/lib/rest/rest-transport.types.d.ts
|
|
3
|
-
type GeneralTransportErrorCode = "DATA_VALIDATION_ERROR" | "NETWORK_ERROR" | "CANCELED_ERROR" | "INTERNAL_ERROR" | "UNKNOWN_ERROR";
|
|
4
|
-
type RestResponseType = "json" | "text" | "blob" | "arrayBuffer";
|
|
5
|
-
type TransportFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
6
|
-
interface UploadProgress {
|
|
7
|
-
loaded: number;
|
|
8
|
-
total: number;
|
|
9
|
-
}
|
|
10
|
-
interface TransportRequestConfig<IsRawRes extends boolean = false> {
|
|
11
|
-
headers?: HeadersInit;
|
|
12
|
-
params?: Record<string, unknown>;
|
|
13
|
-
signal?: AbortSignal;
|
|
14
|
-
timeout?: number;
|
|
15
|
-
credentials?: RequestCredentials;
|
|
16
|
-
responseType?: RestResponseType;
|
|
17
|
-
rawResponse?: IsRawRes;
|
|
18
|
-
allowInvalidResponseData?: boolean;
|
|
19
|
-
onUploadProgress?: (progress: UploadProgress) => void;
|
|
20
|
-
}
|
|
21
|
-
interface TransportResponse<T> {
|
|
22
|
-
data: T;
|
|
23
|
-
status: number;
|
|
24
|
-
statusText: string;
|
|
25
|
-
headers: Headers;
|
|
26
|
-
url: string;
|
|
27
|
-
}
|
|
28
|
-
interface RestRequestInfo<ZOutput, ECodes extends string> {
|
|
29
|
-
resSchema: z.ZodType<ZOutput>;
|
|
30
|
-
}
|
|
31
|
-
interface TransportRequest {
|
|
32
|
-
url: string;
|
|
33
|
-
method: string;
|
|
34
|
-
headers: Headers;
|
|
35
|
-
body?: BodyInit | null;
|
|
36
|
-
signal?: AbortSignal;
|
|
37
|
-
credentials?: RequestCredentials;
|
|
38
|
-
retryCount?: number;
|
|
39
|
-
}
|
|
40
|
-
interface TransportErrorContext {
|
|
41
|
-
request: TransportRequest;
|
|
42
|
-
response?: TransportResponse<unknown>;
|
|
43
|
-
retry(request?: TransportRequest): Promise<TransportResponse<unknown>>;
|
|
44
|
-
}
|
|
45
|
-
interface RestTransportInterceptor {
|
|
46
|
-
onRequest?(request: TransportRequest): TransportRequest | Promise<TransportRequest>;
|
|
47
|
-
onResponse?<T>(response: TransportResponse<T>): TransportResponse<T> | Promise<TransportResponse<T>>;
|
|
48
|
-
onError?(error: unknown, context: TransportErrorContext): unknown | Promise<unknown>;
|
|
49
|
-
}
|
|
50
|
-
type TransportResult<T, IsRawRes extends boolean> = IsRawRes extends true ? TransportResponse<T> : T;
|
|
51
|
-
interface RestTransport {
|
|
52
|
-
attachInterceptor(interceptor: RestTransportInterceptor): void;
|
|
53
|
-
ejectInterceptor(interceptor: RestTransportInterceptor): void;
|
|
54
|
-
get<T, E extends string, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, config?: TransportRequestConfig<R>): Promise<TransportResult<T, R>>;
|
|
55
|
-
post<T, E extends string, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, data?: unknown, config?: TransportRequestConfig<R>): Promise<TransportResult<T, R>>;
|
|
56
|
-
patch<T, E extends string, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, data?: unknown, config?: TransportRequestConfig<R>): Promise<TransportResult<T, R>>;
|
|
57
|
-
put<T, E extends string, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, data?: unknown, config?: TransportRequestConfig<R>): Promise<TransportResult<T, R>>;
|
|
58
|
-
delete<T, E extends string, R extends boolean = false>(info: RestRequestInfo<T, E>, url: string, data?: unknown, config?: TransportRequestConfig<R>): Promise<TransportResult<T, R>>;
|
|
59
|
-
upload(url: string, data: BodyInit, config?: TransportRequestConfig, method?: "put" | "post"): Promise<void>;
|
|
60
|
-
}
|
|
61
|
-
declare class HttpError<T = unknown> extends Error {
|
|
62
|
-
readonly response: TransportResponse<T>;
|
|
63
|
-
constructor(message: string, response: TransportResponse<T>);
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
export { RestTransport as a, TransportFetch as c, TransportResponse as d, TransportResult as f, RestResponseType as i, TransportRequest as l, HttpError as n, RestTransportInterceptor as o, UploadProgress as p, RestRequestInfo as r, TransportErrorContext as s, GeneralTransportErrorCode as t, TransportRequestConfig as u };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region src/lib/rest/rest-transport.types.ts
|
|
2
|
-
var HttpError = class extends Error {
|
|
3
|
-
response;
|
|
4
|
-
constructor(message, response) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.response = response;
|
|
7
|
-
this.name = "HttpError";
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
export { HttpError as t };
|
package/dist/rest.d.mts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { a as RestTransport, d as TransportResponse, f as TransportResult, i as RestResponseType, l as TransportRequest, n as HttpError, o as RestTransportInterceptor, p as UploadProgress, r as RestRequestInfo, t as GeneralTransportErrorCode, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
|
|
2
|
-
export { type GeneralTransportErrorCode, HttpError, type RestRequestInfo, type RestResponseType, type RestTransport, type RestTransportInterceptor, type TransportRequest, type TransportRequestConfig, type TransportResponse, type TransportResult, type UploadProgress };
|
package/dist/rest.mjs
DELETED