@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.
@@ -11,9 +11,9 @@ BadRequest:
11
11
  code: VALIDATION_INVALID_PARAMS
12
12
  message: 请求参数无效
13
13
  data:
14
- - field: pageId
15
- message: 页面 ID 不能为空
16
- code: REQUIRED
14
+ field: pageId
15
+ message: 页面 ID 不能为空
16
+ code: REQUIRED
17
17
  timestamp: 1702300000000
18
18
  path: /api/user/pages/resolve
19
19
  requestId: uuid-string
@@ -63,7 +63,7 @@ ErrorResponse:
63
63
  data:
64
64
  type: object
65
65
  additionalProperties: true
66
- description: 错误详情(验证错误时使用 ApiErrorDetail[],其他情况使用 unknown,放在 data 字段中)
66
+ description: 错误详情(Record<string, unknown>,与 types ApiErrorResponse.data 一致)
67
67
  timestamp:
68
68
  type: integer
69
69
  format: int64
@@ -82,21 +82,6 @@ ErrorResponse:
82
82
  example: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
83
83
  description: 链路追踪 ID(可选,用于分布式追踪)
84
84
 
85
- ErrorDetail:
86
- type: object
87
- required: [message]
88
- description: 错误详情(ApiErrorDetail,与 types/src/common/api.ts 保持一致)
89
- properties:
90
- field:
91
- type: string
92
- description: 字段路径(可选)
93
- message:
94
- type: string
95
- description: 错误消息(必填)
96
- code:
97
- type: string
98
- description: 错误码(可选)
99
-
100
85
  # ============================================================================
101
86
  # 页面相关
102
87
  # ============================================================================
@@ -168,6 +153,13 @@ ResolvePageResponse:
168
153
  maximum: 300
169
154
  default: 30
170
155
  description: 缓存 TTL(秒),建议 10~30 秒
156
+ traceId:
157
+ type: string
158
+ description: 链路追踪 ID(全链路透传,与 types 可观测原则一致)
159
+ runtimeVersion:
160
+ type: string
161
+ pattern: '^\d+\.\d+\.\d+$'
162
+ description: 运行时版本(SemVer,与 manifest.runtime.version 一致)
171
163
  rolloutMatch:
172
164
  type: object
173
165
  description: 灰度匹配信息(可选,用于调试)
@@ -223,14 +215,20 @@ ResolvePageResponse:
223
215
  version:
224
216
  type: string
225
217
  pattern: '^\d+\.\d+\.\d+$'
218
+ source:
219
+ type: string
220
+ enum: [bundled, remote]
221
+ description: '组件来源:bundled = 内置组件,remote = 远程组件'
226
222
  integrity:
227
223
  type: string
228
224
  pattern: '^sha(256|384|512)-'
229
225
  assetsUrl:
230
226
  type: string
231
227
  format: uri
228
+ description: 'CDN 资源基础 URL(source 为 remote 时必填)'
232
229
  entrypoints:
233
230
  type: object
231
+ description: '入口点(source 为 remote 时必填)'
234
232
  properties:
235
233
  js:
236
234
  type: string
@@ -337,7 +335,7 @@ ResourceManifests:
337
335
 
338
336
  ComponentManifest:
339
337
  type: object
340
- required: [componentType, version, entryUrl]
338
+ required: [componentType, version, source]
341
339
  properties:
342
340
  componentType:
343
341
  type: string
@@ -345,10 +343,14 @@ ComponentManifest:
345
343
  version:
346
344
  type: string
347
345
  description: 组件版本
346
+ source:
347
+ type: string
348
+ enum: [bundled, remote]
349
+ description: '组件来源:bundled = 内置组件(随 Runtime 打包),remote = 远程组件(从 CDN 加载)'
348
350
  entryUrl:
349
351
  type: string
350
352
  format: uri
351
- description: 组件入口 URL
353
+ description: '组件入口 URL(source 为 remote 时必填)'
352
354
  styleUrl:
353
355
  type: string
354
356
  format: uri
