@djvlc/openapi-user-client 1.8.0 → 1.8.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.
@@ -4,69 +4,76 @@ resolve:
4
4
  get:
5
5
  tags: [Pages]
6
6
  operationId: resolvePage
7
- summary: 解析页面(Runtime 核心接口)
7
+ summary: 解析页面
8
8
  description: |
9
- Runtime 的核心接口,返回渲染所需的完整数据。
9
+ Runtime 核心接口,返回渲染所需的完整数据。
10
10
 
11
11
  支持两种模式:
12
12
  1. 稳定入口(推荐):支持灰度/回滚/ops,返回 resolvedVersionId 和 CDN 地址
13
- 2. 保底模式:当 includeSnapshot=1 时,返回完整 snapshot(CDN 失败时使用)
14
-
15
- 响应包含:
16
- - resolvedVersionId: 解析后的页面版本 ID(考虑灰度/回滚)
17
- - cdnBase: CDN 基础地址
18
- - snapshotUrl: snapshot.json 的完整 URL
19
- - manifestUrl: manifest.json 的完整 URL
20
- - ops: 运维配置(killSwitch、blockedComponents、flags)
21
- - etag: 内容哈希(用于缓存)
22
- - cacheTtlSeconds: 缓存 TTL(建议 10~30 秒)
23
- - snapshot: 完整快照(仅当 includeSnapshot=1 时返回)
13
+ 2. 保底模式:当 includeSnapshot=true 时,返回完整 snapshot(CDN 失败时使用)
24
14
  parameters:
25
- - name: X-Trace-Id
26
- in: header
27
- required: false
28
- schema:
29
- type: string
30
- description: 链路追踪 ID(OTel,全链路透传)
31
15
  - name: pageId
32
16
  in: query
33
17
  required: true
18
+ description: 页面 ID
34
19
  schema:
35
20
  type: string
36
- description: 页面 ID
21
+ example: page_123456
37
22
  - name: env
38
23
  in: query
39
24
  required: false
25
+ description: 环境
40
26
  schema:
41
27
  type: string
42
28
  enum: [prod, preview, staging]
43
29
  default: prod
44
- description: 环境(prod/preview/staging)
30
+ example: prod
31
+ - name: includeSnapshot
32
+ in: query
33
+ required: false
34
+ description: 是否包含完整快照(CDN 失败保底)
35
+ schema:
36
+ type: boolean
37
+ default: false
45
38
  - name: uid
46
39
  in: query
47
40
  required: false
41
+ description: 用户 ID(契约 query;也可用 Header x-user-id)
48
42
  schema:
49
43
  type: string
50
- description: 用户 ID(用于灰度路由)
44
+ maxLength: 64
45
+ example: user_123456
51
46
  - name: deviceId
52
47
  in: query
53
48
  required: false
49
+ description: 设备 ID(契约 query;也可用 Header x-device-id)
54
50
  schema:
55
51
  type: string
56
- description: 设备 ID
52
+ maxLength: 64
53
+ example: device_123456
57
54
  - name: channel
58
55
  in: query
59
56
  required: false
57
+ description: 渠道(契约 query;也可用 Header x-channel)
60
58
  schema:
61
59
  type: string
62
- description: 渠道标识
63
- - name: includeSnapshot
64
- in: query
65
- required: false
60
+ maxLength: 64
61
+ example: wechat
62
+ - name: x-user-id
63
+ in: header
64
+ required: true
66
65
  schema:
67
- type: boolean
68
- default: false
69
- description: 是否包含完整 snapshot(CDN 失败保底时使用)
66
+ type: string
67
+ - name: x-device-id
68
+ in: header
69
+ required: true
70
+ schema:
71
+ type: string
72
+ - name: x-channel
73
+ in: header
74
+ required: true
75
+ schema:
76
+ type: string
70
77
  responses:
71
78
  '200':
72
79
  description: 解析成功
@@ -86,45 +93,31 @@ manifest:
86
93
  tags: [Pages]
87
94
  operationId: getPageManifest
88
95
  summary: 获取组件清单
89
- description: |
90
- 返回页面的组件锁定清单(manifest),包含所有引用的组件版本和资源信息。
91
-
92
- 用途:
93
- - Runtime 根据 manifest 预加载组件资源
94
- - Editor 根据 manifest 展示组件依赖
96
+ description: 返回页面的组件锁定清单
95
97
  parameters:
