@adminide-stack/extension-api 0.0.2-alpha.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 (318) hide show
  1. package/LICENSE +39 -0
  2. package/README.md +9 -0
  3. package/lib/connections/jsonrpc2/connection.d.ts +55 -0
  4. package/lib/connections/jsonrpc2/connection.js +575 -0
  5. package/lib/connections/jsonrpc2/connection.js.map +1 -0
  6. package/lib/connections/jsonrpc2/connection.test.d.ts +1 -0
  7. package/lib/connections/jsonrpc2/connection.test.js +443 -0
  8. package/lib/connections/jsonrpc2/connection.test.js.map +1 -0
  9. package/lib/connections/jsonrpc2/events.d.ts +24 -0
  10. package/lib/connections/jsonrpc2/events.js +117 -0
  11. package/lib/connections/jsonrpc2/events.js.map +1 -0
  12. package/lib/connections/jsonrpc2/index.d.ts +5 -0
  13. package/lib/connections/jsonrpc2/index.js +24 -0
  14. package/lib/connections/jsonrpc2/index.js.map +1 -0
  15. package/lib/connections/jsonrpc2/linkedMap.d.ts +29 -0
  16. package/lib/connections/jsonrpc2/linkedMap.js +254 -0
  17. package/lib/connections/jsonrpc2/linkedMap.js.map +1 -0
  18. package/lib/connections/jsonrpc2/linkedMap.test.d.ts +1 -0
  19. package/lib/connections/jsonrpc2/linkedMap.test.js +62 -0
  20. package/lib/connections/jsonrpc2/linkedMap.test.js.map +1 -0
  21. package/lib/connections/jsonrpc2/messages.d.ts +117 -0
  22. package/lib/connections/jsonrpc2/messages.js +72 -0
  23. package/lib/connections/jsonrpc2/messages.js.map +1 -0
  24. package/lib/connections/jsonrpc2/test-helper.d.ts +8 -0
  25. package/lib/connections/jsonrpc2/test-helper.js +36 -0
  26. package/lib/connections/jsonrpc2/test-helper.js.map +1 -0
  27. package/lib/connections/jsonrpc2/trace.d.ts +30 -0
  28. package/lib/connections/jsonrpc2/trace.js +96 -0
  29. package/lib/connections/jsonrpc2/trace.js.map +1 -0
  30. package/lib/connections/jsonrpc2/transport.d.ts +36 -0
  31. package/lib/connections/jsonrpc2/transport.js +66 -0
  32. package/lib/connections/jsonrpc2/transport.js.map +1 -0
  33. package/lib/connections/jsonrpc2/transports/browser-websocket.d.ts +0 -0
  34. package/lib/connections/jsonrpc2/transports/browser-websocket.js +189 -0
  35. package/lib/connections/jsonrpc2/transports/browser-websocket.js.map +1 -0
  36. package/lib/connections/jsonrpc2/transports/merged.d.ts +0 -0
  37. package/lib/connections/jsonrpc2/transports/merged.js +239 -0
  38. package/lib/connections/jsonrpc2/transports/merged.js.map +1 -0
  39. package/lib/connections/jsonrpc2/transports/webSocket.d.ts +0 -0
  40. package/lib/connections/jsonrpc2/transports/webSocket.js +138 -0
  41. package/lib/connections/jsonrpc2/transports/webSocket.js.map +1 -0
  42. package/lib/connections/jsonrpc2/transports/webWorker.d.ts +22 -0
  43. package/lib/connections/jsonrpc2/transports/webWorker.js +111 -0
  44. package/lib/connections/jsonrpc2/transports/webWorker.js.map +1 -0
  45. package/lib/connections/proxy/index.d.ts +1 -0
  46. package/lib/connections/proxy/index.js +18 -0
  47. package/lib/connections/proxy/index.js.map +1 -0
  48. package/lib/connections/proxy/proxy.d.ts +49 -0
  49. package/lib/connections/proxy/proxy.js +108 -0
  50. package/lib/connections/proxy/proxy.js.map +1 -0
  51. package/lib/connections/proxy/proxy.test.d.ts +1 -0
  52. package/lib/connections/proxy/proxy.test.js +55 -0
  53. package/lib/connections/proxy/proxy.test.js.map +1 -0
  54. package/lib/connections/remote-rpc/browser-remote-rpc.d.ts +12 -0
  55. package/lib/connections/remote-rpc/browser-remote-rpc.js +62 -0
  56. package/lib/connections/remote-rpc/browser-remote-rpc.js.map +1 -0
  57. package/lib/connections/remote-rpc/browser-server-rpc.test.d.ts +0 -0
  58. package/lib/connections/remote-rpc/browser-server-rpc.test.js +317 -0
  59. package/lib/connections/remote-rpc/browser-server-rpc.test.js.map +1 -0
  60. package/lib/connections/remote-rpc/index.d.ts +1 -0
  61. package/lib/connections/remote-rpc/index.js +18 -0
  62. package/lib/connections/remote-rpc/index.js.map +1 -0
  63. package/lib/connections/remote-rpc/old-browser-remote-rpc.d.ts +12 -0
  64. package/lib/connections/remote-rpc/old-browser-remote-rpc.js +41 -0
  65. package/lib/connections/remote-rpc/old-browser-remote-rpc.js.map +1 -0
  66. package/lib/connections/remote-rpc/rxjs-websockets.d.ts +18 -0
  67. package/lib/connections/remote-rpc/rxjs-websockets.js +80 -0
  68. package/lib/connections/remote-rpc/rxjs-websockets.js.map +1 -0
  69. package/lib/constants/action-types.d.ts +30 -0
  70. package/lib/constants/action-types.js +38 -0
  71. package/lib/constants/action-types.js.map +1 -0
  72. package/lib/constants/index.d.ts +2 -0
  73. package/lib/constants/index.js +19 -0
  74. package/lib/constants/index.js.map +1 -0
  75. package/lib/constants/types.d.ts +8 -0
  76. package/lib/constants/types.js +12 -0
  77. package/lib/constants/types.js.map +1 -0
  78. package/lib/core/expr/evaluator.d.ts +27 -0
  79. package/lib/core/expr/evaluator.js +144 -0
  80. package/lib/core/expr/evaluator.js.map +1 -0
  81. package/lib/core/expr/evaluator.test.d.ts +1 -0
  82. package/lib/core/expr/evaluator.test.js +52 -0
  83. package/lib/core/expr/evaluator.test.js.map +1 -0
  84. package/lib/core/expr/index.d.ts +3 -0
  85. package/lib/core/expr/index.js +20 -0
  86. package/lib/core/expr/index.js.map +1 -0
  87. package/lib/core/expr/lexer.d.ts +114 -0
  88. package/lib/core/expr/lexer.js +418 -0
  89. package/lib/core/expr/lexer.js.map +1 -0
  90. package/lib/core/expr/parser.d.ts +52 -0
  91. package/lib/core/expr/parser.js +242 -0
  92. package/lib/core/expr/parser.js.map +1 -0
  93. package/lib/core/index.d.ts +2 -0
  94. package/lib/core/index.js +19 -0
  95. package/lib/core/index.js.map +1 -0
  96. package/lib/core/types/ext-host-types-bk.d.ts +0 -0
  97. package/lib/core/types/ext-host-types-bk.js +1275 -0
  98. package/lib/core/types/ext-host-types-bk.js.map +1 -0
  99. package/lib/core/types/ext-host-types.d.ts +32 -0
  100. package/lib/core/types/ext-host-types.js +71 -0
  101. package/lib/core/types/ext-host-types.js.map +1 -0
  102. package/lib/core/types/index.d.ts +1 -0
  103. package/lib/core/types/index.js +18 -0
  104. package/lib/core/types/index.js.map +1 -0
  105. package/lib/errors/errors.d.ts +1 -0
  106. package/lib/errors/errors.js +13 -0
  107. package/lib/errors/errors.js.map +1 -0
  108. package/lib/errors/index.d.ts +1 -0
  109. package/lib/errors/index.js +18 -0
  110. package/lib/errors/index.js.map +1 -0
  111. package/lib/index.d.ts +7 -0
  112. package/lib/index.js +24 -0
  113. package/lib/index.js.map +1 -0
  114. package/lib/interfaces/command.d.ts +28 -0
  115. package/lib/interfaces/command.js +3 -0
  116. package/lib/interfaces/command.js.map +1 -0
  117. package/lib/interfaces/configuration.d.ts +36 -0
  118. package/lib/interfaces/configuration.js +3 -0
  119. package/lib/interfaces/configuration.js.map +1 -0
  120. package/lib/interfaces/connection.d.ts +12 -0
  121. package/lib/interfaces/connection.js +3 -0
  122. package/lib/interfaces/connection.js.map +1 -0
  123. package/lib/interfaces/context.d.ts +12 -0
  124. package/lib/interfaces/context.js +3 -0
  125. package/lib/interfaces/context.js.map +1 -0
  126. package/lib/interfaces/contributions/contribution-service.d.ts +20 -0
  127. package/lib/interfaces/contributions/contribution-service.js +3 -0
  128. package/lib/interfaces/contributions/contribution-service.js.map +1 -0
  129. package/lib/interfaces/contributions/contribution.d.ts +383 -0
  130. package/lib/interfaces/contributions/contribution.js +49 -0
  131. package/lib/interfaces/contributions/contribution.js.map +1 -0
  132. package/lib/interfaces/contributions/index.d.ts +2 -0
  133. package/lib/interfaces/contributions/index.js +19 -0
  134. package/lib/interfaces/contributions/index.js.map +1 -0
  135. package/lib/interfaces/controller.d.ts +30 -0
  136. package/lib/interfaces/controller.js +3 -0
  137. package/lib/interfaces/controller.js.map +1 -0
  138. package/lib/interfaces/errors.d.ts +5 -0
  139. package/lib/interfaces/errors.js +3 -0
  140. package/lib/interfaces/errors.js.map +1 -0
  141. package/lib/interfaces/ext-services/contributon-registry.d.ts +45 -0
  142. package/lib/interfaces/ext-services/contributon-registry.js +3 -0
  143. package/lib/interfaces/ext-services/contributon-registry.js.map +1 -0
  144. package/lib/interfaces/ext-services/ext-services.d.ts +23 -0
  145. package/lib/interfaces/ext-services/ext-services.js +3 -0
  146. package/lib/interfaces/ext-services/ext-services.js.map +1 -0
  147. package/lib/interfaces/ext-services/extension-service.d.ts +8 -0
  148. package/lib/interfaces/ext-services/extension-service.js +3 -0
  149. package/lib/interfaces/ext-services/extension-service.js.map +1 -0
  150. package/lib/interfaces/ext-services/index.d.ts +8 -0
  151. package/lib/interfaces/ext-services/index.js +25 -0
  152. package/lib/interfaces/ext-services/index.js.map +1 -0
  153. package/lib/interfaces/ext-services/model-service.d.ts +89 -0
  154. package/lib/interfaces/ext-services/model-service.js +3 -0
  155. package/lib/interfaces/ext-services/model-service.js.map +1 -0
  156. package/lib/interfaces/ext-services/panel-view-registry.d.ts +21 -0
  157. package/lib/interfaces/ext-services/panel-view-registry.js +3 -0
  158. package/lib/interfaces/ext-services/panel-view-registry.js.map +1 -0
  159. package/lib/interfaces/ext-services/settings-service.d.ts +18 -0
  160. package/lib/interfaces/ext-services/settings-service.js +3 -0
  161. package/lib/interfaces/ext-services/settings-service.js.map +1 -0
  162. package/lib/interfaces/ext-services/view-service.d.ts +65 -0
  163. package/lib/interfaces/ext-services/view-service.js +4 -0
  164. package/lib/interfaces/ext-services/view-service.js.map +1 -0
  165. package/lib/interfaces/ext-services/viewer-service.d.ts +125 -0
  166. package/lib/interfaces/ext-services/viewer-service.js +5 -0
  167. package/lib/interfaces/ext-services/viewer-service.js.map +1 -0
  168. package/lib/interfaces/extension-manifest.d.ts +8 -0
  169. package/lib/interfaces/extension-manifest.js +3 -0
  170. package/lib/interfaces/extension-manifest.js.map +1 -0
  171. package/lib/interfaces/extension.d.ts +72 -0
  172. package/lib/interfaces/extension.js +3 -0
  173. package/lib/interfaces/extension.js.map +1 -0
  174. package/lib/interfaces/generated-models.d.ts +3716 -0
  175. package/lib/interfaces/generated-models.js +648 -0
  176. package/lib/interfaces/generated-models.js.map +1 -0
  177. package/lib/interfaces/graphql.d.ts +17 -0
  178. package/lib/interfaces/graphql.js +5 -0
  179. package/lib/interfaces/graphql.js.map +1 -0
  180. package/lib/interfaces/index.d.ts +21 -0
  181. package/lib/interfaces/index.js +38 -0
  182. package/lib/interfaces/index.js.map +1 -0
  183. package/lib/interfaces/languages-types.d.ts +65 -0
  184. package/lib/interfaces/languages-types.js +3 -0
  185. package/lib/interfaces/languages-types.js.map +1 -0
  186. package/lib/interfaces/model.d.ts +51 -0
  187. package/lib/interfaces/model.js +9 -0
  188. package/lib/interfaces/model.js.map +1 -0
  189. package/lib/interfaces/plain-types.d.ts +4 -0
  190. package/lib/interfaces/plain-types.js +6 -0
  191. package/lib/interfaces/plain-types.js.map +1 -0
  192. package/lib/interfaces/plainTypes.d.ts +68 -0
  193. package/lib/interfaces/plainTypes.js +3 -0
  194. package/lib/interfaces/plainTypes.js.map +1 -0
  195. package/lib/interfaces/platform-context.d.ts +82 -0
  196. package/lib/interfaces/platform-context.js +3 -0
  197. package/lib/interfaces/platform-context.js.map +1 -0
  198. package/lib/interfaces/react-props/action-item.d.ts +20 -0
  199. package/lib/interfaces/react-props/action-item.js +3 -0
  200. package/lib/interfaces/react-props/action-item.js.map +1 -0
  201. package/lib/interfaces/react-props/extension-controller.d.ts +11 -0
  202. package/lib/interfaces/react-props/extension-controller.js +3 -0
  203. package/lib/interfaces/react-props/extension-controller.js.map +1 -0
  204. package/lib/interfaces/react-props/index.d.ts +3 -0
  205. package/lib/interfaces/react-props/index.js +20 -0
  206. package/lib/interfaces/react-props/index.js.map +1 -0
  207. package/lib/interfaces/react-props/platform-context.d.ts +7 -0
  208. package/lib/interfaces/react-props/platform-context.js +3 -0
  209. package/lib/interfaces/react-props/platform-context.js.map +1 -0
  210. package/lib/interfaces/registry-extension.d.ts +21 -0
  211. package/lib/interfaces/registry-extension.js +3 -0
  212. package/lib/interfaces/registry-extension.js.map +1 -0
  213. package/lib/interfaces/settings.d.ts +51 -0
  214. package/lib/interfaces/settings.js +3 -0
  215. package/lib/interfaces/settings.js.map +1 -0
  216. package/lib/interfaces/text-document.d.ts +57 -0
  217. package/lib/interfaces/text-document.js +119 -0
  218. package/lib/interfaces/text-document.js.map +1 -0
  219. package/lib/interfaces/webview/index.d.ts +3 -0
  220. package/lib/interfaces/webview/index.js +20 -0
  221. package/lib/interfaces/webview/index.js.map +1 -0
  222. package/lib/interfaces/webview/webview-manager-service.d.ts +22 -0
  223. package/lib/interfaces/webview/webview-manager-service.js +3 -0
  224. package/lib/interfaces/webview/webview-manager-service.js.map +1 -0
  225. package/lib/interfaces/webview/webview-port-mapping.d.ts +4 -0
  226. package/lib/interfaces/webview/webview-port-mapping.js +3 -0
  227. package/lib/interfaces/webview/webview-port-mapping.js.map +1 -0
  228. package/lib/interfaces/webview/webview.d.ts +99 -0
  229. package/lib/interfaces/webview/webview.js +9 -0
  230. package/lib/interfaces/webview/webview.js.map +1 -0
  231. package/lib/main.d.ts +0 -0
  232. package/lib/main.js +3 -0
  233. package/lib/main.js.map +1 -0
  234. package/lib/protocol/client.protocol.d.ts +99 -0
  235. package/lib/protocol/client.protocol.js +8 -0
  236. package/lib/protocol/client.protocol.js.map +1 -0
  237. package/lib/protocol/common.protocol.d.ts +289 -0
  238. package/lib/protocol/common.protocol.js +68 -0
  239. package/lib/protocol/common.protocol.js.map +1 -0
  240. package/lib/protocol/editor-missing-types.d.ts +87 -0
  241. package/lib/protocol/editor-missing-types.js +10 -0
  242. package/lib/protocol/editor-missing-types.js.map +1 -0
  243. package/lib/protocol/index.d.ts +6 -0
  244. package/lib/protocol/index.js +24 -0
  245. package/lib/protocol/index.js.map +1 -0
  246. package/lib/protocol/proxy-identifier.d.ts +51 -0
  247. package/lib/protocol/proxy-identifier.js +59 -0
  248. package/lib/protocol/proxy-identifier.js.map +1 -0
  249. package/lib/protocol/rpc-logger.d.ts +8 -0
  250. package/lib/protocol/rpc-logger.js +60 -0
  251. package/lib/protocol/rpc-logger.js.map +1 -0
  252. package/lib/protocol/rpc-protocol.d.ts +148 -0
  253. package/lib/protocol/rpc-protocol.js +750 -0
  254. package/lib/protocol/rpc-protocol.js.map +1 -0
  255. package/lib/protocol/rpc-protocol.test.d.ts +1 -0
  256. package/lib/protocol/rpc-protocol.test.js +171 -0
  257. package/lib/protocol/rpc-protocol.test.js.map +1 -0
  258. package/lib/protocol/server.protocol-bk.d.ts +0 -0
  259. package/lib/protocol/server.protocol-bk.js +719 -0
  260. package/lib/protocol/server.protocol-bk.js.map +1 -0
  261. package/lib/protocol/server.protocol.d.ts +91 -0
  262. package/lib/protocol/server.protocol.js +31 -0
  263. package/lib/protocol/server.protocol.js.map +1 -0
  264. package/lib/protocol/shared/editor.d.ts +4 -0
  265. package/lib/protocol/shared/editor.js +28 -0
  266. package/lib/protocol/shared/editor.js.map +1 -0
  267. package/lib/protocol/shared/tasks.d.ts +104 -0
  268. package/lib/protocol/shared/tasks.js +4 -0
  269. package/lib/protocol/shared/tasks.js.map +1 -0
  270. package/lib/protocol/temporary-types.d.ts +198 -0
  271. package/lib/protocol/temporary-types.js +30 -0
  272. package/lib/protocol/temporary-types.js.map +1 -0
  273. package/lib/protocol/utils/index.d.ts +1 -0
  274. package/lib/protocol/utils/index.js +18 -0
  275. package/lib/protocol/utils/index.js.map +1 -0
  276. package/lib/protocol/utils/lazy-promise.d.ts +18 -0
  277. package/lib/protocol/utils/lazy-promise.js +69 -0
  278. package/lib/protocol/utils/lazy-promise.js.map +1 -0
  279. package/lib/utils/errors.d.ts +6 -0
  280. package/lib/utils/errors.js +19 -0
  281. package/lib/utils/errors.js.map +1 -0
  282. package/lib/utils/extensions.d.ts +9 -0
  283. package/lib/utils/extensions.js +25 -0
  284. package/lib/utils/extensions.js.map +1 -0
  285. package/lib/utils/helper.test.d.ts +9 -0
  286. package/lib/utils/helper.test.js +15 -0
  287. package/lib/utils/helper.test.js.map +1 -0
  288. package/lib/utils/index.d.ts +7 -0
  289. package/lib/utils/index.js +25 -0
  290. package/lib/utils/index.js.map +1 -0
  291. package/lib/utils/paths-util.d.ts +27 -0
  292. package/lib/utils/paths-util.js +127 -0
  293. package/lib/utils/paths-util.js.map +1 -0
  294. package/lib/utils/rxjs/combineLatestOrDefault.d.ts +28 -0
  295. package/lib/utils/rxjs/combineLatestOrDefault.js +111 -0
  296. package/lib/utils/rxjs/combineLatestOrDefault.js.map +1 -0
  297. package/lib/utils/rxjs/combineLatestOrDefault.test.d.ts +1 -0
  298. package/lib/utils/rxjs/combineLatestOrDefault.test.js +52 -0
  299. package/lib/utils/rxjs/combineLatestOrDefault.test.js.map +1 -0
  300. package/lib/utils/rxjs/index.d.ts +1 -0
  301. package/lib/utils/rxjs/index.js +18 -0
  302. package/lib/utils/rxjs/index.js.map +1 -0
  303. package/lib/utils/util.d.ts +19 -0
  304. package/lib/utils/util.js +57 -0
  305. package/lib/utils/util.js.map +1 -0
  306. package/lib/worker-lib/MessageTypes.d.ts +5 -0
  307. package/lib/worker-lib/MessageTypes.js +9 -0
  308. package/lib/worker-lib/MessageTypes.js.map +1 -0
  309. package/lib/worker-lib/index.d.ts +2 -0
  310. package/lib/worker-lib/index.js +19 -0
  311. package/lib/worker-lib/index.js.map +1 -0
  312. package/lib/worker-lib/webWorkerLink.d.ts +12 -0
  313. package/lib/worker-lib/webWorkerLink.js +96 -0
  314. package/lib/worker-lib/webWorkerLink.js.map +1 -0
  315. package/lib/worker-lib/workerUtils.d.ts +11 -0
  316. package/lib/worker-lib/workerUtils.js +178 -0
  317. package/lib/worker-lib/workerUtils.js.map +1 -0
  318. package/package.json +60 -0
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handleServerProxyRequests = exports.handleServerProxyRequest = exports.handleRequests = exports.createProxy = exports.createExtensionProxy = exports.createProxyAndHandleRequests = void 0;
4
+ /**
5
+ *
6
+ * @param prefix
7
+ * @param connection
8
+ * @param handler
9
+ * @return A proxy that translates method calls on itself to requests sent on the {@link connection}.
10
+ */
11
+ function createProxyAndHandleRequests(prefix, connection, handler) {
12
+ handleRequests(connection, prefix, handler);
13
+ return createProxy(connection, prefix);
14
+ }
15
+ exports.createProxyAndHandleRequests = createProxyAndHandleRequests;
16
+ function createExtensionProxy(connection, rpcId) {
17
+ let handler = {
18
+ get: (target, name) => {
19
+ if (!target[name] && name[0] === '$') {
20
+ const method = `${rpcId}/${name}`;
21
+ target[name] = (...myArgs) => {
22
+ return connection.sendRequest(method, myArgs);
23
+ };
24
+ }
25
+ return target[name];
26
+ },
27
+ };
28
+ return new Proxy(Object.create(null), handler);
29
+ }
30
+ exports.createExtensionProxy = createExtensionProxy;
31
+ /**
32
+ * Creates a Proxy that translates method calls (whose name begins with "$") on the returned object to messages
33
+ * named `${prefix}/${name}` on the connectino.
34
+ *
35
+ * @param connection - The connection to send messages on when proxy methods are called.
36
+ * @param prefix - The name prefix for connection methods.
37
+ */
38
+ function createProxy(connection, prefix) {
39
+ return new Proxy(Object.create(null), {
40
+ get: (target, name) => {
41
+ if (!target[name] && name[0] === '$') {
42
+ const method = `${prefix}/${name}`;
43
+ if (name.startsWith('$observe')) {
44
+ target[name] = (...args) => connection.observeRequest(method, args);
45
+ }
46
+ else {
47
+ target[name] = (...args) => connection.sendRequest(method, args, null);
48
+ }
49
+ }
50
+ return target[name];
51
+ },
52
+ });
53
+ }
54
+ exports.createProxy = createProxy;
55
+ /**
56
+ * Forwards all requests received on the connection to the corresponding method on the handler object. The
57
+ * connection method `${prefix}/${name}` corresponds to `${name}` method on the handler object.
58
+ *
59
+ *
60
+ * @param connection - connection
61
+ * @param prefix - connection prefix
62
+ * @param handler - An instance of a class whose methods should be called when the connection receives
63
+ * corresponding requests, or an object created with Object.create(null) (or otherwise with a null
64
+ * prototype) whose properties contain functions to be called.
65
+ */
66
+ function handleRequests(connection, prefix, handler) {
67
+ // A class instance's methods are own, non-enumerable properties of its prototype.
68
+ const proto = Object.getPrototypeOf(handler) || handler;
69
+ for (const name of Object.getOwnPropertyNames(proto)) {
70
+ const value = proto[name];
71
+ if (name[0] === '$' && typeof value === 'function') {
72
+ connection.onRequest(`${prefix}/${name}`, (args) => value.apply(handler, args));
73
+ }
74
+ }
75
+ }
76
+ exports.handleRequests = handleRequests;
77
+ /**
78
+ * Forwards all requests received on the connection to the corresponding method on the server side.
79
+ *
80
+ * @param connection - connection
81
+ * @param extContext - Remote Context, usually for connecting to Server side providers
82
+ * @param identifier - Remote Actor Identifier.
83
+ */
84
+ function handleServerProxyRequest(connection, remoteProtocol, identifier) {
85
+ const aProxy = remoteProtocol.getProxy(identifier);
86
+ connection.onRequest(`${identifier.sid}/*`, (args, signal, method) => {
87
+ const methodName = method.split('/')[1];
88
+ if (!methodName) {
89
+ throw new Error('method is not defined');
90
+ }
91
+ return aProxy[methodName](...args, signal);
92
+ });
93
+ }
94
+ exports.handleServerProxyRequest = handleServerProxyRequest;
95
+ /**
96
+ * Forwards all requests received on the connection to the corresponding method on the server side.
97
+ *
98
+ * @param connection - connection
99
+ * @param extContext - Remote Context, usually for connecting to Server side providers
100
+ * @param identifier - Remote Actor Identifier.
101
+ */
102
+ function handleServerProxyRequests(connection, remoteProtocol, identifiers) {
103
+ for (let i in identifiers) {
104
+ handleServerProxyRequest(connection, remoteProtocol, identifiers[i]);
105
+ }
106
+ }
107
+ exports.handleServerProxyRequests = handleServerProxyRequests;
108
+ //# sourceMappingURL=proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/connections/proxy/proxy.ts"],"names":[],"mappings":";;;AAIA;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAAC,MAAc,EAAE,UAAsB,EAAE,OAAY;IAC7F,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC;AAHD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AI,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC;AAVD,4DAUC;AAGD;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,UAAsB,EAAE,cAA4B,EAAE,WAAoD;IAChJ,KAAK,IAAI,CAAC,IAAI,WAAW,EAAE;QACvB,wBAAwB,CAAC,UAAU,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;KACxE;AACL,CAAC;AAJD,8DAIC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const assert = require("assert");
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const connection_1 = require("../jsonrpc2/connection");
7
+ const test_helper_1 = require("../jsonrpc2/test-helper");
8
+ const proxy_1 = require("./proxy");
9
+ // import 'jest';
10
+ function createTestProxy(handler) {
11
+ Object.setPrototypeOf(handler, null);
12
+ const [clientTransports, serverTransports] = (0, test_helper_1.createMessageTransports)();
13
+ const client = (0, connection_1.createConnection)(clientTransports);
14
+ const server = (0, connection_1.createConnection)(serverTransports);
15
+ const proxy = (0, proxy_1.createProxy)(client, 'prefix');
16
+ (0, proxy_1.handleRequests)(server, 'prefix', handler);
17
+ client.listen();
18
+ server.listen();
19
+ return proxy;
20
+ }
21
+ describe('Proxy', () => {
22
+ describe('proxies calls', () => {
23
+ const proxy = createTestProxy({
24
+ $a: (n) => n + 1,
25
+ $b: (n) => Promise.resolve(n + 2),
26
+ $c: (m, n) => m + n,
27
+ $d: (...args) => args.reduce((sum, n) => sum + n, 0),
28
+ $e: () => Promise.reject('e'),
29
+ $f: () => {
30
+ throw new Error('f');
31
+ },
32
+ });
33
+ it('to functions', async () => assert.strictEqual(await proxy.$a(1), 2));
34
+ it('to async functions', async () => assert.strictEqual(await proxy.$b(1), 3));
35
+ it('with multiple arguments ', async () => assert.strictEqual(await proxy.$c(2, 3), 5));
36
+ it('with variadic arguments ', async () => assert.strictEqual(await proxy.$d(...[2, 3, 4]), 9));
37
+ it('to functions returning a rejected promise', async () => assert.rejects(() => proxy.$e()));
38
+ it('to functions throwing an error', async () => assert.rejects(() => proxy.$f()));
39
+ });
40
+ it('proxies Observables', async () => {
41
+ const proxy = createTestProxy({
42
+ $observe: (...args) => new rxjs_1.Observable(observer => {
43
+ for (const arg of args) {
44
+ observer.next(arg + 1);
45
+ }
46
+ observer.complete();
47
+ }),
48
+ });
49
+ assert.deepStrictEqual(await proxy
50
+ .$observe(1, 2, 3, 4)
51
+ .pipe((0, operators_1.bufferCount)(4))
52
+ .toPromise(), [2, 3, 4, 5]);
53
+ });
54
+ });
55
+ //# sourceMappingURL=proxy.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.test.js","sourceRoot":"","sources":["../../../src/connections/proxy/proxy.test.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AACjC,+BAAkC;AAClC,8CAA6C;AAC7C,uDAA0D;AAC1D,yDAAkE;AAClE,mCAAsD;AACtD,iBAAiB;AAEjB,SAAS,eAAe,CAAI,OAAU;IAClC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,IAAA,qCAAuB,GAAE,CAAC;IACvE,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,gBAAgB,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAA,6BAAgB,EAAC,gBAAgB,CAAC,CAAC;IAElD,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5C,IAAA,sBAAc,EAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,CAAC,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,MAAM,EAAE,CAAC;IAChB,OAAO,KAAK,CAAC;AACjB,CAAC;A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
+ import { HostIdentifier } from '../../protocol/proxy-identifier';
4
+ export declare class BrowserRemoteRPC implements IRPCMessagePassingProtocol {
5
+ private input$;
6
+ private readonly _localHostId;
7
+ private _onMessage;
8
+ constructor(hostId?: HostIdentifier);
9
+ onMessage(event: any): import("@vscode-alt/monaco-editor/esm/vs/base/common/lifecycle").IDisposable;
10
+ connect(url: string, makeWebSocket: any): void;
11
+ send(buffer: VSBuffer, hostIdentifier: any): void;
12
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BrowserRemoteRPC = void 0;
4
+ const queueing_subject_1 = require("queueing-subject");
5
+ const buffer_1 = require("@vscode-alt/monaco-editor/esm/vs/base/common/buffer");
6
+ const event_1 = require("@vscode-alt/monaco-editor/esm/vs/base/common/event");
7
+ const rxjs_websockets_1 = require("./rxjs-websockets");
8
+ const operators_1 = require("rxjs/operators");
9
+ class BrowserRemoteRPC {
10
+ constructor(hostId = 2 /* HostIdentifier.BrowserExtHost */) {
11
+ this._onMessage = new event_1.Emitter();
12
+ this._localHostId = hostId;
13
+ console.clear();
14
+ this.input$ = new queueing_subject_1.QueueingSubject();
15
+ }
16
+ onMessage(event) {
17
+ return this._onMessage.event(event);
18
+ }
19
+ connect(url, makeWebSocket) {
20
+ const socket$ = (0, rxjs_websockets_1.default)(url, {
21
+ protocols: '',
22
+ makeWebSocket,
23
+ });
24
+ const messages$ = socket$.pipe(
25
+ // the observable produces a value once the websocket has been opened
26
+ (0, operators_1.switchMap)((getResponses) => {
27
+ console.log('websocket opened');
28
+ return getResponses(this.input$);
29
+ }), (0, operators_1.share)());
30
+ messages$.subscribe((message) => {
31
+ const buff = new Uint8Array(message);
32
+ // @sri in future version of @vscode-alt/monaco-editor we don't need to do add `Buffer.from`
33
+ // noticed `Buffer` in browser will be polyfilled by webpack
34
+ const vsBuffer = buffer_1.VSBuffer.wrap(Buffer.from(buff.buffer));
35
+ this._onMessage.fire(vsBuffer);
36
+ }, (error) => {
37
+ const { message } = error;
38
+ if (message === rxjs_websockets_1.normalClosureMessage) {
39
+ console.log('server closed the websocket connection normally');
40
+ }
41
+ else {
42
+ console.log('socket was disconnected due to error:', message);
43
+ }
44
+ });
45
+ }
46
+ send(buffer, hostIdentifier) {
47
+ // If the websocket is not connected then the QueueingSubject will ensure
48
+ // that messages are queued and delivered when the websocket reconnects.
49
+ // A regular Subject can be used to discard messages sent when the websocket
50
+ // is disconnected.
51
+ const headerBuf = buffer_1.VSBuffer.alloc(2);
52
+ // add destination host id
53
+ headerBuf.writeUInt8(hostIdentifier, 0);
54
+ // add sender host id
55
+ headerBuf.writeUInt8(this._localHostId, 1);
56
+ const cocnatBuf = buffer_1.VSBuffer.concat([headerBuf, buffer]);
57
+ // converts to ArrayBuffer and sends data
58
+ this.input$.next(cocnatBuf.buffer);
59
+ }
60
+ }
61
+ exports.BrowserRemoteRPC = BrowserRemoteRPC;
62
+ //# sourceMappingURL=browser-remote-rpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-remote-rpc.js","sourceRoot":"","sources":["../../../src/connections/remote-rpc/browser-remote-rpc.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AACnD,gFAA+E;AAE/E,8EAA6E;AAC7E,uDAAoH;AAEpH,8CAAkD;AAElD,MAAa,gBAAgB;IAQzB,YAAY,8CAAsD;QAF1D,eAAU,GAAG,IAAI,eAAO,EAAY,CAAC;QAGzC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC3B,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,IAAI,kCAAe,EAAe,CAAC;IACrD,CAAC;IAGM,SAAS,CAAC,KAAK;QAClB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAGM,OAAO,CAAC,GAAW,EAAE,aAAa;QACrC,MAAM,OAAO,GAAG,IAAA,yBAAgB,EAC5B,GAAG,EAAE;Y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AY,EAAE,CAAC,CAAC,CAAC;QAC3C,MAAM,SAAS,GAAG,iBAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QACvD,yCAAyC;QACzC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;CACJ;AAxED,4CAwEC"}
@@ -0,0 +1,317 @@
1
+ // import 'reflect-metadata';
2
+ // import AbortController from 'abort-controller';
3
+ // import { WebSocket, Server } from 'mock-socket';
4
+ // import { Logger, createConnection } from '../jsonrpc2/connection';
5
+ // import * as assert from 'assert';
6
+ // import { BrowserRemoteRPC } from './browser-remote-rpc';
7
+ // import { createBarrier } from '../../utils';
8
+ // import { WsProtocol } from '@workbench-stack/extension-module-server';
9
+ // import { RPCProtocol, IRPCMessagePassingProtocol } from '../../protocol/rpc-protocol';
10
+ // // import { MessageBuffer as ServerMessageBuffer, MessageIO as ServerMessageIO } from '../../protocol/server-message-io';
11
+ // // import { MessageBuffer as BrowserMessageBuffer, MessageIO as BrowserMessageIO, MessageBuffer } from '../../protocol/browser-message-io';
12
+ // import { logger } from '@cdm-logger/server';
13
+ // import { Event, Emitter, EventMultiplexer } from '@vscode-alt/monaco-editor/esm/vs/base/common/event';
14
+ // import { RPCLogger } from '../../protocol/rpc-logger';
15
+ // import { createMessagePipe, createMessageTransports } from '../jsonrpc2/test-helper';
16
+ // import { handleServerProxyRequest } from '../proxy/proxy';
17
+ // // import 'jest';
18
+ // import { ProxyIdentifier, TransportType, HostIdentifier, RequestType } from '../../protocol';
19
+ // import { VSBuffer } from '@vscode-alt/monaco-editor/esm/vs/base/common/buffer';
20
+ // const consoleLogger: Logger = {
21
+ // error(message: string): void {
22
+ // console.error(message);
23
+ // },
24
+ // warn(message: string): void {
25
+ // console.warn(message);
26
+ // },
27
+ // info(message: string): void {
28
+ // // tslint:disable-next-line:no-console
29
+ // console.info(message);
30
+ // },
31
+ // log(message: string): void {
32
+ // // tslint:disable-next-line:no-console
33
+ // console.log(message);
34
+ // },
35
+ // };
36
+ // class MessagePassingProtocol implements IRPCMessagePassingProtocol {
37
+ // private _pair: MultiMessagePassingProtocol;
38
+ // public readonly _onNativeMessage = new Emitter<VSBuffer>();
39
+ // public readonly onMessage: Event<VSBuffer> = this._onNativeMessage.event;
40
+ // private readonly _localHostId: HostIdentifier;
41
+ // constructor(hostId: HostIdentifier = HostIdentifier.ServerExtHost) {
42
+ // this._localHostId = hostId;
43
+ // }
44
+ // public setPair(other: MultiMessagePassingProtocol) {
45
+ // this._pair = other;
46
+ // }
47
+ // public send(buffer: VSBuffer, hostIdentifier: HostIdentifier): void {
48
+ // console.log('--send From Ext', hostIdentifier);
49
+ // const headerBuf = VSBuffer.alloc(2);
50
+ // // add destination host id
51
+ // headerBuf.writeUInt8(hostIdentifier, 0);
52
+ // // add sender host id
53
+ // headerBuf.writeUInt8(this._localHostId, 1);
54
+ // const cocatBuf = VSBuffer.concat([headerBuf, buffer]);
55
+ // process.nextTick(() => {
56
+ // this._pair._onNativeMessage.fire(cocatBuf);
57
+ // });
58
+ // }
59
+ // }
60
+ // class MultiMessagePassingProtocol implements IRPCMessagePassingProtocol {
61
+ // private _pair: MessagePassingProtocol;
62
+ // private _wsProtocol = new WsProtocol();
63
+ // public readonly _onNativeMessage = new Emitter<VSBuffer>();
64
+ // private readonly _onMessage = new EventMultiplexer<VSBuffer>();
65
+ // private readonly _localHostId: HostIdentifier;
66
+ // constructor(hostId: HostIdentifier = HostIdentifier.ServerMainThread) {
67
+ // this._localHostId = hostId;
68
+ // this._onMessage.add(this._onNativeMessage.event);
69
+ // this._onMessage.add(this._wsProtocol.onMessage);
70
+ // }
71
+ // public onMessage: Event<VSBuffer> = this._onMessage.event;
72
+ // public connect(socket: any) {
73
+ // this._wsProtocol.connect(socket);
74
+ // }
75
+ // public setPair(other: MessagePassingProtocol) {
76
+ // this._pair = other;
77
+ // }
78
+ // public send(buffer: VSBuffer, hostIdentifier: HostIdentifier): void {
79
+ // const transportType = this.getRequestTypeRouting(hostIdentifier);
80
+ // const headerBuf = VSBuffer.alloc(2);
81
+ // // add destination host id
82
+ // headerBuf.writeUInt8(hostIdentifier, 0);
83
+ // // add sender host id
84
+ // headerBuf.writeUInt8(this._localHostId, 1);
85
+ // const cocatBuf = VSBuffer.concat([headerBuf, buffer]);
86
+ // this._send(cocatBuf, transportType);
87
+ // }
88
+ // public _send(buffer: VSBuffer, transportType?: TransportType): void {
89
+ // console.log('---_send fromMulitp transportType websocket', transportType === TransportType.WebSocket);
90
+ // if (transportType === TransportType.WebSocket) {
91
+ // this.webSend(buffer);
92
+ // } else {
93
+ // this.nativeSend(buffer);
94
+ // }
95
+ // }
96
+ // public forward(buffer: VSBuffer, hostIdentifier?: HostIdentifier) {
97
+ // console.log('---forward the request to hostId', hostIdentifier);
98
+ // const transportType = this.getRequestTypeRouting(hostIdentifier);
99
+ // if (transportType === TransportType.WebSocket) {
100
+ // this._send(buffer, TransportType.WebSocket);
101
+ // } else {
102
+ // this._send(buffer, TransportType.Socket);
103
+ // }
104
+ // }
105
+ // private webSend(buffer: VSBuffer) {
106
+ // return this._wsProtocol.send(buffer);
107
+ // }
108
+ // private nativeSend(buffer: VSBuffer): void {
109
+ // process.nextTick(() => {
110
+ // this._pair._onNativeMessage.fire(buffer);
111
+ // });
112
+ // }
113
+ // private getRequestTypeRouting(hostIdentifier?: HostIdentifier) {
114
+ // if (hostIdentifier === HostIdentifier.ServerExtHost) {
115
+ // return TransportType.Socket;
116
+ // } else if (hostIdentifier === HostIdentifier.BrowserExtHost) {
117
+ // return TransportType.WebSocket;
118
+ // } else {
119
+ // return TransportType.Socket;
120
+ // }
121
+ // }
122
+ // }
123
+ // describe('Websocket RPC', () => {
124
+ // let fakeURL;
125
+ // let mockServer;
126
+ // let socket1;
127
+ // let delegate: (a1: any, a2: any) => any;
128
+ // let bProxyFromA: BClass;
129
+ // let bProdyFromC: BClass;
130
+ // let aProxyFromB: AClass;
131
+ // let aProxyFromC: AClass;
132
+ // let cProxyFromA: CClass;
133
+ // class AClass {
134
+ // public $m(a1: any, a2: any): Promise<any> {
135
+ // return Promise.resolve(delegate.call(null, a1, a2));
136
+ // }
137
+ // }
138
+ // class BClass {
139
+ // public $n(a1: any, a2: any): Promise<any> {
140
+ // return Promise.resolve(delegate.call(null, a1, a2));
141
+ // }
142
+ // }
143
+ // class CClass {
144
+ // public $o(a1: any, a2: any): Promise<any> {
145
+ // return Promise.resolve(delegate.call(null, a1, a2));
146
+ // }
147
+ // }
148
+ // beforeEach((done) => {
149
+ // fakeURL = 'ws://localhost:8080';
150
+ // mockServer = new Server(fakeURL);
151
+ // let b_protocol = new BrowserRemoteRPC();
152
+ // b_protocol.connect(fakeURL, () => {
153
+ // socket1 = new WebSocket(fakeURL);
154
+ // socket1.binaryType = 'arraybuffer';
155
+ // return socket1;
156
+ // });
157
+ // mockServer.on('connection', socket => {
158
+ // console.log('---SOCKET MOCK SErver', socket);
159
+ // let a_protocol = new MultiMessagePassingProtocol();
160
+ // a_protocol.connect(socket);
161
+ // let c_protocol = new MessagePassingProtocol();
162
+ // c_protocol.setPair(a_protocol);
163
+ // a_protocol.setPair(c_protocol);
164
+ // let A = new RPCProtocol(a_protocol, HostIdentifier.ServerMainThread, new RPCLogger(), null);
165
+ // let B = new RPCProtocol(b_protocol, HostIdentifier.BrowserExtHost, new RPCLogger(), null);
166
+ // let C = new RPCProtocol(c_protocol, HostIdentifier.ServerExtHost, new RPCLogger(), null);
167
+ // const bIdentifier = new ProxyIdentifier<BClass>(false, 'bb', HostIdentifier.BrowserExtHost);
168
+ // const bInstance = new BClass();
169
+ // const aIdentifier = new ProxyIdentifier<AClass>(false, 'aa', HostIdentifier.ServerMainThread);
170
+ // const aInstance = new AClass();
171
+ // const cIdentifer = new ProxyIdentifier<CClass>(false, 'cc', HostIdentifier.ServerExtHost);
172
+ // const cInstance = new CClass();
173
+ // B.set(bIdentifier, bInstance);
174
+ // A.set(aIdentifier, aInstance);
175
+ // C.set(cIdentifer, cInstance);
176
+ // bProxyFromA = A.getProxy(bIdentifier);
177
+ // aProxyFromC = C.getProxy(aIdentifier);
178
+ // aProxyFromB = B.getProxy(aIdentifier);
179
+ // cProxyFromA = A.getProxy(cIdentifer);
180
+ // bProdyFromC = C.getProxy(bIdentifier);
181
+ // cProxyFromA = A.getProxy(cIdentifer);
182
+ // done();
183
+ // });
184
+ // });
185
+ // afterEach(() => {
186
+ // socket1.close();
187
+ // mockServer.close();
188
+ // });
189
+ // test('simple call C -> A', function (done) {
190
+ // delegate = (a1: number, a2: number) => a1 + a2;
191
+ // aProxyFromC.$m(4, 1).then((res: number) => {
192
+ // assert.equal(res, 5);
193
+ // done();
194
+ // }, done.fail);
195
+ // });
196
+ // test('simple call B -> A', function (done) {
197
+ // delegate = (a1: number, a2: number) => a1 + a2;
198
+ // aProxyFromB.$m(4, 1).then((res: number) => {
199
+ // assert.equal(res, 5);
200
+ // done();
201
+ // }, done.fail);
202
+ // });
203
+ // test('simple call C -> B', function (done) {
204
+ // delegate = (a1: number, a2: number) => a1 + a2;
205
+ // bProdyFromC.$n(4, 1).then((res: number) => {
206
+ // assert.equal(res, 5);
207
+ // done();
208
+ // }, done.fail);
209
+ // });
210
+ // test('simple call A -> C', function (done) {
211
+ // delegate = (a1: number, a2: number) => a1 + a2;
212
+ // cProxyFromA.$o(4, 1).then((res: number) => {
213
+ // assert.equal(res, 5);
214
+ // done();
215
+ // }, done.fail);
216
+ // });
217
+ // test('test buffer', function () {
218
+ // const b1 = Buffer.allocUnsafe(2);
219
+ // const b2 = Buffer.allocUnsafe(1);
220
+ // b1.writeUInt8(10, 0);
221
+ // b1.writeUInt8(99, 1);
222
+ // b2.writeUInt8(20, 0);
223
+ // const buf = Buffer.concat([b1, b2]);
224
+ // const a1 = buf.readUInt8(0);
225
+ // // const bufNew = buf.slice(3);
226
+ // const a2 = buf.readUInt8(2);
227
+ // console.log('---a1', a1);
228
+ // console.log('---a2', a2);
229
+ // });
230
+ // test('simple call A->C', function (done) {
231
+ // delegate = (a1: number, a2: number) => a1 + a2;
232
+ // cProxyFromA.$o(6, 1).then((res: number) => {
233
+ // assert.equal(res, 7);
234
+ // done();
235
+ // }, done.fail);
236
+ // });
237
+ // test('works', () => {
238
+ // const result: number[] = [];
239
+ // const m = new EventMultiplexer<number>();
240
+ // m.event(r => result.push(r));
241
+ // const e1 = new Emitter<number>();
242
+ // m.add(e1.event);
243
+ // assert.deepEqual(result, []);
244
+ // e1.fire(0);
245
+ // assert.deepEqual(result, [0]);
246
+ // });
247
+ // });
248
+ // xdescribe('Connection', () => {
249
+ // let delegate: (a1: any, a2: any) => any;
250
+ // interface IAClass {
251
+ // $m(a1: any, a2: any): Promise<any>;
252
+ // }
253
+ // let aProxy: AClass;
254
+ // class AClass implements IAClass {
255
+ // public $m(a1: any, a2: any): Promise<any> {
256
+ // return Promise.resolve(delegate.call(null, a1, a2));
257
+ // }
258
+ // }
259
+ // class BClass {
260
+ // public $m(b1: any, b2: any): Promise<any> {
261
+ // return Promise.resolve(delegate.call(null, b1, b2));
262
+ // }
263
+ // }
264
+ // // Polyfill
265
+ // ; (global as any).AbortController = AbortController;
266
+ // let mockServer, socket1: WebSocket;
267
+ // const aIdentifier = new ProxyIdentifier<AClass>(false, 'aa');
268
+ // let A, B;
269
+ // beforeEach((done) => {
270
+ // });
271
+ // afterEach(() => {
272
+ // socket1.close();
273
+ // mockServer.close();
274
+ // });
275
+ // xtest('handle single request', async (done) => {
276
+ // const [serverTransports, clientTransports] = createMessageTransports();
277
+ // delegate = (a1: number, a2: number) => a1 + a2;
278
+ // const server = createConnection(serverTransports, consoleLogger);
279
+ // handleServerProxyRequest(server, B, aIdentifier);
280
+ // server.listen();
281
+ // server.onClose(event => done());
282
+ // const client = createConnection(clientTransports);
283
+ // client.listen();
284
+ // const signal = new AbortController().signal;
285
+ // const result = await client.sendRequest('aa/$m', [4, 1], signal as any);
286
+ // expect(result).toBe(5);
287
+ // done();
288
+ // });
289
+ // xit('abort undispatched request', async (done) => {
290
+ // const [serverTransports, clientTransports] = createMessageTransports();
291
+ // const b1 = createBarrier();
292
+ // const b2 = createBarrier();
293
+ // delegate = (a1: number, a2: number) => a1 + a2;
294
+ // const server = createConnection(serverTransports, consoleLogger);
295
+ // server.onRequest('block', async () => {
296
+ // b2.done();
297
+ // await b1.wait;
298
+ // });
299
+ // // server.onRequest('undispatched', () => {
300
+ // // throw new Error('handler should not be called')
301
+ // // })
302
+ // handleServerProxyRequest(server, B, aIdentifier);
303
+ // server.listen();
304
+ // const client = createConnection(clientTransports);
305
+ // client.listen();
306
+ // server.onClose(event => done());
307
+ // client.sendRequest('block').catch(null);
308
+ // await b2.wait;
309
+ // const abortController = new AbortController();
310
+ // // const result = client.sendRequest('undispatched', ['foo'], abortController.signal)
311
+ // const result = client.sendRequest('aa/$m', [4, 1], abortController.signal as any);
312
+ // abortController.abort();
313
+ // b1.done();
314
+ // await assert.rejects(result, (err/** : AbortError*/) => err.name === 'AbortError');
315
+ // });
316
+ // });
317
+ //# sourceMappingURL=browser-server-rpc.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-server-rpc.test.js","sourceRoot":"","sources":["../../../src/connections/remote-rpc/browser-server-rpc.test.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,kDAAkD;AAClD,mDAAmD;AACnD,qEAAqE;AACrE,oCAAoC;AACpC,2DAA2D;AAC3D,+CAA+C;AAC/C,yEAAyE;AACzE,yFAAyF;AACzF,4HAA4H;AAC5H,8IAA8I;AAC9I,+CAA+C;AAC/C,yGAAyG;AACzG,yDAAyD;AACzD,wFAAwF;AACxF,6DAA6D;AAC7D,oBAAoB;AACpB,gGAAgG;AAChG,kFAAkF;AAClF,kCAAkC;AAClC,qCAAqC;AACrC,kCAAkC;AAClC,SAAS;AACT,oCAAoC;AACpC,iCAAiC;AACjC,SAAS;AACT,oCAAoC;AACpC,iDAAiD;AACjD,iCAAiC;AACjC,SAAS;AACT,mCAAmC;AACnC,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AAEV,0DAA0D;AAC1D,kFAAkF;AAClF,sCAAsC;AACtC,sCAAsC;AAEtC,0DAA0D;AAC1D,4EAA4E;AAC5E,kDAAkD;AAClD,yBAAyB;AACzB,6BAA6B;AAC7B,cAAc;AACd,sDAAsD;AACtD,iEAAiE;AACjE,gBAAgB;AAChB,4DAA4D;AAE5D,2BAA2B;AAE3B,6DAA6D;AAC7D,2BAA2B;AAC3B,2CAA2C;AAC3C,mDAAmD;AACnD,yBAAyB;AACzB,yDAAyD;AACzD,gGAAgG;AAChG,6FAA6F;AAC7F,mCAAmC;AACnC,qBAAqB;AACrB,8FAA8F;AAE9F,UAAU;AAIV,MAAM"}
@@ -0,0 +1 @@
1
+ export * from './browser-remote-rpc';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./browser-remote-rpc"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/connections/remote-rpc/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
@@ -0,0 +1,12 @@
1
+ import { HostIdentifier } from '../../protocol/proxy-identifier';
2
+ import { IRPCMessagePassingProtocol } from '../../protocol/rpc-protocol';
3
+ import { VSBuffer } from '@vscode-alt/monaco-editor/esm/vs/base/common/buffer';
4
+ export declare class BrowserRemoteRPC implements IRPCMessagePassingProtocol {
5
+ private _$queue;
6
+ private _onMessage;
7
+ private readonly _localHostId;
8
+ constructor(hostId?: HostIdentifier);
9
+ onMessage(event: any): import("@vscode-alt/monaco-editor/esm/vs/base/common/lifecycle").IDisposable;
10
+ connect(socket: WebSocket): void;
11
+ send(buffer: VSBuffer, hostIdentifier: any): void;
12
+ }