zcw-shared 2.0.1 → 2.4.0

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 (58) hide show
  1. package/README.md +17 -180
  2. package/dist/constants/apiErrorCodes.d.ts +17 -0
  3. package/dist/constants/apiErrorCodes.js +26 -0
  4. package/dist/constants/apiErrorCodes.js.map +1 -0
  5. package/dist/constants/authStorage.d.ts +4 -0
  6. package/dist/constants/authStorage.js +5 -0
  7. package/dist/constants/authStorage.js.map +1 -0
  8. package/dist/functions/file/getIconfontNameByExtension.d.ts +7 -0
  9. package/dist/functions/file/getIconfontNameByExtension.js +140 -0
  10. package/dist/functions/file/getIconfontNameByExtension.js.map +1 -0
  11. package/dist/functions/im/formatImChatConversationListTime.d.ts +1 -0
  12. package/dist/functions/im/formatImChatConversationListTime.js +19 -0
  13. package/dist/functions/im/formatImChatConversationListTime.js.map +1 -0
  14. package/dist/functions/image/getImageDimensions.js +15 -5
  15. package/dist/functions/image/getImageDimensions.js.map +1 -1
  16. package/dist/functions/qiankun/createQiankunVueApp.d.ts +17 -0
  17. package/dist/functions/qiankun/createQiankunVueApp.js +40 -0
  18. package/dist/functions/qiankun/createQiankunVueApp.js.map +1 -0
  19. package/dist/functions/storage/useDexieShortcuts.d.ts +28 -0
  20. package/dist/functions/storage/useDexieShortcuts.js +54 -0
  21. package/dist/functions/storage/useDexieShortcuts.js.map +1 -0
  22. package/dist/functions/storage/useLocalStorage.js +11 -12
  23. package/dist/functions/storage/useLocalStorage.js.map +1 -1
  24. package/dist/functions/storage/useSessionStorage.js +11 -12
  25. package/dist/functions/storage/useSessionStorage.js.map +1 -1
  26. package/dist/functions/storage/useStorageWithIndexedDB.js +4 -5
  27. package/dist/functions/storage/useStorageWithIndexedDB.js.map +1 -1
  28. package/dist/functions/uniapp/app-plus/buildIOSApp.js +12 -0
  29. package/dist/functions/uniapp/app-plus/buildIOSApp.js.map +1 -1
  30. package/dist/schemas/auth.schema.d.ts +10 -5
  31. package/dist/schemas/auth.schema.js +2 -1
  32. package/dist/schemas/auth.schema.js.map +1 -1
  33. package/dist/schemas/video.schema.d.ts +21 -21
  34. package/dist/schemas/video.schema.js +2 -2
  35. package/dist/vue-hooks/browser/useBridgeMessage.js +7 -8
  36. package/dist/vue-hooks/browser/useBridgeMessage.js.map +1 -1
  37. package/package.json +34 -1
  38. package/types/address.d.ts +38 -0
  39. package/types/auth.d.ts +3 -1
  40. package/types/checkin-config.d.ts +28 -0
  41. package/types/cloud-disk-config.d.ts +36 -0
  42. package/types/im-api.d.ts +118 -0
  43. package/types/im-chat.d.ts +49 -0
  44. package/types/music.d.ts +33 -0
  45. package/types/notification.d.ts +37 -0
  46. package/types/order.d.ts +61 -0
  47. package/types/oss.d.ts +26 -0
  48. package/types/page-config.d.ts +14 -0
  49. package/types/payment.d.ts +21 -0
  50. package/types/performance.d.ts +12 -0
  51. package/types/points-config.d.ts +44 -0
  52. package/types/product.d.ts +41 -0
  53. package/types/rbac.d.ts +24 -0
  54. package/types/report.d.ts +29 -0
  55. package/types/review.d.ts +13 -0
  56. package/types/uniapp-ios-build.d.ts +2 -0
  57. package/types/user.d.ts +36 -0
  58. package/types/video.d.ts +2 -2
@@ -19,7 +19,7 @@ export declare const VideoCategorySchema: z.ZodObject<{
19
19
  created_at?: string | undefined;
20
20
  }>;