96
- - name: X-Trace-Id
97
- in: header
98
- required: false
99
- schema:
100
- type: string
101
- description: 链路追踪 ID(OTel,全链路透传)
102
98
  - name: pageId
103
99
  in: query
104
100
  required: true
101
+ description: 页面 ID
105
102
  schema:
106
103
  type: string
107
- description: 页面 ID
104
+ example: page_123456
108
105
  - name: env
109
106
  in: query
110
107
  required: false
108
+ description: 环境
111
109
  schema:
112
110
  type: string
113
111
  enum: [prod, preview, staging]
114
112
  default: prod
115
- description: 环境(prod/preview/staging)
113
+ example: prod
116
114
  responses:
117
115
  '200':
118
116
  description: 获取成功
119
117
  content:
120
118
  application/json:
121
119
  schema:
122
- type: object
123
- properties:
124
- success:
125
- type: boolean
126
- data:
127
- $ref: '../components/schemas/_index.yaml#/ResourceManifests'
120
+ $ref: '../components/schemas/_index.yaml#/ManifestResponse'
128
121
  '400':
129
122
  $ref: '../components/responses/_index.yaml#/BadRequest'
130
123
  '404':
@@ -135,38 +128,23 @@ config:
135
128
  tags: [Pages]
136
129
  operationId: getPageConfig
137
130
  summary: 获取运维配置
138
- description: |
139
- 返回当前运维配置(killSwitch、blockedComponents、featureFlags 等)。
140
-
141
- 用途:
142
- - Runtime 启动时获取全局运维配置
143
- - 判断是否有组件被阻断或功能被关闭
131
+ description: 返回当前运维配置(killSwitch、blockedComponents 等)
144
132
  parameters:
145
- - name: X-Trace-Id
146
- in: header
147
- required: false
148
- schema:
149
- type: string
150
- description: 链路追踪 ID(OTel,全链路透传)
151
133
  - name: env
152
134
  in: query
153
135
  required: false
136
+ description: 环境
154
137
  schema:
155
138
  type: string
156
139
  enum: [prod, preview, staging]
157
140
  default: prod
158
- description: 环境(prod/preview/staging)
141
+ example: prod
159
142
  responses:
160
143
  '200':
161
144
  description: 获取成功
162
145
  content:
163
146
  application/json:
164
147
  schema:
165
- type: object
166
- properties:
167
- success:
168
- type: boolean
169
- data:
170
- $ref: '../components/schemas/_index.yaml#/OpsConfig'
148
+ $ref: '../components/schemas/_index.yaml#/OpsConfig'
171
149
  '503':
172
150
  $ref: '../components/responses/_index.yaml#/ServiceUnavailable'
@@ -4,23 +4,8 @@ query:
4
4
  post:
5
5
  tags: [Queries]
6
6
  operationId: queryData
7
- summary: 执行数据查询(Data Proxy 统一入口)
8
- description: |
9
- Data Proxy 统一入口,所有数据查询都通过此接口执行。
10
-
11
- 功能:
12
- - 白名单校验(queryVersionId 属于该 app/workspace)
13
- - 字段裁剪、脱敏
14
- - 缓存(短 TTL)
15
- - 失败降级(兜底结构)
16
- - 审计(可选,或采样)
17
-
18
- 支持的数据源类型:
19
- - http: HTTP 接口
20
- - graphql: GraphQL 查询
21
- - database: 数据库查询(受限)
22
- - internal: 内部服务
23
- - aggregation: 聚合查询
7
+ summary: 执行数据查询
8
+ description: 通过 queryVersionId 查询数据
24
9
  requestBody:
25
10
  required: true
26
11
  content:
@@ -29,7 +14,7 @@ query:
29
14
  $ref: '../components/schemas/_index.yaml#/QueryDataRequest'
30
15
  responses:
31
16
  '200':
32
- description: 查询成功
17
+ description: 成功
33
18
  content:
34
19
  application/json:
35
20
  schema:
@@ -38,48 +23,17 @@ query:
38
23
  $ref: '../components/responses/_index.yaml#/BadRequest'
39
24
  '401':
40
25
  $ref: '../components/responses/_index.yaml#/Unauthorized'
