@tencent-rtc/mcp 1.2.6 → 1.2.7

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 (352) hide show
  1. package/package.json +1 -1
  2. package/resource/doc/chatuikit/faq/common/server_error_code.md +74 -0
  3. package/resource/doc/chatuikit/faq/web_sdk/error_code.md +47 -0
  4. package/resource/doc/chatuikit/faq/web_sdk/faq.md +105 -0
  5. package/resource/doc/chatuikit/flutter/faq.md +120 -0
  6. package/resource/doc/chatuikit/iOS/faq.md +120 -0
  7. package/resource/doc/chatuikit/react/faq.md +26 -0
  8. package/resource/doc/chatuikit/vue/faq.md +36 -0
  9. package/resource/doc/livekit/faq/common/error_code.md +88 -0
  10. package/resource/doc/livekit/vue/faq.md +0 -0
  11. package/resource/doc/roomkit/faq/common/error_code.md +67 -0
  12. package/resource/doc/roomkit/vue/faq.md +0 -0
  13. package/resource/doc/rtcengine/faq/common/error_code.md +0 -0
  14. package/resource/doc/rtcengine/faq/web_sdk/.gitkeep +0 -0
  15. package/resource/doc/tuicallkit/faq/common/error_code.md +47 -0
  16. package/resource/doc/tuicallkit/flutter/faq.md +127 -0
  17. package/resource/doc/tuicallkit/iOS/faq.md +127 -0
  18. package/resource/doc/tuicallkit/react/faq.md +36 -0
  19. package/resource/doc/tuicallkit/vue/faq.md +36 -0
  20. package/tools/call/get-native-call-integration.js +4 -10
  21. package/tools/call/get-native-call-integration.js.map +1 -1
  22. package/tools/call/get-web-call-api.js +4 -7
  23. package/tools/call/get-web-call-api.js.map +1 -1
  24. package/tools/call/get-web-call-integration.js +4 -9
  25. package/tools/call/get-web-call-integration.js.map +1 -1
  26. package/tools/chat/get-native-chat-integration.js +4 -9
  27. package/tools/chat/get-native-chat-integration.js.map +1 -1
  28. package/tools/chat/get-web-chat-component-detail.js +5 -10
  29. package/tools/chat/get-web-chat-component-detail.js.map +1 -1
  30. package/tools/chat/get-web-chat-integration.js +4 -12
  31. package/tools/chat/get-web-chat-integration.js.map +1 -1
  32. package/tools/chat/get-web-chat-uikit-init.js +5 -6
  33. package/tools/chat/get-web-chat-uikit-init.js.map +1 -1
  34. package/tools/chat/get-web-chat-window-integration.js +4 -12
  35. package/tools/chat/get-web-chat-window-integration.js.map +1 -1
  36. package/tools/chat/{create-group.js → get-web-create-group-doc.js} +5 -6
  37. package/tools/chat/get-web-create-group-doc.js.map +1 -0
  38. package/tools/common/get-faq.js +93 -0
  39. package/tools/common/get-faq.js.map +1 -0
  40. package/tools/common/get-usersig.js +9 -18
  41. package/tools/common/get-usersig.js.map +1 -1
  42. package/tools/common/present-framework-choice.js +3 -10
  43. package/tools/common/present-framework-choice.js.map +1 -1
  44. package/tools/common/record-prompt.js +5 -11
  45. package/tools/common/record-prompt.js.map +1 -1
  46. package/tools/common/record-result.js +8 -12
  47. package/tools/common/record-result.js.map +1 -1
  48. package/tools/definitions/get_faq_def.js +28 -0
  49. package/tools/definitions/get_faq_def.js.map +1 -0
  50. package/tools/definitions/get_native_call_uikit_integration_def.js +21 -0
  51. package/tools/definitions/get_native_call_uikit_integration_def.js.map +1 -0
  52. package/tools/definitions/get_native_chat_uikit_integration_def.js +21 -0
  53. package/tools/definitions/get_native_chat_uikit_integration_def.js.map +1 -0
  54. package/tools/definitions/get_usersig_def.js +32 -0
  55. package/tools/definitions/get_usersig_def.js.map +1 -0
  56. package/tools/definitions/get_web_call_uikit_api_def.js +23 -0
  57. package/tools/definitions/get_web_call_uikit_api_def.js.map +1 -0
  58. package/tools/definitions/get_web_call_uikit_integration_def.js +20 -0
  59. package/tools/definitions/get_web_call_uikit_integration_def.js.map +1 -0
  60. package/tools/definitions/get_web_chat_uikit_component_detail_def.js +24 -0
  61. package/tools/definitions/get_web_chat_uikit_component_detail_def.js.map +1 -0
  62. package/tools/definitions/get_web_chat_uikit_init_def.js +23 -0
  63. package/tools/definitions/get_web_chat_uikit_init_def.js.map +1 -0
  64. package/tools/definitions/get_web_chat_uikit_integration_def.js +26 -0
  65. package/tools/definitions/get_web_chat_uikit_integration_def.js.map +1 -0
  66. package/tools/definitions/get_web_chat_window_integration_def.js +26 -0
  67. package/tools/definitions/get_web_chat_window_integration_def.js.map +1 -0
  68. package/tools/definitions/get_web_create_group_doc_def.js +18 -0
  69. package/tools/definitions/get_web_create_group_doc_def.js.map +1 -0
  70. package/tools/definitions/get_web_live_state_detail_def.js +19 -0
  71. package/tools/definitions/get_web_live_state_detail_def.js.map +1 -0
  72. package/tools/definitions/get_web_live_uikit_component_detail_def.js +22 -0
  73. package/tools/definitions/get_web_live_uikit_component_detail_def.js.map +1 -0
  74. package/tools/definitions/get_web_room_state_detail_def.js +19 -0
  75. package/tools/definitions/get_web_room_state_detail_def.js.map +1 -0
  76. package/tools/definitions/present_framework_choice_def.js +23 -0
  77. package/tools/definitions/present_framework_choice_def.js.map +1 -0
  78. package/tools/definitions/record_prompt_def.js +22 -0
  79. package/tools/definitions/record_prompt_def.js.map +1 -0
  80. package/tools/definitions/record_result_def.js +22 -0
  81. package/tools/definitions/record_result_def.js.map +1 -0
  82. package/tools/index.js +7 -7
  83. package/tools/index.js.map +1 -1
  84. package/tools/live/get-web-live-component-detail.js +5 -7
  85. package/tools/live/get-web-live-component-detail.js.map +1 -1
  86. package/tools/live/get-web-live-state-detail.js +5 -7
  87. package/tools/live/get-web-live-state-detail.js.map +1 -1
  88. package/tools/room/get-web-room-state-detail.js +5 -7
  89. package/tools/room/get-web-room-state-detail.js.map +1 -1
  90. package/utils/report-cls-client.js +1 -1
  91. package/utils/report-es-client.js +1 -1
  92. package/libs/@tencent/aegis-node-sdk/CHANGELOG.md +0 -8
  93. package/libs/@tencent/aegis-node-sdk/LICENSE +0 -21
  94. package/libs/@tencent/aegis-node-sdk/README.md +0 -562
  95. package/libs/@tencent/aegis-node-sdk/lib/aegis.min.js +0 -1
  96. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/config.d.ts +0 -14
  97. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/global.d.ts +0 -1
  98. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/index.d.ts +0 -9
  99. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/report-ignore.d.ts +0 -2
  100. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/core.d.ts +0 -85
  101. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/afterRequestHooks.d.ts +0 -3
  102. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/beforeRequestHooks.d.ts +0 -9
  103. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/modifyRequestHooks.d.ts +0 -3
  104. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/index.d.ts +0 -9
  105. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/config.d.ts +0 -62
  106. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/env.d.ts +0 -11
  107. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/index.d.ts +0 -4
  108. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/log.d.ts +0 -130
  109. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/send.d.ts +0 -34
  110. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/format.d.ts +0 -2
  111. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/index.d.ts +0 -18
  112. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/length-limit.d.ts +0 -8
  113. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/pv.d.ts +0 -8
  114. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/remove-payload.d.ts +0 -2
  115. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/repeat-limit.d.ts +0 -4
  116. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/report.d.ts +0 -10
  117. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/sample.d.ts +0 -3
  118. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/throttle.d.ts +0 -3
  119. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/index.d.ts +0 -34
  120. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/jwt.d.ts +0 -12
  121. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/ot-js.d.ts +0 -14
  122. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/uuid.d.ts +0 -2
  123. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/whitelist.d.ts +0 -12
  124. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/write-before.d.ts +0 -3
  125. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/plugin.d.ts +0 -33
  126. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/destroy.d.ts +0 -2
  127. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/event-emitter.d.ts +0 -18
  128. package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/index.d.ts +0 -60
  129. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/index.d.ts +0 -15
  130. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/interface/selector.d.ts +0 -5
  131. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/pipes/batch-report-pipe.d.ts +0 -6
  132. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_base.d.ts +0 -18
  133. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_http.d.ts +0 -12
  134. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/ip_selector.d.ts +0 -10
  135. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/polaris_selector.d.ts +0 -20
  136. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/selector_base.d.ts +0 -27
  137. package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/util/eval_require.d.ts +0 -2
  138. package/libs/@tencent/aegis-node-sdk/package.json +0 -19
  139. package/libs/@tencent/polaris/README.md +0 -407
  140. package/libs/@tencent/polaris/dist/consumer/health.d.ts +0 -126
  141. package/libs/@tencent/polaris/dist/consumer/health.js +0 -283
  142. package/libs/@tencent/polaris/dist/consumer/health.js.map +0 -1
  143. package/libs/@tencent/polaris/dist/consumer/index.d.ts +0 -120
  144. package/libs/@tencent/polaris/dist/consumer/index.js +0 -348
  145. package/libs/@tencent/polaris/dist/consumer/index.js.map +0 -1
  146. package/libs/@tencent/polaris/dist/consumer/monitor.d.ts +0 -145
  147. package/libs/@tencent/polaris/dist/consumer/monitor.js +0 -343
  148. package/libs/@tencent/polaris/dist/consumer/monitor.js.map +0 -1
  149. package/libs/@tencent/polaris/dist/consumer/selector.d.ts +0 -73
  150. package/libs/@tencent/polaris/dist/consumer/selector.js +0 -316
  151. package/libs/@tencent/polaris/dist/consumer/selector.js.map +0 -1
  152. package/libs/@tencent/polaris/dist/errors.d.ts +0 -373
  153. package/libs/@tencent/polaris/dist/errors.js +0 -154
  154. package/libs/@tencent/polaris/dist/errors.js.map +0 -1
  155. package/libs/@tencent/polaris/dist/global.d.ts +0 -16
  156. package/libs/@tencent/polaris/dist/global.js +0 -18
  157. package/libs/@tencent/polaris/dist/global.js.map +0 -1
  158. package/libs/@tencent/polaris/dist/index.d.ts +0 -62
  159. package/libs/@tencent/polaris/dist/index.js +0 -145
  160. package/libs/@tencent/polaris/dist/index.js.map +0 -1
  161. package/libs/@tencent/polaris/dist/instance.d.ts +0 -109
  162. package/libs/@tencent/polaris/dist/instance.js +0 -38
  163. package/libs/@tencent/polaris/dist/instance.js.map +0 -1
  164. package/libs/@tencent/polaris/dist/limiter/bucket.d.ts +0 -51
  165. package/libs/@tencent/polaris/dist/limiter/bucket.js +0 -152
  166. package/libs/@tencent/polaris/dist/limiter/bucket.js.map +0 -1
  167. package/libs/@tencent/polaris/dist/limiter/index.d.ts +0 -73
  168. package/libs/@tencent/polaris/dist/limiter/index.js +0 -149
  169. package/libs/@tencent/polaris/dist/limiter/index.js.map +0 -1
  170. package/libs/@tencent/polaris/dist/limiter/ratelimit.d.ts +0 -27
  171. package/libs/@tencent/polaris/dist/limiter/ratelimit.js +0 -134
  172. package/libs/@tencent/polaris/dist/limiter/ratelimit.js.map +0 -1
  173. package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.d.ts +0 -17
  174. package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.js +0 -15
  175. package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.js.map +0 -1
  176. package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.d.ts +0 -59
  177. package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.js +0 -397
  178. package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.js.map +0 -1
  179. package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.d.ts +0 -3
  180. package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.js +0 -19
  181. package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.js.map +0 -1
  182. package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.d.ts +0 -17
  183. package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.js +0 -52
  184. package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.js.map +0 -1
  185. package/libs/@tencent/polaris/dist/location.d.ts +0 -48
  186. package/libs/@tencent/polaris/dist/location.js +0 -67
  187. package/libs/@tencent/polaris/dist/location.js.map +0 -1
  188. package/libs/@tencent/polaris/dist/logging.d.ts +0 -106
  189. package/libs/@tencent/polaris/dist/logging.js +0 -130
  190. package/libs/@tencent/polaris/dist/logging.js.map +0 -1
  191. package/libs/@tencent/polaris/dist/metadata.d.ts +0 -78
  192. package/libs/@tencent/polaris/dist/metadata.js +0 -119
  193. package/libs/@tencent/polaris/dist/metadata.js.map +0 -1
  194. package/libs/@tencent/polaris/dist/plugins/breaker/polaris.d.ts +0 -47
  195. package/libs/@tencent/polaris/dist/plugins/breaker/polaris.js +0 -162
  196. package/libs/@tencent/polaris/dist/plugins/breaker/polaris.js.map +0 -1
  197. package/libs/@tencent/polaris/dist/plugins/lb/base.d.ts +0 -24
  198. package/libs/@tencent/polaris/dist/plugins/lb/base.js +0 -32
  199. package/libs/@tencent/polaris/dist/plugins/lb/base.js.map +0 -1
  200. package/libs/@tencent/polaris/dist/plugins/lb/edf.d.ts +0 -24
  201. package/libs/@tencent/polaris/dist/plugins/lb/edf.js +0 -77
  202. package/libs/@tencent/polaris/dist/plugins/lb/edf.js.map +0 -1
  203. package/libs/@tencent/polaris/dist/plugins/lb/hashring.d.ts +0 -24
  204. package/libs/@tencent/polaris/dist/plugins/lb/hashring.js +0 -53
  205. package/libs/@tencent/polaris/dist/plugins/lb/hashring.js.map +0 -1
  206. package/libs/@tencent/polaris/dist/plugins/lb/sticky.d.ts +0 -31
  207. package/libs/@tencent/polaris/dist/plugins/lb/sticky.js +0 -88
  208. package/libs/@tencent/polaris/dist/plugins/lb/sticky.js.map +0 -1
  209. package/libs/@tencent/polaris/dist/plugins/lb/swrr.d.ts +0 -25
  210. package/libs/@tencent/polaris/dist/plugins/lb/swrr.js +0 -72
  211. package/libs/@tencent/polaris/dist/plugins/lb/swrr.js.map +0 -1
  212. package/libs/@tencent/polaris/dist/plugins/lb/wr.d.ts +0 -17
  213. package/libs/@tencent/polaris/dist/plugins/lb/wr.js +0 -50
  214. package/libs/@tencent/polaris/dist/plugins/lb/wr.js.map +0 -1
  215. package/libs/@tencent/polaris/dist/plugins/lb/wrr.d.ts +0 -19
  216. package/libs/@tencent/polaris/dist/plugins/lb/wrr.js +0 -81
  217. package/libs/@tencent/polaris/dist/plugins/lb/wrr.js.map +0 -1
  218. package/libs/@tencent/polaris/dist/plugins/logging/console.d.ts +0 -10
  219. package/libs/@tencent/polaris/dist/plugins/logging/console.js +0 -38
  220. package/libs/@tencent/polaris/dist/plugins/logging/console.js.map +0 -1
  221. package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.d.ts +0 -32
  222. package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.js +0 -88
  223. package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.js.map +0 -1
  224. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.d.ts +0 -124
  225. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js +0 -398
  226. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js.map +0 -1
  227. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.d.ts +0 -27
  228. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js +0 -287
  229. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js.map +0 -1
  230. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.d.ts +0 -15
  231. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js +0 -43
  232. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js.map +0 -1
  233. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.d.ts +0 -28
  234. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js +0 -249
  235. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js.map +0 -1
  236. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.d.ts +0 -19
  237. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js +0 -222
  238. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js.map +0 -1
  239. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.d.ts +0 -26
  240. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js +0 -99
  241. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js.map +0 -1
  242. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.d.ts +0 -60
  243. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js +0 -259
  244. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js.map +0 -1
  245. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/discover.proto +0 -24
  246. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/monitor.proto +0 -18
  247. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/ratelimit.proto +0 -12
  248. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.d.ts +0 -39
  249. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js +0 -115
  250. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js.map +0 -1
  251. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/api.proto +0 -24
  252. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/client.proto +0 -22
  253. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/model.proto +0 -28
  254. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/ratelimit.proto +0 -80
  255. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/request.proto +0 -18
  256. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/response.proto +0 -65
  257. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/routing.proto +0 -66
  258. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/service.proto +0 -95
  259. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/types.d.ts +0 -1568
  260. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.d.ts +0 -36
  261. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.js +0 -51
  262. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.js.map +0 -1
  263. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/api.proto +0 -18
  264. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/circuitbreak.proto +0 -67
  265. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/request.proto +0 -82
  266. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/response.proto +0 -11
  267. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkcache.proto +0 -46
  268. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkconfiguration.proto +0 -16
  269. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdktoken.proto +0 -10
  270. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/types.d.ts +0 -1102
  271. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.d.ts +0 -29
  272. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js +0 -77
  273. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js.map +0 -1
  274. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/api.proto +0 -12
  275. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/ratelimit.proto +0 -28
  276. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/types.d.ts +0 -395
  277. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.d.ts +0 -13
  278. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js +0 -116
  279. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js.map +0 -1
  280. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.d.ts +0 -67
  281. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.js +0 -67
  282. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.js.map +0 -1
  283. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.d.ts +0 -99
  284. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js +0 -217
  285. package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js.map +0 -1
  286. package/libs/@tencent/polaris/dist/plugins/registry/memory.d.ts +0 -10
  287. package/libs/@tencent/polaris/dist/plugins/registry/memory.js +0 -50
  288. package/libs/@tencent/polaris/dist/plugins/registry/memory.js.map +0 -1
  289. package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.d.ts +0 -51
  290. package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.js +0 -145
  291. package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.js.map +0 -1
  292. package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.d.ts +0 -11
  293. package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.js +0 -174
  294. package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.js.map +0 -1
  295. package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.d.ts +0 -25
  296. package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.js +0 -36
  297. package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.js.map +0 -1
  298. package/libs/@tencent/polaris/dist/plugins/router/trpc/env.d.ts +0 -10
  299. package/libs/@tencent/polaris/dist/plugins/router/trpc/env.js +0 -34
  300. package/libs/@tencent/polaris/dist/plugins/router/trpc/env.js.map +0 -1
  301. package/libs/@tencent/polaris/dist/plugins/router/trpc/set.d.ts +0 -56
  302. package/libs/@tencent/polaris/dist/plugins/router/trpc/set.js +0 -106
  303. package/libs/@tencent/polaris/dist/plugins/router/trpc/set.js.map +0 -1
  304. package/libs/@tencent/polaris/dist/plugins/shaping/unirate.d.ts +0 -31
  305. package/libs/@tencent/polaris/dist/plugins/shaping/unirate.js +0 -124
  306. package/libs/@tencent/polaris/dist/plugins/shaping/unirate.js.map +0 -1
  307. package/libs/@tencent/polaris/dist/plugins/shaping/warmup.d.ts +0 -61
  308. package/libs/@tencent/polaris/dist/plugins/shaping/warmup.js +0 -171
  309. package/libs/@tencent/polaris/dist/plugins/shaping/warmup.js.map +0 -1
  310. package/libs/@tencent/polaris/dist/plugins/weight/polaris.d.ts +0 -23
  311. package/libs/@tencent/polaris/dist/plugins/weight/polaris.js +0 -159
  312. package/libs/@tencent/polaris/dist/plugins/weight/polaris.js.map +0 -1
  313. package/libs/@tencent/polaris/dist/plugins.d.ts +0 -619
  314. package/libs/@tencent/polaris/dist/plugins.js +0 -91
  315. package/libs/@tencent/polaris/dist/plugins.js.map +0 -1
  316. package/libs/@tencent/polaris/dist/polaris.d.ts +0 -33
  317. package/libs/@tencent/polaris/dist/polaris.js +0 -59
  318. package/libs/@tencent/polaris/dist/polaris.js.map +0 -1
  319. package/libs/@tencent/polaris/dist/provider/index.d.ts +0 -102
  320. package/libs/@tencent/polaris/dist/provider/index.js +0 -168
  321. package/libs/@tencent/polaris/dist/provider/index.js.map +0 -1
  322. package/libs/@tencent/polaris/dist/registry.d.ts +0 -174
  323. package/libs/@tencent/polaris/dist/registry.js +0 -660
  324. package/libs/@tencent/polaris/dist/registry.js.map +0 -1
  325. package/libs/@tencent/polaris/dist/rules.d.ts +0 -163
  326. package/libs/@tencent/polaris/dist/rules.js +0 -24
  327. package/libs/@tencent/polaris/dist/rules.js.map +0 -1
  328. package/libs/@tencent/polaris/dist/scripts/postinstall.d.ts +0 -1
  329. package/libs/@tencent/polaris/dist/scripts/postinstall.js +0 -71
  330. package/libs/@tencent/polaris/dist/scripts/postinstall.js.map +0 -1
  331. package/libs/@tencent/polaris/dist/service.d.ts +0 -18
  332. package/libs/@tencent/polaris/dist/service.js +0 -3
  333. package/libs/@tencent/polaris/dist/service.js.map +0 -1
  334. package/libs/@tencent/polaris/dist/skeleton.d.ts +0 -87
  335. package/libs/@tencent/polaris/dist/skeleton.js +0 -282
  336. package/libs/@tencent/polaris/dist/skeleton.js.map +0 -1
  337. package/libs/@tencent/polaris/dist/utils.d.ts +0 -36
  338. package/libs/@tencent/polaris/dist/utils.js +0 -74
  339. package/libs/@tencent/polaris/dist/utils.js.map +0 -1
  340. package/libs/@tencent/polaris/dist/weak.d.ts +0 -11
  341. package/libs/@tencent/polaris/dist/weak.js +0 -44
  342. package/libs/@tencent/polaris/dist/weak.js.map +0 -1
  343. package/libs/@tencent/polaris/package.json +0 -114
  344. package/resource/doc/chatuikit/faq/generate_UserSig.md +0 -306
  345. package/tools/call/get-call-faq.js +0 -29
  346. package/tools/call/get-call-faq.js.map +0 -1
  347. package/tools/chat/create-group.js.map +0 -1
  348. package/tools/chat/get-chat-faq.js +0 -29
  349. package/tools/chat/get-chat-faq.js.map +0 -1
  350. /package/resource/doc/chatuikit/{faq/faq_sdk.md → android/faq.md} +0 -0
  351. /package/{libs/@tencent/aegis-node-sdk/lib/packages/core/src/polyfill.d.ts → resource/doc/chatuikit/faq/native_sdk/faq.md} +0 -0
  352. /package/resource/doc/tuicallkit/{faq → android}/faq.md +0 -0
