@ruan-cat/utils 1.3.1 → 1.3.3

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.
@@ -0,0 +1,310 @@
1
+ import { OptionalKeysOf } from 'type-fest';
2
+ import { Options } from 'unplugin-vue-router';
3
+ import { RequiredPick } from 'type-plus';
4
+ import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
5
+ import { UseAxiosOptions, UseAxiosReturn } from '@vueuse/integrations/useAxios';
6
+ export { UseAxiosOptions } from '@vueuse/integrations/useAxios';
7
+
8
+ /**
9
+ * rmmv特征基类
10
+ * @description
11
+ * 全部的rmmv类都具有 `initialize` 函数
12
+ *
13
+ * 此类型用于描述此
14
+ */
15
+ declare abstract class RmmvClass {
16
+ initialize: (...args: any[]) => void;
17
+ }
18
+ /**
19
+ * 获取对象的全部函数key名称
20
+ * @description
21
+ * 从一个类型内,获取值为函数的key名称
22
+ */
23
+ type FunctionKeys<T> = {
24
+ [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
25
+ }[keyof T];
26
+ /**
27
+ * 属性提示工具
28
+ * @description
29
+ * 对继承的类进行属性提示
30
+ *
31
+ * 对自己新增的属性和函数做属性提示
32
+ *
33
+ * 对全部涉及到的函数,其this全部做判定
34
+ */
35
+ type AttributePromptTool<SourceCode extends RmmvClass, UserCode> = ThisType<SourceCode & UserCode> & Partial<SourceCode> & UserCode;
36
+ /**
37
+ * 默认处理策略
38
+ * @description
39
+ * 先回调rmmv源码 再加上用户代码
40
+ */
41
+ declare const defaultHandleStrategy: "source-first";
42
+ /**
43
+ * 处理策略
44
+ * @description
45
+ * 用户代码相对于rmmv源码的处理策略
46
+ */
47
+ declare const handleStrategy: readonly ["userCode-cover-source", "source-first", "userCode-first"];
48
+ /**
49
+ * 处理策略
50
+ * @description
51
+ * 用户代码相对于rmmv源码的处理策略
52
+ */
53
+ type HandleStrategy = (typeof handleStrategy)[number];
54
+ /**
55
+ * 被默认执行默认处理策略的函数名
56
+ * @description
57
+ * 初始化函数默认使用固定的处理策略。
58
+ */
59
+ type defaultHandleStrategy_FuncationName = FunctionKeys<RmmvClass>;
60
+ /** 全部可选字段组成的对象 且该对象的全部字段必填 */
61
+ type AllOptionalFieldObj<T extends object> = Required<Pick<T, OptionalKeysOf<T>>>;
62
+ /** 给一个对象排除 init 字段 */
63
+ type NoInit<T> = Omit<T, defaultHandleStrategy_FuncationName>;
64
+ type AllOptionalFieldObj_noInit<T extends object> = NoInit<AllOptionalFieldObj<T>>;
65
+ /** 处理策略配置的 全部有意义的配置键名 */
66
+ type HandleStrategyConfigKeys<T extends object> = FunctionKeys<AllOptionalFieldObj_noInit<T>>;
67
+ /**
68
+ * 全部有意义函数的 处理策略配置
69
+ * @description
70
+ * 只有可能去覆盖,拓展的函数名,才值得去配置
71
+ */
72
+ type HandleStrategyConfig<T extends object> = Record<HandleStrategyConfigKeys<T>, HandleStrategy>;
73
+ /** rmmv类拓展工具函数配置 */
74
+ type RmmvClassExpandTools<SourceCode extends new (...args: any[]) => RmmvClass, UserCode extends object> = {
75
+ /** 源码 一般是被拓展的类,往往是rmmv的源码类 */
76
+ source: SourceCode;
77
+ /** 用户代码 插件开发者编写的一个内部完备的对象 */
78
+ userCode: UserCode;
79
+ /**
80
+ * 拓展配置 按照要求拓展
81
+ * @description
82
+ * 用户可以不提供配置 就默认按照标准的方式处理
83
+ */
84
+ config?: Partial<HandleStrategyConfig<UserCode>>;
85
+ };
86
+ /**
87
+ * rmmv类拓展工具函数
88
+ * @description
89
+ * 预期处理5种情况
90
+ *
91
+ * - 1. 用户代码覆盖掉rmmv源码
92
+ * - 2. 默认处理策略
93
+ * - 3. 先执行用户代码 再回调rmmv源码
94
+ * - 4. 初始化函数默认使用固定的处理策略
95
+ * - 5. 继承对象没有这个属性时 说明是新的函数 直接添加到原型链上
96
+ */
97
+ declare function rmmvClassExpandTools<SourceCode extends new (...args: any[]) => RmmvClass, UserCode extends object = any>(params: RmmvClassExpandTools<SourceCode, UserCode>): void;
98
+
99
+ type Condition = (...args: unknown[]) => boolean;
100
+ /** @deprecated 没必要 */
101
+ type Conditions = Condition[];
102
+ /**
103
+ * 是否每一个条件函数都满足?
104
+ * @description
105
+ * ### 设计理由
106
+ * 旨在于封装这样的代码段
107
+ * ```js
108
+ * const conditions = [
109
+ * () => !isEqual(nAssetRecord, oAssetRecord),
110
+ * () => !isEqual(nAssetRecord, defPropsAssets),
111
+ * () => isEdit.value || isInfo.value,
112
+ * ];
113
+ * conditions.every((condition) => condition())
114
+ * ```
115
+ */
116
+ declare function isConditionsEvery(conditions: Condition[]): boolean;
117
+ declare function isConditionsSome(conditions: Condition[]): boolean;
118
+
119
+ /**
120
+ * `Prettify` 帮助程序是一种实用程序类型,它采用对象类型并使悬停叠加更具可读性。
121
+ * @see https://www.totaltypescript.com/concepts/the-prettify-helper
122
+ */
123
+ type Prettify<T> = {
124
+ [K in keyof T]: T[K];
125
+ } & {};
126
+ /**
127
+ * 转换成 NumberLike 类型
128
+ * @description
129
+ * ### *设计理由*
130
+ * 期望让一个数值类型的联合类型 变成`NumberLike`形式的类型
131
+ */
132
+ type ToNumberLike<T extends number> = T | `${T}`;
133
+
134
+ type GetRouteName = NonNullable<Options["getRouteName"]>;
135
+ /**
136
+ * 自主生成路由名称
137
+ * @description
138
+ * 对插件自动生成的路由名称,很不满意,不好看,容易引起阅读歧义。
139
+ *
140
+ * 故自定义。
141
+ *
142
+ * unplugin-vue-router 插件的 getRouteName 配置项
143
+ */
144
+ declare const getRouteName: GetRouteName;
145
+
146
+ /** 创建简单的异步任务 */
147
+ declare function generateSimpleAsyncTask<T extends (...args: any) => any>(func: T): (...args: any) => Promise<ReturnType<T>>;
148
+ type SimpleAsyncTask = ReturnType<typeof generateSimpleAsyncTask>;
149
+ declare const initFlag: "initFlag";
150
+ /**
151
+ * 以队列串行的形式 串行运行异步函数
152
+ * @version 2
153
+ */
154
+ declare function runPromiseByQueue<T>(promises: ((...args: any) => Promise<T>)[]): Promise<void>;
155
+ /**
156
+ * 以并行的形式 并发运行异步函数
157
+ */
158
+ declare function runPromiseByConcurrency<T>(promises: ((...args: any) => Promise<T>)[]): Promise<void>;
159
+
160
+ declare const taskTypes: readonly ["single", "parallel", "queue"];
161
+ type TaskType = (typeof taskTypes)[number];
162
+ interface BaseTask {
163
+ /** 任务类型 */
164
+ type: TaskType;
165
+ }
166
+ type Task = SimpleAsyncTask | TasksConfig;
167
+ interface SingleTasks extends BaseTask {
168
+ type: "single";
169
+ tasks: Task;
170
+ }
171
+ interface ParallelTasks extends BaseTask {
172
+ type: "parallel";
173
+ tasks: Task[];
174
+ }
175
+ interface QueueTasks extends BaseTask {
176
+ type: "queue";
177
+ tasks: Task[];
178
+ }
179
+ type TasksConfig = SingleTasks | ParallelTasks | QueueTasks;
180
+ type PromiseTasksConfig = TasksConfig;
181
+ /**
182
+ * 定义异步任务对象
183
+ * @description
184
+ * 这个对象是一揽子异步任务的配置
185
+ */
186
+ declare function definePromiseTasks(config: TasksConfig): TasksConfig;
187
+ /**
188
+ * 执行异步函数对象
189
+ */
190
+ declare function executePromiseTasks(config: TasksConfig,
191
+ /**
192
+ * 上一次递归执行时提供的参数
193
+ * @description
194
+ * 考虑到递归函数 这里提供了一个参数 用于传递上一次递归执行的结果
195
+ */
196
+ lastParams?: any): Promise<any>;
197
+
198
+ /** 拓展的类型参数 用于约束必填的字段 */
199
+ type KeyAxiosRequestConfig<D = any> = keyof AxiosRequestConfig<D>;
200
+ /** 填写key值的帮助类型 */
201
+ type KeyHelper<K extends KeyAxiosRequestConfig> = K;
202
+ type RemoveUrl<T extends KeyAxiosRequestConfig> = Exclude<T, "url">;
203
+ /**
204
+ * 创建 AxiosRequestConfig 的各种变种类型
205
+ * @description
206
+ * 目前需要给 AxiosRequestConfig 添加必填属性
207
+ *
208
+ * 故需要本工具创建各种变种类型
209
+ *
210
+ * @example CreateAxiosRequestConfig<"url", D>
211
+ */
212
+ type CreateAxiosRequestConfig<K extends keyof Target, D = any, Target = AxiosRequestConfig<D>> = RequiredPick<Target, K>;
213
+ /** 拓展K泛型后的类型 */
214
+ interface StrictUseAxiosReturn<T,
215
+ /**
216
+ * 拓展的类型参数 用于约束必填的字段
217
+ * @description
218
+ * 这里不需要提供默认的取值
219
+ */
220
+ K extends KeyAxiosRequestConfig<D>, R, D> extends UseAxiosReturn<T, R, D> {
221
+ /**
222
+ * Manually call the axios request
223
+ */
224
+ execute: (url?: string | CreateAxiosRequestConfig<K, D>, config?: CreateAxiosRequestConfig<K, D>) => Promise<StrictUseAxiosReturn<T, K, R, D>>;
225
+ }
226
+ declare module "@vueuse/integrations/useAxios" {
227
+ /**
228
+ * 拓展类型参数后的 useAxios 函数
229
+ * @description
230
+ * 在我们的封装中 使用本类型
231
+ */
232
+ function useAxios<T = any,
233
+ /** 拓展的类型参数 用于约束必填的字段 */
234
+ K extends KeyAxiosRequestConfig<D> = "url", R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, K, R, D> & Promise<StrictUseAxiosReturn<T, K, R, D>>;
235
+ }
236
+ /** 包装器的参数 */
237
+ interface UseAxiosWrapperParams<
238
+ /**
239
+ * 业务数据类型
240
+ * @description
241
+ * 必须先填写业务类型
242
+ */
243
+ T = any,
244
+ /**
245
+ * AxiosRequestConfig 默认必填的字段
246
+ * @description
247
+ * 用于约束其他类型的字段
248
+ *
249
+ * 然后才能填写必传的参数类型
250
+ *
251
+ * 默认为 必填url请求地址的 config 请求配置
252
+ */
253
+ K extends KeyAxiosRequestConfig<D> = "url",
254
+ /**
255
+ * UseAxiosOptions 的派生类型
256
+ */
257
+ UseAxiosOptionsLike extends UseAxiosOptions = UseAxiosOptions,
258
+ /**
259
+ * AxiosRequestConfig 用的类型
260
+ * @description
261
+ * 最后才可以传递此类型
262
+ */
263
+ D = any> {
264
+ /**
265
+ * axios的配置类型
266
+ * @description
267
+ * 默认为 必填url请求地址的 config 请求配置
268
+ */
269
+ config: CreateAxiosRequestConfig<K, D>;
270
+ /**
271
+ * axios实例
272
+ * @description
273
+ * 对于包装器函数而言 必须传递有意义的请求实例
274
+ */
275
+ instance: AxiosInstance;
276
+ /** useAxios 的选项配置 */
277
+ options: UseAxiosOptionsLike;
278
+ }
279
+ /**
280
+ * useAxios 的包装函数
281
+ * @description
282
+ * 其本质是对 useAxios 函数的封装,仅仅是包装了参数层
283
+ *
284
+ * 预期设计成一个万能的 通用的请求函数
285
+ */
286
+ declare function useAxiosWrapper<T, K extends KeyAxiosRequestConfig, D = any>(params: UseAxiosWrapperParams): StrictUseAxiosReturn<T, K, AxiosResponse<T, any>, D> & Promise<StrictUseAxiosReturn<T, K, AxiosResponse<T, any>, D>>;
287
+
288
+ /**
289
+ * pnpm-workspace.yaml 文件的类型声明
290
+ * @description
291
+ * 设计理由
292
+ *
293
+ * 主要是为了让该文件被解析后,能够有一个基础的类型声明
294
+ *
295
+ * 按理说这个东西应该有别人封装好的类型的,肯定因为我没找到。
296
+ *
297
+ * 未来应该找到这样的类型声明库,直接复用别人的就好了,不要自己写了。
298
+ */
299
+ interface PnpmWorkspace {
300
+ /**
301
+ * 包的匹配语法字符串
302
+ *
303
+ * @example
304
+ * ["packages/**", "demos/**", "utils"]
305
+ */
306
+ packages?: string[];
307
+ catalog?: string[];
308
+ }
309
+
310
+ export { type AttributePromptTool, type BaseTask, type Condition, type Conditions, type CreateAxiosRequestConfig, type FunctionKeys, type HandleStrategy, type KeyAxiosRequestConfig, type KeyHelper, type ParallelTasks, type PnpmWorkspace, type Prettify, type PromiseTasksConfig, type QueueTasks, type RemoveUrl, RmmvClass, type SimpleAsyncTask, type SingleTasks, type StrictUseAxiosReturn, type Task, type TaskType, type TasksConfig, type ToNumberLike, type UseAxiosWrapperParams, defaultHandleStrategy, type defaultHandleStrategy_FuncationName, definePromiseTasks, executePromiseTasks, generateSimpleAsyncTask, getRouteName, initFlag, isConditionsEvery, isConditionsSome, rmmvClassExpandTools, runPromiseByConcurrency, runPromiseByQueue, taskTypes, useAxiosWrapper };
@@ -0,0 +1,310 @@
1
+ import { OptionalKeysOf } from 'type-fest';
2
+ import { Options } from 'unplugin-vue-router';
3
+ import { RequiredPick } from 'type-plus';
4
+ import { AxiosResponse, AxiosRequestConfig, AxiosInstance } from 'axios';
5
+ import { UseAxiosOptions, UseAxiosReturn } from '@vueuse/integrations/useAxios';
6
+ export { UseAxiosOptions } from '@vueuse/integrations/useAxios';
7
+
8
+ /**
9
+ * rmmv特征基类
10
+ * @description
11
+ * 全部的rmmv类都具有 `initialize` 函数
12
+ *
13
+ * 此类型用于描述此
14
+ */
15
+ declare abstract class RmmvClass {
16
+ initialize: (...args: any[]) => void;
17
+ }
18
+ /**
19
+ * 获取对象的全部函数key名称
20
+ * @description
21
+ * 从一个类型内,获取值为函数的key名称
22
+ */
23
+ type FunctionKeys<T> = {
24
+ [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
25
+ }[keyof T];
26
+ /**
27
+ * 属性提示工具
28
+ * @description
29
+ * 对继承的类进行属性提示
30
+ *
31
+ * 对自己新增的属性和函数做属性提示
32
+ *
33
+ * 对全部涉及到的函数,其this全部做判定
34
+ */
35
+ type AttributePromptTool<SourceCode extends RmmvClass, UserCode> = ThisType<SourceCode & UserCode> & Partial<SourceCode> & UserCode;
36
+ /**
37
+ * 默认处理策略
38
+ * @description
39
+ * 先回调rmmv源码 再加上用户代码
40
+ */
41
+ declare const defaultHandleStrategy: "source-first";
42
+ /**
43
+ * 处理策略
44
+ * @description
45
+ * 用户代码相对于rmmv源码的处理策略
46
+ */
47
+ declare const handleStrategy: readonly ["userCode-cover-source", "source-first", "userCode-first"];
48
+ /**
49
+ * 处理策略
50
+ * @description
51
+ * 用户代码相对于rmmv源码的处理策略
52
+ */
53
+ type HandleStrategy = (typeof handleStrategy)[number];
54
+ /**
55
+ * 被默认执行默认处理策略的函数名
56
+ * @description
57
+ * 初始化函数默认使用固定的处理策略。
58
+ */
59
+ type defaultHandleStrategy_FuncationName = FunctionKeys<RmmvClass>;
60
+ /** 全部可选字段组成的对象 且该对象的全部字段必填 */
61
+ type AllOptionalFieldObj<T extends object> = Required<Pick<T, OptionalKeysOf<T>>>;
62
+ /** 给一个对象排除 init 字段 */
63
+ type NoInit<T> = Omit<T, defaultHandleStrategy_FuncationName>;
64
+ type AllOptionalFieldObj_noInit<T extends object> = NoInit<AllOptionalFieldObj<T>>;
65
+ /** 处理策略配置的 全部有意义的配置键名 */
66
+ type HandleStrategyConfigKeys<T extends object> = FunctionKeys<AllOptionalFieldObj_noInit<T>>;
67
+ /**
68
+ * 全部有意义函数的 处理策略配置
69
+ * @description
70
+ * 只有可能去覆盖,拓展的函数名,才值得去配置
71
+ */
72
+ type HandleStrategyConfig<T extends object> = Record<HandleStrategyConfigKeys<T>, HandleStrategy>;
73
+ /** rmmv类拓展工具函数配置 */
74
+ type RmmvClassExpandTools<SourceCode extends new (...args: any[]) => RmmvClass, UserCode extends object> = {
75
+ /** 源码 一般是被拓展的类,往往是rmmv的源码类 */
76
+ source: SourceCode;
77
+ /** 用户代码 插件开发者编写的一个内部完备的对象 */
78
+ userCode: UserCode;
79
+ /**
80
+ * 拓展配置 按照要求拓展
81
+ * @description
82
+ * 用户可以不提供配置 就默认按照标准的方式处理
83
+ */
84
+ config?: Partial<HandleStrategyConfig<UserCode>>;
85
+ };
86
+ /**
87
+ * rmmv类拓展工具函数
88
+ * @description
89
+ * 预期处理5种情况
90
+ *
91
+ * - 1. 用户代码覆盖掉rmmv源码
92
+ * - 2. 默认处理策略
93
+ * - 3. 先执行用户代码 再回调rmmv源码
94
+ * - 4. 初始化函数默认使用固定的处理策略
95
+ * - 5. 继承对象没有这个属性时 说明是新的函数 直接添加到原型链上
96
+ */
97
+ declare function rmmvClassExpandTools<SourceCode extends new (...args: any[]) => RmmvClass, UserCode extends object = any>(params: RmmvClassExpandTools<SourceCode, UserCode>): void;
98
+
99
+ type Condition = (...args: unknown[]) => boolean;
100
+ /** @deprecated 没必要 */
101
+ type Conditions = Condition[];
102
+ /**
103
+ * 是否每一个条件函数都满足?
104
+ * @description
105
+ * ### 设计理由
106
+ * 旨在于封装这样的代码段
107
+ * ```js
108
+ * const conditions = [
109
+ * () => !isEqual(nAssetRecord, oAssetRecord),
110
+ * () => !isEqual(nAssetRecord, defPropsAssets),
111
+ * () => isEdit.value || isInfo.value,
112
+ * ];
113
+ * conditions.every((condition) => condition())
114
+ * ```
115
+ */
116
+ declare function isConditionsEvery(conditions: Condition[]): boolean;
117
+ declare function isConditionsSome(conditions: Condition[]): boolean;
118
+
119
+ /**
120
+ * `Prettify` 帮助程序是一种实用程序类型,它采用对象类型并使悬停叠加更具可读性。
121
+ * @see https://www.totaltypescript.com/concepts/the-prettify-helper
122
+ */
123
+ type Prettify<T> = {
124
+ [K in keyof T]: T[K];
125
+ } & {};
126
+ /**
127
+ * 转换成 NumberLike 类型
128
+ * @description
129
+ * ### *设计理由*
130
+ * 期望让一个数值类型的联合类型 变成`NumberLike`形式的类型
131
+ */
132
+ type ToNumberLike<T extends number> = T | `${T}`;
133
+
134
+ type GetRouteName = NonNullable<Options["getRouteName"]>;
135
+ /**
136
+ * 自主生成路由名称
137
+ * @description
138
+ * 对插件自动生成的路由名称,很不满意,不好看,容易引起阅读歧义。
139
+ *
140
+ * 故自定义。
141
+ *
142
+ * unplugin-vue-router 插件的 getRouteName 配置项
143
+ */
144
+ declare const getRouteName: GetRouteName;
145
+
146
+ /** 创建简单的异步任务 */
147
+ declare function generateSimpleAsyncTask<T extends (...args: any) => any>(func: T): (...args: any) => Promise<ReturnType<T>>;
148
+ type SimpleAsyncTask = ReturnType<typeof generateSimpleAsyncTask>;
149
+ declare const initFlag: "initFlag";
150
+ /**
151
+ * 以队列串行的形式 串行运行异步函数
152
+ * @version 2
153
+ */
154
+ declare function runPromiseByQueue<T>(promises: ((...args: any) => Promise<T>)[]): Promise<void>;
155
+ /**
156
+ * 以并行的形式 并发运行异步函数
157
+ */
158
+ declare function runPromiseByConcurrency<T>(promises: ((...args: any) => Promise<T>)[]): Promise<void>;
159
+
160
+ declare const taskTypes: readonly ["single", "parallel", "queue"];
161
+ type TaskType = (typeof taskTypes)[number];
162
+ interface BaseTask {
163
+ /** 任务类型 */
164
+ type: TaskType;
165
+ }
166
+ type Task = SimpleAsyncTask | TasksConfig;
167
+ interface SingleTasks extends BaseTask {
168
+ type: "single";
169
+ tasks: Task;
170
+ }
171
+ interface ParallelTasks extends BaseTask {
172
+ type: "parallel";
173
+ tasks: Task[];
174
+ }
175
+ interface QueueTasks extends BaseTask {
176
+ type: "queue";
177
+ tasks: Task[];
178
+ }
179
+ type TasksConfig = SingleTasks | ParallelTasks | QueueTasks;
180
+ type PromiseTasksConfig = TasksConfig;
181
+ /**
182
+ * 定义异步任务对象
183
+ * @description
184
+ * 这个对象是一揽子异步任务的配置
185
+ */
186
+ declare function definePromiseTasks(config: TasksConfig): TasksConfig;
187
+ /**
188
+ * 执行异步函数对象
189
+ */
190
+ declare function executePromiseTasks(config: TasksConfig,
191
+ /**
192
+ * 上一次递归执行时提供的参数
193
+ * @description
194
+ * 考虑到递归函数 这里提供了一个参数 用于传递上一次递归执行的结果
195
+ */
196
+ lastParams?: any): Promise<any>;
197
+
198
+ /** 拓展的类型参数 用于约束必填的字段 */
199
+ type KeyAxiosRequestConfig<D = any> = keyof AxiosRequestConfig<D>;
200
+ /** 填写key值的帮助类型 */
201
+ type KeyHelper<K extends KeyAxiosRequestConfig> = K;
202
+ type RemoveUrl<T extends KeyAxiosRequestConfig> = Exclude<T, "url">;
203
+ /**
204
+ * 创建 AxiosRequestConfig 的各种变种类型
205
+ * @description
206
+ * 目前需要给 AxiosRequestConfig 添加必填属性
207
+ *
208
+ * 故需要本工具创建各种变种类型
209
+ *
210
+ * @example CreateAxiosRequestConfig<"url", D>
211
+ */
212
+ type CreateAxiosRequestConfig<K extends keyof Target, D = any, Target = AxiosRequestConfig<D>> = RequiredPick<Target, K>;
213
+ /** 拓展K泛型后的类型 */
214
+ interface StrictUseAxiosReturn<T,
215
+ /**
216
+ * 拓展的类型参数 用于约束必填的字段
217
+ * @description
218
+ * 这里不需要提供默认的取值
219
+ */
220
+ K extends KeyAxiosRequestConfig<D>, R, D> extends UseAxiosReturn<T, R, D> {
221
+ /**
222
+ * Manually call the axios request
223
+ */
224
+ execute: (url?: string | CreateAxiosRequestConfig<K, D>, config?: CreateAxiosRequestConfig<K, D>) => Promise<StrictUseAxiosReturn<T, K, R, D>>;
225
+ }
226
+ declare module "@vueuse/integrations/useAxios" {
227
+ /**
228
+ * 拓展类型参数后的 useAxios 函数
229
+ * @description
230
+ * 在我们的封装中 使用本类型
231
+ */
232
+ function useAxios<T = any,
233
+ /** 拓展的类型参数 用于约束必填的字段 */
234
+ K extends KeyAxiosRequestConfig<D> = "url", R = AxiosResponse<T>, D = any>(url: string, config: AxiosRequestConfig<D>, instance: AxiosInstance, options?: UseAxiosOptions): StrictUseAxiosReturn<T, K, R, D> & Promise<StrictUseAxiosReturn<T, K, R, D>>;
235
+ }
236
+ /** 包装器的参数 */
237
+ interface UseAxiosWrapperParams<
238
+ /**
239
+ * 业务数据类型
240
+ * @description
241
+ * 必须先填写业务类型
242
+ */
243
+ T = any,
244
+ /**
245
+ * AxiosRequestConfig 默认必填的字段
246
+ * @description
247
+ * 用于约束其他类型的字段
248
+ *
249
+ * 然后才能填写必传的参数类型
250
+ *
251
+ * 默认为 必填url请求地址的 config 请求配置
252
+ */
253
+ K extends KeyAxiosRequestConfig<D> = "url",
254
+ /**
255
+ * UseAxiosOptions 的派生类型
256
+ */
257
+ UseAxiosOptionsLike extends UseAxiosOptions = UseAxiosOptions,
258
+ /**
259
+ * AxiosRequestConfig 用的类型
260
+ * @description
261
+ * 最后才可以传递此类型
262
+ */
263
+ D = any> {
264
+ /**
265
+ * axios的配置类型
266
+ * @description
267
+ * 默认为 必填url请求地址的 config 请求配置
268
+ */
269
+ config: CreateAxiosRequestConfig<K, D>;
270
+ /**
271
+ * axios实例
272
+ * @description
273
+ * 对于包装器函数而言 必须传递有意义的请求实例
274
+ */
275
+ instance: AxiosInstance;
276
+ /** useAxios 的选项配置 */
277
+ options: UseAxiosOptionsLike;
278
+ }
279
+ /**
280
+ * useAxios 的包装函数
281
+ * @description
282
+ * 其本质是对 useAxios 函数的封装,仅仅是包装了参数层
283
+ *
284
+ * 预期设计成一个万能的 通用的请求函数
285
+ */
286
+ declare function useAxiosWrapper<T, K extends KeyAxiosRequestConfig, D = any>(params: UseAxiosWrapperParams): StrictUseAxiosReturn<T, K, AxiosResponse<T, any>, D> & Promise<StrictUseAxiosReturn<T, K, AxiosResponse<T, any>, D>>;
287
+
288
+ /**
289
+ * pnpm-workspace.yaml 文件的类型声明
290
+ * @description
291
+ * 设计理由
292
+ *
293
+ * 主要是为了让该文件被解析后,能够有一个基础的类型声明
294
+ *
295
+ * 按理说这个东西应该有别人封装好的类型的,肯定因为我没找到。
296
+ *
297
+ * 未来应该找到这样的类型声明库,直接复用别人的就好了,不要自己写了。
298
+ */
299
+ interface PnpmWorkspace {
300
+ /**
301
+ * 包的匹配语法字符串
302
+ *
303
+ * @example
304
+ * ["packages/**", "demos/**", "utils"]
305
+ */
306
+ packages?: string[];
307
+ catalog?: string[];
308
+ }
309
+
310
+ export { type AttributePromptTool, type BaseTask, type Condition, type Conditions, type CreateAxiosRequestConfig, type FunctionKeys, type HandleStrategy, type KeyAxiosRequestConfig, type KeyHelper, type ParallelTasks, type PnpmWorkspace, type Prettify, type PromiseTasksConfig, type QueueTasks, type RemoveUrl, RmmvClass, type SimpleAsyncTask, type SingleTasks, type StrictUseAxiosReturn, type Task, type TaskType, type TasksConfig, type ToNumberLike, type UseAxiosWrapperParams, defaultHandleStrategy, type defaultHandleStrategy_FuncationName, definePromiseTasks, executePromiseTasks, generateSimpleAsyncTask, getRouteName, initFlag, isConditionsEvery, isConditionsSome, rmmvClassExpandTools, runPromiseByConcurrency, runPromiseByQueue, taskTypes, useAxiosWrapper };