@allahjs/utils 0.0.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.
Files changed (160) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +244 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/browser/cookieUtils/index.cjs +100 -0
  5. package/dist/browser/cookieUtils/index.cjs.map +1 -0
  6. package/dist/browser/cookieUtils/index.d.ts +55 -0
  7. package/dist/browser/domUtils/index.cjs +237 -0
  8. package/dist/browser/domUtils/index.cjs.map +1 -0
  9. package/dist/browser/domUtils/index.d.ts +116 -0
  10. package/dist/browser/index.cjs +12 -0
  11. package/dist/browser/index.cjs.map +1 -0
  12. package/dist/browser/index.d.ts +3 -0
  13. package/dist/browser/urlUtils/index.cjs +262 -0
  14. package/dist/browser/urlUtils/index.cjs.map +1 -0
  15. package/dist/browser/urlUtils/index.d.ts +72 -0
  16. package/dist/core/arrayUtils/index.cjs +109 -0
  17. package/dist/core/arrayUtils/index.cjs.map +1 -0
  18. package/dist/core/arrayUtils/index.d.ts +67 -0
  19. package/dist/core/asyncUtils/index.cjs +180 -0
  20. package/dist/core/asyncUtils/index.cjs.map +1 -0
  21. package/dist/core/asyncUtils/index.d.ts +80 -0
  22. package/dist/core/colorUtils/index.cjs +38 -0
  23. package/dist/core/colorUtils/index.cjs.map +1 -0
  24. package/dist/core/colorUtils/index.d.ts +10 -0
  25. package/dist/core/cryptoUtils/index.cjs +428 -0
  26. package/dist/core/cryptoUtils/index.cjs.map +1 -0
  27. package/dist/core/cryptoUtils/index.d.ts +132 -0
  28. package/dist/core/dateUtils/index.cjs +245 -0
  29. package/dist/core/dateUtils/index.cjs.map +1 -0
  30. package/dist/core/dateUtils/index.d.ts +117 -0
  31. package/dist/core/index.cjs +34 -0
  32. package/dist/core/index.cjs.map +1 -0
  33. package/dist/core/index.d.ts +118 -0
  34. package/dist/core/numberUtils/index.cjs +126 -0
  35. package/dist/core/numberUtils/index.cjs.map +1 -0
  36. package/dist/core/numberUtils/index.d.ts +91 -0
  37. package/dist/core/objectUtils/index.cjs +249 -0
  38. package/dist/core/objectUtils/index.cjs.map +1 -0
  39. package/dist/core/objectUtils/index.d.ts +91 -0
  40. package/dist/core/pageUtils/index.cjs +74 -0
  41. package/dist/core/pageUtils/index.cjs.map +1 -0
  42. package/dist/core/pageUtils/index.d.ts +52 -0
  43. package/dist/core/stringUtils/index.cjs +163 -0
  44. package/dist/core/stringUtils/index.cjs.map +1 -0
  45. package/dist/core/stringUtils/index.d.ts +69 -0
  46. package/dist/core/validationUtils/index.cjs +154 -0
  47. package/dist/core/validationUtils/index.cjs.map +1 -0
  48. package/dist/core/validationUtils/index.d.ts +87 -0
  49. package/dist/esm/browser/cookieUtils/index.d.ts +55 -0
  50. package/dist/esm/browser/cookieUtils/index.js +96 -0
  51. package/dist/esm/browser/cookieUtils/index.js.map +1 -0
  52. package/dist/esm/browser/domUtils/index.d.ts +116 -0
  53. package/dist/esm/browser/domUtils/index.js +233 -0
  54. package/dist/esm/browser/domUtils/index.js.map +1 -0
  55. package/dist/esm/browser/index.d.ts +3 -0
  56. package/dist/esm/browser/index.js +4 -0
  57. package/dist/esm/browser/index.js.map +1 -0
  58. package/dist/esm/browser/urlUtils/index.d.ts +72 -0
  59. package/dist/esm/browser/urlUtils/index.js +248 -0
  60. package/dist/esm/browser/urlUtils/index.js.map +1 -0
  61. package/dist/esm/core/arrayUtils/index.d.ts +67 -0
  62. package/dist/esm/core/arrayUtils/index.js +105 -0
  63. package/dist/esm/core/arrayUtils/index.js.map +1 -0
  64. package/dist/esm/core/asyncUtils/index.d.ts +80 -0
  65. package/dist/esm/core/asyncUtils/index.js +175 -0
  66. package/dist/esm/core/asyncUtils/index.js.map +1 -0
  67. package/dist/esm/core/colorUtils/index.d.ts +10 -0
  68. package/dist/esm/core/colorUtils/index.js +34 -0
  69. package/dist/esm/core/colorUtils/index.js.map +1 -0
  70. package/dist/esm/core/cryptoUtils/index.d.ts +132 -0
  71. package/dist/esm/core/cryptoUtils/index.js +424 -0
  72. package/dist/esm/core/cryptoUtils/index.js.map +1 -0
  73. package/dist/esm/core/dateUtils/index.d.ts +117 -0
  74. package/dist/esm/core/dateUtils/index.js +241 -0
  75. package/dist/esm/core/dateUtils/index.js.map +1 -0
  76. package/dist/esm/core/index.d.ts +118 -0
  77. package/dist/esm/core/index.js +30 -0
  78. package/dist/esm/core/index.js.map +1 -0
  79. package/dist/esm/core/numberUtils/index.d.ts +91 -0
  80. package/dist/esm/core/numberUtils/index.js +122 -0
  81. package/dist/esm/core/numberUtils/index.js.map +1 -0
  82. package/dist/esm/core/objectUtils/index.d.ts +91 -0
  83. package/dist/esm/core/objectUtils/index.js +245 -0
  84. package/dist/esm/core/objectUtils/index.js.map +1 -0
  85. package/dist/esm/core/pageUtils/index.d.ts +52 -0
  86. package/dist/esm/core/pageUtils/index.js +66 -0
  87. package/dist/esm/core/pageUtils/index.js.map +1 -0
  88. package/dist/esm/core/stringUtils/index.d.ts +69 -0
  89. package/dist/esm/core/stringUtils/index.js +159 -0
  90. package/dist/esm/core/stringUtils/index.js.map +1 -0
  91. package/dist/esm/core/validationUtils/index.d.ts +87 -0
  92. package/dist/esm/core/validationUtils/index.js +150 -0
  93. package/dist/esm/core/validationUtils/index.js.map +1 -0
  94. package/dist/esm/index.d.ts +22 -0
  95. package/dist/esm/index.js +26 -0
  96. package/dist/esm/index.js.map +1 -0
  97. package/dist/esm/request/ReqQueue/index.js +59 -0
  98. package/dist/esm/request/ReqQueue/index.js.map +1 -0
  99. package/dist/esm/request/httpCode/index.js +49 -0
  100. package/dist/esm/request/httpCode/index.js.map +1 -0
  101. package/dist/esm/request/httpUtils/index.js +359 -0
  102. package/dist/esm/request/httpUtils/index.js.map +1 -0
  103. package/dist/esm/request/index.d.ts +15 -0
  104. package/dist/esm/request/index.js +166 -0
  105. package/dist/esm/request/index.js.map +1 -0
  106. package/dist/esm/request/typings/index.d.ts +184 -0
  107. package/dist/esm/request/uniRequest/index.js +62 -0
  108. package/dist/esm/request/uniRequest/index.js.map +1 -0
  109. package/dist/esm/types/data/index.d.ts +188 -0
  110. package/dist/esm/types/data/index.js +13 -0
  111. package/dist/esm/types/data/index.js.map +1 -0
  112. package/dist/esm/types/index.d.ts +1 -0
  113. package/dist/esm/types/index.js +2 -0
  114. package/dist/esm/types/index.js.map +1 -0
  115. package/dist/esm/uniapp/Tips/index.d.ts +295 -0
  116. package/dist/esm/uniapp/Tips/index.js +498 -0
  117. package/dist/esm/uniapp/Tips/index.js.map +1 -0
  118. package/dist/esm/uniapp/cloudUtils/index.d.ts +56 -0
  119. package/dist/esm/uniapp/cloudUtils/index.js +90 -0
  120. package/dist/esm/uniapp/cloudUtils/index.js.map +1 -0
  121. package/dist/esm/uniapp/index.d.ts +3 -0
  122. package/dist/esm/uniapp/index.js +4 -0
  123. package/dist/esm/uniapp/index.js.map +1 -0
  124. package/dist/esm/uniapp/uniUtils/index.d.ts +113 -0
  125. package/dist/esm/uniapp/uniUtils/index.js +199 -0
  126. package/dist/esm/uniapp/uniUtils/index.js.map +1 -0
  127. package/dist/index.cjs +88 -0
  128. package/dist/index.cjs.map +1 -0
  129. package/dist/index.d.ts +22 -0
  130. package/dist/request/ReqQueue/index.cjs +63 -0
  131. package/dist/request/ReqQueue/index.cjs.map +1 -0
  132. package/dist/request/httpCode/index.cjs +52 -0
  133. package/dist/request/httpCode/index.cjs.map +1 -0
  134. package/dist/request/httpUtils/index.cjs +365 -0
  135. package/dist/request/httpUtils/index.cjs.map +1 -0
  136. package/dist/request/index.cjs +170 -0
  137. package/dist/request/index.cjs.map +1 -0
  138. package/dist/request/index.d.ts +15 -0
  139. package/dist/request/typings/index.d.ts +184 -0
  140. package/dist/request/uniRequest/index.cjs +66 -0
  141. package/dist/request/uniRequest/index.cjs.map +1 -0
  142. package/dist/types/data/index.cjs +15 -0
  143. package/dist/types/data/index.cjs.map +1 -0
  144. package/dist/types/data/index.d.ts +188 -0
  145. package/dist/types/index.cjs +8 -0
  146. package/dist/types/index.cjs.map +1 -0
  147. package/dist/types/index.d.ts +1 -0
  148. package/dist/uniapp/Tips/index.cjs +521 -0
  149. package/dist/uniapp/Tips/index.cjs.map +1 -0
  150. package/dist/uniapp/Tips/index.d.ts +295 -0
  151. package/dist/uniapp/cloudUtils/index.cjs +92 -0
  152. package/dist/uniapp/cloudUtils/index.cjs.map +1 -0
  153. package/dist/uniapp/cloudUtils/index.d.ts +56 -0
  154. package/dist/uniapp/index.cjs +53 -0
  155. package/dist/uniapp/index.cjs.map +1 -0
  156. package/dist/uniapp/index.d.ts +3 -0
  157. package/dist/uniapp/uniUtils/index.cjs +213 -0
  158. package/dist/uniapp/uniUtils/index.cjs.map +1 -0
  159. package/dist/uniapp/uniUtils/index.d.ts +113 -0
  160. package/package.json +129 -0
