runner-runtime 1.0.76 → 1.0.78

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.
Files changed (3) hide show
  1. package/events/api.js +44 -34
  2. package/package.json +5 -3
  3. package/tmp/request.js +392 -138
package/events/api.js CHANGED
@@ -2282,43 +2282,51 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2282
2282
  }
2283
2283
  },
2284
2284
 
2285
- response: async (err, cursor, response, request, item, cookies, history) => {
2286
- if (!err) {
2287
- if (!_.includes(['get_parsed_request'], scene)) {
2288
- _.set(eventRuntimeData, [event?.event_id, "response"], await convert2EchoResponse(response, history));
2289
- }
2290
- } else {
2291
- if (!_.includes(['script', 'sql', 'assert_visual', 'assert'], event?.type)) {
2292
- _.set(eventRuntimeData, [event?.event_id, "exception", 'prerequest'], String(err));
2293
- _.set(eventRuntimeData, [event?.event_id, 'error'], {
2294
- error_type: 'prerequest',
2295
- message: String(err)
2296
- })
2297
-
2298
- if (_.isUndefined(_.get(eventRuntimeData, [event?.event_id, "console"]))) {
2299
- _.set(eventRuntimeData, [event?.event_id, "console"], []);
2300
- }
2301
-
2302
- const time = Date.now()
2303
- eventRuntimeData[event?.event_id].console.push(
2304
- {
2305
- time,
2306
- "level": "error",
2307
- "args": [String(err?.message)]
2308
- }
2309
- )
2310
- }
2285
+ responseStart: (err, cursor, response, request, item, cookies, history) => {
2286
+ if (_.includes(['get_parsed_request'], scene)) {
2287
+ callback(generateHarFromRequest(request));
2288
+ try {
2289
+ run.abort();
2290
+ } catch (e) { }
2291
+ resolve();
2311
2292
  }
2293
+ },
2312
2294
 
2313
- const requestOptions = convert2EchoRequest(request, requestJson, postmanJSON, history);
2314
- _.set(eventRuntimeData, [event?.event_id, "request"], requestOptions);
2315
-
2295
+ response: async (err, cursor, response, request, item, cookies, history) => {
2316
2296
  if (_.includes(['get_parsed_request'], scene)) {
2317
2297
  callback(generateHarFromRequest(request));
2318
2298
  try {
2319
2299
  run.abort();
2320
2300
  } catch (e) { }
2321
2301
  resolve();
2302
+ } else {
2303
+ if (!err) {
2304
+ _.set(eventRuntimeData, [event?.event_id, "response"], await convert2EchoResponse(response, history));
2305
+ } else {
2306
+ if (!_.includes(['script', 'sql', 'assert_visual', 'assert'], event?.type)) {
2307
+ _.set(eventRuntimeData, [event?.event_id, "exception", 'prerequest'], String(err));
2308
+ _.set(eventRuntimeData, [event?.event_id, 'error'], {
2309
+ error_type: 'prerequest',
2310
+ message: String(err)
2311
+ })
2312
+
2313
+ if (_.isUndefined(_.get(eventRuntimeData, [event?.event_id, "console"]))) {
2314
+ _.set(eventRuntimeData, [event?.event_id, "console"], []);
2315
+ }
2316
+
2317
+ const time = Date.now()
2318
+ eventRuntimeData[event?.event_id].console.push(
2319
+ {
2320
+ time,
2321
+ "level": "error",
2322
+ "args": [String(err?.message)]
2323
+ }
2324
+ )
2325
+ }
2326
+ }
2327
+
2328
+ const requestOptions = convert2EchoRequest(request, requestJson, postmanJSON, history);
2329
+ _.set(eventRuntimeData, [event?.event_id, "request"], requestOptions);
2322
2330
  }
2323
2331
  },
2324
2332
 
@@ -2412,11 +2420,13 @@ module.exports = (event, option, callback, eventRuntimeData, eventResultList) =>
2412
2420
  },
2413
2421
 
2414
2422
  item(err, cursor, item, visualizer, result) {
2415
- if (!err && _.isObject(visualizer)) {
2416
- const { error, processedTemplate } = visualizer;
2417
- _.set(eventRuntimeData[event?.event_id], "visualizer", { error, processed_template: processedTemplate });
2418
- } else {
2419
- _.set(eventRuntimeData[event?.event_id], "visualizer", { error: null, processed_template: "" });
2423
+ if (!_.includes(['get_parsed_request'], scene)) {
2424
+ if (!err && _.isObject(visualizer)) {
2425
+ const { error, processedTemplate } = visualizer;
2426
+ _.set(eventRuntimeData[event?.event_id], "visualizer", { error, processed_template: processedTemplate });
2427
+ } else {
2428
+ _.set(eventRuntimeData[event?.event_id], "visualizer", { error: null, processed_template: "" });
2429
+ }
2420
2430
  }
2421
2431
  },
2422
2432
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runner-runtime",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "description": "runner-runtime.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -19,12 +19,14 @@
19
19
  "url": "https://github.com/Apipost-Team/runner-runtime/issues"
20
20
  },
21
21
  "homepage": "https://github.com/Apipost-Team/runner-runtime#readme",
22
+ "devDependencies": {
23
+ "database-query": "^1.1.12"
24
+ },
22
25
  "dependencies": {
23
26
  "@apipost/url-join": "^1.0.1",
24
27
  "apipost-tools": "^0.0.38",
25
28
  "atomic-sleep": "^1.0.0",
26
29
  "content-disposition": "^0.5.4",
27
- "database-query": "^1.1.12",
28
30
  "file-type": "^16.5.4",
29
31
  "is-image": "^3.0.0",
30
32
  "is-svg": "^4.3.2",
@@ -48,4 +50,4 @@
48
50
  "uuid": "^9.0.1",
49
51
  "validator": "^13.15.0"
50
52
  }
51
- }
53
+ }
package/tmp/request.js CHANGED
@@ -1,9 +1,7 @@
1
1
  module.exports = {
2
2
  "option": {
3
3
  "scene": "http_request",
4
- "globals": {
5
- "variable_key": "variable_value"
6
- },
4
+ "globals": {},
7
5
  "project": {
8
6
  "request": {
9
7
  "header": {
@@ -71,103 +69,20 @@ module.exports = {
71
69
  "sort": 1000,
72
70
  "uri": ""
73
71
  },
74
- "467939876001000": {
75
- "server_id": "467939876001000",
76
- "name": "服务01",
72
+ "468cc640dc01000": {
73
+ "server_id": "468cc640dc01000",
74
+ "name": "aaa1",
77
75
  "sort": 2000,
78
- "uri": "cc.apipost.cc:6001"
76
+ "uri": "111"
79
77
  }
80
78
  },
81
- "environment": {}
79
+ "environment": {
80
+ "123": ""
81
+ }
82
82
  },
83
83
  "cookies": {
84
84
  "switch": 1,
85
- "data": [
86
- {
87
- "key": "liveCookie",
88
- "value": "gin",
89
- "maxAge": 120,
90
- "domain": "go.apipost.cn",
91
- "path": "/",
92
- "secure": true,
93
- "httpOnly": true,
94
- "creation": "2025-05-15T10:38:57.212Z",
95
- "name": "liveCookie",
96
- "cookie_id": "275fc00b7ae05a",
97
- "expires": "Thu, 15 May 2025 10:41:01 GMT",
98
- "project_id": "4660e6894001000"
99
- },
100
- {
101
- "key": "loseCookie",
102
- "value": "gin",
103
- "maxAge": 0,
104
- "domain": "go.apipost.cn",
105
- "path": "/",
106
- "secure": true,
107
- "httpOnly": true,
108
- "creation": "2025-05-15T10:38:57.212Z",
109
- "name": "loseCookie",
110
- "cookie_id": "275fc00b7ae05b",
111
- "expires": "Thu, 15 May 2025 10:39:01 GMT",
112
- "project_id": "4660e6894001000"
113
- },
114
- {
115
- "key": "HWWAFSESID",
116
- "value": "58238825d84d632420",
117
- "path": "/",
118
- "creation": "2025-05-14T03:49:53.061Z",
119
- "name": "HWWAFSESID",
120
- "cookie_id": "2762194efae080",
121
- "domain": "api.deepseek.com",
122
- "project_id": "4660e6894001000"
123
- },
124
- {
125
- "key": "HWWAFSESTIME",
126
- "value": "1747194592164",
127
- "path": "/",
128
- "creation": "2025-05-14T03:49:53.061Z",
129
- "name": "HWWAFSESTIME",
130
- "cookie_id": "2762194efae081",
131
- "domain": "api.deepseek.com",
132
- "project_id": "4660e6894001000"
133
- },
134
- {
135
- "key": "security_session_verify",
136
- "value": "50b7079424eebfb269f14efdd7081939",
137
- "expires": "2025-05-18T18:29:27.000Z",
138
- "path": "/",
139
- "httpOnly": true,
140
- "creation": "2025-05-15T10:29:28.804Z",
141
- "name": "security_session_verify",
142
- "cookie_id": "290728687aef2d",
143
- "domain": "echo.apipost.cn",
144
- "project_id": "4660e6894001000"
145
- },
146
- {
147
- "key": "security_session_verify",
148
- "value": "50b7079424eebfb269f14efdd7081939",
149
- "expires": "2025-05-18T18:29:27.000Z",
150
- "path": "/",
151
- "httpOnly": true,
152
- "creation": "2025-05-15T10:29:28.805Z",
153
- "name": "security_session_verify",
154
- "cookie_id": "29072868baef2e",
155
- "domain": "echo.apipost.cn",
156
- "project_id": "4660e6894001000"
157
- },
158
- {
159
- "key": "security_session_verify",
160
- "value": "50b7079424eebfb269f14efdd7081939",
161
- "expires": "2025-05-18T18:29:27.000Z",
162
- "path": "/",
163
- "httpOnly": true,
164
- "creation": "2025-05-15T10:29:28.805Z",
165
- "name": "security_session_verify",
166
- "cookie_id": "29072868baef2f",
167
- "domain": "echo.apipost.cn",
168
- "project_id": "4660e6894001000"
169
- }
170
- ]
85
+ "data": []
171
86
  },
172
87
  "system_configs": {
173
88
  "send_timeout": 0,
@@ -176,7 +91,7 @@ module.exports = {
176
91
  "auto_gen_mock_url": 1,
177
92
  "request_param_auto_json": -1,
178
93
  "proxy": {
179
- "type": 2,
94
+ "type": -1,
180
95
  "envfirst": 1,
181
96
  "bypass": [],
182
97
  "protocols": [
@@ -191,60 +106,394 @@ module.exports = {
191
106
  },
192
107
  "ca_cert": {
193
108
  "open": -1,
194
- "path": "",
195
- "base64": ""
109
+ "path": ""
196
110
  },
197
- "client_cert": {
198
- "https://cc.apipost.cc:6003": {
199
- "crt": {
200
- "file_base64": "data:application/x-x509-ca-cert;base64,LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURuVENDQW9VQ0ZFcDd4Z3J2VVhteWEzTEdmcEFpenRNUkJvN3ZNQTBHQ1NxR1NJYjNEUUVCQ3dVQU1JR0sKTVFzd0NRWURWUVFHRXdKRFRqRVFNQTRHQTFVRUNBd0hRbVZwYW1sdVp6RVFNQTRHQTFVRUJ3d0hRbVZwYW1sdQpaekVRTUE0R0ExVUVDZ3dIWVhCcGNHOXpkREVNTUFvR0ExVUVDd3dEWVhCME1SWXdGQVlEVlFRRERBMWpZeTVoCmNHbHdiM04wTG1Oak1SOHdIUVlKS29aSWh2Y05BUWtCRmhCaFpHMXBia0JoY0dsd2IzTjBMbU5qTUI0WERUSXoKTVRJeE1UQTVOREl4TmxvWERUTXpNVEl3T0RBNU5ESXhObG93Z1lveEN6QUpCZ05WQkFZVEFrTk9NUkF3RGdZRApWUVFJREFkQ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prZzJwK3o5MUFVU3p2NlpTbHlnK3pGM2kyM1Q0ZXA5VDhwRTV2eXE3UlFnClNPT3BQd25uN0d5UWd2UzREbU5LMHkyazc5ZUdGb3VnTWxnS3g1Um5nMUQxNEd0ZFcvMlE0WGxNa2tHZ1ZsR2IKRVRkcGlES1JKWjNTTDJPZ1RsSFpibWM9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K",
201
- "file_name": "client (1).crt",
202
- "file_url": ""
111
+ "client_cert": {}
112
+ },
113
+ "custom_functions": {
114
+ "fn_add": "\n//返回函数处理后的text,text为函数的入参\n\nreturn text % 2 === 0;\n"
115
+ },
116
+ "collection": [
117
+ {
118
+ "target_id": "469ef86c4401000",
119
+ "target_type": "sample",
120
+ "parent_id": "250e0b1af57024",
121
+ "name": "测试数据",
122
+ "request": {
123
+ "auth": {
124
+ "type": "inherit"
203
125
  },
204
- "key": {
205
- "file_name": "client (1).key",
206
- "file_url": "",
207
- "file_base64": "data:application/x-iwork-keynote-sffkey;base64,LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBNXdvMHFWblAweWY2c2VuYlFSQ0NjY1l0RE5ESU9kenJraURQb0MxYkpjdmNTRUVqCmNCVjRaUC94dkV2V0xjSW9OTTZYa2lrVjYrdjVyeUQ2L1pYTFFJdzVJT1BBanp5VFYybWVST3oxUTE1dkpqTVcKaW5RTXFuajNUcGVwVzdaQ1ZSTkxhU0ZTMmZFUncvWHZFMW0rQWkrRDB5dmZ1RjFCeUEwREJEQmpKbW9CQkVNTQovcmUwVEMzZWFLajliYms3MXdKNGs1M3ZEYjJtaysrUFk2VjE2TW9GcUJJbHRQRzhPbStqWDZWRU5zVDVTUnBMCkpHNTAydnRqSG82RlpDV1FwZFh2UnpXcnI1RHZXZkQ0M1Y5S0lIdCtQRFlucU80M0FtSVFFWkpvN2lJOFc5VEgKVXNEcis5ZVZTcXRLVUtaOTdFNjVHT1k3K2c4L3U3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b29FMC9mZE0vVFEwVmRtbQpGeEJrN2xmMkVpdllycjJTbDB4bk5hYkRrK1MwdG1STUNlWGh5SzZldmJIMTY1SXBpVTcwMHpzenBXcDNneEdOCnFvMVZUd2JscHhwdkpEMStjdHJLeXNFQ2dZRUFyMlo0T3Q4Y0lCVnVGS2h2cWV5Mlc1UWt6UlJIUWV1bTkwSU0KQ2t1T2tGeGlVOXgxRWRCQjFTSGtmNzFjNG96VnlQNis4VkdsTFZkTDdVSG4ySVZQQUlPTWFKc0crSGlLRXpTdApSMHN2MzNqdmVWQVh5Wi9jMG0weWwyc0MyZUwweEJxbFo2bUl4YTJSb3BuaVFWeUpKeTl1WUJOa1BsYTk0Mi8wCnRYY0lHaDhDZ1lCbHJBaVdIOGU4aEhkWjdxTjNOTk51cVkvQjdJWFNPdzFIMEVKbjd3Ui9tZElzalFRYkJGL3gKa05YNndvZDVFeHBzRkVER2lJQ0RiQm1FbW5oaU1TWFBXREhoalZKSkFSUG5sL2Fxc0tNemt0dXdic29DbGQ2OApkT1hkbHNtbGhYZVdrcGp5ZUdCREZ5Y3hPdW80M3F6VzdOOUNpQ285dXBuNGZrSEg3Si95Znc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
126
+ "body": {
127
+ "raw": "{\"zxc\": \"ut ipsum\", \"zzzz\": \"2025-05-15T07:20:17.657Z\"}",
128
+ "mode": "json",
129
+ "binary": null,
130
+ "parameter": [],
131
+ "raw_schema": {},
132
+ "raw_parameter": []
208
133
  },
209
- "password": "",
210
- "pfx": {
211
- "file_base64": "",
212
- "file_name": "",
213
- "file_url": ""
134
+ "query": {
135
+ "parameter": [],
136
+ "query_add_equal": 1
214
137
  },
215
- "HOST": "https://cc.apipost.cc:6003"
216
- }
217
- }
218
- },
219
- "custom_functions": {},
220
- "collection": [
138
+ "cookie": {
139
+ "parameter": [],
140
+ "cookie_encode": 1
141
+ },
142
+ "header": {
143
+ "parameter": [
144
+ {
145
+ "key": "Content-Length",
146
+ "value": "59",
147
+ "schema": {
148
+ "type": "string"
149
+ },
150
+ "not_null": 1,
151
+ "param_id": "469ef86c4401000",
152
+ "field_type": "string",
153
+ "is_checked": 1,
154
+ "description": ""
155
+ },
156
+ {
157
+ "key": "Accept-Encoding",
158
+ "value": "gzip, deflate, br",
159
+ "schema": {
160
+ "type": "string"
161
+ },
162
+ "not_null": 1,
163
+ "param_id": "469ef86c4401001",
164
+ "field_type": "string",
165
+ "is_checked": 1,
166
+ "description": ""
167
+ },
168
+ {
169
+ "key": "Host",
170
+ "value": "cc.apipost.cc:6002",
171
+ "schema": {
172
+ "type": "string"
173
+ },
174
+ "not_null": 1,
175
+ "param_id": "469ef86c4401002",
176
+ "field_type": "string",
177
+ "is_checked": 1,
178
+ "description": ""
179
+ },
180
+ {
181
+ "key": "Accept",
182
+ "value": "*/*",
183
+ "schema": {
184
+ "type": "string"
185
+ },
186
+ "not_null": 1,
187
+ "param_id": "469ef86c4401003",
188
+ "field_type": "string",
189
+ "is_checked": 1,
190
+ "description": ""
191
+ },
192
+ {
193
+ "key": "Connection",
194
+ "value": "keep-alive",
195
+ "schema": {
196
+ "type": "string"
197
+ },
198
+ "not_null": 1,
199
+ "param_id": "469ef86c4401004",
200
+ "field_type": "string",
201
+ "is_checked": 1,
202
+ "description": ""
203
+ },
204
+ {
205
+ "key": "User-Agent",
206
+ "value": "PostmanRuntime-ApipostRuntime/1.1.0",
207
+ "schema": {
208
+ "type": "string"
209
+ },
210
+ "not_null": 1,
211
+ "param_id": "469ef86c4401005",
212
+ "field_type": "string",
213
+ "is_checked": 1,
214
+ "description": ""
215
+ },
216
+ {
217
+ "key": "Content-Type",
218
+ "value": "application/json",
219
+ "schema": {
220
+ "type": "string"
221
+ },
222
+ "not_null": 1,
223
+ "param_id": "469ef86c4401006",
224
+ "field_type": "string",
225
+ "is_checked": 1,
226
+ "description": ""
227
+ },
228
+ {
229
+ "key": "Cache-Control",
230
+ "value": "no-cache",
231
+ "schema": {
232
+ "type": "string"
233
+ },
234
+ "not_null": 1,
235
+ "param_id": "469ef86c4401007",
236
+ "field_type": "string",
237
+ "is_checked": 1,
238
+ "description": ""
239
+ }
240
+ ]
241
+ },
242
+ "restful": {
243
+ "parameter": []
244
+ },
245
+ "pre_tasks": [],
246
+ "post_tasks": []
247
+ },
248
+ "parents": [
249
+ {
250
+ "target_id": "250e0b1af57024",
251
+ "target_type": "api"
252
+ },
253
+ {
254
+ "target_id": "28cb255375729d",
255
+ "target_type": "folder"
256
+ }
257
+ ],
258
+ "method": "POST",
259
+ "protocol": "http/1.1",
260
+ "url": "http://cc.apipost.cc:6002/post",
261
+ "pre_url": ""
262
+ },
221
263
  {
222
- "target_id": "28e606147ae00b",
223
- "target_type": "api",
264
+ "target_id": "28cb255375729d",
265
+ "target_type": "folder",
224
266
  "parent_id": "0",
225
- "name": "11683",
267
+ "name": "测试目录",
268
+ "request": {
269
+ "auth": {
270
+ "type": "inherit"
271
+ },
272
+ "pre_tasks": [
273
+ {
274
+ "type": "customScript",
275
+ "enabled": 1,
276
+ "data": "apt.environment.getName();",
277
+ "name": "自定义脚本",
278
+ "id": "29283d3435793e"
279
+ }
280
+ ],
281
+ "post_tasks": [
282
+ {
283
+ "type": "customScript",
284
+ "enabled": 1,
285
+ "data": "apt.test(\"响应码为 200\", function () {\n apt.response.to.have.status(200);\n });",
286
+ "name": "自定义脚本",
287
+ "id": "2928468df5793f"
288
+ }
289
+ ],
290
+ "body": {
291
+ "parameter": []
292
+ },
293
+ "header": {
294
+ "parameter": []
295
+ },
296
+ "query": {
297
+ "parameter": []
298
+ },
299
+ "cookie": {
300
+ "parameter": []
301
+ }
302
+ },
303
+ "parents": [],
304
+ "server_id": "0",
305
+ "pre_url": ""
306
+ },
307
+ {
308
+ "target_id": "250e0b1af57024",
309
+ "target_type": "api",
310
+ "parent_id": "28cb255375729d",
311
+ "name": "根据提供信息处理业务的API",
226
312
  "request": {
227
313
  "auth": {
228
314
  "type": "inherit"
229
315
  },
230
316
  "body": {
231
317
  "mode": "json",
232
- "parameter": [],
233
- "raw": "",
234
- "raw_parameter": [],
318
+ "parameter": [
319
+ {
320
+ "param_id": "25137d7677102e",
321
+ "description": "序号",
322
+ "field_type": "number",
323
+ "is_checked": 1,
324
+ "key": "id",
325
+ "not_null": 1,
326
+ "value": "111{{$mockjs.qq()|fn_add}}",
327
+ "content_type": "",
328
+ "file_name": "",
329
+ "file_base64": "",
330
+ "schema": {
331
+ "type": "number"
332
+ }
333
+ },
334
+ {
335
+ "param_id": "25137f23f7102f",
336
+ "description": "姓名",
337
+ "field_type": "string",
338
+ "is_checked": 1,
339
+ "key": "name",
340
+ "not_null": 1,
341
+ "value": "张三",
342
+ "content_type": "",
343
+ "file_name": "",
344
+ "file_base64": "",
345
+ "schema": {
346
+ "type": "string",
347
+ "default": "张三"
348
+ }
349
+ },
350
+ {
351
+ "param_id": "25145237f71041",
352
+ "description": "年龄",
353
+ "field_type": "integer",
354
+ "is_checked": 1,
355
+ "key": "age",
356
+ "not_null": 1,
357
+ "value": "{{age}}",
358
+ "content_type": "",
359
+ "file_name": "",
360
+ "file_base64": "",
361
+ "schema": {
362
+ "type": "integer",
363
+ "format": "int64"
364
+ }
365
+ }
366
+ ],
367
+ "raw": "{\n\t\"user_name\": \"张三\",\n\t\"user_phone\": \"13800138000\",\n\t\"user_id\": \"1234567890\",\n\t\"user_nickname\": \"阳光男孩\",\n\t\"user_address\": \"北京市朝阳区XX街道XX号\",\n\t\"order_number\": \"20231010123456\"\n}",
368
+ "raw_parameter": [
369
+ {
370
+ "key": "user_name",
371
+ "value": "张三",
372
+ "description": "用户的真实姓名,用于标识用户身份。\n",
373
+ "not_null": 1,
374
+ "field_type": "String",
375
+ "type": "Text",
376
+ "is_checked": 1,
377
+ "param_id": "2a675ed7bf100c"
378
+ },
379
+ {
380
+ "key": "user_phone",
381
+ "value": "13800138000",
382
+ "description": "用户的联系电话,方便与用户取得联系。\n",
383
+ "not_null": 1,
384
+ "field_type": "String",
385
+ "type": "Text",
386
+ "is_checked": 1,
387
+ "param_id": "2a675ed7bf100d"
388
+ },
389
+ {
390
+ "key": "user_id",
391
+ "value": "1234567890",
392
+ "description": "用户的唯一标识符,用于系统内区分不同用户。\n",
393
+ "not_null": 1,
394
+ "field_type": "String",
395
+ "type": "Text",
396
+ "is_checked": 1,
397
+ "param_id": "2a675ed7bf100e"
398
+ },
399
+ {
400
+ "key": "user_nickname",
401
+ "value": "阳光男孩",
402
+ "description": "用户在系统中使用的昵称,具有个性化。\n",
403
+ "not_null": 1,
404
+ "field_type": "String",
405
+ "type": "Text",
406
+ "is_checked": 1,
407
+ "param_id": "2a675ed7bf100f"
408
+ },
409
+ {
410
+ "key": "user_address",
411
+ "value": "北京市朝阳区XX街道XX号",
412
+ "description": "用户的居住地址,用于相关业务的地址信息记录。\n",
413
+ "not_null": 1,
414
+ "field_type": "String",
415
+ "type": "Text",
416
+ "is_checked": 1,
417
+ "param_id": "2a675ed7bf1010"
418
+ },
419
+ {
420
+ "key": "order_number",
421
+ "value": "20231010123456",
422
+ "description": "订单编号,用于标识特定的订单。\n",
423
+ "not_null": 1,
424
+ "field_type": "String",
425
+ "type": "Text",
426
+ "is_checked": 1,
427
+ "param_id": "2a675ed7bf1011"
428
+ }
429
+ ],
235
430
  "raw_schema": {
236
- "type": "object"
431
+ "type": "object",
432
+ "required": [
433
+ "user_name",
434
+ "user_phone",
435
+ "user_id",
436
+ "user_nickname",
437
+ "user_address",
438
+ "order_number"
439
+ ],
440
+ "properties": {
441
+ "user_name": {
442
+ "type": "string",
443
+ "description": "用户的真实姓名,用于标识用户身份。\n"
444
+ },
445
+ "user_phone": {
446
+ "type": "string",
447
+ "description": "用户的联系电话,方便与用户取得联系。\n"
448
+ },
449
+ "user_id": {
450
+ "type": "string",
451
+ "description": "用户的唯一标识符,用于系统内区分不同用户。\n"
452
+ },
453
+ "user_nickname": {
454
+ "type": "string",
455
+ "description": "用户在系统中使用的昵称,具有个性化。\n"
456
+ },
457
+ "user_address": {
458
+ "type": "string",
459
+ "description": "用户的居住地址,用于相关业务的地址信息记录。\n"
460
+ },
461
+ "order_number": {
462
+ "type": "string",
463
+ "description": "订单编号,用于标识特定的订单。\n"
464
+ }
465
+ },
466
+ "x-schema-refs": {
467
+ "fa39c8a7bb014": {}
468
+ },
469
+ "x-schema-orders": [
470
+ "fa39c8a7bb014",
471
+ "user_name",
472
+ "user_phone",
473
+ "user_id",
474
+ "user_nickname",
475
+ "user_address",
476
+ "order_number"
477
+ ]
237
478
  },
238
479
  "binary": null
239
480
  },
240
- "pre_tasks": [],
241
- "post_tasks": [
481
+ "pre_tasks": [
242
482
  {
243
483
  "type": "customScript",
244
- "id": "29077d8a7ae006",
484
+ "enabled": 1,
485
+ "data": "apt.environment.set(\"key\", \"value\");",
245
486
  "name": "自定义脚本",
487
+ "id": "29282dddf57937"
488
+ }
489
+ ],
490
+ "post_tasks": [
491
+ {
492
+ "type": "customScript",
246
493
  "enabled": 1,
247
- "data": "var jsonData = apt.response.json();\n//从响应数据中获取childList\nconst List = jsonData.data.list[0];\nconsole.log(List)\n//设置环境变量\napt.environment.set(\"childlist02\", List);\napt.environment.set(\"childlist\", jsonData.data.list[0]);\napt.environment.set(\"childlist01\",111);\napt.environment.set(\"设置环境无效\", \"设置环境无效\");\n\napt.globals.set(\"variable_key\", \"variable_value\");\napt.globals.set(\"childlist02\", List);"
494
+ "data": "apt.test(\"响应码为 200\", function () {\n apt.response.to.have.status(200);\n});\n\napt.environment.unset(\"key\");",
495
+ "name": "自定义脚本",
496
+ "id": "292832d0357939"
248
497
  }
249
498
  ],
250
499
  "header": {
@@ -262,10 +511,15 @@ module.exports = {
262
511
  "parameter": []
263
512
  }
264
513
  },
265
- "parents": [],
266
- "method": "GET",
267
- "protocol": "http/1.1",
268
- "url": "https://echo.apipost.cn/userlist.php",
514
+ "parents": [
515
+ {
516
+ "target_id": "28cb255375729d",
517
+ "target_type": "folder"
518
+ }
519
+ ],
520
+ "method": "POST",
521
+ "protocol": "auto",
522
+ "url": "http://cc.apipost.cc:6002/post",
269
523
  "pre_url": ""
270
524
  }
271
525
  ],
@@ -273,12 +527,12 @@ module.exports = {
273
527
  },
274
528
  "test_events": [
275
529
  {
276
- "type": "api",
530
+ "type": "sample",
277
531
  "data": {
278
- "target_id": "28e606147ae00b",
279
- "project_id": "26623ba1a864000",
280
- "parent_id": "4651a1dffc6e000",
281
- "target_type": "api"
532
+ "target_id": "469ef86c4401000",
533
+ "project_id": "250e0b1ab5701e",
534
+ "parent_id": "250e0b1af57024",
535
+ "target_type": "sample"
282
536
  }
283
537
  }
284
538
  ]