@tencent-rtc/mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/@tencent/aegis-node-sdk/CHANGELOG.md +8 -0
  2. package/@tencent/aegis-node-sdk/LICENSE +21 -0
  3. package/@tencent/aegis-node-sdk/README.md +562 -0
  4. package/@tencent/aegis-node-sdk/lib/aegis.min.js +1 -0
  5. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/config.d.ts +14 -0
  6. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/global.d.ts +1 -0
  7. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/index.d.ts +9 -0
  8. package/@tencent/aegis-node-sdk/lib/packages/core/src/constant/report-ignore.d.ts +2 -0
  9. package/@tencent/aegis-node-sdk/lib/packages/core/src/core.d.ts +85 -0
  10. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/afterRequestHooks.d.ts +3 -0
  11. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/beforeRequestHooks.d.ts +9 -0
  12. package/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/modifyRequestHooks.d.ts +3 -0
  13. package/@tencent/aegis-node-sdk/lib/packages/core/src/index.d.ts +9 -0
  14. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/config.d.ts +62 -0
  15. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/env.d.ts +11 -0
  16. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/index.d.ts +4 -0
  17. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/log.d.ts +130 -0
  18. package/@tencent/aegis-node-sdk/lib/packages/core/src/interface/send.d.ts +34 -0
  19. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/format.d.ts +2 -0
  20. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/index.d.ts +18 -0
  21. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/length-limit.d.ts +8 -0
  22. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/pv.d.ts +8 -0
  23. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/remove-payload.d.ts +2 -0
  24. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/repeat-limit.d.ts +4 -0
  25. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/report.d.ts +10 -0
  26. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/sample.d.ts +3 -0
  27. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/throttle.d.ts +3 -0
  28. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/index.d.ts +34 -0
  29. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/jwt.d.ts +12 -0
  30. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/ot-js.d.ts +14 -0
  31. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/uuid.d.ts +2 -0
  32. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/whitelist.d.ts +12 -0
  33. package/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/write-before.d.ts +3 -0
  34. package/@tencent/aegis-node-sdk/lib/packages/core/src/plugin.d.ts +33 -0
  35. package/@tencent/aegis-node-sdk/lib/packages/core/src/polyfill.d.ts +0 -0
  36. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/destroy.d.ts +2 -0
  37. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/event-emitter.d.ts +18 -0
  38. package/@tencent/aegis-node-sdk/lib/packages/core/src/util/index.d.ts +60 -0
  39. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/index.d.ts +15 -0
  40. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/interface/selector.d.ts +5 -0
  41. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/pipes/batch-report-pipe.d.ts +6 -0
  42. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_base.d.ts +18 -0
  43. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_http.d.ts +12 -0
  44. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/ip_selector.d.ts +10 -0
  45. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/polaris_selector.d.ts +20 -0
  46. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/selector_base.d.ts +27 -0
  47. package/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/util/eval_require.d.ts +2 -0
  48. package/@tencent/aegis-node-sdk/package.json +19 -0
  49. package/@tencent/polaris/README.md +407 -0
  50. package/@tencent/polaris/dist/consumer/health.d.ts +126 -0
  51. package/@tencent/polaris/dist/consumer/health.js +283 -0
  52. package/@tencent/polaris/dist/consumer/health.js.map +1 -0
  53. package/@tencent/polaris/dist/consumer/index.d.ts +120 -0
  54. package/@tencent/polaris/dist/consumer/index.js +348 -0
  55. package/@tencent/polaris/dist/consumer/index.js.map +1 -0
  56. package/@tencent/polaris/dist/consumer/monitor.d.ts +145 -0
  57. package/@tencent/polaris/dist/consumer/monitor.js +343 -0
  58. package/@tencent/polaris/dist/consumer/monitor.js.map +1 -0
  59. package/@tencent/polaris/dist/consumer/selector.d.ts +73 -0
  60. package/@tencent/polaris/dist/consumer/selector.js +316 -0
  61. package/@tencent/polaris/dist/consumer/selector.js.map +1 -0
  62. package/@tencent/polaris/dist/errors.d.ts +373 -0
  63. package/@tencent/polaris/dist/errors.js +154 -0
  64. package/@tencent/polaris/dist/errors.js.map +1 -0
  65. package/@tencent/polaris/dist/global.d.ts +16 -0
  66. package/@tencent/polaris/dist/global.js +18 -0
  67. package/@tencent/polaris/dist/global.js.map +1 -0
  68. package/@tencent/polaris/dist/index.d.ts +62 -0
  69. package/@tencent/polaris/dist/index.js +145 -0
  70. package/@tencent/polaris/dist/index.js.map +1 -0
  71. package/@tencent/polaris/dist/instance.d.ts +109 -0
  72. package/@tencent/polaris/dist/instance.js +38 -0
  73. package/@tencent/polaris/dist/instance.js.map +1 -0
  74. package/@tencent/polaris/dist/limiter/bucket.d.ts +51 -0
  75. package/@tencent/polaris/dist/limiter/bucket.js +152 -0
  76. package/@tencent/polaris/dist/limiter/bucket.js.map +1 -0
  77. package/@tencent/polaris/dist/limiter/index.d.ts +73 -0
  78. package/@tencent/polaris/dist/limiter/index.js +149 -0
  79. package/@tencent/polaris/dist/limiter/index.js.map +1 -0
  80. package/@tencent/polaris/dist/limiter/ratelimit.d.ts +27 -0
  81. package/@tencent/polaris/dist/limiter/ratelimit.js +134 -0
  82. package/@tencent/polaris/dist/limiter/ratelimit.js.map +1 -0
  83. package/@tencent/polaris/dist/limiter/ratelimiter/base.d.ts +17 -0
  84. package/@tencent/polaris/dist/limiter/ratelimiter/base.js +15 -0
  85. package/@tencent/polaris/dist/limiter/ratelimiter/base.js.map +1 -0
  86. package/@tencent/polaris/dist/limiter/ratelimiter/global.d.ts +59 -0
  87. package/@tencent/polaris/dist/limiter/ratelimiter/global.js +397 -0
  88. package/@tencent/polaris/dist/limiter/ratelimiter/global.js.map +1 -0
  89. package/@tencent/polaris/dist/limiter/ratelimiter/index.d.ts +3 -0
  90. package/@tencent/polaris/dist/limiter/ratelimiter/index.js +19 -0
  91. package/@tencent/polaris/dist/limiter/ratelimiter/index.js.map +1 -0
  92. package/@tencent/polaris/dist/limiter/ratelimiter/local.d.ts +17 -0
  93. package/@tencent/polaris/dist/limiter/ratelimiter/local.js +52 -0
  94. package/@tencent/polaris/dist/limiter/ratelimiter/local.js.map +1 -0
  95. package/@tencent/polaris/dist/location.d.ts +48 -0
  96. package/@tencent/polaris/dist/location.js +67 -0
  97. package/@tencent/polaris/dist/location.js.map +1 -0
  98. package/@tencent/polaris/dist/logging.d.ts +106 -0
  99. package/@tencent/polaris/dist/logging.js +130 -0
  100. package/@tencent/polaris/dist/logging.js.map +1 -0
  101. package/@tencent/polaris/dist/metadata.d.ts +78 -0
  102. package/@tencent/polaris/dist/metadata.js +119 -0
  103. package/@tencent/polaris/dist/metadata.js.map +1 -0
  104. package/@tencent/polaris/dist/plugins/breaker/polaris.d.ts +47 -0
  105. package/@tencent/polaris/dist/plugins/breaker/polaris.js +162 -0
  106. package/@tencent/polaris/dist/plugins/breaker/polaris.js.map +1 -0
  107. package/@tencent/polaris/dist/plugins/lb/base.d.ts +24 -0
  108. package/@tencent/polaris/dist/plugins/lb/base.js +32 -0
  109. package/@tencent/polaris/dist/plugins/lb/base.js.map +1 -0
  110. package/@tencent/polaris/dist/plugins/lb/edf.d.ts +24 -0
  111. package/@tencent/polaris/dist/plugins/lb/edf.js +77 -0
  112. package/@tencent/polaris/dist/plugins/lb/edf.js.map +1 -0
  113. package/@tencent/polaris/dist/plugins/lb/hashring.d.ts +24 -0
  114. package/@tencent/polaris/dist/plugins/lb/hashring.js +53 -0
  115. package/@tencent/polaris/dist/plugins/lb/hashring.js.map +1 -0
  116. package/@tencent/polaris/dist/plugins/lb/sticky.d.ts +31 -0
  117. package/@tencent/polaris/dist/plugins/lb/sticky.js +88 -0
  118. package/@tencent/polaris/dist/plugins/lb/sticky.js.map +1 -0
  119. package/@tencent/polaris/dist/plugins/lb/swrr.d.ts +25 -0
  120. package/@tencent/polaris/dist/plugins/lb/swrr.js +72 -0
  121. package/@tencent/polaris/dist/plugins/lb/swrr.js.map +1 -0
  122. package/@tencent/polaris/dist/plugins/lb/wr.d.ts +17 -0
  123. package/@tencent/polaris/dist/plugins/lb/wr.js +50 -0
  124. package/@tencent/polaris/dist/plugins/lb/wr.js.map +1 -0
  125. package/@tencent/polaris/dist/plugins/lb/wrr.d.ts +19 -0
  126. package/@tencent/polaris/dist/plugins/lb/wrr.js +81 -0
  127. package/@tencent/polaris/dist/plugins/lb/wrr.js.map +1 -0
  128. package/@tencent/polaris/dist/plugins/logging/console.d.ts +10 -0
  129. package/@tencent/polaris/dist/plugins/logging/console.js +38 -0
  130. package/@tencent/polaris/dist/plugins/logging/console.js.map +1 -0
  131. package/@tencent/polaris/dist/plugins/naming/local-server/index.d.ts +32 -0
  132. package/@tencent/polaris/dist/plugins/naming/local-server/index.js +88 -0
  133. package/@tencent/polaris/dist/plugins/naming/local-server/index.js.map +1 -0
  134. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.d.ts +124 -0
  135. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js +398 -0
  136. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js.map +1 -0
  137. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.d.ts +27 -0
  138. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js +287 -0
  139. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js.map +1 -0
  140. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.d.ts +15 -0
  141. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js +43 -0
  142. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js.map +1 -0
  143. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.d.ts +28 -0
  144. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js +249 -0
  145. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js.map +1 -0
  146. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.d.ts +19 -0
  147. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js +222 -0
  148. package/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js.map +1 -0
  149. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.d.ts +26 -0
  150. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js +99 -0
  151. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js.map +1 -0
  152. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.d.ts +60 -0
  153. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js +259 -0
  154. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js.map +1 -0
  155. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/discover.proto +24 -0
  156. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/monitor.proto +18 -0
  157. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/ratelimit.proto +12 -0
  158. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.d.ts +39 -0
  159. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js +115 -0
  160. package/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js.map +1 -0
  161. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/api.proto +24 -0
  162. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/client.proto +22 -0
  163. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/model.proto +28 -0
  164. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/ratelimit.proto +80 -0
  165. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/request.proto +18 -0
  166. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/response.proto +65 -0
  167. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/routing.proto +66 -0
  168. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/service.proto +95 -0
  169. package/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/types.d.ts +1568 -0
  170. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.d.ts +36 -0
  171. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.js +51 -0
  172. package/@tencent/polaris/dist/plugins/naming/polaris-server/index.js.map +1 -0
  173. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/api.proto +18 -0
  174. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/circuitbreak.proto +67 -0
  175. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/request.proto +82 -0
  176. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/response.proto +11 -0
  177. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkcache.proto +46 -0
  178. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkconfiguration.proto +16 -0
  179. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdktoken.proto +10 -0
  180. package/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/types.d.ts +1102 -0
  181. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.d.ts +29 -0
  182. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js +77 -0
  183. package/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js.map +1 -0
  184. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/api.proto +12 -0
  185. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/ratelimit.proto +28 -0
  186. package/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/types.d.ts +395 -0
  187. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.d.ts +13 -0
  188. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js +116 -0
  189. package/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js.map +1 -0
  190. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.d.ts +67 -0
  191. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.js +67 -0
  192. package/@tencent/polaris/dist/plugins/naming/polaris-server/types.js.map +1 -0
  193. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.d.ts +99 -0
  194. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js +217 -0
  195. package/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js.map +1 -0
  196. package/@tencent/polaris/dist/plugins/registry/memory.d.ts +10 -0
  197. package/@tencent/polaris/dist/plugins/registry/memory.js +50 -0
  198. package/@tencent/polaris/dist/plugins/registry/memory.js.map +1 -0
  199. package/@tencent/polaris/dist/plugins/router/polaris/nearby.d.ts +51 -0
  200. package/@tencent/polaris/dist/plugins/router/polaris/nearby.js +145 -0
  201. package/@tencent/polaris/dist/plugins/router/polaris/nearby.js.map +1 -0
  202. package/@tencent/polaris/dist/plugins/router/polaris/rule.d.ts +11 -0
  203. package/@tencent/polaris/dist/plugins/router/polaris/rule.js +174 -0
  204. package/@tencent/polaris/dist/plugins/router/polaris/rule.js.map +1 -0
  205. package/@tencent/polaris/dist/plugins/router/trpc/canary.d.ts +25 -0
  206. package/@tencent/polaris/dist/plugins/router/trpc/canary.js +36 -0
  207. package/@tencent/polaris/dist/plugins/router/trpc/canary.js.map +1 -0
  208. package/@tencent/polaris/dist/plugins/router/trpc/env.d.ts +10 -0
  209. package/@tencent/polaris/dist/plugins/router/trpc/env.js +34 -0
  210. package/@tencent/polaris/dist/plugins/router/trpc/env.js.map +1 -0
  211. package/@tencent/polaris/dist/plugins/router/trpc/set.d.ts +56 -0
  212. package/@tencent/polaris/dist/plugins/router/trpc/set.js +106 -0
  213. package/@tencent/polaris/dist/plugins/router/trpc/set.js.map +1 -0
  214. package/@tencent/polaris/dist/plugins/shaping/unirate.d.ts +31 -0
  215. package/@tencent/polaris/dist/plugins/shaping/unirate.js +124 -0
  216. package/@tencent/polaris/dist/plugins/shaping/unirate.js.map +1 -0
  217. package/@tencent/polaris/dist/plugins/shaping/warmup.d.ts +61 -0
  218. package/@tencent/polaris/dist/plugins/shaping/warmup.js +171 -0
  219. package/@tencent/polaris/dist/plugins/shaping/warmup.js.map +1 -0
  220. package/@tencent/polaris/dist/plugins/weight/polaris.d.ts +23 -0
  221. package/@tencent/polaris/dist/plugins/weight/polaris.js +159 -0
  222. package/@tencent/polaris/dist/plugins/weight/polaris.js.map +1 -0
  223. package/@tencent/polaris/dist/plugins.d.ts +619 -0
  224. package/@tencent/polaris/dist/plugins.js +91 -0
  225. package/@tencent/polaris/dist/plugins.js.map +1 -0
  226. package/@tencent/polaris/dist/polaris.d.ts +33 -0
  227. package/@tencent/polaris/dist/polaris.js +59 -0
  228. package/@tencent/polaris/dist/polaris.js.map +1 -0
  229. package/@tencent/polaris/dist/provider/index.d.ts +102 -0
  230. package/@tencent/polaris/dist/provider/index.js +168 -0
  231. package/@tencent/polaris/dist/provider/index.js.map +1 -0
  232. package/@tencent/polaris/dist/registry.d.ts +174 -0
  233. package/@tencent/polaris/dist/registry.js +660 -0
  234. package/@tencent/polaris/dist/registry.js.map +1 -0
  235. package/@tencent/polaris/dist/rules.d.ts +163 -0
  236. package/@tencent/polaris/dist/rules.js +24 -0
  237. package/@tencent/polaris/dist/rules.js.map +1 -0
  238. package/@tencent/polaris/dist/scripts/postinstall.d.ts +1 -0
  239. package/@tencent/polaris/dist/scripts/postinstall.js +71 -0
  240. package/@tencent/polaris/dist/scripts/postinstall.js.map +1 -0
  241. package/@tencent/polaris/dist/service.d.ts +18 -0
  242. package/@tencent/polaris/dist/service.js +3 -0
  243. package/@tencent/polaris/dist/service.js.map +1 -0
  244. package/@tencent/polaris/dist/skeleton.d.ts +87 -0
  245. package/@tencent/polaris/dist/skeleton.js +282 -0
  246. package/@tencent/polaris/dist/skeleton.js.map +1 -0
  247. package/@tencent/polaris/dist/utils.d.ts +36 -0
  248. package/@tencent/polaris/dist/utils.js +74 -0
  249. package/@tencent/polaris/dist/utils.js.map +1 -0
  250. package/@tencent/polaris/dist/weak.d.ts +11 -0
  251. package/@tencent/polaris/dist/weak.js +44 -0
  252. package/@tencent/polaris/dist/weak.js.map +1 -0
  253. package/@tencent/polaris/package.json +114 -0
  254. package/README.md +61 -0
  255. package/cursor-setting.png +0 -0
  256. package/index.js +16 -0
  257. package/index.js.map +1 -0
  258. package/mcp-server-prompt.png +0 -0
  259. package/mcp.json +8 -0
  260. package/package.json +49 -0
  261. package/resource/doc/tuicallkit/android/.gitkeep +0 -0
  262. package/resource/doc/tuicallkit/android/api_TUICallKit.md +610 -0
  263. package/resource/doc/tuicallkit/android/api_TUICallObserver.md +784 -0
  264. package/resource/doc/tuicallkit/android/how_to_integrated_android_callkit.md +286 -0
  265. package/resource/doc/tuicallkit/faq/faq.md +127 -0
  266. package/resource/doc/tuicallkit/flutter/api_TUICallDefine.md +938 -0
  267. package/resource/doc/tuicallkit/flutter/api_TUICallKit.md +469 -0
  268. package/resource/doc/tuicallkit/flutter/api_TUICallObserver.md +897 -0
  269. package/resource/doc/tuicallkit/flutter/how_to_integrated_flutter_callkit.md +226 -0
  270. package/resource/doc/tuicallkit/flutter/how_to_run_flutter_callkit_demo.md +101 -0
  271. package/resource/doc/tuicallkit/iOS/api_TUICallKit.md +398 -0
  272. package/resource/doc/tuicallkit/iOS/api_TUICallObserver.md +781 -0
  273. package/resource/doc/tuicallkit/iOS/how_to_integrated_iOS_callkit.md +268 -0
  274. package/resource/doc/tuicallkit/iOS/how_to_run_iOS_callkit_demo.md +98 -0
  275. package/resource/doc/tuicallkit/react/.gitkeep +0 -0
  276. package/resource/doc/tuicallkit/react/api_TUICallKit.md +354 -0
  277. package/resource/doc/tuicallkit/react/how_to_integrated_react_callkit.md +166 -0
  278. package/resource/doc/tuicallkit/react/how_to_run_react_callkit_demo.md +61 -0
  279. package/resource/doc/tuicallkit/vue/.gitkeep +0 -0
  280. package/resource/doc/tuicallkit/vue/api_TUICallKit.md +354 -0
  281. package/resource/doc/tuicallkit/vue/how_to_integrated_vue_callkit.md +187 -0
  282. package/resource/doc/tuicallkit/vue/how_to_run_vue_callkit_demo.md +61 -0
  283. package/server.js +132 -0
  284. package/server.js.map +1 -0
  285. package/streamableHttp.js +74 -0
  286. package/streamableHttp.js.map +1 -0
