@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.
- package/package.json +1 -1
- package/resource/doc/chatuikit/faq/common/server_error_code.md +74 -0
- package/resource/doc/chatuikit/faq/web_sdk/error_code.md +47 -0
- package/resource/doc/chatuikit/faq/web_sdk/faq.md +105 -0
- package/resource/doc/chatuikit/flutter/faq.md +120 -0
- package/resource/doc/chatuikit/iOS/faq.md +120 -0
- package/resource/doc/chatuikit/react/faq.md +26 -0
- package/resource/doc/chatuikit/vue/faq.md +36 -0
- package/resource/doc/livekit/faq/common/error_code.md +88 -0
- package/resource/doc/livekit/vue/faq.md +0 -0
- package/resource/doc/roomkit/faq/common/error_code.md +67 -0
- package/resource/doc/roomkit/vue/faq.md +0 -0
- package/resource/doc/rtcengine/faq/common/error_code.md +0 -0
- package/resource/doc/rtcengine/faq/web_sdk/.gitkeep +0 -0
- package/resource/doc/tuicallkit/faq/common/error_code.md +47 -0
- package/resource/doc/tuicallkit/flutter/faq.md +127 -0
- package/resource/doc/tuicallkit/iOS/faq.md +127 -0
- package/resource/doc/tuicallkit/react/faq.md +36 -0
- package/resource/doc/tuicallkit/vue/faq.md +36 -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 -9
- 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 -11
- package/tools/common/record-prompt.js.map +1 -1
- package/tools/common/record-result.js +8 -12
- 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 +32 -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 +22 -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 +23 -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 -7
- 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/generate_UserSig.md +0 -306
- 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/faq_sdk.md → android/faq.md} +0 -0
- /package/{libs/@tencent/aegis-node-sdk/lib/packages/core/src/polyfill.d.ts → resource/doc/chatuikit/faq/native_sdk/faq.md} +0 -0
- /package/resource/doc/tuicallkit/{faq → android}/faq.md +0 -0
|
@@ -1,660 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocalRegistry = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
const process_1 = require("process");
|
|
6
|
-
const errors_1 = require("./errors");
|
|
7
|
-
const instance_1 = require("./instance");
|
|
8
|
-
const location_1 = require("./location");
|
|
9
|
-
const plugins_1 = require("./plugins");
|
|
10
|
-
const utils_1 = require("./utils");
|
|
11
|
-
var EntryStatus;
|
|
12
|
-
(function (EntryStatus) {
|
|
13
|
-
/** 正常 */
|
|
14
|
-
EntryStatus[EntryStatus["Normal"] = 0] = "Normal";
|
|
15
|
-
/** 过期 */
|
|
16
|
-
EntryStatus[EntryStatus["Outdated"] = 1] = "Outdated";
|
|
17
|
-
/** 更新中 */
|
|
18
|
-
EntryStatus[EntryStatus["Updating"] = 2] = "Updating";
|
|
19
|
-
/** 已释放 */
|
|
20
|
-
EntryStatus[EntryStatus["Released"] = 3] = "Released";
|
|
21
|
-
})(EntryStatus || (EntryStatus = {}));
|
|
22
|
-
const kDefaultOptions = {
|
|
23
|
-
// #region Time
|
|
24
|
-
/**
|
|
25
|
-
* 过期时间
|
|
26
|
-
* 超过此时间,会 __异步__ 请求新数据
|
|
27
|
-
* _也就是说,返回值可能为旧数据_
|
|
28
|
-
*/
|
|
29
|
-
expireTime: {
|
|
30
|
-
/** 实例过期时间 */
|
|
31
|
-
[plugins_1.RegistryCategory.Instance]: 2 * utils_1.kSeconds,
|
|
32
|
-
/** 规则过期时间 */
|
|
33
|
-
[plugins_1.RegistryCategory.Rule]: 2 * utils_1.kSeconds,
|
|
34
|
-
/** 限流规则过期时间 */
|
|
35
|
-
[plugins_1.RegistryCategory.Ratelimit]: 2 * utils_1.kSeconds
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* 刷新时间
|
|
39
|
-
* 达到此时间,会自动更新数据(如数据已过期)
|
|
40
|
-
* _数据刷新,并不影响资源回收策略_
|
|
41
|
-
*/
|
|
42
|
-
refreshTime: {
|
|
43
|
-
/** 实例刷新时间 */
|
|
44
|
-
[plugins_1.RegistryCategory.Instance]: 10 * utils_1.kSeconds,
|
|
45
|
-
/** 规则刷新时间 */
|
|
46
|
-
[plugins_1.RegistryCategory.Rule]: 10 * utils_1.kSeconds,
|
|
47
|
-
/** 限流规则刷新时间 */
|
|
48
|
-
[plugins_1.RegistryCategory.Ratelimit]: 10 * utils_1.kSeconds
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* 脏数据时间
|
|
52
|
-
* 超过此时间,会 __同步__ 请求新数据
|
|
53
|
-
* _也就是说,返回值一定为新数据_
|
|
54
|
-
*/
|
|
55
|
-
dirtyTime: {
|
|
56
|
-
/** 实例脏数据时间 */
|
|
57
|
-
[plugins_1.RegistryCategory.Instance]: 1 * utils_1.kMinutes,
|
|
58
|
-
/** 规则脏数据时间 */
|
|
59
|
-
[plugins_1.RegistryCategory.Rule]: 1 * utils_1.kMinutes,
|
|
60
|
-
/** 限流规则脏数据时间 */
|
|
61
|
-
[plugins_1.RegistryCategory.Ratelimit]: 1 * utils_1.kMinutes
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
* 资源回收时间
|
|
65
|
-
* 回收条件为:_至少_经历指定的间隔都没被访问
|
|
66
|
-
* 小于或等于 0 则为不启用此特性
|
|
67
|
-
*/
|
|
68
|
-
recycleTime: 1 * utils_1.kDays,
|
|
69
|
-
// #endregion
|
|
70
|
-
// #region Report
|
|
71
|
-
/**
|
|
72
|
-
* 服务状态上报间隔
|
|
73
|
-
*/
|
|
74
|
-
reportInterval: 3 * utils_1.kMinutes,
|
|
75
|
-
/**
|
|
76
|
-
* 服务状态上报阈值
|
|
77
|
-
*/
|
|
78
|
-
reportThreshold: 10000,
|
|
79
|
-
// #endregion
|
|
80
|
-
/**
|
|
81
|
-
* 请求池最大容量
|
|
82
|
-
* 超过此大小,且无请求时,将会进行回收
|
|
83
|
-
*/
|
|
84
|
-
maxRequestsCapacity: 18 /** v8 对于 FastProperties Slot 的上限为 18 */
|
|
85
|
-
};
|
|
86
|
-
// #endregion
|
|
87
|
-
class LocalRegistry extends events_1.EventEmitter {
|
|
88
|
-
constructor(logger, naming, registry, reporters, ratelimit, options) {
|
|
89
|
-
super();
|
|
90
|
-
this.logger = logger;
|
|
91
|
-
this.naming = naming;
|
|
92
|
-
this.registry = registry;
|
|
93
|
-
this.reporters = reporters;
|
|
94
|
-
this.ratelimit = ratelimit;
|
|
95
|
-
this.entriesMeta = this.createEntries();
|
|
96
|
-
this.servicesMeta = Object.create(null);
|
|
97
|
-
// #region request
|
|
98
|
-
this.activeRequestsPool = Object.create(null);
|
|
99
|
-
this.activeRequestsCapacity = 0;
|
|
100
|
-
this.activeRequestsCount = 0;
|
|
101
|
-
// #endregion
|
|
102
|
-
// #region report
|
|
103
|
-
this.historyRecorder = Object.create(null);
|
|
104
|
-
this.historyRecorderCount = 0;
|
|
105
|
-
this.needReport = false;
|
|
106
|
-
this.disposed = false;
|
|
107
|
-
this.options = Object.assign(Object.assign(Object.assign({}, kDefaultOptions), options), { expireTime: Object.assign(Object.assign({}, kDefaultOptions.expireTime), options === null || options === void 0 ? void 0 : options.expireTime), refreshTime: Object.assign(Object.assign({}, kDefaultOptions.refreshTime), options === null || options === void 0 ? void 0 : options.refreshTime), dirtyTime: Object.assign(Object.assign({}, kDefaultOptions.dirtyTime), options === null || options === void 0 ? void 0 : options.dirtyTime) });
|
|
108
|
-
this.needReport = reporters.some(report => typeof report.registryCache === "function");
|
|
109
|
-
}
|
|
110
|
-
get location() {
|
|
111
|
-
const { location } = this.naming;
|
|
112
|
-
const { baseLocation } = this.options;
|
|
113
|
-
if (baseLocation && (0, location_1.isEmptyLocation)(location)) {
|
|
114
|
-
return baseLocation;
|
|
115
|
-
}
|
|
116
|
-
return location;
|
|
117
|
-
}
|
|
118
|
-
async fetch(type, namespace, service) {
|
|
119
|
-
if (this.disposed) {
|
|
120
|
-
throw new errors_1.StateError("Already disposed");
|
|
121
|
-
}
|
|
122
|
-
if (namespace === "" && service === "") {
|
|
123
|
-
switch (type) {
|
|
124
|
-
case plugins_1.RegistryCategory.Instance: {
|
|
125
|
-
return [];
|
|
126
|
-
}
|
|
127
|
-
case plugins_1.RegistryCategory.Rule: {
|
|
128
|
-
return {
|
|
129
|
-
in: [],
|
|
130
|
-
out: []
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
case plugins_1.RegistryCategory.Ratelimit: {
|
|
134
|
-
return [];
|
|
135
|
-
}
|
|
136
|
-
default: {
|
|
137
|
-
(0, utils_1.UNREACHABLE)();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/** 标记对 `namespace.service` 的访问 */
|
|
142
|
-
this.accessService(namespace, service);
|
|
143
|
-
const fromLocal = this.local(type, namespace, service);
|
|
144
|
-
// #region remote
|
|
145
|
-
if (fromLocal === null) {
|
|
146
|
-
const fromNaming = await this.pull(type, namespace, service);
|
|
147
|
-
if (fromNaming !== null) {
|
|
148
|
-
return fromNaming;
|
|
149
|
-
}
|
|
150
|
-
/*
|
|
151
|
-
* note:
|
|
152
|
-
* 如果前一相同查询设置了数据,
|
|
153
|
-
* 则重走标准逻辑获取数据。
|
|
154
|
-
*/
|
|
155
|
-
return this.fetch(type, namespace, service);
|
|
156
|
-
}
|
|
157
|
-
// #endregion
|
|
158
|
-
const entryMeta = this.getEntryMeta(type, namespace, service);
|
|
159
|
-
switch (entryMeta.status) {
|
|
160
|
-
case EntryStatus.Outdated: {
|
|
161
|
-
/**
|
|
162
|
-
* `timeSpan` >= dirtyTime
|
|
163
|
-
* 删除本地所有缓存数据,重新获取
|
|
164
|
-
*/
|
|
165
|
-
if (entryMeta.outdatedTime === undefined) {
|
|
166
|
-
(0, utils_1.UNREACHABLE)();
|
|
167
|
-
}
|
|
168
|
-
if (((0, process_1.uptime)() - entryMeta.outdatedTime) * utils_1.kSeconds >= this.options.dirtyTime[type]) {
|
|
169
|
-
this.dropService([type], namespace, service);
|
|
170
|
-
return this.fetch(type, namespace, service);
|
|
171
|
-
}
|
|
172
|
-
/*
|
|
173
|
-
* `timeSpan` < dirtyTime
|
|
174
|
-
* 异步更新缓存数据
|
|
175
|
-
*
|
|
176
|
-
* note:
|
|
177
|
-
* 更新机制为异步更新,
|
|
178
|
-
* 避免缓存击穿,及在特定场景下死循环
|
|
179
|
-
*/
|
|
180
|
-
this.performUpdate(type, namespace, service, fromLocal, entryMeta).catch(e => this.logger.error(`[Registry] [fetch], update ${type}`, e));
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
case EntryStatus.Normal: {
|
|
184
|
-
if (entryMeta.statusUpdater === null) {
|
|
185
|
-
(0, utils_1.UNREACHABLE)();
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
}
|
|
189
|
-
case EntryStatus.Updating: {
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
case EntryStatus.Released: // [[fallthrough]]
|
|
193
|
-
default: {
|
|
194
|
-
(0, utils_1.UNREACHABLE)();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return fromLocal.data;
|
|
198
|
-
}
|
|
199
|
-
/* eslint-enable max-len */
|
|
200
|
-
// #endregion
|
|
201
|
-
local(type, namespace, service) {
|
|
202
|
-
if (!namespace || !service) {
|
|
203
|
-
return this.registry[type].all();
|
|
204
|
-
}
|
|
205
|
-
return this.registry[type].get(namespace, service);
|
|
206
|
-
}
|
|
207
|
-
// #endregion
|
|
208
|
-
// #region dispose
|
|
209
|
-
dispose() {
|
|
210
|
-
this.cancelHistoryReporter();
|
|
211
|
-
this.dropEntryMeta();
|
|
212
|
-
this.dropServiceMeta();
|
|
213
|
-
this.removeAllListeners();
|
|
214
|
-
this.disposed = true;
|
|
215
|
-
}
|
|
216
|
-
get isDisposed() {
|
|
217
|
-
return this.disposed;
|
|
218
|
-
}
|
|
219
|
-
// #endregion
|
|
220
|
-
// #region update
|
|
221
|
-
/** for external use only */
|
|
222
|
-
async update(type, namespace, service) {
|
|
223
|
-
/** 标记对 `namespace.service` 的访问 */
|
|
224
|
-
this.accessService(namespace, service);
|
|
225
|
-
return this.performUpdate(type, namespace, service);
|
|
226
|
-
}
|
|
227
|
-
async performUpdate(type, namespace, service, fromLocal = this.local(type, namespace, service), entryMeta) {
|
|
228
|
-
if (fromLocal === null) {
|
|
229
|
-
return (await this.pull(type, namespace, service)) !== null;
|
|
230
|
-
}
|
|
231
|
-
const localEntryMeta = entryMeta !== null && entryMeta !== void 0 ? entryMeta : this.getEntryMeta(type, namespace, service);
|
|
232
|
-
switch (localEntryMeta.status) {
|
|
233
|
-
case EntryStatus.Normal: // [[fallthrough]]
|
|
234
|
-
case EntryStatus.Outdated: {
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
case EntryStatus.Updating: {
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
case EntryStatus.Released: // [[fallthrough]]
|
|
241
|
-
default: {
|
|
242
|
-
(0, utils_1.UNREACHABLE)();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
localEntryMeta.status = EntryStatus.Updating;
|
|
246
|
-
return Promise.resolve() /** 通过 Promise 切分同步执行代码,降低(同步)调用耗时 */
|
|
247
|
-
.then(() => {
|
|
248
|
-
switch (type) {
|
|
249
|
-
case plugins_1.RegistryCategory.Instance: {
|
|
250
|
-
return this.updateInstance(namespace, service, fromLocal, localEntryMeta);
|
|
251
|
-
}
|
|
252
|
-
case plugins_1.RegistryCategory.Rule: {
|
|
253
|
-
return this.updateRule(namespace, service, fromLocal, localEntryMeta);
|
|
254
|
-
}
|
|
255
|
-
case plugins_1.RegistryCategory.Ratelimit: {
|
|
256
|
-
return this.updateRatelimit(namespace, service, fromLocal, localEntryMeta);
|
|
257
|
-
}
|
|
258
|
-
default: {
|
|
259
|
-
(0, utils_1.UNREACHABLE)();
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
})
|
|
263
|
-
.then((hasUpdated) => {
|
|
264
|
-
if (localEntryMeta.status !== EntryStatus.Released) {
|
|
265
|
-
localEntryMeta.status = EntryStatus.Normal;
|
|
266
|
-
localEntryMeta.outdatedTime = undefined;
|
|
267
|
-
this.attachUpdaterToEntryMeta(type, localEntryMeta);
|
|
268
|
-
}
|
|
269
|
-
return hasUpdated;
|
|
270
|
-
}, (err) => {
|
|
271
|
-
if (localEntryMeta.status !== EntryStatus.Released) {
|
|
272
|
-
/** 当请求失败时,不更新过期时间戳 `outdatedTime` */
|
|
273
|
-
localEntryMeta.status = EntryStatus.Outdated;
|
|
274
|
-
}
|
|
275
|
-
throw err;
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
async updateInstance(namespace, service, fromLocal, entryMeta) {
|
|
279
|
-
const fromNaming = await this.request(plugins_1.RegistryCategory.Instance, namespace, service, fromLocal.revision);
|
|
280
|
-
if (entryMeta.status === EntryStatus.Released || fromNaming.revision === fromLocal.revision) {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
fromNaming.data.forEach((namingInstance) => {
|
|
284
|
-
const exists = fromLocal.data.some((localInstance) => {
|
|
285
|
-
if (namingInstance.id === localInstance.id) {
|
|
286
|
-
(0, instance_1.instanceCopy)(namingInstance, localInstance);
|
|
287
|
-
if (namingInstance.status !== localInstance.status) {
|
|
288
|
-
/** EventEmitter Synchronously calls each of the listeners */
|
|
289
|
-
this.emit("SyncInstanceStatus" /* SyncInstanceStatus */, namespace, service, localInstance, namingInstance.status);
|
|
290
|
-
localInstance.status = namingInstance.status;
|
|
291
|
-
}
|
|
292
|
-
return true;
|
|
293
|
-
}
|
|
294
|
-
return false;
|
|
295
|
-
});
|
|
296
|
-
if (!exists) {
|
|
297
|
-
fromLocal.data.push(namingInstance);
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
fromLocal.data = fromLocal.data.filter(localInstance => fromNaming.data.some(namingInstance => namingInstance.id === localInstance.id));
|
|
301
|
-
fromLocal.revision = fromNaming.revision;
|
|
302
|
-
this.registry[plugins_1.RegistryCategory.Instance].set(namespace, service, fromLocal);
|
|
303
|
-
this.changelog(plugins_1.RegistryCategory.Instance, namespace, service, fromNaming.revision);
|
|
304
|
-
return true;
|
|
305
|
-
}
|
|
306
|
-
async updateRule(namespace, service, fromLocal, entryMeta) {
|
|
307
|
-
const fromNaming = await this.request(plugins_1.RegistryCategory.Rule, namespace, service, fromLocal.revision);
|
|
308
|
-
if (entryMeta.status === EntryStatus.Released || fromNaming.revision === fromLocal.revision) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
this.registry[plugins_1.RegistryCategory.Rule].set(namespace, service, fromNaming);
|
|
312
|
-
this.changelog(plugins_1.RegistryCategory.Rule, namespace, service, fromNaming.revision);
|
|
313
|
-
return true;
|
|
314
|
-
}
|
|
315
|
-
async updateRatelimit(namespace, service, fromLocal, entryMeta) {
|
|
316
|
-
const fromNaming = await this.request(plugins_1.RegistryCategory.Ratelimit, namespace, service, fromLocal.revision);
|
|
317
|
-
if (entryMeta.status === EntryStatus.Released || fromNaming.revision === fromLocal.revision) {
|
|
318
|
-
return false;
|
|
319
|
-
}
|
|
320
|
-
fromNaming.data.forEach((namingRule) => {
|
|
321
|
-
const localData = fromLocal.data;
|
|
322
|
-
const { length } = localData;
|
|
323
|
-
let index = 0;
|
|
324
|
-
for (; index < length; index += 1) {
|
|
325
|
-
const localRule = localData[index];
|
|
326
|
-
if (namingRule.id === localRule.id) {
|
|
327
|
-
if (namingRule.revision !== localRule.revision) {
|
|
328
|
-
localData[index] = namingRule;
|
|
329
|
-
}
|
|
330
|
-
break;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
if (index === length) { /** not found */
|
|
334
|
-
fromLocal.data.push(namingRule);
|
|
335
|
-
}
|
|
336
|
-
});
|
|
337
|
-
fromLocal.data = fromLocal.data.filter(localRule => fromNaming.data.some(namingRule => namingRule.id === localRule.id));
|
|
338
|
-
fromLocal.revision = fromNaming.revision;
|
|
339
|
-
this.registry[plugins_1.RegistryCategory.Ratelimit].set(namespace, service, fromNaming);
|
|
340
|
-
this.changelog(plugins_1.RegistryCategory.Ratelimit, namespace, service, fromNaming.revision);
|
|
341
|
-
return true;
|
|
342
|
-
}
|
|
343
|
-
async request(type, namespace, service, revision) {
|
|
344
|
-
const key = `${type}#${namespace}.${service}${revision ? `@${revision}` : ""}`;
|
|
345
|
-
let activeRequest = this.activeRequestsPool[key];
|
|
346
|
-
const performRequest = !activeRequest;
|
|
347
|
-
if (performRequest) {
|
|
348
|
-
/**
|
|
349
|
-
* 当值为 `undefined` 时,说明对应(key)的槽未被使用,
|
|
350
|
-
* 故存储对象容量大小增加 1 个槽位。
|
|
351
|
-
*/
|
|
352
|
-
if (activeRequest === undefined) {
|
|
353
|
-
this.activeRequestsCapacity += 1;
|
|
354
|
-
}
|
|
355
|
-
this.activeRequestsCount += 1;
|
|
356
|
-
switch (type) {
|
|
357
|
-
case plugins_1.RegistryCategory.Instance: {
|
|
358
|
-
activeRequest = this.naming.list(namespace, service, revision);
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
case plugins_1.RegistryCategory.Rule: {
|
|
362
|
-
activeRequest = this.naming.routingRules(namespace, service, revision);
|
|
363
|
-
break;
|
|
364
|
-
}
|
|
365
|
-
case plugins_1.RegistryCategory.Ratelimit: {
|
|
366
|
-
if (!this.ratelimit) {
|
|
367
|
-
(0, utils_1.UNREACHABLE)();
|
|
368
|
-
}
|
|
369
|
-
activeRequest = this.ratelimit.ratelimitRules(namespace, service, revision);
|
|
370
|
-
break;
|
|
371
|
-
}
|
|
372
|
-
default: {
|
|
373
|
-
(0, utils_1.UNREACHABLE)();
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
this.activeRequestsPool[key] = activeRequest;
|
|
377
|
-
}
|
|
378
|
-
let result;
|
|
379
|
-
try {
|
|
380
|
-
result = await activeRequest;
|
|
381
|
-
}
|
|
382
|
-
finally {
|
|
383
|
-
if (performRequest) {
|
|
384
|
-
this.activeRequestsCount -= 1;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* 回收机制:
|
|
388
|
-
* 当超过最大容量且当前没有未完成的请求时,进行整体回收(重新创建)。
|
|
389
|
-
* 这里为了性能考虑这里不使用 `delete` 删除对象属性,避免退化为字典模式。
|
|
390
|
-
*/
|
|
391
|
-
if (this.activeRequestsCount === 0 && this.activeRequestsCapacity > this.options.maxRequestsCapacity) {
|
|
392
|
-
this.activeRequestsPool = Object.create(null);
|
|
393
|
-
this.activeRequestsCapacity = 0;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* 将使用过的槽设置成为 `null`,以便于复用时区分。
|
|
397
|
-
*/
|
|
398
|
-
this.activeRequestsPool[key] = null;
|
|
399
|
-
}
|
|
400
|
-
return result;
|
|
401
|
-
}
|
|
402
|
-
async pull(type, namespace, service) {
|
|
403
|
-
const { data: fromNaming, revision } = await this.request(type, namespace, service);
|
|
404
|
-
if (this.local(type, namespace, service) === null) {
|
|
405
|
-
this.registry[type].set(namespace, service, {
|
|
406
|
-
data: fromNaming,
|
|
407
|
-
revision
|
|
408
|
-
});
|
|
409
|
-
this.createEntryMeta(type, namespace, service, false);
|
|
410
|
-
return fromNaming;
|
|
411
|
-
}
|
|
412
|
-
return null;
|
|
413
|
-
}
|
|
414
|
-
// #endregion
|
|
415
|
-
// #region stat
|
|
416
|
-
report() {
|
|
417
|
-
const { historyRecorder } = this;
|
|
418
|
-
this.historyRecorder = Object.create(null);
|
|
419
|
-
this.historyRecorderCount = 0;
|
|
420
|
-
Object.keys(historyRecorder).forEach((namespace) => {
|
|
421
|
-
const serviceHistory = historyRecorder[namespace];
|
|
422
|
-
Object.keys(serviceHistory).forEach((service) => {
|
|
423
|
-
var _a, _b, _c;
|
|
424
|
-
const changelog = serviceHistory[service];
|
|
425
|
-
const rules = (_a = this.registry[plugins_1.RegistryCategory.Rule].get(namespace, service)) === null || _a === void 0 ? void 0 : _a.data;
|
|
426
|
-
const stat = {
|
|
427
|
-
[plugins_1.RegistryCategory.Instance]: {
|
|
428
|
-
history: changelog[plugins_1.RegistryCategory.Instance],
|
|
429
|
-
/*
|
|
430
|
-
* 当前实例列表不存在或为空,则认为当前已删除
|
|
431
|
-
*/
|
|
432
|
-
eliminated: (((_b = this.registry[plugins_1.RegistryCategory.Instance].get(namespace, service)) === null || _b === void 0 ? void 0 : _b.data.length) || 0) === 0
|
|
433
|
-
},
|
|
434
|
-
[plugins_1.RegistryCategory.Rule]: {
|
|
435
|
-
history: changelog[plugins_1.RegistryCategory.Rule],
|
|
436
|
-
/*
|
|
437
|
-
* 当前规则不存在或出入规则均为空,则认为当前已删除
|
|
438
|
-
*/
|
|
439
|
-
eliminated: ((rules === null || rules === void 0 ? void 0 : rules.in.length) || 0) === 0 && ((rules === null || rules === void 0 ? void 0 : rules.out.length) || 0) === 0
|
|
440
|
-
},
|
|
441
|
-
[plugins_1.RegistryCategory.Ratelimit]: {
|
|
442
|
-
history: changelog[plugins_1.RegistryCategory.Ratelimit],
|
|
443
|
-
/*
|
|
444
|
-
* 当前限流规则不存在或为空,则认为当前已删除
|
|
445
|
-
*/
|
|
446
|
-
eliminated: (((_c = this.registry[plugins_1.RegistryCategory.Ratelimit].get(namespace, service)) === null || _c === void 0 ? void 0 : _c.data.length) || 0) === 0
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
this.reporters.forEach((reporter) => {
|
|
450
|
-
var _a;
|
|
451
|
-
(_a = reporter.registryCache) === null || _a === void 0 ? void 0 : _a.call(reporter, namespace, service, stat).catch(err => this.disposed || this.logger.error(`[${reporter.name}] [registryCache]`, err));
|
|
452
|
-
});
|
|
453
|
-
});
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
changelog(type, namespace, service, revision) {
|
|
457
|
-
if (!this.needReport) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
const log = {
|
|
461
|
-
time: Date.now(),
|
|
462
|
-
revision
|
|
463
|
-
};
|
|
464
|
-
let ns = this.historyRecorder[namespace];
|
|
465
|
-
if (!ns) {
|
|
466
|
-
ns = Object.create(null);
|
|
467
|
-
this.historyRecorder[namespace] = ns;
|
|
468
|
-
}
|
|
469
|
-
let svr = ns[service];
|
|
470
|
-
if (!svr) {
|
|
471
|
-
svr = {
|
|
472
|
-
[plugins_1.RegistryCategory.Instance]: [],
|
|
473
|
-
[plugins_1.RegistryCategory.Rule]: [],
|
|
474
|
-
[plugins_1.RegistryCategory.Ratelimit]: []
|
|
475
|
-
};
|
|
476
|
-
ns[service] = svr;
|
|
477
|
-
}
|
|
478
|
-
svr[type].push(log);
|
|
479
|
-
this.historyRecorderCount += 1;
|
|
480
|
-
if (this.historyRecorderCount >= this.options.reportThreshold) {
|
|
481
|
-
this.cancelHistoryReporter();
|
|
482
|
-
this.report();
|
|
483
|
-
}
|
|
484
|
-
else if (this.historyReporter === undefined) {
|
|
485
|
-
this.historyReporter = setTimeout(() => {
|
|
486
|
-
this.report();
|
|
487
|
-
this.historyReporter = undefined;
|
|
488
|
-
}, this.options.reportInterval).unref();
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
cancelHistoryReporter() {
|
|
492
|
-
if (this.historyReporter) {
|
|
493
|
-
clearTimeout(this.historyReporter);
|
|
494
|
-
this.historyReporter = undefined;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
// #endregion
|
|
498
|
-
// #region ServiceMeta
|
|
499
|
-
accessService(namespace, service) {
|
|
500
|
-
const { recycleTime } = this.options;
|
|
501
|
-
if (!(recycleTime > 0) || recycleTime === Infinity) {
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
const serviceMeta = this.servicesMeta[`${namespace}.${service}`];
|
|
505
|
-
if (serviceMeta === undefined) {
|
|
506
|
-
this.createServiceMeta(namespace, service);
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
serviceMeta.accessed = true;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
dropServiceMeta(namespace, service) {
|
|
513
|
-
if (namespace === undefined && service === undefined) {
|
|
514
|
-
Object.values(this.servicesMeta)
|
|
515
|
-
.forEach(({ garbageCollector }) => clearInterval(garbageCollector));
|
|
516
|
-
return true;
|
|
517
|
-
}
|
|
518
|
-
if (namespace === undefined || service === undefined) {
|
|
519
|
-
(0, utils_1.UNREACHABLE)();
|
|
520
|
-
}
|
|
521
|
-
const serviceMeta = this.servicesMeta[`${namespace}.${service}`];
|
|
522
|
-
if (serviceMeta) {
|
|
523
|
-
clearInterval(serviceMeta.garbageCollector);
|
|
524
|
-
delete this.servicesMeta[`${namespace}.${service}`];
|
|
525
|
-
return true;
|
|
526
|
-
}
|
|
527
|
-
return false;
|
|
528
|
-
}
|
|
529
|
-
createServiceMeta(namespace, service) {
|
|
530
|
-
const { recycleTime } = this.options;
|
|
531
|
-
const serviceMeta = {
|
|
532
|
-
accessed: true,
|
|
533
|
-
garbageCollector: setInterval(() => {
|
|
534
|
-
if (serviceMeta.accessed) {
|
|
535
|
-
serviceMeta.accessed = false;
|
|
536
|
-
}
|
|
537
|
-
else {
|
|
538
|
-
this.dropServiceMeta(namespace, service);
|
|
539
|
-
this.dropService([plugins_1.RegistryCategory.Instance, plugins_1.RegistryCategory.Ratelimit, plugins_1.RegistryCategory.Rule], namespace, service);
|
|
540
|
-
}
|
|
541
|
-
}, recycleTime).unref()
|
|
542
|
-
};
|
|
543
|
-
this.servicesMeta[`${namespace}.${service}`] = serviceMeta;
|
|
544
|
-
return serviceMeta;
|
|
545
|
-
}
|
|
546
|
-
dropService(types, namespace, service) {
|
|
547
|
-
types.forEach((type) => {
|
|
548
|
-
this.dropEntryMeta(type, namespace, service);
|
|
549
|
-
this.registry[type].delete(namespace, service);
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
// #endregion
|
|
553
|
-
// #region EntryMeta
|
|
554
|
-
attachRefresherToEntryMeta(type, entryMeta, namespace, service) {
|
|
555
|
-
const interval = this.options.refreshTime[type];
|
|
556
|
-
if (!(interval > 0) || interval === Infinity) {
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
entryMeta.contentRefresher = setInterval(() => {
|
|
560
|
-
if (entryMeta.status === EntryStatus.Outdated) {
|
|
561
|
-
this.performUpdate(type, namespace, service).catch(e => this.logger.error(`[Registry] [refresher], refresh ${namespace}.${service}#${type}`, e));
|
|
562
|
-
}
|
|
563
|
-
}, interval).unref();
|
|
564
|
-
}
|
|
565
|
-
attachUpdaterToEntryMeta(type, entryMeta) {
|
|
566
|
-
const timeout = this.options.expireTime[type];
|
|
567
|
-
if (!(timeout > 0) || timeout === Infinity) {
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
if (entryMeta.statusUpdater !== null) {
|
|
571
|
-
clearTimeout(entryMeta.statusUpdater);
|
|
572
|
-
entryMeta.statusUpdater = null;
|
|
573
|
-
}
|
|
574
|
-
entryMeta.statusUpdater = setTimeout(() => {
|
|
575
|
-
entryMeta.statusUpdater = null;
|
|
576
|
-
/*
|
|
577
|
-
* note:
|
|
578
|
-
* 请注意,这里必须要判断当前状态是否正常,
|
|
579
|
-
* 否则会造成异步死循环问题
|
|
580
|
-
*/
|
|
581
|
-
if (entryMeta.status === EntryStatus.Normal) {
|
|
582
|
-
entryMeta.status = EntryStatus.Outdated;
|
|
583
|
-
entryMeta.outdatedTime = (0, process_1.uptime)();
|
|
584
|
-
}
|
|
585
|
-
}, timeout).unref();
|
|
586
|
-
}
|
|
587
|
-
releaseEntryMeta(entryMeta) {
|
|
588
|
-
entryMeta.status = EntryStatus.Released;
|
|
589
|
-
entryMeta.outdatedTime = undefined;
|
|
590
|
-
if (entryMeta.statusUpdater !== null) {
|
|
591
|
-
clearTimeout(entryMeta.statusUpdater);
|
|
592
|
-
entryMeta.statusUpdater = null;
|
|
593
|
-
}
|
|
594
|
-
if (entryMeta.contentRefresher !== null) {
|
|
595
|
-
clearInterval(entryMeta.contentRefresher);
|
|
596
|
-
entryMeta.contentRefresher = null;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
dropEntryMeta(type, namespace, service) {
|
|
600
|
-
/** drop all */
|
|
601
|
-
if (type === undefined && namespace === undefined && service === undefined) {
|
|
602
|
-
Object.values(this.entriesMeta).forEach((entriesMeta) => {
|
|
603
|
-
Object.values(entriesMeta).forEach((entryMeta) => {
|
|
604
|
-
this.releaseEntryMeta(entryMeta);
|
|
605
|
-
});
|
|
606
|
-
});
|
|
607
|
-
this.entriesMeta = this.createEntries();
|
|
608
|
-
return true;
|
|
609
|
-
}
|
|
610
|
-
/** drop one */
|
|
611
|
-
const entryMeta = this.getEntryMeta(type, namespace, service, true);
|
|
612
|
-
if (entryMeta !== undefined) {
|
|
613
|
-
this.releaseEntryMeta(entryMeta);
|
|
614
|
-
return true;
|
|
615
|
-
}
|
|
616
|
-
return false;
|
|
617
|
-
}
|
|
618
|
-
createEntries() {
|
|
619
|
-
return {
|
|
620
|
-
[plugins_1.RegistryCategory.Instance]: Object.create(null),
|
|
621
|
-
[plugins_1.RegistryCategory.Rule]: Object.create(null),
|
|
622
|
-
[plugins_1.RegistryCategory.Ratelimit]: Object.create(null)
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
createEntryMeta(type, namespace, service, isOutdated) {
|
|
626
|
-
const entryMeta = {
|
|
627
|
-
status: isOutdated ? EntryStatus.Outdated : EntryStatus.Normal,
|
|
628
|
-
statusUpdater: null,
|
|
629
|
-
contentRefresher: null
|
|
630
|
-
};
|
|
631
|
-
if (isOutdated) {
|
|
632
|
-
entryMeta.outdatedTime = (0, process_1.uptime)();
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
this.attachUpdaterToEntryMeta(type, entryMeta);
|
|
636
|
-
}
|
|
637
|
-
this.attachRefresherToEntryMeta(type, entryMeta, namespace, service);
|
|
638
|
-
this.entriesMeta[type][`${namespace}.${service}`] = entryMeta;
|
|
639
|
-
return entryMeta;
|
|
640
|
-
}
|
|
641
|
-
getEntryMeta(type, namespace, service, popup = false) {
|
|
642
|
-
const entriesMeta = this.entriesMeta[type];
|
|
643
|
-
let entryMeta = entriesMeta[`${namespace}.${service}`];
|
|
644
|
-
if (entryMeta === undefined) {
|
|
645
|
-
if (!popup) {
|
|
646
|
-
/**
|
|
647
|
-
* 在本地名字服务插件中找得到的数据,并不一定有其对应的 `EntryMeta`,
|
|
648
|
-
* 故如查不到则创建,并标注为已过期 `EntryStatus.Outdated`,以便尽快更新
|
|
649
|
-
*/
|
|
650
|
-
entryMeta = this.createEntryMeta(type, namespace, service, true);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
else if (popup) {
|
|
654
|
-
delete entriesMeta[`${namespace}.${service}`];
|
|
655
|
-
}
|
|
656
|
-
return entryMeta;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
exports.LocalRegistry = LocalRegistry;
|
|
660
|
-
//# sourceMappingURL=registry.js.map
|