@djvlc/openapi-user-client 1.7.14 → 1.8.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.
@@ -69,6 +69,12 @@ paths:
69
69
  - cacheTtlSeconds: 缓存 TTL(建议 10~30 秒)
70
70
  - snapshot: 完整快照(仅当 includeSnapshot=1 时返回)
71
71
  parameters:
72
+ - name: X-Trace-Id
73
+ in: header
74
+ required: false
75
+ schema:
76
+ type: string
77
+ description: 链路追踪 ID(OTel,全链路透传)
72
78
  - name: pageId
73
79
  in: query
74
80
  required: true
@@ -124,6 +130,102 @@ paths:
124
130
  $ref: '#/components/responses/NotFound'
125
131
  '503':
126
132
  $ref: '#/components/responses/ServiceUnavailable'
133
+ /page/manifest:
134
+ get:
135
+ tags:
136
+ - Pages
137
+ operationId: getPageManifest
138
+ summary: 获取组件清单
139
+ description: |
140
+ 返回页面的组件锁定清单(manifest),包含所有引用的组件版本和资源信息。
141
+
142
+ 用途:
143
+ - Runtime 根据 manifest 预加载组件资源
144
+ - Editor 根据 manifest 展示组件依赖
145
+ parameters:
146
+ - name: X-Trace-Id
147
+ in: header
148
+ required: false
149
+ schema:
150
+ type: string
151
+ description: 链路追踪 ID(OTel,全链路透传)
152
+ - name: pageId
153
+ in: query
154
+ required: true
155
+ schema:
156
+ type: string
157
+ description: 页面 ID
158
+ - name: env
159
+ in: query
160
+ required: false
161
+ schema:
162
+ type: string
163
+ enum:
164
+ - prod
165
+ - preview
166
+ - staging
167
+ default: prod
168
+ description: 环境(prod/preview/staging)
169
+ responses:
170
+ '200':
171
+ description: 获取成功
172
+ content:
173
+ application/json:
174
+ schema:
175
+ type: object
176
+ properties:
177
+ success:
178
+ type: boolean
179
+ data:
180
+ $ref: '#/components/schemas/ResourceManifests'
181
+ '400':
182
+ $ref: '#/components/responses/BadRequest'
183
+ '404':
184
+ $ref: '#/components/responses/NotFound'
185
+ /page/config:
186
+ get:
187
+ tags:
188
+ - Pages
189
+ operationId: getPageConfig
190
+ summary: 获取运维配置
191
+ description: |
192
+ 返回当前运维配置(killSwitch、blockedComponents、featureFlags 等)。
193
+
194
+ 用途:
195
+ - Runtime 启动时获取全局运维配置
196
+ - 判断是否有组件被阻断或功能被关闭
197
+ parameters:
198
+ - name: X-Trace-Id
199
+ in: header
200
+ required: false
201
+ schema:
202
+ type: string
203
+ description: 链路追踪 ID(OTel,全链路透传)
204
+ - name: env
205
+ in: query
206
+ required: false
207
+ schema:
208
+ type: string
209
+ enum:
210
+ - prod
211
+ - preview
212
+ - staging
213
+ default: prod
214
+ description: 环境(prod/preview/staging)
215
+ responses:
216
+ '200':
217
+ description: 获取成功
218
+ content:
219
+ application/json:
220
+ schema:
221
+ type: object
222
+ properties:
223
+ success:
224
+ type: boolean
225
+ data:
226
+ $ref: '#/components/schemas/OpsConfig'
227
+ '503':
228
+ $ref: '#/components/responses/ServiceUnavailable'
127
229
  /actions/execute:
128
230
  post:
129
231
  tags:
@@ -155,6 +257,21 @@ paths:
155
257
  - setState: 状态更新(内置)
156
258
  - showToast: 提示消息(内置)
157
259
  - custom: 自定义动作
