@djvlc/openapi-user-client 1.4.0 → 1.6.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.
@@ -0,0 +1,89 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: DJVLC User API
4
+ version: 1.0.0
5
+ description: |
6
+ DJVLC 低代码平台用户端 API
7
+
8
+ 提供以下功能:
9
+ - 页面获取(解析页面 Schema)
10
+ - 动作执行(调用业务逻辑)
11
+ - 数据查询(获取数据源)
12
+ contact:
13
+ name: DJVLC Team
14
+ email: dev@djvlc.com
15
+ license:
16
+ name: MIT
17
+ url: https://opensource.org/licenses/MIT
18
+
19
+ servers:
20
+ - url: /api/user
21
+ description: 用户端 API
22
+
23
+ tags:
24
+ - name: Pages
25
+ description: 页面获取
26
+ - name: Actions
27
+ description: 动作执行
28
+ - name: Queries
29
+ description: 数据查询
30
+ - name: Activities
31
+ description: 活动状态
32
+ - name: Track
33
+ description: 埋点上报
34
+
35
+ paths:
36
+ # 页面获取
37
+ /pages/{pageId}:
38
+ $ref: './paths/pages.yaml#/page'
39
+ /pages/{pageId}/resolve:
40
+ $ref: './paths/pages.yaml#/resolve'
41
+
42
+ # 动作执行
43
+ /actions/{actionId}/execute:
44
+ $ref: './paths/actions.yaml#/execute'
45
+ /actions/{actionId}/validate:
46
+ $ref: './paths/actions.yaml#/validate'
47
+
48
+ # 数据查询
49
+ /queries/{queryId}/execute:
50
+ $ref: './paths/queries.yaml#/execute'
51
+
52
+ # 活动状态
53
+ /activities/{activityId}:
54
+ $ref: './paths/activities.yaml#/activityInfo'
55
+ /activities/{activityId}/state:
56
+ $ref: './paths/activities.yaml#/activityState'
57
+ /activities/{activityId}/signin/calendar:
58
+ $ref: './paths/activities.yaml#/signinCalendar'
59
+ /activities/{activityId}/claims:
60
+ $ref: './paths/activities.yaml#/claimRecords'
61
+ /activities/{activityId}/lottery:
62
+ $ref: './paths/activities.yaml#/lotteryRecords'
63
+
64
+ # 埋点上报
65
+ /track:
66
+ $ref: './paths/track.yaml#/track'
67
+ /track/batch:
68
+ $ref: './paths/track.yaml#/trackBatch'
69
+
70
+ components:
71
+ schemas:
72
+ $ref: './components/schemas/_index.yaml'
73
+ responses:
74
+ $ref: './components/responses/_index.yaml'
75
+ securitySchemes:
76
+ BearerAuth:
77
+ type: http
78
+ scheme: bearer
79
+ bearerFormat: JWT
80
+ description: JWT 认证令牌(可选)
81
+ ApiKey:
82
+ type: apiKey
83
+ in: header
84
+ name: X-API-Key
85
+ description: API 密钥
86
+
87
+ security:
88
+ - BearerAuth: []
89
+ - ApiKey: []
@@ -0,0 +1,70 @@
1
+ # 动作执行相关路径
2
+
3
+ execute:
4
+ post:
5
+ tags: [Actions]
6
+ operationId: executeAction
7
+ summary: 执行动作
8
+ description: |
9
+ 执行指定的动作,返回执行结果。
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
21
+ requestBody:
22
+ required: true
23
+ content:
24
+ application/json:
25
+ schema:
26
+ $ref: '../components/schemas/_index.yaml#/ExecuteActionRequest'
27
+ responses:
28
+ '200':
29
+ description: 执行成功
30
+ content:
31
+ application/json:
32
+ schema:
33
+ $ref: '../components/schemas/_index.yaml#/ExecuteActionResponse'
34
+ '400':
35
+ $ref: '../components/responses/_index.yaml#/BadRequest'
36
+ '404':
37
+ $ref: '../components/responses/_index.yaml#/NotFound'
38
+ '422':
39
+ $ref: '../components/responses/_index.yaml#/UnprocessableEntity'
40
+ '500':
41
+ $ref: '../components/responses/_index.yaml#/InternalError'
42
+
43
+ validate:
44
+ post:
45
+ tags: [Actions]
46
+ operationId: validateActionParams
47
+ summary: 验证动作参数
48
+ description: 验证动作参数是否符合 Schema 定义(不执行动作)
49
+ parameters:
50
+ - name: actionId
51
+ in: path
52
+ required: true
53
+ schema:
54
+ type: string
55
+ description: 动作 ID 或动作定义版本 ID
56
+ requestBody:
57
+ required: true
58
+ content:
59
+ application/json:
60
+ schema:
61
+ $ref: '../components/schemas/_index.yaml#/ValidateActionRequest'
62
+ responses:
63
+ '200':
64
+ description: 验证结果
65
+ content:
66
+ application/json:
67
+ schema:
68
+ $ref: '../components/schemas/_index.yaml#/ValidateActionResponse'
69
+ '404':
70
+ $ref: '../components/responses/_index.yaml#/NotFound'
@@ -0,0 +1,195 @@
1
+ # Activities 活动状态 API(User 端)
2
+
3
+ activityState:
4
+ get:
5
+ tags:
6
+ - Activities
7
+ summary: 获取用户活动状态
8
+ operationId: getActivityState
9
+ description: |
10
+ 查询用户在指定活动中的参与状态。
11
+
12
+ 返回内容包括:
13
+ - 是否可参与
14
+ - 剩余次数
15
+ - 类型特定状态(领取/签到/抽奖等)
16
+ parameters:
17
+ - name: activityId
18
+ in: path
19
+ required: true
20
+ schema:
21
+ type: string
22
+ responses:
23
+ '200':
24
+ description: 成功
25
+ content:
26
+ application/json:
27
+ schema:
28
+ type: object
29
+ properties:
30
+ success:
31
+ type: boolean
32
+ data:
33
+ $ref: '../components/schemas/_index.yaml#/UserActivityState'
34
+ '404':
35
+ $ref: '../components/responses/_index.yaml#/NotFound'
36
+ security:
37
+ - BearerAuth: []
38
+
39
+ activityInfo:
40
+ get:
41
+ tags:
42
+ - Activities
43
+ summary: 获取活动信息(公开)
44
+ operationId: getActivityInfo
45
+ description: |
46
+ 获取活动的公开信息,不需要登录。
47
+
48
+ 返回内容包括:
49
+ - 活动基本信息
50
+ - 时间范围
51
+ - 奖品列表(脱敏)
52
+ parameters:
53
+ - name: activityId
54
+ in: path
55
+ required: true
56
+ schema:
57
+ type: string
58
+ responses:
59
+ '200':
60
+ description: 成功
61
+ content:
62
+ application/json:
63
+ schema:
64
+ type: object
65
+ properties:
66
+ success:
67
+ type: boolean
68
+ data:
69
+ $ref: '../components/schemas/_index.yaml#/PublicActivityInfo'
70
+ '404':
71
+ $ref: '../components/responses/_index.yaml#/NotFound'
72
+ security: []
73
+
74
+ signinCalendar:
75
+ get:
76
+ tags:
77
+ - Activities
78
+ summary: 获取签到日历
79
+ operationId: getSigninCalendar
80
+ description: |
81
+ 获取用户的签到日历数据。
82
+
83
+ 返回内容包括:
84
+ - 当前周期的签到记录
85
+ - 连续签到天数
86
+ - 累计签到天数
87
+ - 奖励进度
88
+ parameters:
89
+ - name: activityId
90
+ in: path
91
+ required: true
92
+ schema:
93
+ type: string
94
+ - name: month
95
+ in: query
96
+ description: 月份(YYYY-MM),默认当前月
97
+ schema:
98
+ type: string
99
+ pattern: '^\d{4}-\d{2}$'
100
+ responses:
101
+ '200':
102
+ description: 成功
103
+ content:
104
+ application/json:
105
+ schema:
106
+ type: object
107
+ properties:
108
+ success:
109
+ type: boolean
110
+ data:
111
+ $ref: '../components/schemas/_index.yaml#/SigninCalendar'
112
+ security:
113
+ - BearerAuth: []
114
+
115
+ claimRecords:
116
+ get:
117
+ tags:
118
+ - Activities
119
+ summary: 获取领取记录
120
+ operationId: getClaimRecords
121
+ description: 获取用户在指定活动中的领取记录
122
+ parameters:
123
+ - name: activityId
124
+ in: path
125
+ required: true
126
+ schema:
127
+ type: string
128
+ - name: pageSize
129
+ in: query
130
+ schema:
131
+ type: integer
132
+ default: 20
133
+ - name: pageToken
134
+ in: query
135
+ schema:
136
+ type: string
137
+ responses:
138
+ '200':
139
+ description: 成功
140
+ content:
141
+ application/json:
142
+ schema:
143
+ type: object
144
+ properties:
145
+ success:
146
+ type: boolean
147
+ data:
148
+ type: array
149
+ items:
150
+ $ref: '../components/schemas/_index.yaml#/ClaimRecordInfo'
151
+ meta:
152
+ $ref: '../components/schemas/_index.yaml#/PaginationMeta'
153
+ security:
154
+ - BearerAuth: []
155
+
156
+ lotteryRecords:
157
+ get:
158
+ tags:
159
+ - Activities
160
+ summary: 获取抽奖记录
161
+ operationId: getLotteryRecords
162
+ description: 获取用户在指定活动中的抽奖记录
163
+ parameters:
164
+ - name: activityId
165
+ in: path
166
+ required: true
167
+ schema:
168
+ type: string
169
+ - name: pageSize
170
+ in: query
171
+ schema:
172
+ type: integer
173
+ default: 20
174
+ - name: pageToken
175
+ in: query
176
+ schema:
177
+ type: string
178
+ responses:
179
+ '200':
180
+ description: 成功
181
+ content:
182
+ application/json:
183
+ schema:
184
+ type: object
185
+ properties:
186
+ success:
187
+ type: boolean
188
+ data:
189
+ type: array
190
+ items:
191
+ $ref: '../components/schemas/_index.yaml#/LotteryRecordInfo'
192
+ meta:
193
+ $ref: '../components/schemas/_index.yaml#/PaginationMeta'
194
+ security:
195
+ - BearerAuth: []
@@ -0,0 +1,71 @@
1
+ # 页面获取相关路径
2
+
3
+ page:
4
+ get:
5
+ tags: [Pages]
6
+ operationId: getPage
7
+ summary: 获取页面
8
+ description: 获取指定页面的基本信息和元数据
9
+ parameters:
10
+ - name: pageId
11
+ in: path
12
+ required: true
13
+ schema:
14
+ type: string
15
+ description: 页面 ID
16
+ - name: version
17
+ in: query
18
+ schema:
19
+ type: string
20
+ description: 指定版本号(可选,默认最新版本)
21
+ responses:
22
+ '200':
23
+ description: 成功
24
+ content:
25
+ application/json:
26
+ schema:
27
+ $ref: '../components/schemas/_index.yaml#/PageResponse'
28
+ '404':
29
+ $ref: '../components/responses/_index.yaml#/NotFound'
30
+ '503':
31
+ $ref: '../components/responses/_index.yaml#/ServiceUnavailable'
32
+
33
+ resolve:
34
+ post:
35
+ tags: [Pages]
36
+ operationId: resolvePage
37
+ summary: 解析页面
38
+ description: |
39
+ 解析页面 Schema,返回完整的渲染数据。
40
+
41
+ 包括:
42
+ - 解析后的页面 Schema
43
+ - 组件资源清单
44
+ - 预取的数据查询结果
45
+ - 动作资源清单
46
+ parameters:
47
+ - name: pageId
48
+ in: path
49
+ required: true
50
+ schema:
51
+ type: string
52
+ description: 页面 ID
53
+ requestBody:
54
+ required: true
55
+ content:
56
+ application/json:
57
+ schema:
58
+ $ref: '../components/schemas/_index.yaml#/ResolvePageRequest'
59
+ responses:
60
+ '200':
61
+ description: 成功
62
+ content:
63
+ application/json:
64
+ schema:
65
+ $ref: '../components/schemas/_index.yaml#/ResolvePageResponse'
66
+ '400':
67
+ $ref: '../components/responses/_index.yaml#/BadRequest'
68
+ '404':
69
+ $ref: '../components/responses/_index.yaml#/NotFound'
70
+ '503':
71
+ $ref: '../components/responses/_index.yaml#/ServiceUnavailable'
@@ -0,0 +1,44 @@
1
+ # 数据查询相关路径
2
+
3
+ execute:
4
+ post:
5
+ tags: [Queries]
6
+ operationId: executeQuery
7
+ summary: 执行数据查询
8
+ description: |
9
+ 执行指定的数据查询,返回查询结果。
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
22
+ requestBody:
23
+ required: true
24
+ content:
25
+ application/json:
26
+ schema:
27
+ $ref: '../components/schemas/_index.yaml#/ExecuteQueryRequest'
28
+ responses:
29
+ '200':
30
+ description: 查询成功
31
+ content:
32
+ application/json:
33
+ schema:
34
+ $ref: '../components/schemas/_index.yaml#/ExecuteQueryResponse'
35
+ '400':
36
+ $ref: '../components/responses/_index.yaml#/BadRequest'
37
+ '404':
38
+ $ref: '../components/responses/_index.yaml#/NotFound'
39
+ '422':
40
+ $ref: '../components/responses/_index.yaml#/UnprocessableEntity'
41
+ '500':
42
+ $ref: '../components/responses/_index.yaml#/InternalError'
43
+ '504':
44
+ $ref: '../components/responses/_index.yaml#/GatewayTimeout'
@@ -0,0 +1,89 @@
1
+ # Track 埋点上报 API
2
+
3
+ track:
4
+ post:
5
+ tags:
6
+ - Track
7
+ summary: 埋点上报
8
+ operationId: track
9
+ description: |
10
+ 接收客户端埋点数据,异步写入 Outbox。
11
+
12
+ 特点:
13
+ - 高性能:不阻塞主链路
14
+ - 可靠:通过 Outbox 异步持久化
15
+ - 可追溯:自动关联 pageVersionId/componentVersionId/traceId
16
+ requestBody:
17
+ required: true
18
+ content:
19
+ application/json:
20
+ schema:
21
+ $ref: '../components/schemas/_index.yaml#/TrackRequest'
22
+ responses:
23
+ '202':
24
+ description: 接收成功(异步处理)
25
+ content:
26
+ application/json:
27
+ 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
39
+ '400':
40
+ $ref: '../components/responses/_index.yaml#/BadRequest'
41
+
42
+ trackBatch:
43
+ post:
44
+ tags:
45
+ - Track
46
+ summary: 批量埋点上报
47
+ operationId: trackBatch
48
+ description: |
49
+ 批量接收客户端埋点数据,提高上报效率。
50
+
51
+ 限制:
52
+ - 单次最多 100 条
53
+ - 单条事件不超过 10KB
54
+ requestBody:
55
+ required: true
56
+ content:
57
+ application/json:
58
+ schema:
59
+ $ref: '../components/schemas/_index.yaml#/TrackBatchRequest'
60
+ responses:
61
+ '202':
62
+ description: 接收成功
63
+ content:
64
+ application/json:
65
+ 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
88
+ '400':
89
+ $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.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "DJV Low-code Platform - User API 客户端(自动生成)",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -13,19 +13,19 @@
13
13
  }