21
21
  export declare const VideoSchema: z.ZodObject<{
22
- id: z.ZodNumber;
22
+ id: z.ZodString;
23
23
  title: z.ZodString;
24
24
  description: z.ZodOptional<z.ZodString>;
25
25
  cover_url: z.ZodOptional<z.ZodString>;
@@ -37,7 +37,7 @@ export declare const VideoSchema: z.ZodObject<{
37
37
  updated_at: z.ZodOptional<z.ZodString>;
38
38
  }, "strip", z.ZodTypeAny, {
39
39
  title: string;
40
- id: number;
40
+ id: string;
41
41
  description?: string | undefined;
42
42
  duration?: number | undefined;
43
43
  status?: string | undefined;
@@ -54,7 +54,7 @@ export declare const VideoSchema: z.ZodObject<{
54
54
  updated_at?: string | undefined;
55
55
  }, {
56
56
  title: string;
57
- id: number;
57
+ id: string;
58
58
  description?: string | undefined;
59
59
  duration?: number | undefined;
60
60
  status?: string | undefined;
@@ -72,7 +72,7 @@ export declare const VideoSchema: z.ZodObject<{
72
72
  }>;
73
73
  export declare const VideoListResponseSchema: z.ZodObject<{
74
74
  data: z.ZodArray<z.ZodObject<{
75
- id: z.ZodNumber;
75
+ id: z.ZodString;
76
76
  title: z.ZodString;
77
77
  description: z.ZodOptional<z.ZodString>;
78
78
  cover_url: z.ZodOptional<z.ZodString>;
@@ -90,7 +90,7 @@ export declare const VideoListResponseSchema: z.ZodObject<{
90
90
  updated_at: z.ZodOptional<z.ZodString>;
91
91
  }, "strip", z.ZodTypeAny, {
92
92
  title: string;
93
- id: number;
93
+ id: string;
94
94
  description?: string | undefined;
95
95
  duration?: number | undefined;
96
96
  status?: string | undefined;
@@ -107,7 +107,7 @@ export declare const VideoListResponseSchema: z.ZodObject<{
107
107
  updated_at?: string | undefined;
108
108
  }, {
109
109
  title: string;
110
- id: number;
110
+ id: string;
111
111
  description?: string | undefined;
112
112
  duration?: number | undefined;
113
113
  status?: string | undefined;
@@ -129,7 +129,7 @@ export declare const VideoListResponseSchema: z.ZodObject<{
129
129
  }, "strip", z.ZodTypeAny, {
130
130
  data: {
131
131
  title: string;
132
- id: number;
132
+ id: string;
133
133
  description?: string | undefined;
134
134
  duration?: number | undefined;
135
135
  status?: string | undefined;
@@ -151,7 +151,7 @@ export declare const VideoListResponseSchema: z.ZodObject<{
151
151
  }, {
152
152
  data: {
153
153
  title: string;
154
- id: number;
154
+ id: string;
155
155
  description?: string | undefined;
156
156
  duration?: number | undefined;
157
157
  status?: string | undefined;
@@ -173,7 +173,7 @@ export declare const VideoListResponseSchema: z.ZodObject<{
173
173
  }>;
174
174
  export declare const VideoDetailResponseSchema: z.ZodObject<{
175
175
  data: z.ZodObject<{
176
- id: z.ZodNumber;
176
+ id: z.ZodString;
177
177
  title: z.ZodString;
178
178
  description: z.ZodOptional<z.ZodString>;
179
179
  cover_url: z.ZodOptional<z.ZodString>;
@@ -191,7 +191,7 @@ export declare const VideoDetailResponseSchema: z.ZodObject<{
191
191
  updated_at: z.ZodOptional<z.ZodString>;
192
192
  }, "strip", z.ZodTypeAny, {
193
193
  title: string;
194
- id: number;
194
+ id: string;
195
195
  description?: string | undefined;
196
196
  duration?: number | undefined;
197
197
  status?: string | undefined;
@@ -208,7 +208,7 @@ export declare const VideoDetailResponseSchema: z.ZodObject<{
208
208
  updated_at?: string | undefined;
209
209
  }, {
210
210
  title: string;
211
- id: number;
211
+ id: string;
212
212
  description?: string | undefined;
213
213
  duration?: number | undefined;
214
214
  status?: string | undefined;
@@ -227,7 +227,7 @@ export declare const VideoDetailResponseSchema: z.ZodObject<{
227
227
  }, "strip", z.ZodTypeAny, {
228
228
  data: {
229
229
  title: string;
230
- id: number;
230
+ id: string;
231
231
  description?: string | undefined;
232
232
  duration?: number | undefined;
233
233
  status?: string | undefined;
@@ -246,7 +246,7 @@ export declare const VideoDetailResponseSchema: z.ZodObject<{
246
246
  }, {
247
247
  data: {
248
248
  title: string;
249
- id: number;
249
+ id: string;
250
250
  description?: string | undefined;
251
251
  duration?: number | undefined;
252
252
  status?: string | undefined;
@@ -302,7 +302,7 @@ export declare const VideoCategoriesResponseSchema: z.ZodObject<{
302
302
  }>;
303
303
  export declare const VideoCommentSchema: z.ZodObject<{
304
304
  id: z.ZodNumber;
305
- video_id: z.ZodNumber;
305
+ video_id: z.ZodString;
306
306
  user_id: z.ZodString;
307
307
  content: z.ZodString;
308
308
  parent_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -312,7 +312,7 @@ export declare const VideoCommentSchema: z.ZodObject<{
312
312
  }, "strip", z.ZodTypeAny, {
313
313
  id: number;
314
314
  content: string;
315
- video_id: number;
315
+ video_id: string;
316
316
  user_id: string;
317
317
  created_at?: string | undefined;
318
318
  like_count?: number | undefined;
@@ -321,7 +321,7 @@ export declare const VideoCommentSchema: z.ZodObject<{
321
321
  }, {
322
322
  id: number;
323
323
  content: string;
324
- video_id: number;
324
+ video_id: string;
325
325
  user_id: string;
326
326
  created_at?: string | undefined;
327
327
  like_count?: number | undefined;
@@ -331,7 +331,7 @@ export declare const VideoCommentSchema: z.ZodObject<{
331
331
  export declare const VideoCommentsResponseSchema: z.ZodObject<{
332
332
  data: z.ZodArray<z.ZodObject<{
333
333
  id: z.ZodNumber;
334
- video_id: z.ZodNumber;
334
+ video_id: z.ZodString;
335
335
  user_id: z.ZodString;
336
336
  content: z.ZodString;
337
337
  parent_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
@@ -341,7 +341,7 @@ export declare const VideoCommentsResponseSchema: z.ZodObject<{
341
341
  }, "strip", z.ZodTypeAny, {
342
342
  id: number;
343
343
  content: string;
344
- video_id: number;
344
+ video_id: string;
345
345
  user_id: string;
346
346
  created_at?: string | undefined;
347
347
  like_count?: number | undefined;
@@ -350,7 +350,7 @@ export declare const VideoCommentsResponseSchema: z.ZodObject<{
350
350
  }, {
351
351
  id: number;
352
352
  content: string;
353
- video_id: number;
353
+ video_id: string;
354
354
  user_id: string;
355
355
  created_at?: string | undefined;
356
356
  like_count?: number | undefined;
@@ -364,7 +364,7 @@ export declare const VideoCommentsResponseSchema: z.ZodObject<{
364
364
  data: {
365
365
  id: number;
366
366
  content: string;
367
- video_id: number;
367
+ video_id: string;
368
368
  user_id: string;
369
369
  created_at?: string | undefined;
370
370
  like_count?: number | undefined;
@@ -378,7 +378,7 @@ export declare const VideoCommentsResponseSchema: z.ZodObject<{
378
378
  data: {
379
379
  id: number;
380
380
  content: string;
381
- video_id: number;
381
+ video_id: string;
382
382
  user_id: string;
383
383
  created_at?: string | undefined;
384
384
  like_count?: number | undefined;
@@ -7,7 +7,7 @@ export const VideoCategorySchema = z.object({
7
7
  created_at: z.string().optional(),
8
8
  });
9
9
  export const VideoSchema = z.object({
10
- id: z.number(),
10
+ id: z.string(),
11
11
  title: z.string(),
12
12
  description: z.string().optional(),
13
13
  cover_url: z.string().optional(),
@@ -38,7 +38,7 @@ export const VideoCategoriesResponseSchema = z.object({
38
38
  });
39
39
  export const VideoCommentSchema = z.object({
40
40
  id: z.number(),
41
- video_id: z.number(),
41
+ video_id: z.string(),
42
42
  user_id: z.string(),
43
43
  content: z.string(),
44
44
  parent_id: z.number().nullable().optional(),
@@ -1,21 +1,20 @@
1
1
  import { postBridgeMessage } from '../../functions/hybrid/postBridgeMessage';
2
2
  import { createRequestMessage } from '../../functions/hybrid/createBridgeMessage';
3
3
  export function useBridgeMessage(deps) {
4
- const { vue, isServer } = deps;
5
4
  const isInWechatMiniprogram = () => {
6
- if (isServer())
5
+ if (deps.isServer())
7
6
  return false;
8
7
  const wx = deps.getWx();
9
8
  return !!(wx && wx.miniProgram);
10
9
  };
11
10
  const isInAppWebview = () => {
12
- if (isServer())
11
+ if (deps.isServer())
13
12
  return false;
14
13
  const window = deps.window;
15
14
  return !!(window?.uni || window?.plus);
16
15
  };
17
16
  const getDetectedEnv = () => {
18
- if (isServer())
17
+ if (deps.isServer())
19
18
  return 'unknown';
20
19
  if (isInWechatMiniprogram())
21
20
  return 'miniapp';
@@ -24,13 +23,13 @@ export function useBridgeMessage(deps) {
24
23
  return 'h5';
25
24
  };
26
25
  const detectedEnv = getDetectedEnv();
27
- const environment = vue.ref(detectedEnv);
28
- const error = vue.ref(null);
26
+ const environment = deps.vue.ref(detectedEnv);
27
+ const error = deps.vue.ref(null);
29
28
  const isBridgeSupported = () => {
30
29
  return isInWechatMiniprogram() || isInAppWebview();
31
30
  };
32
31
  const postBridgeMessageHook = async (data, options) => {
33
- if (isServer()) {
32
+ if (deps.isServer()) {
34
33
  throw new Error('服务端环境不支持');
35
34
  }
36
35
  error.value = null;
@@ -61,7 +60,7 @@ export function useBridgeMessage(deps) {
61
60
  }
62
61
  };
63
62
  const getEnvironmentInfo = () => {
64
- if (isServer()) {
63
+ if (deps.isServer()) {
65
64
  return {
66
65
  environment: 'server',
67
66
  userA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,6 +1,6 @@
1
1
  {
2
2
  "name": "zcw-shared",
3
- "version": "2.0.1",
3
+ "version": "2.4.0",
4
4
  "files": [
5
5
  "references",
6
6
  "dist",
@@ -15,9 +15,18 @@
15
15
  "dependencies": {
16
16
  "zod": "^3.23.8"
17
17
  },
18
+ "peerDependencies": {
19
+ "dexie": "^4.0.1"
20
+ },
21
+ "peerDependenciesMeta": {
22
+ "dexie": {
23
+ "optional": true
24
+ }
25
+ },
18
26
  "devDependencies": {
19
27
  "@cloudbase/manager-node": "^4.3.2",
20
28
  "cos-nodejs-sdk-v5": "^2.14.4",
29
+ "dexie": "^4.3.0",
21
30
  "jszip": "^3.10.1",
22
31
  "tsx": "^4.20.3",
23
32
  "typescript": "^5.8.3",
@@ -26,6 +35,8 @@
26
35
  "zcw-vue-ui": "^1.25.1"
27
36
  },
28
37
  "exports": {
38
+ "./constants/apiErrorCodes": "./dist/constants/apiErrorCodes.js",
39
+ "./constants/authStorage": "./dist/constants/authStorage.js",
29
40
  "./constants/colorPatterns": "./dist/constants/colorPatterns.js",
30
41
  "./constants/hybridConstants": "./dist/constants/hybridConstants.js",
31
42
  "./constants/namedColors": "./dist/constants/namedColors.js",
@@ -148,6 +159,7 @@
148
159
  "./functions/fake/generateFakeLicensePlate": "./dist/functions/fake/generateFakeLicensePlate.js",
149
160
  "./functions/file/formatFileSize": "./dist/functions/file/formatFileSize.js",
150
161
  "./functions/file/getFileExtension": "./dist/functions/file/getFileExtension.js",
162
+ "./functions/file/getIconfontNameByExtension": "./dist/functions/file/getIconfontNameByExtension.js",
151
163
  "./functions/functional/compose": "./dist/functions/functional/compose.js",
152
164
  "./functions/functional/cond": "./dist/functions/functional/cond.js",
153
165
  "./functions/functional/curry": "./dist/functions/functional/curry.js",
@@ -161,6 +173,7 @@
161
173
  "./functions/hybrid/generateBridgeMessageId": "./dist/functions/hybrid/generateBridgeMessageId.js",
162
174
  "./functions/hybrid/postBridgeMessage": "./dist/functions/hybrid/postBridgeMessage.js",
163
175
  "./functions/hybrid/validateBridgeMessage": "./dist/functions/hybrid/validateBridgeMessage.js",
176
+ "./functions/im/formatImChatConversationListTime": "./dist/functions/im/formatImChatConversationListTime.js",
164
177
  "./functions/image/compressImageToWidth": "./dist/functions/image/compressImageToWidth.js",
165
178
  "./functions/image/compressToTargetSize": "./dist/functions/image/compressToTargetSize.js",
166
179
  "./functions/image/generateFavIcon": "./dist/functions/image/generateFavIcon.js",
@@ -222,7 +235,9 @@
222
235
  "./functions/principles/myNew": "./dist/functions/principles/myNew.js",
223
236
  "./functions/promise/sleep": "./dist/functions/promise/sleep.js",
224
237
  "./functions/promise/timeout": "./dist/functions/promise/timeout.js",
238
+ "./functions/qiankun/createQiankunVueApp": "./dist/functions/qiankun/createQiankunVueApp.js",
225
239
  "./functions/software/findSoftware": "./dist/functions/software/findSoftware.js",
240
+ "./functions/storage/useDexieShortcuts": "./dist/functions/storage/useDexieShortcuts.js",
226
241
  "./functions/storage/useLocalStorage": "./dist/functions/storage/useLocalStorage.js",
227
242
  "./functions/storage/useSessionStorage": "./dist/functions/storage/useSessionStorage.js",
228
243
  "./functions/storage/useStorage": "./dist/functions/storage/useStorage.js",
@@ -379,20 +394,37 @@
379
394
  "./vue-hooks/worker/useWebWorker": "./dist/vue-hooks/worker/useWebWorker.js",
380
395
  "./vue-hooks/worker/useWorkerFunction": "./dist/vue-hooks/worker/useWorkerFunction.js",
381
396
  "./vue-hooks/worker/useWorkerPool": "./dist/vue-hooks/worker/useWorkerPool.js",
397
+ "./types/address": "./types/address.d.ts",
382
398
  "./types/algorithm-visual": "./types/algorithm-visual.d.ts",
383
399
  "./types/algorithm": "./types/algorithm.d.ts",
384
400
  "./types/altool": "./types/altool.d.ts",
385
401
  "./types/android-build": "./types/android-build.d.ts",
386
402
  "./types/auth": "./types/auth.d.ts",
403
+ "./types/checkin-config": "./types/checkin-config.d.ts",
404
+ "./types/cloud-disk-config": "./types/cloud-disk-config.d.ts",
387
405
  "./types/color": "./types/color.d.ts",
388
406
  "./types/design-system": "./types/design-system.d.ts",
389
407
  "./types/geometry": "./types/geometry.d.ts",
390
408
  "./types/hybrid": "./types/hybrid.d.ts",
409
+ "./types/im-api": "./types/im-api.d.ts",
410
+ "./types/im-chat": "./types/im-chat.d.ts",
391
411
  "./types/ios-build": "./types/ios-build.d.ts",
412
+ "./types/music": "./types/music.d.ts",
413
+ "./types/notification": "./types/notification.d.ts",
414
+ "./types/order": "./types/order.d.ts",
415
+ "./types/oss": "./types/oss.d.ts",
416
+ "./types/page-config": "./types/page-config.d.ts",
417
+ "./types/payment": "./types/payment.d.ts",
418
+ "./types/performance": "./types/performance.d.ts",
392
419
  "./types/pgyer": "./types/pgyer.d.ts",
393
420
  "./types/placement": "./types/placement.d.ts",
394
421
  "./types/platform": "./types/platform.d.ts",
422
+ "./types/points-config": "./types/points-config.d.ts",
423
+ "./types/product": "./types/product.d.ts",
424
+ "./types/rbac": "./types/rbac.d.ts",
395
425
  "./types/reactive": "./types/reactive.d.ts",
426
+ "./types/report": "./types/report.d.ts",
427
+ "./types/review": "./types/review.d.ts",
396
428
  "./types/semver": "./types/semver.d.ts",
397
429
  "./types/software": "./types/software.d.ts",
398
430
  "./types/storage": "./types/storage.d.ts",
@@ -400,6 +432,7 @@
400
432
  "./types/uniapp-android-build": "./types/uniapp-android-build.d.ts",
401
433
  "./types/uniapp-ios-build": "./types/uniapp-ios-build.d.ts",
402
434
  "./types/uniapp": "./types/uniapp.d.ts",
435
+ "./types/user": "./types/user.d.ts",
403
436
  "./types/video": "./types/video.d.ts",
404
437
  "./types/vue": "./types/vue.d.ts",
405
438
  "./types/worker": "./types/worker.d.ts"
@@ -0,0 +1,38 @@
1
+ export interface Address {
2
+ id: number
3
+ user_id?: string
4
+ name?: string
5
+ phone?: string
6
+ province?: string
7
+ city?: string
8
+ district?: string
9
+ detail?: string
10
+ is_default?: boolean
11
+ created_at?: string
12
+ updated_at?: string
13
+ }
14
+
15
+ export interface AddressListResponse {
16
+ data: Address[]
17
+ count: number
18
+ }
19
+
20
+ export interface CreateAddressPayload {
21
+ name: string
22
+ phone: string
23
+ province: string
24
+ city: string
25
+ district?: string
26
+ detail: string
27
+ is_default?: boolean
28
+ }
29
+
30
+ export interface UpdateAddressPayload {
31
+ name?: string
32
+ phone?: string
33
+ province?: string
34
+ city?: string
35
+ district?: string
36
+ detail?: string
37
+ is_default?: boolean
38
+ }
package/types/auth.d.ts CHANGED
@@ -37,10 +37,12 @@ export interface RefreshTokenResponse {
37
37
  message: string
38
38
  }
39
39
 
40
+ /** 发送验证码响应:data 不含验证码(安全),仅返回发送结果 */
40
41
  export interface SendSmsCodeResponse {
41
42
  code: number
42
43
  data: {
43
- code: string
44
+ success: boolean
45
+ message: string
44
46
  }
45
47
  message: string
46
48
  }
@@ -0,0 +1,28 @@
1
+ export interface CheckinConfig {
2
+ // 基础配置
3
+ enabled: boolean // 是否启用签到功能
4
+
5
+ // 签到奖励配置
6
+ daily_reward_points: number // 每日签到奖励积分
7
+ consecutive_reward_enabled: boolean // 是否启用连续签到奖励
8
+ consecutive_rewards: Array<{
9
+ days: number // 连续天数
10
+ points: number // 奖励积分
11
+ }> // 连续签到奖励规则
12
+
13
+ // 时间配置
14
+ checkin_time_limit_start?: string // 签到开始时间(HH:mm)
15
+ checkin_time_limit_end?: string // 签到结束时间(HH:mm)
16
+ allow_midnight_checkin: boolean // 是否允许跨天签到(0点后仍可签前一天)
17
+
18
+ // 其他配置
19
+ max_consecutive_days: number // 最大连续签到天数(用于统计显示)
20
+ reset_consecutive_on_miss: boolean // 断签是否重置连续天数
21
+ }
22
+
23
+ export interface CheckinConfigResponse {
24
+ data: CheckinConfig
25
+ }
26
+
27
+ export interface UpdateCheckinConfigPayload
28
+ extends Partial<CheckinConfig> {}
@@ -0,0 +1,36 @@
1
+ export interface CloudDiskConfig {
2
+ // 容量配置
3
+ default_user_capacity: number // 默认用户容量(字节)
4
+ max_user_capacity: number // 最大用户容量(字节)
5
+ max_file_size: number // 单个文件最大大小(字节)
6
+
7
+ // 私有化配置
8
+ is_private: boolean // 是否私有化部署
9
+ allow_public_share: boolean // 是否允许公开分享
10
+ require_auth_for_upload: boolean // 上传是否需要认证
11
+
12
+ // 存储配置
13
+ default_bucket: string // 默认存储桶
14
+ allowed_file_types: string[] // 允许的文件类型(MIME类型)
15
+ blocked_file_types: string[] // 禁止的文件类型(MIME类型)
16
+
17
+ // 功能配置
18
+ enable_thumbnail: boolean // 是否启用缩略图
19
+ enable_preview: boolean // 是否启用预览
20
+ enable_download: boolean // 是否允许下载
21
+
22
+ // 安全配置
23
+ max_share_expire_days: number // 分享链接最大过期天数
24
+ require_password_for_share: boolean // 分享是否需要密码
25
+
26
+ // 其他配置
27
+ auto_cleanup_deleted_files: boolean // 是否自动清理已删除文件
28
+ deleted_files_retention_days: number // 已删除文件保留天数
29
+ }
30
+
31
+ export interface CloudDiskConfigResponse {
32
+ data: CloudDiskConfig
33
+ }
34
+
35
+ export interface UpdateCloudDiskConfigPayload
36
+ extends Partial<Omit<CloudDiskConfig, 'default_bucket'>> {}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * IM:与后端 HTTP / WebSocket JSON 及落库归一后的**领域形状**一致(多为 snake_case)。
3
+ *
4
+ * - **终端 UI 展示**见 `zcw-shared/types/im-chat`(`ChatMessage` / `ChatConversation`,camelCase、含 sender 对象等),
5
+ * 与本文件的 `ImApiMessage` 在设计上不同:前者是列表/气泡视图模型,后者是接口契约。
6
+ * - 需要兼顾旧代码时可用别名 `ImMessage`、`Conversation` 等(均指向 ImApi*)。
7
+ */
8
+
9
+ /** 出站投递状态(与送达已读 status 分离);库内成功落库行一般为 success */
10
+ export type ImOutboundStatus =
11
+ | 'queued'
12
+ | 'sending'
13
+ | 'failed'
14
+ | 'success'
15
+
16
+ /** HTTP / WS 中的消息对象(与 `ImService` 返回结构一致) */
17
+ export interface ImApiMessage {
18
+ /** PostgreSQL BIGSERIAL 为 number;CloudBase 等可能为十六进制字符串文档 id */
19
+ id: string | number
20
+ sender_id: string
21
+ conversation_id: string
22
+ content: string
23
+ type: 'text' | 'image' | 'file' | 'system' | 'audio' | 'video'
24
+ status: 'sent' | 'delivered' | 'read'
25
+ /** 发送方在该会话中的第几条(由服务端写入;旧数据可由接口补算) */
26
+ sender_seq?: number
27
+ /** 终端上报的本地发送时刻(ISO) */
28
+ client_sent_at?: string
29
+ /** 服务端落库/受理时刻(ISO),排序与展示优先于 created_at 缺失时 */
30
+ server_sent_at?: string
31
+ /** 终端幂等 ID,重试去重 */
32
+ client_message_id?: string
33
+ /** 终端上报的已尝试发送次数快照(可选) */
34
+ send_retry_count?: number
35
+ /** 出站状态;仅终端离线队列或后续异步扩展用库内非 success */
36
+ outbound_status?: ImOutboundStatus
37
+ extra_data?: Record<string, any>
38
+ created_at?: string
39
+ updated_at?: string
40
+ }
41
+
42
+ /** 会话对象(接口返回;成员 id 列表 + 可选最后一条消息) */
43
+ export interface ImApiConversation {
44
+ id: string
45
+ type: 'private' | 'group'
46
+ name?: string
47
+ avatar?: string
48
+ members: string[]
49
+ last_message?: ImApiMessage
50
+ unread_count?: number
51
+ created_at?: string
52
+ updated_at?: string
53
+ }
54
+
55
+ /** `registerMediaOutbound` 响应:附件 id、已落库消息、OSS 直传目标 */
56
+ export interface ImRegisterMediaOutboundResult {
57
+ attachmentId: string
58
+ message: ImApiMessage
59
+ upload: { bucket: string; path: string }
60
+ }
61
+
62
+ /** 仓储驱动返回的 `im_messages` 行(字段宽松,需经归一函数转为 `ImApiMessage`) */
63
+ export interface ImDbMessageRow {
64
+ id: string | number
65
+ sender_id: string
66
+ conversation_id: string
67
+ content: string
68
+ type: string
69
+ status: string
70
+ sender_seq?: number | null
71
+ client_sent_at?: string | null
72
+ server_sent_at?: string | null
73
+ client_message_id?: string | null
74
+ send_retry_count?: number | null
75
+ outbound_status?: string | null
76
+ extra_data?: Record<string, any>
77
+ created_at?: string
78
+ updated_at?: string
79
+ }
80
+
81
+ export interface ImDbConversationRow {
82
+ id: string
83
+ type: string
84
+ name?: string
85
+ avatar?: string
86
+ members?: string[]
87
+ created_at?: string
88
+ updated_at?: string
89
+ }
90
+
91
+ export interface ImDbAttachmentRow {
92
+ id: string
93
+ uploader_id: string
94
+ conversation_id: string
95
+ storage_bucket: string
96
+ storage_path: string
97
+ public_url?: string | null
98
+ original_name?: string | null
99
+ mime_type?: string | null
100
+ size_bytes?: number | null
101
+ status: string
102
+ upload_retry_count?: number | null
103
+ last_error?: string | null
104
+ linked_message_id?: string | number | null
105
+ created_at?: string
106
+ updated_at?: string
107
+ }
108
+
109
+ /** 与 `ImApiMessage` 相同(简练别名,服务端历史代码常用) */
110
+ export type ImMessage = ImApiMessage
111
+
112
+ /** 与 `ImApiConversation` 相同 */
113
+ export type ImConversation = ImApiConversation
114
+
115
+ /** 与 `ImApiConversation` 相同(历史泛名,建议新代码用 ImApiConversation) */
116
+ export type Conversation = ImApiConversation
117
+
118
+ export type RegisterMediaOutboundResult = ImRegisterMediaOutboundResult
@@ -0,0 +1,49 @@
1
+ /**
2
+ * IM 聊天:**终端 UI** 用的视图类型(camelCase,含 `sender` 对象等)。
3
+ *
4
+ * 与接口 JSON 形状不同,后者见 `zcw-shared/types/im-api`(`ImApiMessage` / `ImApiConversation`)。
5
+ * 在仓库层做 `ImApiMessage` → `ChatMessage` 的映射即可两端共类型、各层语义清晰。
6
+ */
7
+ export interface ChatMessage {
8
+ id: string
9
+ type: 'text' | 'image' | 'video' | 'voice' | 'file'
10
+ content: string
11
+ timestamp: Date
12
+ sender: {
13
+ id: string
14
+ name: string
15
+ avatar?: string
16
+ }
17
+ isOwn?: boolean
18
+ status?: 'sending' | 'sent' | 'delivered' | 'read' | 'failed'
19
+ senderSeq?: number
20
+ timeLabel?: string
21
+ clientTimeLabel?: string
22
+ clientSentAt?: string
23
+ serverSentAt?: string
24
+ /** 服务端 extra_data.media_upload_status 映射,用于图片等先上传再展示 */
25
+ mediaUploadStatus?: 'uploading' | 'uploaded' | 'failed'
26
+ /** 本地上传 0–100;仅在前端写入,用于 OSS 上传进度 */
27
+ mediaUploadProgress?: number
28
+ /** 终端幂等 id,与 ImApiMessage.client_message_id 一致 */
29
+ clientMessageId?: string
30
+ /** 媒体登记时原名(content 尚为空时用于文件气泡标题) */
31
+ mediaOriginalFileName?: string
32
+ /** 图片/视频缩略图 URL;存在时列表气泡优先展示缩略图 */
33
+ mediaThumbnailUrl?: string
34
+ /** 气泡内展示用的原始像素宽(如 extra_data.location_x / image_width) */
35
+ mediaWidth?: number
36
+ /** 气泡内展示用的原始像素高 */
37
+ mediaHeight?: number
38
+ }
39
+
40
+ export interface ChatConversation {
41
+ id: string
42
+ name: string
43
+ avatar?: string
44
+ description?: string
45
+ lastMessage?: string
46
+ timestamp?: Date
47
+ unreadCount?: number
48
+ isOnline?: boolean
49
+ }