@djvlc/openapi-admin-client 1.6.10 → 1.6.12

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.
@@ -1,5 +1,28 @@
1
1
  # Schema 组件索引
2
2
 
3
+ # ============================================================================
4
+ # 复杂类型引用(引用 JSON Schema 文件,types 与 packages/schemas 为单一数据源)
5
+ # ============================================================================
6
+
7
+ # PageSchema:页面 Schema 定义(单一数据源为 JSON Schema,此处为占位以兼容 OpenAPI Generator)
8
+ # 类型:types/src/page/schema.ts - PageSchema
9
+ # 完整结构:packages/schemas/schemas/page-schema.json(Schema ID: https://djvlc.com/schemas/page-schema.v1.json)
10
+ # 校验与编辑器请使用 @djvlc/contracts-schemas 或 page-schema.json
11
+ PageSchema:
12
+ type: object
13
+ description: |
14
+ 页面 Schema(PageSchema)。完整定义与校验见 packages/schemas/schemas/page-schema.json 与 types/src/page/schema.ts。
15
+ additionalProperties: true
16
+
17
+ # ComponentMeta:组件元数据定义(单一数据源为 JSON Schema,此处为占位以兼容 OpenAPI Generator)
18
+ # 类型:types/src/component/meta.ts - ComponentMeta
19
+ # 完整结构:packages/schemas/schemas/component-meta.json(Schema ID: https://djvlc.com/schemas/component-meta.v1.json)
20
+ ComponentMeta:
21
+ type: object
22
+ description: |
23
+ 组件元数据(ComponentMeta)。完整定义与校验见 packages/schemas/schemas/component-meta.json 与 types/src/component/meta.ts。
24
+ additionalProperties: true
25
+
3
26
  # ============================================================================
4
27
  # 通用
5
28
  # ============================================================================
@@ -26,34 +49,120 @@ PaginationMeta:
26
49
  minimum: 0
27
50
  description: 总页数
28
51
 
52
+ # ============================================================================
53
+ # 统一响应结构(与 platform 仓库保持一致)
54
+ # ============================================================================
55
+
56
+ SuccessResponse:
57
+ type: object
58
+ required: [success, code, message, data, timestamp, path]
59
+ description: 成功响应(ApiSuccessResponse,与 types/src/common/api.ts 保持一致)
60
+ properties:
61
+ success:
62
+ type: boolean
63
+ enum: [true]
64
+ example: true
65
+ description: 是否成功(固定为 true)
66
+ code:
67
+ type: string
68
+ example: OK
69
+ description: 业务状态码
70
+ message:
71
+ type: string
72
+ example: 操作成功
73
+ description: 响应消息
74
+ data:
75
+ description: 响应数据(泛型 T)
76
+ timestamp:
77
+ type: integer
78
+ format: int64
79
+ example: 1702300000000
80
+ description: 响应时间戳(Unix 毫秒时间戳,number)
81
+ path:
82
+ type: string
83
+ example: /api/admin/pages
84
+ description: 请求路径
85
+ requestId:
86
+ type: string
87
+ example: uuid-string
88
+ description: 请求 ID(可选)
89
+
29
90
  ErrorResponse:
30
91
  type: object
31
- required: [code, message]
92
+ required: [success, code, message, timestamp, path]
93
+ description: 错误响应(ApiErrorResponse,与 types/src/common/api.ts 保持一致)
32
94
  properties:
95
+ success:
96
+ type: boolean
97
+ enum: [false]
98
+ example: false
99
+ description: 是否成功(固定为 false)
33
100
  code:
34
101
  type: string
35
- description: 错误码
102
+ example: VALIDATION_INVALID_PARAMS
103
+ description: 错误码(ErrorCode | string)
36
104
  message:
37
105
  type: string