14
14
  },
15
15
  "files": [
16
- "dist"
16
+ "dist",
17
+ "openapi"
17
18
  ],
18
19
  "sideEffects": false,
19
20
  "scripts": {
20
- "clean": "rimraf src/gen dist",
21
- "gen": "node ../../tools/openapi/generate-clients.js user",
22
21
  "build": "tsup --config tsup.config.ts",
22
+ "clean": "rimraf src/generated dist",
23
23
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
24
- "lint": "eslint src/ --ext .ts --ignore-pattern src/gen/",
24
+ "lint": "eslint src/ --ext .ts --ignore-pattern src/generated/",
25
25
  "typecheck": "tsc --noEmit"
26
26
  },
27
27
  "dependencies": {
28
- "@djvlc/openapi-client-core": "1.0.0"
28
+ "@djvlc/openapi-client-core": "1.2.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^20.0.0",
@@ -44,17 +44,17 @@
44
44
  "djvlc",
45
45
  "generated"
46
46
  ],
47
- "author": "DJV Team",
47
+ "author": "DJVLC Team",
48
48
  "license": "MIT",
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "registry": "https://registry.npmjs.org/"
52
+ },
49
53
  "repository": {
50
54
  "type": "git",
51
55
  "url": "git+https://github.com/djvlc/contracts.git",
52
56
  "directory": "packages/openapi-user-client"
53
57
  },
54
- "publishConfig": {
55
- "access": "public",
56
- "registry": "https://registry.npmjs.org/"
57
- },
58
58
  "engines": {
59
59
  "node": ">=18.0.0"
60
60
  }