@@ -1,562 +0,0 @@
1
- # Node SDK
2
-
3
- TAM 整体架构 for 前端监控设计,node-sdk 只做简单的上报,服务端数据上报建议使用
4
- [伽利略](https://j.woa.com)
5
- [CLS](https://console.cloud.tencent.com/cls)
6
- [智研日志汇](https://zhiyan.woa.com/)
7
-
8
- ## 安装
9
- ### NPM
10
- 在项目支持 NPM 时推荐使用 NPM 安装 Aegis SDK。
11
- ```bash
12
- $ tnpm install --save @tencent/aegis-node-sdk
13
- ```
14
- ::: warning 注意 ⚠️
15
- - 从 1.25.1 版本开始,SDK内部服务发现已经去掉了对L5的支持,默认使用北极星作为服务发现
16
- - 如果用户使用electron进行的是客户端的数据上报或者本地开发的话,建议使用host模式,具体使用方式见[配置文档](#配置文档)里的`selector.type`配置项
17
- - 如果用户是在devcloud机器上调用aegis接口上报的,建议先执行
18
- ```bash
19
- unset http_proxy
20
- unset https_proxy
21
- ```
22
- :::
23
-
24
- ## 使用
25
-
26
- ### 初始化
27
- 使用非常简单,只需要新建一个 Aegis 实例,传入相应的配置即可:
28
-
29
- ```javascript
30
- import Aegis from '@tencent/aegis-node-sdk';
31
-
32
- const aegis = new Aegis({
33
- id: 'pGUVFTCZyewxxxxx', // 项目上报ID
34
- uin: 'xxx', // 用户唯一 ID(可选)
35
- })
36
- ```
37
-
38
- ## 日志
39
-
40
- Aegis SDK 会主动收集用户的一些性能和错误日志,开发者可以根据不同的参数来配置哪些日志需要上报,以及上报的日志具体信息。
41
-
42
- ### 日志类型
43
-
44
- 全部日志类型如下:
45
-
46
- ```javascript
47
- { logType: 'custom', name: '自定义测速' }
48
- { logType: 'event', name: '自定义事件' }
49
- { logType: 'log', name: '日志' }
50
- { logType: 'performance', name: '页面测速' }
51
- { logType: 'pv', name: '页面PV' }
52
- { logType: 'speed', name: '接口和静态资源测速' }
53
- { logType: 'vitals', name: 'web vitals' }
54
- ```
55
-
56
-
57
- ### 日志等级
58
-
59
- 全部日志等级如下:
60
-
61
- ```javascript
62
- { level: 1, name: '白名单日志' },
63
- { level: 2, name: '一般日志' },
64
- { level: 4, name: '错误日志' },
65
- { level: 8, name: 'Promise 错误' },
66
- { level: 16, name: 'Ajax 请求异常' },
67
- { level: 32, name: 'JS 加载异常' },
68
- { level: 64, name: '图片加载异常' },
69
- { level: 128, name: 'css 加载异常' },
70
- { level: 256, name: 'console.error' },
71
- { level: 512, name: '音视频资源异常' }
72
- { level: 1024, name: 'retcode 异常' }
73
- { level: 2048, name: 'aegis report' }
74
- { level: 4096, name: 'PV' }
75
- { level: 8192, name: '自定义事件' }
76
- { level: 16384, name: '小程序 页面不存在' }
77
- { level: 32768, name: 'websocket错误' }
78
- { level: 65536, name: 'js bridge错误' }
79
- ```
80
-
81
-
82
- ### 日志上报
83
-
84
- 创建完 Aegis 实例之后,就可以开心的上报日志啦 🥰,日志上报同样简单
85
-
86
- ```javascript
87
- // info 可以上报任意字符串,数字,数组,对象,但是只有打开页面的用户在名单中才会上报
88
- aegis.info('test');
89
- aegis.info('test', 123, ['a', 'b', 'c', 1], {a: '123'});
90
-
91
-
92
- // 也可以上报特定的对象,支持用户传ext参数和trace参数
93
- // 注意这种 case 一定要传 msg 字段
94
- aegis.info({
95
- msg: 'test',
96
- ext1: 'ext1',
97
- ext2: 'ext2',
98
- ext3: 'ext3',
99
- trace: 'trace',
100
- });
101
-
102
- // 不同于 info,infoAll 表示全量上报
103
- aegis.infoAll({
104
- msg: 'test',
105
- ext1: 'ext1',
106
- ext2: 'ext2',
107
- ext3: 'ext3',
108
- trace: 'trace',
109
- });
110
-
111
-
112
- // error 用来表示 JS 错误日志,也是全量上报,一般用于开发者主动获取JS异常,然后进行上报
113
- aegis.error({
114
- msg: 'test',
115
- ext1: 'ext1',
116
- ext2: 'ext2',
117
- ext3: 'ext3',
118
- trace: 'trace',
119
- });
120
- aegis.error(new Error('主动上报一个错误'));
121
-
122
- // report 默认是 aegis.report 的日志类型,但是现在你可以传入任何日志类型了
123
- aegis.report({
124
- msg: '这是一个ajax错误日志',
125
- level: Aegis.logType.AJAX_ERROR,
126
- ext1: 'ext1',
127
- ext2: 'ext2',
128
- ext3: 'ext3',
129
- trace: 'trace',
130
- });
131
- ```
132
-
133
- ## 实例方法
134
- Aegis 实例暴露接口简单实用,目前 Aegis 实例有以下方法供您使用:
135
- `setConfig` 、 `info` 、 `infoAll` 、 `report` 、 `error` 、 `reportEvent` 、 `reportTime` 、 `time` 、 `timeEnd`、`destroy`
136
-
137
- ### setConfig
138
- 该方法用来修改实例配置,比如下面场景:
139
- 在实例化 Aegis 时需要传入配置对象
140
- ```javascript
141
- const aegis = new Aegis({
142
- id: 'pGUVFTCZyewxxxxx',
143
- uin: '777'
144
- })
145
- ```
146
- 很多情况下,并不能一开始就获取到用户的 `uin`,而等获取到用户的 `uin` 才开始实例化 Aegis,如果这期间发生了错误 Aegis 将监听不到。`uin` 的设置可以在获取到用户的时候:
147
- ```javascript
148
- const aegis = new Aegis({
149
- id: 'pGUVFTCZyewxxxxx'
150
- })
151
-
152
- // 拿到uin之后...
153
- aegis.setConfig({
154
- uin: '888'
155
- })
156
- ```
157
-
158
- ### info、infoAll、report
159
- 这三个方法是 Aegis 提供的主要上报手段。
160
- ```javascript
161
- aegis.info('上报一条白名单日志,这两种情况这条日志才会报到后台:1、打开页面的用户在名单中;2、对应的页面发生了错误🤨');
162
-
163
- aegis.infoAll('上报了一条日志,该上报与info唯一的不同就在于,所有用户都会上报');
164
-
165
- aegis.report(new Error('上报一个错误'));
166
- ```
167
-
168
- ### reportEvent
169
-
170
- 该方法可用来上报自定义事件,平台将会自动统计上报事件的各项指标,诸如:PV、UV、平台分布等...
171
-
172
- reportEvent 可以支持两种类型上报参数类型,一种是字符串类型
173
-
174
- ```javascript
175
- aegis.reportEvent('XXX请求成功');
176
- ```
177
-
178
- 一种是对象类型,ext1 ext2 ext3 默认使用 new Aegis 的时候传入的参数,自定义事件上报的时候,可以覆盖默认值。
179
-
180
- ```javascript
181
- aegis.reportEvent({
182
- name: 'XXX请求成功',
183
- ext1: '额外参数1',
184
- ext2: '额外参数2',
185
- ext3: '额外参数3',
186
- })
187
- ```
188
-
189
- 注意,额外参数的三个 key 是固定的,目前只支持 ext1 ext2 ext3。
190
-
191
- ### reportTime
192
-
193
- 该方法可用来上报自定义测速,例如:
194
-
195
- ```javascript
196
- // 假如‘onload’的时间是1s
197
- aegis.reportTime('onload', 1000);
198
- ```
199
-
200
- 或者如果需要使用额外参数,可以传入对象类型参数,ext1,ext2,ext3 会覆盖默认值:
201
-
202
- ```javascript
203
- aegis.reportTime({
204
- name: 'onload', // 自定义测速 name
205
- duration: 1000, // 自定义测速耗时(0 - 60000)
206
- ext1: 'test1',
207
- ext2: 'test2',
208
- ext3: 'test3',
209
- });
210
- ```
211
-
212
- > `onload` 可以修改为其他的命名。
213
-
214
- ### time、timeEnd
215
-
216
- 该方法同样可用来上报自定义测速,适用于两个时间点之间时长的计算并上报,例如:
217
-
218
- ```javascript
219
- aegis.time('complexOperation');
220
- /**
221
- * .
222
- * .
223
- * 做了很久的复杂操作之后。。。
224
- * .
225
- * .
226
- */
227
- aegis.timeEnd('complexOperation'); /** 此时日志已经报上去了😄**/
228
- ```
229
-
230
- > `complexOperation` 同样可以修改为其他的命名。
231
- > 自定义测速是用户上报任意值,服务端对其进行统计和计算,因为服务端不能做脏数据处理,因此建议用户在上报端进行统计值限制,防止脏数据对整体产生影响。
232
- > 目前 Aegis 只支持 0-60000 的数值计算,如果大于该值,建议进行合理改造。
233
- > 高频率的自定义测速上报尽量使用 reportTime。time 和 timeEnd 上报会存在上报值覆盖的问题。比如 aegis.time(aaa), 在调用 aegis.timeEnd(aaa) 之前,又调用了一次 aegis.time(aaa), 则上报的时间为 timeEnd 时间 - 第二次 time 的时间。
234
-
235
- ### reportSpeedLog
236
-
237
- 该方法用来上报cgi测速功能,上报完可到开发者平台的 “CGI测速” 栏目看到数据,如下:
238
-
239
- ![cgi测速](https://nowpic.gtimg.com/feeds_pic/PiajxSqBRaEILjSDiaDdp9RXb4hNJVcxegBAsoqwibkicrpx98RNG98a1Q/)
240
-
241
- 使用方法:
242
-
243
- ```javascript
244
- aegis.reportSpeedLog({
245
- url: 'https://www.xxx.com/some/api/url',
246
- isHttps: true,
247
- method: 'get',
248
- duration: 900, // 耗时,单位:ms
249
- ret: 0, // retcode,默认为:unknown
250
- status: 200, // http status
251
- })
252
- ```
253
-
254
- ### destroy
255
-
256
- 该方法用于销毁 sdk 实例,销毁后,不再进行数据上报
257
-
258
- ```javascript
259
- aegis.destroy();
260
- ```
261
-
262
- ## 白名单
263
-
264
- 白名单功能是适用于开发者希望对某些特定的用户上报更多的日志,但是又不希望太多上报来影响到全部日志数据,并且减少用户的接口请求次数,因为 TAM 设定了白名单的逻辑。
265
-
266
- 1. 白名单用户会上报全部的 API 请求信息,包括接口请求和请求结果。
267
- 2. 白名单用户可以使用 info 接口信息数据上报。
268
- 3. info vs infoAll:在开发者实际体验过程中,白名单用户可以添加更多的日志,并且使用 info 进行上报。infoAll 会对所有用户无差别进行上报,因此可能导致日志量上报巨大。
269
- 4. 通过接口 whitelist 来判断当前用户是否是白名单用户,白名单用户的返回结果会绑定在 aegis 实例上 (aegis.isWhiteList) 用来给开发者使用。
270
- 5. 用了减少开发者使用负担,白名单用户是团队有效,可以在 [组织管理-白名单管理](https://tam.woa.com/role/group-whitelist-manage) 内创建白名单,则团队下全部项目都生效。
271
-
272
-
273
- ## 钩子函数
274
-
275
-
276
- ### onBeforeRequest
277
-
278
- 该钩子函数会在所有请求发出前调用,参数中会传入请求的所有内容,必须返回待发送内容。
279
-
280
- ```javascript
281
- function changeURLArg(url,arg,arg_val) {
282
- var pattern=arg+' = ([^&]*)';
283
- var replaceText = arg+'='+arg_val;
284
- if (url.match(pattern)) {
285
- var tmp = '/('+ arg+'=)([^&]*)/gi';
286
- tmp = url.replace(eval(tmp),replaceText);
287
- return tmp;
288
- }
289
- return url;
290
- }
291
- const aegis = new Aegis({
292
- id: 'pGUVFTCZyewxxxxx',
293
- onBeforeRequest(log) {
294
- if (log.type === 'performance') {
295
- // 页面测速,此时可以修改log内容,如修改页面测速platform
296
- log.url = changeURLArg(log.url, 'platform', type)
297
- }
298
- return log
299
- }
300
- });
301
-
302
- // SEND_TYPE {
303
- // LOG = 'log', // 日志
304
- // SPEED = 'speed', // 接口和静态资源测速
305
- // PERFORMANCE = 'performance', // 页面测速
306
- // OFFLINE = 'offline', // 离线日志上传
307
- // WHITE_LIST = 'whiteList', // 白名单
308
- // VITALS = 'vitals', // vitals
309
- // PV = 'pv', // 自定义pv
310
- // EVENT = 'event', // 自定义事件
311
- // CUSTOM = 'custom', // 自定义测速
312
- // SDK_ERROR = 'sdkError', // sdk报错
313
- // }
314
- ```
315
-
316
- ### beforeReport
317
-
318
- 1. 该钩子将会在日志上报(对应上报接口为 /collect?)前执行,例如
319
-
320
- ```javascript
321
- const aegis = new Aegis({
322
- id: 'pGUVFTCZyewxxxxx',
323
- beforeReport(log) {
324
- // 监听到下面抛出的错误
325
- console.log(log); // {level: "4", msg: "发生错误啦!!!!"}
326
- return log;
327
- }
328
- });
329
-
330
- throw new Error('发生错误啦!!!!');
331
- ```
332
-
333
- 2. 当该钩子返回 false 时,本条日志将不会进行上报,该功能可用来过滤某些不需要上报的错误,例如:
334
-
335
- ```javascript
336
- const aegis = new Aegis({
337
- id: 'pGUVFTCZyewxxxxx',
338
- beforeReport(log) {
339
- if (log.level === '4' && log.msg && log.msg.indexOf('碍眼的错误') !== -1) {
340
- return false
341
- }
342
- return log;
343
- }
344
- });
345
- throw new Error('碍眼的错误'); // 该错误将不会被上报
346
- ```
347
-
348
- 上面例子中,当上报的错误内容包含 碍眼的错误 几个关键字时,将不会上报至前端监控后台中。
349
-
350
-
351
- ### beforeReportSpeed
352
-
353
- 1. 该钩子将会在测速数据上报前(/speed?)被执行,例如:
354
-
355
- ```javascript
356
- const aegis = new Aegis({
357
- id: 'pGUVFTCZyewxxxxx',
358
- reportApiSpeed: true,
359
- reportAssetSpeed: true,
360
- beforeReportSpeed(msg) {
361
- console.log(msg); // {url: "https://localhost:3001/example.e31bb0bc.js", method: "get", duration: 7.4, status: 200, type: "static"}
362
- return msg
363
- }
364
- });
365
- ```
366
-
367
- 上述 msg 将会有以下几个字段:
368
-
369
- ```sh
370
- url: 该资源的请求地址;
371
- type: 该资源的类型,目前有 fetch 、 static 两种,当为 fetch 时,Aegis 将会把该资源当成 API 请求进行上报,static 时则视为静态资源;
372
- duration: 该资源请求耗时;
373
- method: 请求该资源时使用的 http method;
374
- status: 服务器返回状态码;
375
- payload: 提供给开发人员的完整资源请求信息(此数据不上报到 Aegis 后台,用户可自行操作)
376
- 完整的数据结构如下:
377
- payload.type - 表示该资源请求的类型,用于区分原始请求类型,可取值为:'fetch', 'xhr'
378
- payload.sourceURL - 表示完整的 URL 请求连接
379
- payload.status - 表示请求状态码
380
- payload.headers - 包含所有的请求头,且 value 值都为字符串
381
- payload.data - 表示完整的请求资源,用户可自定义操作(当请求类型为 fetch 时,表示 response 对象;当请求类型为 XHR 时,表示 XMLHttpRequest 对象)
382
- ```
383
-
384
- 上面的例子中,每当 Aegis 收集到一个资源的加载详情时,将会以该资源的加载情况(上面返回的 msg)作为参数调用 beforeReportSpeed 钩子。
385
-
386
- 2. 如果您配置了该钩子,Aegis 最终的上报内容将以钩子的执行结果为准。例如:
387
-
388
- ```javascript
389
- const aegis = new Aegis({
390
- id: 'pGUVFTCZyewxxxxx',
391
- reportApiSpeed: true,
392
- reportAssetSpeed: true,
393
- beforeReportSpeed(msg) {
394
- msg.type = 'static';
395
- return msg;
396
- }
397
- });
398
- ```
399
-
400
- 上面的代码中,将所有的 msg.type 设置为 static,这意味着所有的资源都将被当成静态资源进行上报,API 请求也将被报至静态资源中。
401
-
402
- 3. 使用该钩子,您可以校准 Aegis 类型判断错误的请求。
403
-
404
- 假如您有一条接口 https://example.com/api,该接口的响应头 Content-Type 为 text/html。正常情况下,RUM 会将该资源当成静态资源进行上报。但在您的业务中,该接口就必须视为 API 请求进行上报,您可以给 Aegis 配置如下钩子进行校正:
405
-
406
-
407
- ```javascript
408
- const aegis = new Aegis({
409
- id: 'pGUVFTCZyewxxxxx',
410
- reportApiSpeed: true,
411
- reportAssetSpeed: true,
412
- beforeReportSpeed(msg) {
413
- if (msg.url === 'https://example.com/api') {
414
- msg.type = 'fetch';
415
- }
416
- }
417
- });
418
- ```
419
-
420
- 4. 您还可以屏蔽某些资源的测速上报,例如:
421
-
422
- ```javascript
423
- const aegis = new Aegis({
424
- id: 'pGUVFTCZyewxxxxx',
425
- reportApiSpeed: true,
426
- reportAssetSpeed: true,
427
- beforeReportSpeed(msg) {
428
- // 地址中包含‘https://example.com/api’的都不上报
429
- if (msg.url.indexOf('https://example.com/api') !== -1) {
430
- // 返回 ‘false’ 将阻止本条测速日志的上报
431
- return false
432
- }
433
- }
434
- });
435
- ```
436
-
437
- ### beforeRequest
438
-
439
- 该钩子将会在日志上报前执行,例如:
440
-
441
- ```javascript
442
- const aegis = new Aegis({
443
- id: "pGUVFTCZyewxxxxx",
444
- beforeRequest: function(msg) {
445
- //{logs: {…}, logType: "log"}
446
- console.log(msg);
447
- }
448
- });
449
- ```
450
-
451
- 其中,`msg` 将会有以下几个字段:
452
-
453
- > 1.`logs`: 上报的日志内容;
454
-
455
- > 2.`logType`: 日志类型,有以下值 custom:自定义测速,event:自定义事件,log:日志,pv:页面PV,speed:接口和静态资源测速
456
-
457
- logType等于`custom`时,logs的值如下:
458
-
459
- ```sh
460
- {name: "白屏时间", duration: 3015.7000000178814, ext1: '', ext2: '', ext3: '', from: ''}
461
- ```
462
-
463
- logType等于`event`时,logs的值如下:
464
-
465
- ```sh
466
- {name: "ios", ext1: "", ext2: "", ext3: ""}
467
- ```
468
-
469
- logType等于`log`时,logs的值如下:
470
-
471
- ```sh
472
- { level: '1', msg: '接口请求日志(白名单日志)' } // 具体level信息参考日志等级
473
- ```
474
-
475
- 当该钩子返回 `false` 时,本条日志将不会进行上报,该功能可用来过滤某些不需要上报的错误,例如:
476
-
477
- ```javascript
478
- const aegis = new Aegis({
479
- id: "pGUVFTCZyewxxxxx",
480
- beforeRequest: function(data) {
481
- // 入参 data 的数据结构:{logs: {…}, logType: "log"}
482
- if (data.logType === 'log' && data.logs.msg.indexOf('otheve.beacon.qq.com') > -1) {
483
- // 拦截:日志类型为 log,且内容包含 otheve.beacon.qq.com 的请求
484
- return false;
485
- }
486
- // 入参 data 数据结构:{logs: {}, logType: "speed"}
487
- if (data.logType === 'speed' && data.logs.url.indexOf('otheve.beacon.qq.com') > -1) {
488
- // 拦截:日志类型为 speed,并且接口 url 包含 otheve.beacon.qq.com 的请求
489
- return false;
490
- }
491
- if (data.logType === 'performance') {
492
- // 修改:将性能数据的首屏渲染时间改为2s
493
- data.logs.firstScreenTiming = 2000;
494
- }
495
- return data;
496
- }
497
- }
498
- });
499
- throw new Error('碍眼的错误'); // 该错误将不会被上报
500
- ```
501
-
502
- 上面例子中,当上报的错误内容包含 `碍眼的错误` 几个关键字时,将不会上报至 Aegis 后台中。
503
-
504
- ### afterRequest
505
-
506
- 该勾子将会在测速数据上报后被执行,例如:
507
-
508
- ```javascript
509
- const aegis = new Aegis({
510
- id: "pGUVFTCZyewxxxxx",
511
- reportApiSpeed: true,
512
- reportAssetSpeed: true,
513
- afterRequest: function(msg) {
514
- // {isErr: false, result: Array(1), logType: "log", logs: Array(4)}
515
- console.log(msg);
516
- }
517
- });
518
- ```
519
-
520
- 其中,`msg` 将会有以下几个字段:
521
-
522
- > 1.`isErr`: 请求上报接口是否错误;
523
-
524
- > 2.`result`: 上报接口的返回结果;
525
-
526
- > 3.`logs`: 上报的日志内容;
527
-
528
- > 4.`logType`: 日志类型,有以下值speed:接口和静态资源测速,performance:页面测速,vitals:web vitals,event:自定义事件,custom:自定义测速;
529
-
530
- ## 配置文档
531
- | 配置 | 描述 |
532
- | -------- | -------- |
533
- | id | 必须,string,默认 无。<br>开发者平台分配的项目上报ID |
534
- | uin | 建议,string <br>业务定义的当前用户的唯一标识符,用来查找固定用户的日志。白名单上报时将根据该字段判定用户是否在白名单中,字段仅支持`字母数字@=._-`,正则表达式: `/^[@=.0-9a-zA-Z_-]{1,60}$/` |
535
- | version | 可选,string,默认 sdk 版本号。<br>当前上报版本,当页面使用了pwa或者存在离线包时,可用来判断当前的上报是来自哪一个版本的代码,仅支持`字母数字.,:_-`,长度在 60 位以内 `/^[0-9a-zA-Z.,:_-]{1,60}$/` |
536
- | delay | 可选,number,默认 1000 ms。<br>上报节流时间,在该时间段内的上报将会合并到一个上报请求中。 |
537
- | repeat | 可选,number,默认 5。<br>重复上报次数,对于同一个错误超过多少次不上报。 |
538
- | env | 可选,enum,默认 Aegis.environment.production。 <br> 当前项目运行所处的环境。|
539
- | hostUrl | 可选,默认是 `https://rumt-zh.com`。<br>影响全部上报数据的 host 地址,下面几个 url 地址设置后会覆盖对应的上报地址 |
540
- | url | 可选,string,默认 'https://rumt-zh.com/collect'。<br>日志上报地址 |
541
- | pvUrl | 可选,string, 默认 'https://rumt-zh.com/collect/pv' <br> pv 上报地址 |
542
- | whiteListUrl | 可选,string,默认 'https://rumt-zh.com/collect/whitelist'。<br>白名单确认接口 <br>如果想要关闭白名单接口请求,可以传空字符串|
543
- | offlineUrl | 可选,string,默认 'https://rumt-zh.com/collect/offline'。<br> 离线日志上报地址 |
544
- | eventUrl | 可选,string,默认 'https://rumt-zh.com/collect/events'。<br> 自定义事件上报地址 |
545
- | customTimeUrl | 可选,string,默认 'https://rumt-zh.com/speed/custom'。<br>自定义测速上报地址 |
546
- | speedUrl | 可选,string,默认 'https://rumt-zh.com/speed'。<br>测速日志上报地址 |
547
- | ext1 | 可选,string,自定义上报的额外维度,上报的时候可以被覆盖 |
548
- | ext2 | 可选,string,自定义上报的额外维度,上报的时候可以被覆盖 |
549
- | ext3 | 可选,string,自定义上报的额外维度,上报的时候可以被覆盖 |
550
-
551
-
552
- 在实例化 Aegis node sdk 时可传入额外配置:
553
- | 配置 | 描述 |
554
- | -------- | -------- |
555
- |selector|可选, object 寻址相关配置,不传默认会使用北极星进行寻址|
556
- |selector.type|必须, string 可选值:ip,host,polaris(北极星)|
557
- |protocol|可选,string, selector.type=host 时,默认为https, 其他类型默认为http,未来会支持trpc协议|
558
-
559
- ## 注意事项
560
- - 由于aegis实例是node应用初始时构造的,因此建议使用者将 uin/sessionId等直接打到 `aegis.info`接口中,在平台查询时直接使用关键字查询。
561
-
562
-
@@ -1 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("url"),require("querystring"),require("axios")):"function"==typeof define&&define.amd?define(["url","querystring","axios"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Aegis=t(e.url,e.querystring,e.axios)}(this,(function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var i=o(e),s=o(t),l=r(n),c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function a(e,t){function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function f(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function l(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,l)}c((r=r.apply(e,t||[])).next())}))}function p(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function h(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,l=i.length;s<l;s++,o++)r[o]=i[s];return r}Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e)throw new TypeError("Cannot convert first argument to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r){r=Object(r);for(var o=Object.keys(Object(r)),i=0,s=o.length;i<s;i++){var l=o[i],c=Object.getOwnPropertyDescriptor(r,l);(null==c?void 0:c.enumerable)&&(t[l]=r[l])}}}return t}});var d,g=["ext1","ext2","ext3","level","trace","tag","seq","code"],v=function(){function e(){var e=this;this.emit=function(t,n){if(e){var r,o=e.eventsList[t];if(null==o?void 0:o.length){o=o.slice();for(var i=0;i<o.length;i++){r=o[i];try{var s=r.callback.apply(e,[n]);if(1===r.type&&e.remove(t,r.callback),!1===s)break}catch(e){throw e}}}return e}},this.eventsList={}}return e.prototype.indexOf=function(e,t){for(var n=0;n<e.length;n++)if(e[n].callback===t)return n;return-1},e.prototype.on=function(e,t,n){if(void 0===n&&(n=0),this){var r=this.eventsList[e];if(r||(this.eventsList[e]=[],r=this.eventsList[e]),-1===this.indexOf(r,t)){var o={name:e,type:n||0,callback:t};return r.push(o),this}return this}},e.prototype.one=function(e,t){this.on(e,t,1)},e.prototype.remove=function(e,t){if(this){var n=this.eventsList[e];if(!n)return null;if(!t){try{delete this.eventsList[e]}catch(e){}return null}if(n.length){var r=this.indexOf(n,t);n.splice(r,1)}return this}},e.prototype.clear=function(){this.eventsList={}},e}(),m=function(e){if(!e||0===e.length)return"{}";e=Array.isArray(e)?e:[e];var t=Object.keys(e[0]),n={};return t.forEach((function(t){n[t]=e.map((function(e){return e[t]}))})),n.count=e.length,S(n)};!function(e){e[e.number=-1]="number",e.string=""}(d||(d={}));var y,O,b,R,E,w=function(){var e=new WeakSet;return function(t,n){if(n instanceof Error)return"Error.message: "+n.message+" \n Error.stack: "+n.stack;if("object"==typeof n&&null!==n){if(e.has(n))return"[Circular "+(t||"root")+"]";e.add(n)}return n}},P=function(e){if("string"==typeof e)return e;try{return e instanceof Error?(JSON.stringify(e,w(),4)||"undefined").replace(/"/gim,""):JSON.stringify(e,w(),4)||"undefined"}catch(e){return"error happen when aegis stringify: \n "+e.message+" \n "+e.stack}},S=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e,w())||"undefined"}catch(e){return"error happen when aegis stringify: \n "+e.message+" \n "+e.stack}};!function(e){e.INFO_ALL="-1",e.API_RESPONSE="1",e.INFO="2",e.ERROR="4",e.PROMISE_ERROR="8",e.AJAX_ERROR="16",e.SCRIPT_ERROR="32",e.IMAGE_ERROR="64",e.CSS_ERROR="128",e.CONSOLE_ERROR="256",e.MEDIA_ERROR="512",e.RET_ERROR="1024",e.PAGE_LOAD="1025",e.SLOW_PAGE_LOAD="1026",e.SLOW_NET_REQUEST="1027",e.ASSERT_REQUEST="1028",e.SLOW_ASSET_REQUEST="1029",e.CLICK_EVENT="1030",e.true="1031",e.REPORT="2048",e.PV="4096",e.EVENT="8192",e.SPEED_EVENT="8193",e.PAGE_NOT_FOUND_ERROR="16384",e.WEBSOCKET_ERROR="32768",e.BRIDGE_ERROR="65536",e.LAZY_LOAD_ERROR="131072"}(y||(y={})),function(e){e[e.android=1]="android",e[e.ios=2]="ios",e[e.windows=3]="windows",e[e.macos=4]="macos",e[e.linux=5]="linux",e[e.devtools=6]="devtools",e[e.other=100]="other"}(O||(O={})),function(e){e[e.unknown=100]="unknown",e[e.wifi=1]="wifi",e[e.net2g=2]="net2g",e[e.net3g=3]="net3g",e[e.net4g=4]="net4g",e[e.net5g=5]="net5g",e[e.net6g=6]="net6g"}(b||(b={})),function(e){e.LOG="log",e.SPEED="speed",e.PERFORMANCE="performance",e.OFFLINE="offline",e.WHITE_LIST="whiteList",e.VITALS="vitals",e.PV="pv",e.CUSTOM_PV="customPV",e.EVENT="event",e.CUSTOM="custom",e.SDK_ERROR="sdkError",e.SET_DATA="setData",e.LOAD_PACKAGE="loadPackage"}(R||(R={})),function(e){e.production="production",e.development="development",e.gray="gray",e.pre="pre",e.daily="daily",e.local="local",e.test="test",e.others="others"}(E||(E={}));var T=function(e,t){return function(n,r){var o=t.logCreated;if("function"==typeof o){var i=n.filter((function(e){return!1!==o(e)}));return e("beforeWrite",i),r(i)}return e("beforeWrite",n),r(n)}},_=function(e){return e.filter((function(t,n){return"static"!==t.type||!e.find((function(e,r){return t.url===e.url&&200===t.status&&r>n}))}))},x=function(e,t){var n,r=[],o=e.config;return e.lifeCycle.on("destroy",(function(){r.length=0})),function(i,s){if(Array.isArray(i)?r=r.concat(i):r.push(i),t&&r.length>=t||e.sendNow&&r.length>0)return r=_(r),s(r.splice(0,r.length)),void(n&&clearTimeout(n));n&&clearTimeout(n),n=setTimeout((function(){n=null,(r=_(r)).length>0&&s(r.splice(0,r.length))}),o.delay)}},U=function(e,t){return Array.isArray(e)?t(e.map((function(e){return function(e){return g.forEach((function(t){e[t]||delete e[t]})),e}(u(u({},e),{msg:"string"==typeof e.msg?e.msg:[].concat(e.msg).map(P).join(" ")}))}))):t([u(u({},e),{msg:"string"==typeof e.msg?e.msg:P(e.msg)})])},C=function(e){e.level===y.INFO_ALL&&(e.level=y.INFO)},L=function(e){var t,n=!1,r=!1,o=!1,i=[];return e.lifeCycle.on("onConfigChange",(function(){t&&clearTimeout(t),t=setTimeout((function(){if(!o&&e.config){o=!0;var t=e.config.whiteListUrl,s=void 0===t?"":t;s&&e.sendPipeline([function(t,o){o({url:s,type:R.WHITE_LIST,success:function(t){r=!0;try{var o=t.data?t.data:JSON.parse(t),s=o.retcode,l=o.result,c=void 0===l?{}:l;0===s&&(n=c.is_in_white_list,e.isWhiteList=n,c.rate>=0&&c.rate<=1&&(e.config.random=c.rate,e.isGetSample=!1)),e.isWhiteList&&i.length?D(e)(i.splice(0),(function(){})):!e.isWhiteList&&i.length&&(i.length=0);var a=e.config.onWhitelist;"function"==typeof a&&a(n)}catch(e){}},fail:function(){r=!0}})}],R.WHITE_LIST)(null),o=!1}}),e.config.uin?50:500)})),e.lifeCycle.on("destroy",(function(){i.length=0})),function(t,o){var s,l;if(n||(null===(l=null===(s=e.config)||void 0===s?void 0:s.api)||void 0===l?void 0:l.reportRequest))o(t.concat(i.splice(0)).map((function(e){return C(e),e})));else{var c=t.filter((function(e){return e.level!==y.INFO&&e.level!==y.API_RESPONSE?(C(e),!0):(r||(i.push(e),i.length>=200&&(i.length=200)),!1)}));c.length&&o(c)}}},I=function(e){return setTimeout((function(){var t=e.config,n=t.pvUrl,r=void 0===n?"":n,o=t.spa,i=["web-sdk","mp-sdk"].indexOf("node-sdk")>-1;r&&(i&&!o||!i)&&e.sendPipeline([function(e,t){t({url:r,type:R.PV})}],R.PV)(null)}),100),function(e,t){t(e)}},A={},k={},j=function(e){return function(t,n){var r="number"==typeof e.repeat?e.repeat:60;if(r<=0)return n(t);var o=(null==e?void 0:e.id)+"_error",i=k[o]||{};n(t.filter((function(e){if(e.level===y.ERROR||e.level===y.PROMISE_ERROR||e.level===y.AJAX_ERROR||e.level===y.SCRIPT_ERROR||e.level===y.IMAGE_ERROR||e.level===y.CSS_ERROR||e.level===y.MEDIA_ERROR||e.level===y.RET_ERROR||e.level===y.BRIDGE_ERROR||e.level===y.PAGE_NOT_FOUND_ERROR||e.level===y.WEBSOCKET_ERROR||e.level===y.LAZY_LOAD_ERROR){var t=e.msg.slice(0,200);if(i[t]>r)return A[o]||(A[n=o]||(A[n]=setTimeout((function(){k[n]={},A[n]=null}),6e4)),A[n]),!1;i[t]=1+~~i[t],k[o]=i}var n;return!0})))}},N=function(e){return(Array.isArray(e)?e:[e]).map((function(e){return Object.getOwnPropertyNames(e).reduce((function(t,n){return"ctx"!==n&&(t[n]=e[n]),t}),{level:y.INFO,msg:""})}))},D=function(e){return function(t){return e.sendPipeline([function(t,n){return n({url:e.config.url||"",data:m(N(t)),method:"post",contentType:"application/json",type:R.LOG,log:t,requestConfig:{timeout:5e3},success:function(){var r=e.config.onReport;"function"==typeof r&&t.forEach((function(e){r(e)})),"function"==typeof n&&n([])}})}],R.LOG)(t)}},B=function(e){return function(t){e.sendPipeline([function(t,n){var r=t.map((function(t){return{name:t.name,ext1:t.ext1||e.config.ext1||"",ext2:t.ext2||e.config.ext2||"",ext3:t.ext3||e.config.ext3||""}}));n({url:e.config.eventUrl+"?payload="+encodeURIComponent(JSON.stringify(r)),type:R.EVENT,log:t})}],R.EVENT)(t)}},q=function(e){return function(t){return e.sendPipeline([function(t,n){n({url:e.config.customTimeUrl+"?payload="+encodeURIComponent(JSON.stringify({custom:t})),type:R.CUSTOM,log:t})}],R.CUSTOM)(t)}},M=function(e,t){return function(n,r){var o=Array.isArray(n),i=o?n:[n];e.lifeCycle.emit("beforeRequest",n);var s=e.config.beforeRequest;"function"==typeof s&&(i=i.map((function(e){try{var n=s({logs:e,logType:t});return(null==n?void 0:n.logType)===t&&(null==n?void 0:n.logs)?n.logs:!1!==n&&e}catch(t){return e}})).filter((function(e){return!1!==e}))),i.length&&(i=function(e,t){if(!Array.isArray(e)||e.length<=1)return e;var n=[],r=[];return!(r="string"==typeof t?[t]:t)||r.length<=0||(r.forEach((function(t){e.forEach((function(e){(null==e?void 0:e[t])&&n.push(t)}))})),n.length>0&&(e=e.map((function(e){var t={};return n.forEach((function(e){t[e]=""})),u(u({},t),e)})))),e}(i,g),r(o?i:i[0]))}},H=function(e){return function(t,n){e.lifeCycle.emit("modifyRequest",t);var r=e.config.modifyRequest;if("function"==typeof r)try{var o=r(t);"object"==typeof o&&"url"in o&&(t=o)}catch(e){console.error(e)}n(t)}},F=function(e){return function(t,n){var r;null===(r=e.lifeCycle)||void 0===r||r.emit("afterRequest",t);var o=(e.config||{}).afterRequest;"function"==typeof o&&!1===o(t)||n(t)}};Array(32);var V,G=function(){},W=function(e){if(!e||!e.reduce||!e.length)throw new TypeError("createPipeline need at least one function param");return 1===e.length?function(t,n){e[0](t,n||G)}:e.reduce((function(e,t){return function(n,r){return void 0===r&&(r=G),e(n,(function(e){return null==t?void 0:t(e,r)}))}}))},J=function(e,t){Object.getOwnPropertyNames(e).forEach((function(n){"function"==typeof e[n]&&"constructor"!==n&&(t?t[n]="sendPipeline"===n?function(){return function(){}}:function(){}:e[n]=function(){})}))},K=function(){function e(t){var n,r=this;this.isGetSample=!1,this.isHidden=!1,this.config={version:0,delay:1e3,onError:!0,repeat:60,random:1,aid:!0,device:!0,pagePerformance:!0,webVitals:!0,speedSample:!0,onClose:!0,reportLoadPackageSpeed:!0,hostUrl:"https://rumt-zh.com",env:"production",url:"",offlineUrl:"",whiteListUrl:"",pvUrl:"",speedUrl:"",customTimeUrl:"",performanceUrl:"",performanceUrlForHippy:"",webVitalsUrl:"",eventUrl:"",setDataReportUrl:"",reportImmediately:!0},this.isWhiteList=!1,this.lifeCycle=new v,this.bean={},this.normalLogPipeline=W([x(this,5),U,(n=this,function(e,t){var r=n.config;t(e=e.map((function(e){var t,n=r.maxLength||102400;try{if(!e.msg||e.msg.length<=n)return e;e.msg=null===(t=e.msg)||void 0===t?void 0:t.substring(0,n)}catch(t){e.msg=P(e.msg).substring(0,r.maxLength)}return e})))}),j(this.config),T(this.lifeCycle.emit,this.config),I(this),L(this),function(e,t){try{var n=JSON.parse(JSON.stringify(e));r.lifeCycle.emit("beforeReport",n);var o=r.config.beforeReport;"function"==typeof o&&(e=e.filter((function(e){return!1!==o(e)}))),e.length&&t(e)}catch(e){}},D(this)]),this.eventPipeline=W([x(this,10),B(this)]),this.customTimePipeline=W([x(this,10),q(this)]),this.timeMap={},this.failRequestCount=0,this.config=function(e,t){return void 0===t&&(t="https://rumt-zh.com"),"string"!=typeof t&&(t="https://rumt-zh.com"),e.url=e.url||t+"/collect",e.offlineUrl=e.offlineUrl||t+"/offline",e.whiteListUrl=e.whiteListUrl||t+"/collect/whitelist",e.pvUrl=e.pvUrl||t+"/collect/pv",e.eventUrl=e.eventUrl||t+"/collect/events",e.speedUrl=e.speedUrl||t+"/speed",e.customTimeUrl=e.customTimeUrl||t+"/speed/custom",e.performanceUrl=e.performanceUrl||t+"/speed/performance",e.performanceUrlForHippy=e.performanceUrlForHippy||t+"/speed/hippyPerformance",e.webVitalsUrl=e.webVitalsUrl||t+"/speed/webvitals",e.setDataReportUrl=e.SetDataReportUrl||t+"/speed/miniProgramData",e}(this.config,t.hostUrl),e.instances.push(this)}return e.use=function(t){-1===e.installedPlugins.indexOf(t)&&t.aegisPlugin&&e.installedPlugins.push(t)},e.unuse=function(t){var n=e.installedPlugins.indexOf(t);-1!==n&&e.installedPlugins.splice(n,1)},e.prototype.init=function(t){this.setConfig(t);for(var n=0;n<e.installedPlugins.length;n++)try{e.installedPlugins[n].patch(this)}catch(e){this.sendSDKError(e)}this.lifeCycle.emit("onInited")},e.prototype.destroy=function(t){void 0===t&&(t=!1);var n,r,o,i=e.instances.indexOf(this);-1!==i&&e.instances.splice(i,1);for(var s=e.installedPlugins.length-1;s>=0;s--)try{e.installedPlugins[s].unpatch(this)}catch(e){this.sendSDKError(e)}if(this.lifeCycle.emit("destroy"),this.lifeCycle.clear(),t)n=this,o=Object.getOwnPropertyDescriptors(n),Object.keys(o).forEach((function(e){o[e].writable&&(r?r[e]=null:n[e]=null)})),Object.setPrototypeOf(this,null);else{var l=this;do{l.constructor!==Object&&J(l,this)}while(l=Object.getPrototypeOf(l));if(0===e.instances.length){var c=Object.getPrototypeOf(this).constructor;J(c),J(e)}}},e.prototype.setConfig=function(e){Object.assign(this.config,e);var t=this.config,n=t.id,r=t.uin,o=t.version,i=t.ext1,s=t.ext2,l=t.ext3,c=t.aid,a=t.env,u=void 0===a?"production":a,f=t.pageUrl,p=this.bean.id!==n||this.bean.uin!==r||this.bean.aid!==c;return this.bean.id=n||"",this.bean.uin=r||"",this.bean.version=o||"1.43.25",this.bean.aid=c||"",this.bean.env=function(e){switch(e){case E.production:case E.development:case E.gray:case E.pre:case E.daily:case E.local:case E.test:case E.others:return!0;default:return!1}}(u)?u:E.others,f&&this.extendBean("from",encodeURIComponent(f.slice(0,2048))),i&&this.extendBean("ext1",encodeURIComponent(i)),s&&this.extendBean("ext2",encodeURIComponent(s)),l&&this.extendBean("ext3",encodeURIComponent(l)),p&&this.lifeCycle.emit("onConfigChange",this.config),this.config},e.prototype.extendBean=function(e,t){this.bean[e]=t},e.prototype.send=function(e,t,n){var r=this;return W([H(this),function(e,o){r.request(e,(function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];o({isErr:!1,result:n,logType:e.type,logs:e.log}),null==t||t.apply(void 0,n)}),(function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];o({isErr:!0,result:t,logType:e.type,logs:e.log}),null==n||n.apply(void 0,t)}))},F(this)])(e)},e.prototype.sendSDKError=function(e){var t=this;this.sendPipeline([function(e,n){n({url:t.config.url+"?id=1085&msg[0]="+encodeURIComponent(P(e))+"&level[0]=2&from="+t.config.id+"&count=1&version="+t.config.id+"(1.43.25)",addBean:!1,method:"get",type:R.SDK_ERROR,log:e})}],R.SDK_ERROR)(e)},e.prototype.sendPipeline=function(e,t){var n,r=this;return W(h([(n=this,function(e,t){if("number"!=typeof n.config.random&&(console.warn("random must in [0, 1], default is 1."),n.config.random=1),!n.isHidden||!n.isGetSample)if(n.isGetSample)!n.isHidden&&t(e);else{if(n.isGetSample=!0,Math.random()<n.config.random)return n.isHidden=!1,t(e);n.isHidden=!0}}),M(this,t)],e,[H(this),function(e,t){r.request(e,(function(){for(var n,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];r.failRequestCount=0;var s=!1,l=o[0];(""+l).indexOf("403 forbidden")>-1&&(s=!0,r.destroy()),t({isErr:s,result:o,logType:null==e?void 0:e.type,logs:null==e?void 0:e.log}),null===(n=null==e?void 0:e.success)||void 0===n||n.call.apply(n,h([e],o))}),(function(){for(var n,o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];++r.failRequestCount>=60&&r.destroy();var s=o[0];(""+s).indexOf("403 forbidden")>-1&&r.destroy(),t({isErr:!0,result:o,logType:null==e?void 0:e.type,logs:null==e?void 0:e.log}),null===(n=null==e?void 0:e.fail)||void 0===n||n.call.apply(n,h([e],o))}))},F(this)]))},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:y.INFO,msg:e};1===e.length&&e[0].msg&&Object.assign(n,u({},e[0]),{level:y.INFO}),this.normalLogPipeline(n)},e.prototype.infoAll=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:y.INFO_ALL,msg:e};1===e.length&&e[0].msg&&Object.assign(n,u({},e[0]),{level:y.INFO_ALL}),this.normalLogPipeline(n)},e.prototype.report=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:y.REPORT,msg:e};1===e.length&&e[0].msg&&Object.assign(n,u({},e[0])),this.normalLogPipeline(n)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n={level:y.ERROR,msg:e};1===e.length&&e[0].msg&&Object.assign(n,u({},e[0]),{level:y.ERROR}),this.normalLogPipeline(n)},e.prototype.reportEvent=function(e){if(e){var t="string"==typeof e?{name:e,ext1:this.config.ext1||"",ext2:this.config.ext2||"",ext3:this.config.ext3||""}:e;t.name?("string"!=typeof t.name&&(console.warn("reportEvent params name must be string"),t.name=String(t.name)),this.eventPipeline(t)):console.warn("reportEvent params error")}},e.prototype.reportT=function(e){var t=e.name,n=e.duration,r=e.ext1,o=void 0===r?"":r,i=e.ext2,s=void 0===i?"":i,l=e.ext3,c=void 0===l?"":l,a=e.from,u=void 0===a?"":a;if("string"==typeof t&&"number"==typeof n&&"string"==typeof o&&"string"==typeof s&&"string"==typeof c){if(!(n<0||n>2147483646))return this.submitCustomTime(t,n,o,s,c,u);console.warn("reportTime: duration must between 0 and 2147483646")}else console.warn("reportTime: params error")},e.prototype.reportTime=function(e,t){if("object"==typeof e)return this.reportT(e);"string"==typeof e?"number"==typeof t?t<0||t>2147483646?console.warn("reportTime: duration must between 0 and 2147483646"):(this.submitCustomTime(e,t),this.normalLogPipeline({level:y.SPEED_EVENT,msg:"key:"+e+"\n duration:"+t,errorMsg:""})):console.warn("reportTime: second param must be number"):console.warn("reportTime: first param must be a string")},e.prototype.time=function(e){"string"==typeof e?this.timeMap[e]?console.warn("Timer "+e+" already exists"):this.timeMap[e]=Date.now():console.warn("time: first param must be a string")},e.prototype.timeEnd=function(e){"string"==typeof e?this.timeMap[e]?(this.submitCustomTime(e,Date.now()-this.timeMap[e]),delete this.timeMap[e]):console.warn("Timer "+e+" does not exist"):console.warn("timeEnd: first param must be a string")},e.prototype.ready=function(e,t,n){throw new Error('You need to override "ready" method')},e.prototype.request=function(e,t,n){throw new Error('You need to override "request" method')},e.prototype.speedLogPipeline=function(e){throw new Error('You need to override "speedLogPipeline" method')},Object.defineProperty(e.prototype,"__version__",{get:function(){return"1.43.25"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"LogType",{get:function(){return y},enumerable:!1,configurable:!0}),e.prototype.reportPv=function(e){e&&console.warn("reportPv is deprecated, please use reportEvent")},e.prototype.submitCustomTime=function(e,t,n,r,o,i){this.customTimePipeline({name:e,duration:t,ext1:n||this.config.ext1,ext2:r||this.config.ext2,ext3:o||this.config.ext3,from:i||void 0})},e.version="1.43.25",e.instances=[],e.logType=y,e.environment=E,e.installedPlugins=[],e}();!function(e){e[e.IP=0]="IP",e[e.HOST=1]="HOST",e[e.L5=2]="L5",e[e.POLARIS=3]="POLARIS"}(V||(V={}));var z=function(){function e(e){this.selectorConf=e,this.defaultSpeedBaseUrl="rumt-zh.com/speed",this.defaultLogBaseurl="rumt-zh.com"}return e.prototype.replaceUrl=function(e,t,n){return e.replace(/(^http[s]?:\/\/)?/,"").replace(this.defaultSpeedBaseUrl,t).replace(this.defaultLogBaseurl,n)},e}(),Y=function(e){function t(t){var n=e.call(this,t)||this;if("host"===n.selectorConf.type)n.selectorConf.logBaseUrl=n.selectorConf.logBaseUrl||n.defaultLogBaseurl,n.selectorConf.speedBaseUrl=n.selectorConf.speedBaseUrl||n.defaultSpeedBaseUrl;else if(!("ip"!==n.selectorConf.type||n.selectorConf.logBaseUrl&&n.selectorConf.speedBaseUrl))throw new Error("logBaseUrl or speedBaseUrl required");return n}return a(t,e),t.prototype.select=function(e){var t=null;"host"===this.selectorConf.type?t=V.HOST:"ip"===this.selectorConf.type&&(t=V.IP);var n=this.replaceUrl(e,this.selectorConf.speedBaseUrl,this.selectorConf.logBaseUrl);return Promise.resolve([{type:t,url:n,ctx:null},null])},t.prototype.update=function(){},t}(z),Q=require("../../polaris/dist/index.js").Consumer,X=function(e){function t(t){var n=e.call(this,t)||this;n.namespace="Production";var r="polaris://"+(n.selectorConf.logBaseUrl||"tam_log_svr?ns=Production"),o="polaris://"+(n.selectorConf.speedBaseUrl||"tam_speed_svr?ns=Production");return n.logPolarisInfo=n.parseUrlToPolarisInfo(r),n.speedPolarisInfo=n.parseUrlToPolarisInfo(o),n}return a(t,e),t.prototype.select=function(e){return f(this,void 0,void 0,(function(){var n,r,o,i,s,l,c,a;return p(this,(function(u){switch(u.label){case 0:n=e.indexOf(this.defaultSpeedBaseUrl)>-1?this.speedPolarisInfo:this.logPolarisInfo,u.label=1;case 1:return u.trys.push([1,3,,4]),[4,t.consumer.select(n.namespace,n.service)];case 2:return r=u.sent(),[3,4];case 3:return o=u.sent(),[2,[null,new Error("polaris exception with "+o.message)]];case 4:return r?(i=r.instance,s=i.host,l=i.port,c=s+":"+l,a="http://"+(a=this.replaceUrl(e,c+"/speed",c)),[2,[{type:V.POLARIS,url:a,ctx:r},null]]):[2,[null,new Error("polaris select no response")]]}}))}))},t.prototype.update=function(e,t){e&&"function"==typeof e.update&&e.update(t.success,t.cost,"number"==typeof t.code?t.code.toString():void 0)},t.prototype.parseUrlToPolarisInfo=function(e){var t=i.parse(e),n=t.host;return{namespace:s.parse(t.query||"").ns||"",service:n}},t.consumer=new Q({},{logVerbosity:0}),t}(z),Z=function(e){this.keepalive=!1,this.selector=e.selector,this.protocol=e.protocol,this.keepalive=e.keepalive},$=require("agentkeepalive"),ee=function(e){function t(t){var n=e.call(this,t)||this;if(n.isHttps=!1,"https"===n.protocol&&(n.isHttps=!0),n.keepalive){var r={keepAlive:!0,keepAliveMsecs:2e3,freeSocketTimeout:5e3,maxSockets:20,maxFreeSockets:10};n.isHttps?n.agent=new $.HttpsAgent(r):n.agent=new $(r)}return n}return a(t,e),t.prototype.send=function(e,t){var n;return f(this,void 0,void 0,(function(){var r,o,i,s,c,a,u=this;return p(this,(function(f){switch(f.label){case 0:return r=e.url,[4,this.selector.select(r)];case 1:if(o=f.sent(),i=o[0],s=o[1])return console.error("[service selector err] "+s.message),[2];if(r=/^http[s]?:\/\//.test(i.url||"")?i.url:(this.isHttps?"https://":"http://")+i.url,!1!==e.addBean&&t.bean&&(r=r+(-1===r.indexOf("?")?"?":"&")+t.bean),"post"===(null===(n=e.method)||void 0===n?void 0:n.toLowerCase())&&"string"==typeof e.data)try{e.data=JSON.parse(e.data)}catch(e){}return c=Date.now(),a={url:r,method:"post",data:e.data,timeout:3e3},this.agent&&(this.isHttps?a.httpsAgent=this.agent:a.httpAgent=this.agent),l.default(a).then((function(e){var n,r={success:!0,code:0,cost:Date.now()-c};u.selector.update(i.ctx,r),null===(n=t.success)||void 0===n||n.call(t,JSON.stringify(e.data))})).catch((function(n){var o,s;if(console.error("[aegis server access err] url = "+r+"; message = "+(null==n?void 0:n.message)),(null===(o=null==n?void 0:n.request)||void 0===o?void 0:o.reusedSocket)&&"ECONNRESET"===n.code)return console.error("[aegis connection retry] reason: connection reset on reused socket"),void u.send(e,t);var l={success:!1,code:-1,cost:Date.now()-c};u.selector.update(i.ctx,l),null===(s=t.fail)||void 0===s||s.call(t,n)})),[2]}}))}))},t}(Z),te=function(e,t){var n,r=[],o=t||{},i=o.maxLength,s=o.batchNum;return function(o,l){if(r.push(o),i&&r.length>=i&&l(r.splice(0,r.length)),void 0===n){var c=function(){var o,i=null===(o=null==t?void 0:t.allowNextRound)||void 0===o?void 0:o.call(t);if(void 0===i&&(i=!0),!i)return clearTimeout(n),void(n=void 0);n=setTimeout((function(){var e=r.splice(0,s||10);e.length>0&&l(e),r.length>0?c():n=void 0}),(null==e?void 0:e.batchReportInterval)||1e3)};c()}}},ne={host:"ip_selector",ip:"ip_selector",polaris:"polaris_selector"},re={http:"protocol_http",https:"protocol_http"};return function(e){function t(n){var r=e.call(this,n)||this;r.reportSpeedLog=W([te(r.config,{batchNum:5,maxLength:50}),function(e,t){r.lifeCycle.emit("beforeReportSpeed",e);var n=r.config.beforeReportSpeed;if("function"==typeof n&&(e=e.filter((function(e){return!1!==n(e)}))),e.length)return t(e)},M(r,R.SPEED),function(e){var t={fetch:[]};e.forEach((function(e){return t.fetch.push(e)})),r.send({url:""+r.config.speedUrl,method:"post",data:"payload="+encodeURIComponent(JSON.stringify({duration:t}))})}]),r.config.repeat=0;try{r.init(n),r.bean.sessionId=t.sessionID,r.bean.from=n.pageUrl||"",r.initSelector(),r.initProtocol()}catch(e){console.warn(e),console.log("%cThe above error occurred in the process of initializing Aegis, which will affect your normal use of Aegis.\nIt is recommended that you contact us for feedback and thank you for your support.","color: red"),r.sendSDKError(e)}return r}return a(t,e),t.prototype.request=function(e,t,n){if(e&&"string"==typeof e.url&&this.bean.id)return"string"==typeof e.url?~e.url.indexOf("/whitelist")?null==t?void 0:t('{"retcode":0,"result":{"is_in_white_list":true}}'):void this.reqProtocol.send(e,{success:t,fail:n,bean:this.getBean}):void 0},t.prototype.setSessionID=function(e){this.extendBean("sessionId",e||"session-"+Date.now())},t.prototype.initSelector=function(){if(this.config.selector=this.config.selector||{type:"polaris"},!this.config.selector.type)throw new Error("selector type 不能为空");var e;switch(this.config.selector.type){case"host":case"ip":e=Y;break;case"polaris":e=X;break;default:throw new Error("selector 类型非法,可选值: "+Object.keys(ne).toString())}this.selector=new e(this.config.selector)},t.prototype.initProtocol=function(){var e,t;if(this.config.protocol||("host"===(null===(e=this.config.selector)||void 0===e?void 0:e.type)?this.config.protocol="https":this.config.protocol="http"),-1===Object.keys(re).indexOf(this.config.protocol))throw new Error("unknown protocol");switch(this.config.protocol){case"http":case"https":t=ee;break;default:throw new Error("selector 类型非法,可选值: "+Object.keys(re).toString())}this.reqProtocol=new t({selector:this.selector,protocol:this.config.protocol,keepalive:"boolean"==typeof this.config.keepalive&&this.config.keepalive})},Object.defineProperty(t.prototype,"getBean",{get:function(){var e=this;return Object.getOwnPropertyNames(this.bean||{}).map((function(t){return t+"="+e.bean[t]})).join("&")},enumerable:!1,configurable:!0}),t.sessionID="session-"+Date.now(),t}(K)}));
@@ -1,14 +0,0 @@
1
- import { Config } from '../interface';
2
- export declare const REPORT_TIMEOUT = 5000;
3
- export declare const MAX_FAIL_REQUEST_NUM = 60;
4
- export declare const MAX_LOG_LENGTH: number;
5
- export declare const MAX_FROM_LENGTH: number;
6
- export declare const TIMESTAMP_REG: RegExp;
7
- export declare const MAX_REPEAT_TIMES = 60;
8
- export declare const CLEAR_REPEAT_CACHE_TIMEOUT = 60000;
9
- export declare const MAX_CUSTOM_TIME = 2147483646;
10
- export declare const MAX_ERROR_COUNT = 5;
11
- export declare const FORBIDDEN_RESPONSE_DATA = "403 forbidden";
12
- export declare const MAX_PROMISE_ERROR_MSG_LENGTH = 150;
13
- export declare const getDefaultConfig: () => Config;
14
- export declare const setConfigUrl: (config: Config, hostUrl?: string) => Config;
@@ -1 +0,0 @@
1
- export declare const globalAny: any;
@@ -1,9 +0,0 @@
1
- export { getDefaultConfig, setConfigUrl, REPORT_TIMEOUT, MAX_FAIL_REQUEST_NUM, MAX_LOG_LENGTH, MAX_FROM_LENGTH, MAX_REPEAT_TIMES, CLEAR_REPEAT_CACHE_TIMEOUT, FORBIDDEN_RESPONSE_DATA, TIMESTAMP_REG, MAX_CUSTOM_TIME, MAX_ERROR_COUNT, MAX_PROMISE_ERROR_MSG_LENGTH, } from './config';
2
- export { URL_SPEED_IGNORE, ERROR_MSG_IGNORE, } from './report-ignore';
3
- export declare const COMPLETION_KEYS: string[];
4
- export declare const RESOURCE_TYPE_STATIC = "static";
5
- export declare const RESOURCE_TYPE_FETCH = "fetch";
6
- export declare const RESOURCE_TYPE: string[];
7
- export declare const UNKNOWN = "unknown";
8
- export declare const UNKNOWN_CHINESE = "\u672A\u77E5";
9
- export * from './global';
@@ -1,2 +0,0 @@
1
- export declare const URL_SPEED_IGNORE: string[];
2
- export declare const ERROR_MSG_IGNORE: string[];