41
- '403':
42
- $ref: '../components/responses/_index.yaml#/Forbidden'
43
- '404':
44
- $ref: '../components/responses/_index.yaml#/NotFound'
45
- '422':
46
- $ref: '../components/responses/_index.yaml#/UnprocessableEntity'
47
26
  '500':
48
27
  $ref: '../components/responses/_index.yaml#/InternalError'
49
- '504':
50
- $ref: '../components/responses/_index.yaml#/GatewayTimeout'
51
-
52
- definitions:
53
- get:
54
- tags: [Queries]
55
- operationId: getQueryDefinition
56
- summary: 获取查询定义
57
- description: 获取指定数据查询定义版本的详细信息
58
- parameters:
59
- - name: queryVersionId
60
- in: query
61
- required: true
62
- schema:
63
- type: string
64
- description: 查询定义版本 ID
65
- responses:
66
- '200':
67
- description: 成功
68
- content:
69
- application/json:
70
- schema:
71
- $ref: '../components/schemas/_index.yaml#/QueryDefinitionResponse'
72
- '404':
73
- $ref: '../components/responses/_index.yaml#/NotFound'
28
+ security:
29
+ - BearerAuth: []
74
30
 
75
31
  batch:
76
32
  post:
77
33
  tags: [Queries]
78
34
  operationId: batchQueryData
79
35
  summary: 批量执行数据查询
80
- description: |
81
- 批量执行多个数据查询,用于页面初始化时预取多个数据源。
82
- 所有查询并行执行,部分失败不影响其他查询返回。
36
+ description: 批量执行多个数据查询,所有查询并行执行
83
37
  requestBody:
84
38
  required: true
85
39
  content:
@@ -95,3 +49,29 @@ batch:
95
49
  $ref: '../components/schemas/_index.yaml#/BatchQueryResponse'
96
50
  '400':
97
51
  $ref: '../components/responses/_index.yaml#/BadRequest'
52
+ security:
53
+ - BearerAuth: []
54
+
55
+ definitions:
56
+ get:
57
+ tags: [Queries]
58
+ operationId: getQueryDefinition
59
+ summary: 获取查询定义
60
+ description: 按版本 ID 获取数据查询定义
61
+ parameters:
62
+ - name: queryVersionId
63
+ in: query
64
+ required: true
65
+ schema:
66
+ type: string
67
+ responses:
68
+ '200':
69
+ description: 查询定义
70
+ content:
71
+ application/json:
72
+ schema:
73
+ $ref: '../components/schemas/_index.yaml#/QueryDefinitionResponse'
74
+ '404':
75
+ $ref: '../components/responses/_index.yaml#/NotFound'
76
+ security:
77
+ - BearerAuth: []
@@ -2,47 +2,23 @@
2
2
 
3
3
  resolve:
4
4
  post:
5
- tags:
6
- - Tenant
7
- summary: 解析租户信息
5
+ tags: [Tenant]
8
6
  operationId: resolveTenant
9
- description: |
10
- 根据 appKey 或 host 解析租户/应用信息。
11
-
12
- 用于:
13
- - Runtime 初始化时获取应用配置
14
- - 多租户场景下的应用隔离
7
+ summary: 解析租户信息
8
+ description: 根据 appKey 或 host 解析租户/应用信息
15
9
  requestBody:
16
10
  required: true
17
11
  content:
18
12
  application/json:
19
13
  schema:
20
- type: object
21
- properties:
22
- appKey:
23
- type: string
24
- description: 应用密钥
25
- host:
26
- type: string
27
- description: 请求来源域名
28
- channel:
29
- type: string
30
- description: 渠道标识
31
- anyOf:
32
- - required: [appKey]
33
- - required: [host]
14
+ $ref: '../components/schemas/_index.yaml#/ResolveTenantRequest'
34
15
  responses:
35
16
  '200':
36
17
  description: 解析成功
37
18
  content:
38
19
  application/json:
39
20
  schema:
40
- type: object
41
- properties:
42
- success:
43
- type: boolean
44
- data:
45
- $ref: '../components/schemas/_index.yaml#/TenantInfo'
21
+ $ref: '../components/schemas/_index.yaml#/ResolveTenantResponse'
46
22
  '400':
47
23
  $ref: '../components/responses/_index.yaml#/BadRequest'
48
24
  '404':