260
+ parameters:
261
+ - name: Idempotency-Key
262
+ in: header
263
+ required: false
264
+ schema:
265
+ type: string
266
+ minLength: 16
267
+ maxLength: 128
268
+ description: 幂等键(与 body.idempotencyKey 二选一,推荐 header 传递)
269
+ - name: X-Trace-Id
270
+ in: header
271
+ required: false
272
+ schema:
273
+ type: string
274
+ description: 链路追踪 ID(OTel,全链路透传)
158
275
  requestBody:
159
276
  required: true
160
277
  content:
@@ -518,6 +635,104 @@ paths:
518
635
  $ref: '#/components/schemas/PaginationMeta'
519
636
  security:
520
637
  - BearerAuth: []
638
+ /activities/{activityId}/status:
639
+ get:
640
+ tags:
641
+ - Activities
642
+ summary: 获取活动状态(兼容)
643
+ operationId: getActivityStatus
644
+ description: |
645
+ 获取活动的当前状态信息,包括是否进行中、时间范围等。
646
+ 不需要登录,可用于前端判断活动是否在有效期内。
647
+ parameters:
648
+ - name: activityId
649
+ in: path
650
+ required: true
651
+ schema:
652
+ type: string
653
+ responses:
654
+ '200':
655
+ description: 成功
656
+ content:
657
+ application/json:
658
+ schema:
659
+ type: object
660
+ properties:
661
+ success:
662
+ type: boolean
663
+ data:
664
+ $ref: '#/components/schemas/ActivityStatus'
665
+ '404':
666
+ $ref: '#/components/responses/NotFound'
667
+ security: []
668
+ /activities/{activityId}/claim/status:
669
+ get:
670
+ tags:
671
+ - Activities
672
+ summary: 获取领取状态
673
+ operationId: getClaimStatus
674
+ description: 获取用户在指定活动中的领取状态
675
+ parameters:
676
+ - name: activityId
677
+ in: path
678
+ required: true
679
+ schema:
680
+ type: string
681
+ - name: uid
682
+ in: query
683
+ required: true
684
+ schema:
685
+ type: string
686
+ description: 用户 UID
687
+ responses:
688
+ '200':
689
+ description: 成功
690
+ content:
691
+ application/json:
692
+ schema:
693
+ type: object
694
+ properties:
695
+ success:
696
+ type: boolean
697
+ data:
698
+ type: object
699
+ description: 领取状态数据
700
+ security:
701
+ - BearerAuth: []
702
+ /activities/{activityId}/signin/status:
703
+ get:
704
+ tags:
705
+ - Activities
706
+ summary: 获取签到状态
707
+ operationId: getSigninStatus
708
+ description: 获取用户在指定活动中的签到状态
709
+ parameters:
710
+ - name: activityId
711
+ in: path
712
+ required: true
713
+ schema:
714
+ type: string
715
+ - name: uid
716
+ in: query
717
+ required: true
718
+ schema:
719
+ type: string
720
+ description: 用户 UID
721
+ responses:
722
+ '200':
723
+ description: 成功
724
+ content:
725
+ application/json:
726
+ schema:
727
+ type: object
728
+ properties:
729
+ success:
730
+ type: boolean
731
+ data:
732
+ type: object
733
+ description: 签到状态数据
734
+ security:
735
+ - BearerAuth: []
521
736
  /track:
522
737
  post:
523
738
  tags:
@@ -822,36 +1037,103 @@ components:
822
1037
  type: string
823
1038
  example: uuid-string
824
1039
  description: 请求 ID(可选)