@@ -395,33 +397,94 @@ QueryManifest:
395
397
  type: integer
396
398
  description: 缓存 TTL(秒)
397
399
 
400
+ # 与 types/page/snapshot.ts KillSwitchItem 对齐
401
+ KillSwitchItem:
402
+ type: object
403
+ required: [targetType, targetId, enabled]
404
+ description: Kill-Switch 条目
405
+ properties:
406
+ targetType:
407
+ type: string
408
+ enum: [action, component, feature, page, query]
409
+ description: 目标类型
410
+ targetId:
411
+ type: string
412
+ description: 目标 ID(actionType/componentName/featureKey/pageId/queryId)
413
+ enabled:
414
+ type: boolean
415
+ description: 是否启用(true = 被关闭)
416
+ reason:
417
+ type: string
418
+ description: 关闭原因
419
+ enabledAt:
420
+ type: string
421
+ format: date-time
422
+ description: 关闭时间(ISO8601)
423
+ enabledBy:
424
+ type: string
425
+ description: 关闭操作者
426
+ userMessage:
427
+ type: string
428
+ description: 用户提示消息
429
+
430
+ # 与 types/page/snapshot.ts BlockedComponentItem 对齐
431
+ BlockedComponentItem:
432
+ type: object
433
+ required: [name, reason]
434
+ description: 被阻断的组件条目
435
+ properties:
436
+ name:
437
+ type: string
438
+ description: 组件名称
439
+ version:
440
+ type: string
441
+ pattern: '^\d+\.\d+\.\d+$'
442
+ description: 组件版本(可选,不指定则阻断所有版本)
443
+ reason:
444
+ type: string
445
+ description: 阻断原因
446
+ blockedAt:
447
+ type: string
448
+ format: date-time
449
+ description: 阻断时间(ISO8601)
450
+ blockedBy:
451
+ type: string
452
+ description: 阻断操作者
453
+ fallbackVersion:
454
+ type: string
455
+ pattern: '^\d+\.\d+\.\d+$'
456
+ description: 降级版本(可选)
457
+ urgent:
458
+ type: boolean
459
+ description: 是否紧急阻断
460
+
398
461
  OpsConfig:
399
462
  type: object
400
- description: 运维配置(运行时下发)
463
+ description: 运维配置(运行时下发,与 types/page/snapshot.ts OpsConfig 对齐)
401
464
  required: [killSwitch, blockedComponents, flags]
402
465
  properties:
466
+ configVersionId:
467
+ type: string
468
+ description: 配置版本 ID(用于缓存失效)
403
469
  killSwitch:
404
470
  type: array
405
471
  items:
406
- type: string
407
- description: Kill Switch 列表(被阻断的 actionType/componentType)
472
+ $ref: '#/KillSwitchItem'
473
+ description: Kill-Switch 列表(被紧急关闭的功能/动作)
408
474
  blockedComponents:
409
475
  type: array
410
476
  items:
411
- type: object
412
- properties:
413
- componentName:
414
- type: string
415
- componentVersion:
416
- type: string
417
- reason:
418
- type: string
477
+ $ref: '#/BlockedComponentItem'
419
478
  description: 被阻断的组件列表
420
479
  flags:
421
480
  type: object
422
481
  additionalProperties:
423
482
  type: boolean
424
483
  description: 功能开关(Feature Flags)
484
+ expiresAt:
485
+ type: string
486
+ format: date-time
487
+ description: 配置过期时间(ISO8601)
425
488
 
426
489
  # ============================================================================
427
490
  # Action Gateway 动作相关
@@ -444,7 +507,7 @@ ExecuteActionRequest:
444
507
  additionalProperties: true
445
508
  description: 动作参数(Record<string, JsonValue>)
446
509
  context:
447
- $ref: '#/ActionContext'
510
+ $ref: '#/ActionClientContext'
448
511
  description: 客户端上下文(ActionClientContext,必填)
449
512
  idempotencyKey:
450
513
  type: string
@@ -452,7 +515,7 @@ ExecuteActionRequest:
452
515
  maxLength: 128