38
- description: 错误消息
39
- details:
40
- type: array
41
- items:
42
- $ref: '#/ErrorDetail'
43
- description: 错误详情
106
+ example: 请求参数无效
107
+ description: 错误消息(用户可读)
108
+ # 不使 oneOf(array|object),避免生成器产出 Array<...> 等非法 TS;不指定 type 表示允许 array 或 object
109
+ data:
110
+ description: 错误详情(验证错误时使用 ApiErrorDetail[],其他情况使用 unknown,放在 data 字段中)
111
+ nullable: true
112
+ timestamp:
113
+ type: integer
114
+ format: int64
115
+ example: 1702300000000
116
+ description: 响应时间戳(Unix 毫秒时间戳,number)
117
+ path:
118
+ type: string
119
+ example: /api/admin/pages
120
+ description: 请求路径
121
+ requestId:
122
+ type: string
123
+ example: uuid-string
124
+ description: 请求 ID(可选)
125
+ traceId:
126
+ type: string
127
+ example: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
128
+ description: 链路追踪 ID(可选,用于分布式追踪)
44
129
 
45
130
  ErrorDetail:
46
131
  type: object
132
+ required: [message]
133
+ description: 错误详情(ApiErrorDetail,与 types/src/common/api.ts 保持一致)
47
134
  properties:
48
135
  field:
49
136
  type: string
50
- description: 字段名
137
+ description: 字段路径(可选)
51
138
  message:
52
139
  type: string
53
- description: 字段错误信息
140
+ description: 错误消息(必填)
54
141
  code:
55
142
  type: string
56
- description: 字段错误码
143
+ description: 错误码(可选)
144
+
145
+ # 具名 schema,供 ErrorResponse.data oneOf 使用,避免生成器产出 Array<...> 非法类型名
146
+ ErrorDetailList:
147
+ type: array
148
+ description: 验证错误时的 data(ApiErrorDetail[])
149
+ items:
150
+ $ref: '#/ErrorDetail'
151
+
152
+ ErrorResponseData:
153
+ type: object
154
+ additionalProperties: true
155
+ description: 错误响应数据(用于非验证错误场景,对应 unknown 类型)
156
+
157
+ # 具名 schema,供 oneOf 使用,避免生成器产出无效 TypeScript(自由对象分支须有命名类型)
158
+ ErrorResponseDataObject:
159
+ type: object
160
+ description: 错误响应 data 的非数组分支(任意结构)
161
+ properties:
162
+ _:
163
+ type: string
164
+ description: 占位属性,确保生成器产出命名类型
165
+ additionalProperties: true
57
166
 
58
167
  # ============================================================================
59
168
  # 页面相关
@@ -100,22 +209,28 @@ PageInfo:
100
209
  description: 更新者 ID
101
210
 
102
211
  PageListResponse:
103
- type: object
104
- required: [data, meta]
105
- properties:
106
- data:
107
- type: array
108
- items:
109
- $ref: '#/PageInfo'
110
- meta:
111
- $ref: '#/PaginationMeta'
212
+ allOf:
213
+ - $ref: '#/SuccessResponse'
214
+ - type: object
215
+ properties:
216
+ data:
217
+ type: object
218
+ required: [items, meta]
219
+ properties:
220
+ items:
221
+ type: array
222
+ items:
223
+ $ref: '#/PageInfo'
224
+ meta:
225
+ $ref: '#/PaginationMeta'
112
226
 
113
227
  PageResponse:
114
- type: object
115
- required: [data]
116
- properties:
117
- data:
118
- $ref: '#/PageInfo'
228
+ allOf:
229
+ - $ref: '#/SuccessResponse'
230
+ - type: object
231
+ properties:
232
+ data:
233
+ $ref: '#/PageInfo'
119
234
 
120
235
  CreatePageRequest:
121
236
  type: object
@@ -170,26 +285,32 @@ DraftResponse:
170
285
 
171
286
  DraftData:
172
287
  type: object
173
- required: [pageId, content, updatedAt]
288
+ required: [id, pageId, schema, isDirty, savedAt, savedBy, updatedAt]
289
+ description: 页面草稿(PageDraft,根据 types/src/page/draft.ts)
174
290
  properties:
291
+ id:
292
+ type: string
293
+ description: 草稿 ID(UniqueId)
175
294
  pageId:
176
295
  type: string