@@ -0,0 +1,29 @@
1
+ import { Instance } from "../../../instance";
2
+ import type { ServiceType } from "./types";
3
+ declare const kDefaultClientPoolOptions: {
4
+ /**
5
+ * 检查间隔
6
+ */
7
+ checkInterval: number;
8
+ /**
9
+ * 最长空闲时间
10
+ */
11
+ idleTime: number;
12
+ };
13
+ export declare type ClientPoolOptions = typeof kDefaultClientPoolOptions;
14
+ export interface ClosableClient {
15
+ close?: () => void;
16
+ }
17
+ export declare class ClientPool<Client extends ClosableClient> {
18
+ private readonly clientCreator;
19
+ private readonly options;
20
+ private timer;
21
+ private disposed;
22
+ private pool;
23
+ constructor(clientCreator: (address: string, type: ServiceType) => Client, options?: Partial<ClientPoolOptions>);
24
+ dispose(): void;
25
+ truncate(): void;
26
+ getOrCreateClient(instance: string | Instance, type: ServiceType): Client;
27
+ private maintenance;
28
+ }
29
+ export {};
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientPool = void 0;
4
+ const process_1 = require("process");
5
+ const errors_1 = require("../../../errors");
6
+ const utils_1 = require("../../../utils");
7
+ const kDefaultClientPoolOptions = {
8
+ /**
9
+ * 检查间隔
10
+ */
11
+ checkInterval: 1 * utils_1.kMinutes,
12
+ /**
13
+ * 最长空闲时间
14
+ */
15
+ idleTime: 1 * utils_1.kMinutes
16
+ };
17
+ class ClientPool {
18
+ constructor(clientCreator, options) {
19
+ this.clientCreator = clientCreator;
20
+ this.disposed = false;
21
+ this.pool = Object.create(null);
22
+ this.options = Object.assign(Object.assign({}, kDefaultClientPoolOptions), options);
23
+ this.timer = setInterval(() => {
24
+ this.maintenance();
25
+ }, this.options.checkInterval).unref();
26
+ }
27
+ dispose() {
28
+ this.disposed = true;
29
+ clearInterval(this.timer);
30
+ this.truncate();
31
+ }
32
+ truncate() {
33
+ Object.values(this.pool).forEach(({ client }) => {
34
+ var _a;
35
+ (_a = client.close) === null || _a === void 0 ? void 0 : _a.call(client);
36
+ });
37
+ this.pool = Object.create(null);
38
+ }
39
+ getOrCreateClient(instance, type) {
40
+ if (this.disposed) {
41
+ throw new errors_1.StateError("Already disposed");
42
+ }
43
+ let address;
44
+ if (typeof instance === "string") {
45
+ address = instance;
46
+ }
47
+ else {
48
+ address = `${instance.host}:${instance.port}`;
49
+ }
50
+ const key = `${address}.${type}`;
51
+ let clientObj = this.pool[key];
52
+ if (!clientObj) {
53
+ clientObj = {
54
+ client: this.clientCreator(address, type),
55
+ accessTime: (0, process_1.uptime)()
56
+ };
57
+ this.pool[key] = clientObj;
58
+ }
59
+ else {
60
+ clientObj.accessTime = (0, process_1.uptime)();
61
+ }
62
+ return clientObj.client;
63
+ }
64
+ maintenance() {
65
+ const now = (0, process_1.uptime)();
66
+ Object.keys(this.pool).forEach((key) => {
67
+ var _a;
68
+ const { client, accessTime } = this.pool[key];
69
+ if ((now - accessTime) * utils_1.kSeconds > this.options.idleTime) {
70
+ delete this.pool[key];
71
+ (_a = client.close) === null || _a === void 0 ? void 0 : _a.call(client);
72
+ }
73
+ });
74
+ }
75
+ }
76
+ exports.ClientPool = ClientPool;
77
+ //# sourceMappingURL=pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pool.js","sourceRoot":"","sources":["../../../../src/plugins/naming/polaris-server/pool.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC,4CAA6C;AAE7C,0CAAoD;AAGpD,MAAM,yBAAyB,GAAG;IAChC;;OAEG;IACH,aAAa,EAAE,CAAC,GAAG,gBAAQ;IAE3B;;OAEG;IACH,QAAQ,EAAE,CAAC,GAAG,gBAAQ;CACvB,CAAC;AAaF,MAAa,UAAU;IAMrB,YACmB,aAA6D,EAC9E,OAAoC;QADnB,kBAAa,GAAb,aAAa,CAAgD;QAJxE,aAAQ,GAAG,KAAK,CAAC;QACjB,SAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAqB,CAAC;QAMrD,IAAI,CAAC,OAAO,mCACP,yBAAyB,GACzB,OAAO,CACX,CAAC;QACF,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;YAC5B,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,a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ACrB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;;YACrC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAE,CAAC;YAC/C,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,gBAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACzD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACtB,MAAA,MAAM,CAAC,KAAK,sDAAI,CAAC;aAClB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApED,gCAoEC"}
@@ -0,0 +1,12 @@
1
+ syntax = "proto3";
2
+
3
+ package v1;
4
+
5
+ import "ratelimit.proto";
6
+
7
+ service RateLimitAPI {
8
+ // 限流KEY初始化
9
+ rpc InitializeQuota(RateLimitRequest) returns(RateLimitResponse) {}
10
+ // 获取限流配额
11
+ rpc AcquireQuota(stream RateLimitRequest) returns(stream RateLimitResponse) {}
12
+ }
@@ -0,0 +1,28 @@
1
+ syntax = "proto3";
2
+
3
+ package v1;
4
+
5
+ import "google/protobuf/wrappers.proto";
6
+ import "google/protobuf/duration.proto";
7
+
8
+ message RateLimitRequest {
9
+ google.protobuf.StringValue key = 1; // 限流规则唯一ID
10
+ google.protobuf.StringValue service = 2; // 服务名
11
+ google.protobuf.StringValue namespace = 3; // 命名空间
12
+ google.protobuf.Int64Value timestamp = 4; // 限流server绝对时间,单位ms
13
+ repeated Limiter totals = 5; // 限流配额
14
+ repeated Limiter useds = 6; // 每个周期已使用的配额
15
+ }
16
+
17
+ message RateLimitResponse {
18
+ google.protobuf.UInt32Value code = 1; // 返回码
19
+ google.protobuf.StringValue info = 2; // 返回码详情
20
+ google.protobuf.StringValue key = 3; // 限流规则KEY
21
+ google.protobuf.Int64Value timestamp = 4; // 限流server绝对时间,单位ms
22
+ repeated Limiter sum_useds = 5; // 限流规则当前周期,所使用的配额总量
23
+ }
24
+
25
+ message Limiter {
26
+ google.protobuf.UInt32Value amount = 1; // 配额
27
+ google.protobuf.Duration duration = 2; // 限流周期
28
+ }
@@ -0,0 +1,395 @@
1
+ import * as $protobuf from "protobufjs";
2
+ /** Namespace v1. */
3
+ export namespace v1 {
4
+
5
+ /** Represents a RateLimitAPI */
6
+ class RateLimitAPI extends $protobuf.rpc.Service {
7
+
8
+ /**
9
+ * Constructs a new RateLimitAPI service.
10
+ * @param rpcImpl RPC implementation
11
+ * @param [requestDelimited=false] Whether requests are length-delimited
12
+ * @param [responseDelimited=false] Whether responses are length-delimited
13
+ */
14
+ constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean);
15
+
16
+ /**
17
+ * Calls InitializeQuota.
18
+ * @param request RateLimitRequest message or plain object
19
+ * @param callback Node-style callback called with the error, if any, and RateLimitResponse
20
+ */
21
+ public initializeQuota(request: v1.IRateLimitRequest, callback: v1.RateLimitAPI.InitializeQuotaCallback): void;
22
+
23
+ /**
24
+ * Calls InitializeQuota.
25
+ * @param request RateLimitRequest message or plain object
26
+ * @returns Promise
27
+ */
28
+ public initializeQuota(request: v1.IRateLimitRequest): Promise<v1.RateLimitResponse>;
29
+
30
+ /**
31
+ * Calls AcquireQuota.
32
+ * @param request RateLimitRequest message or plain object
33
+ * @param callback Node-style callback called with the error, if any, and RateLimitResponse
34
+ */
35
+ public acquireQuota(request: v1.IRateLimitRequest, callback: v1.RateLimitAPI.AcquireQuotaCallback): void;
36
+
37
+ /**
38
+ * Calls AcquireQuota.
39
+ * @param request RateLimitRequest message or plain object
40
+ * @returns Promise
41
+ */
42
+ public acquireQuota(request: v1.IRateLimitRequest): Promise<v1.RateLimitResponse>;
43
+ }
44
+
45
+ namespace RateLimitAPI {
46
+
47
+ /**
48
+ * Callback as used by {@link v1.RateLimitAPI#initializeQuota}.
49
+ * @param error Error, if any
50
+ * @param [response] RateLimitResponse
51
+ */
52
+ type InitializeQuotaCallback = (error: (Error|null), response?: v1.RateLimitResponse) => void;
53
+
54
+ /**
55
+ * Callback as used by {@link v1.RateLimitAPI#acquireQuota}.
56
+ * @param error Error, if any
57
+ * @param [response] RateLimitResponse
58
+ */
59
+ type AcquireQuotaCallback = (error: (Error|null), response?: v1.RateLimitResponse) => void;
60
+ }
61
+
62
+ /** Properties of a RateLimitRequest. */
63
+ interface IRateLimitRequest {
64
+
65
+ /** RateLimitRequest key */
66
+ key?: (google.protobuf.IStringValue|null);
67
+
68
+ /** RateLimitRequest service */
69
+ service?: (google.protobuf.IStringValue|null);
70
+
71
+ /** RateLimitRequest namespace */
72
+ namespace?: (google.protobuf.IStringValue|null);
73
+
74
+ /** RateLimitRequest timestamp */
75
+ timestamp?: (google.protobuf.IInt64Value|null);
76
+
77
+ /** RateLimitRequest totals */
78
+ totals?: (v1.ILimiter[]|null);
79
+
80
+ /** RateLimitRequest useds */
81
+ useds?: (v1.ILimiter[]|null);
82
+ }
83
+
84
+ /** Represents a RateLimitRequest. */
85
+ class RateLimitRequest implements IRateLimitRequest {
86
+
87
+ /**
88
+ * Constructs a new RateLimitRequest.
89
+ * @param [properties] Properties to set
90
+ */
91
+ constructor(properties?: v1.IRateLimitRequest);
92
+
93
+ /** RateLimitRequest key. */
94
+ public key?: (google.protobuf.IStringValue|null);
95
+
96
+ /** RateLimitRequest service. */
97
+ public service?: (google.protobuf.IStringValue|null);
98
+
99
+ /** RateLimitRequest namespace. */
100
+ public namespace?: (google.protobuf.IStringValue|null);
101
+
102
+ /** RateLimitRequest timestamp. */
103
+ public timestamp?: (google.protobuf.IInt64Value|null);
104
+
105
+ /** RateLimitRequest totals. */
106
+ public totals: v1.ILimiter[];
107
+
108
+ /** RateLimitRequest useds. */
109
+ public useds: v1.ILimiter[];
110
+ }
111
+
112
+ /** Properties of a RateLimitResponse. */
113
+ interface IRateLimitResponse {
114
+
115
+ /** RateLimitResponse code */
116
+ code?: (google.protobuf.IUInt32Value|null);
117
+
118
+ /** RateLimitResponse info */
119
+ info?: (google.protobuf.IStringValue|null);
120
+
121
+ /** RateLimitResponse key */
122
+ key?: (google.protobuf.IStringValue|null);
123
+
124
+ /** RateLimitResponse timestamp */
125
+ timestamp?: (google.protobuf.IInt64Value|null);
126
+
127
+ /** RateLimitResponse sum_useds */
128
+ sum_useds?: (v1.ILimiter[]|null);
129
+ }
130
+
131
+ /** Represents a RateLimitResponse. */
132
+ class RateLimitResponse implements IRateLimitResponse {
133
+
134
+ /**
135
+ * Constructs a new RateLimitResponse.
136
+ * @param [properties] Properties to set
137
+ */
138
+ constructor(properties?: v1.IRateLimitResponse);
139
+
140
+ /** RateLimitResponse code. */
141
+ public code?: (google.protobuf.IUInt32Value|null);
142
+
143
+ /** RateLimitResponse info. */
144
+ public info?: (google.protobuf.IStringValue|null);
145
+
146
+ /** RateLimitResponse key. */
147
+ public key?: (google.protobuf.IStringValue|null);
148
+
149
+ /** RateLimitResponse timestamp. */
150
+ public timestamp?: (google.protobuf.IInt64Value|null);
151
+
152
+ /** RateLimitResponse sum_useds. */
153
+ public sum_useds: v1.ILimiter[];
154
+ }
155
+
156
+ /** Properties of a Limiter. */
157
+ interface ILimiter {
158
+
159
+ /** Limiter amount */
160
+ amount?: (google.protobuf.IUInt32Value|null);
161
+
162
+ /** Limiter duration */
163
+ duration?: (google.protobuf.IDuration|null);
164
+ }
165
+
166
+ /** Represents a Limiter. */
167
+ class Limiter implements ILimiter {
168
+
169
+ /**
170
+ * Constructs a new Limiter.
171
+ * @param [properties] Properties to set
172
+ */
173
+ constructor(properties?: v1.ILimiter);
174
+
175
+ /** Limiter amount. */
176
+ public amount?: (google.protobuf.IUInt32Value|null);
177
+
178
+ /** Limiter duration. */
179
+ public duration?: (google.protobuf.IDuration|null);
180
+ }
181
+ }
182
+
183
+ /** Namespace google. */
184
+ export namespace google {
185
+
186
+ /** Namespace protobuf. */
187
+ namespace protobuf {
188
+
189
+ /** Properties of a DoubleValue. */
190
+ interface IDoubleValue {
191
+
192
+ /** DoubleValue value */
193
+ value?: (number|null);
194
+ }
195
+
196
+ /** Represents a DoubleValue. */
197
+ class DoubleValue implements IDoubleValue {
198
+
199
+ /**
200
+ * Constructs a new DoubleValue.
201
+ * @param [properties] Properties to set
202
+ */
203
+ constructor(properties?: google.protobuf.IDoubleValue);
204
+
205
+ /** DoubleValue value. */
206
+ public value: number;
207
+ }
208
+
209
+ /** Properties of a FloatValue. */
210
+ interface IFloatValue {
211
+
212
+ /** FloatValue value */
213
+ value?: (number|null);
214
+ }
215
+
216
+ /** Represents a FloatValue. */
217
+ class FloatValue implements IFloatValue {
218
+
219
+ /**
220
+ * Constructs a new FloatValue.
221
+ * @param [properties] Properties to set
222
+ */
223
+ constructor(properties?: google.protobuf.IFloatValue);
224
+
225
+ /** FloatValue value. */
226
+ public value: number;
227
+ }
228
+
229
+ /** Properties of an Int64Value. */
230
+ interface IInt64Value {
231
+
232
+ /** Int64Value value */
233
+ value?: (number|null);
234
+ }
235
+
236
+ /** Represents an Int64Value. */
237
+ class Int64Value implements IInt64Value {
238
+
239
+ /**
240
+ * Constructs a new Int64Value.
241
+ * @param [properties] Properties to set
242
+ */
243
+ constructor(properties?: google.protobuf.IInt64Value);
244
+
245
+ /** Int64Value value. */
246
+ public value: number;
247
+ }
248
+
249
+ /** Properties of a UInt64Value. */
250
+ interface IUInt64Value {
251
+
252
+ /** UInt64Value value */
253
+ value?: (number|null);
254
+ }
255
+
256
+ /** Represents a UInt64Value. */
257
+ class UInt64Value implements IUInt64Value {
258
+
259
+ /**
260
+ * Constructs a new UInt64Value.
261
+ * @param [properties] Properties to set
262
+ */
263
+ constructor(properties?: google.protobuf.IUInt64Value);
264
+
265
+ /** UInt64Value value. */
266
+ public value: number;
267
+ }
268
+
269
+ /** Properties of an Int32Value. */
270
+ interface IInt32Value {
271
+
272
+ /** Int32Value value */
273
+ value?: (number|null);
274
+ }
275
+
276
+ /** Represents an Int32Value. */
277
+ class Int32Value implements IInt32Value {
278
+
279
+ /**
280
+ * Constructs a new Int32Value.
281
+ * @param [properties] Properties to set
282
+ */
283
+ constructor(properties?: google.protobuf.IInt32Value);
284
+
285
+ /** Int32Value value. */
286
+ public value: number;
287
+ }
288
+
289
+ /** Properties of a UInt32Value. */
290
+ interface IUInt32Value {
291
+
292
+ /** UInt32Value value */
293
+ value?: (number|null);
294
+ }
295
+
296
+ /** Represents a UInt32Value. */
297
+ class UInt32Value implements IUInt32Value {
298
+
299
+ /**
300
+ * Constructs a new UInt32Value.
301
+ * @param [properties] Properties to set
302
+ */
303
+ constructor(properties?: google.protobuf.IUInt32Value);
304
+
305
+ /** UInt32Value value. */
306
+ public value: number;
307
+ }
308
+
309
+ /** Properties of a BoolValue. */
310
+ interface IBoolValue {
311
+
312
+ /** BoolValue value */
313
+ value?: (boolean|null);
314
+ }
315
+
316
+ /** Represents a BoolValue. */
317
+ class BoolValue implements IBoolValue {
318
+
319
+ /**
320
+ * Constructs a new BoolValue.
321
+ * @param [properties] Properties to set
322
+ */
323
+ constructor(properties?: google.protobuf.IBoolValue);
324
+
325
+ /** BoolValue value. */
326
+ public value: boolean;
327
+ }
328
+
329
+ /** Properties of a StringValue. */
330
+ interface IStringValue {
331
+
332
+ /** StringValue value */
333
+ value?: (string|null);
334
+ }
335
+
336
+ /** Represents a StringValue. */
337
+ class StringValue implements IStringValue {
338
+
339
+ /**
340
+ * Constructs a new StringValue.
341
+ * @param [properties] Properties to set
342
+ */
343
+ constructor(properties?: google.protobuf.IStringValue);
344
+
345
+ /** StringValue value. */
346
+ public value: string;
347
+ }
348
+
349
+ /** Properties of a BytesValue. */
350
+ interface IBytesValue {
351
+
352
+ /** BytesValue value */
353
+ value?: (Uint8Array|null);
354
+ }
355
+
356
+ /** Represents a BytesValue. */
357
+ class BytesValue implements IBytesValue {
358
+
359
+ /**
360
+ * Constructs a new BytesValue.
361
+ * @param [properties] Properties to set
362
+ */
363
+ constructor(properties?: google.protobuf.IBytesValue);
364
+
365
+ /** BytesValue value. */
366
+ public value: Uint8Array;
367
+ }
368
+
369
+ /** Properties of a Duration. */
370
+ interface IDuration {
371
+
372
+ /** Duration seconds */
373
+ seconds?: (number|null);
374
+
375
+ /** Duration nanos */
376
+ nanos?: (number|null);
377
+ }
378
+
379
+ /** Represents a Duration. */
380
+ class Duration implements IDuration {
381
+
382
+ /**
383
+ * Constructs a new Duration.
384
+ * @param [properties] Properties to set
385
+ */
386
+ constructor(properties?: google.protobuf.IDuration);
387
+
388
+ /** Duration seconds. */
389
+ public seconds: number;
390
+
391
+ /** Duration nanos. */
392
+ public nanos: number;
393
+ }
394
+ }
395
+ }
@@ -0,0 +1,13 @@
1
+ import { MetadataCondition, RoutingRules } from "../../..";
2
+ import { v1 as Polaris } from "./discover-pb/types";
3
+ import { Boxable, DeconstructorWrappers } from "./types";
4
+ declare type Metadata = NonNullable<DeconstructorWrappers<(Polaris.IDestination & Polaris.ISource)["metadata"]>>;
5
+ export declare class RuleProcessor {
6
+ private readonly unbox;
7
+ constructor(unbox: Boxable["unbox"]);
8
+ procRules(rules: DeconstructorWrappers<Polaris.IRoute>[]): RoutingRules[];
9
+ produceMetadata(metadata?: Metadata): MetadataCondition;
10
+ private procSourceRules;
11
+ private procDestinationRules;
12
+ }
13
+ export {};
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RuleProcessor = void 0;
4
+ const __1 = require("../../..");
5
+ const utils_1 = require("../../../utils");
6
+ const types_1 = require("./types");
7
+ class RuleProcessor {
8
+ constructor(unbox) {
9
+ this.unbox = unbox;
10
+ /**
11
+ * (empty function)
12
+ */
13
+ }
14
+ procRules(rules) {
15
+ const result = [];
16
+ rules.forEach(({ sources, destinations }) => {
17
+ if (sources && destinations) {
18
+ result.push({
19
+ sources: this.procSourceRules(sources),
20
+ destinations: this.procDestinationRules(destinations)
21
+ });
22
+ }
23
+ });
24
+ return result;
25
+ }
26
+ produceMetadata(metadata) {
27
+ const destMetadata = Object.create(null);
28
+ if (metadata) {
29
+ Object.keys(metadata).forEach((key) => {
30
+ const matchString = metadata[key];
31
+ if (matchString.value_type !== types_1.ValueType.PARAMETER && !matchString.value) {
32
+ return;
33
+ }
34
+ let payload;
35
+ switch (matchString.type) {
36
+ case types_1.MatchStringType.EXACT: {
37
+ payload = this.unbox(matchString.value, "");
38
+ break;
39
+ }
40
+ case types_1.MatchStringType.REGEX: {
41
+ payload = new RegExp(this.unbox(matchString.value, ""));
42
+ break;
43
+ }
44
+ default: {
45
+ (0, utils_1.UNREACHABLE)();
46
+ }
47
+ }
48
+ switch (matchString.value_type) {
49
+ case types_1.ValueType.PARAMETER: {
50
+ destMetadata[key] = {
51
+ source: __1.MetadataDynamicValueSource.Parameter
52
+ };
53
+ break;
54
+ }
55
+ case types_1.ValueType.VARIABLE: {
56
+ destMetadata[key] = {
57
+ source: __1.MetadataDynamicValueSource.Variable,
58
+ payload
59
+ };
60
+ break;
61
+ }
62
+ case types_1.ValueType.TEXT: {
63
+ destMetadata[key] = {
64
+ source: __1.MetadataDynamicValueSource.Payload,
65
+ payload
66
+ };
67
+ break;
68
+ }
69
+ default: {
70
+ (0, utils_1.UNREACHABLE)();
71
+ }
72
+ }
73
+ });
74
+ }
75
+ return destMetadata;
76
+ }
77
+ procSourceRules(rules) {
78
+ const result = [];
79
+ rules.forEach(({ service, metadata }) => {
80
+ const serviceName = this.unbox(service, "");
81
+ if (serviceName) {
82
+ const source = {
83
+ service: serviceName
84
+ };
85
+ if (metadata) {
86
+ source.metadata = this.produceMetadata(metadata);
87
+ }
88
+ result.push(source);
89
+ }
90
+ });
91
+ return result;
92
+ }
93
+ procDestinationRules(rules) {
94
+ const result = [];
95
+ rules.forEach(({ service, metadata, priority, transfer, weight }) => {
96
+ const serviceName = this.unbox(service, "");
97
+ if (serviceName) {
98
+ const dest = {
99
+ service: serviceName,
100
+ priority: this.unbox(priority, 9),
101
+ weight: this.unbox(weight, 0)
102
+ };
103
+ if (transfer) {
104
+ dest.transfer = this.unbox(transfer, "");
105
+ }
106
+ if (metadata) {
107
+ dest.metadata = this.produceMetadata(metadata);
108
+ }
109
+ result.push(dest);
110
+ }
111
+ });
112
+ return result;
113
+ }
114
+ }
115
+ exports.RuleProcessor = RuleProcessor;
116
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/plugins/naming/polaris-server/rules.ts"],"names":[],"mappings":";;;AAAA,gCAAoH;AACpH,0CAA6C;AAE7C,mCAAqF;AAIrF,MAAa,aAAa;IACxB,YAA6B,KAAuB;QAAvB,UAAK,GAAL,KAAK,CAAkB;QAClD;;WAEG;IACL,CAAC;IAED,SAAS,CAAC,KAA8C;QACtD,MAAM,MAAM,GAAmB,EAAE,CAAC;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;YAC1C,IAAI,OAAO,IAAI,YAAY,EAAE;gBAC3B,MAAM,CAAC,IAAI,CAAC;oBACV,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;oBACtC,YAAY,EAAE,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC;iBACtD,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,eAAe,CAAC,QAAmB;QACjC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAsB,CAAC;QAE9D,IAAI,QAAQ,EAAE;YACZ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACpC,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAElC,IAAI,WAAW,CAAC,UAAU,KAAK,iBAAS,CAAC,SAAS,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE;oBACxE,OAAO;iBACR;gBAED,IAAI,OAAwB,CAAC;gBAC7B,Q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