@alipay-inc/mpaas-ide-openapi 1.0.0-beta.8 → 1.0.4-alpha.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.
- package/README.md +81 -243
- package/dist/index.js +1 -2
- package/package.json +10 -9
- package/dist/index.js.LICENSE.txt +0 -1157
package/README.md
CHANGED
|
@@ -8,18 +8,19 @@
|
|
|
8
8
|
|
|
9
9
|
#### 私有云
|
|
10
10
|
|
|
11
|
+
- 请联系PDSA
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
### 接口返回数据标准
|
|
14
15
|
|
|
15
16
|
```js
|
|
16
17
|
{
|
|
17
|
-
data: 'any',
|
|
18
|
-
errorCode: 'string',
|
|
19
|
-
requestId: 'string',
|
|
20
|
-
resultMsg: 'string',
|
|
21
|
-
success: 'boolean',
|
|
22
|
-
...
|
|
18
|
+
data: '<any>', // 返回数据
|
|
19
|
+
errorCode: '<string>', // 错误代码,非必选
|
|
20
|
+
requestId: '<string>', // 请求ID,非必选
|
|
21
|
+
resultMsg: '<string>', // 当success !== true,必选
|
|
22
|
+
success: '<boolean>', // 是否正确返回
|
|
23
|
+
... // 各环境自定义字段
|
|
23
24
|
}
|
|
24
25
|
```
|
|
25
26
|
|
|
@@ -36,28 +37,40 @@
|
|
|
36
37
|
- ```javascript
|
|
37
38
|
{
|
|
38
39
|
...配置文件内容,
|
|
39
|
-
openapi: {
|
|
40
|
-
type: 'aliyun',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
"openapi": {
|
|
41
|
+
"type": 'aliyun', // 必填、固定值
|
|
42
|
+
"userId": '<string>', // 必填、字母数字下划线
|
|
43
|
+
"accessKeyId": '<阿里云 AccessKey ID>', // 必填
|
|
44
|
+
"accessKeySecret": '<阿里云 AccessKey Secret>', // 必填
|
|
45
|
+
"endpoint": 'mpaas.cn-hangzhou.aliyuncs.com', // 必填、固定值
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
```
|
|
47
|
-
|
|
49
|
+
|
|
48
50
|
- 私有化openapi,需要配置rsa
|
|
49
|
-
|
|
51
|
+
|
|
50
52
|
- ```javascript
|
|
51
53
|
{
|
|
52
54
|
...配置文件内容,
|
|
53
|
-
openapi: {
|
|
54
|
-
type: 'antfin',
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
"openapi": {
|
|
56
|
+
"type": 'antfin', // 必填、固定值
|
|
57
|
+
"userId": '<string>', // 必填、字母数字下划线
|
|
58
|
+
"privateKey": '<私钥 string format>', // 必填 https://www.samltool.com/format_privatekey.php
|
|
59
|
+
"api_url": '<私有云api地址>' // 必填
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
```
|
|
63
|
+
|
|
60
64
|
|
|
65
|
+
- 如果需要详细日志,可以在配置文件中加一个字段,将产生一个 .mpaas-ide-openapi.${yyyy-MM-dd}.log 文件
|
|
66
|
+
|
|
67
|
+
- ```js
|
|
68
|
+
{
|
|
69
|
+
...配置文件内容,
|
|
70
|
+
"log": true
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
61
74
|
|
|
62
75
|
|
|
63
76
|
### 使用方法
|
|
@@ -80,7 +93,7 @@
|
|
|
80
93
|
|
|
81
94
|
|
|
82
95
|
|
|
83
|
-
###
|
|
96
|
+
### API
|
|
84
97
|
|
|
85
98
|
#### getAppListByApi 拉取小程序列表
|
|
86
99
|
|
|
@@ -92,314 +105,139 @@
|
|
|
92
105
|
{
|
|
93
106
|
data: [
|
|
94
107
|
{
|
|
95
|
-
appCode: 'string',
|
|
96
|
-
gmtCreate: 'string'
|
|
97
|
-
gmtModified: 'string',
|
|
98
|
-
h5Id: 'string',
|
|
99
|
-
h5Name: 'string'
|
|
100
|
-
|
|
108
|
+
appCode: '<string>',
|
|
109
|
+
gmtCreate: '<string>',
|
|
110
|
+
gmtModified: '<string>',
|
|
111
|
+
h5Id: '<string>',
|
|
112
|
+
h5Name: '<string>',
|
|
113
|
+
...
|
|
114
|
+
},
|
|
115
|
+
...
|
|
101
116
|
],
|
|
102
117
|
errorCode: 'OK',
|
|
103
|
-
requestId: 'string',
|
|
118
|
+
requestId: '<string>',
|
|
104
119
|
resultMsg: '',
|
|
105
120
|
success: true
|
|
106
121
|
}
|
|
107
122
|
```
|
|
108
123
|
|
|
109
|
-
|
|
110
124
|
#### getPackageInfoByApi 拉取小程序配置
|
|
111
125
|
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
- ```js
|
|
115
|
-
{
|
|
116
|
-
h5Id: 'string',
|
|
117
|
-
packageTypes: 'string' // 可选,默认 '1,2,3,4'
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
- 返回
|
|
122
|
-
|
|
123
|
-
- ```javascript
|
|
124
|
-
{
|
|
125
|
-
data: {
|
|
126
|
-
appCode: 'ONEX7036F60021129-a3',
|
|
127
|
-
autoInstall: 0,
|
|
128
|
-
clientVersionMax: '',
|
|
129
|
-
clientVersionMin: '0.0.0.0;0.0.0.0',
|
|
130
|
-
downloadUrl: 'https://mcube-prod.cn-hangzhou.oss.aliyuncs.com/ONEX7036F60021129-a3/1234567890123452/1.0.0.1_all/nebula/1234567890123452_1.0.0.1.amr',
|
|
131
|
-
extendInfo: '',
|
|
132
|
-
extraData: '{"enableKeepAlive":"0","enableOptionMenu":"1","enableTabBar":"0","iconUrl":"https://mcube-prod.cn-hangzhou.oss.aliyuncs.com/ONEX7036F60021129-a3/1234567890123452/1.0.0.1_all/icon/1234567890123452_1.0.0.1_版权.png","resourceType":"4"}',
|
|
133
|
-
fallbackBaseUrl: 'https://mcube-prod.cn-hangzhou.oss.aliyuncs.com/ONEX7036F60021129-a3/1234567890123452/1.0.0.1_all/nebula/fallback/;https://mcube-prod.cn-hangzhou.oss.aliyuncs.com/ONEX7036F60021129-a3/1234567890123452/1.0.0.1_all/nebula/fallback/',
|
|
134
|
-
gmtCreate: '2021-07-22 16:13:44',
|
|
135
|
-
gmtModified: '2021-07-22 16:23:43',
|
|
136
|
-
h5Id: '1234567890123452',
|
|
137
|
-
h5Name: '小程序5',
|
|
138
|
-
h5Version: '1.0.0.1',
|
|
139
|
-
id: 587253,
|
|
140
|
-
installType: 0,
|
|
141
|
-
mainUrl: '',
|
|
142
|
-
memo: 'https://mcube-prod.cn-hangzhou.oss.aliyuncs.com/ONEX7036F60021129-a3/1234567890123452/1.0.0.1_all/nebula/nebula_json/h5_json.json',
|
|
143
|
-
packageType: 1,
|
|
144
|
-
platform: 'all',
|
|
145
|
-
publishPeriod: 3,
|
|
146
|
-
resourceType: 4,
|
|
147
|
-
status: 1
|
|
148
|
-
},
|
|
149
|
-
errorCode: 'OK',
|
|
150
|
-
requestId: 'string',
|
|
151
|
-
resultMsg: '',
|
|
152
|
-
success: true
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
#### createWhiteListByApi 创建白名单
|
|
126
|
+
- 若此小程序从未发布过,则读取默认配置
|
|
157
127
|
|
|
158
128
|
- 入参
|
|
159
129
|
|
|
160
130
|
- ```js
|
|
161
131
|
{
|
|
162
|
-
|
|
163
|
-
|
|
132
|
+
h5Id: '<string>', // 必填,小程序ID
|
|
133
|
+
h5Name: '<string>', // 必填,小程序名称
|
|
134
|
+
packageTypes: '<string>' // 可选,默认 '1,2,3,4'
|
|
164
135
|
}
|
|
165
136
|
```
|
|
166
137
|
|
|
167
138
|
- 返回
|
|
168
139
|
|
|
169
|
-
- ```
|
|
140
|
+
- ```javascript
|
|
170
141
|
{
|
|
171
|
-
data: '
|
|
142
|
+
data: '<object>',
|
|
172
143
|
errorCode: 'OK',
|
|
173
|
-
requestId: 'string',
|
|
144
|
+
requestId: '<string>',
|
|
174
145
|
resultMsg: '',
|
|
175
146
|
success: true
|
|
176
147
|
}
|
|
177
148
|
```
|
|
178
149
|
|
|
179
|
-
####
|
|
180
|
-
|
|
181
|
-
- 入参
|
|
182
|
-
|
|
183
|
-
- ```js
|
|
184
|
-
{
|
|
185
|
-
appInfo: 'object', // 小程序配置
|
|
186
|
-
packageType: 'string', // 包类型 (1,2 为正式包。3,4 为测试包)
|
|
187
|
-
resourceFile: 'string', // 小程序包的本地绝对路径 (远程包需要自行下载到本地转换为本地绝对路径)
|
|
188
|
-
iconFile: 'string', // 小程序图标的本地绝对路径 (远程包需要自行下载到本地转换为本地绝对路径)
|
|
189
|
-
}
|
|
190
|
-
```
|
|
150
|
+
#### uploadPackageByApi 上传小程序并发布
|
|
191
151
|
|
|
192
|
-
-
|
|
152
|
+
- 上传小程序包之前,需要检测是否配置虚拟域名,若未配置,则报错
|
|
193
153
|
|
|
194
|
-
|
|
195
|
-
{
|
|
196
|
-
data: 'string', // 上传任务ID
|
|
197
|
-
errorCode: 'OK',
|
|
198
|
-
requestId: 'string',
|
|
199
|
-
resultMsg: '',
|
|
200
|
-
success: true
|
|
201
|
-
}
|
|
202
|
-
```
|
|
154
|
+
- 预览调试包上传并发布,正式包只上传
|
|
203
155
|
|
|
204
|
-
|
|
156
|
+
- 调试包上传之前需要检测是否有白名单,若无白名单,则直接报错返回
|
|
205
157
|
|
|
206
158
|
- 入参
|
|
207
159
|
|
|
208
160
|
- ```js
|
|
209
161
|
{
|
|
210
|
-
|
|
211
|
-
|
|
162
|
+
appInfo: '<object>', // 必填,小程序配置
|
|
163
|
+
packageType: '<string>', // 必填,包类型(1,2 为正式包。3,4 为测试包)
|
|
164
|
+
resourceFile: '<string>', // 必填,小程序包的本地绝对路径
|
|
165
|
+
iconFile: '<string>', // 选填,小程序图标的本地绝对路径
|
|
166
|
+
h5Version: '<string>', // 选填,版本号(若传入,则使用此版本号。若未传入,则使用appInfo.h5Version + packageType生成新的版本号)
|
|
167
|
+
whitelistValue: '<string>', // 选填,白名单(若packageType === '3' || '4',则为测试包,需要白名单)
|
|
168
|
+
sourceCodeFile: '<string>', // 选填,源码包本地的压缩包地址
|
|
212
169
|
}
|
|
213
170
|
```
|
|
214
171
|
|
|
215
172
|
- 返回
|
|
216
173
|
|
|
217
|
-
- ```
|
|
174
|
+
- ```javascript
|
|
218
175
|
{
|
|
219
|
-
data: 'string',
|
|
176
|
+
data: '<string>',
|
|
177
|
+
// packageType === 3 || 4。"{"debugUrl":"mpaas://platformapi/startapp?appId=20001101&token=ide_qr&scheme=mpaas%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D1234567890123456%26nbsv%3D1.4.25.62%26nbsource%3Ddebug%26nbprefer%3DYES%26nbsn%3DDEBUG%26nboffline%3Dsync%26nbtoken%3Dide_qr%26enableBugme%3Dfalse%26chInfo%3Dch_scan%26channelId%3Dnull%26enablePolyfillWorker%3D%26isRemoteDebug%3Dfalse%26enableBugme%3Dfalse%26websocketUrl%3Dwss%3A%2F%2Fcn-hangzhou-mproxy.cloud.alipay.com","userId":"shengyong_zhu"}"
|
|
178
|
+
// packageType === 1 || 2。 "发布ID"
|
|
220
179
|
errorCode: 'OK',
|
|
221
|
-
requestId: 'string',
|
|
180
|
+
requestId: '<string>',
|
|
222
181
|
resultMsg: '',
|
|
223
182
|
success: true
|
|
224
183
|
}
|
|
225
184
|
```
|
|
226
185
|
|
|
186
|
+
### 公共API
|
|
227
187
|
|
|
228
|
-
|
|
229
|
-
#### uploadPackageByApi 上传小程序并发布
|
|
230
|
-
|
|
231
|
-
- 集合了createWhiteListByApi、uploadPackage、createNebulaTask 三个接口
|
|
232
|
-
|
|
233
|
-
- 预览调试包上传并发布,正式包只上传。
|
|
234
|
-
- 调试包上传之前需要检测是否有白名单,若无白名单,则直接报错返回。
|
|
235
|
-
|
|
236
|
-
- 此接口只有IDE原有的classic提供,其他端需要模拟
|
|
237
|
-
- https://yuque.antfin-inc.com/docs/share/7a4a6272-36e4-4176-b50d-2d346a351267?#%20%E3%80%8AIDE%E4%B8%8A%E4%BC%A0%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%8C%85%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E%E3%80%8B
|
|
238
|
-
|
|
239
|
-
- 入参
|
|
240
|
-
|
|
241
|
-
- ```javascript
|
|
242
|
-
{
|
|
243
|
-
appInfo: 'object', // 小程序配置
|
|
244
|
-
packageType: 'string', // 包类型 (1,2 为正式包。3,4 为测试包)
|
|
245
|
-
resourceFile: 'string', // 小程序包的本地绝对路径 (远程包需要自行下载到本地转换为本地绝对路径)
|
|
246
|
-
iconFile: 'string', // 小程序图标的本地绝对路径 (远程包需要自行下载到本地转换为本地绝对路径)
|
|
247
|
-
h5Version: 'string', // 版本号,可选。(若传入,则使用此版本号。若未传入,则使用appInfo.h5Version + packageType生成新的版本号)
|
|
248
|
-
whitelistValue: 'string', // 白名单(若packageType === '3' || '4',则为测试包,需要白名单)
|
|
249
|
-
userId: 'string', // 可选。用来区分白名单名称 `${appId}-${workspaceId}-${tenantId}-${userId}`
|
|
250
|
-
}
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
### 通用API
|
|
256
|
-
|
|
257
|
-
#### uploadFile 上传文件
|
|
188
|
+
#### cloudBuild 云构建小程序
|
|
258
189
|
|
|
259
190
|
- 入参
|
|
260
191
|
|
|
261
192
|
- ```js
|
|
262
193
|
{
|
|
263
|
-
|
|
194
|
+
file: '<string>', // 必填,本地amr文件路径、或者本地项目的根目录
|
|
195
|
+
config: '<object>', // 必填,配置文件
|
|
196
|
+
h5Id: '<string>', // 必填,mPaaS小程序ID
|
|
264
197
|
}
|
|
265
198
|
```
|
|
266
199
|
|
|
267
200
|
- 返回
|
|
268
201
|
|
|
269
|
-
- ```
|
|
270
|
-
{
|
|
271
|
-
data: 'string', // 上传文件后保存在服务器的地址
|
|
272
|
-
errorCode: '',
|
|
273
|
-
success: true
|
|
274
|
-
}
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
#### getVersion 获取版本
|
|
278
|
-
|
|
279
|
-
- 入参
|
|
280
|
-
|
|
281
|
-
- ```js
|
|
282
|
-
{
|
|
283
|
-
version: '1.1.1.5'
|
|
284
|
-
}
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
- 返回
|
|
288
|
-
|
|
289
|
-
- ```js
|
|
202
|
+
- ```javascript
|
|
290
203
|
{
|
|
291
204
|
data: {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
nextDev: '1.1.1.6' // 下一测试版本
|
|
205
|
+
file: '<string>', // 本地根据h5Id生成的mPaaS zip文件,可以直接从控制台上传
|
|
206
|
+
originFile: '<string>' // 云构建原始文件
|
|
295
207
|
},
|
|
296
|
-
success:
|
|
208
|
+
success: true
|
|
297
209
|
}
|
|
298
210
|
```
|
|
299
211
|
|
|
300
|
-
####
|
|
212
|
+
#### getZipFromTar 将本地IDE/mpaasu构建后的小程序tar文件转为mPaaS格式的zip文件
|
|
301
213
|
|
|
302
214
|
- 入参
|
|
303
215
|
|
|
304
216
|
- ```js
|
|
305
217
|
{
|
|
306
|
-
|
|
218
|
+
tarFilePath: '<string>', // 必填,本地tar文件
|
|
219
|
+
h5Id: '<string>' // 必填,mPaaS小程序ID
|
|
307
220
|
}
|
|
308
221
|
```
|
|
309
222
|
|
|
310
223
|
- 返回
|
|
311
224
|
|
|
312
|
-
- ```
|
|
313
|
-
{
|
|
314
|
-
data: 'dbc1898e-2501-417f-b2dc-5e6e1fc2739e',
|
|
315
|
-
success: true
|
|
316
|
-
}
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
#### getZipFromTar tar文件转zip ,用来拿到IDE/mpaasu 构建后的小程序包转为mpaas可上传的格式
|
|
320
|
-
|
|
321
|
-
- 入参
|
|
322
|
-
|
|
323
|
-
- ```js
|
|
324
|
-
{
|
|
325
|
-
tarFilePath: '/var/folders/ls/9svnt3gj0_q3f_gyflbk7gqw0000gn/T/minicode_compile_dy/dist-OikE6ZQHD-1629797477127/dist.tar',
|
|
326
|
-
appId: '123456'
|
|
327
|
-
}
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
- 返回
|
|
331
|
-
|
|
332
|
-
- ```js
|
|
225
|
+
- ```javascript
|
|
333
226
|
{
|
|
334
|
-
data:
|
|
335
|
-
success:
|
|
227
|
+
data: '<string>', // 转换后的zip文件本地路径
|
|
228
|
+
success: true
|
|
336
229
|
}
|
|
337
230
|
```
|
|
338
231
|
|
|
339
|
-
####
|
|
232
|
+
#### cleanCache 清除openapi的缓存文件
|
|
340
233
|
|
|
341
234
|
- 入参 -
|
|
342
235
|
|
|
343
236
|
- 返回
|
|
344
237
|
|
|
345
|
-
- ```
|
|
346
|
-
{
|
|
347
|
-
data: 'tinyapp.com',
|
|
348
|
-
errorCode: 'OK',
|
|
349
|
-
requestId: '599D03FC-2558-533C-BB88-3B3DCD67FB05',
|
|
350
|
-
resultMsg: '',
|
|
351
|
-
success: true
|
|
352
|
-
}
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
#### getPackageType 判断当前的包类型
|
|
356
|
-
|
|
357
|
-
- 入参
|
|
358
|
-
|
|
359
|
-
- packageType
|
|
360
|
-
|
|
361
|
-
- 返回
|
|
362
|
-
|
|
363
|
-
- ```js
|
|
364
|
-
{
|
|
365
|
-
data: 'production' || 'development',
|
|
366
|
-
success: true
|
|
367
|
-
}
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
#### looseJsonParse 不规范json string转换json object
|
|
371
|
-
|
|
372
|
-
- 入参
|
|
373
|
-
|
|
374
|
-
- string
|
|
375
|
-
|
|
376
|
-
- 返回
|
|
377
|
-
|
|
378
|
-
- ```js
|
|
379
|
-
{
|
|
380
|
-
data: 'json object',
|
|
381
|
-
success: true
|
|
382
|
-
}
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
#### downloadFile 远程文件保存至本地
|
|
386
|
-
|
|
387
|
-
- 入参
|
|
388
|
-
|
|
389
|
-
- ```
|
|
390
|
-
{
|
|
391
|
-
url: 'string', // 需要下载文件的远程地址
|
|
392
|
-
target: 'string' // 需要保存至本地的路径。可选,不填写的话,会保存至本地的 `${tmpdir()}/.mpaas_ide_openapi`
|
|
393
|
-
}
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
- 返回
|
|
399
|
-
|
|
400
|
-
- ```js
|
|
238
|
+
- ```javascript
|
|
401
239
|
{
|
|
402
|
-
data:
|
|
240
|
+
data: 'ok',
|
|
403
241
|
success: true
|
|
404
242
|
}
|
|
405
243
|
```
|