runner-runtime 1.0.78 → 1.0.81

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/events/api.js CHANGED
@@ -143,7 +143,13 @@ const convert2PostmanRequest = (request, option) => {
143
143
  _.set(pmRequest, "protocol", _.get(request, "protocol") || "http/1.1");
144
144
 
145
145
  // 处理 method
146
- _.set(pmRequest, "method", _.get(request, "method") || "GET");
146
+ let method = _.get(request, "method") || "GET";
147
+
148
+ if(_.includes(['CONNECT'],_.toUpper(method))){
149
+ method = 'GET';
150
+ }
151
+
152
+ _.set(pmRequest, "method", method);
147
153
 
148
154
  // 处理认证
149
155
  const auth = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runner-runtime",
3
- "version": "1.0.78",
3
+ "version": "1.0.81",
4
4
  "description": "runner-runtime.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -37,7 +37,7 @@
37
37
  "mime": "^3.0.0",
38
38
  "minimatch": "^9.0.4",
39
39
  "mockjs5-pro": "^1.0.6",
40
- "json-schema-faker-pro": "^0.5.28",
40
+ "json-schema-faker-pro": "^0.5.29",
41
41
  "exp-mock": "^2.0.17",
42
42
  "msgpack5": "^6.0.2",
43
43
  "net": "^1.0.2",
package/tmp/request.js CHANGED
@@ -48,7 +48,15 @@ module.exports = {
48
48
  "auth": {
49
49
  "type": "noauth"
50
50
  },
51
- "pre_tasks": [],
51
+ "pre_tasks": [
52
+ {
53
+ "id": "14444a597644ca",
54
+ "type": "customScript",
55
+ "enabled": 1,
56
+ "data": "function idcard() {\n return '4177251111111';\n}\nfunction b() {\n return '333';\n}\n\nfunction c() {\n return '22222';\n}",
57
+ "name": "自定义脚本"
58
+ }
59
+ ],
52
60
  "post_tasks": []
53
61
  }
54
62
  },
@@ -68,21 +76,56 @@ module.exports = {
68
76
  "name": "默认服务",
69
77
  "sort": 1000,
70
78
  "uri": ""
71
- },
72
- "468cc640dc01000": {
73
- "server_id": "468cc640dc01000",
74
- "name": "aaa1",
75
- "sort": 2000,
76
- "uri": "111"
77
79
  }
78
80
  },
79
81
  "environment": {
80
- "123": ""
82
+ "phone": "",
83
+ "user_id": ""
81
84
  }
82
85
  },
83
86
  "cookies": {
84
87
  "switch": 1,
85
- "data": []
88
+ "data": [
89
+ {
90
+ "key": "aliyungf_tc",
91
+ "value": "e6d1d6f5e7a6350610bd8ad4ffbdf3f761ccd221501e275d42e029dff094a782",
92
+ "path": "/",
93
+ "httpOnly": true,
94
+ "creation": "2025-05-19T05:44:27.144Z",
95
+ "name": "aliyungf_tc",
96
+ "cookie_id": "2dec44b8f47008",
97
+ "domain": "op.juhe.cn",
98
+ "project_id": "137212d936401f"
99
+ },
100
+ {
101
+ "key": "liveCookie",
102
+ "value": "gin",
103
+ "maxAge": 120,
104
+ "domain": "go.apipost.cn",
105
+ "path": "/",
106
+ "secure": true,
107
+ "httpOnly": true,
108
+ "creation": "2025-05-19T07:23:44.291Z",
109
+ "name": "liveCookie",
110
+ "cookie_id": "2e028c353c600c",
111
+ "expires": "Mon, 19 May 2025 07:25:44 GMT",
112
+ "project_id": "137212d936401f"
113
+ },
114
+ {
115
+ "key": "loseCookie",
116
+ "value": "gin",
117
+ "maxAge": 0,
118
+ "domain": "go.apipost.cn",
119
+ "path": "/",
120
+ "secure": true,
121
+ "httpOnly": true,
122
+ "creation": "2025-05-19T07:23:44.291Z",
123
+ "name": "loseCookie",
124
+ "cookie_id": "2e028c353c600d",
125
+ "expires": "Mon, 19 May 2025 07:23:44 GMT",
126
+ "project_id": "137212d936401f"
127
+ }
128
+ ]
86
129
  },