177
- description: 页面 ID
178
- content:
179
- type: object
180
- description: 页面 Schema 内容
181
- baseVersion:
296
+ description: 页面 ID(UniqueId)
297
+ schema:
298
+ $ref: '#/PageSchema'
299
+ description: 草稿内容(PageSchema,见 packages/schemas/schemas/page-schema.json)
300
+ isDirty:
301
+ type: boolean
302
+ description: 是否有未保存的更改
303
+ savedAt:
304
+ type: string
305
+ format: date-time
306
+ description: 最后保存时间(ISODateTime)
307
+ savedBy:
182
308
  type: string
183
- description: 基于的版本号
309
+ description: 最后保存者
184
310
  updatedAt:
185
311
  type: string
186
312
  format: date-time
187
- description: 最后更新时间
188
- updatedBy:
189
- type: string
190
- description: 最后更新者 ID
191
- lockInfo:
192
- $ref: '#/LockInfo'
313
+ description: 更新时间(ISODateTime)
193
314
 
194
315
  LockInfo:
195
316
  type: object
@@ -208,14 +329,15 @@ LockInfo:
208
329
 
209
330
  SaveDraftRequest:
210
331
  type: object
211
- required: [content]
332
+ required: [schema]
333
+ description: 保存草稿请求(根据 types/src/page/draft.ts)
212
334
  properties:
213
- content:
214
- type: object
215
- description: 页面 Schema 内容
335
+ schema:
336
+ $ref: '#/PageSchema'
337
+ description: 页面 Schema 内容(PageSchema,见 packages/schemas/schemas/page-schema.json)
216
338
  baseVersion:
217
339
  type: string
218
- description: 基于的版本号(用于冲突检测)
340
+ description: 基于的版本号(用于冲突检测,UniqueId)
219
341
  force:
220
342
  type: boolean
221
343
  default: false
@@ -285,18 +407,230 @@ VersionResponse:
285
407
 
286
408
  PublishRequest:
287
409
  type: object
410
+ description: 发布页面请求(PublishConfig,根据设计总纲 V2 和 platform 实现)
288
411
  properties:
289
- changelog:
412
+ channel:
290
413
  type: string
291
- maxLength: 2048
292
- description: 变更日志
293
- versionBump:
414
+ enum: [preview, prod, gray]
415
+ default: prod
416
+ description: 发布渠道PublishChannel(preview/prod/gray)
417
+ description:
294
418
  type: string
