@djvlc/openapi-user-client 1.7.0 → 1.7.2

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,14 +1,23 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
3
  title: DJVLC User API
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  description: |
6
- DJVLC 低代码平台用户端 API
6
+ DJVLC 低代码平台用户端 API(数据面)
7
7
 
8
8
  提供以下功能:
9
- - 页面获取(解析页面 Schema
10
- - 动作执行(调用业务逻辑)
11
- - 数据查询(获取数据源)
9
+ - 页面解析(Page Resolve
10
+ - 动作执行(Action Gateway - 统一入口)
11
+ - 数据查询(Data Proxy - 统一入口)
12
+ - 活动状态查询
13
+ - 埋点上报(Track)
14
+ - 租户解析(Tenant Resolver)
15
+ - 健康检查(Health)
16
+
17
+ 核心原则:
18
+ - 所有业务动作只走 Action Gateway(鉴权/风控/幂等/审计/签名)
19
+ - 所有数据访问只走 Data Proxy(白名单/裁剪/脱敏/缓存)
20
+ - 全链路可追溯:pageVersionId + componentVersionId + actionId + traceId
12
21
  contact:
13
22
  name: DJVLC Team
14
23
  email: dev@djvlc.com
@@ -22,32 +31,42 @@ servers:
22
31
 
23
32
  tags:
24
33
  - name: Pages
25
- description: 页面获取
34
+ description: 页面解析(Page Resolve)
26
35
  - name: Actions
27
- description: 动作执行
36
+ description: 动作执行(Action Gateway)
28
37
  - name: Queries
29
- description: 数据查询
38
+ description: 数据查询(Data Proxy)
30
39
  - name: Activities
31
- description: 活动状态
40
+ description: 活动状态查询
32
41
  - name: Track
33
42
  description: 埋点上报
43
+ - name: Tenant
44
+ description: 租户解析
45
+ - name: Health
46
+ description: 健康检查
34
47
 
35
48
  paths:
36
- # 页面获取
49
+ # 页面解析
37
50
  /pages/{pageId}:
38
51
  $ref: './paths/pages.yaml#/page'
39
52
  /pages/{pageId}/resolve:
40
53
  $ref: './paths/pages.yaml#/resolve'
41
54
 
42
- # 动作执行
43
- /actions/{actionId}/execute:
55
+ # Action Gateway(统一入口)
56
+ /actions/execute:
44
57
  $ref: './paths/actions.yaml#/execute'
45
- /actions/{actionId}/validate:
58
+ /actions/validate:
46
59
  $ref: './paths/actions.yaml#/validate'
60
+ /actions/definitions:
61
+ $ref: './paths/actions.yaml#/definitions'
47
62
 
48
- # 数据查询
49
- /queries/{queryId}/execute:
50
- $ref: './paths/queries.yaml#/execute'
63
+ # Data Proxy(统一入口)
64
+ /data/query:
65
+ $ref: './paths/queries.yaml#/query'
66
+ /data/query/batch:
67
+ $ref: './paths/queries.yaml#/batch'
68
+ /data/definitions:
69
+ $ref: './paths/queries.yaml#/definitions'
51
70
 
52
71
  # 活动状态
53
72
  /activities/{activityId}:
@@ -66,6 +85,20 @@ paths:
66
85
  $ref: './paths/track.yaml#/track'
67
86
  /track/batch:
68
87
  $ref: './paths/track.yaml#/trackBatch'
88
+
89
+ # 租户解析
90
+ /tenant/resolve:
91
+ $ref: './paths/tenant.yaml#/resolve'
92
+ /tenant/config:
93
+ $ref: './paths/tenant.yaml#/config'
94
+
95
+ # 健康检查
96
+ /health:
97
+ $ref: './paths/health.yaml#/health'
98
+ /health/ready:
99
+ $ref: './paths/health.yaml#/ready'
100
+ /health/live:
101
+ $ref: './paths/health.yaml#/live'
69
102
 
70
103
  components:
71
104
  schemas:
@@ -83,6 +116,19 @@ components:
83
116
  in: header
84
117
  name: X-API-Key
85
118
  description: API 密钥
119
+ parameters:
120
+ X-Trace-Id:
121
+ name: X-Trace-Id
122
+ in: header
123
+ schema:
124
+ type: string
125
+ description: 分布式追踪 ID(OTel)
126
+ X-App-Id:
127
+ name: X-App-Id
128
+ in: header
129
+ schema:
130
+ type: string
131
+ description: 应用/租户 ID
86
132
 
87
133
  security:
88
134
  - BearerAuth: []
@@ -1,23 +1,35 @@
1
- # 动作执行相关路径
1
+ # 动作执行相关路径 - Action Gateway 统一入口
2
2
 
3
3
  execute:
4
4
  post:
5
5
  tags: [Actions]
6
6
  operationId: executeAction
7
- summary: 执行动作
7
+ summary: 执行动作(统一入口)
8
8
  description: |
9
- 执行指定的动作,返回执行结果。
9
+ Action Gateway 唯一入口,所有业务动作都通过此接口执行。
10
10
 
11
- 支持:
12
- - 自定义动作(通过 actionDefinitionVersionId)
13
- - 内置动作(setState, navigate, etc.)
14
- parameters:
15
- - name: actionId
16
- in: path
17
- required: true
18
- schema:
19
- type: string
20
- description: 动作 ID 或动作定义版本 ID
11
+ 执行流程(Pipeline):
12
+ 1. Auth(登录态/票据/签名)
13
+ 2. Risk(限流、黑名单、设备指纹、验证码开关)
14
+ 3. Idempotency(幂等键检查)
15
+ 4. Execute(执行器:Claim/Signin/Lottery...)
16
+ 5. Audit(审计落库 + outbox)
17
+ 6. Normalize(统一错误码/返回)
18
+
19
+ 支持的动作类型:
20
+ - claim: 领取
21
+ - signin: 签到
22
+ - lottery: 抽奖
23
+ - reserve: 预约
24
+ - bind: 绑定
25
+ - task_complete: 任务完成
26
+ - vote: 投票
27
+ - share: 分享
28
+ - form_submit: 表单提交
29
+ - navigate: 页面跳转(内置)
30
+ - setState: 状态更新(内置)
31
+ - showToast: 提示消息(内置)
32
+ - custom: 自定义动作
21
33
  requestBody:
22
34
  required: true
23
35
  content:
@@ -33,10 +45,20 @@ execute:
33
45
  $ref: '../components/schemas/_index.yaml#/ExecuteActionResponse'
34
46
  '400':
35
47
  $ref: '../components/responses/_index.yaml#/BadRequest'
36
- '404':
37
- $ref: '../components/responses/_index.yaml#/NotFound'
48
+ '401':
49
+ $ref: '../components/responses/_index.yaml#/Unauthorized'
50
+ '403':
51
+ $ref: '../components/responses/_index.yaml#/Forbidden'
52
+ '409':
53
+ description: 幂等冲突(重复请求)
54
+ content:
55
+ application/json:
56
+ schema:
57
+ $ref: '../components/schemas/_index.yaml#/IdempotencyConflictResponse'
38
58
  '422':
39
59
  $ref: '../components/responses/_index.yaml#/UnprocessableEntity'
60
+ '429':
61
+ $ref: '../components/responses/_index.yaml#/TooManyRequests'
40
62
  '500':
41
63
  $ref: '../components/responses/_index.yaml#/InternalError'
42
64
 
@@ -45,14 +67,9 @@ validate:
45
67
  tags: [Actions]
46
68
  operationId: validateActionParams
47
69
  summary: 验证动作参数
48
- description: 验证动作参数是否符合 Schema 定义(不执行动作)
49
- parameters:
50
- - name: actionId
51
- in: path
52
- required: true
53
- schema:
54
- type: string
55
- description: 动作 ID 或动作定义版本 ID
70
+ description: |
71
+ 验证动作参数是否符合 Schema 定义(不执行动作)。
72
+ 用于前端表单提交前的预校验。
56
73
  requestBody:
57
74
  required: true
58
75
  content:
@@ -66,5 +83,28 @@ validate:
66
83
  application/json:
67
84
  schema:
68
85
  $ref: '../components/schemas/_index.yaml#/ValidateActionResponse'
86
+ '400':
87
+ $ref: '../components/responses/_index.yaml#/BadRequest'
88
+
89
+ definitions:
90
+ get:
91
+ tags: [Actions]
92
+ operationId: getActionDefinition
93
+ summary: 获取动作定义
94
+ description: 获取指定动作定义版本的详细信息(用于 Runtime 渲染动作配置)
95
+ parameters:
96
+ - name: actionDefinitionVersionId
97
+ in: query
98
+ required: true
99
+ schema:
100
+ type: string
101
+ description: 动作定义版本 ID
102
+ responses:
103
+ '200':
104
+ description: 成功
105
+ content:
106
+ application/json:
107
+ schema:
108
+ $ref: '../components/schemas/_index.yaml#/ActionDefinitionResponse'
69
109
  '404':
70
110
  $ref: '../components/responses/_index.yaml#/NotFound'
@@ -0,0 +1,88 @@
1
+ # Health 健康检查 API
2
+
3
+ health:
4
+ get:
5
+ tags:
6
+ - Health
7
+ summary: 健康检查
8
+ operationId: healthCheck
9
+ description: |
10
+ 综合健康检查,包含所有依赖服务状态。
11
+
12
+ 返回:
13
+ - 服务状态(healthy/degraded/unhealthy)
14
+ - 版本信息
15
+ - 运行时间
16
+ - 依赖服务状态
17
+ responses:
18
+ '200':
19
+ description: 服务健康
20
+ content:
21
+ application/json:
22
+ schema:
23
+ $ref: '../components/schemas/_index.yaml#/HealthResponse'
24
+ '503':
25
+ description: 服务不健康
26
+ content:
27
+ application/json:
28
+ schema:
29
+ $ref: '../components/schemas/_index.yaml#/HealthResponse'
30
+ security: []
31
+
32
+ ready:
33
+ get:
34
+ tags:
35
+ - Health
36
+ summary: 就绪检查
37
+ operationId: readinessCheck
38
+ description: |
39
+ Kubernetes readiness probe。
40
+ 检查服务是否准备好接收流量。
41
+ responses:
42
+ '200':
43
+ description: 服务就绪
44
+ content:
45
+ application/json:
46
+ schema:
47
+ type: object
48
+ properties:
49
+ ready:
50
+ type: boolean
51
+ example: true
52
+ '503':
53
+ description: 服务未就绪
54
+ content:
55
+ application/json:
56
+ schema:
57
+ type: object
58
+ properties:
59
+ ready:
60
+ type: boolean
61
+ example: false
62
+ reason:
63
+ type: string
64
+ security: []
65
+
66
+ live:
67
+ get:
68
+ tags:
69
+ - Health
70
+ summary: 存活检查
71
+ operationId: livenessCheck
72
+ description: |
73
+ Kubernetes liveness probe。
74
+ 检查服务是否存活。
75
+ responses:
76
+ '200':
77
+ description: 服务存活
78
+ content:
79
+ application/json:
80
+ schema:
81
+ type: object
82
+ properties:
83
+ alive:
84
+ type: boolean
85
+ example: true
86
+ '503':
87
+ description: 服务不存活
88
+ security: []
@@ -1,39 +1,45 @@
1
- # 数据查询相关路径
1
+ # Data Proxy 数据查询相关路径
2
2
 
3
- execute:
3
+ query:
4
4
  post:
5
5
  tags: [Queries]
6
- operationId: executeQuery
7
- summary: 执行数据查询
6
+ operationId: queryData
7
+ summary: 执行数据查询(Data Proxy 统一入口)
8
8
  description: |
9
- 执行指定的数据查询,返回查询结果。
9
+ Data Proxy 统一入口,所有数据查询都通过此接口执行。
10
10
 
11
- 支持:
12
- - 参数化查询
13
- - 结果缓存
14
- - 分页
15
- parameters:
16
- - name: queryId
17
- in: path
18
- required: true
19
- schema:
20
- type: string
21
- description: 查询 ID 或查询定义版本 ID
11
+ 功能:
12
+ - 白名单校验(queryVersionId 属于该 app/workspace)
13
+ - 字段裁剪、脱敏
14
+ - 缓存(短 TTL)
15
+ - 失败降级(兜底结构)
16
+ - 审计(可选,或采样)
17
+
18
+ 支持的数据源类型:
19
+ - http: HTTP 接口
20
+ - graphql: GraphQL 查询
21
+ - database: 数据库查询(受限)
22
+ - internal: 内部服务
23
+ - aggregation: 聚合查询
22
24
  requestBody:
23
25
  required: true
24
26
  content:
25
27
  application/json:
26
28
  schema:
27
- $ref: '../components/schemas/_index.yaml#/ExecuteQueryRequest'
29
+ $ref: '../components/schemas/_index.yaml#/QueryDataRequest'
28
30
  responses:
29
31
  '200':
30
32
  description: 查询成功
31
33
  content:
32
34
  application/json:
33
35
  schema:
34
- $ref: '../components/schemas/_index.yaml#/ExecuteQueryResponse'
36
+ $ref: '../components/schemas/_index.yaml#/QueryDataResponse'
35
37
  '400':
36
38
  $ref: '../components/responses/_index.yaml#/BadRequest'
39
+ '401':
40
+ $ref: '../components/responses/_index.yaml#/Unauthorized'
41
+ '403':
42
+ $ref: '../components/responses/_index.yaml#/Forbidden'
37
43
  '404':
38
44
  $ref: '../components/responses/_index.yaml#/NotFound'
39
45
  '422':
@@ -42,3 +48,50 @@ execute:
42
48
  $ref: '../components/responses/_index.yaml#/InternalError'
43
49
  '504':
44
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'
74
+
75
+ batch:
76
+ post:
77
+ tags: [Queries]
78
+ operationId: batchQueryData
79
+ summary: 批量执行数据查询
80
+ description: |
81
+ 批量执行多个数据查询,用于页面初始化时预取多个数据源。
82
+ 所有查询并行执行,部分失败不影响其他查询返回。
83
+ requestBody:
84
+ required: true
85
+ content:
86
+ application/json:
87
+ schema:
88
+ $ref: '../components/schemas/_index.yaml#/BatchQueryRequest'
89
+ responses:
90
+ '200':
91
+ description: 批量查询结果
92
+ content:
93
+ application/json:
94
+ schema:
95
+ $ref: '../components/schemas/_index.yaml#/BatchQueryResponse'
96
+ '400':
97
+ $ref: '../components/responses/_index.yaml#/BadRequest'
@@ -0,0 +1,93 @@
1
+ # Tenant 租户解析 API
2
+
3
+ resolve:
4
+ post:
5
+ tags:
6
+ - Tenant
7
+ summary: 解析租户信息
8
+ operationId: resolveTenant
9
+ description: |
10
+ 根据 appKey 或 host 解析租户/应用信息。
11
+
12
+ 用于:
13
+ - Runtime 初始化时获取应用配置
14
+ - 多租户场景下的应用隔离
15
+ requestBody:
16
+ required: true
17
+ content:
18
+ application/json:
19
+ 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]
34
+ responses:
35
+ '200':
36
+ description: 解析成功
37
+ content:
38
+ application/json:
39
+ schema:
40
+ type: object
41
+ properties:
42
+ success:
43
+ type: boolean
44
+ data:
45
+ $ref: '../components/schemas/_index.yaml#/TenantInfo'
46
+ '400':
47
+ $ref: '../components/responses/_index.yaml#/BadRequest'
48
+ '404':
49
+ description: 租户不存在
50
+ content:
51
+ application/json:
52
+ schema:
53
+ $ref: '../components/schemas/_index.yaml#/ErrorResponse'
54
+ security: []
55
+
56
+ config:
57
+ get:
58
+ tags:
59
+ - Tenant
60
+ summary: 获取租户配置
61
+ operationId: getTenantConfig
62
+ description: |
63
+ 获取当前租户的运行时配置。
64
+
65
+ 包括:
66
+ - 功能开关
67
+ - 主题配置
68
+ - CDN 域名
69
+ - 阻断组件列表
70
+ - Kill Switch 状态
71
+ parameters:
72
+ - name: X-App-Id
73
+ in: header
74
+ required: true
75
+ schema:
76
+ type: string
77
+ description: 应用 ID
78
+ responses:
79
+ '200':
80
+ description: 成功
81
+ content:
82
+ application/json:
83
+ schema:
84
+ type: object
85
+ properties:
86
+ success:
87
+ type: boolean
88
+ data:
89
+ $ref: '../components/schemas/_index.yaml#/TenantConfig'
90
+ '401':
91
+ $ref: '../components/responses/_index.yaml#/Unauthorized'
92
+ '404':
93
+ $ref: '../components/responses/_index.yaml#/NotFound'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djvlc/openapi-user-client",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
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.0"
28
+ "@djvlc/openapi-client-core": "1.2.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^20.0.0",