@tencentcloud/sdk-mcp 1.2.6 → 1.2.8
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/package.json +1 -1
- package/resource/doc/chatuikit/faq/common/server_error_code.md +74 -0
- package/resource/doc/chatuikit/faq/{freq_qa.md → native_sdk/faq.md} +2 -1
- package/resource/doc/chatuikit/faq/web_sdk/error_code.md +47 -0
- package/resource/doc/chatuikit/faq/web_sdk/faq.md +115 -0
- package/resource/doc/chatuikit/flutter/faq.md +117 -0
- package/resource/doc/chatuikit/iOS/faq.md +117 -0
- package/resource/doc/chatuikit/react/faq.md +26 -0
- package/resource/doc/chatuikit/vue/faq.md +35 -0
- package/resource/doc/livekit/faq/common/error_code.md +89 -0
- package/resource/doc/roomkit/common/error_code.md +67 -0
- package/resource/doc/rtcengine/faq/web_sdk/.gitkeep +0 -0
- package/resource/doc/tuicallkit/android/faq.md +1000 -0
- package/resource/doc/tuicallkit/faq/common/error_code.md +47 -0
- package/resource/doc/tuicallkit/flutter/faq.md +981 -0
- package/resource/doc/tuicallkit/{faq → iOS}/faq.md +0 -72
- package/resource/doc/tuicallkit/react/faq.md +986 -0
- package/resource/doc/tuicallkit/vue/faq.md +986 -0
- package/tools/call/get-native-call-integration.js +4 -10
- package/tools/call/get-native-call-integration.js.map +1 -1
- package/tools/call/get-web-call-api.js +4 -7
- package/tools/call/get-web-call-api.js.map +1 -1
- package/tools/call/get-web-call-integration.js +4 -9
- package/tools/call/get-web-call-integration.js.map +1 -1
- package/tools/chat/get-native-chat-integration.js +4 -8
- package/tools/chat/get-native-chat-integration.js.map +1 -1
- package/tools/chat/get-web-chat-component-detail.js +5 -10
- package/tools/chat/get-web-chat-component-detail.js.map +1 -1
- package/tools/chat/get-web-chat-integration.js +4 -12
- package/tools/chat/get-web-chat-integration.js.map +1 -1
- package/tools/chat/get-web-chat-uikit-init.js +5 -6
- package/tools/chat/get-web-chat-uikit-init.js.map +1 -1
- package/tools/chat/get-web-chat-window-integration.js +4 -12
- package/tools/chat/get-web-chat-window-integration.js.map +1 -1
- package/tools/chat/{create-group.js → get-web-create-group-doc.js} +5 -6
- package/tools/chat/get-web-create-group-doc.js.map +1 -0
- package/tools/common/get-faq.js +93 -0
- package/tools/common/get-faq.js.map +1 -0
- package/tools/common/get-usersig.js +9 -18
- package/tools/common/get-usersig.js.map +1 -1
- package/tools/common/present-framework-choice.js +3 -10
- package/tools/common/present-framework-choice.js.map +1 -1
- package/tools/common/record-prompt.js +5 -12
- package/tools/common/record-prompt.js.map +1 -1
- package/tools/common/record-result.js +7 -11
- package/tools/common/record-result.js.map +1 -1
- package/tools/definitions/get_faq_def.js +28 -0
- package/tools/definitions/get_faq_def.js.map +1 -0
- package/tools/definitions/get_native_call_uikit_integration_def.js +21 -0
- package/tools/definitions/get_native_call_uikit_integration_def.js.map +1 -0
- package/tools/definitions/get_native_chat_uikit_integration_def.js +21 -0
- package/tools/definitions/get_native_chat_uikit_integration_def.js.map +1 -0
- package/tools/definitions/get_usersig_def.js +34 -0
- package/tools/definitions/get_usersig_def.js.map +1 -0
- package/tools/definitions/get_web_call_uikit_api_def.js +23 -0
- package/tools/definitions/get_web_call_uikit_api_def.js.map +1 -0
- package/tools/definitions/get_web_call_uikit_integration_def.js +20 -0
- package/tools/definitions/get_web_call_uikit_integration_def.js.map +1 -0
- package/tools/definitions/get_web_chat_uikit_component_detail_def.js +24 -0
- package/tools/definitions/get_web_chat_uikit_component_detail_def.js.map +1 -0
- package/tools/definitions/get_web_chat_uikit_init_def.js +23 -0
- package/tools/definitions/get_web_chat_uikit_init_def.js.map +1 -0
- package/tools/definitions/get_web_chat_uikit_integration_def.js +26 -0
- package/tools/definitions/get_web_chat_uikit_integration_def.js.map +1 -0
- package/tools/definitions/get_web_chat_window_integration_def.js +26 -0
- package/tools/definitions/get_web_chat_window_integration_def.js.map +1 -0
- package/tools/definitions/get_web_create_group_doc_def.js +18 -0
- package/tools/definitions/get_web_create_group_doc_def.js.map +1 -0
- package/tools/definitions/get_web_live_state_detail_def.js +19 -0
- package/tools/definitions/get_web_live_state_detail_def.js.map +1 -0
- package/tools/definitions/get_web_live_uikit_component_detail_def.js +21 -0
- package/tools/definitions/get_web_live_uikit_component_detail_def.js.map +1 -0
- package/tools/definitions/get_web_room_state_detail_def.js +19 -0
- package/tools/definitions/get_web_room_state_detail_def.js.map +1 -0
- package/tools/definitions/present_framework_choice_def.js +24 -0
- package/tools/definitions/present_framework_choice_def.js.map +1 -0
- package/tools/definitions/record_prompt_def.js +22 -0
- package/tools/definitions/record_prompt_def.js.map +1 -0
- package/tools/definitions/record_result_def.js +22 -0
- package/tools/definitions/record_result_def.js.map +1 -0
- package/tools/index.js +7 -9
- package/tools/index.js.map +1 -1
- package/tools/live/get-web-live-component-detail.js +5 -7
- package/tools/live/get-web-live-component-detail.js.map +1 -1
- package/tools/live/get-web-live-state-detail.js +5 -7
- package/tools/live/get-web-live-state-detail.js.map +1 -1
- package/tools/room/get-web-room-state-detail.js +5 -7
- package/tools/room/get-web-room-state-detail.js.map +1 -1
- package/utils/report-cls-client.js +1 -1
- package/utils/report-es-client.js +1 -1
- package/libs/@tencent/aegis-node-sdk/CHANGELOG.md +0 -8
- package/libs/@tencent/aegis-node-sdk/LICENSE +0 -21
- package/libs/@tencent/aegis-node-sdk/README.md +0 -562
- package/libs/@tencent/aegis-node-sdk/lib/aegis.min.js +0 -1
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/config.d.ts +0 -14
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/global.d.ts +0 -1
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/index.d.ts +0 -9
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/report-ignore.d.ts +0 -2
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/core.d.ts +0 -85
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/afterRequestHooks.d.ts +0 -3
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/beforeRequestHooks.d.ts +0 -9
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/modifyRequestHooks.d.ts +0 -3
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/index.d.ts +0 -9
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/config.d.ts +0 -62
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/env.d.ts +0 -11
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/index.d.ts +0 -4
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/log.d.ts +0 -130
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/send.d.ts +0 -34
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/format.d.ts +0 -2
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/index.d.ts +0 -18
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/length-limit.d.ts +0 -8
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/pv.d.ts +0 -8
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/remove-payload.d.ts +0 -2
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/repeat-limit.d.ts +0 -4
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/report.d.ts +0 -10
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/sample.d.ts +0 -3
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/throttle.d.ts +0 -3
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/index.d.ts +0 -34
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/jwt.d.ts +0 -12
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/ot-js.d.ts +0 -14
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/uuid.d.ts +0 -2
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/whitelist.d.ts +0 -12
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/write-before.d.ts +0 -3
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/plugin.d.ts +0 -33
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/destroy.d.ts +0 -2
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/event-emitter.d.ts +0 -18
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/index.d.ts +0 -60
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/index.d.ts +0 -15
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/interface/selector.d.ts +0 -5
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/pipes/batch-report-pipe.d.ts +0 -6
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_base.d.ts +0 -18
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_http.d.ts +0 -12
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/ip_selector.d.ts +0 -10
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/polaris_selector.d.ts +0 -20
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/selector_base.d.ts +0 -27
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/util/eval_require.d.ts +0 -2
- package/libs/@tencent/aegis-node-sdk/package.json +0 -19
- package/libs/@tencent/polaris/README.md +0 -407
- package/libs/@tencent/polaris/dist/consumer/health.d.ts +0 -126
- package/libs/@tencent/polaris/dist/consumer/health.js +0 -283
- package/libs/@tencent/polaris/dist/consumer/health.js.map +0 -1
- package/libs/@tencent/polaris/dist/consumer/index.d.ts +0 -120
- package/libs/@tencent/polaris/dist/consumer/index.js +0 -348
- package/libs/@tencent/polaris/dist/consumer/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/consumer/monitor.d.ts +0 -145
- package/libs/@tencent/polaris/dist/consumer/monitor.js +0 -343
- package/libs/@tencent/polaris/dist/consumer/monitor.js.map +0 -1
- package/libs/@tencent/polaris/dist/consumer/selector.d.ts +0 -73
- package/libs/@tencent/polaris/dist/consumer/selector.js +0 -316
- package/libs/@tencent/polaris/dist/consumer/selector.js.map +0 -1
- package/libs/@tencent/polaris/dist/errors.d.ts +0 -373
- package/libs/@tencent/polaris/dist/errors.js +0 -154
- package/libs/@tencent/polaris/dist/errors.js.map +0 -1
- package/libs/@tencent/polaris/dist/global.d.ts +0 -16
- package/libs/@tencent/polaris/dist/global.js +0 -18
- package/libs/@tencent/polaris/dist/global.js.map +0 -1
- package/libs/@tencent/polaris/dist/index.d.ts +0 -62
- package/libs/@tencent/polaris/dist/index.js +0 -145
- package/libs/@tencent/polaris/dist/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/instance.d.ts +0 -109
- package/libs/@tencent/polaris/dist/instance.js +0 -38
- package/libs/@tencent/polaris/dist/instance.js.map +0 -1
- package/libs/@tencent/polaris/dist/limiter/bucket.d.ts +0 -51
- package/libs/@tencent/polaris/dist/limiter/bucket.js +0 -152
- package/libs/@tencent/polaris/dist/limiter/bucket.js.map +0 -1
- package/libs/@tencent/polaris/dist/limiter/index.d.ts +0 -73
- package/libs/@tencent/polaris/dist/limiter/index.js +0 -149
- package/libs/@tencent/polaris/dist/limiter/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/limiter/ratelimit.d.ts +0 -27
- package/libs/@tencent/polaris/dist/limiter/ratelimit.js +0 -134
- package/libs/@tencent/polaris/dist/limiter/ratelimit.js.map +0 -1
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.d.ts +0 -17
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.js +0 -15
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.js.map +0 -1
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.d.ts +0 -59
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.js +0 -397
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.js.map +0 -1
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.d.ts +0 -3
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.js +0 -19
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.d.ts +0 -17
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.js +0 -52
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.js.map +0 -1
- package/libs/@tencent/polaris/dist/location.d.ts +0 -48
- package/libs/@tencent/polaris/dist/location.js +0 -67
- package/libs/@tencent/polaris/dist/location.js.map +0 -1
- package/libs/@tencent/polaris/dist/logging.d.ts +0 -106
- package/libs/@tencent/polaris/dist/logging.js +0 -130
- package/libs/@tencent/polaris/dist/logging.js.map +0 -1
- package/libs/@tencent/polaris/dist/metadata.d.ts +0 -78
- package/libs/@tencent/polaris/dist/metadata.js +0 -119
- package/libs/@tencent/polaris/dist/metadata.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/breaker/polaris.d.ts +0 -47
- package/libs/@tencent/polaris/dist/plugins/breaker/polaris.js +0 -162
- package/libs/@tencent/polaris/dist/plugins/breaker/polaris.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/lb/base.d.ts +0 -24
- package/libs/@tencent/polaris/dist/plugins/lb/base.js +0 -32
- package/libs/@tencent/polaris/dist/plugins/lb/base.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/lb/edf.d.ts +0 -24
- package/libs/@tencent/polaris/dist/plugins/lb/edf.js +0 -77
- package/libs/@tencent/polaris/dist/plugins/lb/edf.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/lb/hashring.d.ts +0 -24
- package/libs/@tencent/polaris/dist/plugins/lb/hashring.js +0 -53
- package/libs/@tencent/polaris/dist/plugins/lb/hashring.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/lb/sticky.d.ts +0 -31
- package/libs/@tencent/polaris/dist/plugins/lb/sticky.js +0 -88
- package/libs/@tencent/polaris/dist/plugins/lb/sticky.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/lb/swrr.d.ts +0 -25
- package/libs/@tencent/polaris/dist/plugins/lb/swrr.js +0 -72
- package/libs/@tencent/polaris/dist/plugins/lb/swrr.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/lb/wr.d.ts +0 -17
- package/libs/@tencent/polaris/dist/plugins/lb/wr.js +0 -50
- package/libs/@tencent/polaris/dist/plugins/lb/wr.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/lb/wrr.d.ts +0 -19
- package/libs/@tencent/polaris/dist/plugins/lb/wrr.js +0 -81
- package/libs/@tencent/polaris/dist/plugins/lb/wrr.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/logging/console.d.ts +0 -10
- package/libs/@tencent/polaris/dist/plugins/logging/console.js +0 -38
- package/libs/@tencent/polaris/dist/plugins/logging/console.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.d.ts +0 -32
- package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.js +0 -88
- package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.d.ts +0 -124
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js +0 -398
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.d.ts +0 -27
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js +0 -287
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.d.ts +0 -15
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js +0 -43
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.d.ts +0 -28
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js +0 -249
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.d.ts +0 -19
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js +0 -222
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.d.ts +0 -26
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js +0 -99
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.d.ts +0 -60
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js +0 -259
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/discover.proto +0 -24
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/monitor.proto +0 -18
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/ratelimit.proto +0 -12
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.d.ts +0 -39
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js +0 -115
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/api.proto +0 -24
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/client.proto +0 -22
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/model.proto +0 -28
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/ratelimit.proto +0 -80
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/request.proto +0 -18
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/response.proto +0 -65
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/routing.proto +0 -66
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/service.proto +0 -95
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/types.d.ts +0 -1568
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.d.ts +0 -36
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.js +0 -51
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/api.proto +0 -18
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/circuitbreak.proto +0 -67
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/request.proto +0 -82
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/response.proto +0 -11
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkcache.proto +0 -46
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkconfiguration.proto +0 -16
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdktoken.proto +0 -10
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/types.d.ts +0 -1102
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.d.ts +0 -29
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js +0 -77
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/api.proto +0 -12
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/ratelimit.proto +0 -28
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/types.d.ts +0 -395
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.d.ts +0 -13
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js +0 -116
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.d.ts +0 -67
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.js +0 -67
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.d.ts +0 -99
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js +0 -217
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/registry/memory.d.ts +0 -10
- package/libs/@tencent/polaris/dist/plugins/registry/memory.js +0 -50
- package/libs/@tencent/polaris/dist/plugins/registry/memory.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.d.ts +0 -51
- package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.js +0 -145
- package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.d.ts +0 -11
- package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.js +0 -174
- package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.d.ts +0 -25
- package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.js +0 -36
- package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/router/trpc/env.d.ts +0 -10
- package/libs/@tencent/polaris/dist/plugins/router/trpc/env.js +0 -34
- package/libs/@tencent/polaris/dist/plugins/router/trpc/env.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/router/trpc/set.d.ts +0 -56
- package/libs/@tencent/polaris/dist/plugins/router/trpc/set.js +0 -106
- package/libs/@tencent/polaris/dist/plugins/router/trpc/set.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/shaping/unirate.d.ts +0 -31
- package/libs/@tencent/polaris/dist/plugins/shaping/unirate.js +0 -124
- package/libs/@tencent/polaris/dist/plugins/shaping/unirate.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/shaping/warmup.d.ts +0 -61
- package/libs/@tencent/polaris/dist/plugins/shaping/warmup.js +0 -171
- package/libs/@tencent/polaris/dist/plugins/shaping/warmup.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins/weight/polaris.d.ts +0 -23
- package/libs/@tencent/polaris/dist/plugins/weight/polaris.js +0 -159
- package/libs/@tencent/polaris/dist/plugins/weight/polaris.js.map +0 -1
- package/libs/@tencent/polaris/dist/plugins.d.ts +0 -619
- package/libs/@tencent/polaris/dist/plugins.js +0 -91
- package/libs/@tencent/polaris/dist/plugins.js.map +0 -1
- package/libs/@tencent/polaris/dist/polaris.d.ts +0 -33
- package/libs/@tencent/polaris/dist/polaris.js +0 -59
- package/libs/@tencent/polaris/dist/polaris.js.map +0 -1
- package/libs/@tencent/polaris/dist/provider/index.d.ts +0 -102
- package/libs/@tencent/polaris/dist/provider/index.js +0 -168
- package/libs/@tencent/polaris/dist/provider/index.js.map +0 -1
- package/libs/@tencent/polaris/dist/registry.d.ts +0 -174
- package/libs/@tencent/polaris/dist/registry.js +0 -660
- package/libs/@tencent/polaris/dist/registry.js.map +0 -1
- package/libs/@tencent/polaris/dist/rules.d.ts +0 -163
- package/libs/@tencent/polaris/dist/rules.js +0 -24
- package/libs/@tencent/polaris/dist/rules.js.map +0 -1
- package/libs/@tencent/polaris/dist/scripts/postinstall.d.ts +0 -1
- package/libs/@tencent/polaris/dist/scripts/postinstall.js +0 -71
- package/libs/@tencent/polaris/dist/scripts/postinstall.js.map +0 -1
- package/libs/@tencent/polaris/dist/service.d.ts +0 -18
- package/libs/@tencent/polaris/dist/service.js +0 -3
- package/libs/@tencent/polaris/dist/service.js.map +0 -1
- package/libs/@tencent/polaris/dist/skeleton.d.ts +0 -87
- package/libs/@tencent/polaris/dist/skeleton.js +0 -282
- package/libs/@tencent/polaris/dist/skeleton.js.map +0 -1
- package/libs/@tencent/polaris/dist/utils.d.ts +0 -36
- package/libs/@tencent/polaris/dist/utils.js +0 -74
- package/libs/@tencent/polaris/dist/utils.js.map +0 -1
- package/libs/@tencent/polaris/dist/weak.d.ts +0 -11
- package/libs/@tencent/polaris/dist/weak.js +0 -44
- package/libs/@tencent/polaris/dist/weak.js.map +0 -1
- package/libs/@tencent/polaris/package.json +0 -114
- package/resource/doc/chatuikit/faq/web_qa.md +0 -118
- package/tools/call/get-call-faq.js +0 -29
- package/tools/call/get-call-faq.js.map +0 -1
- package/tools/chat/create-group.js.map +0 -1
- package/tools/chat/get-chat-faq.js +0 -29
- package/tools/chat/get-chat-faq.js.map +0 -1
- /package/resource/doc/chatuikit/{faq/sdk_qa.md → android/faq.md} +0 -0
- /package/{libs/@tencent/aegis-node-sdk/lib/packages/core/src/polyfill.d.ts → resource/doc/livekit/vue/faq.md} +0 -0
- /package/resource/doc/{chatuikit/faq/vue_qa.md → roomkit/vue/faq.md} +0 -0
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mirror of `PolarisService.DiscoverResponse.DiscoverResponseType`
|
|
3
|
-
*/
|
|
4
|
-
export declare enum DiscoverRequestType {
|
|
5
|
-
UNKNOWN = 0,
|
|
6
|
-
INSTANCE = 1,
|
|
7
|
-
CLUSTER = 2,
|
|
8
|
-
ROUTING = 3,
|
|
9
|
-
RATE_LIMIT = 4
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Mirror of `PolarisService.MatchString.MatchStringType`
|
|
13
|
-
*/
|
|
14
|
-
export declare enum MatchStringType {
|
|
15
|
-
EXACT = 0,
|
|
16
|
-
REGEX = 1
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Mirror of `PolarisService.MatchString.ValueType`
|
|
20
|
-
*/
|
|
21
|
-
export declare enum ValueType {
|
|
22
|
-
TEXT = 0,
|
|
23
|
-
PARAMETER = 1,
|
|
24
|
-
VARIABLE = 2
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Mirror of `MonitorService.StatusChange`
|
|
28
|
-
*/
|
|
29
|
-
export declare enum StatusChange {
|
|
30
|
-
Unknown = 0,
|
|
31
|
-
CloseToOpen = 1,
|
|
32
|
-
OpenToHalfOpen = 2,
|
|
33
|
-
HalfOpenToOpen = 3,
|
|
34
|
-
HalfOpenToClose = 4
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Mirror of `MonitorService.RecoverAllStatus`
|
|
38
|
-
*/
|
|
39
|
-
export declare enum RecoverAllStatus {
|
|
40
|
-
Invalid = 0,
|
|
41
|
-
Start = 1,
|
|
42
|
-
End = 2
|
|
43
|
-
}
|
|
44
|
-
export interface BoxType<T> {
|
|
45
|
-
value?: T | null;
|
|
46
|
-
}
|
|
47
|
-
export interface Boxable {
|
|
48
|
-
unbox<T>(value: BoxType<T> | T | null | undefined, defaultValue: T | (() => T)): T;
|
|
49
|
-
box<T>(value: T): BoxType<T> | T | null | undefined;
|
|
50
|
-
}
|
|
51
|
-
export declare type DeconstructorWrappers<T> = {
|
|
52
|
-
[P in keyof T]: NonNullable<T[P]> extends BoxType<unknown> ? keyof NonNullable<T[P]> extends "value" ? NonNullable<Extract<T[P], BoxType<unknown>>["value"]> | T[P] : DeconstructorWrappers<NonNullable<T[P]>> : DeconstructorWrappers<NonNullable<T[P]>>;
|
|
53
|
-
};
|
|
54
|
-
export declare enum ServiceType {
|
|
55
|
-
Discover = 0,
|
|
56
|
-
Monitor = 1,
|
|
57
|
-
Ratelimit = 2
|
|
58
|
-
}
|
|
59
|
-
export interface ServiceInfo<DiscoverType, MonitorType, RatelimitType> {
|
|
60
|
-
[ServiceType.Discover]: DiscoverType;
|
|
61
|
-
[ServiceType.Monitor]: MonitorType;
|
|
62
|
-
[ServiceType.Ratelimit]: RatelimitType;
|
|
63
|
-
}
|
|
64
|
-
export declare enum ClientType {
|
|
65
|
-
SDK = 0,
|
|
66
|
-
AGENT = 1
|
|
67
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientType = exports.ServiceType = exports.RecoverAllStatus = exports.StatusChange = exports.ValueType = exports.MatchStringType = exports.DiscoverRequestType = void 0;
|
|
4
|
-
// #region enum mirrors
|
|
5
|
-
/**
|
|
6
|
-
* Mirror of `PolarisService.DiscoverResponse.DiscoverResponseType`
|
|
7
|
-
*/
|
|
8
|
-
var DiscoverRequestType;
|
|
9
|
-
(function (DiscoverRequestType) {
|
|
10
|
-
DiscoverRequestType[DiscoverRequestType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
11
|
-
DiscoverRequestType[DiscoverRequestType["INSTANCE"] = 1] = "INSTANCE";
|
|
12
|
-
DiscoverRequestType[DiscoverRequestType["CLUSTER"] = 2] = "CLUSTER";
|
|
13
|
-
DiscoverRequestType[DiscoverRequestType["ROUTING"] = 3] = "ROUTING";
|
|
14
|
-
DiscoverRequestType[DiscoverRequestType["RATE_LIMIT"] = 4] = "RATE_LIMIT";
|
|
15
|
-
})(DiscoverRequestType = exports.DiscoverRequestType || (exports.DiscoverRequestType = {}));
|
|
16
|
-
/**
|
|
17
|
-
* Mirror of `PolarisService.MatchString.MatchStringType`
|
|
18
|
-
*/
|
|
19
|
-
var MatchStringType;
|
|
20
|
-
(function (MatchStringType) {
|
|
21
|
-
MatchStringType[MatchStringType["EXACT"] = 0] = "EXACT";
|
|
22
|
-
MatchStringType[MatchStringType["REGEX"] = 1] = "REGEX";
|
|
23
|
-
})(MatchStringType = exports.MatchStringType || (exports.MatchStringType = {}));
|
|
24
|
-
/**
|
|
25
|
-
* Mirror of `PolarisService.MatchString.ValueType`
|
|
26
|
-
*/
|
|
27
|
-
var ValueType;
|
|
28
|
-
(function (ValueType) {
|
|
29
|
-
ValueType[ValueType["TEXT"] = 0] = "TEXT";
|
|
30
|
-
ValueType[ValueType["PARAMETER"] = 1] = "PARAMETER";
|
|
31
|
-
ValueType[ValueType["VARIABLE"] = 2] = "VARIABLE";
|
|
32
|
-
})(ValueType = exports.ValueType || (exports.ValueType = {}));
|
|
33
|
-
/**
|
|
34
|
-
* Mirror of `MonitorService.StatusChange`
|
|
35
|
-
*/
|
|
36
|
-
var StatusChange;
|
|
37
|
-
(function (StatusChange) {
|
|
38
|
-
StatusChange[StatusChange["Unknown"] = 0] = "Unknown";
|
|
39
|
-
StatusChange[StatusChange["CloseToOpen"] = 1] = "CloseToOpen";
|
|
40
|
-
StatusChange[StatusChange["OpenToHalfOpen"] = 2] = "OpenToHalfOpen";
|
|
41
|
-
StatusChange[StatusChange["HalfOpenToOpen"] = 3] = "HalfOpenToOpen";
|
|
42
|
-
StatusChange[StatusChange["HalfOpenToClose"] = 4] = "HalfOpenToClose";
|
|
43
|
-
})(StatusChange = exports.StatusChange || (exports.StatusChange = {}));
|
|
44
|
-
/**
|
|
45
|
-
* Mirror of `MonitorService.RecoverAllStatus`
|
|
46
|
-
*/
|
|
47
|
-
var RecoverAllStatus;
|
|
48
|
-
(function (RecoverAllStatus) {
|
|
49
|
-
RecoverAllStatus[RecoverAllStatus["Invalid"] = 0] = "Invalid";
|
|
50
|
-
RecoverAllStatus[RecoverAllStatus["Start"] = 1] = "Start";
|
|
51
|
-
RecoverAllStatus[RecoverAllStatus["End"] = 2] = "End";
|
|
52
|
-
})(RecoverAllStatus = exports.RecoverAllStatus || (exports.RecoverAllStatus = {}));
|
|
53
|
-
// #endregion
|
|
54
|
-
// #region Service
|
|
55
|
-
var ServiceType;
|
|
56
|
-
(function (ServiceType) {
|
|
57
|
-
ServiceType[ServiceType["Discover"] = 0] = "Discover";
|
|
58
|
-
ServiceType[ServiceType["Monitor"] = 1] = "Monitor";
|
|
59
|
-
ServiceType[ServiceType["Ratelimit"] = 2] = "Ratelimit";
|
|
60
|
-
})(ServiceType = exports.ServiceType || (exports.ServiceType = {}));
|
|
61
|
-
// #endregion
|
|
62
|
-
var ClientType;
|
|
63
|
-
(function (ClientType) {
|
|
64
|
-
ClientType[ClientType["SDK"] = 0] = "SDK";
|
|
65
|
-
ClientType[ClientType["AGENT"] = 1] = "AGENT";
|
|
66
|
-
})(ClientType = exports.ClientType || (exports.ClientType = {}));
|
|
67
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/plugins/naming/polaris-server/types.ts"],"names":[],"mappings":";;;AAAA,uBAAuB;AACvB;;GAEG;AACH,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,mEAAW,CAAA;IACX,qEAAY,CAAA;IACZ,mEAAW,CAAA;IACX,mEAAW,CAAA;IACX,yEAAc,CAAA;AAChB,CAAC,EANW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAM9B;AAED;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,uDAAS,CAAA;IACT,uDAAS,CAAA;AACX,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAED;;GAEG;AACH,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,yCAAQ,CAAA;IACR,mDAAa,CAAA;IACb,iDAAY,CAAA;AACd,CAAC,EAJW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAIpB;AAED;;GAEG;AACH,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,qDAAW,CAAA;IACX,6DAAe,CAAA;IACf,mEAAkB,CAAA;IAClB,mEAAkB,CAAA;IAClB,qEAAmB,CAAA;AACrB,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB;AAED;;GAEG;AACH,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,6DAAW,CAAA;IACX,yDAAS,CAAA;IACT,qDAAO,CAAA;AACT,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAkBD,aAAa;AAEb,kBAAkB;AAClB,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,qDAAQ,CAAA;IACR,mDAAO,CAAA;IACP,uDAAS,CAAA;AACX,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAOD,aAAa;AAEb,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,yCAAO,CAAA;IACP,6CAAS,CAAA;AACX,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Instance, InstanceStatus } from "../../..";
|
|
2
|
-
import type * as PolarisTypes from "./discover-pb/types";
|
|
3
|
-
import type * as MonitorTypes from "./monitor-pb/types";
|
|
4
|
-
import { DeconstructorWrappers, ServiceInfo, StatusChange } from "./types";
|
|
5
|
-
export interface EndPoint {
|
|
6
|
-
host: string;
|
|
7
|
-
port: number;
|
|
8
|
-
}
|
|
9
|
-
export interface LocalRemotePair {
|
|
10
|
-
local: EndPoint;
|
|
11
|
-
remote: EndPoint;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 转换为可读地址
|
|
15
|
-
* @param inputs `EndPoint` 类型地址
|
|
16
|
-
*/
|
|
17
|
-
export declare const inspectEndpoints: (inputs: EndPoint[]) => string;
|
|
18
|
-
/**
|
|
19
|
-
* 判断端口号是否合法
|
|
20
|
-
* @param input 端口号
|
|
21
|
-
*/
|
|
22
|
-
export declare const isValidPort: (input: number) => boolean;
|
|
23
|
-
/**
|
|
24
|
-
* 地址类型转换
|
|
25
|
-
* `string` ---> `EndPoint`
|
|
26
|
-
* @param input `string` 类型地址
|
|
27
|
-
* @returns `EndPoint` 类型地址
|
|
28
|
-
*/
|
|
29
|
-
export declare function address2Endpoint(input: string): EndPoint;
|
|
30
|
-
/**
|
|
31
|
-
* 探测连接速度最快的远端节点
|
|
32
|
-
* @param hosts 待探测远端节点列表
|
|
33
|
-
* @param ms 最长探测时长
|
|
34
|
-
* @returns 最快响应远端及其对应的本地节点 IP
|
|
35
|
-
*/
|
|
36
|
-
export declare function fastestRemote(hosts: EndPoint[] | string[], ms?: number): Promise<LocalRemotePair>;
|
|
37
|
-
/**
|
|
38
|
-
* 判断特定 IP(4/6) 是否为任意地址 `INADDR_ANY`
|
|
39
|
-
* @param ip IP 地址
|
|
40
|
-
* @returns 判定结果
|
|
41
|
-
*/
|
|
42
|
-
export declare const isAnyAddr: (ip: string) => boolean;
|
|
43
|
-
/**
|
|
44
|
-
* `protobuf` 时间类型
|
|
45
|
-
*/
|
|
46
|
-
declare type ProtobufTime = MonitorTypes.google.protobuf.ITimestamp | PolarisTypes.google.protobuf.IDuration;
|
|
47
|
-
/**
|
|
48
|
-
* 毫秒转 `protobuf` 时间格式
|
|
49
|
-
* @param ms 毫秒
|
|
50
|
-
*/
|
|
51
|
-
export declare function ms2protobuf(ms: number, format?: ProtobufFormat.Original): DeconstructorWrappers<ProtobufTime>;
|
|
52
|
-
/**
|
|
53
|
-
* 毫秒转 `protobuf` 时间格式
|
|
54
|
-
* @param ms 毫秒
|
|
55
|
-
* @param format 时间格式
|
|
56
|
-
*/
|
|
57
|
-
export declare function ms2protobuf(ms: number, format: ProtobufFormat.JSON): string;
|
|
58
|
-
/**
|
|
59
|
-
* 毫秒转 `protobuf` 时间格式
|
|
60
|
-
* @param ms 毫秒
|
|
61
|
-
* @param format 时间格式
|
|
62
|
-
*/
|
|
63
|
-
export declare function ms2protobuf(ms: number, format: ProtobufFormat): DeconstructorWrappers<ProtobufTime> | string;
|
|
64
|
-
/**
|
|
65
|
-
* `protobuf` 时间格式转毫秒
|
|
66
|
-
* @param time `protobuf` 时间格式
|
|
67
|
-
*/
|
|
68
|
-
export declare function protobuf2ms(time: string | DeconstructorWrappers<ProtobufTime>): number;
|
|
69
|
-
/**
|
|
70
|
-
* 转换实例状态至熔断器变更类型
|
|
71
|
-
* @description `StatusChange` 为熔断器变更类型而非实例的状态,_也就是说,这里所需输出的状态与实例状态相反_
|
|
72
|
-
* @param before 前一状态
|
|
73
|
-
* @param after 下一状态
|
|
74
|
-
*/
|
|
75
|
-
export declare const transformStatusChange: (before: InstanceStatus, after: InstanceStatus) => StatusChange;
|
|
76
|
-
/**
|
|
77
|
-
* 本地实例版本号
|
|
78
|
-
*/
|
|
79
|
-
export declare const kInstanceLocalVersion = "local";
|
|
80
|
-
/**
|
|
81
|
-
* 通过地址列表生成对应实例列表
|
|
82
|
-
* @param input 地址列表
|
|
83
|
-
* @param protocol 协议
|
|
84
|
-
*/
|
|
85
|
-
export declare const address2Instance: (input: readonly string[], protocol: string) => Instance[];
|
|
86
|
-
/**
|
|
87
|
-
* `protobuf` 编码格式
|
|
88
|
-
*/
|
|
89
|
-
export declare enum ProtobufFormat {
|
|
90
|
-
/** 原始格式 */
|
|
91
|
-
Original = 0,
|
|
92
|
-
/** JSON 格式 */
|
|
93
|
-
JSON = 1
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Proto definition directory
|
|
97
|
-
*/
|
|
98
|
-
export declare const kProtoPath: ServiceInfo<string, string, string>;
|
|
99
|
-
export {};
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.kProtoPath = exports.ProtobufFormat = exports.address2Instance = exports.kInstanceLocalVersion = exports.transformStatusChange = exports.protobuf2ms = exports.ms2protobuf = exports.isAnyAddr = exports.fastestRemote = exports.address2Endpoint = exports.isValidPort = exports.inspectEndpoints = void 0;
|
|
4
|
-
const net = require("net");
|
|
5
|
-
const path = require("path");
|
|
6
|
-
const __1 = require("../../..");
|
|
7
|
-
const utils_1 = require("../../../utils");
|
|
8
|
-
const types_1 = require("./types");
|
|
9
|
-
// #region Network
|
|
10
|
-
const kAnyAddrRegex = /^(0|[^0-9a-z])+$/i;
|
|
11
|
-
const kDetectionTimeout = 1 * utils_1.kSeconds;
|
|
12
|
-
/**
|
|
13
|
-
* 转换为可读地址
|
|
14
|
-
* @param inputs `EndPoint` 类型地址
|
|
15
|
-
*/
|
|
16
|
-
const inspectEndpoints = (inputs) => inputs.map(({ host, port }) => `${host}:${port}`).join(", ");
|
|
17
|
-
exports.inspectEndpoints = inspectEndpoints;
|
|
18
|
-
/**
|
|
19
|
-
* 判断端口号是否合法
|
|
20
|
-
* @param input 端口号
|
|
21
|
-
*/
|
|
22
|
-
const isValidPort = (input) => Number.isInteger(input) && input >= 0 && input <= (2 ** 16) - 1;
|
|
23
|
-
exports.isValidPort = isValidPort;
|
|
24
|
-
/**
|
|
25
|
-
* 地址类型转换
|
|
26
|
-
* `string` ---> `EndPoint`
|
|
27
|
-
* @param input `string` 类型地址
|
|
28
|
-
* @returns `EndPoint` 类型地址
|
|
29
|
-
*/
|
|
30
|
-
function address2Endpoint(input) {
|
|
31
|
-
const [host, port] = input.split(":");
|
|
32
|
-
const normalizedPort = Number.parseInt(port, 10);
|
|
33
|
-
if (!(0, exports.isValidPort)(normalizedPort)) {
|
|
34
|
-
throw new __1.ArgumentError("invalid port");
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
host,
|
|
38
|
-
port: normalizedPort
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
exports.address2Endpoint = address2Endpoint;
|
|
42
|
-
/**
|
|
43
|
-
* 探测连接速度最快的远端节点
|
|
44
|
-
* @param hosts 待探测远端节点列表
|
|
45
|
-
* @param ms 最长探测时长
|
|
46
|
-
* @returns 最快响应远端及其对应的本地节点 IP
|
|
47
|
-
*/
|
|
48
|
-
async function fastestRemote(hosts, ms = kDetectionTimeout) {
|
|
49
|
-
const normalized = [];
|
|
50
|
-
hosts.forEach((host) => {
|
|
51
|
-
switch (typeof host) {
|
|
52
|
-
case "string": {
|
|
53
|
-
normalized.push(address2Endpoint(host));
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
case "object": {
|
|
57
|
-
normalized.push(host);
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
default: {
|
|
61
|
-
throw new __1.ArgumentError("invalid hosts");
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return new Promise((resolve, reject) => {
|
|
66
|
-
let isResolved = false;
|
|
67
|
-
let rejectCount = 0;
|
|
68
|
-
normalized.forEach((host) => {
|
|
69
|
-
const socket = net.connect(Object.assign(Object.assign({}, host), { timeout: ms }))
|
|
70
|
-
.once("connect", () => {
|
|
71
|
-
if (!isResolved) {
|
|
72
|
-
const { localAddress, localPort } = socket;
|
|
73
|
-
if (localAddress && localPort && localPort > 0) {
|
|
74
|
-
isResolved = true;
|
|
75
|
-
resolve({
|
|
76
|
-
local: {
|
|
77
|
-
host: localAddress,
|
|
78
|
-
port: localPort
|
|
79
|
-
},
|
|
80
|
-
remote: host
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
rejectCount += 1;
|
|
85
|
-
if (rejectCount === hosts.length) {
|
|
86
|
-
reject(new __1.NetworkError(`all remote hosts(${(0, exports.inspectEndpoints)(normalized)}) dead`));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
socket.destroy();
|
|
91
|
-
})
|
|
92
|
-
.once("error", () => {
|
|
93
|
-
if (!isResolved) {
|
|
94
|
-
rejectCount += 1;
|
|
95
|
-
if (rejectCount === hosts.length) {
|
|
96
|
-
reject(new __1.NetworkError(`all remote hosts(${(0, exports.inspectEndpoints)(normalized)}) dead`));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
.unref();
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
exports.fastestRemote = fastestRemote;
|
|
105
|
-
/**
|
|
106
|
-
* 判断特定 IP(4/6) 是否为任意地址 `INADDR_ANY`
|
|
107
|
-
* @param ip IP 地址
|
|
108
|
-
* @returns 判定结果
|
|
109
|
-
*/
|
|
110
|
-
const isAnyAddr = (ip) => kAnyAddrRegex.test(ip);
|
|
111
|
-
exports.isAnyAddr = isAnyAddr;
|
|
112
|
-
function ms2protobuf(ms, format = ProtobufFormat.Original) {
|
|
113
|
-
switch (format) {
|
|
114
|
-
case ProtobufFormat.Original: {
|
|
115
|
-
return {
|
|
116
|
-
seconds: ms / utils_1.kSeconds,
|
|
117
|
-
nanos: (ms % utils_1.kSeconds) * utils_1.kSeconds * utils_1.kNanos
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
case ProtobufFormat.JSON: {
|
|
121
|
-
return `${ms / utils_1.kSeconds}s`;
|
|
122
|
-
}
|
|
123
|
-
default: {
|
|
124
|
-
(0, utils_1.UNREACHABLE)();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
(0, utils_1.UNREACHABLE)(); /** Stub */
|
|
128
|
-
}
|
|
129
|
-
exports.ms2protobuf = ms2protobuf;
|
|
130
|
-
/**
|
|
131
|
-
* `protobuf` 时间格式转毫秒
|
|
132
|
-
* @param time `protobuf` 时间格式
|
|
133
|
-
*/
|
|
134
|
-
function protobuf2ms(time) {
|
|
135
|
-
switch (typeof time) {
|
|
136
|
-
case "string": { /** ProtobufFormat.JSON */
|
|
137
|
-
if (!time.endsWith("s")) {
|
|
138
|
-
return NaN;
|
|
139
|
-
}
|
|
140
|
-
return parseFloat(time) * utils_1.kSeconds;
|
|
141
|
-
}
|
|
142
|
-
case "object": {
|
|
143
|
-
const { seconds, nanos } = time;
|
|
144
|
-
if (typeof seconds !== "number" || typeof nanos !== "number") {
|
|
145
|
-
return NaN;
|
|
146
|
-
}
|
|
147
|
-
return Math.floor((seconds * utils_1.kSeconds) + (nanos / utils_1.kNanos));
|
|
148
|
-
}
|
|
149
|
-
default: {
|
|
150
|
-
return NaN;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
(0, utils_1.UNREACHABLE)(); /** Stub */
|
|
154
|
-
}
|
|
155
|
-
exports.protobuf2ms = protobuf2ms;
|
|
156
|
-
// #endregion
|
|
157
|
-
/**
|
|
158
|
-
* 转换实例状态至熔断器变更类型
|
|
159
|
-
* @description `StatusChange` 为熔断器变更类型而非实例的状态,_也就是说,这里所需输出的状态与实例状态相反_
|
|
160
|
-
* @param before 前一状态
|
|
161
|
-
* @param after 下一状态
|
|
162
|
-
*/
|
|
163
|
-
const transformStatusChange = (before, after) => {
|
|
164
|
-
if (before === 0 /* Normal */ && after === 3 /* Fused */) {
|
|
165
|
-
return types_1.StatusChange.CloseToOpen;
|
|
166
|
-
}
|
|
167
|
-
if (before === 2 /* HalfClose */ || before === 1 /* HalfOpen */) {
|
|
168
|
-
if (after === 0 /* Normal */) {
|
|
169
|
-
return types_1.StatusChange.HalfOpenToClose;
|
|
170
|
-
}
|
|
171
|
-
if (after === 3 /* Fused */) {
|
|
172
|
-
return types_1.StatusChange.HalfOpenToOpen;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
else if (before === 3 /* Fused */
|
|
176
|
-
&& (after === 2 /* HalfClose */ || after === 1 /* HalfOpen */)) {
|
|
177
|
-
return types_1.StatusChange.OpenToHalfOpen;
|
|
178
|
-
}
|
|
179
|
-
return types_1.StatusChange.Unknown;
|
|
180
|
-
};
|
|
181
|
-
exports.transformStatusChange = transformStatusChange;
|
|
182
|
-
/**
|
|
183
|
-
* 本地实例版本号
|
|
184
|
-
*/
|
|
185
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
186
|
-
exports.kInstanceLocalVersion = "local";
|
|
187
|
-
/**
|
|
188
|
-
* 通过地址列表生成对应实例列表
|
|
189
|
-
* @param input 地址列表
|
|
190
|
-
* @param protocol 协议
|
|
191
|
-
*/
|
|
192
|
-
const address2Instance = (input, protocol) => input.map((address) => {
|
|
193
|
-
const endpoint = address2Endpoint(address);
|
|
194
|
-
return Object.assign({ dynamicWeight: 0, logicSet: "", priority: 9, status: 0 /* Normal */, staticWeight: 100, protocol, version: exports.kInstanceLocalVersion, metadata: {
|
|
195
|
-
protocol
|
|
196
|
-
}, location: Object.assign({}, __1.blankLocation /** copy */), vpcId: "", id: `${endpoint.host}:${endpoint.port}` }, endpoint);
|
|
197
|
-
});
|
|
198
|
-
exports.address2Instance = address2Instance;
|
|
199
|
-
/**
|
|
200
|
-
* `protobuf` 编码格式
|
|
201
|
-
*/
|
|
202
|
-
var ProtobufFormat;
|
|
203
|
-
(function (ProtobufFormat) {
|
|
204
|
-
/** 原始格式 */
|
|
205
|
-
ProtobufFormat[ProtobufFormat["Original"] = 0] = "Original";
|
|
206
|
-
/** JSON 格式 */
|
|
207
|
-
ProtobufFormat[ProtobufFormat["JSON"] = 1] = "JSON";
|
|
208
|
-
})(ProtobufFormat = exports.ProtobufFormat || (exports.ProtobufFormat = {}));
|
|
209
|
-
/**
|
|
210
|
-
* Proto definition directory
|
|
211
|
-
*/
|
|
212
|
-
exports.kProtoPath = Object.freeze({
|
|
213
|
-
[types_1.ServiceType.Discover]: path.join(__dirname, "discover-pb"),
|
|
214
|
-
[types_1.ServiceType.Monitor]: path.join(__dirname, "monitor-pb"),
|
|
215
|
-
[types_1.ServiceType.Ratelimit]: path.join(__dirname, "ratelimit-pb")
|
|
216
|
-
});
|
|
217
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/plugins/naming/polaris-server/utils.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AAC3B,6BAA6B;AAE7B,gCAAgG;AAChG,0CAA+D;AAG/D,mCAAwF;AAExF,kBAA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,EAAc,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;IAChH,MAAM,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC3C,uBACE,aAAa,EAAE,CAAC,EAChB,QAAQ,EAAE,EAAE,EACZ,QAAQ,EAAE,CAAC,EACX,MAAM,kBACN,YAAY,EAAE,GAAG,EACjB,QAAQ,EACR,OAAO,EAAE,6BAAqB,EAC9B,QAAQ,EAAE;YACR,QAAQ;SACT,EACD,QAAQ,oBAAO,iBAAa,CAAC,WAAW,GACxC,KAAK,EAAE,EAAE,EACT,EAAE,EAAE,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,IACpC,QAAQ,EACX;AACJ,CAAC,CAAC,CAAC;AAlBU,QAAA,gBAAgB,oBAkB1B;AAEH;;GAEG;AACH,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,WAAW;IACX,2DAAQ,CAAA;IACR,cAAc;IACd,mDAAI,CAAA;AACN,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB;AAED;;GAEG;AACU,QAAA,UAAU,GAAwC,MAAM,CAAC,MAAM,CAAC;IAC3E,CAAC,mBAAW,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC;IAC3D,CAAC,mBAAW,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC;IACzD,CAAC,mBAAW,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC;CAC9D,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Instance } from "../../instance";
|
|
2
|
-
import { LocalRegistryPlugin, PluginType, RegistryCategory, RegistryData, ServiceRules } from "../../plugins";
|
|
3
|
-
import { RatelimitRule } from "../../rules";
|
|
4
|
-
export declare class MemoryOnlyRegistry implements LocalRegistryPlugin {
|
|
5
|
-
readonly name: string;
|
|
6
|
-
readonly type = PluginType.LocalRegistry;
|
|
7
|
-
readonly [RegistryCategory.Instance]: RegistryData<Instance[]>;
|
|
8
|
-
readonly [RegistryCategory.Rule]: RegistryData<ServiceRules>;
|
|
9
|
-
readonly [RegistryCategory.Ratelimit]: RegistryData<RatelimitRule[]>;
|
|
10
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a, _b, _c;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.MemoryOnlyRegistry = void 0;
|
|
5
|
-
const plugins_1 = require("../../plugins");
|
|
6
|
-
class MemoryStorage {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.storage = Object.create(null);
|
|
9
|
-
}
|
|
10
|
-
get(namespace, service) {
|
|
11
|
-
var _d, _e;
|
|
12
|
-
return (_e = (_d = this.storage[namespace]) === null || _d === void 0 ? void 0 : _d[service]) !== null && _e !== void 0 ? _e : null;
|
|
13
|
-
}
|
|
14
|
-
set(namespace, service, data) {
|
|
15
|
-
const list = this.storage[namespace];
|
|
16
|
-
if (list) {
|
|
17
|
-
list[service] = data;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
this.storage[namespace] = {
|
|
21
|
-
[service]: data
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
delete(namespace, service) {
|
|
26
|
-
if (this.get(namespace, service) === null) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
delete this.storage[namespace][service];
|
|
30
|
-
if (Object.keys(this.storage[namespace]).length === 0) {
|
|
31
|
-
delete this.storage[namespace];
|
|
32
|
-
}
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
all() {
|
|
36
|
-
return this.storage;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
class MemoryOnlyRegistry {
|
|
40
|
-
constructor() {
|
|
41
|
-
this.name = "MemoryOnlyRegistry";
|
|
42
|
-
this.type = plugins_1.PluginType.LocalRegistry;
|
|
43
|
-
this[_a] = new MemoryStorage();
|
|
44
|
-
this[_b] = new MemoryStorage();
|
|
45
|
-
this[_c] = new MemoryStorage();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.MemoryOnlyRegistry = MemoryOnlyRegistry;
|
|
49
|
-
_a = plugins_1.RegistryCategory.Instance, _b = plugins_1.RegistryCategory.Rule, _c = plugins_1.RegistryCategory.Ratelimit;
|
|
50
|
-
//# sourceMappingURL=memory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/plugins/registry/memory.ts"],"names":[],"mappings":";;;;AACA,2CAAgJ;AAGhJ,MAAM,aAAa;IAAnB;QACU,YAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAwC,CAAC;IAiC/E,CAAC;IA/BC,GAAG,CAAC,SAAiB,EAAE,OAAe;;QACpC,OAAO,MAAA,MAAA,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,0CAAG,OAAO,CAAC,mCAAI,IAAI,CAAC;IACpD,CAAC;IAED,GAAG,CAAC,SAAiB,EAAE,OAAe,EAAE,IAAyB;QAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;SACtB;aAAM;YACL,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG;gBACxB,CAAC,OAAO,CAAC,EAAE,IAAI;aAChB,CAAC;SACH;IACH,CAAC;IAED,MAAM,CAAC,SAAiB,EAAE,OAAe;QACvC,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;YACzC,OAAO,KAAK,CAAC;SACd;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAE,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAE,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;YACtD,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;SAChC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAED,MAAa,kBAAkB;IAA/B;QACW,SAAI,GAAW,oBAAoB,CAAC;QACpC,SAAI,GAAG,oBAAU,CAAC,aAAa,CAAC;QAChC,QAA2B,GAA6B,IAAI,aAAa,EAAc,CAAC;QACxF,QAAuB,GAA+B,IAAI,aAAa,EAAgB,CAAC;QACxF,QAA4B,GAAkC,IAAI,aAAa,EAAmB,CAAC;IAC9G,CAAC;CAAA;AAND,gDAMC;KAHW,0BAAgB,CAAC,QAAQ,OACzB,0BAAgB,CAAC,IAAI,OACrB,0BAAgB,CAAC,SAAS"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Instance, LocationMatchLevel, RoutingRules, Service } from "../../..";
|
|
2
|
-
import { DestinationQuery, FilteredResult, PluginType, RequisiteBitfield, ServiceRouterPlugin } from "../../../plugins";
|
|
3
|
-
/** 就近路由匹配模式 */
|
|
4
|
-
export declare enum MatchMode {
|
|
5
|
-
/** 不开启就近路由 */
|
|
6
|
-
Off = 0,
|
|
7
|
-
/**
|
|
8
|
-
* 根据实例元数据信息自动切换,
|
|
9
|
-
* 如备选实例中存在任意一个未开启就近路由的实例,则不开启,
|
|
10
|
-
* 否则开启
|
|
11
|
-
*/
|
|
12
|
-
Auto = 1,
|
|
13
|
-
/** 总是开启就近路由 */
|
|
14
|
-
Always = 2
|
|
15
|
-
}
|
|
16
|
-
declare const kDefaultOptions: {
|
|
17
|
-
/**
|
|
18
|
-
* 匹配模式
|
|
19
|
-
*/
|
|
20
|
-
mode: MatchMode;
|
|
21
|
-
/**
|
|
22
|
-
* 就近路由最大查询范围
|
|
23
|
-
*/
|
|
24
|
-
maxRange: LocationMatchLevel;
|
|
25
|
-
/**
|
|
26
|
-
* 就近路由最小查询范围
|
|
27
|
-
*/
|
|
28
|
-
minRange: LocationMatchLevel;
|
|
29
|
-
/**
|
|
30
|
-
* 不健康实例比例达到多少进行降级
|
|
31
|
-
* 默认为 1,即全部不健康才降级
|
|
32
|
-
*/
|
|
33
|
-
unhealthyDegrade: number;
|
|
34
|
-
};
|
|
35
|
-
export declare type PolarisNearbyRouterOptions = typeof kDefaultOptions;
|
|
36
|
-
export declare type NearbyArgs = Partial<Pick<PolarisNearbyRouterOptions, "maxRange" | "minRange">>;
|
|
37
|
-
/**
|
|
38
|
-
* 北极星定义的就近路由策略
|
|
39
|
-
* 优先匹配最小范围,失败则扩大一级范围重试,直到超过 `maxRange`
|
|
40
|
-
*/
|
|
41
|
-
export declare class PolarisNearbyRouter implements ServiceRouterPlugin {
|
|
42
|
-
readonly type = PluginType.ServiceRouter;
|
|
43
|
-
readonly name: string;
|
|
44
|
-
readonly requisite: RequisiteBitfield;
|
|
45
|
-
private readonly options;
|
|
46
|
-
constructor(options?: Partial<PolarisNearbyRouterOptions>);
|
|
47
|
-
query<AdditionalArgs = NearbyArgs>(callee: Service, rules?: RoutingRules[], caller?: Service, args?: AdditionalArgs): Generator<Partial<DestinationQuery>, void, void>;
|
|
48
|
-
filter<AdditionalArgs = NearbyArgs>(instances: Instance[], { destination }: Partial<DestinationQuery>, args?: AdditionalArgs): FilteredResult;
|
|
49
|
-
private getRange;
|
|
50
|
-
}
|
|
51
|
-
export {};
|