295
- enum: [major, minor, patch]
296
- default: patch
297
- description: 版本号升级类型
298
- rollout:
299
- $ref: '#/RolloutConfig'
419
+ maxLength: 500
420
+ description: 发布描述/备注
421
+ publishConfig:
422
+ type: object
423
+ description: 发布配置(PublishConfig)
424
+ properties:
425
+ rollout:
426
+ type: object
427
+ description: 灰度配置(PublishRolloutConfig,单次发布时的临时配置)
428
+ properties:
429
+ strategy:
430
+ type: object
431
+ description: 灰度策略配置(RolloutStrategyConfig,支持 percentage/whitelist/blacklist/feature/time_window/ab_test/canary)
432
+ oneOf:
433
+ - type: object
434
+ properties:
435
+ type:
436
+ type: string
437
+ enum: [percentage]
438
+ percentage:
439
+ type: integer
440
+ minimum: 0
441
+ maximum: 100
442
+ bucketKey:
443
+ type: string
444
+ enum: [uid, device_id, session_id]
445
+ bucketSeed:
446
+ type: string
447
+ - type: object
448
+ properties:
449
+ type:
450
+ type: string
451
+ enum: [whitelist]
452
+ userIds:
453
+ type: array
454
+ items:
455
+ type: string
456
+ deviceIds:
457
+ type: array
458
+ items:
459
+ type: string
460
+ ips:
461
+ type: array
462
+ items:
463
+ type: string
464
+ - type: object
465
+ properties:
466
+ type:
467
+ type: string
468
+ enum: [blacklist]
469
+ userIds:
470
+ type: array
471
+ items:
472
+ type: string
473
+ deviceIds:
474
+ type: array
475
+ items:
476
+ type: string
477
+ ips:
478
+ type: array
479
+ items:
480
+ type: string
481
+ - type: object
482
+ properties:
483
+ type:
484
+ type: string
485
+ enum: [feature]
486
+ conditions:
487
+ type: array
488
+ items:
489
+ type: object
490
+ properties:
491
+ field:
492
+ type: string
493
+ operator:
494
+ type: string
495
+ enum: [eq, ne, in, not_in, regex, contains, starts_with, ends_with]
496
+ value:
497
+ $ref: '#/ConditionValue'
498
+ logic:
499
+ type: string
500
+ enum: [and, or]
501
+ - type: object
502
+ properties:
503
+ type:
504
+ type: string
505
+ enum: [time_window]
506
+ startAt:
507
+ type: string
508
+ format: date-time
509
+ endAt:
510
+ type: string
511
+ format: date-time
512
+ timezone:
513
+ type: string
514
+ - type: object
515
+ properties:
516
+ type:
517
+ type: string
518
+ enum: [ab_test]
519
+ experimentId:
520
+ type: string
521
+ variantId:
522
+ type: string
523
+ variants:
524
+ type: array
525
+ items:
526
+ type: object
527
+ properties:
528
+ id:
529
+ type: string
530
+ name:
531
+ type: string
532
+ weight:
533
+ type: number
534
+ pageVersionId:
535
+ type: string
536
+ - type: object
537
+ properties:
538
+ type:
539
+ type: string
540
+ enum: [canary]
541
+ stages:
542
+ type: array
543
+ items:
544
+ type: object
545
+ properties:
546
+ name:
547
+ type: string
548
+ percentage:
549
+ type: integer
550
+ durationSeconds:
551
+ type: integer
552
+ requireApproval:
553
+ type: boolean
554
+ currentStageIndex:
555
+ type: integer
556
+ autoAdvance:
557
+ type: object
558
+ properties:
559
+ enabled:
560
+ type: boolean
561
+ stageDurationSeconds:
562
+ type: integer
563
+ healthCheck:
564
+ type: object
565
+ properties:
566
+ errorRateThreshold:
567
+ type: number
568
+ latencyThresholdMs:
569
+ type: integer
570
+ windowSeconds:
571
+ type: integer
572
+ persist:
573
+ type: boolean
574
+ description: 是否保存为持久化配置
575
+ persistName:
576
+ type: string
577
+ description: 持久化时的策略名称
578
+ persistPriority:
579
+ type: integer
580
+ description: 持久化时的优先级
581
+ cdn:
582
+ type: object
583
+ description: CDN 配置(PublishCdnConfig)
584
+ properties:
585
+ refreshCache:
586
+ type: boolean
587
+ description: 是否刷新缓存
588
+ warmupUrls:
589
+ type: array
590
+ items:
591
+ type: string
592
+ format: uri
593
+ description: 预热 URL 列表
594
+ priority:
595
+ type: string
596
+ enum: [high, normal, low]
597
+ description: 刷新优先级
598
+ notification:
599
+ type: object
600
+ description: 发布通知配置(PublishNotificationConfig)
601
+ properties:
602
+ enabled:
603
+ type: boolean
604
+ description: 是否发送通知
605
+ channels:
606
+ type: array
607
+ items:
608
+ type: string
609
+ enum: [email, webhook, slack, dingtalk]
610
+ description: 通知渠道
611
+ recipients:
612
+ type: array
613
+ items:
614
+ type: string
615
+ description: 通知接收者
616
+ webhookUrl:
617
+ type: string
618
+ format: uri
619
+ description: Webhook URL
620
+ skipValidation:
621
+ type: boolean
622
+ description: 是否跳过校验(仅开发环境有效)
623
+ immediate:
624
+ type: boolean
625
+ description: 是否立即生效(false 时进入待发布状态)
626
+ scheduledAt:
627
+ type: string
628
+ format: date-time
629
+ description: 定时发布时间(immediate 为 false 时有效)
630
+ versionUid:
631
+ type: string
632
+ maxLength: 32
633
+ description: 指定发布的版本 UID(不传则使用当前页面最新内容,UniqueId)
300
634
 
301
635
  RolloutConfig:
302
636
  type: object
@@ -511,6 +845,10 @@ SetKillSwitchRequest:
511
845
  # ============================================================================