@@ -0,0 +1,295 @@
1
+ /**
2
+ * 提示类型枚举
3
+ */
4
+ declare enum ToastType {
5
+ SUCCESS = "success",
6
+ ERROR = "error",
7
+ WARNING = "warning",
8
+ INFO = "info",
9
+ LOADING = "loading"
10
+ }
11
+ /**
12
+ * 提示位置枚举
13
+ */
14
+ declare enum ToastPosition {
15
+ TOP = "top",
16
+ CENTER = "center",
17
+ BOTTOM = "bottom"
18
+ }
19
+ /**
20
+ * 模态框按钮配置
21
+ */
22
+ interface ModalButton {
23
+ text: string;
24
+ color?: string;
25
+ }
26
+ /**
27
+ * 模态框配置选项
28
+ */
29
+ interface ModalOptions {
30
+ title?: string;
31
+ content: string;
32
+ showCancel?: boolean;
33
+ cancelText?: string;
34
+ cancelColor?: string;
35
+ confirmText?: string;
36
+ confirmColor?: string;
37
+ editable?: boolean;
38
+ placeholderText?: string;
39
+ }
40
+ /**
41
+ * ActionSheet 选项配置
42
+ */
43
+ interface ActionSheetItem {
44
+ text: string;
45
+ color?: string;
46
+ }
47
+ /**
48
+ * ActionSheet 配置选项
49
+ */
50
+ interface ActionSheetOptions {
51
+ itemList: string[] | ActionSheetItem[];
52
+ itemColor?: string;
53
+ title?: string;
54
+ }
55
+ /**
56
+ * 统一的提示工具对象
57
+ */
58
+ declare const Tips: {
59
+ /**
60
+ * 显示成功提示
61
+ */
62
+ success: (title: string, duration?: number, mask?: boolean) => void;
63
+ /**
64
+ * 显示错误提示
65
+ */
66
+ error: (title: string, duration?: number, mask?: boolean) => void;
67
+ /**
68
+ * 显示警告提示
69
+ */
70
+ warning: (title: string, duration?: number, mask?: boolean) => void;
71
+ /**
72
+ * 显示普通提示
73
+ */
74
+ info: (title: string, duration?: number, mask?: boolean) => void;
75
+ /**
76
+ * 显示加载提示
77
+ */
78
+ loading: (title?: string, mask?: boolean) => void;
79
+ /**
80
+ * 隐藏加载提示
81
+ */
82
+ hideLoading: () => void;
83
+ /**
84
+ * 隐藏所有提示
85
+ */
86
+ hide: () => void;
87
+ /**
88
+ * 显示确认对话框
89
+ */
90
+ confirm: (content: string, title?: string) => Promise<boolean>;
91
+ /**
92
+ * 显示自定义模态框
93
+ */
94
+ modal: (options: ModalOptions) => Promise<{
95
+ confirm: boolean;
96
+ cancel: boolean;
97
+ content?: string;
98
+ }>;
99
+ /**
100
+ * 显示输入框对话框
101
+ */
102
+ input: (content: string, placeholder?: string, title?: string) => Promise<{
103
+ confirmed: boolean;
104
+ content: string;
105
+ }>;
106
+ /**
107
+ * 显示操作菜单
108
+ */
109
+ actionSheet: (options: ActionSheetOptions) => Promise<{
110
+ tapIndex: number;
111
+ cancelled: boolean;
112
+ }>;
113
+ /**
114
+ * 显示带回调的成功提示
115
+ */
116
+ successCallback: (title: string, callback: () => void, duration?: number) => void;
117
+ /**
118
+ * 显示带回调的错误提示
119
+ */
120
+ errorCallback: (title: string, callback: () => void, duration?: number) => void;
121
+ /**
122
+ * 显示加载提示并执行异步操作
123
+ */
124
+ async: <T>(asyncFn: () => Promise<T>, loadingText?: string, successText?: string, errorText?: string) => Promise<T>;
125
+ /**
126
+ * 显示删除确认对话框
127
+ */
128
+ deleteConfirm: (itemName: string, title?: string) => Promise<boolean>;
129
+ /**
130
+ * 显示网络错误提示
131
+ */
132
+ networkError: (customMessage?: string) => void;
133
+ /**
134
+ * 显示权限请求提示
135
+ */
136
+ permission: (permissionName: string) => Promise<boolean>;
137
+ /**
138
+ * 显示版本更新提示
139
+ */
140
+ update: (version: string, updateContent: string, isForced?: boolean) => Promise<boolean>;
141
+ /**
142
+ * 防抖成功提示
143
+ */
144
+ successDebounced: (title: string, duration?: number) => void;
145
+ /**
146
+ * 防抖错误提示
147
+ */
148
+ errorDebounced: (title: string, duration?: number) => void;
149
+ /**
150
+ * 创建批量操作提示管理器
151
+ */
152
+ batch: () => BatchOperationTips;
153
+ };
154
+ /**
155
+ * 显示成功提示
156
+ * @deprecated 建议使用 Tips.success
157
+ */
158
+ declare const showSuccessToast: (title: string, duration?: number, mask?: boolean) => void;
159
+ /**
160
+ * 显示错误提示
161
+ * @deprecated 建议使用 Tips.error
162
+ */
163
+ declare const showErrorToast: (title: string, duration?: number, mask?: boolean) => void;
164
+ /**
165
+ * 显示警告提示
166
+ * @deprecated 建议使用 Tips.warning
167
+ */
168
+ declare const showWarningToast: (title: string, duration?: number, mask?: boolean) => void;
169
+ /**
170
+ * 显示普通提示(无图标)
171
+ * @deprecated 建议使用 Tips.info
172
+ */
173
+ declare const showToast: (title: string, duration?: number, mask?: boolean) => void;
174
+ /**
175
+ * 显示加载提示
176
+ * @deprecated 建议使用 Tips.loading
177
+ */
178
+ declare const showLoading: (title?: string, mask?: boolean) => void;
179
+ /**
180
+ * 隐藏加载提示
181
+ * @deprecated 建议使用 Tips.hideLoading
182
+ */
183
+ declare const hideLoading: () => void;
184
+ /**
185
+ * 隐藏所有提示
186
+ * @deprecated 建议使用 Tips.hide
187
+ */
188
+ declare const hideToast: () => void;
189
+ /**
190
+ * 显示确认对话框
191
+ * @deprecated 建议使用 Tips.confirm
192
+ */
193
+ declare const showConfirmDialog: (content: string, title?: string) => Promise<boolean>;
194
+ /**
195
+ * 显示自定义模态框
196
+ * @deprecated 建议使用 Tips.modal
197
+ */
198
+ declare const showModal: (options: ModalOptions) => Promise<{
199
+ confirm: boolean;
200
+ cancel: boolean;
201
+ content?: string;
202
+ }>;
203
+ /**
204
+ * 显示输入框对话框
205
+ * @deprecated 建议使用 Tips.input
206
+ */
207
+ declare const showInputDialog: (content: string, placeholder?: string, title?: string) => Promise<{
208
+ confirmed: boolean;
209
+ content: string;
210
+ }>;
211
+ /**
212
+ * 显示操作菜单
213
+ * @deprecated 建议使用 Tips.actionSheet
214
+ */
215
+ declare const showActionSheet: (options: ActionSheetOptions) => Promise<{
216
+ tapIndex: number;
217
+ cancelled: boolean;
218
+ }>;
219
+ /**
220
+ * 显示带回调的成功提示
221
+ * @deprecated 建议使用 Tips.successCallback
222
+ */
223
+ declare const showSuccessToastWithCallback: (title: string, callback: () => void, duration?: number) => void;
224
+ /**
225
+ * 显示带回调的错误提示
226
+ * @deprecated 建议使用 Tips.errorCallback
227
+ */
228
+ declare const showErrorToastWithCallback: (title: string, callback: () => void, duration?: number) => void;
229
+ /**
230
+ * 显示加载提示并执行异步操作
231
+ * @deprecated 建议使用 Tips.async
232
+ */
233
+ declare const showLoadingWithAsync: <T>(asyncFn: () => Promise<T>, loadingText?: string, successText?: string, errorText?: string) => Promise<T>;
234
+ /**
235
+ * 显示删除确认对话框
236
+ * @deprecated 建议使用 Tips.deleteConfirm
237
+ */
238
+ declare const showDeleteConfirm: (itemName: string, title?: string) => Promise<boolean>;
239
+ /**
240
+ * 显示网络错误提示
241
+ * @deprecated 建议使用 Tips.networkError
242
+ */
243
+ declare const showNetworkError: (customMessage?: string) => void;
244
+ /**
245
+ * 显示权限请求提示
246
+ * @deprecated 建议使用 Tips.permission
247
+ */
248
+ declare const showPermissionRequest: (permissionName: string) => Promise<boolean>;
249
+ /**
250
+ * 显示版本更新提示
251
+ * @deprecated 建议使用 Tips.update
252
+ */
253
+ declare const showUpdateDialog: (version: string, updateContent: string, isForced?: boolean) => Promise<boolean>;
254
+ /**
255
+ * 防抖成功提示
256
+ * @deprecated 建议使用 Tips.successDebounced
257
+ */
258
+ declare const showSuccessToastDebounced: (title: string, duration?: number) => void;
259
+ /**
260
+ * 防抖错误提示
261
+ * @deprecated 建议使用 Tips.errorDebounced
262
+ */
263
+ declare const showErrorToastDebounced: (title: string, duration?: number) => void;
264
+ /**
265
+ * 批量操作提示管理器
266
+ */
267
+ declare class BatchOperationTips {
268
+ private total;
269
+ private current;
270
+ private operation;
271
+ /**
272
+ * 开始批量操作
273
+ * @param total 总数量
274
+ * @param operation 操作名称
275
+ */
276
+ start(total: number, operation?: string): void;
277
+ /**
278
+ * 更新进度
279
+ * @param increment 增加的数量,默认1
280
+ */
281
+ progress(increment?: number): void;
282
+ /**
283
+ * 完成批量操作
284
+ * @param successMessage 成功提示信息
285
+ */
286
+ complete(successMessage?: string): void;
287
+ /**
288
+ * 批量操作失败
289
+ * @param errorMessage 错误提示信息
290
+ */
291
+ error(errorMessage?: string): void;
292
+ }
293
+
294
+ export { BatchOperationTips, Tips, ToastPosition, ToastType, hideLoading, hideToast, showActionSheet, showConfirmDialog, showDeleteConfirm, showErrorToast, showErrorToastDebounced, showErrorToastWithCallback, showInputDialog, showLoading, showLoadingWithAsync, showModal, showNetworkError, showPermissionRequest, showSuccessToast, showSuccessToastDebounced, showSuccessToastWithCallback, showToast, showUpdateDialog, showWarningToast };
295
+ export type { ActionSheetItem, ActionSheetOptions, ModalButton, ModalOptions };
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+
3
+ var index = require('../uniUtils/index.cjs');
4
+
5
+ /**
6
+ * 云函数工具类
7
+ * 提供云函数调用、重试、响应处理等功能
8
+ */
9
+ const cloudUtils = {
10
+ /**
11
+ * 调用云函数
12
+ * @param app CloudBase 应用实例
13
+ * @param params 操作参数
14
+ * @returns 云函数执行结果
15
+ */
16
+ async call(app, params) {
17
+ try {
18
+ const result = await app.callFunction({
19
+ name: params.function,
20
+ data: {
21
+ action: params.action,
22
+ params: params.params
23
+ }
24
+ });
25
+ // 提示信息处理
26
+ if (params.successMessage) {
27
+ return cloudUtils.handleResponse(result.result, params.successMessage);
28
+ }
29
+ // 使用 safeGetResponseData 确保返回安全的数据结构
30
+ return index.safeGetResponseData(result.result, params.errorDefault);
31
+ }
32
+ catch (error) {
33
+ index.handleError(error, `调用云函数 ${params.function} 失败`);
34
+ }
35
+ return null;
36
+ },
37
+ /**
38
+ * 带重试机制调用云函数
39
+ * @param app CloudBase 应用实例
40
+ * @param functionName 云函数名称
41
+ * @param action 操作类型
42
+ * @param params 参数
43
+ * @param retryCount 重试次数,默认3次
44
+ * @returns 云函数执行结果
45
+ */
46
+ async callWithRetry(app, functionName, action, params, retryCount = 3) {
47
+ let lastError;
48
+ for (let i = 0; i < retryCount; i++) {
49
+ try {
50
+ return await this.call(app, {
51
+ function: functionName,
52
+ action,
53
+ params
54
+ });
55
+ }
56
+ catch (error) {
57
+ lastError = error;
58
+ if (i < retryCount - 1) {
59
+ // 等待一段时间后重试
60
+ await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1)));
61
+ }
62
+ }
63
+ }
64
+ throw lastError;
65
+ },
66
+ /**
67
+ * 处理响应
68
+ * @param data 云函数返回结果
69
+ * @param successMessage 成功提示消息
70
+ * @returns 处理后的结果数据
71
+ */
72
+ handleResponse(data, successMessage) {
73
+ if (data?.code === 0) {
74
+ if (successMessage) {
75
+ uni.showToast({
76
+ title: successMessage,
77
+ icon: 'success'
78
+ });
79
+ }
80
+ return data.result;
81
+ }
82
+ const errorMessage = data?.message || '操作失败';
83
+ uni.showToast({
84
+ title: errorMessage,
85
+ icon: 'none'
86
+ });
87
+ throw new Error(errorMessage);
88
+ }
89
+ };
90
+
91
+ exports.cloudUtils = cloudUtils;
92
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/uniapp/cloudUtils/index.ts"],"sourcesContent":[null],"names":["safeGetResponseData","handleError"],"mappings":";;;;AA2BA;;;AAGG;AACI,MAAM,UAAU,GAAG;AACxB;;;;;AAKG;AACH,IAAA,MAAM,IAAI,CAAU,GAAQ,EAAE,MAAsB,EAAA;AAElD,QAAA,IAAI;AACF,YAAA,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,CAAC;gBACpC,IAAI,EAAE,MAAM,CAAC,QAAQ;AACrB,gBAAA,IAAI,EAAE;oBACJ,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,MAAM,EAAE,MAAM,CAAC;AAChB;AACF,aAAA,CAAC;;AAEF,YAAA,IAAG,MAAM,CAAC,cAAc,EAAC;AACvB,gBAAA,OAAO,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;YACxE;;YAEA,OAAOA,yBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAM;QACrE;QAAE,OAAO,KAAK,EAAE;YACdC,iBAAW,CAAC,KAAK,EAAE,CAAA,MAAA,EAAS,MAAM,CAAC,QAAQ,CAAA,GAAA,CAAK,CAAC;QACnD;AACA,QAAA,OAAO,IAAS;IAClB,CAAC;AAED;;;;;;;;AAQG;AACH,IAAA,MAAM,aAAa,CACjB,GAAQ,EACR,YAAoB,EACpB,MAAc,EACd,MAAY,EACZ,UAAA,GAAqB,CAAC,EAAA;AAEtB,QAAA,IAAI,SAAc;AAElB,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;AACnC,YAAA,IAAI;AACF,gBAAA,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;AAC1B,oBAAA,QAAQ,EAAE,YAAY;oBACtB,MAAM;oBACN;AACD,iBAAA,CAAC;YACJ;YAAE,OAAO,KAAK,EAAE;gBACd,SAAS,GAAG,KAAK;AACjB,gBAAA,IAAI,CAAC,GAAG,UAAU,GAAG,CAAC,EAAE;;oBAEtB,MAAM,IAAI,OAAO,CAAC,OAAO,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACnE;YACF;QACF;AAEA,QAAA,MAAM,SAAS;IACjB,CAAC;AAED;;;;;AAKG;IACH,cAAc,CAAC,IAAS,EAAE,cAAuB,EAAA;AAC/C,QAAA,IAAI,IAAI,EAAE,IAAI,KAAK,CAAC,EAAE;YACpB,IAAI,cAAc,EAAE;gBAClB,GAAG,CAAC,SAAS,CAAC;AACZ,oBAAA,KAAK,EAAE,cAAc;AACrB,oBAAA,IAAI,EAAE;AACP,iBAAA,CAAC;YACJ;YACA,OAAO,IAAI,CAAC,MAAM;QACpB;AACA,QAAA,MAAM,YAAY,GAAG,IAAI,EAAE,OAAO,IAAI,MAAM;QAC5C,GAAG,CAAC,SAAS,CAAC;AACZ,YAAA,KAAK,EAAE,YAAY;AACnB,YAAA,IAAI,EAAE;AACP,SAAA,CAAC;AACF,QAAA,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC;IAC/B;;;;;"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * 云函数调用参数接口
3
+ * 用于统一封装调用云函数时所需的参数
4
+ */
5
+ type ICallParams<T> = {
6
+ /** 云函数名称 */
7
+ function: string;
8
+ /** 云函数内部操作类型 */
9
+ action: string;
10
+ /** 传递给云函数的额外参数 */
11
+ params?: any;
12
+ /**
13
+ * 异常的时候的默认值
14
+ */
15
+ errorDefault?: T;
16
+ /**
17
+ * 成功时的提示
18
+ */
19
+ successMessage?: string;
20
+ /**
21
+ * 失败时的提示
22
+ */
23
+ errorMessage?: string;
24
+ };
25
+ /**
26
+ * 云函数工具类
27
+ * 提供云函数调用、重试、响应处理等功能
28
+ */
29
+ declare const cloudUtils: {
30
+ /**
31
+ * 调用云函数
32
+ * @param app CloudBase 应用实例
33
+ * @param params 操作参数
34
+ * @returns 云函数执行结果
35
+ */
36
+ call<T = any>(app: any, params: ICallParams<T>): Promise<T>;
37
+ /**
38
+ * 带重试机制调用云函数
39
+ * @param app CloudBase 应用实例
40
+ * @param functionName 云函数名称
41
+ * @param action 操作类型
42
+ * @param params 参数
43
+ * @param retryCount 重试次数,默认3次
44
+ * @returns 云函数执行结果
45
+ */
46
+ callWithRetry(app: any, functionName: string, action: string, params?: any, retryCount?: number): Promise<any>;
47
+ /**
48
+ * 处理响应
49
+ * @param data 云函数返回结果
50
+ * @param successMessage 成功提示消息
51
+ * @returns 处理后的结果数据
52
+ */
53
+ handleResponse(data: any, successMessage?: string): any;
54
+ };
55
+
56
+ export { cloudUtils };
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var index$2 = require('./uniUtils/index.cjs');
4
+ var index = require('./Tips/index.cjs');
5
+ var index$1 = require('./cloudUtils/index.cjs');
6
+
7
+
8
+
9
+ exports.createTimestampedData = index$2.createTimestampedData;
10
+ exports.createUpdateData = index$2.createUpdateData;
11
+ exports.deepClone = index$2.deepClone;
12
+ exports.ensureArray = index$2.ensureArray;
13
+ exports.findById = index$2.findById;
14
+ exports.formatDate = index$2.formatDate;
15
+ exports.formatRelativeTime = index$2.formatRelativeTime;
16
+ exports.handleError = index$2.handleError;
17
+ exports.handleSuccess = index$2.handleSuccess;
18
+ exports.isDataExists = index$2.isDataExists;
19
+ exports.isValidFamilyMember = index$2.isValidFamilyMember;
20
+ exports.safeGetResponseData = index$2.safeGetResponseData;
21
+ exports.validateRequiredFields = index$2.validateRequiredFields;
22
+ exports.BatchOperationTips = index.BatchOperationTips;
23
+ exports.Tips = index.Tips;
24
+ Object.defineProperty(exports, "ToastPosition", {
25
+ enumerable: true,
26
+ get: function () { return index.ToastPosition; }
27
+ });
28
+ Object.defineProperty(exports, "ToastType", {
29
+ enumerable: true,
30
+ get: function () { return index.ToastType; }
31
+ });
32
+ exports.hideLoading = index.hideLoading;
33
+ exports.hideToast = index.hideToast;
34
+ exports.showActionSheet = index.showActionSheet;
35
+ exports.showConfirmDialog = index.showConfirmDialog;
36
+ exports.showDeleteConfirm = index.showDeleteConfirm;
37
+ exports.showErrorToast = index.showErrorToast;
38
+ exports.showErrorToastDebounced = index.showErrorToastDebounced;
39
+ exports.showErrorToastWithCallback = index.showErrorToastWithCallback;
40
+ exports.showInputDialog = index.showInputDialog;
41
+ exports.showLoading = index.showLoading;
42
+ exports.showLoadingWithAsync = index.showLoadingWithAsync;
43
+ exports.showModal = index.showModal;
44
+ exports.showNetworkError = index.showNetworkError;
45
+ exports.showPermissionRequest = index.showPermissionRequest;
46
+ exports.showSuccessToast = index.showSuccessToast;
47
+ exports.showSuccessToastDebounced = index.showSuccessToastDebounced;
48
+ exports.showSuccessToastWithCallback = index.showSuccessToastWithCallback;
49
+ exports.showToast = index.showToast;
50
+ exports.showUpdateDialog = index.showUpdateDialog;
51
+ exports.showWarningToast = index.showWarningToast;
52
+ exports.cloudUtils = index$1.cloudUtils;
53
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ export { ExistenceValidationResponse, FamilyValidationResponse, StandardResponse, createTimestampedData, createUpdateData, deepClone, ensureArray, findById, formatDate, formatRelativeTime, handleError, handleSuccess, isDataExists, isValidFamilyMember, safeGetResponseData, validateRequiredFields } from './uniUtils/index.js';
2
+ export { ActionSheetItem, ActionSheetOptions, BatchOperationTips, ModalButton, ModalOptions, Tips, ToastPosition, ToastType, hideLoading, hideToast, showActionSheet, showConfirmDialog, showDeleteConfirm, showErrorToast, showErrorToastDebounced, showErrorToastWithCallback, showInputDialog, showLoading, showLoadingWithAsync, showModal, showNetworkError, showPermissionRequest, showSuccessToast, showSuccessToastDebounced, showSuccessToastWithCallback, showToast, showUpdateDialog, showWarningToast } from './Tips/index.js';
3
+ export { cloudUtils } from './cloudUtils/index.js';