@oiyo/framework 0.3.10 → 0.4.0-beta.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/dist/{chunk-BM2gq5Zj.cjs → chunk-CPOuyFJX.cjs} +1 -1
- package/dist/{chunk-DFzgTjC9.mjs → chunk-CzvwBCEU.mjs} +1 -1
- package/dist/index-DzsQka7j.d.cts +234 -0
- package/dist/index-DzsQka7j.d.mts +234 -0
- package/dist/index.cjs +6 -2
- package/dist/index.d.cts +8 -2
- package/dist/index.d.mts +8 -2
- package/dist/index.mjs +4 -3
- package/dist/oiyo-CdQ_-aZW.mjs +7 -0
- package/dist/oiyo-DZ6BFYIw.cjs +7 -0
- package/dist/oiyo.cjs +11 -0
- package/dist/oiyo.d.cts +8 -0
- package/dist/oiyo.d.mts +8 -0
- package/dist/oiyo.mjs +8 -0
- package/dist/uni.cjs +2 -2
- package/dist/uni.d.cts +1 -1
- package/dist/uni.d.mts +1 -1
- package/dist/uni.mjs +2 -2
- package/dist/vue.cjs +2 -2
- package/dist/vue.d.cts +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.mjs +2 -2
- package/package.json +9 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
|
+
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
|
+
* Commercial software. See LICENSE for terms.
|
|
5
|
+
* Official site: https://oiyo.js.org
|
|
6
|
+
*/
|
|
7
|
+
//#region src/oiyo/vessel/abort.d.ts
|
|
8
|
+
type AbortListener = (this: BeaconSignal, event: {
|
|
9
|
+
type: 'abort';
|
|
10
|
+
}) => void;
|
|
11
|
+
declare class Emitter {
|
|
12
|
+
private listeners;
|
|
13
|
+
addEventListener(type: 'abort', listener: AbortListener): void;
|
|
14
|
+
removeEventListener(type: 'abort', listener: AbortListener): void;
|
|
15
|
+
protected emit(event: {
|
|
16
|
+
type: 'abort';
|
|
17
|
+
}): void;
|
|
18
|
+
}
|
|
19
|
+
declare class BeaconSignal extends Emitter {
|
|
20
|
+
aborted: boolean;
|
|
21
|
+
reason: any;
|
|
22
|
+
onabort: AbortListener | null;
|
|
23
|
+
/**
|
|
24
|
+
* 内部使用:标记中断并派发 `abort` 事件(幂等)。
|
|
25
|
+
*/
|
|
26
|
+
_abort(reason?: any): void;
|
|
27
|
+
/**
|
|
28
|
+
* 已中断则抛出 `reason`,否则什么都不做。
|
|
29
|
+
*/
|
|
30
|
+
throwIfAborted(): void;
|
|
31
|
+
}
|
|
32
|
+
interface Beacon {
|
|
33
|
+
readonly signal: BeaconSignal;
|
|
34
|
+
abort: (reason?: any) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 创建一个中断信标。
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* const beacon = createBeacon()
|
|
41
|
+
* vessel.request('/pet/1', { signal: beacon.signal })
|
|
42
|
+
* beacon.abort()
|
|
43
|
+
*/
|
|
44
|
+
declare function createBeacon(): Beacon;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/oiyo/vessel/types/utils.d.ts
|
|
47
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
48
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/oiyo/vessel/types/body.d.ts
|
|
51
|
+
interface ResponseBodyTypeMap {
|
|
52
|
+
text: string;
|
|
53
|
+
arrayBuffer: ArrayBuffer;
|
|
54
|
+
}
|
|
55
|
+
type ResponseBodyType = Prettify<keyof ResponseBodyTypeMap | 'json'>;
|
|
56
|
+
type MappedResponseBodyType<TRBType extends ResponseBodyType, TRBJsonType = any> = TRBType extends keyof ResponseBodyTypeMap ? ResponseBodyTypeMap[TRBType] : TRBJsonType;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/oiyo/vessel/types/uni.d.ts
|
|
59
|
+
type UniAppRequestOptions = Omit<UniNamespace.RequestOptions, 'url' | 'data' | 'header' | 'method' | 'timeout' | 'responseType' | 'success' | 'fail' | 'complete'>;
|
|
60
|
+
type UniAppRequestResponse<TRBody = any> = Prettify<Omit<UniNamespace.RequestSuccessCallbackResult, 'data'> & {
|
|
61
|
+
data: TRBody;
|
|
62
|
+
}>;
|
|
63
|
+
type UniAppUploadOptions = Omit<UniNamespace.UploadFileOption, 'url' | 'name' | 'header' | 'formData' | 'timeout' | 'success' | 'fail' | 'complete'>;
|
|
64
|
+
interface UniAppOnUploadProgress extends UniNamespace.OnProgressUpdateResult {}
|
|
65
|
+
type UniAppUploadResponse<TRBody = any> = Prettify<Omit<UniNamespace.UploadFileSuccessCallbackResult, 'data'> & {
|
|
66
|
+
data: TRBody;
|
|
67
|
+
}>;
|
|
68
|
+
type UniAppDownloadBodyType = 'json';
|
|
69
|
+
type UniAppDownloadBody = Prettify<Pick<UniNamespace.DownloadSuccessData, 'tempFilePath'>>;
|
|
70
|
+
type UniAppDownloadOptions = Omit<UniNamespace.DownloadFileOption, 'url' | 'header' | 'timeout' | 'success' | 'fail' | 'complete'>;
|
|
71
|
+
interface UniAppDownloadProgress extends UniNamespace.OnProgressDownloadResult {
|
|
72
|
+
progress: number;
|
|
73
|
+
totalBytesWritten: number;
|
|
74
|
+
totalBytesExpectedToWrite: number;
|
|
75
|
+
}
|
|
76
|
+
type UniAppDownloadResponse<TRBody = any> = Prettify<Omit<UniNamespace.DownloadSuccessData, keyof UniAppDownloadBody> & {
|
|
77
|
+
data: TRBody;
|
|
78
|
+
}>;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/oiyo/vessel/types/options.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* 响应头监听回调入参。
|
|
83
|
+
*/
|
|
84
|
+
interface HeadersReceived {
|
|
85
|
+
header: Record<string, string>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 所有请求共享的基础选项。
|
|
89
|
+
*/
|
|
90
|
+
interface VesselBaseOptions<TRBType extends ResponseBodyType = ResponseBodyType> {
|
|
91
|
+
baseURL?: string;
|
|
92
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT';
|
|
93
|
+
headers?: Record<string, string>;
|
|
94
|
+
query?: Record<string, any>;
|
|
95
|
+
body?: any;
|
|
96
|
+
timeout?: number;
|
|
97
|
+
/**
|
|
98
|
+
* 为 true 时返回完整响应对象(statusCode / header / data ...),
|
|
99
|
+
* 否则只返回精炼后的 data。
|
|
100
|
+
*/
|
|
101
|
+
raw?: boolean;
|
|
102
|
+
responseType?: TRBType;
|
|
103
|
+
parseResponse?: (responseText: string) => any;
|
|
104
|
+
retry?: number | false;
|
|
105
|
+
retryDelay?: number;
|
|
106
|
+
/**
|
|
107
|
+
* 重试的响应状态码
|
|
108
|
+
* @default [408, 409, 425, 429, 500, 502, 503, 504]
|
|
109
|
+
*/
|
|
110
|
+
retryStatusCodes?: number[];
|
|
111
|
+
ignoreResponseError?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 中断信号,由 `createBeacon()` 创建。
|
|
114
|
+
* 信号触发后请求会被中断;已中断的信号会让请求立即中断。
|
|
115
|
+
*/
|
|
116
|
+
signal?: BeaconSignal;
|
|
117
|
+
/**
|
|
118
|
+
* 监听响应头(对应 task.onHeadersReceived)。
|
|
119
|
+
*/
|
|
120
|
+
onHeadersReceived?: (result: HeadersReceived) => void;
|
|
121
|
+
}
|
|
122
|
+
interface VesselRequestOptions<TRBType extends ResponseBodyType = ResponseBodyType> extends VesselBaseOptions<TRBType>, UniAppRequestOptions {
|
|
123
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT';
|
|
124
|
+
}
|
|
125
|
+
interface VesselUploadOptions<TRBType extends ResponseBodyType = ResponseBodyType> extends VesselBaseOptions<TRBType>, UniAppUploadOptions {
|
|
126
|
+
/**
|
|
127
|
+
* 文件对应的 key
|
|
128
|
+
* @default - 'file'
|
|
129
|
+
*/
|
|
130
|
+
name?: string;
|
|
131
|
+
/**
|
|
132
|
+
* 上传请求方法
|
|
133
|
+
* @default - 'POST'
|
|
134
|
+
*/
|
|
135
|
+
method?: 'POST';
|
|
136
|
+
/**
|
|
137
|
+
* 监听上传进度(对应 task.onProgressUpdate)。
|
|
138
|
+
*/
|
|
139
|
+
onProgress?: (result: UniAppOnUploadProgress) => void;
|
|
140
|
+
}
|
|
141
|
+
interface VesselDownloadOptions<TRBType extends UniAppDownloadBodyType = 'json'> extends VesselBaseOptions<TRBType>, UniAppDownloadOptions {
|
|
142
|
+
/**
|
|
143
|
+
* 下载请求方法
|
|
144
|
+
* @default - 'GET'
|
|
145
|
+
*/
|
|
146
|
+
method?: 'GET';
|
|
147
|
+
/**
|
|
148
|
+
* 监听下载进度(对应 task.onProgressUpdate)。
|
|
149
|
+
*/
|
|
150
|
+
onProgress?: (result: UniAppDownloadProgress) => void;
|
|
151
|
+
}
|
|
152
|
+
type VesselURL = string;
|
|
153
|
+
type VesselOptions = VesselRequestOptions | VesselUploadOptions | VesselDownloadOptions;
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/oiyo/vessel/types/response.d.ts
|
|
156
|
+
type VesselRequestResponse<TRBody = any, TRBType extends ResponseBodyType = ResponseBodyType> = MappedResponseBodyType<TRBType, TRBody>;
|
|
157
|
+
type VesselUploadResponse<TRBody = any, TRBType extends ResponseBodyType = ResponseBodyType> = MappedResponseBodyType<TRBType, TRBody>;
|
|
158
|
+
type VesselDownloadResponse<TRBody extends UniAppDownloadBody = UniAppDownloadBody, TRBType extends UniAppDownloadBodyType = 'json'> = MappedResponseBodyType<TRBType, TRBody>;
|
|
159
|
+
type VesselRequestRawResponse<TRBody = any, TRBType extends ResponseBodyType = ResponseBodyType> = UniAppRequestResponse<MappedResponseBodyType<TRBType, TRBody>>;
|
|
160
|
+
type VesselUploadRawResponse<TRBody = any, TRBType extends ResponseBodyType = ResponseBodyType> = UniAppUploadResponse<MappedResponseBodyType<TRBType, TRBody>>;
|
|
161
|
+
type VesselDownloadRawResponse<TRBody extends UniAppDownloadBody = UniAppDownloadBody, TRBType extends UniAppDownloadBodyType = 'json'> = UniAppDownloadResponse<MappedResponseBodyType<TRBType, TRBody>>;
|
|
162
|
+
type VesselRawResponse<T = any> = VesselRequestRawResponse<T> | VesselUploadRawResponse<T> | VesselDownloadRawResponse;
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/oiyo/vessel/types/vessel.d.ts
|
|
165
|
+
interface VesselRequestMethod {
|
|
166
|
+
<TRBody = any, TRBType extends ResponseBodyType = 'json'>(resource: VesselURL, options: VesselRequestOptions<TRBType> & {
|
|
167
|
+
raw: true;
|
|
168
|
+
}): Promise<VesselRequestRawResponse<TRBody, TRBType>>;
|
|
169
|
+
<TRBody = any, TRBType extends ResponseBodyType = 'json'>(resource: VesselURL, options?: VesselRequestOptions<TRBType>): Promise<VesselRequestResponse<TRBody, TRBType>>;
|
|
170
|
+
}
|
|
171
|
+
interface VesselUploadMethod {
|
|
172
|
+
<TRBody = any, TRBType extends ResponseBodyType = 'json'>(resource: VesselURL, options: VesselUploadOptions<TRBType> & {
|
|
173
|
+
raw: true;
|
|
174
|
+
}): Promise<VesselUploadRawResponse<TRBody, TRBType>>;
|
|
175
|
+
<TRBody = any, TRBType extends ResponseBodyType = 'json'>(resource: VesselURL, options?: VesselUploadOptions<TRBType>): Promise<VesselUploadResponse<TRBody, TRBType>>;
|
|
176
|
+
}
|
|
177
|
+
interface VesselDownloadMethod {
|
|
178
|
+
<TRBody extends UniAppDownloadBody = UniAppDownloadBody, TRBType extends UniAppDownloadBodyType = UniAppDownloadBodyType>(resource: VesselURL, options: VesselDownloadOptions<TRBType> & {
|
|
179
|
+
raw: true;
|
|
180
|
+
}): Promise<VesselDownloadRawResponse<TRBody, TRBType>>;
|
|
181
|
+
<TRBody extends UniAppDownloadBody = UniAppDownloadBody, TRBType extends UniAppDownloadBodyType = UniAppDownloadBodyType>(resource: VesselURL, options?: VesselDownloadOptions<TRBType>): Promise<VesselDownloadResponse<TRBody, TRBType>>;
|
|
182
|
+
}
|
|
183
|
+
interface VesselHooks<TContextOptions, TResponse> {
|
|
184
|
+
onRequest?: (context: {
|
|
185
|
+
resource: VesselURL;
|
|
186
|
+
options: TContextOptions;
|
|
187
|
+
}) => MaybePromise<void>;
|
|
188
|
+
onRequestError?: (context: {
|
|
189
|
+
resource: VesselURL;
|
|
190
|
+
options: TContextOptions;
|
|
191
|
+
error: Error;
|
|
192
|
+
}) => MaybePromise<void>;
|
|
193
|
+
onResponse?: (context: {
|
|
194
|
+
resource: VesselURL;
|
|
195
|
+
options: TContextOptions;
|
|
196
|
+
response: TResponse;
|
|
197
|
+
}) => MaybePromise<void>;
|
|
198
|
+
onResponseError?: (context: {
|
|
199
|
+
resource: VesselURL;
|
|
200
|
+
options: TContextOptions;
|
|
201
|
+
response: TResponse;
|
|
202
|
+
}) => MaybePromise<void>;
|
|
203
|
+
}
|
|
204
|
+
interface VesselConfig extends VesselBaseOptions<ResponseBodyType>, VesselHooks<VesselConfig, VesselRawResponse> {}
|
|
205
|
+
interface VesselError<T = any> extends Error {
|
|
206
|
+
resource?: VesselURL;
|
|
207
|
+
options?: VesselOptions;
|
|
208
|
+
response?: VesselRawResponse<T>;
|
|
209
|
+
data: T;
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/oiyo/vessel/vessel.d.ts
|
|
213
|
+
interface Vessel {
|
|
214
|
+
/**
|
|
215
|
+
* 普通请求
|
|
216
|
+
*/
|
|
217
|
+
request: VesselRequestMethod;
|
|
218
|
+
/**
|
|
219
|
+
* 文件上传
|
|
220
|
+
*/
|
|
221
|
+
upload: VesselUploadMethod;
|
|
222
|
+
/**
|
|
223
|
+
* 文件下载
|
|
224
|
+
*/
|
|
225
|
+
download: VesselDownloadMethod;
|
|
226
|
+
/**
|
|
227
|
+
* 基于当前配置派生一个新实例。
|
|
228
|
+
*/
|
|
229
|
+
create: (config: VesselConfig) => Vessel;
|
|
230
|
+
}
|
|
231
|
+
declare function createVessel(globalConfig?: VesselConfig): Vessel;
|
|
232
|
+
declare const vessel: Vessel;
|
|
233
|
+
//#endregion
|
|
234
|
+
export { VesselDownloadResponse as a, VesselDownloadOptions as c, ResponseBodyType as d, createBeacon as f, VesselError as i, VesselRequestOptions as l, vessel as n, VesselRequestResponse as o, VesselConfig as r, VesselUploadResponse as s, createVessel as t, VesselUploadOptions as u };
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
|
+
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
|
+
* Commercial software. See LICENSE for terms.
|
|
5
|
+
* Official site: https://oiyo.js.org
|
|
6
|
+
*/
|
|
7
|
+
//#region src/oiyo/vessel/abort.d.ts
|
|
8
|
+
type AbortListener = (this: BeaconSignal, event: {
|
|
9
|
+
type: 'abort';
|
|
10
|
+
}) => void;
|
|
11
|
+
declare class Emitter {
|
|
12
|
+
private listeners;
|
|
13
|
+
addEventListener(type: 'abort', listener: AbortListener): void;
|
|
14
|
+
removeEventListener(type: 'abort', listener: AbortListener): void;
|
|
15
|
+
protected emit(event: {
|
|
16
|
+
type: 'abort';
|
|
17
|
+
}): void;
|
|
18
|
+
}
|
|
19
|
+
declare class BeaconSignal extends Emitter {
|
|
20
|
+
aborted: boolean;
|
|
21
|
+
reason: any;
|
|
22
|
+
onabort: AbortListener | null;
|
|
23
|
+
/**
|
|
24
|
+
* 内部使用:标记中断并派发 `abort` 事件(幂等)。
|
|
25
|
+
*/
|
|
26
|
+
_abort(reason?: any): void;
|
|
27
|
+
/**
|
|
28
|
+
* 已中断则抛出 `reason`,否则什么都不做。
|
|
29
|
+
*/
|
|
30
|
+
throwIfAborted(): void;
|
|
31
|
+
}
|
|
32
|
+
interface Beacon {
|
|
33
|
+
readonly signal: BeaconSignal;
|
|
34
|
+
abort: (reason?: any) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 创建一个中断信标。
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* const beacon = createBeacon()
|
|
41
|
+
* vessel.request('/pet/1', { signal: beacon.signal })
|
|
42
|
+
* beacon.abort()
|
|
43
|
+
*/
|
|
44
|
+
declare function createBeacon(): Beacon;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/oiyo/vessel/types/utils.d.ts
|
|
47
|
+
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
48
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/oiyo/vessel/types/body.d.ts
|
|
51
|
+
interface ResponseBodyTypeMap {
|
|
52
|
+
text: string;
|
|
53
|
+
arrayBuffer: ArrayBuffer;
|
|
54
|
+
}
|
|
55
|
+
type ResponseBodyType = Prettify<keyof ResponseBodyTypeMap | 'json'>;
|
|
56
|
+
type MappedResponseBodyType<TRBType extends ResponseBodyType, TRBJsonType = any> = TRBType extends keyof ResponseBodyTypeMap ? ResponseBodyTypeMap[TRBType] : TRBJsonType;
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/oiyo/vessel/types/uni.d.ts
|
|
59
|
+
type UniAppRequestOptions = Omit<UniNamespace.RequestOptions, 'url' | 'data' | 'header' | 'method' | 'timeout' | 'responseType' | 'success' | 'fail' | 'complete'>;
|
|
60
|
+
type UniAppRequestResponse<TRBody = any> = Prettify<Omit<UniNamespace.RequestSuccessCallbackResult, 'data'> & {
|
|
61
|
+
data: TRBody;
|
|
62
|
+
}>;
|
|
63
|
+
type UniAppUploadOptions = Omit<UniNamespace.UploadFileOption, 'url' | 'name' | 'header' | 'formData' | 'timeout' | 'success' | 'fail' | 'complete'>;
|
|
64
|
+
interface UniAppOnUploadProgress extends UniNamespace.OnProgressUpdateResult {}
|
|
65
|
+
type UniAppUploadResponse<TRBody = any> = Prettify<Omit<UniNamespace.UploadFileSuccessCallbackResult, 'data'> & {
|
|
66
|
+
data: TRBody;
|
|
67
|
+
}>;
|
|
68
|
+
type UniAppDownloadBodyType = 'json';
|
|
69
|
+
type UniAppDownloadBody = Prettify<Pick<UniNamespace.DownloadSuccessData, 'tempFilePath'>>;
|
|
70
|
+
type UniAppDownloadOptions = Omit<UniNamespace.DownloadFileOption, 'url' | 'header' | 'timeout' | 'success' | 'fail' | 'complete'>;
|
|
71
|
+
interface UniAppDownloadProgress extends UniNamespace.OnProgressDownloadResult {
|
|
72
|
+
progress: number;
|
|
73
|
+
totalBytesWritten: number;
|
|
74
|
+
totalBytesExpectedToWrite: number;
|
|
75
|
+
}
|
|
76
|
+
type UniAppDownloadResponse<TRBody = any> = Prettify<Omit<UniNamespace.DownloadSuccessData, keyof UniAppDownloadBody> & {
|
|
77
|
+
data: TRBody;
|
|
78
|
+
}>;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/oiyo/vessel/types/options.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* 响应头监听回调入参。
|
|
83
|
+
*/
|
|
84
|
+
interface HeadersReceived {
|
|
85
|
+
header: Record<string, string>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 所有请求共享的基础选项。
|
|
89
|
+
*/
|
|
90
|
+
interface VesselBaseOptions<TRBType extends ResponseBodyType = ResponseBodyType> {
|
|
91
|
+
baseURL?: string;
|
|
92
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT';
|
|
93
|
+
headers?: Record<string, string>;
|
|
94
|
+
query?: Record<string, any>;
|
|
95
|
+
body?: any;
|
|
96
|
+
timeout?: number;
|
|
97
|
+
/**
|
|
98
|
+
* 为 true 时返回完整响应对象(statusCode / header / data ...),
|
|
99
|
+
* 否则只返回精炼后的 data。
|
|
100
|
+
*/
|
|
101
|
+
raw?: boolean;
|
|
102
|
+
responseType?: TRBType;
|
|
103
|
+
parseResponse?: (responseText: string) => any;
|
|
104
|
+
retry?: number | false;
|
|
105
|
+
retryDelay?: number;
|
|
106
|
+
/**
|
|
107
|
+
* 重试的响应状态码
|
|
108
|
+
* @default [408, 409, 425, 429, 500, 502, 503, 504]
|
|
109
|
+
*/
|
|
110
|
+
retryStatusCodes?: number[];
|
|
111
|
+
ignoreResponseError?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 中断信号,由 `createBeacon()` 创建。
|
|
114
|
+
* 信号触发后请求会被中断;已中断的信号会让请求立即中断。
|
|
115
|
+
*/
|
|
116
|
+
signal?: BeaconSignal;
|
|
117
|
+
/**
|
|
118
|
+
* 监听响应头(对应 task.onHeadersReceived)。
|
|
119
|
+
*/
|
|
120
|
+
onHeadersReceived?: (result: HeadersReceived) => void;
|
|
121
|
+
}
|
|
122
|
+
interface VesselRequestOptions<TRBType extends ResponseBodyType = ResponseBodyType> extends VesselBaseOptions<TRBType>, UniAppRequestOptions {
|
|
123
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'CONNECT';
|
|
124
|
+
}
|
|
125
|
+
interface VesselUploadOptions<TRBType extends ResponseBodyType = ResponseBodyType> extends VesselBaseOptions<TRBType>, UniAppUploadOptions {
|
|
126
|
+
/**
|
|
127
|
+
* 文件对应的 key
|
|
128
|
+
* @default - 'file'
|
|
129
|
+
*/
|
|
130
|
+
name?: string;
|
|
131
|
+
/**
|
|
132
|
+
* 上传请求方法
|
|
133
|
+
* @default - 'POST'
|
|
134
|
+
*/
|
|
135
|
+
method?: 'POST';
|
|
136
|
+
/**
|
|
137
|
+
* 监听上传进度(对应 task.onProgressUpdate)。
|
|
138
|
+
*/
|
|
139
|
+
onProgress?: (result: UniAppOnUploadProgress) => void;
|
|
140
|
+
}
|
|
141
|
+
interface VesselDownloadOptions<TRBType extends UniAppDownloadBodyType = 'json'> extends VesselBaseOptions<TRBType>, UniAppDownloadOptions {
|
|
142
|
+
/**
|
|
143
|
+
* 下载请求方法
|
|
144
|
+
* @default - 'GET'
|
|
145
|
+
*/
|
|
146
|
+
method?: 'GET';
|
|
147
|
+
/**
|
|
148
|
+
* 监听下载进度(对应 task.onProgressUpdate)。
|
|
149
|
+
*/
|
|
150
|
+
onProgress?: (result: UniAppDownloadProgress) => void;
|
|
151
|
+
}
|
|
152
|
+
type VesselURL = string;
|
|
153
|
+
type VesselOptions = VesselRequestOptions | VesselUploadOptions | VesselDownloadOptions;
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/oiyo/vessel/types/response.d.ts
|
|
156
|
+
type VesselRequestResponse<TRBody = any, TRBType extends ResponseBodyType = ResponseBodyType> = MappedResponseBodyType<TRBType, TRBody>;
|
|
157
|
+
type VesselUploadResponse<TRBody = any, TRBType extends ResponseBodyType = ResponseBodyType> = MappedResponseBodyType<TRBType, TRBody>;
|
|
158
|
+
type VesselDownloadResponse<TRBody extends UniAppDownloadBody = UniAppDownloadBody, TRBType extends UniAppDownloadBodyType = 'json'> = MappedResponseBodyType<TRBType, TRBody>;
|
|
159
|
+
type VesselRequestRawResponse<TRBody = any, TRBType extends ResponseBodyType = ResponseBodyType> = UniAppRequestResponse<MappedResponseBodyType<TRBType, TRBody>>;
|
|
160
|
+
type VesselUploadRawResponse<TRBody = any, TRBType extends ResponseBodyType = ResponseBodyType> = UniAppUploadResponse<MappedResponseBodyType<TRBType, TRBody>>;
|
|
161
|
+
type VesselDownloadRawResponse<TRBody extends UniAppDownloadBody = UniAppDownloadBody, TRBType extends UniAppDownloadBodyType = 'json'> = UniAppDownloadResponse<MappedResponseBodyType<TRBType, TRBody>>;
|
|
162
|
+
type VesselRawResponse<T = any> = VesselRequestRawResponse<T> | VesselUploadRawResponse<T> | VesselDownloadRawResponse;
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/oiyo/vessel/types/vessel.d.ts
|
|
165
|
+
interface VesselRequestMethod {
|
|
166
|
+
<TRBody = any, TRBType extends ResponseBodyType = 'json'>(resource: VesselURL, options: VesselRequestOptions<TRBType> & {
|
|
167
|
+
raw: true;
|
|
168
|
+
}): Promise<VesselRequestRawResponse<TRBody, TRBType>>;
|
|
169
|
+
<TRBody = any, TRBType extends ResponseBodyType = 'json'>(resource: VesselURL, options?: VesselRequestOptions<TRBType>): Promise<VesselRequestResponse<TRBody, TRBType>>;
|
|
170
|
+
}
|
|
171
|
+
interface VesselUploadMethod {
|
|
172
|
+
<TRBody = any, TRBType extends ResponseBodyType = 'json'>(resource: VesselURL, options: VesselUploadOptions<TRBType> & {
|
|
173
|
+
raw: true;
|
|
174
|
+
}): Promise<VesselUploadRawResponse<TRBody, TRBType>>;
|
|
175
|
+
<TRBody = any, TRBType extends ResponseBodyType = 'json'>(resource: VesselURL, options?: VesselUploadOptions<TRBType>): Promise<VesselUploadResponse<TRBody, TRBType>>;
|
|
176
|
+
}
|
|
177
|
+
interface VesselDownloadMethod {
|
|
178
|
+
<TRBody extends UniAppDownloadBody = UniAppDownloadBody, TRBType extends UniAppDownloadBodyType = UniAppDownloadBodyType>(resource: VesselURL, options: VesselDownloadOptions<TRBType> & {
|
|
179
|
+
raw: true;
|
|
180
|
+
}): Promise<VesselDownloadRawResponse<TRBody, TRBType>>;
|
|
181
|
+
<TRBody extends UniAppDownloadBody = UniAppDownloadBody, TRBType extends UniAppDownloadBodyType = UniAppDownloadBodyType>(resource: VesselURL, options?: VesselDownloadOptions<TRBType>): Promise<VesselDownloadResponse<TRBody, TRBType>>;
|
|
182
|
+
}
|
|
183
|
+
interface VesselHooks<TContextOptions, TResponse> {
|
|
184
|
+
onRequest?: (context: {
|
|
185
|
+
resource: VesselURL;
|
|
186
|
+
options: TContextOptions;
|
|
187
|
+
}) => MaybePromise<void>;
|
|
188
|
+
onRequestError?: (context: {
|
|
189
|
+
resource: VesselURL;
|
|
190
|
+
options: TContextOptions;
|
|
191
|
+
error: Error;
|
|
192
|
+
}) => MaybePromise<void>;
|
|
193
|
+
onResponse?: (context: {
|
|
194
|
+
resource: VesselURL;
|
|
195
|
+
options: TContextOptions;
|
|
196
|
+
response: TResponse;
|
|
197
|
+
}) => MaybePromise<void>;
|
|
198
|
+
onResponseError?: (context: {
|
|
199
|
+
resource: VesselURL;
|
|
200
|
+
options: TContextOptions;
|
|
201
|
+
response: TResponse;
|
|
202
|
+
}) => MaybePromise<void>;
|
|
203
|
+
}
|
|
204
|
+
interface VesselConfig extends VesselBaseOptions<ResponseBodyType>, VesselHooks<VesselConfig, VesselRawResponse> {}
|
|
205
|
+
interface VesselError<T = any> extends Error {
|
|
206
|
+
resource?: VesselURL;
|
|
207
|
+
options?: VesselOptions;
|
|
208
|
+
response?: VesselRawResponse<T>;
|
|
209
|
+
data: T;
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/oiyo/vessel/vessel.d.ts
|
|
213
|
+
interface Vessel {
|
|
214
|
+
/**
|
|
215
|
+
* 普通请求
|
|
216
|
+
*/
|
|
217
|
+
request: VesselRequestMethod;
|
|
218
|
+
/**
|
|
219
|
+
* 文件上传
|
|
220
|
+
*/
|
|
221
|
+
upload: VesselUploadMethod;
|
|
222
|
+
/**
|
|
223
|
+
* 文件下载
|
|
224
|
+
*/
|
|
225
|
+
download: VesselDownloadMethod;
|
|
226
|
+
/**
|
|
227
|
+
* 基于当前配置派生一个新实例。
|
|
228
|
+
*/
|
|
229
|
+
create: (config: VesselConfig) => Vessel;
|
|
230
|
+
}
|
|
231
|
+
declare function createVessel(globalConfig?: VesselConfig): Vessel;
|
|
232
|
+
declare const vessel: Vessel;
|
|
233
|
+
//#endregion
|
|
234
|
+
export { VesselDownloadResponse as a, VesselDownloadOptions as c, ResponseBodyType as d, createBeacon as f, VesselError as i, VesselRequestOptions as l, vessel as n, VesselRequestResponse as o, VesselConfig as r, VesselUploadResponse as s, createVessel as t, VesselUploadOptions as u };
|
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/framework v0.
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
3
|
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
4
|
* Commercial software. See LICENSE for terms.
|
|
5
5
|
* Official site: https://oiyo.js.org
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
require("./chunk-
|
|
8
|
+
require("./chunk-CPOuyFJX.cjs");
|
|
9
|
+
const require_oiyo = require("./oiyo-DZ6BFYIw.cjs");
|
|
9
10
|
require("./uni.cjs");
|
|
10
11
|
require("./vue.cjs");
|
|
11
12
|
//#endregion
|
|
13
|
+
exports.createBeacon = require_oiyo.createBeacon;
|
|
14
|
+
exports.createVessel = require_oiyo.createVessel;
|
|
15
|
+
exports.vessel = require_oiyo.vessel;
|
|
12
16
|
var _dcloudio_uni_app = require("@dcloudio/uni-app");
|
|
13
17
|
Object.keys(_dcloudio_uni_app).forEach(function(k) {
|
|
14
18
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/framework v0.
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
3
|
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
4
|
* Commercial software. See LICENSE for terms.
|
|
5
5
|
* Official site: https://oiyo.js.org
|
|
6
6
|
*/
|
|
7
|
+
import { a as VesselDownloadResponse, c as VesselDownloadOptions, d as ResponseBodyType, f as createBeacon, i as VesselError, l as VesselRequestOptions, n as vessel, o as VesselRequestResponse, r as VesselConfig, s as VesselUploadResponse, t as createVessel, u as VesselUploadOptions } from "./index-DzsQka7j.cjs";
|
|
7
8
|
export * from "@dcloudio/uni-app";
|
|
8
9
|
export * from "vue";
|
|
9
10
|
|
|
10
|
-
//#region src/index.d.ts
|
|
11
|
+
//#region src/index.d.ts
|
|
12
|
+
declare namespace index_d_exports {
|
|
13
|
+
export { ResponseBodyType, VesselConfig, VesselDownloadOptions, VesselDownloadResponse, VesselError, VesselRequestOptions, VesselRequestResponse, VesselUploadOptions, VesselUploadResponse, createBeacon, createVessel, vessel };
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { type ResponseBodyType, type VesselConfig, type VesselDownloadOptions, type VesselDownloadResponse, type VesselError, type VesselRequestOptions, type VesselRequestResponse, type VesselUploadOptions, type VesselUploadResponse, createBeacon, createVessel, vessel };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/framework v0.
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
3
|
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
4
|
* Commercial software. See LICENSE for terms.
|
|
5
5
|
* Official site: https://oiyo.js.org
|
|
6
6
|
*/
|
|
7
|
+
import { a as VesselDownloadResponse, c as VesselDownloadOptions, d as ResponseBodyType, f as createBeacon, i as VesselError, l as VesselRequestOptions, n as vessel, o as VesselRequestResponse, r as VesselConfig, s as VesselUploadResponse, t as createVessel, u as VesselUploadOptions } from "./index-DzsQka7j.mjs";
|
|
7
8
|
export * from "@dcloudio/uni-app";
|
|
8
9
|
export * from "vue";
|
|
9
10
|
|
|
10
|
-
//#region src/index.d.ts
|
|
11
|
+
//#region src/index.d.ts
|
|
12
|
+
declare namespace index_d_exports {
|
|
13
|
+
export { ResponseBodyType, VesselConfig, VesselDownloadOptions, VesselDownloadResponse, VesselError, VesselRequestOptions, VesselRequestResponse, VesselUploadOptions, VesselUploadResponse, createBeacon, createVessel, vessel };
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { type ResponseBodyType, type VesselConfig, type VesselDownloadOptions, type VesselDownloadResponse, type VesselError, type VesselRequestOptions, type VesselRequestResponse, type VesselUploadOptions, type VesselUploadResponse, createBeacon, createVessel, vessel };
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/framework v0.
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
3
|
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
4
|
* Commercial software. See LICENSE for terms.
|
|
5
5
|
* Official site: https://oiyo.js.org
|
|
6
6
|
*/
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-CzvwBCEU.mjs";
|
|
8
|
+
import { n as vessel, r as createBeacon, t as createVessel } from "./oiyo-CdQ_-aZW.mjs";
|
|
8
9
|
import "./uni.mjs";
|
|
9
10
|
import "./vue.mjs";
|
|
10
11
|
export * from "@dcloudio/uni-app";
|
|
11
12
|
export * from "vue";
|
|
12
13
|
//#endregion
|
|
13
|
-
export {};
|
|
14
|
+
export { createBeacon, createVessel, vessel };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
|
+
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
|
+
* Commercial software. See LICENSE for terms.
|
|
5
|
+
* Official site: https://oiyo.js.org
|
|
6
|
+
*/
|
|
7
|
+
const _0x57f845=_0x5260;(function(_0x2a3388,_0x325ffc){const _0x4a6af5=_0x5260,_0x53bf85=_0x2a3388();while(!![]){try{const _0xd65509=parseInt(_0x4a6af5(0x90))/0x1+-parseInt(_0x4a6af5(0xc9))/0x2*(parseInt(_0x4a6af5(0xbc))/0x3)+-parseInt(_0x4a6af5(0xb2))/0x4+-parseInt(_0x4a6af5(0xa3))/0x5+parseInt(_0x4a6af5(0xae))/0x6+parseInt(_0x4a6af5(0xa0))/0x7+-parseInt(_0x4a6af5(0xac))/0x8*(-parseInt(_0x4a6af5(0xdc))/0x9);if(_0xd65509===_0x325ffc)break;else _0x53bf85['push'](_0x53bf85['shift']());}catch(_0x4afcf9){_0x53bf85['push'](_0x53bf85['shift']());}}}(_0x3699,0xcea87));const ABORT_ERROR_NAME='AbortError';var Emitter=class{['listeners']=[];[_0x57f845(0xad)](_0x736ceb,_0x1c3e63){const _0x1ecf64=_0x57f845;if(_0x736ceb!=='abort')return;this['listeners'][_0x1ecf64(0xa5)](_0x1c3e63);}[_0x57f845(0xa4)](_0x5a6417,_0xb326e3){if(_0x5a6417!=='abort')return;const _0x49aaa8=this['listeners']['indexOf'](_0xb326e3);if(_0x49aaa8!==-0x1)this['listeners']['splice'](_0x49aaa8,0x1);}[_0x57f845(0xcd)](_0x4cfcdf){for(const _0xbe05c2 of this['listeners']['slice']())_0xbe05c2['call'](this,_0x4cfcdf);}},BeaconSignal=class extends Emitter{[_0x57f845(0xda)]=![];['reason']=void 0x0;['onabort']=null;['_abort'](_0x1cafd8){const _0x3d0c8d=_0x57f845;if(this['aborted'])return;this['aborted']=!![],this['reason']=_0x1cafd8===void 0x0?createAbortError():_0x1cafd8;const _0x2b9746={};_0x2b9746[_0x3d0c8d(0xab)]='abort';const _0x13d650=_0x2b9746;if(typeof this['onabort']==='function')this['onabort'](_0x13d650);this['emit'](_0x13d650);}[_0x57f845(0xbd)](){const _0x594cd5=_0x57f845;if(this[_0x594cd5(0xda)])throw this[_0x594cd5(0x9e)];}};function createBeacon(){const _0x3d7815=new BeaconSignal();return{'signal':_0x3d7815,'abort':_0x4e98c8=>_0x3d7815['_abort'](_0x4e98c8)};}function createAbortError(_0x7f6ec7=_0x57f845(0xb9)){const _0x2fc0e5=_0x57f845,_0x34e255=new Error(_0x7f6ec7);return _0x34e255[_0x2fc0e5(0xb7)]=ABORT_ERROR_NAME,_0x34e255;}function isAbortError(_0x1f9b95){const _0x1133b6=_0x57f845;return _0x1f9b95 instanceof Error&&_0x1f9b95[_0x1133b6(0xb7)]===ABORT_ERROR_NAME;}function onAbort(_0x76fe90,_0x44cfea){const _0x5b8300=_0x57f845;if(!_0x76fe90)return()=>{};if(_0x76fe90[_0x5b8300(0xda)])return _0x44cfea(),()=>{};return _0x76fe90[_0x5b8300(0xad)]('abort',_0x44cfea),()=>_0x76fe90['removeEventListener'](_0x5b8300(0xaf),_0x44cfea);}const HOOK_NAMES=['onRequest',_0x57f845(0xb4),_0x57f845(0x9c),'onResponseError'];function mergeOptions(..._0xc38814){const _0x422c7e=_0x57f845,_0x3adb33={},_0x56d77f={};for(const _0x53e32f of _0xc38814){if(!_0x53e32f)continue;for(const _0x4d3527 of HOOK_NAMES)collectHook(_0x56d77f,_0x4d3527,_0x53e32f);const _0x346a3b=_0x3adb33[_0x422c7e(0xc3)],_0x35f77c=_0x3adb33[_0x422c7e(0xd7)];Object['assign'](_0x3adb33,_0x53e32f);const _0x5b0eba={..._0x346a3b,..._0x53e32f[_0x422c7e(0xc3)]};_0x3adb33['headers']=_0x5b0eba;const _0x2e65c4={..._0x35f77c,..._0x53e32f[_0x422c7e(0xd7)]};_0x3adb33[_0x422c7e(0xd7)]=_0x2e65c4;}for(const [_0x5ed489,_0x110816]of Object['entries'](_0x56d77f))Object['assign'](_0x3adb33,{[_0x5ed489]:async _0xb25a52=>{for(const _0x20f0c6 of _0x110816)await _0x20f0c6(_0xb25a52);}});return _0x3adb33;}function collectHook(_0x4c329e,_0x96d2e,_0x12ce7c){const _0x4eff3d=_0x57f845,_0x1168c4=_0x12ce7c[_0x96d2e];if(typeof _0x1168c4!==_0x4eff3d(0xd6))return;_0x4c329e[_0x96d2e]??=[],_0x4c329e[_0x96d2e]['push'](_0x1168c4);}function dispatch(_0x36f2c5,_0x5e1f49,_0x956fed,_0x13979e){const _0x5ae130=_0x57f845;let _0x3f48f8;if(_0x36f2c5==='upload')_0x3f48f8=dispatchUpload(_0x5e1f49,_0x956fed,_0x13979e);else{if(_0x36f2c5===_0x5ae130(0xb0))_0x3f48f8=dispatchDownload(_0x5e1f49,_0x956fed,_0x13979e);else _0x3f48f8=dispatchRequest(_0x5e1f49,_0x956fed,_0x13979e);}bindTask(_0x3f48f8,_0x956fed);}function bindTask(_0x3a47b4,_0x58ed48){const _0x4be057=_0x57f845;onAbort(_0x58ed48[_0x4be057(0xa2)],()=>_0x3a47b4['abort']());if(typeof _0x58ed48[_0x4be057(0x9a)]==='function')_0x3a47b4[_0x4be057(0x9a)](_0x58ed48[_0x4be057(0x9a)]);const _0x2104fe=_0x58ed48[_0x4be057(0x95)];if(typeof _0x2104fe==='function'&&_0x4be057(0x98)in _0x3a47b4)_0x3a47b4['onProgressUpdate'](_0x2104fe);}function dispatchRequest(_0x2bbcce,_0x378ceb,_0x1c8acc){const _0x217376=_0x57f845,_0xfcccb5={'url':_0x2bbcce,'method':_0x378ceb[_0x217376(0xc8)],'header':_0x378ceb[_0x217376(0xc3)],'data':_0x378ceb[_0x217376(0xc4)]??{},'timeout':_0x378ceb[_0x217376(0xbb)],'dataType':_0x378ceb['dataType']||'json','responseType':mappedResponseBodyType(_0x378ceb['responseType']),'sslVerify':_0x378ceb['sslVerify'],'withCredentials':_0x378ceb['withCredentials'],'firstIpv4':_0x378ceb['firstIpv4'],'enableHttp2':_0x378ceb['enableHttp2'],'enableQuic':_0x378ceb[_0x217376(0xcc)],'enableCache':_0x378ceb['enableCache'],'enableHttpDNS':_0x378ceb['enableHttpDNS'],'httpDNSServiceId':_0x378ceb['httpDNSServiceId'],'enableChunked':_0x378ceb[_0x217376(0x9d)],'forceCellularNetwork':_0x378ceb['forceCellularNetwork'],'success':_0x1c8acc['onSuccess'],'fail':_0x1c8acc['onFail'],'complete':()=>{}};return uni['request'](_0xfcccb5);}function dispatchUpload(_0x579fcf,_0x47a031,_0x4a4337){const _0xecb92d=_0x57f845,_0x5abb5b={};_0x5abb5b['url']=_0x579fcf,_0x5abb5b['fileType']=_0x47a031['fileType'],_0x5abb5b['file']=_0x47a031['file'],_0x5abb5b[_0xecb92d(0xd9)]=_0x47a031[_0xecb92d(0xd9)],_0x5abb5b[_0xecb92d(0xb7)]=_0x47a031[_0xecb92d(0xb7)]??_0xecb92d(0xb3),_0x5abb5b['files']=_0x47a031['files'],_0x5abb5b['header']=_0x47a031[_0xecb92d(0xc3)],_0x5abb5b['formData']=_0x47a031[_0xecb92d(0xc4)]??{},_0x5abb5b['timeout']=_0x47a031[_0xecb92d(0xbb)],_0x5abb5b[_0xecb92d(0xcf)]=_0x4a4337['onSuccess'],_0x5abb5b['fail']=_0x4a4337[_0xecb92d(0x94)],_0x5abb5b[_0xecb92d(0xce)]=()=>{};const _0x25181a=_0x5abb5b;return uni['uploadFile'](_0x25181a);}function dispatchDownload(_0x3abaf7,_0x57d822,_0x324e58){const _0x42a237=_0x57f845,_0x23a049={'url':_0x3abaf7,'header':_0x57d822[_0x42a237(0xc3)],'timeout':_0x57d822['timeout'],'success':_0x882ab9=>{const _0x44cb6a=_0x42a237,_0x5421af={..._0x882ab9};_0x5421af['data']={},_0x5421af['data']['tempFilePath']=_0x882ab9[_0x44cb6a(0x93)],_0x324e58['onSuccess'](_0x5421af);},'fail':_0x324e58[_0x42a237(0x94)],'complete':()=>{}};return uni[_0x42a237(0xaa)](_0x23a049);}function mappedResponseBodyType(_0x44ec6f){const _0x4b2a41=_0x57f845;if(!_0x44ec6f||_0x44ec6f===_0x4b2a41(0xdb))return _0x4b2a41(0xd8);if(_0x44ec6f==='arrayBuffer')return _0x4b2a41(0xd4);return'text';}function _0x5260(_0x21db5d,_0x3c17d4){_0x21db5d=_0x21db5d-0x90;const _0x369954=_0x3699();let _0x526031=_0x369954[_0x21db5d];return _0x526031;}var VesselError=class extends Error{constructor(_0x11d992){const _0x7a97e1=_0x57f845;super(_0x11d992),this['name']=_0x7a97e1(0xb5);}};function createResponseError(_0x120b8d,_0x5c81da,_0x4acd19){const _0x38564a=_0x57f845,_0x14af2e=_0x120b8d,_0x29a07a='['+(_0x5c81da?.[_0x38564a(0xc8)]||'GET')+']\x20'+_0x14af2e,_0x2cc11a=_0x4acd19?_0x4acd19[_0x38564a(0xc5)]+'\x20'+(_0x4acd19[_0x38564a(0xd5)]||''):_0x38564a(0xc1),_0x4801d4=_0x4acd19?JSON['stringify'](_0x4acd19[_0x38564a(0xd0)]):_0x38564a(0xd1),_0x3dc53d=new VesselError(_0x29a07a+':\x20'+_0x2cc11a+(_0x4acd19['data']?'\x20'+_0x4801d4:''));for(const _0x5e68e5 of[_0x38564a(0xd3),_0x38564a(0xa1),'response','data'])Object[_0x38564a(0xa9)](_0x3dc53d,_0x5e68e5,{'get'(){const _0x8f1bf8=_0x38564a,_0x1bb544={};return _0x1bb544[_0x8f1bf8(0xd3)]=_0x120b8d,_0x1bb544['options']=_0x5c81da,_0x1bb544['response']=_0x4acd19,_0x1bb544[_0x8f1bf8(0xd0)]=_0x4acd19['data'],_0x1bb544[_0x5e68e5];}});return _0x3dc53d;}function normalizeError(_0x3034d6){const _0x16a809=_0x57f845;if(_0x3034d6 instanceof Error)return _0x3034d6;return Object['assign'](new Error(_0x3034d6?.[_0x16a809(0xd5)]||_0x3034d6?.[_0x16a809(0xba)]||_0x16a809(0xc0)),{'cause':_0x3034d6});}async function callRequestHooks(_0x6f0f5c,_0x1ee3a7){await _0x1ee3a7['onRequest']?.({'options':_0x1ee3a7,'resource':_0x6f0f5c});}async function callRequestErrorHooks(_0x3f2864,_0x24fc1a,_0x4060c8){const _0x244376=_0x57f845;await _0x24fc1a[_0x244376(0xb4)]?.({'options':_0x24fc1a,'resource':_0x3f2864,'error':_0x4060c8});}async function callResponseHooks(_0x487d01,_0x460660,_0x533833){await _0x460660['onResponse']?.({'options':_0x460660,'resource':_0x487d01,'response':_0x533833});}async function callResponseErrorHooks(_0x36b914,_0x918b9b,_0x3d2f68){const _0x257c74=_0x57f845;await _0x918b9b[_0x257c74(0xcb)]?.({'options':_0x918b9b,'resource':_0x36b914,'response':_0x3d2f68});}async function refineResponse(_0x56588f,_0x57805e){const _0x3484bd=_0x57f845;if(_0x57805e['responseType']===_0x3484bd(0xdb)||!_0x57805e[_0x3484bd(0xc7)])return{..._0x56588f,'data':await parseJSONResponse(_0x56588f['data'],_0x57805e)};return _0x56588f;}function parseJSONResponse(_0x3e65f7,_0x29940c){const _0x2bd949=_0x57f845;if(typeof _0x3e65f7!==_0x2bd949(0xa6))return _0x3e65f7;if(_0x29940c[_0x2bd949(0x91)])return _0x29940c[_0x2bd949(0x91)](_0x3e65f7);return _0x3e65f7?JSON['parse'](_0x3e65f7):null;}function isResponseError(_0x49ea15){const _0x367455='statusCode'in _0x49ea15?_0x49ea15['statusCode']:void 0x0;return typeof _0x367455==='number'&&(_0x367455<0xc8||_0x367455>=0x12c);}const DEFAULT_RETRY_STATUS_CODES=[0x198,0x199,0x1a9,0x1ad,0x1f4,0x1f6,0x1f7,0x1f8],PAYLOAD_METHODS=new Set(['POST','PUT','DELETE',_0x57f845(0xb6)]);async function withRetry(_0x34897d,_0x446002){const _0x2c3560=_0x57f845,_0x16781e=resolveRetryCount(_0x34897d);for(let _0x250d1c=0x0;;_0x250d1c++)try{return await _0x446002();}catch(_0x124e4d){if(_0x250d1c>=_0x16781e||!shouldRetry(_0x124e4d,_0x34897d))throw _0x124e4d;await sleep(_0x34897d['retryDelay']??0x0,_0x34897d[_0x2c3560(0xa2)]);}}function resolveRetryCount(_0x21b926){const _0x15f6b8=_0x57f845,{retry:_0xf3c6ae}=_0x21b926;if(_0xf3c6ae===![])return 0x0;if(typeof _0xf3c6ae==='number')return _0xf3c6ae>0x0?_0xf3c6ae:0x0;return isPayloadMethod(_0x21b926[_0x15f6b8(0xc8)])?0x0:0x1;}function shouldRetry(_0x864885,_0x584ec0){const _0x33cb2c=_0x57f845;if(_0x584ec0['signal']?.['aborted']||isAbortError(_0x864885))return![];const _0x17966c=_0x864885?.[_0x33cb2c(0x96)]?.['statusCode'];if(typeof _0x17966c!==_0x33cb2c(0xd2))return!![];return(_0x584ec0[_0x33cb2c(0x9f)]??DEFAULT_RETRY_STATUS_CODES)['includes'](_0x17966c);}function isPayloadMethod(_0x36ffc7){const _0x3ba35d=_0x57f845;return!!_0x36ffc7&&PAYLOAD_METHODS['has'](_0x36ffc7[_0x3ba35d(0x92)]());}function sleep(_0x486888,_0x1ac3cf){return new Promise((_0x119a71,_0x4beef9)=>{const _0x3b3281=_0x5260;if(_0x1ac3cf?.['aborted']){_0x4beef9(_0x1ac3cf[_0x3b3281(0x9e)]);return;}if(!(_0x486888>0x0)){_0x119a71();return;}let _0x125745=()=>{};const _0x5cb00a=setTimeout(()=>{_0x125745(),_0x119a71();},_0x486888);_0x125745=onAbort(_0x1ac3cf,()=>{const _0x3e3f8d=_0x3b3281;clearTimeout(_0x5cb00a),_0x4beef9(_0x1ac3cf[_0x3e3f8d(0x9e)]);});});}function buildURL(_0x349937,_0x4ca0a9){const _0x3882f5=_0x57f845,_0xf6adf3=joinURL(_0x4ca0a9[_0x3882f5(0xc6)],_0x349937),_0x14aae8=_0x4ca0a9['query']??{},_0x5403d2=Object['keys'](_0x14aae8)['filter'](_0x3744e6=>_0x14aae8[_0x3744e6]!==void 0x0)[_0x3882f5(0xa7)](_0x4c7525=>{const _0x34625b=_0x14aae8[_0x4c7525];return(Array['isArray'](_0x34625b)?_0x34625b:[_0x34625b])['map'](_0x10765f=>encodeURIComponent(_0x4c7525)+'='+encodeURIComponent(String(_0x10765f)));})[_0x3882f5(0xbe)]('&');if(!_0x5403d2)return _0xf6adf3;return''+_0xf6adf3+(_0xf6adf3[_0x3882f5(0xb8)]('?')?'&':'?')+_0x5403d2;}function joinURL(_0x153cdb,_0x5cbc4a){const _0x4fdde0=_0x57f845;if(!_0x153cdb||isAbsoluteURL(_0x5cbc4a))return _0x5cbc4a;return _0x153cdb[_0x4fdde0(0xc2)](/\/+$/,'')+'/'+_0x5cbc4a[_0x4fdde0(0xc2)](/^\/+/,'');}function isAbsoluteURL(_0x3a0fda){const _0x1067ff=_0x57f845;return/^[a-z][a-z\d+\-.]*:\/\//i[_0x1067ff(0xa8)](_0x3a0fda)||_0x3a0fda['startsWith']('//');}function dispatchHttp(_0x2b4884,_0x6996e8,_0x390be5){const _0x44cf68=buildURL(_0x6996e8,_0x390be5);return withRetry(_0x390be5,()=>attemptRequest(_0x2b4884,_0x6996e8,_0x44cf68,_0x390be5));}function _0x3699(){const _0x2eadf9=['message','timeout','838788caFkyP','throwIfAborted','join','catch','HTTP\x20request\x20failed','<no\x20response>','replace','headers','body','statusCode','baseURL','responseType','method','4SagaFO','upload','onResponseError','enableQuic','emit','complete','success','data','<no\x20response\x20body>','number','request','arraybuffer','errMsg','function','query','text','filePath','aborted','json','17703KpRmLF','1327766ltnbpc','parseResponse','toUpperCase','tempFilePath','onFail','onProgress','response','then','onProgressUpdate','raw','onHeadersReceived','GET','onResponse','enableChunked','reason','retryStatusCodes','2128875aFlzWG','options','signal','7707685bkcLpU','removeEventListener','push','string','flatMap','test','defineProperty','downloadFile','type','7672EieCri','addEventListener','2036184iAoiEJ','abort','download','resolve','3641632sahcgS','file','onRequestError','VesselError','PATCH','name','includes','The\x20operation\x20was\x20aborted'];_0x3699=function(){return _0x2eadf9;};return _0x3699();}function attemptRequest(_0x59279e,_0x38693b,_0x4bfecc,_0x3640ac){const _0x4b1b52=_0x57f845,_0x4e13a2=!!_0x3640ac[_0x4b1b52(0x99)];return new Promise((_0x50f771,_0x499843)=>{const _0x94eade=_0x4b1b52;let _0x73be81=![];const _0x12520f=_0x200b54=>{if(_0x73be81)return;_0x73be81=!![],_0x200b54();},_0x3ebf85=onAbort(_0x3640ac['signal'],()=>{_0x12520f(()=>_0x499843(_0x3640ac['signal']['reason']));}),_0x1dca4c=_0x499a65=>{_0x3ebf85(),_0x12520f(_0x499a65);};callRequestHooks(_0x38693b,_0x3640ac)[_0x94eade(0x97)](()=>{if(_0x73be81)return;dispatch(_0x59279e,_0x4bfecc,_0x3640ac,{'onSuccess':_0x7739be=>{const _0x2974e3=_0x5260;Promise[_0x2974e3(0xb1)]()['then'](()=>refineResponse(_0x7739be,_0x3640ac))['then'](async _0x37fbc7=>{const _0x26e2fe=_0x2974e3;if(isResponseError(_0x7739be)){await callResponseErrorHooks(_0x38693b,_0x3640ac,_0x37fbc7);if(!_0x3640ac['ignoreResponseError'])throw createResponseError(_0x38693b,_0x3640ac,_0x37fbc7);}else await callResponseHooks(_0x38693b,_0x3640ac,_0x37fbc7);_0x1dca4c(()=>_0x50f771(_0x4e13a2?_0x37fbc7:_0x37fbc7[_0x26e2fe(0xd0)]));})[_0x2974e3(0xbf)](_0x1b7255=>_0x1dca4c(()=>_0x499843(_0x1b7255)));},'onFail':_0x3d107f=>{const _0x35c4b2=_0x5260;Promise[_0x35c4b2(0xb1)]()[_0x35c4b2(0x97)](async()=>{const _0x199d38=normalizeError(_0x3d107f);if(!isAbortError(_0x199d38))await callRequestErrorHooks(_0x38693b,_0x3640ac,_0x199d38);throw _0x199d38;})['catch'](_0x231939=>_0x1dca4c(()=>_0x499843(_0x231939)));}});})[_0x94eade(0xbf)](async _0x53334f=>{const _0x2e9c7d=normalizeError(_0x53334f);await callRequestErrorHooks(_0x38693b,_0x3640ac,_0x2e9c7d),_0x1dca4c(()=>_0x499843(_0x2e9c7d));});});}const _0x4cc407={};_0x4cc407['method']='GET',_0x4cc407[_0x57f845(0xc7)]='json';const defaultConfig=_0x4cc407;function createVessel(_0x1efca1={}){const _0x43c6bd=_0x57f845,_0x2edc28=(_0xd743d7,_0x2155f5)=>{return dispatchHttp('request',_0xd743d7,mergeOptions(defaultConfig,_0x1efca1,_0x2155f5));},_0x4df490=(_0x8c7a77,_0x5321ec)=>{const _0x5e217a=_0x5260,_0x503715={};return _0x503715[_0x5e217a(0xc8)]='POST',dispatchHttp('upload',_0x8c7a77,mergeOptions(defaultConfig,_0x1efca1,_0x5321ec,_0x503715));},_0x378f37=(_0x1a0cc5,_0xa64481)=>{const _0x3ca6b1=_0x5260,_0x428336={};return _0x428336[_0x3ca6b1(0xc8)]=_0x3ca6b1(0x9b),dispatchHttp('download',_0x1a0cc5,mergeOptions(defaultConfig,_0x1efca1,_0xa64481,_0x428336));},_0x127e66=_0x5a3652=>createVessel(mergeOptions(_0x1efca1,_0x5a3652)),_0x1dd501={};return _0x1dd501['request']=_0x2edc28,_0x1dd501[_0x43c6bd(0xca)]=_0x4df490,_0x1dd501[_0x43c6bd(0xb0)]=_0x378f37,_0x1dd501['create']=_0x127e66,_0x1dd501;}const vessel=createVessel();export{vessel as n,createBeacon as r,createVessel as t};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
|
+
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
|
+
* Commercial software. See LICENSE for terms.
|
|
5
|
+
* Official site: https://oiyo.js.org
|
|
6
|
+
*/
|
|
7
|
+
const _0x39377b=_0x43fc;(function(_0xf7877b,_0x42d449){const _0x23ab28=_0x43fc,_0x4e04a0=_0xf7877b();while(!![]){try{const _0x2743ef=parseInt(_0x23ab28(0xa9))/0x1*(parseInt(_0x23ab28(0xba))/0x2)+parseInt(_0x23ab28(0x90))/0x3+parseInt(_0x23ab28(0x8b))/0x4*(-parseInt(_0x23ab28(0x98))/0x5)+-parseInt(_0x23ab28(0x7f))/0x6+parseInt(_0x23ab28(0x91))/0x7+parseInt(_0x23ab28(0xaa))/0x8*(-parseInt(_0x23ab28(0x9e))/0x9)+-parseInt(_0x23ab28(0x7c))/0xa*(-parseInt(_0x23ab28(0xa8))/0xb);if(_0x2743ef===_0x42d449)break;else _0x4e04a0['push'](_0x4e04a0['shift']());}catch(_0x23cd82){_0x4e04a0['push'](_0x4e04a0['shift']());}}}(_0x12aa,0xcd60c));const ABORT_ERROR_NAME=_0x39377b(0xab);var Emitter=class{[_0x39377b(0xbe)]=[];[_0x39377b(0xa5)](_0x521dbe,_0x4a9c78){const _0x4fd409=_0x39377b;if(_0x521dbe!=='abort')return;this[_0x4fd409(0xbe)][_0x4fd409(0x93)](_0x4a9c78);}['removeEventListener'](_0x3d3dad,_0x84d2ee){const _0x3c42b5=_0x39377b;if(_0x3d3dad!=='abort')return;const _0xd19fdd=this[_0x3c42b5(0xbe)][_0x3c42b5(0x9d)](_0x84d2ee);if(_0xd19fdd!==-0x1)this['listeners'][_0x3c42b5(0x96)](_0xd19fdd,0x1);}[_0x39377b(0xbf)](_0x373704){const _0x1726b4=_0x39377b;for(const _0x4793c3 of this['listeners']['slice']())_0x4793c3[_0x1726b4(0xc0)](this,_0x373704);}},BeaconSignal=class extends Emitter{['aborted']=![];['reason']=void 0x0;['onabort']=null;['_abort'](_0x1e68e8){const _0xf5f281=_0x39377b;if(this['aborted'])return;this['aborted']=!![],this[_0xf5f281(0x8c)]=_0x1e68e8===void 0x0?createAbortError():_0x1e68e8;const _0x42da32={};_0x42da32[_0xf5f281(0x92)]='abort';const _0xb65297=_0x42da32;if(typeof this['onabort']==='function')this[_0xf5f281(0xc3)](_0xb65297);this['emit'](_0xb65297);}['throwIfAborted'](){const _0x167ca7=_0x39377b;if(this[_0x167ca7(0x86)])throw this[_0x167ca7(0x8c)];}};function createBeacon(){const _0x45ed5d=_0x39377b,_0x52ad6e=new BeaconSignal();return{'signal':_0x52ad6e,'abort':_0x34a7ad=>_0x52ad6e[_0x45ed5d(0x7b)](_0x34a7ad)};}function createAbortError(_0x5eb9fb='The\x20operation\x20was\x20aborted'){const _0x3de4da=_0x39377b,_0xeaad92=new Error(_0x5eb9fb);return _0xeaad92[_0x3de4da(0x7e)]=ABORT_ERROR_NAME,_0xeaad92;}function isAbortError(_0x4298c0){return _0x4298c0 instanceof Error&&_0x4298c0['name']===ABORT_ERROR_NAME;}function onAbort(_0x1e7600,_0x3e85b6){const _0x58c3ac=_0x39377b;if(!_0x1e7600)return()=>{};if(_0x1e7600[_0x58c3ac(0x86)])return _0x3e85b6(),()=>{};return _0x1e7600['addEventListener'](_0x58c3ac(0x76),_0x3e85b6),()=>_0x1e7600['removeEventListener'](_0x58c3ac(0x76),_0x3e85b6);}function _0x43fc(_0x108aff,_0x4963f1){_0x108aff=_0x108aff-0x75;const _0x12aa7d=_0x12aa();let _0x43fcb3=_0x12aa7d[_0x108aff];return _0x43fcb3;}const HOOK_NAMES=[_0x39377b(0x8d),'onRequestError','onResponse','onResponseError'];function mergeOptions(..._0xe7c681){const _0x43b2e1=_0x39377b,_0xa6b99={},_0x5a9115={};for(const _0x25ddff of _0xe7c681){if(!_0x25ddff)continue;for(const _0x30472a of HOOK_NAMES)collectHook(_0x5a9115,_0x30472a,_0x25ddff);const _0x442c00=_0xa6b99[_0x43b2e1(0x97)],_0x31e9a8=_0xa6b99['query'];Object['assign'](_0xa6b99,_0x25ddff);const _0xeeed8a={..._0x442c00,..._0x25ddff[_0x43b2e1(0x97)]};_0xa6b99[_0x43b2e1(0x97)]=_0xeeed8a;const _0x29bc4a={..._0x31e9a8,..._0x25ddff['query']};_0xa6b99['query']=_0x29bc4a;}for(const [_0x549968,_0x115b2e]of Object[_0x43b2e1(0xae)](_0x5a9115))Object['assign'](_0xa6b99,{[_0x549968]:async _0x5e74d8=>{for(const _0x32bc64 of _0x115b2e)await _0x32bc64(_0x5e74d8);}});return _0xa6b99;}function collectHook(_0x4111b9,_0x4529c0,_0xfa2a45){const _0x49d405=_0x39377b,_0x343b02=_0xfa2a45[_0x4529c0];if(typeof _0x343b02!=='function')return;_0x4111b9[_0x4529c0]??=[],_0x4111b9[_0x4529c0][_0x49d405(0x93)](_0x343b02);}function dispatch(_0x32c944,_0x4a440e,_0x16b25e,_0x2346bf){let _0x3e40c6;if(_0x32c944==='upload')_0x3e40c6=dispatchUpload(_0x4a440e,_0x16b25e,_0x2346bf);else{if(_0x32c944==='download')_0x3e40c6=dispatchDownload(_0x4a440e,_0x16b25e,_0x2346bf);else _0x3e40c6=dispatchRequest(_0x4a440e,_0x16b25e,_0x2346bf);}bindTask(_0x3e40c6,_0x16b25e);}function bindTask(_0x10bc7c,_0x3666bd){const _0x4e7ee2=_0x39377b;onAbort(_0x3666bd['signal'],()=>_0x10bc7c[_0x4e7ee2(0x76)]());if(typeof _0x3666bd['onHeadersReceived']==='function')_0x10bc7c['onHeadersReceived'](_0x3666bd[_0x4e7ee2(0xb8)]);const _0x2eb32b=_0x3666bd[_0x4e7ee2(0xb1)];if(typeof _0x2eb32b===_0x4e7ee2(0x9c)&&_0x4e7ee2(0x82)in _0x10bc7c)_0x10bc7c['onProgressUpdate'](_0x2eb32b);}function dispatchRequest(_0x278a4d,_0x527aee,_0x53aab4){const _0x48b3d9=_0x39377b,_0x376bfe={'url':_0x278a4d,'method':_0x527aee[_0x48b3d9(0x83)],'header':_0x527aee['headers'],'data':_0x527aee[_0x48b3d9(0x89)]??{},'timeout':_0x527aee[_0x48b3d9(0xb7)],'dataType':_0x527aee['dataType']||'json','responseType':mappedResponseBodyType(_0x527aee[_0x48b3d9(0x85)]),'sslVerify':_0x527aee[_0x48b3d9(0x87)],'withCredentials':_0x527aee[_0x48b3d9(0xb2)],'firstIpv4':_0x527aee[_0x48b3d9(0xb4)],'enableHttp2':_0x527aee['enableHttp2'],'enableQuic':_0x527aee['enableQuic'],'enableCache':_0x527aee['enableCache'],'enableHttpDNS':_0x527aee[_0x48b3d9(0xc4)],'httpDNSServiceId':_0x527aee['httpDNSServiceId'],'enableChunked':_0x527aee[_0x48b3d9(0x80)],'forceCellularNetwork':_0x527aee[_0x48b3d9(0x81)],'success':_0x53aab4[_0x48b3d9(0x77)],'fail':_0x53aab4['onFail'],'complete':()=>{}};return uni['request'](_0x376bfe);}function dispatchUpload(_0x27007c,_0x59eeca,_0x5d9560){const _0x2d4bcf=_0x39377b,_0x47814d={};_0x47814d['url']=_0x27007c,_0x47814d['fileType']=_0x59eeca['fileType'],_0x47814d[_0x2d4bcf(0xbc)]=_0x59eeca['file'],_0x47814d['filePath']=_0x59eeca[_0x2d4bcf(0xb6)],_0x47814d[_0x2d4bcf(0x7e)]=_0x59eeca[_0x2d4bcf(0x7e)]??'file',_0x47814d['files']=_0x59eeca[_0x2d4bcf(0xbb)],_0x47814d[_0x2d4bcf(0x75)]=_0x59eeca[_0x2d4bcf(0x97)],_0x47814d['formData']=_0x59eeca[_0x2d4bcf(0x89)]??{},_0x47814d['timeout']=_0x59eeca[_0x2d4bcf(0xb7)],_0x47814d[_0x2d4bcf(0xa1)]=_0x5d9560['onSuccess'],_0x47814d['fail']=_0x5d9560['onFail'],_0x47814d['complete']=()=>{};const _0x163011=_0x47814d;return uni[_0x2d4bcf(0xb9)](_0x163011);}function dispatchDownload(_0x138162,_0x44802f,_0x1e7b18){const _0x28837c=_0x39377b,_0x10c153={'url':_0x138162,'header':_0x44802f['headers'],'timeout':_0x44802f['timeout'],'success':_0x42e0d2=>{const _0x3e1b8f=_0x43fc,_0x50c581={..._0x42e0d2};_0x50c581[_0x3e1b8f(0x84)]={},_0x50c581[_0x3e1b8f(0x84)][_0x3e1b8f(0xa2)]=_0x42e0d2[_0x3e1b8f(0xa2)],_0x1e7b18[_0x3e1b8f(0x77)](_0x50c581);},'fail':_0x1e7b18[_0x28837c(0xc5)],'complete':()=>{}};return uni['downloadFile'](_0x10c153);}function mappedResponseBodyType(_0xf5cc69){const _0x17ad2e=_0x39377b;if(!_0xf5cc69||_0xf5cc69==='json')return'text';if(_0xf5cc69===_0x17ad2e(0xa0))return'arraybuffer';return'text';}var VesselError=class extends Error{constructor(_0x1f41bf){const _0x51cd72=_0x39377b;super(_0x1f41bf),this[_0x51cd72(0x7e)]='VesselError';}};function createResponseError(_0x40f8b8,_0x2de955,_0x4a9253){const _0x2a984c=_0x39377b,_0x5a28d3=_0x40f8b8,_0x3a5ce5='['+(_0x2de955?.['method']||'GET')+']\x20'+_0x5a28d3,_0x79b8f8=_0x4a9253?_0x4a9253['statusCode']+'\x20'+(_0x4a9253[_0x2a984c(0x78)]||''):'<no\x20response>',_0x259390=_0x4a9253?JSON[_0x2a984c(0xac)](_0x4a9253[_0x2a984c(0x84)]):'<no\x20response\x20body>',_0x5d35f6=new VesselError(_0x3a5ce5+':\x20'+_0x79b8f8+(_0x4a9253['data']?'\x20'+_0x259390:''));for(const _0x447a2e of[_0x2a984c(0x95),_0x2a984c(0x94),_0x2a984c(0xb3),_0x2a984c(0x84)])Object['defineProperty'](_0x5d35f6,_0x447a2e,{'get'(){const _0x56697c=_0x2a984c,_0x374f6e={};return _0x374f6e['request']=_0x40f8b8,_0x374f6e[_0x56697c(0x94)]=_0x2de955,_0x374f6e['response']=_0x4a9253,_0x374f6e['data']=_0x4a9253[_0x56697c(0x84)],_0x374f6e[_0x447a2e];}});return _0x5d35f6;}function normalizeError(_0x18457e){const _0x12d30f=_0x39377b;if(_0x18457e instanceof Error)return _0x18457e;return Object['assign'](new Error(_0x18457e?.[_0x12d30f(0x78)]||_0x18457e?.['message']||'HTTP\x20request\x20failed'),{'cause':_0x18457e});}async function callRequestHooks(_0x4cf6c2,_0x5c9e0a){await _0x5c9e0a['onRequest']?.({'options':_0x5c9e0a,'resource':_0x4cf6c2});}async function callRequestErrorHooks(_0x14da47,_0x435038,_0x71a13){await _0x435038['onRequestError']?.({'options':_0x435038,'resource':_0x14da47,'error':_0x71a13});}async function callResponseHooks(_0x44fb74,_0x85d332,_0x7b233){await _0x85d332['onResponse']?.({'options':_0x85d332,'resource':_0x44fb74,'response':_0x7b233});}async function callResponseErrorHooks(_0x3c7a88,_0x455851,_0x560b64){const _0x1171a2=_0x39377b;await _0x455851[_0x1171a2(0xc2)]?.({'options':_0x455851,'resource':_0x3c7a88,'response':_0x560b64});}async function refineResponse(_0x520f07,_0x340458){const _0x392393=_0x39377b;if(_0x340458['responseType']===_0x392393(0xbd)||!_0x340458[_0x392393(0x85)])return{..._0x520f07,'data':await parseJSONResponse(_0x520f07['data'],_0x340458)};return _0x520f07;}function parseJSONResponse(_0x21cf4e,_0x2151bf){const _0x21ef2c=_0x39377b;if(typeof _0x21cf4e!=='string')return _0x21cf4e;if(_0x2151bf[_0x21ef2c(0xb5)])return _0x2151bf['parseResponse'](_0x21cf4e);return _0x21cf4e?JSON['parse'](_0x21cf4e):null;}function isResponseError(_0x1580aa){const _0x158ada=_0x39377b,_0x424994='statusCode'in _0x1580aa?_0x1580aa['statusCode']:void 0x0;return typeof _0x424994===_0x158ada(0xb0)&&(_0x424994<0xc8||_0x424994>=0x12c);}const DEFAULT_RETRY_STATUS_CODES=[0x198,0x199,0x1a9,0x1ad,0x1f4,0x1f6,0x1f7,0x1f8],PAYLOAD_METHODS=new Set([_0x39377b(0x7a),_0x39377b(0x8e),'DELETE',_0x39377b(0xaf)]);async function withRetry(_0x193985,_0x1aaf05){const _0x2f10ef=_0x39377b,_0x201418=resolveRetryCount(_0x193985);for(let _0x2ab680=0x0;;_0x2ab680++)try{return await _0x1aaf05();}catch(_0x454c93){if(_0x2ab680>=_0x201418||!shouldRetry(_0x454c93,_0x193985))throw _0x454c93;await sleep(_0x193985[_0x2f10ef(0xc6)]??0x0,_0x193985['signal']);}}function resolveRetryCount(_0x416d9f){const _0x87b757=_0x39377b,{retry:_0x1be4b8}=_0x416d9f;if(_0x1be4b8===![])return 0x0;if(typeof _0x1be4b8==='number')return _0x1be4b8>0x0?_0x1be4b8:0x0;return isPayloadMethod(_0x416d9f[_0x87b757(0x83)])?0x0:0x1;}function shouldRetry(_0x301bd3,_0x2a8f6e){const _0xfa53fb=_0x39377b;if(_0x2a8f6e['signal']?.['aborted']||isAbortError(_0x301bd3))return![];const _0xd7fe93=_0x301bd3?.['response']?.['statusCode'];if(typeof _0xd7fe93!==_0xfa53fb(0xb0))return!![];return(_0x2a8f6e[_0xfa53fb(0xad)]??DEFAULT_RETRY_STATUS_CODES)[_0xfa53fb(0x9b)](_0xd7fe93);}function isPayloadMethod(_0x2a1a68){const _0x1a1692=_0x39377b;return!!_0x2a1a68&&PAYLOAD_METHODS[_0x1a1692(0xa6)](_0x2a1a68['toUpperCase']());}function sleep(_0x165433,_0xc5b077){return new Promise((_0x27bc3c,_0x32fa66)=>{const _0x3feba3=_0x43fc;if(_0xc5b077?.[_0x3feba3(0x86)]){_0x32fa66(_0xc5b077['reason']);return;}if(!(_0x165433>0x0)){_0x27bc3c();return;}let _0x4fe6ba=()=>{};const _0x153ef4=setTimeout(()=>{_0x4fe6ba(),_0x27bc3c();},_0x165433);_0x4fe6ba=onAbort(_0xc5b077,()=>{const _0x210ef6=_0x3feba3;clearTimeout(_0x153ef4),_0x32fa66(_0xc5b077[_0x210ef6(0x8c)]);});});}function buildURL(_0x26be9a,_0x402635){const _0x20f9b5=_0x39377b,_0x19b8dd=joinURL(_0x402635['baseURL'],_0x26be9a),_0x77c2ea=_0x402635['query']??{},_0x32a81c=Object[_0x20f9b5(0x9a)](_0x77c2ea)[_0x20f9b5(0x79)](_0x2faa54=>_0x77c2ea[_0x2faa54]!==void 0x0)['flatMap'](_0x14e180=>{const _0x41e015=_0x77c2ea[_0x14e180];return(Array['isArray'](_0x41e015)?_0x41e015:[_0x41e015])['map'](_0x5bc34b=>encodeURIComponent(_0x14e180)+'='+encodeURIComponent(String(_0x5bc34b)));})['join']('&');if(!_0x32a81c)return _0x19b8dd;return''+_0x19b8dd+(_0x19b8dd[_0x20f9b5(0x9b)]('?')?'&':'?')+_0x32a81c;}function joinURL(_0x58de7a,_0x4d0086){if(!_0x58de7a||isAbsoluteURL(_0x4d0086))return _0x4d0086;return _0x58de7a['replace'](/\/+$/,'')+'/'+_0x4d0086['replace'](/^\/+/,'');}function isAbsoluteURL(_0x4de141){const _0x4b42c2=_0x39377b;return/^[a-z][a-z\d+\-.]*:\/\//i[_0x4b42c2(0x7d)](_0x4de141)||_0x4de141['startsWith']('//');}function dispatchHttp(_0x3d9e1b,_0x103b76,_0x36af1e){const _0x22b378=buildURL(_0x103b76,_0x36af1e);return withRetry(_0x36af1e,()=>attemptRequest(_0x3d9e1b,_0x103b76,_0x22b378,_0x36af1e));}function attemptRequest(_0x5961a2,_0x5a1a28,_0x1986bf,_0x1b2875){const _0x54bc28=!!_0x1b2875['raw'];return new Promise((_0x4f87ed,_0x41c1d0)=>{const _0x77633f=_0x43fc;let _0x50214c=![];const _0x598cec=_0x11c8f8=>{if(_0x50214c)return;_0x50214c=!![],_0x11c8f8();},_0x23ebc3=onAbort(_0x1b2875[_0x77633f(0xa4)],()=>{const _0x30cef8=_0x77633f;_0x598cec(()=>_0x41c1d0(_0x1b2875[_0x30cef8(0xa4)]['reason']));}),_0x50e9c0=_0x340b20=>{_0x23ebc3(),_0x598cec(_0x340b20);};callRequestHooks(_0x5a1a28,_0x1b2875)[_0x77633f(0x8f)](()=>{if(_0x50214c)return;dispatch(_0x5961a2,_0x1986bf,_0x1b2875,{'onSuccess':_0x32f26d=>{const _0x15ec5a=_0x43fc;Promise['resolve']()['then'](()=>refineResponse(_0x32f26d,_0x1b2875))['then'](async _0x5a1b75=>{const _0x46f241=_0x43fc;if(isResponseError(_0x32f26d)){await callResponseErrorHooks(_0x5a1a28,_0x1b2875,_0x5a1b75);if(!_0x1b2875[_0x46f241(0xa7)])throw createResponseError(_0x5a1a28,_0x1b2875,_0x5a1b75);}else await callResponseHooks(_0x5a1a28,_0x1b2875,_0x5a1b75);_0x50e9c0(()=>_0x4f87ed(_0x54bc28?_0x5a1b75:_0x5a1b75['data']));})[_0x15ec5a(0x9f)](_0x3c68b3=>_0x50e9c0(()=>_0x41c1d0(_0x3c68b3)));},'onFail':_0x4deaa3=>{const _0x3f92c4=_0x43fc;Promise[_0x3f92c4(0x99)]()[_0x3f92c4(0x8f)](async()=>{const _0x426d95=normalizeError(_0x4deaa3);if(!isAbortError(_0x426d95))await callRequestErrorHooks(_0x5a1a28,_0x1b2875,_0x426d95);throw _0x426d95;})['catch'](_0x44d9d5=>_0x50e9c0(()=>_0x41c1d0(_0x44d9d5)));}});})[_0x77633f(0x9f)](async _0x3d4b71=>{const _0x56ad43=normalizeError(_0x3d4b71);await callRequestErrorHooks(_0x5a1a28,_0x1b2875,_0x56ad43),_0x50e9c0(()=>_0x41c1d0(_0x56ad43));});});}const _0x4f241b={};_0x4f241b[_0x39377b(0x83)]='GET',_0x4f241b[_0x39377b(0x85)]='json';const defaultConfig=_0x4f241b;function createVessel(_0x2dc6d3={}){const _0x2b4ad6=_0x39377b,_0x25ad99=(_0x885fe8,_0x304640)=>{return dispatchHttp('request',_0x885fe8,mergeOptions(defaultConfig,_0x2dc6d3,_0x304640));},_0x43ed9f=(_0x111923,_0x2da874)=>{const _0x4283f2=_0x43fc,_0x21f4b6={};return _0x21f4b6[_0x4283f2(0x83)]=_0x4283f2(0x7a),dispatchHttp('upload',_0x111923,mergeOptions(defaultConfig,_0x2dc6d3,_0x2da874,_0x21f4b6));},_0x4ddfa9=(_0x4c2903,_0x219418)=>{const _0x39d725=_0x43fc,_0x3a9958={};return _0x3a9958['method']='GET',dispatchHttp(_0x39d725(0x88),_0x4c2903,mergeOptions(defaultConfig,_0x2dc6d3,_0x219418,_0x3a9958));},_0x471b8f=_0x2047eb=>createVessel(mergeOptions(_0x2dc6d3,_0x2047eb)),_0x496079={};return _0x496079[_0x2b4ad6(0x95)]=_0x25ad99,_0x496079['upload']=_0x43ed9f,_0x496079[_0x2b4ad6(0x88)]=_0x4ddfa9,_0x496079[_0x2b4ad6(0xc1)]=_0x471b8f,_0x496079;}function _0x12aa(){const _0x5edd1b=['7892759GIEvDt','type','push','options','request','splice','headers','1405hitSJG','resolve','keys','includes','function','indexOf','4113jxXdhy','catch','arrayBuffer','success','tempFilePath','get','signal','addEventListener','has','ignoreResponseError','957qtdSeg','233787HfjRas','17192TjEkuV','AbortError','stringify','retryStatusCodes','entries','PATCH','number','onProgress','withCredentials','response','firstIpv4','parseResponse','filePath','timeout','onHeadersReceived','uploadFile','6sAInWp','files','file','json','listeners','emit','call','create','onResponseError','onabort','enableHttpDNS','onFail','retryDelay','header','abort','onSuccess','errMsg','filter','POST','_abort','1450NzcuMm','test','name','7983276YdZyMD','enableChunked','forceCellularNetwork','onProgressUpdate','method','data','responseType','aborted','sslVerify','download','body','enumerable','1016RVuyvh','reason','onRequest','PUT','then','4151184TyZtBN'];_0x12aa=function(){return _0x5edd1b;};return _0x12aa();}const vessel=createVessel(),_0x45dd10={};_0x45dd10[_0x39377b(0x8a)]=!![],_0x45dd10[_0x39377b(0xa3)]=function(){return createBeacon;},Object['defineProperty'](exports,'createBeacon',_0x45dd10);const _0x3132c5={};_0x3132c5['enumerable']=!![],_0x3132c5['get']=function(){return createVessel;},Object['defineProperty'](exports,'createVessel',_0x3132c5);const _0x383d46={};_0x383d46['enumerable']=!![],_0x383d46['get']=function(){return vessel;},Object['defineProperty'](exports,'vessel',_0x383d46);
|
package/dist/oiyo.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
|
+
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
|
+
* Commercial software. See LICENSE for terms.
|
|
5
|
+
* Official site: https://oiyo.js.org
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const require_oiyo = require("./oiyo-DZ6BFYIw.cjs");
|
|
9
|
+
exports.createBeacon = require_oiyo.createBeacon;
|
|
10
|
+
exports.createVessel = require_oiyo.createVessel;
|
|
11
|
+
exports.vessel = require_oiyo.vessel;
|
package/dist/oiyo.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
|
+
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
|
+
* Commercial software. See LICENSE for terms.
|
|
5
|
+
* Official site: https://oiyo.js.org
|
|
6
|
+
*/
|
|
7
|
+
import { a as VesselDownloadResponse, c as VesselDownloadOptions, d as ResponseBodyType, f as createBeacon, i as VesselError, l as VesselRequestOptions, n as vessel, o as VesselRequestResponse, r as VesselConfig, s as VesselUploadResponse, t as createVessel, u as VesselUploadOptions } from "./index-DzsQka7j.cjs";
|
|
8
|
+
export { type ResponseBodyType, type VesselConfig, type VesselDownloadOptions, type VesselDownloadResponse, type VesselError, type VesselRequestOptions, type VesselRequestResponse, type VesselUploadOptions, type VesselUploadResponse, createBeacon, createVessel, vessel };
|
package/dist/oiyo.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
|
+
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
|
+
* Commercial software. See LICENSE for terms.
|
|
5
|
+
* Official site: https://oiyo.js.org
|
|
6
|
+
*/
|
|
7
|
+
import { a as VesselDownloadResponse, c as VesselDownloadOptions, d as ResponseBodyType, f as createBeacon, i as VesselError, l as VesselRequestOptions, n as vessel, o as VesselRequestResponse, r as VesselConfig, s as VesselUploadResponse, t as createVessel, u as VesselUploadOptions } from "./index-DzsQka7j.mjs";
|
|
8
|
+
export { type ResponseBodyType, type VesselConfig, type VesselDownloadOptions, type VesselDownloadResponse, type VesselError, type VesselRequestOptions, type VesselRequestResponse, type VesselUploadOptions, type VesselUploadResponse, createBeacon, createVessel, vessel };
|
package/dist/oiyo.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
|
+
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
|
+
* Commercial software. See LICENSE for terms.
|
|
5
|
+
* Official site: https://oiyo.js.org
|
|
6
|
+
*/
|
|
7
|
+
import { n as vessel, r as createBeacon, t as createVessel } from "./oiyo-CdQ_-aZW.mjs";
|
|
8
|
+
export { createBeacon, createVessel, vessel };
|
package/dist/uni.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/framework v0.
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
3
|
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
4
|
* Commercial software. See LICENSE for terms.
|
|
5
5
|
* Official site: https://oiyo.js.org
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
require("./chunk-
|
|
8
|
+
require("./chunk-CPOuyFJX.cjs");
|
|
9
9
|
var _dcloudio_uni_app = require("@dcloudio/uni-app");
|
|
10
10
|
Object.keys(_dcloudio_uni_app).forEach(function(k) {
|
|
11
11
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/dist/uni.d.cts
CHANGED
package/dist/uni.d.mts
CHANGED
package/dist/uni.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/framework v0.
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
3
|
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
4
|
* Commercial software. See LICENSE for terms.
|
|
5
5
|
* Official site: https://oiyo.js.org
|
|
6
6
|
*/
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-CzvwBCEU.mjs";
|
|
8
8
|
export * from "@dcloudio/uni-app";
|
|
9
9
|
export {};
|
package/dist/vue.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/framework v0.
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
3
|
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
4
|
* Commercial software. See LICENSE for terms.
|
|
5
5
|
* Official site: https://oiyo.js.org
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
require("./chunk-
|
|
8
|
+
require("./chunk-CPOuyFJX.cjs");
|
|
9
9
|
var vue = require("vue");
|
|
10
10
|
Object.keys(vue).forEach(function(k) {
|
|
11
11
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
package/dist/vue.d.cts
CHANGED
package/dist/vue.d.mts
CHANGED
package/dist/vue.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @oiyo/framework v0.
|
|
2
|
+
* @oiyo/framework v0.4.0-beta.1
|
|
3
3
|
* Copyright (c) 2026 skiyee. All rights reserved.
|
|
4
4
|
* Commercial software. See LICENSE for terms.
|
|
5
5
|
* Official site: https://oiyo.js.org
|
|
6
6
|
*/
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-CzvwBCEU.mjs";
|
|
8
8
|
export * from "vue";
|
|
9
9
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oiyo/framework",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0-beta.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "skiyee",
|
|
7
7
|
"email": "319619193@qq.com",
|
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
"import": "./dist/index.mjs",
|
|
27
27
|
"require": "./dist/index.cjs"
|
|
28
28
|
},
|
|
29
|
+
"./oiyo": {
|
|
30
|
+
"types": {
|
|
31
|
+
"import": "./dist/oiyo.d.mts",
|
|
32
|
+
"require": "./dist/oiyo.d.cts"
|
|
33
|
+
},
|
|
34
|
+
"import": "./dist/oiyo.mjs",
|
|
35
|
+
"require": "./dist/oiyo.cjs"
|
|
36
|
+
},
|
|
29
37
|
"./vue": {
|
|
30
38
|
"types": {
|
|
31
39
|
"import": "./dist/vue.d.mts",
|