512
846
  # Rollout 灰度发布相关
513
847
  # ============================================================================
848
+ # 灰度策略 feature 条件中的 value:实际为 string | number | boolean | string[],不使 oneOf 避免生成器产出非法 TS
849
+ ConditionValue:
850
+ description: 条件值(string | number | boolean | string[],运行时为 JSON 值)
851
+ nullable: true
514
852
 
515
853
  RolloutStrategy:
516
854
  type: object
@@ -989,91 +1327,97 @@ HealthResponse:
989
1327
 
990
1328
  ActivityInfo:
991
1329
  type: object
992
- required: [id, name, type, status, createdAt]
1330
+ required: [id, appId, name, type, status, createdAt]
1331
+ description: 活动信息(Activity,根据 types/src/activity/index.ts)
993
1332
  properties:
994
1333
  id:
995
1334
  type: string
996
- description: 活动 ID
1335
+ description: 活动 ID(UniqueId)
1336
+ appId:
1337
+ type: string
1338
+ description: 应用 ID(UniqueId)
997
1339
  name:
998
1340
  type: string
999
1341
  description: 活动名称
1342
+ description:
1343
+ type: string
1344
+ description: 活动描述
1000
1345
  type:
1001
1346
  type: string
1002
- enum: [signin, lottery, redpack, coupon, custom]
1003
- description: 活动类型
1347
+ enum: [claim, signin, lottery, reserve, task, vote, share, bind, custom]
1348
+ description: 活动类型(ActivityType)
1004
1349
  status:
1005
1350
  type: string
1006
- enum: [draft, scheduled, active, paused, ended]
1007
- description: 活动状态
1008
- startTime:
1009
- type: string
1010
- format: date-time
1011
- description: 开始时间
1012
- endTime:
1013
- type: string
1014
- format: date-time
1015
- description: 结束时间
1351
+ enum: [draft, scheduled, active, paused, ended, archived]
1352
+ description: 活动状态(ActivityStatus)
1016
1353
  createdAt:
1017
1354
  type: string
1018
1355
  format: date-time
1019
- description: 创建时间
1356
+ description: 创建时间(ISODateTime)
1020
1357
  updatedAt:
1021
1358
  type: string
1022
1359
  format: date-time
1023
- description: 更新时间
1360
+ description: 更新时间(ISODateTime)
1361
+ createdBy:
1362
+ type: string
1363
+ description: 创建者
1364
+ updatedBy:
1365
+ type: string
1366
+ description: 更新者
1024
1367
 
1025
1368
  ActivityDetail:
1026
1369
  type: object
1027
- required: [id, name, type, status, config, createdAt]
1370
+ required: [id, appId, name, type, rule, status, createdAt]
1371
+ description: 活动详情(Activity,根据 types/src/activity/index.ts)
1028
1372
  properties:
1029
1373
  id:
1030
1374
  type: string
1031
- description: 活动 ID
1375
+ description: 活动 ID(UniqueId)
1376
+ appId:
1377
+ type: string
1378
+ description: 应用 ID(UniqueId)
1032
1379
  name:
1033
1380
  type: string
1034
1381
  description: 活动名称
1035
- type:
1036
- type: string
1037
- enum: [signin, lottery, redpack, coupon, custom]
1038
- description: 活动类型
1039
- status:
1040
- type: string
1041
- enum: [draft, scheduled, active, paused, ended]
1042
- description: 活动状态
1043
1382
  description:
1044
1383
  type: string
1045
1384
  description: 活动描述
1046
- config:
1047
- type: object
1048
- additionalProperties: true
1049
- description: 活动配置
1050
- rules:
1385
+ type:
1386
+ type: string
1387
+ enum: [claim, signin, lottery, reserve, task, vote, share, bind, custom]
1388
+ description: 活动类型(ActivityType)
1389
+ rule:
1051
1390
  type: object
1391
+ description: 活动规则(ActivityRule,联合类型:ClaimActivityRule | SigninActivityRule | LotteryActivityRule)
1392
+ # 这里应该使用 oneOf 来定义不同的规则类型,但为了简化,使用 object
1052
1393
  additionalProperties: true