453
516
  description: 幂等键(部分策略需要客户端提供,防重复提交)
454
517
 
455
- ActionContext:
518
+ ActionClientContext:
456
519
  type: object
457
520
  description: 动作执行上下文(ActionClientContext,问题追溯必须字段)
458
521
  required: [pageVersionId]
@@ -527,6 +590,19 @@ ExecuteActionResponse:
527
590
  retryAfter:
528
591
  type: integer
529
592
  description: 建议重试延迟(毫秒)
593
+ riskDecision:
594
+ type: object
595
+ description: 风控决策(可选,风控拒绝时返回)
596
+ properties:
597
+ allowed:
598
+ type: boolean
599
+ description: 是否放行
600
+ reason:
601
+ type: string
602
+ description: 拒绝原因(如 RISK_BLOCKED)
603
+ code:
604
+ type: string
605
+ description: 风控错误码
530
606
 
531
607
  ActionEffect:
532
608
  type: object
@@ -781,15 +857,17 @@ BatchQueryResponse:
781
857
  # 通用分页
782
858
  # ============================================================================
783
859
 
860
+ # 与 types/src/common/api.ts PaginationMeta 严格一致
784
861
  PaginationMeta:
785
862
  type: object
786
- required: [page, limit, total, totalPages]
863
+ required: [page, pageSize, total, totalPages, hasNext, hasPrev]
864
+ description: 分页元数据(PaginationMeta)
787
865
  properties:
788
866
  page:
789
867
  type: integer
790
868
  minimum: 1
791
869
  description: 当前页码
792
- limit:
870
+ pageSize:
793
871
  type: integer
794
872
  minimum: 1
795
873
  maximum: 100
@@ -802,6 +880,12 @@ PaginationMeta:
802
880
  type: integer
803
881
  minimum: 0
804
882
  description: 总页数
883
+ hasNext:
884
+ type: boolean
885
+ description: 是否有下一页
886
+ hasPrev:
887
+ type: boolean
888
+ description: 是否有上一页
805
889
 
806
890
  # ============================================================================
807
891
  # Tenant 租户相关
@@ -920,6 +1004,33 @@ HealthResponse:
920
1004
  # Activity 用户活动相关
921
1005
  # ============================================================================
922
1006
 
1007
+ ActivityStatus:
1008
+ type: object
1009
+ required: [activityUid, name, type, isInProgress, startAt, endAt]
1010
+ description: 活动状态信息(与 docs ActivityStatusVo 对齐)
1011
+ properties:
1012
+ activityUid:
1013
+ type: string
1014
+ description: 活动 UID
1015
+ name:
1016
+ type: string
1017
+ description: 活动名称
1018
+ type:
1019
+ type: string
1020
+ description: 活动类型
1021
+ enum: [claim, signin]
1022
+ isInProgress:
1023
+ type: boolean
1024
+ description: 是否进行中
1025
+ startAt:
1026
+ type: string
1027
+ format: date-time
1028
+ description: 开始时间(ISODateTime)
1029
+ endAt:
1030
+ type: string
1031
+ format: date-time
1032
+ description: 结束时间(ISODateTime)
1033
+
923
1034
  PublicActivityInfo:
924
1035
  type: object
925
1036
  required: [id, name, type, status]
@@ -49,6 +49,10 @@ paths:
49
49
  # 页面解析(根据设计总纲 V2)
50
50
  /page/resolve:
51
51
  $ref: './paths/pages.yaml#/resolve'
52
+ /page/manifest:
53
+ $ref: './paths/pages.yaml#/manifest'
54
+ /page/config:
55
+ $ref: './paths/pages.yaml#/config'
52
56
 
53
57
  # Action Gateway(统一入口)
54
58
  /actions/execute:
@@ -77,6 +81,12 @@ paths:
77
81
  $ref: './paths/activities.yaml#/claimRecords'
78
82
  /activities/{activityId}/lottery:
79
83
  $ref: './paths/activities.yaml#/lotteryRecords'