@@ -55,38 +31,28 @@ resolve:
55
31
 
56
32
  config:
57
33
  get:
58
- tags:
59
- - Tenant
60
- summary: 获取租户配置
34
+ tags: [Tenant]
61
35
  operationId: getTenantConfig
62
- description: |
63
- 获取当前租户的运行时配置。
64
-
65
- 包括:
66
- - 功能开关
67
- - 主题配置
68
- - CDN 域名
69
- - 阻断组件列表
70
- - Kill Switch 状态
36
+ summary: 获取租户配置
37
+ description: 获取当前租户的运行时配置
71
38
  parameters:
39
+ - name: x-app-id
40
+ in: header
41
+ required: true
42
+ schema:
43
+ type: string
72
44
  - name: X-App-Id
73
45
  in: header
74
46
  required: true
75
47
  schema:
76
48
  type: string
77
- description: 应用 ID
78
49
  responses:
79
50
  '200':
80
- description: 成功
51
+ description: 获取成功
81
52
  content:
82
53
  application/json:
83
54
  schema:
84
- type: object
85
- properties:
86
- success:
87
- type: boolean
88
- data:
89
- $ref: '../components/schemas/_index.yaml#/TenantConfig'
55
+ $ref: '../components/schemas/_index.yaml#/TenantConfigResponse'
90
56
  '401':
91
57
  $ref: '../components/responses/_index.yaml#/Unauthorized'
92
58
  '404':
@@ -2,55 +2,32 @@
2
2
 
3
3
  track:
4
4
  post:
5
- tags:
6
- - Track
7
- summary: 埋点上报
5
+ tags: [Track]
8
6
  operationId: track
9
- description: |
10
- 接收客户端埋点数据,异步写入 Outbox。
11
-
12
- 特点:
13
- - 高性能:不阻塞主链路
14
- - 可靠:通过 Outbox 异步持久化
15
- - 可追溯:自动关联 pageVersionId/componentVersionId/traceId
7
+ summary: 单个埋点上报
8
+ description: 接收客户端埋点数据,异步处理
16
9
  requestBody:
17
10
  required: true
18
11
  content:
19
12
  application/json:
20
13
  schema:
21
- $ref: '../components/schemas/_index.yaml#/TrackRequest'
14
+ $ref: '../components/schemas/_index.yaml#/TrackSingleRequest'
22
15
  responses:
23
16
  '202':
24
17
  description: 接收成功(异步处理)
25
18
  content:
26
19
  application/json:
27
20
  schema:
28
- type: object
29
- properties:
30
- success:
31
- type: boolean
32
- example: true
33
- data:
34
- type: object
35
- properties:
36
- eventId:
37
- type: string
38
- description: 事件 ID
21
+ $ref: '../components/schemas/_index.yaml#/TrackSingleResponse'
39
22
  '400':
40
23
  $ref: '../components/responses/_index.yaml#/BadRequest'
41
24
 
42
25
  trackBatch:
43
26
  post:
44
- tags:
45
- - Track
46
- summary: 批量埋点上报
27
+ tags: [Track]
47
28
  operationId: trackBatch
48
- description: |
49
- 批量接收客户端埋点数据,提高上报效率。
50
-
51
- 限制:
52
- - 单次最多 100 条
53
- - 单条事件不超过 10KB
29
+ summary: 批量埋点上报
30
+ description: 批量接收客户端埋点数据,提高上报效率
54
31
  requestBody:
55
32
  required: true
56
33
  content:
@@ -63,27 +40,6 @@ trackBatch:
63
40
  content:
64
41
  application/json:
65
42
  schema:
66
- type: object
67
- properties:
68
- success:
69
- type: boolean
70
- data:
71
- type: object
72
- properties:
73
- accepted:
74
- type: integer
75
- description: 接收的事件数量
76
- rejected:
77
- type: integer
78
- description: 拒绝的事件数量
79
- errors:
80
- type: array
81
- items:
82
- type: object
83
- properties:
84
- index:
85
- type: integer
86
- reason:
87
- type: string
43
+ $ref: '../components/schemas/_index.yaml#/TrackBatchResponse'
88
44
  '400':
89
45
  $ref: '../components/responses/_index.yaml#/BadRequest'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djvlc/openapi-user-client",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "DJV Low-code Platform - User API 客户端(自动生成)",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",