1053
- description: 活动规则
1054
- startTime:
1055
- type: string
1056
- format: date-time
1057
- description: 开始时间
1058
- endTime:
1394
+ status:
1059
1395
  type: string
1060
- format: date-time
1061
- description: 结束时间
1396
+ enum: [draft, scheduled, active, paused, ended, archived]
1397
+ description: 活动状态(ActivityStatus)
1062
1398
  createdAt:
1063
1399
  type: string
1064
1400
  format: date-time
1065
- description: 创建时间
1401
+ description: 创建时间(ISODateTime)
1066
1402
  updatedAt:
1067
1403
  type: string
1068
1404
  format: date-time
1069
- description: 更新时间
1405
+ description: 更新时间(ISODateTime)
1070
1406
  createdBy:
1071
1407
  type: string
1072
- description: 创建者 ID
1408
+ description: 创建者
1409
+ updatedBy:
1410
+ type: string
1411
+ description: 更新者
1412
+ extensions:
1413
+ type: object
1414
+ additionalProperties: true
1415
+ description: 扩展数据(Record<string, unknown>)
1073
1416
 
1074
1417
  CreateActivityRequest:
1075
1418
  type: object
1076
- required: [name, type]
1419
+ required: [name, type, rule]
1420
+ description: 创建活动请求(根据 types/src/activity/index.ts)
1077
1421
  properties:
1078
1422
  name:
1079
1423
  type: string
@@ -1082,28 +1426,62 @@ CreateActivityRequest:
1082
1426
  description: 活动名称
1083
1427
  type:
1084
1428
  type: string
1085
- enum: [signin, lottery, redpack, coupon, custom]
1086
- description: 活动类型
1429
+ enum: [claim, signin, lottery, reserve, task, vote, share, bind, custom]
1430
+ description: 活动类型(ActivityType)
1087
1431
  description:
1088
1432
  type: string
1089
1433
  maxLength: 1024
1090
1434
  description: 活动描述
1091
- config:
1435
+ rule:
1092
1436
  type: object
1437
+ description: 活动规则(ActivityRule,根据 type 不同而不同)
1438
+ # 这里应该使用 oneOf 来定义不同的规则类型
1439
+ # 为了简化,使用 object,但实际应该根据 type 字段动态校验
1093
1440
  additionalProperties: true
1094
- description: 活动配置
1095
- rules:
1096
- type: object
1097
- additionalProperties: true
1098
- description: 活动规则
1099
- startTime:
1100
- type: string
1101
- format: date-time
1102
- description: 开始时间
1103
- endTime:
1104
- type: string
1105
- format: date-time
1106
- description: 结束时间
1441
+ # 基础规则字段(BaseActivityRule)
1442
+ properties:
1443
+ startAt:
1444
+ type: string
1445
+ format: date-time
1446
+ description: 开始时间(ISODateTime)
1447
+ endAt:
1448
+ type: string
1449
+ format: date-time
1450
+ description: 结束时间(ISODateTime)
1451
+ timezone:
1452
+ type: string
1453
+ description: 时区
1454
+ requireAuth:
1455
+ type: boolean
1456
+ description: 是否要求登录
1457
+ participationLimit:
1458
+ type: object
1459
+ description: 参与次数限制(ParticipationLimit)
1460
+ properties:
1461
+ perUser:
1462
+ type: integer
1463
+ perUserPerDay:
1464
+ type: integer
1465
+ perUserPerWeek:
1466
+ type: integer
1467
+ global:
1468
+ type: integer
1469
+ globalPerDay:
1470
+ type: integer
1471
+ preconditions:
1472
+ type: array
1473
+ items:
1474
+ type: object
1475
+ properties:
1476
+ type:
1477
+ type: string
1478
+ enum: [user_level, membership, whitelist, prerequisite_activity, custom]
1479
+ config:
1480
+ type: object
1481
+ additionalProperties: true
1482
+ errorMessage:
1483
+ type: string
1484
+ description: 前置条件(ActivityPrecondition[])
1107
1485
 
1108
1486
  UpdateActivityRequest:
1109
1487
  type: object