84
+ /activities/{activityId}/status:
85
+ $ref: './paths/activities.yaml#/activityStatus'
86
+ /activities/{activityId}/claim/status:
87
+ $ref: './paths/activities.yaml#/claimStatus'
88
+ /activities/{activityId}/signin/status:
89
+ $ref: './paths/activities.yaml#/signinStatus'
80
90
 
81
91
  # 埋点上报
82
92
  /track:
@@ -30,6 +30,21 @@ execute:
30
30
  - setState: 状态更新(内置)
31
31
  - showToast: 提示消息(内置)
32
32
  - custom: 自定义动作
33
+ parameters:
34
+ - name: Idempotency-Key
35
+ in: header
36
+ required: false
37
+ schema:
38
+ type: string
39
+ minLength: 16
40
+ maxLength: 128
41
+ description: 幂等键(与 body.idempotencyKey 二选一,推荐 header 传递)
42
+ - name: X-Trace-Id
43
+ in: header
44
+ required: false
45
+ schema:
46
+ type: string
47
+ description: 链路追踪 ID(OTel,全链路透传)
33
48
  requestBody:
34
49
  required: true
35
50
  content:
@@ -153,6 +153,107 @@ claimRecords:
153
153
  security:
154
154
  - BearerAuth: []
155
155
 
156
+ activityStatus:
157
+ get:
158
+ tags:
159
+ - Activities
160
+ summary: 获取活动状态(兼容)
161
+ operationId: getActivityStatus
162
+ description: |
163
+ 获取活动的当前状态信息,包括是否进行中、时间范围等。
164
+ 不需要登录,可用于前端判断活动是否在有效期内。
165
+ parameters:
166
+ - name: activityId
167
+ in: path
168
+ required: true
169
+ schema:
170
+ type: string
171
+ responses:
172
+ '200':
173
+ description: 成功
174
+ content:
175
+ application/json:
176
+ schema:
177
+ type: object
178
+ properties:
179
+ success:
180
+ type: boolean
181
+ data:
182
+ $ref: '../components/schemas/_index.yaml#/ActivityStatus'
183
+ '404':
184
+ $ref: '../components/responses/_index.yaml#/NotFound'
185
+ security: []
186
+
187
+ claimStatus:
188
+ get:
189
+ tags:
190
+ - Activities
191
+ summary: 获取领取状态
192
+ operationId: getClaimStatus
193
+ description: 获取用户在指定活动中的领取状态
194
+ parameters:
195
+ - name: activityId
196
+ in: path
197
+ required: true
198
+ schema:
199
+ type: string
200
+ - name: uid
201
+ in: query
202
+ required: true
203
+ schema:
204
+ type: string
205
+ description: 用户 UID
206
+ responses:
207
+ '200':
208
+ description: 成功
209
+ content:
210
+ application/json:
211
+ schema:
212
+ type: object
213
+ properties:
214
+ success:
215
+ type: boolean
216
+ data:
217
+ type: object
218
+ description: 领取状态数据
219
+ security:
220
+ - BearerAuth: []
221
+
222
+ signinStatus:
223
+ get:
224
+ tags:
225
+ - Activities
226
+ summary: 获取签到状态
227
+ operationId: getSigninStatus
228
+ description: 获取用户在指定活动中的签到状态
229
+ parameters:
230
+ - name: activityId
231
+ in: path
232
+ required: true
233
+ schema:
234
+ type: string
235
+ - name: uid
236
+ in: query
237
+ required: true
238
+ schema:
239
+ type: string
240
+ description: 用户 UID
241
+ responses:
242
+ '200':
243
+ description: 成功
244
+ content:
245
+ application/json:
246
+ schema:
247
+ type: object
248
+ properties:
249
+ success:
250
+ type: boolean
251
+ data:
252
+ type: object
253
+ description: 签到状态数据
254
+ security:
255
+ - BearerAuth: []
256
+
156
257
  lotteryRecords:
157
258
  get:
158
259
  tags:
@@ -22,6 +22,12 @@ resolve:
22
22
  - cacheTtlSeconds: 缓存 TTL(建议 10~30 秒)
23
23
  - snapshot: 完整快照(仅当 includeSnapshot=1 时返回)
24
24
  parameters:
25
+ - name: X-Trace-Id
26
+ in: header
27
+ required: false
28
+ schema:
29
+ type: string
30
+ description: 链路追踪 ID(OTel,全链路透传)
25
31
  - name: pageId
26
32
  in: query
27
33
  required: true
@@ -74,3 +80,93 @@ resolve:
74
80
  $ref: '../components/responses/_index.yaml#/NotFound'
75
81
  '503':
76
82
  $ref: '../components/responses/_index.yaml#/ServiceUnavailable'
83
+
84
+ manifest:
85
+ get:
86
+ tags: [Pages]
87
+ operationId: getPageManifest
88
+ summary: 获取组件清单
89
+ description: |
90
+ 返回页面的组件锁定清单(manifest),包含所有引用的组件版本和资源信息。
91
+
92
+ 用途:
93
+ - Runtime 根据 manifest 预加载组件资源
94
+ - Editor 根据 manifest 展示组件依赖
95
+ parameters:
96
+ - name: X-Trace-Id
97
+ in: header
98
+ required: false
99
+ schema:
100
+ type: string
101
+ description: 链路追踪 ID(OTel,全链路透传)
102
+ - name: pageId
103
+ in: query
104
+ required: true
105
+ schema:
106
+ type: string
107
+ description: 页面 ID
108
+ - name: env
109
+ in: query
110
+ required: false
111
+ schema:
112
+ type: string
113
+ enum: [prod, preview, staging]
114
+ default: prod
115
+ description: 环境(prod/preview/staging)
116
+ responses:
117
+ '200':
118
+ description: 获取成功
119
+ content:
120
+ application/json:
121
+ schema:
122
+ type: object
123
+ properties:
124
+ success:
125
+ type: boolean
126
+ data:
127
+ $ref: '../components/schemas/_index.yaml#/ResourceManifests'
128
+ '400':
129
+ $ref: '../components/responses/_index.yaml#/BadRequest'
130
+ '404':
131
+ $ref: '../components/responses/_index.yaml#/NotFound'
132
+
133
+ config:
134
+ get:
135
+ tags: [Pages]
136
+ operationId: getPageConfig
137
+ summary: 获取运维配置
138
+ description: |
139
+ 返回当前运维配置(killSwitch、blockedComponents、featureFlags 等)。
140
+
141
+ 用途:
142
+ - Runtime 启动时获取全局运维配置
143
+ - 判断是否有组件被阻断或功能被关闭
144
+ parameters:
145
+ - name: X-Trace-Id
146
+ in: header
147
+ required: false
148
+ schema:
149
+ type: string
150
+ description: 链路追踪 ID(OTel,全链路透传)
151
+ - name: env
152
+ in: query
153
+ required: false
154
+ schema:
155
+ type: string
156
+ enum: [prod, preview, staging]
157
+ default: prod
158
+ description: 环境(prod/preview/staging)
159
+ responses:
160
+ '200':
161
+ description: 获取成功
162
+ content:
163
+ application/json:
164
+ schema:
165
+ type: object
166
+ properties:
167
+ success:
168
+ type: boolean
169
+ data:
170
+ $ref: '../components/schemas/_index.yaml#/OpsConfig'
171
+ '503':
172
+ $ref: '../components/responses/_index.yaml#/ServiceUnavailable'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djvlc/openapi-user-client",
3
- "version": "1.7.14",
3
+ "version": "1.8.0",
4
4
  "description": "DJV Low-code Platform - User API 客户端(自动生成)",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -25,7 +25,7 @@
25
25
  "typecheck": "tsc --noEmit"
26
26
  },
27
27
  "dependencies": {
28
- "@djvlc/openapi-client-core": "1.2.11"
28
+ "@djvlc/openapi-client-core": "1.2.13"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^20.0.0",