1040
+ KillSwitchItem:
1041
+ type: object
1042
+ required:
1043
+ - targetType
1044
+ - targetId
1045
+ - enabled
1046
+ description: Kill-Switch 条目
1047
+ properties:
1048
+ targetType:
1049
+ type: string
1050
+ enum:
1051
+ - action
1052
+ - component
1053
+ - feature
1054
+ - page
1055
+ - query
1056
+ description: 目标类型
1057
+ targetId:
1058
+ type: string
1059
+ description: 目标 ID(actionType/componentName/featureKey/pageId/queryId)
1060
+ enabled:
1061
+ type: boolean
1062
+ description: 是否启用(true = 被关闭)
1063
+ reason:
1064
+ type: string
1065
+ description: 关闭原因
1066
+ enabledAt:
1067
+ type: string
1068
+ format: date-time
1069
+ description: 关闭时间(ISO8601)
1070
+ enabledBy:
1071
+ type: string
1072
+ description: 关闭操作者
1073
+ userMessage:
1074
+ type: string
1075
+ description: 用户提示消息
1076
+ BlockedComponentItem:
1077
+ type: object
1078
+ required:
1079
+ - name
1080
+ - reason
1081
+ description: 被阻断的组件条目
1082
+ properties:
1083
+ name:
1084
+ type: string
1085
+ description: 组件名称
1086
+ version:
1087
+ type: string
1088
+ pattern: ^\d+\.\d+\.\d+$
1089
+ description: 组件版本(可选,不指定则阻断所有版本)
1090
+ reason:
1091
+ type: string
1092
+ description: 阻断原因
1093
+ blockedAt:
1094
+ type: string
1095
+ format: date-time
1096
+ description: 阻断时间(ISO8601)
1097
+ blockedBy:
1098
+ type: string
1099
+ description: 阻断操作者
1100
+ fallbackVersion:
1101
+ type: string
1102
+ pattern: ^\d+\.\d+\.\d+$
1103
+ description: 降级版本(可选)
1104
+ urgent:
1105
+ type: boolean
1106
+ description: 是否紧急阻断
825
1107
  OpsConfig:
826
1108
  type: object
827
- description: 运维配置(运行时下发)
1109
+ description: 运维配置(运行时下发,与 types/page/snapshot.ts OpsConfig 对齐)
828
1110
  required:
829
1111
  - killSwitch
830
1112
  - blockedComponents
831
1113
  - flags
832
1114
  properties:
1115
+ configVersionId:
1116
+ type: string
1117
+ description: 配置版本 ID(用于缓存失效)
833
1118
  killSwitch:
834
1119
  type: array
835
1120
  items:
836
- type: string
837
- description: Kill Switch 列表(被阻断的 actionType/componentType)
1121
+ $ref: '#/components/schemas/KillSwitchItem'
1122
+ description: Kill-Switch 列表(被紧急关闭的功能/动作)
838
1123
  blockedComponents:
839
1124
  type: array
840
1125
  items:
841
- type: object
842
- properties:
843
- componentName:
844
- type: string
845
- componentVersion:
846
- type: string
847
- reason:
848
- type: string
1126
+ $ref: '#/components/schemas/BlockedComponentItem'
849
1127
  description: 被阻断的组件列表
850
1128
  flags:
851
1129
  type: object
852
1130
  additionalProperties:
853
1131
  type: boolean
854
1132
  description: 功能开关(Feature Flags)
1133
+ expiresAt:
1134
+ type: string
1135
+ format: date-time
1136
+ description: 配置过期时间(ISO8601)
855
1137
  ResolvePageResponse:
856
1138
  allOf:
857
1139
  - $ref: '#/components/schemas/SuccessResponse'
@@ -899,6 +1181,13 @@ components:
899
1181
  maximum: 300
900
1182
  default: 30
901
1183
  description: 缓存 TTL(秒),建议 10~30 秒
1184
+ traceId:
1185
+ type: string
1186
+ description: 链路追踪 ID(全链路透传,与 types 可观测原则一致)
1187
+ runtimeVersion:
1188
+ type: string
1189
+ pattern: ^\d+\.\d+\.\d+$
1190
+ description: 运行时版本(SemVer,与 manifest.runtime.version 一致)
902
1191
  rolloutMatch:
903
1192
  type: object
904
1193
  description: 灰度匹配信息(可选,用于调试)
@@ -954,14 +1243,22 @@ components:
954
1243
  version:
955
1244
  type: string
956
1245
  pattern: ^\d+\.\d+\.\d+$
1246
+ source:
1247
+ type: string
1248
+ enum:
1249
+ - bundled
1250
+ - remote
1251
+ description: 组件来源:bundled = 内置组件,remote = 远程组件
957
1252
  integrity:
958
1253
  type: string
959
1254
  pattern: ^sha(256|384|512)-
960
1255
  assetsUrl:
961
1256
  type: string
962
1257
  format: uri
1258
+ description: CDN 资源基础 URL(source 为 remote 时必填)
963
1259
  entrypoints:
964
1260
  type: object
1261
+ description: 入口点(source 为 remote 时必填)
965
1262
  properties:
966
1263
  js:
967
1264
  type: string
@@ -1076,7 +1373,7 @@ components:
1076
1373
  data:
1077
1374
  type: object
1078
1375
  additionalProperties: true
1079
- description: 错误详情(验证错误时使用 ApiErrorDetail[],其他情况使用 unknown,放在 data 字段中)
1376
+ description: 错误详情(Record<string, unknown>,与 types ApiErrorResponse.data 一致)
1080
1377
  timestamp:
1081
1378
  type: integer
1082
1379
  format: int64
@@ -1094,7 +1391,109 @@ components:
1094
1391
  type: string
1095
1392
  example: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
1096
1393
  description: 链路追踪 ID(可选,用于分布式追踪)
1097
- ActionContext:
1394
+ ComponentManifest:
1395
+ type: object
1396
+ required:
1397
+ - componentType
1398
+ - version
1399
+ - source
1400
+ properties:
1401
+ componentType:
1402
+ type: string
1403
+ description: 组件类型
1404
+ version:
1405
+ type: string
1406
+ description: 组件版本
1407
+ source:
1408
+ type: string
1409
+ enum:
1410
+ - bundled
1411
+ - remote
1412
+ description: 组件来源:bundled = 内置组件(随 Runtime 打包),remote = 远程组件(从 CDN 加载)
1413
+ entryUrl:
1414
+ type: string
1415
+ format: uri
1416
+ description: 组件入口 URL(source 为 remote 时必填)
1417
+ styleUrl:
1418
+ type: string
1419
+ format: uri
1420
+ description: 样式文件 URL
1421
+ integrity:
1422
+ type: string
1423
+ description: SRI 完整性哈希
1424
+ blocked:
1425
+ type: boolean
1426
+ description: 是否被阻断
1427
+ fallback:
1428
+ type: string
1429
+ description: 降级组件类型
1430
+ ActionManifest:
1431
+ type: object
1432
+ required:
1433
+ - actionId
1434
+ - actionDefinitionVersionId
1435
+ properties:
1436
+ actionId:
1437
+ type: string
1438
+ description: 动作 ID
1439
+ actionDefinitionVersionId:
1440
+ type: string
1441
+ description: 动作定义版本 ID
1442
+ actionType:
1443
+ type: string
1444
+ enum:
1445
+ - claim
1446
+ - signin
1447
+ - lottery
1448
+ - reserve
1449
+ - bind
1450
+ - task_complete
1451
+ - vote
1452
+ - share
1453
+ - form_submit
1454
+ - navigate
1455
+ - setState
1456
+ - showToast
1457
+ - refreshData
1458
+ - custom
1459
+ description: 动作类型
1460
+ builtin:
1461
+ type: boolean
1462
+ description: 是否内置动作
1463
+ QueryManifest:
1464
+ type: object
1465
+ required:
1466
+ - queryId
1467
+ - queryVersionId
1468
+ properties:
1469
+ queryId:
1470
+ type: string
1471
+ description: 查询 ID
1472
+ queryVersionId:
1473
+ type: string
1474
+ description: 查询定义版本 ID
1475
+ cacheTtl:
1476
+ type: integer
1477
+ description: 缓存 TTL(秒)
1478
+ ResourceManifests:
1479
+ type: object
1480
+ properties:
1481
+ components:
1482
+ type: array
1483
+ items:
1484
+ $ref: '#/components/schemas/ComponentManifest'
1485
+ description: 组件资源清单
1486
+ actions:
1487
+ type: array
1488
+ items:
1489
+ $ref: '#/components/schemas/ActionManifest'
1490
+ description: 动作资源清单
1491
+ queries:
1492
+ type: array
1493
+ items:
1494
+ $ref: '#/components/schemas/QueryManifest'
1495
+ description: 查询资源清单
1496
+ ActionClientContext:
1098
1497
  type: object