87
130
  "system_configs": {
88
131
  "send_timeout": 0,
@@ -91,7 +134,7 @@ module.exports = {
91
134
  "auto_gen_mock_url": 1,
92
135
  "request_param_auto_json": -1,
93
136
  "proxy": {
94
- "type": -1,
137
+ "type": 2,
95
138
  "envfirst": 1,
96
139
  "bypass": [],
97
140
  "protocols": [
@@ -111,370 +154,58 @@ module.exports = {
111
154
  "client_cert": {}
112
155
  },
113
156
  "custom_functions": {
114
- "fn_add": "\n//返回函数处理后的text,text为函数的入参\n\nreturn text % 2 === 0;\n"
157
+ "fn_aaa": "\n//返回函数处理后的text,text为函数的入参\nreturn text+123;",
158
+ "fn_idcard": "\n//返回函数处理后的text,text为函数的入参\nreturn '41072518777777';"
115
159
  },
116
160
  "collection": [
117
161
  {
118
- "target_id": "469ef86c4401000",
119
- "target_type": "sample",
120
- "parent_id": "250e0b1af57024",
121
- "name": "测试数据",
122
- "request": {
123
- "auth": {
124
- "type": "inherit"
125
- },
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": []
133
- },
134
- "query": {
135
- "parameter": [],
136
- "query_add_equal": 1
137
- },
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
- },
263
- {
264
- "target_id": "28cb255375729d",
265
- "target_type": "folder",
266
- "parent_id": "0",
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",
162
+ "target_id": "1431af17f64057",
309
163
  "target_type": "api",
310
- "parent_id": "28cb255375729d",
311
- "name": "根据提供信息处理业务的API",
164
+ "parent_id": "0",
165
+ "name": "Anything",
312
166
  "request": {
313
167
  "auth": {
314
168
  "type": "inherit"
315
169
  },
316
170
  "body": {
317
- "mode": "json",
171
+ "mode": "urlencoded",
318
172
  "parameter": [
319
173
  {
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": "姓名",
174
+ "param_id": "14343144f710b0",
175
+ "description": "登录验证码,用于验证用户身份,确保登录操作的安全性。\n",
337
176
  "field_type": "string",
338
177
  "is_checked": 1,
339
- "key": "name",
178
+ "key": "phone",
340
179
  "not_null": 1,
341
- "value": "张三",
180
+ "value": "",
342
181
  "content_type": "",
343
182
  "file_name": "",
344
183
  "file_base64": "",
345
184
  "schema": {
346
185
  "type": "string",
347
- "default": "张三"
186
+ "default": ""
348
187
  }
349
188
  },
350
189
  {
351
- "param_id": "25145237f71041",
352
- "description": "年龄",
353
- "field_type": "integer",
190
+ "param_id": "1435d64439b0cd",
191
+ "description": "",
192
+ "field_type": "string",
354
193
  "is_checked": 1,
355
- "key": "age",
194
+ "key": "",
356
195
  "not_null": 1,
357
- "value": "{{age}}",
196
+ "value": "",
358
197
  "content_type": "",
359
198
  "file_name": "",
360
199
  "file_base64": "",
361
200
  "schema": {
362
- "type": "integer",
363
- "format": "int64"
201
+ "type": "string"
364
202
  }
365
203
  }
366
204
  ],
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
- ],
205
+ "raw": "",
206
+ "raw_parameter": [],
430
207
  "raw_schema": {
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
- ]
208
+ "type": "object"
478
209
  },
479
210
  "binary": null
480
211
  },
@@ -482,22 +213,49 @@ module.exports = {
482
213
  {
483
214
  "type": "customScript",
484
215
  "enabled": 1,
485
- "data": "apt.environment.set(\"key\", \"value\");",
216
+ "data": "try {\n // php 示例,调用 demo.php\n // 注意:json 格式数据作为参数时,需要使用 JSON.stringify 对参数进行序列化\n // 实际命令行执行的命令为:php demo.php '{\"a\":1,\"b\":2}'\n const phpResultString = await pm.executeAsync(\"/Users/aaa.js\");\n\n// console.log(getMainProcessSocketPath())\n // 注意:返回数据为 json 格式字符串时,可使用 JSON.parse 反序列化\n// const phpResult = JSON.parse(phpResultString);\n// console.log(\"php 运行结果\", phpResult);\n} catch (e) {\n console.error(e);\n}\n\n",
486
217
  "name": "自定义脚本",
487
- "id": "29282dddf57937"
218
+ "id": "1438b80ff64007"
488
219
  }
489
220
  ],
490
221
  "post_tasks": [
491
222
  {
492
223
  "type": "customScript",
493
- "enabled": 1,
494
- "data": "apt.test(\"响应码为 200\", function () {\n apt.response.to.have.status(200);\n});\n\napt.environment.unset(\"key\");",
224
+ "enabled": -1,
225
+ "data": "",
495
226
  "name": "自定义脚本",
496
- "id": "292832d0357939"
227
+ "id": "143797e6f6448b"
228
+ },
229
+ {
230
+ "type": "assert",
231
+ "enabled": -1,
232
+ "data": {
233
+ "type": "responseTime",
234
+ "expression": {
235
+ "path": "",
236
+ "compareType": "lt",
237
+ "compareValue": "100"
238
+ }
239
+ },
240
+ "name": "响应时间小于100ms",
241
+ "id": "1437c692f6448e"
497
242
  }
498
243
  ],
499
244
  "header": {
500
- "parameter": []
245
+ "parameter": [
246
+ {
247
+ "param_id": "1d53335ff6e56e",
248
+ "description": "",
249
+ "field_type": "string",
250
+ "is_checked": 1,
251
+ "key": "phone",
252
+ "not_null": 1,
253
+ "value": "{{$mockjs.telephone()}}",
254
+ "schema": {
255
+ "type": "string"
256
+ }
257
+ }
258
+ ]
501
259
  },
502
260
  "query": {
503
261
  "query_add_equal": 1,
@@ -511,15 +269,10 @@ module.exports = {
511
269
  "parameter": []
512
270
  }
513
271
  },
514
- "parents": [
515
- {
516
- "target_id": "28cb255375729d",
517
- "target_type": "folder"
518
- }
519
- ],
272
+ "parents": [],
520
273
  "method": "POST",
521
- "protocol": "auto",
522
- "url": "http://cc.apipost.cc:6002/post",
274
+ "protocol": "http/1.1",
275
+ "url": "https://go.apipost.cn",
523
276
  "pre_url": ""
524
277
  }
525
278
  ],
@@ -527,12 +280,12 @@ module.exports = {
527
280
  },
528
281
  "test_events": [
529
282
  {
530
- "type": "sample",
283
+ "type": "api",
531
284
  "data": {
532
- "target_id": "469ef86c4401000",
533
- "project_id": "250e0b1ab5701e",
534
- "parent_id": "250e0b1af57024",
535
- "target_type": "sample"
285
+ "target_id": "1431af17f64057",
286
+ "project_id": "137212d936401f",
287
+ "parent_id": "0",
288
+ "target_type": "api"
536
289
  }
537
290
  }
538
291
  ]