apipost-cli 1.0.17 → 1.0.19
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/dist/apipost-reports/apipost-reports-2024-04-03_16-47-21.html +750 -0
- package/dist/apipost-reports/apipost-reports-2024-04-03_164706.html +750 -0
- package/dist/apipost-reports/{apipost-reports-2024-01-22 20:12:49.html → apipost-reports-2024-04-03_16:46:19.html} +1 -1
- package/dist/build/Release/cpufeatures.node +0 -0
- package/dist/index.js +119 -1
- package/dist/lib/protocol/crypto/build/Release/sshcrypto.node +0 -0
- package/package.json +1 -1
|
@@ -632,7 +632,7 @@
|
|
|
632
632
|
return '-';
|
|
633
633
|
};
|
|
634
634
|
|
|
635
|
-
const data = {"combined_id":"0","report_id":"","report_name":"测试查询角色详细信息测试报告","env_id":"32e2403f-586b-4f99-ac53-0190cedb1918","env_name":"BETA正式","env_pre_url":"http://permission.beta.xfusion.com/interface","env_pre_urls":{"default":"http://permission.beta.xfusion.com/interface"},"user":{"nick_name":"wuyang@xfusion.com","email":"wuyang@xfusion.com","portrait":"https://apipost.xfusion.com/static/user/default_profile_photo/Vector-4.png","openid":"107558763110348","uuid":"5X9DD4E46126","is_admin":1,"is_super_admin":-1,"is_manager":1,"role":2,"project_id":"3ad342a0-44fb-4582-ad00-024e50e1d2f9","id":"3ad342a0-44fb-4582-ad00-024e50e1d2f9/5X9DD4E46126"},"total_count":2,"total_effective_count":2,"ignore_count":0,"total_received_data":0.02,"total_response_time":0,"average_response_time":0,"http_errors":[{"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","parent_id":"0","event_id":"0beac0ae-2721-4cc1-bb39-6a11820f559a","iteration_id":"7e171513-bb0a-40bc-9c28-85d03ff67236","type":"api","target_id":"be109489-837e-47de-9119-7e297ed109b9","request":{"parent_id":"923dc0cf-e919-4bfe-bb9a-a5ef9304cf8d","target_id":"be109489-837e-47de-9119-7e297ed109b9","name":"beta灰度测试应用平铺权限","method":"POST","url":"http://permission.beta.xfusion.com/interface/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"http://permission.beta.xfusion.com/interface/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"json","parameter":[],"raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"is_checked":"1","type":"Text","key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":"1","description":"","field_type":"Text"},{"is_checked":"1","type":"Text","key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":"1","description":"","field_type":"Text"},{"key":"cookie","value":"permissionbeta_interface_sticky=pro_mcls#cluster1_10.25.26.67_31906:3","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[{"description":"","is_checked":"1","key":"appSys","type":"Text","not_null":"1","field_type":"Text","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[{"type":"pickVars","enabled":1,"data":{"source":"responseJson","variables":[{"name":"roleId","type":"tempVars","expression":"$.result[0].roleId"}]},"id":"cc92a54a-5dee-4d03-8294-cbbdeaf47feb"}]}},"response":{"status":"error","message":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","data":{"error":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","request":{"url":"undefined","timeout":0,"contentType":"none","header":[],"proxy":null,"request_bodys":{"mode":"raw","raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","options":{"raw":{"language":"json"}}},"body":{"mode":"raw","raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","options":{"raw":{"language":"json"}}}},"response":{"target_id":"be109489-837e-47de-9119-7e297ed109b9","responseTime":"0.00","responseSize":0.01,"resposneAt":"20:12:49","netWork":{"agent":null,"address":{"remote":{}}},"status":"OK","code":200,"timingPhases":{},"resHeaders":{},"headers":{},"header":[],"rawCookies":[],"resCookies":[],"cookies":{},"rawBody":"undefined","stream":{"type":"Buffer"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"raw":{"type":"json","responseText":"undefined"},"json":{},"filename":""}}},"http_error":1,"assert":[],"datetime":"2024-01-22 20:12:49","assert_error":-1},{"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","parent_id":"0","event_id":"285d622c-26b8-4c1c-92b2-ee82f470b832","iteration_id":"0862ad13-abd4-4e74-987d-7453000eee3a","type":"api","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","request":{"parent_id":"d36a4e00-9fa4-4515-9e99-5ff9e14e6789","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","name":"根据id查询角色信息","method":"POST","url":"http://permission.beta.xfusion.com/interface/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"http://permission.beta.xfusion.com/interface/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"json","parameter":[],"raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"description":"","field_type":"String","is_checked":1,"key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":1,"type":"Text"},{"description":"","field_type":"String","is_checked":1,"key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":1,"type":"Text"},{"key":"cookie","value":"permissionbeta_interface_sticky=pro_mcls#cluster1_10.25.26.67_31906:3","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[{"description":"","is_checked":1,"key":"appSys","type":"Text","not_null":1,"field_type":"String","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[]}},"response":{"status":"error","message":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","data":{"error":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","request":{"url":"undefined","timeout":0,"contentType":"none","header":[],"proxy":null,"request_bodys":{"mode":"raw","raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","options":{"raw":{"language":"json"}}},"body":{"mode":"raw","raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","options":{"raw":{"language":"json"}}}},"response":{"target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","responseTime":"0.00","responseSize":0.01,"resposneAt":"20:12:49","netWork":{"agent":null,"address":{"remote":{}}},"status":"OK","code":200,"timingPhases":{},"resHeaders":{},"headers":{},"header":[],"rawCookies":[],"resCookies":[],"cookies":{},"rawBody":"undefined","stream":{"type":"Buffer"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"raw":{"type":"json","responseText":"undefined"},"json":{},"filename":""}}},"http_error":1,"assert":[],"datetime":"2024-01-22 20:12:49","assert_error":-1}],"assert_errors":[],"ignore_errors":[],"http":{"passed":0,"passed_per":0,"failure":2,"failure_per":1},"assert":{"passed":0,"passed_per":0,"failure":0,"failure_per":0},"start_time":"2024-01-22 20:12:49","end_time":"2024-01-22 20:12:49","long_time":"0.04 秒","children":[],"type":"single","test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","event_status":{"0beac0ae-2721-4cc1-bb39-6a11820f559a":"failure","285d622c-26b8-4c1c-92b2-ee82f470b832":"failure"},"test_events":[{"event_id":"0beac0ae-2721-4cc1-bb39-6a11820f559a","parent_event_id":"0","data":{"parent_id":"923dc0cf-e919-4bfe-bb9a-a5ef9304cf8d","target_id":"be109489-837e-47de-9119-7e297ed109b9","name":"beta灰度测试应用平铺权限","method":"POST","url":"/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"json","parameter":[],"raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"is_checked":"1","type":"Text","key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":"1","description":"","field_type":"Text"},{"is_checked":"1","type":"Text","key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":"1","description":"","field_type":"Text"},{"is_checked":-1,"type":"Text","key":"X-HW-ID","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":"1","description":"","field_type":"Text"},{"is_checked":-1,"type":"Text","key":"X-HW-APPKEY","value":"crvv4XIlBNKnRx48OJNoRQ==","not_null":"1","description":"","field_type":"Text"}]},"query":{"parameter":[{"description":"","is_checked":"1","key":"appSys","type":"Text","not_null":"1","field_type":"Text","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[{"type":"pickVars","enabled":1,"data":{"source":"responseJson","variables":[{"name":"roleId","type":"tempVars","expression":"$.result[0].roleId"}]},"id":"cc92a54a-5dee-4d03-8294-cbbdeaf47feb"}]}},"enabled":1,"project_id":"3ad342a0-44fb-4582-ad00-024e50e1d2f9","sort":1,"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","type":"api","report_id":"","runtime_status":"failure"},{"event_id":"285d622c-26b8-4c1c-92b2-ee82f470b832","parent_event_id":"0","data":{"parent_id":"d36a4e00-9fa4-4515-9e99-5ff9e14e6789","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","name":"根据id查询角色信息","method":"POST","url":"/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"json","parameter":[],"raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"description":"","field_type":"String","is_checked":1,"key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":1,"type":"Text"},{"description":"","field_type":"String","is_checked":1,"key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":1,"type":"Text"},{"is_checked":-1,"type":"Text","key":"X-HW-ID","value":"","not_null":"1","description":"","field_type":"Text"},{"is_checked":-1,"type":"Text","key":"X-HW-APPKEY","value":"","not_null":"1","description":"","field_type":"Text"}]},"query":{"parameter":[{"description":"","is_checked":1,"key":"appSys","type":"Text","not_null":1,"field_type":"String","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[]}},"enabled":1,"project_id":"3ad342a0-44fb-4582-ad00-024e50e1d2f9","sort":2,"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","type":"api","report_id":"","runtime_status":"failure"}],"logList":[{"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","parent_id":"0","event_id":"0beac0ae-2721-4cc1-bb39-6a11820f559a","iteration_id":"7e171513-bb0a-40bc-9c28-85d03ff67236","type":"api","target_id":"be109489-837e-47de-9119-7e297ed109b9","request":{"parent_id":"923dc0cf-e919-4bfe-bb9a-a5ef9304cf8d","target_id":"be109489-837e-47de-9119-7e297ed109b9","name":"beta灰度测试应用平铺权限","method":"POST","url":"http://permission.beta.xfusion.com/interface/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"http://permission.beta.xfusion.com/interface/authenticationservice/valid/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"json","parameter":[],"raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"is_checked":"1","type":"Text","key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":"1","description":"","field_type":"Text"},{"is_checked":"1","type":"Text","key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":"1","description":"","field_type":"Text"},{"key":"cookie","value":"permissionbeta_interface_sticky=pro_mcls#cluster1_10.25.26.67_31906:3","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[{"description":"","is_checked":"1","key":"appSys","type":"Text","not_null":"1","field_type":"Text","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[{"type":"pickVars","enabled":1,"data":{"source":"responseJson","variables":[{"name":"roleId","type":"tempVars","expression":"$.result[0].roleId"}]},"id":"cc92a54a-5dee-4d03-8294-cbbdeaf47feb"}]}},"response":{"status":"error","message":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","data":{"error":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","request":{"url":"undefined","timeout":0,"contentType":"none","header":[],"proxy":null,"request_bodys":{"mode":"raw","raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","options":{"raw":{"language":"json"}}},"body":{"mode":"raw","raw":"{\r\n\t\"pageNum\": 5,\r\n\t\"pageSize\": 100,\r\n\t\"orderByAsc\": [\"roleId\"]\r\n\r\n}","options":{"raw":{"language":"json"}}}},"response":{"target_id":"be109489-837e-47de-9119-7e297ed109b9","responseTime":"0.00","responseSize":0.01,"resposneAt":"20:12:49","netWork":{"agent":null,"address":{"remote":{}}},"status":"OK","code":200,"timingPhases":{},"resHeaders":{},"headers":{},"header":[],"rawCookies":[],"resCookies":[],"cookies":{},"rawBody":"undefined","stream":{"type":"Buffer"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"raw":{"type":"json","responseText":"undefined"},"json":{},"filename":""}}},"http_error":1,"assert":[],"datetime":"2024-01-22 20:12:49","assert_error":-1},{"test_id":"e174fa15-cce1-46ab-8c4b-f68a8f3e4d62","parent_id":"0","event_id":"285d622c-26b8-4c1c-92b2-ee82f470b832","iteration_id":"0862ad13-abd4-4e74-987d-7453000eee3a","type":"api","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","request":{"parent_id":"d36a4e00-9fa4-4515-9e99-5ff9e14e6789","target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","name":"根据id查询角色信息","method":"POST","url":"http://permission.beta.xfusion.com/interface/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","request":{"url":"http://permission.beta.xfusion.com/interface/authenticationservice/role/query?appSys=d2ddb0d11d4046d89b9c0623836dbd1e","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"json","parameter":[],"raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","raw_para":[]},"event":{"pre_script":"","test":""},"header":{"parameter":[{"description":"","field_type":"String","is_checked":1,"key":"projectId","value":"b842cec0a5884e4d8b2e4d0af0ca7ec0","not_null":1,"type":"Text"},{"description":"","field_type":"String","is_checked":1,"key":"authorization","value":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJiODQyY2VjMGE1ODg0ZTRkOGIyZTRkMGFmMGNhN2VjMCIsImFjY291bnRfdHlwZSI6IklBTV9TRVJWSUNFIiwibmJmIjoxNzA0Njc5NTE4LCJhY2NvdW50X2lkIjoiODcyYzg5NDI4MzlkNGJkMjAxODNjOWU4Njc2YjAwYjMiLCJlbnRlcnByaXNlIjoiMTExMTExMTExMTExMTExMTY2NjY2NjY2NjY2NjY2NjYiLCJpc3MiOiJpYW0iLCJuYW1lIjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJwcm9qZWN0IjoiYjg0MmNlYzBhNTg4NGU0ZDhiMmU0ZDBhZjBjYTdlYzAiLCJleHAiOjE3MDQ4NTIzMTgsImlhdCI6MTcwNDc2NTkxOCwianRpIjoiN2E4MmY1NjktZTNiNS00YzUxLWI3MmEtNDQ1NzcwZTgzMDFhIn0.gC2xm9h1kD3ZX40QppHoNXpPa9hrffGuWLrGxw1vBJOi-0zdLCki0DbAjylMF_LmF6fv9hgxjgTv04iFVnJCdiiw95KaC__4iHiz0HJ-hYHFo8oe6_kCtaVxbctpDnKa7z3f69OlOIa-welBJOwJUTAuYuQlYNTPyy324bo6VbE","not_null":1,"type":"Text"},{"key":"cookie","value":"permissionbeta_interface_sticky=pro_mcls#cluster1_10.25.26.67_31906:3","description":"","not_null":1,"field_type":"String","type":"Text","is_checked":1}]},"query":{"parameter":[{"description":"","is_checked":1,"key":"appSys","type":"Text","not_null":1,"field_type":"String","value":"d2ddb0d11d4046d89b9c0623836dbd1e"}]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"pre_tasks":[],"post_tasks":[]}},"response":{"status":"error","message":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","data":{"error":"RequestError: getaddrinfo ENOTFOUND permission.beta.xfusion.com[ENOTFOUND]","request":{"url":"undefined","timeout":0,"contentType":"none","header":[],"proxy":null,"request_bodys":{"mode":"raw","raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","options":{"raw":{"language":"json"}}},"body":{"mode":"raw","raw":"{\n\t\"pageNum\": 1,\n\t\"pageSize\": 100,\n\t\"pageFilter\": [\n\t\t{\n\t\t\t\"column\": \".id\",\n\t\t\t\"value\": \"{{roleId}}\",\n\t\t\t\"filterType\": 1\n\t\t}\n\t]\n}","options":{"raw":{"language":"json"}}}},"response":{"target_id":"8e016d21-a27d-430c-bd2d-4e050ae443de","responseTime":"0.00","responseSize":0.01,"resposneAt":"20:12:49","netWork":{"agent":null,"address":{"remote":{}}},"status":"OK","code":200,"timingPhases":{},"resHeaders":{},"headers":{},"header":[],"rawCookies":[],"resCookies":[],"cookies":{},"rawBody":"undefined","stream":{"type":"Buffer"},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"raw":{"type":"json","responseText":"undefined"},"json":{},"filename":""}}},"http_error":1,"assert":[],"datetime":"2024-01-22 20:12:49","assert_error":-1}]};
|
|
635
|
+
const data = {"combined_id":"0","report_id":"","report_name":"新建测试用例测试报告","env_id":"6e734f0b-3d77-4e95-896a-f20f58fa1889","env_name":"dev","env_pre_url":"http://cc.apipost.cc:6002/proxy","env_pre_urls":{"default":"http://cc.apipost.cc:6002/proxy"},"user":{"role":2,"nick_name":"wenjin","email":null,"portrait":"https://img.cdn.apipost.cn/user/default_profile_photo/Vector-6.png","is_manager":1,"uuid":"UL4XWF681351","is_super_admin":1,"project_id":"e337b75f-93eb-4263-82ca-2b9832ffbd02","id":"e337b75f-93eb-4263-82ca-2b9832ffbd02/UL4XWF681351"},"total_count":1,"total_effective_count":1,"ignore_count":0,"total_received_data":0.07,"total_response_time":22,"average_response_time":22,"http_errors":[],"assert_errors":[],"ignore_errors":[],"http":{"passed":1,"passed_per":1,"failure":0,"failure_per":0},"assert":{"passed":0,"passed_per":0,"failure":0,"failure_per":0},"start_time":"2024-04-03 16:46:19","end_time":"2024-04-03 16:46:19","long_time":"0.04 秒","children":[],"type":"single","test_id":"85c4b152-85d3-4c00-895a-b361541d1349","event_status":{"406cc32a-691a-436a-8833-99af0b34e5fa":"passed"},"test_events":[{"event_id":"406cc32a-691a-436a-8833-99af0b34e5fa","parent_event_id":"0","data":{"parent_id":"f2af0203-f760-4fb6-b7e5-8f80c1b50e58","target_id":"bfa94803-79db-4442-916d-41c2dc5e9fab","name":"测试路径1","method":"POST","url":"/test","request":{"url":"/test","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"none","parameter":[],"raw":"","raw_para":[],"raw_schema":{"type":"object"},"binary":null},"event":{"pre_script":"","test":""},"header":{"parameter":[]},"query":{"parameter":[]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"protocol":"http/1.1"}},"enabled":1,"project_id":"e337b75f-93eb-4263-82ca-2b9832ffbd02","sort":1,"test_id":"85c4b152-85d3-4c00-895a-b361541d1349","type":"api","report_id":"","runtime_status":"passed"}],"logList":[{"test_id":"85c4b152-85d3-4c00-895a-b361541d1349","parent_id":"0","event_id":"406cc32a-691a-436a-8833-99af0b34e5fa","iteration_id":"637b9c87-6e62-45f9-b567-d33679cd0daf","type":"api","target_id":"bfa94803-79db-4442-916d-41c2dc5e9fab","request":{"parent_id":"f2af0203-f760-4fb6-b7e5-8f80c1b50e58","target_id":"bfa94803-79db-4442-916d-41c2dc5e9fab","name":"测试路径1","method":"POST","url":"http://cc.apipost.cc:6002/proxy/test","request":{"url":"http://cc.apipost.cc:6002/proxy/test","description":"","auth":{"type":"noauth","kv":{"key":"","value":""},"bearer":{"key":""},"basic":{"username":"","password":""},"digest":{"username":"","password":"","realm":"","nonce":"","algorithm":"","qop":"","nc":"","cnonce":"","opaque":""},"hawk":{"authId":"","authKey":"","algorithm":"","user":"","nonce":"","extraData":"","app":"","delegation":"","timestamp":"","includePayloadHash":-1},"awsv4":{"accessKey":"","secretKey":"","region":"","service":"","sessionToken":"","addAuthDataToQuery":-1},"ntlm":{"username":"","password":"","domain":"","workstation":"","disableRetryRequest":1},"edgegrid":{"accessToken":"","clientToken":"","clientSecret":"","nonce":"","timestamp":"","baseURi":"","headersToSign":""},"oauth1":{"consumerKey":"","consumerSecret":"","signatureMethod":"","addEmptyParamsToSign":-1,"includeBodyHash":-1,"addParamsToHeader":-1,"realm":"","version":"1.0","nonce":"","timestamp":"","verifier":"","callback":"","tokenSecret":"","token":""}},"body":{"mode":"none","parameter":[],"raw":"","raw_para":[],"raw_schema":{"type":"object"},"binary":null},"event":{"pre_script":"","test":""},"header":{"parameter":[]},"query":{"parameter":[]},"cookie":{"parameter":[]},"resful":{"parameter":[]},"protocol":"http/1.1"}},"response":{"status":"success","message":"success","data":{"error":null,"request":{"url":"http://cc.apipost.cc:6002/proxy/test","uri":"http://cc.apipost.cc:6002/proxy/test","method":"POST","timeout":0,"contentType":"none","header":[{"key":"accept-encoding","value":"gzip, deflate, br"},{"key":"User-Agent","value":"PostmanRuntime-ApipostRuntime/1.1.0"},{"key":"Cache-Control","value":"no-cache"}],"proxy":null,"httpVersion":"1.1","request_headers":{"accept-encoding":"gzip, deflate, br","User-Agent":"PostmanRuntime-ApipostRuntime/1.1.0","Cache-Control":"no-cache"},"request_bodys":{"mode":"none"},"body":{"mode":"none"}},"response":{"target_id":"bfa94803-79db-4442-916d-41c2dc5e9fab","responseTime":22,"responseSize":0.07,"resposneAt":"16:46:19","netWork":{"agent":null,"address":{"remote":{"address":"114.242.33.198"}}},"status":"OK","code":200,"timingPhases":{"wait":1,"dns":2,"tcp":12,"request":0,"firstByte":6,"download":1,"total":22},"headers":{"Content-Type":"application/json","Date":"Wed, 03 Apr 2024 08:46:19 GMT","Content-Length":"69","Connection":"close"},"resCookies":[],"stream":{"type":"Buffer","data":[120,156,171,86,242,77,45,201,200,79,81,178,82,10,240,15,14,81,210,81,10,72,44,201,0,242,244,11,138,242,43,42,245,75,82,139,75,64,130,249,197,37,46,137,37,137,64,9,32,175,176,52,181,168,50,32,177,40,49,183,88,201,170,186,182,22,0,247,129,22,135]},"fitForShow":"Monaco","resMime":{"ext":"json","mime":"application/json"},"filename":""}}},"http_error":-1,"assert":[],"datetime":"2024-04-03 16:46:19","assert_error":-1}]};
|
|
636
636
|
console.log(data, 'data')
|
|
637
637
|
|
|
638
638
|
document.title = data?.report_name || '';
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -777,7 +777,7 @@ const RENDER_TEST_REPORT_HTML_STR = (data = {}) => {
|
|
|
777
777
|
const downloadTestReport = async (data, options, request) => {
|
|
778
778
|
const homedir = os.homedir();
|
|
779
779
|
const now = dayjs();
|
|
780
|
-
const formattedTime = now.format('YYYY-MM-
|
|
780
|
+
const formattedTime = now.format('YYYY-MM-DD_HH-mm-ss');
|
|
781
781
|
|
|
782
782
|
//检查options.outDir 是否存在,是否是目录
|
|
783
783
|
if (!fs.existsSync(options.outDir)) {
|
|
@@ -801,6 +801,7 @@ const downloadTestReport = async (data, options, request) => {
|
|
|
801
801
|
let retries = 0;
|
|
802
802
|
|
|
803
803
|
for (let i = 0; i < 2; i++) {
|
|
804
|
+
console.log(finalFilePath);
|
|
804
805
|
try {
|
|
805
806
|
fs.writeFileSync(finalFilePath, reportContent);
|
|
806
807
|
break;
|
|
@@ -127305,6 +127306,121 @@ var setObjValByPath = function (obj, val, path) {
|
|
|
127305
127306
|
}, obj);
|
|
127306
127307
|
};
|
|
127307
127308
|
|
|
127309
|
+
/**
|
|
127310
|
+
* 雪花算法生成唯一ID
|
|
127311
|
+
*/
|
|
127312
|
+
/**
|
|
127313
|
+
* 生成 Snowflake ID
|
|
127314
|
+
* @param seed - 用于生成 Snowflake ID 的种子字符串,如果为空,自动生成。建议使用项目id
|
|
127315
|
+
* @param base - hash范围,2或16,2进制或16进制
|
|
127316
|
+
* @returns 以2进制或16进制表示的64位ID
|
|
127317
|
+
*/
|
|
127318
|
+
var snowflakeId = function (seed, base) {
|
|
127319
|
+
if (seed === void 0) { seed = ""; }
|
|
127320
|
+
if (base === void 0) { base = 16; }
|
|
127321
|
+
//base 支持2,16 需要验证
|
|
127322
|
+
base = (base === 2 || base === 16) ? base : 16;
|
|
127323
|
+
seed = seed || genSeed();
|
|
127324
|
+
if (typeof seed !== 'string') {
|
|
127325
|
+
seed = seed + ""; //强制转字符串
|
|
127326
|
+
}
|
|
127327
|
+
var sequence = next_id(); //一直自增id
|
|
127328
|
+
var timestamp = new Date().getTime() - 1671537188000; //和后端约定时间戳起始时间,2022-12-20
|
|
127329
|
+
if (sequence > 4095) {
|
|
127330
|
+
sequence = sequence % 4095; //12位序列号
|
|
127331
|
+
}
|
|
127332
|
+
// 64位ID的划分
|
|
127333
|
+
// 0 - 41位时间戳 - 12位序列号 - 10位机器标识 - 12位序号
|
|
127334
|
+
var binstring = '0' + leftpad(dec2bin(timestamp), 41) + "1" + simpleHash(seed) + leftpad(dec2bin(sequence), 12);
|
|
127335
|
+
if (base === 2) {
|
|
127336
|
+
return binstring;
|
|
127337
|
+
}
|
|
127338
|
+
else {
|
|
127339
|
+
var chunks = splitN(binstring, 4);
|
|
127340
|
+
var binHexMap_1 = { "0000": "0", "0001": "1", "0010": "2", "0011": "3", "0100": "4", "0101": "5", "0110": "6", "0111": "7", "1000": "8", "1001": "9", "1010": "a", "1011": "b", "1100": "c", "1101": "d", "1110": "e", "1111": "f" };
|
|
127341
|
+
//用map转换chunks
|
|
127342
|
+
var hexChunks = chunks.map(function (item) {
|
|
127343
|
+
return binHexMap_1[item];
|
|
127344
|
+
});
|
|
127345
|
+
//返回16进制
|
|
127346
|
+
return hexChunks.join("").replace(/^0+/, '');
|
|
127347
|
+
}
|
|
127348
|
+
//10进制转2进制
|
|
127349
|
+
function dec2bin(dec) {
|
|
127350
|
+
return (dec >>> 0).toString(2);
|
|
127351
|
+
}
|
|
127352
|
+
//左边补0
|
|
127353
|
+
function leftpad(str, len) {
|
|
127354
|
+
str = str + '';
|
|
127355
|
+
len = len - str.length;
|
|
127356
|
+
if (len <= 0) {
|
|
127357
|
+
return str;
|
|
127358
|
+
}
|
|
127359
|
+
return Array(len + 1).join('0') + str;
|
|
127360
|
+
}
|
|
127361
|
+
//右边补0
|
|
127362
|
+
function rightpad(str, len) {
|
|
127363
|
+
str = str + '';
|
|
127364
|
+
len = len - str.length;
|
|
127365
|
+
if (len <= 0) {
|
|
127366
|
+
return str;
|
|
127367
|
+
}
|
|
127368
|
+
return str + Array(len + 1).join('0');
|
|
127369
|
+
}
|
|
127370
|
+
//9位hash
|
|
127371
|
+
function simpleHash(str) {
|
|
127372
|
+
var hash = 0;
|
|
127373
|
+
for (var i = 0; i < str.length; i++) {
|
|
127374
|
+
hash = (hash << 5) - hash + str.charCodeAt(i);
|
|
127375
|
+
}
|
|
127376
|
+
var strhash = rightpad(dec2bin(hash), 9);
|
|
127377
|
+
if (strhash.length > 9) {
|
|
127378
|
+
strhash = strhash.substring(0, 9);
|
|
127379
|
+
}
|
|
127380
|
+
return strhash;
|
|
127381
|
+
}
|
|
127382
|
+
//gen seed
|
|
127383
|
+
function genSeed() {
|
|
127384
|
+
var seed = "";
|
|
127385
|
+
try {
|
|
127386
|
+
//默认使用进程id
|
|
127387
|
+
//@ts-ignore
|
|
127388
|
+
if (typeof process === 'object' && process + '' === '[object process]') {
|
|
127389
|
+
//@ts-ignore
|
|
127390
|
+
seed = process.pid + "";
|
|
127391
|
+
}
|
|
127392
|
+
else if (typeof window === 'object' && window.navigator && window.navigator.userAgent) {
|
|
127393
|
+
seed = window.navigator.userAgent + window.navigator.language + window.screen.colorDepth + window.screen.width + window.screen.height;
|
|
127394
|
+
}
|
|
127395
|
+
}
|
|
127396
|
+
catch (e) { }
|
|
127397
|
+
//如果为空,生成32位随机字符串
|
|
127398
|
+
if (!seed) {
|
|
127399
|
+
var str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
127400
|
+
for (var i = 0; i < 32; i++) {
|
|
127401
|
+
seed += str.charAt(Math.floor(Math.random() * str.length));
|
|
127402
|
+
}
|
|
127403
|
+
}
|
|
127404
|
+
return seed;
|
|
127405
|
+
}
|
|
127406
|
+
//切分字符串
|
|
127407
|
+
function splitN(inputString, chunkSize) {
|
|
127408
|
+
var chunks = [];
|
|
127409
|
+
for (var i = 0; i < inputString.length; i += chunkSize) {
|
|
127410
|
+
chunks.push(inputString.substring(i, i + chunkSize));
|
|
127411
|
+
}
|
|
127412
|
+
return chunks;
|
|
127413
|
+
}
|
|
127414
|
+
};
|
|
127415
|
+
var generateIncrementalFunction = function () {
|
|
127416
|
+
var counter = 0;
|
|
127417
|
+
return function () {
|
|
127418
|
+
return counter++;
|
|
127419
|
+
};
|
|
127420
|
+
};
|
|
127421
|
+
//生成唯一id
|
|
127422
|
+
var next_id = generateIncrementalFunction();
|
|
127423
|
+
|
|
127308
127424
|
var index = {
|
|
127309
127425
|
isJson: isJson,
|
|
127310
127426
|
isJsonp: isJsonp,
|
|
@@ -127326,6 +127442,7 @@ var index = {
|
|
|
127326
127442
|
completionHttpProtocol: completionHttpProtocol,
|
|
127327
127443
|
NewURL: NewURL,
|
|
127328
127444
|
setObjValByPath: setObjValByPath,
|
|
127445
|
+
snowflakeId: snowflakeId,
|
|
127329
127446
|
};
|
|
127330
127447
|
|
|
127331
127448
|
exports.NewURL = NewURL;
|
|
@@ -127348,6 +127465,7 @@ exports.isXml = isXml;
|
|
|
127348
127465
|
exports.jsonp2Obj = jsonp2Obj;
|
|
127349
127466
|
exports.ms2second = ms2second;
|
|
127350
127467
|
exports.setObjValByPath = setObjValByPath;
|
|
127468
|
+
exports.snowflakeId = snowflakeId;
|
|
127351
127469
|
exports.successResult = successResult;
|
|
127352
127470
|
|
|
127353
127471
|
|
|
Binary file
|