1099
1498
  description: 动作执行上下文(ActionClientContext,问题追溯必须字段)
1100
1499
  required:
@@ -1160,7 +1559,7 @@ components:
1160
1559
  additionalProperties: true
1161
1560
  description: 动作参数(Record<string, JsonValue>)
1162
1561
  context:
1163
- $ref: '#/components/schemas/ActionContext'
1562
+ $ref: '#/components/schemas/ActionClientContext'
1164
1563
  description: 客户端上下文(ActionClientContext,必填)
1165
1564
  idempotencyKey:
1166
1565
  type: string
@@ -1230,6 +1629,19 @@ components:
1230
1629
  retryAfter:
1231
1630
  type: integer
1232
1631
  description: 建议重试延迟(毫秒)
1632
+ riskDecision:
1633
+ type: object
1634
+ description: 风控决策(可选,风控拒绝时返回)
1635
+ properties:
1636
+ allowed:
1637
+ type: boolean
1638
+ description: 是否放行
1639
+ reason:
1640
+ type: string
1641
+ description: 拒绝原因(如 RISK_BLOCKED)
1642
+ code:
1643
+ type: string
1644
+ description: 风控错误码
1233
1645
  IdempotencyConflictResponse:
1234
1646
  type: object
1235
1647
  required:
@@ -1757,15 +2169,18 @@ components:
1757
2169
  type: object
1758
2170
  required:
1759
2171
  - page
1760
- - limit
2172
+ - pageSize
1761
2173
  - total
1762
2174
  - totalPages
2175
+ - hasNext
2176
+ - hasPrev
2177
+ description: 分页元数据(PaginationMeta)
1763
2178
  properties:
1764
2179
  page:
1765
2180
  type: integer
1766
2181
  minimum: 1
1767
2182
  description: 当前页码
1768
- limit:
2183
+ pageSize:
1769
2184
  type: integer
1770
2185
  minimum: 1
1771
2186
  maximum: 100
@@ -1778,6 +2193,12 @@ components:
1778
2193
  type: integer
1779
2194
  minimum: 0
1780
2195
  description: 总页数
2196
+ hasNext:
2197
+ type: boolean
2198
+ description: 是否有下一页
2199
+ hasPrev:
2200
+ type: boolean
2201
+ description: 是否有上一页
1781
2202
  LotteryRecordInfo:
1782
2203
  type: object
1783
2204
  required:
@@ -1823,6 +2244,40 @@ components:
1823
2244
  type: string
1824
2245
  format: date-time
1825
2246
  description: 领取时间
2247
+ ActivityStatus:
2248
+ type: object
2249
+ required:
2250
+ - activityUid
2251
+ - name
2252
+ - type
2253
+ - isInProgress
2254
+ - startAt
2255
+ - endAt
2256
+ description: 活动状态信息(与 docs ActivityStatusVo 对齐)
2257
+ properties:
2258
+ activityUid:
2259
+ type: string
2260
+ description: 活动 UID
2261
+ name:
2262
+ type: string
2263
+ description: 活动名称
2264
+ type:
2265
+ type: string
2266
+ description: 活动类型
2267
+ enum:
2268
+ - claim
2269
+ - signin
2270
+ isInProgress:
2271
+ type: boolean
2272
+ description: 是否进行中
2273
+ startAt:
2274
+ type: string
2275
+ format: date-time
2276
+ description: 开始时间(ISODateTime)
2277
+ endAt:
2278
+ type: string
2279
+ format: date-time
2280
+ description: 结束时间(ISODateTime)
1826
2281
  TrackRequest:
1827
2282
  type: object
1828
2283
  required:
@@ -1991,99 +2446,6 @@ components:
1991
2446
  message:
1992
2447
  type: string
1993
2448
  description: 依赖服务状态
1994
- ComponentManifest:
1995
- type: object
1996
- required:
1997
- - componentType
1998
- - version
1999
- - entryUrl
2000
- properties:
2001
- componentType:
2002
- type: string
2003
- description: 组件类型
2004
- version:
2005
- type: string
2006
- description: 组件版本
2007
- entryUrl:
2008
- type: string
2009
- format: uri
2010
- description: 组件入口 URL
2011
- styleUrl:
2012
- type: string
2013
- format: uri
2014
- description: 样式文件 URL
2015
- integrity:
2016
- type: string
2017
- description: SRI 完整性哈希
2018
- blocked:
2019
- type: boolean
2020
- description: 是否被阻断
2021
- fallback:
2022
- type: string
2023
- description: 降级组件类型
2024
- ActionManifest:
2025
- type: object
2026
- required:
2027
- - actionId
2028
- - actionDefinitionVersionId
2029
- properties:
2030
- actionId:
2031
- type: string
2032
- description: 动作 ID
2033
- actionDefinitionVersionId:
2034
- type: string
2035
- description: 动作定义版本 ID
2036
- actionType:
2037
- type: string
2038
- enum:
2039
- - claim
2040
- - signin
2041
- - lottery
2042
- - reserve
2043
- - bind
2044
- - task_complete
2045
- - vote
2046
- - share
2047
- - form_submit
2048
- - navigate
2049
- - setState
2050
- - showToast
2051
- - refreshData
2052
- - custom
2053
- description: 动作类型
2054
- builtin:
2055
- type: boolean
2056
- description: 是否内置动作
2057
- QueryManifest:
2058
- type: object
2059
- required:
2060
- - queryId
2061
- - queryVersionId
2062
- properties:
2063
- queryId:
2064
- type: string
2065
- description: 查询 ID
2066
- queryVersionId:
2067
- type: string
2068
- description: 查询定义版本 ID
2069
- cacheTtl:
2070
- type: integer
2071
- description: 缓存 TTL(秒)
2072
- ErrorDetail:
2073
- type: object
2074
- required:
2075
- - message
2076
- description: 错误详情(ApiErrorDetail,与 types/src/common/api.ts 保持一致)
2077
- properties:
2078
- field:
2079
- type: string
2080
- description: 字段路径(可选)
2081
- message:
2082
- type: string
2083
- description: 错误消息(必填)
2084
- code:
2085
- type: string
2086
- description: 错误码(可选)
2087
2449
  PageResponse:
2088
2450
  allOf:
2089
2451
  - $ref: '#/components/schemas/SuccessResponse'
@@ -2114,24 +2476,6 @@ components:
2114
2476
  integrity:
2115
2477
  type: string
2116
2478
  description: 完整性哈希
2117
- ResourceManifests:
2118
- type: object
2119
- properties:
2120
- components:
2121
- type: array
2122
- items:
2123
- $ref: '#/components/schemas/ComponentManifest'
2124
- description: 组件资源清单
2125
- actions:
2126
- type: array
2127
- items:
2128
- $ref: '#/components/schemas/ActionManifest'
2129
- description: 动作资源清单
2130
- queries:
2131
- type: array
2132
- items:
2133
- $ref: '#/components/schemas/QueryManifest'
2134
- description: 查询资源清单
2135
2479
  responses:
2136
2480
  BadRequest:
2137
2481
  description: 请求参数错误
@@ -2144,9 +2488,9 @@ components:
2144
2488
  code: VALIDATION_INVALID_PARAMS
2145
2489
  message: 请求参数无效
2146
2490
  data:
2147
- - field: pageId
2148
- message: 页面 ID 不能为空
2149
- code: REQUIRED
2491
+ field: pageId
2492
+ message: 页面 ID 不能为空
2493
+ code: REQUIRED
2150
2494
  timestamp: 1702300000000
2151
2495
  path: /api/user/pages/resolve
2152
2496
  requestId: uuid-string