@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,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asError = exports.isErrorLike = void 0;
4
+ const isErrorLike = (val) => !!val && typeof val === 'object' && (!!val.stack || ('message' in val || 'code' in val)) && !('__typename' in val);
5
+ exports.isErrorLike = isErrorLike;
6
+ /**
7
+ * Ensures a value is a proper Error, copying all properties if needed
8
+ */
9
+ const asError = (err) => {
10
+ if (err instanceof Error) {
11
+ return err;
12
+ }
13
+ if (typeof err === 'object' && err !== null) {
14
+ return Object.assign(new Error(err.message), err);
15
+ }
16
+ return new Error(err);
17
+ };
18
+ exports.asError = asError;
19
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AAGO,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAoB,EAAE,CACtD,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,IAAI,GAAG,IAAI,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,IAAI,GAAG,CAAC,CAAC;AAD1G,QAAA,WAAW,eAC+F;AAEvH;;GAEG;AACI,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAS,EAAE;IACvC,IAAI,GAAG,YAAY,KAAK,EAAE;QACtB,OAAO,GAAG,CAAC;KACd;IACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE;QACzC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,CAAC;KACrD;IACD,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB"}
@@ -0,0 +1,9 @@
1
+ import { IConfiguredExtension } from '../interfaces';
2
+ /**
3
+ * Returns the extension's script URL from its manifest.
4
+ *
5
+ * @param extension The extension whose script URL to get.
6
+ * @throws If the script URL can't be dtermined.
7
+ * @returns The extension's script URL.
8
+ */
9
+ export declare function getScriptURLFromExtensionManifest(extension: IConfiguredExtension): string;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getScriptURLFromExtensionManifest = void 0;
4
+ const errors_1 = require("./errors");
5
+ /**
6
+ * Returns the extension's script URL from its manifest.
7
+ *
8
+ * @param extension The extension whose script URL to get.
9
+ * @throws If the script URL can't be dtermined.
10
+ * @returns The extension's script URL.
11
+ */
12
+ function getScriptURLFromExtensionManifest(extension) {
13
+ if (!extension.manifest) {
14
+ throw new Error(`extension ${JSON.stringify(extension.id)}: no mainfest found`);
15
+ }
16
+ if ((0, errors_1.isErrorLike)(extension.manifest)) {
17
+ throw new Error(`extension ${JSON.stringify(extension.id)}: invalid manifest: ${extension.manifest.message}`);
18
+ }
19
+ if (!extension.manifest.bundleURL) {
20
+ throw new Error(`extension ${JSON.stringify(extension.id)}: no "url" property in manifest`);
21
+ }
22
+ return extension.manifest.bundleURL;
23
+ }
24
+ exports.getScriptURLFromExtensionManifest = getScriptURLFromExtensionManifest;
25
+ //# sourceMappingURL=extensions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../src/utils/extensions.ts"],"names":[],"mappings":";;;AACA,qCAAuC;AAEvC;;;;;;GAMG;AACH,SAAgB,iCAAiC,CAAC,SAA+B;IAC7E,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC;KACnF;IACD,IAAI,IAAA,oBAAW,EAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,uBAAuB,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;KACjH;IACD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC,iCAAiC,CAAC,CAAC;KAC/F;IACD,OAAO,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;AACxC,CAAC;AAXD,8EAWC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns a {@link Promise} and a function. The {@link Promise} blocks untils the returned function is called.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare function createBarrier(): {
7
+ wait: Promise<void>;
8
+ done: () => void;
9
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createBarrier = void 0;
4
+ /**
5
+ * Returns a {@link Promise} and a function. The {@link Promise} blocks untils the returned function is called.
6
+ *
7
+ * @internal
8
+ */
9
+ function createBarrier() {
10
+ let done;
11
+ const wait = new Promise(resolve => (done = resolve));
12
+ return { wait, done };
13
+ }
14
+ exports.createBarrier = createBarrier;
15
+ //# sourceMappingURL=helper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.test.js","sourceRoot":"","sources":["../../src/utils/helper.test.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,SAAgB,aAAa;IACzB,IAAI,IAAiB,CAAC;IACtB,MAAM,IAAI,GAAG,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC;IAC5D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC;AAJD,sCAIC"}
@@ -0,0 +1,7 @@
1
+ export * from './helper.test';
2
+ export * from './util';
3
+ export * from './errors';
4
+ export * from './extensions';
5
+ export * from './rxjs';
6
+ import * as path from './paths-util';
7
+ export { path };
@@ -0,0 +1,25 @@
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
+ exports.path = void 0;
18
+ __exportStar(require("./helper.test"), exports);
19
+ __exportStar(require("./util"), exports);
20
+ __exportStar(require("./errors"), exports);
21
+ __exportStar(require("./extensions"), exports);
22
+ __exportStar(require("./rxjs"), exports);
23
+ const path = require("./paths-util");
24
+ exports.path = path;
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,yCAAuB;AACvB,2CAAyB;AACzB,+CAA6B;AAC7B,yCAAuB;AACvB,qCAAqC;AAC5B,oBAAI"}
@@ -0,0 +1,27 @@
1
+ /********************************************************************************
2
+
3
+ Copyright (c) 2015 John Vilk and other contributors.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ====
24
+ */
25
+ export declare function resolve(...paths: string[]): string;
26
+ export declare function relative(from: string, to: string): string;
27
+ export declare function normalize(p: string): string;
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+
4
+ Copyright (c) 2015 John Vilk and other contributors.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10
+ of the Software, and to permit persons to whom the Software is furnished to do
11
+ so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+
24
+ ====
25
+ */
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.normalize = exports.relative = exports.resolve = void 0;
28
+ const path_1 = require("@vscode-alt/monaco-editor/esm/vs/base/common/path");
29
+ const replaceRegex = new RegExp('//+', 'g');
30
+ function resolve(...paths) {
31
+ let processed = [];
32
+ for (const p of paths) {
33
+ if (typeof p !== 'string') {
34
+ throw new TypeError('Invalid argument type to path.join: ' + (typeof p));
35
+ }
36
+ else if (p !== '') {
37
+ if (p.charAt(0) === path_1.sep) {
38
+ processed = [];
39
+ }
40
+ processed.push(p);
41
+ }
42
+ }
43
+ const resolved = normalize(processed.join(path_1.sep));
44
+ if (resolved.length > 1 && resolved.charAt(resolved.length - 1) === path_1.sep) {
45
+ return resolved.substr(0, resolved.length - 1);
46
+ }
47
+ return resolved;
48
+ }
49
+ exports.resolve = resolve;
50
+ function relative(from, to) {
51
+ let i;
52
+ from = resolve(from);
53
+ to = resolve(to);
54
+ const fromSegments = from.split(path_1.sep);
55
+ const toSegments = to.split(path_1.sep);
56
+ toSegments.shift();
57
+ fromSegments.shift();
58
+ let upCount = 0;
59
+ let downSegments = [];
60
+ for (i = 0; i < fromSegments.length; i++) {
61
+ const seg = fromSegments[i];
62
+ if (seg === toSegments[i]) {
63
+ continue;
64
+ }
65
+ upCount = fromSegments.length - i;
66
+ break;
67
+ }
68
+ downSegments = toSegments.slice(i);
69
+ if (fromSegments.length === 1 && fromSegments[0] === '') {
70
+ upCount = 0;
71
+ }
72
+ if (upCount > fromSegments.length) {
73
+ upCount = fromSegments.length;
74
+ }
75
+ let rv = '';
76
+ for (i = 0; i < upCount; i++) {
77
+ rv += '../';
78
+ }
79
+ rv += downSegments.join(path_1.sep);
80
+ if (rv.length > 1 && rv.charAt(rv.length - 1) === path_1.sep) {
81
+ rv = rv.substr(0, rv.length - 1);
82
+ }
83
+ return rv;
84
+ }
85
+ exports.relative = relative;
86
+ function normalize(p) {
87
+ if (p === '') {
88
+ p = '.';
89
+ }
90
+ const absolute = p.charAt(0) === path_1.sep;
91
+ p = removeDuplicateSeparators(p);
92
+ const components = p.split(path_1.sep);
93
+ const goodComponents = [];
94
+ for (const c of components) {
95
+ if (c === '.') {
96
+ continue;
97
+ }
98
+ else if (c === '..' && (absolute || (!absolute && goodComponents.length > 0 && goodComponents[0] !== '..'))) {
99
+ goodComponents.pop();
100
+ }
101
+ else {
102
+ goodComponents.push(c);
103
+ }
104
+ }
105
+ if (!absolute && goodComponents.length < 2) {
106
+ switch (goodComponents.length) {
107
+ case 1:
108
+ if (goodComponents[0] === '') {
109
+ goodComponents.unshift('.');
110
+ }
111
+ break;
112
+ default:
113
+ goodComponents.push('.');
114
+ }
115
+ }
116
+ p = goodComponents.join(path_1.sep);
117
+ if (absolute && p.charAt(0) !== path_1.sep) {
118
+ p = path_1.sep + p;
119
+ }
120
+ return p;
121
+ }
122
+ exports.normalize = normalize;
123
+ function removeDuplicateSeparators(p) {
124
+ p = p.replace(replaceRegex, path_1.sep);
125
+ return p;
126
+ }
127
+ //# sourceMappingURL=paths-util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths-util.js","sourceRoot":"","sources":["../../src/utils/paths-util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;;;AAEF,4EAAwE;AAExE,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAE5C,SAAgB,OAAO,CAAC,GAAG,KAAe;IACtC,IAAI,SAAS,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;QACnB,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;YACvB,MAAM,IAAI,SAAS,CAAC,sCAAsC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SAC5E;aAAM,IAAI,CAAC,KAAK,EAAE,EAAE;YACjB,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,UAAG,EAAE;gBACrB,SAAS,GAAG,EAAE,CAAC;aAClB;YACD,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACrB;KACJ;IAED,MAAM,QA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CAAC,GAAG,EAAE,CAAC;SACxB;aAAM;YACH,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAC1B;KACJ;IAED,IAAI,CAAC,QAAQ,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;QACxC,QAAQ,cAAc,CAAC,MAAM,EAAE;YAC3B,KAAK,CAAC;gBACF,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;oBAC1B,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;iBAC/B;gBACD,MAAM;YACV;gBACI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAChC;KACJ;IACD,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,UAAG,CAAC,CAAC;IAC7B,IAAI,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,UAAG,EAAE;QACjC,CAAC,GAAG,UAAG,GAAG,CAAC,CAAC;KACf;IACD,OAAO,CAAC,CAAC;AACb,CAAC;AAtCD,8BAsCC;AAED,SAAS,yBAAyB,CAAC,CAAS;IACxC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,UAAG,CAAC,CAAC;IACjC,OAAO,CAAC,CAAC;AACb,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Observable, ObservableInput } from 'rxjs';
2
+ /**
3
+ * Like {@link combineLatest}, except that it does not wait for all Observables to emit before emitting an initial
4
+ * value. It emits whenever any of the source Observables emit.
5
+ *
6
+ * If {@link defaultValue} is provided, it will be used to represent any source Observables
7
+ * that have not yet emitted in the emitted array. If it is not provided, source Observables
8
+ * that have not yet emitted will not be represented in the emitted array.
9
+ *
10
+ * Also unlike {@link combineLatest}, if the source Observables array is empty, it emits an empty array and
11
+ * completes.
12
+ *
13
+ * This behavior is useful for the common pattern of combining providers: we don't want to block on the slowest
14
+ * provider for the initial emission, and an empty array of providers should yield an empty array (instead of
15
+ * yielding an Observable that never completes).
16
+ *
17
+ * @see {@link combineLatest}
18
+ *
19
+ * @todo Consider renaming this to combineProviders and making it also catchError from each Observable (and return
20
+ * the error as a value).
21
+ *
22
+ * @param observables The source Observables.
23
+ * @param defaultValue The value to emit for a source Observable if it has not yet emitted a value by the time
24
+ * another Observable has emitted a value.
25
+ * @return {Observable} An Observable of an array of the most recent values from each input Observable (or
26
+ * {@link defaultValue}).
27
+ */
28
+ export declare function combineLatestOrDefault<T>(observables: ObservableInput<T>[], defaultValue?: T): Observable<T[]>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.combineLatestOrDefault = void 0;
4
+ /* tslint:disable */
5
+ const rxjs_1 = require("rxjs");
6
+ const fromArray_1 = require("rxjs-compat/observable/fromArray");
7
+ const OuterSubscriber_1 = require("rxjs-compat/OuterSubscriber");
8
+ const asap_1 = require("rxjs-compat/scheduler/asap");
9
+ const subscribeToResult_1 = require("rxjs-compat/util/subscribeToResult");
10
+ // tslint:disable no-use-before-declare
11
+ /**
12
+ * Like {@link combineLatest}, except that it does not wait for all Observables to emit before emitting an initial
13
+ * value. It emits whenever any of the source Observables emit.
14
+ *
15
+ * If {@link defaultValue} is provided, it will be used to represent any source Observables
16
+ * that have not yet emitted in the emitted array. If it is not provided, source Observables
17
+ * that have not yet emitted will not be represented in the emitted array.
18
+ *
19
+ * Also unlike {@link combineLatest}, if the source Observables array is empty, it emits an empty array and
20
+ * completes.
21
+ *
22
+ * This behavior is useful for the common pattern of combining providers: we don't want to block on the slowest
23
+ * provider for the initial emission, and an empty array of providers should yield an empty array (instead of
24
+ * yielding an Observable that never completes).
25
+ *
26
+ * @see {@link combineLatest}
27
+ *
28
+ * @todo Consider renaming this to combineProviders and making it also catchError from each Observable (and return
29
+ * the error as a value).
30
+ *
31
+ * @param observables The source Observables.
32
+ * @param defaultValue The value to emit for a source Observable if it has not yet emitted a value by the time
33
+ * another Observable has emitted a value.
34
+ * @return {Observable} An Observable of an array of the most recent values from each input Observable (or
35
+ * {@link defaultValue}).
36
+ */
37
+ function combineLatestOrDefault(observables, defaultValue) {
38
+ switch (observables.length) {
39
+ case 0:
40
+ // No source observables: emit an empty array and complete
41
+ return (0, rxjs_1.of)([]);
42
+ case 1:
43
+ // Only one source observable: no need to handle emission accumulation or default values
44
+ return (0, rxjs_1.zip)(...observables);
45
+ default:
46
+ return (0, fromArray_1.fromArray)(observables).lift(new CombineLatestOperator(defaultValue));
47
+ }
48
+ }
49
+ exports.combineLatestOrDefault = combineLatestOrDefault;
50
+ class CombineLatestOperator {
51
+ constructor(defaultValue) {
52
+ this.defaultValue = defaultValue;
53
+ }
54
+ call(subscriber, source) {
55
+ return source.subscribe(new CombineLatestSubscriber(subscriber, this.defaultValue));
56
+ }
57
+ }
58
+ class CombineLatestSubscriber extends OuterSubscriber_1.OuterSubscriber {
59
+ constructor(observer, defaultValue) {
60
+ super(observer);
61
+ this.defaultValue = defaultValue;
62
+ this.activeObservables = 0;
63
+ this.values = [];
64
+ this.observables = [];
65
+ this.scheduled = false;
66
+ }
67
+ _next(observable) {
68
+ if (this.defaultValue !== undefined) {
69
+ this.values.push(this.defaultValue);
70
+ }
71
+ this.observables.push(observable);
72
+ }
73
+ _complete() {
74
+ this.activeObservables = this.observables.length;
75
+ for (let i = 0; i < this.observables.length; i++) {
76
+ this.add((0, subscribeToResult_1.subscribeToResult)(this, this.observables[i], this.observables[i], i));
77
+ }
78
+ }
79
+ notifyComplete() {
80
+ this.activeObservables--;
81
+ if (this.activeObservables === 0 && this.destination.complete) {
82
+ this.destination.complete();
83
+ }
84
+ }
85
+ notifyNext(_outerValue, innerValue, outerIndex) {
86
+ const values = this.values;
87
+ values[outerIndex] = innerValue;
88
+ if (this.activeObservables === 1) {
89
+ // Only 1 observable is active, so no need to buffer.
90
+ //
91
+ // This makes it possible to use RxJS's `of` in tests without specifying an explicit scheduler.
92
+ if (this.destination.next) {
93
+ this.destination.next(this.values.slice());
94
+ }
95
+ return;
96
+ }
97
+ // Buffer all next values that are emitted at the same time into one emission.
98
+ //
99
+ // This makes tests (using expectObservable) easier to write.
100
+ if (!this.scheduled) {
101
+ this.scheduled = true;
102
+ asap_1.asap.schedule(() => {
103
+ if (this.scheduled && this.destination.next) {
104
+ this.destination.next(this.values.slice());
105
+ }
106
+ this.scheduled = false;
107
+ });
108
+ }
109
+ }
110
+ }
111
+ //# sourceMappingURL=combineLatestOrDefault.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combineLatestOrDefault.js","sourceRoot":"","sources":["../../../src/utils/rxjs/combineLatestOrDefault.ts"],"names":[],"mappings":";;;AAAA,oBAAoB;AACpB,+BAAkH;AAClH,gEAA6D;AAC7D,iEAA8D;AAC9D,qDAAkD;AAClD,0EAAuE;AAGvE,uCAAuC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,sBAAsB,CAAI,WAAiC,EAAE,YAAgB;IACzF,QAAQ,WAAW,CAAC,MAAM,EAAE;QACxB,KAAK,CAAC;YACF,0DAA0D;YAC1D,OAAO,IAAA,SAAE,EAAC,EAAE,CAAC,CAAA;QACjB,KAAK,CAAC;YACF,wFAAwF;YACxF,OAAO,IAAA,UAAG,EAAC,GAAG,WAAW,CAAC,CAAA;QAC9B;YACI,OAAO,IAAA,qBAAS,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAA;KAClF;AACL,CAAC;AAXD,wDAWC;AAED,MAAM,qBAAqB;IACvB,YAA2B,YAAgB;QAAhB,iBAAY,GAAZ,YAAY,CAAI;IAAG,CAAC;IAExC,IAAI,CAAC,UAA2B,EAAE,MAAW;QAChD,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,uBAAuB,CAAC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAA;IACvF,CAAC;CACJ;AAED,MAAM,uBAA2B,SAAQ,iCAAuB;IAM5D,YAAY,QAA8B,EAAU,YAAgB;QAChE,KAA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F,+FAA+F;YAC/F,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;gBACvB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;aAC7C;YACD,OAAM;SACT;QAED,8EAA8E;QAC9E,EAAE;QACF,6DAA6D;QAC7D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;YACrB,WAAI,CAAC,QAAQ,CAAC,GAAG,EAAE;gBACf,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;oBACzC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;iBAC7C;gBACD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;YAC1B,CAAC,CAAC,CAAA;SACL;IACL,CAAC;CACJ"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* tslint:disable */
4
+ const rxjs_1 = require("rxjs");
5
+ const testing_1 = require("rxjs/testing");
6
+ const combineLatestOrDefault_1 = require("./combineLatestOrDefault");
7
+ const scheduler = () => new testing_1.TestScheduler((a, b) => expect(a).toEqual(b));
8
+ describe('combineLatestOrDefault', () => {
9
+ describe('with 0 source observables', () => {
10
+ test('emits an empty array and completes', () => scheduler().run(({ expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([], 'x')).toBe('(a|)', {
11
+ a: [],
12
+ })));
13
+ });
14
+ describe('with 1 source observable', () => {
15
+ test('waits to emit/complete until the source observable emits/completes', () => scheduler().run(({ cold, expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([cold('-b-|', { b: 1 })])).toBe('-b-|', {
16
+ b: [1],
17
+ })));
18
+ });
19
+ describe('of()', () => {
20
+ test('handles 1 of() source observable', () => scheduler().run(({ expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([(0, rxjs_1.of)(1)])).toBe('(a|)', {
21
+ a: [1],
22
+ })));
23
+ test('handles 2 of() source observables', () => scheduler().run(({ expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([(0, rxjs_1.of)(1), (0, rxjs_1.of)(2)])).toBe('(a|)', {
24
+ a: [1, 2],
25
+ })));
26
+ });
27
+ test('handles source observables with staggered emissions', () => scheduler().run(({ cold, expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([cold('-b-|', { b: 1 }), cold('--c|', { c: 2 })])).toBe('-bc|', {
28
+ b: [1],
29
+ c: [1, 2],
30
+ })));
31
+ test('handles source observables with staggered completions', () => scheduler().run(({ cold, expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([cold('a|', { a: 1 }), cold('a-|', { a: 2 })])).toBe('a-|', {
32
+ a: [1, 2],
33
+ })));
34
+ test('handles source observables with concurrent emissions', () => scheduler().run(({ cold, expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([cold('-b-|', { b: 1 }), cold('-b-|', { b: 2 })])).toBe('-b-|', {
35
+ b: [1, 2],
36
+ })));
37
+ test('handles observables with staggered and concurrent emissions', () => scheduler().run(({ cold, expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([
38
+ cold('a-|', { a: 1 }),
39
+ cold('ab|', { a: 2, b: 3 }),
40
+ cold('-bc-|', { b: 4, c: 5 }),
41
+ ])).toBe('abc-|', {
42
+ a: [1, 2],
43
+ b: [1, 3, 4],
44
+ c: [1, 3, 5],
45
+ })));
46
+ test('fills in the default value if provided', () => scheduler().run(({ cold, expectObservable }) => expectObservable((0, combineLatestOrDefault_1.combineLatestOrDefault)([cold('a--|', { a: 1 }), cold('-b-|', { b: 2 }), cold('--c|', { c: 3 })], 42)).toBe('abc|', {
47
+ a: [1, 42, 42],
48
+ b: [1, 2, 42],
49
+ c: [1, 2, 3],
50
+ })));
51
+ });
52
+ //# sourceMappingURL=combineLatestOrDefault.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combineLatestOrDefault.test.js","sourceRoot":"","sources":["../../../src/utils/rxjs/combineLatestOrDefault.test.ts"],"names":[],"mappings":";;AAAA,oBAAoB;AACpB,+BAAyB;AACzB,0CAA4C;AAC5C,qEAAiE;AAEjE,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,uBAAa,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAEzE,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACpC,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACvC,IAAI,CAAC,oCAAoC,EAAE,GAAG,EAAE,CAC5C,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,CACrC,gBAAgB,CAAC,IAAA,+CAAsB,EAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;YAC3D,CAAC,EAAE,EAAE;SACR,CAAC,CACL,CAAC,CAAA;IACV,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACtC,IAAI,CAAC,oEAAoE,EAAE,GAAG,EAAE,CAC5E,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAC3C,gBAAgB,CAAC,IAAA,+CAAsB,EAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE;YAC5E,CAAC,EAAE,CAAC,CAAC,CAAC;SACT,CAAC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AE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;KAChC,CAAC,CACL,CAAC,IAAI,CAAC,OAAO,EAAE;QACZ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACT,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACZ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KACf,CAAC,CACL,CAAC,CAAA;IAEN,IAAI,CAAC,wCAAwC,EAAE,GAAG,EAAE,CAChD,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAC3C,gBAAgB,CACZ,IAAA,+CAAsB,EAAC,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CACvG,CAAC,IAAI,CAAC,MAAM,EAAE;QACX,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;QACd,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACb,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;KACf,CAAC,CACL,CAAC,CAAA;AACV,CAAC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './combineLatestOrDefault';
@@ -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("./combineLatestOrDefault"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/rxjs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC"}
@@ -0,0 +1,19 @@
1
+ import { Subscribable } from 'cdeops/client';
2
+ /**
3
+ * Runs f and returns a resolved promise with its value or a rejected promise with its exception,
4
+ * regardless of whether it returns a promise or not.
5
+ * @param f
6
+ */
7
+ export declare function tryCatchPromise<T>(f: () => T | Promise<T>): Promise<T>;
8
+ /**
9
+ * Reports whether value is a Promise.
10
+ */
11
+ export declare function isPromise(value: any): value is Promise<any>;
12
+ /**
13
+ * Reports whether value is a {@link cdeops.Subscribable}.
14
+ */
15
+ export declare function isSubscribable(value: any): value is Subscribable<any>;
16
+ /** Flattens and compacts the argument. If it is null or if the result is empty, it returns null. */
17
+ export declare function flattenAndCompact<T>(value: (T | T[] | null)[] | null): T[] | null;
18
+ /** generate unique id for contributions */
19
+ export declare function generateContributionId(): string;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateContributionId = exports.flattenAndCompact = exports.isSubscribable = exports.isPromise = exports.tryCatchPromise = void 0;
4
+ const lodash_1 = require("lodash");
5
+ /**
6
+ * Runs f and returns a resolved promise with its value or a rejected promise with its exception,
7
+ * regardless of whether it returns a promise or not.
8
+ * @param f
9
+ */
10
+ function tryCatchPromise(f) {
11
+ try {
12
+ return Promise.resolve(f());
13
+ }
14
+ catch (err) {
15
+ return Promise.reject(err);
16
+ }
17
+ }
18
+ exports.tryCatchPromise = tryCatchPromise;
19
+ /**
20
+ * Reports whether value is a Promise.
21
+ */
22
+ function isPromise(value) {
23
+ return typeof value.then === 'function';
24
+ }
25
+ exports.isPromise = isPromise;
26
+ /**
27
+ * Reports whether value is a {@link cdeops.Subscribable}.
28
+ */
29
+ function isSubscribable(value) {
30
+ return typeof value.subscribe === 'function';
31
+ }
32
+ exports.isSubscribable = isSubscribable;
33
+ /** Flattens and compacts the argument. If it is null or if the result is empty, it returns null. */
34
+ function flattenAndCompact(value) {
35
+ if (value === null) {
36
+ return null;
37
+ }
38
+ const merged = (0, lodash_1.flatten)((0, lodash_1.compact)(value));
39
+ return merged.length === 0 ? null : merged;
40
+ }
41
+ exports.flattenAndCompact = flattenAndCompact;
42
+ /** generate unique id for contributions */
43
+ function generateContributionId() {
44
+ // always start with a letter (for DOM friendlyness)
45
+ let idStr = String.fromCharCode(Math.floor((Math.random() * 25) + 65));
46
+ do {
47
+ // between numbers and characters (48 is 0 and 90 is Z (42-48 = 90)
48
+ const asciCode = Math.floor((Math.random() * 42) + 48);
49
+ if (asciCode < 58 || asciCode > 64) {
50
+ // exclude all chars between : (58) and @ (64)
51
+ idStr += String.fromCharCode(asciCode);
52
+ }
53
+ } while (idStr.length < 32);
54
+ return (idStr);
55
+ }
56
+ exports.generateContributionId = generateContributionId;
57
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/utils/util.ts"],"names":[],"mappings":";;;AACA,mCAA0C;AAC1C;;;;GAIG;AACH,SAAgB,eAAe,CAAI,CAAuB;IACtD,IAAI;QACA,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;KAC/B;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KAC9B;AACL,C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
2
+ export declare const GQL_STOP = "stop";
3
+ export declare const GQL_DATA = "data";
4
+ export declare const GQL_ERROR = "error";
5
+ export declare const GQL_COMPLETE = "complete";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GQL_COMPLETE = exports.GQL_ERROR = exports.GQL_DATA = exports.GQL_STOP = exports.GQL_START = void 0;
4
+ exports.GQL_START = 'start';
5
+ exports.GQL_STOP = 'stop';
6
+ exports.GQL_DATA = 'data';
7
+ exports.GQL_ERROR = 'error';
8
+ exports.GQL_COMPLETE = 'complete';
9
+ //# sourceMappingURL=MessageTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageTypes.js","sourceRoot":"","sources":["../../src/worker-lib/MessageTypes.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC;AACpB,QAAA,QAAQ,GAAG,MAAM,CAAC;AAClB,QAAA,QAAQ,GAAG,MAAM,CAAC;AAClB,QAAA,SAAS,GAAG,OAAO,CAAC;AACpB,QAAA,YAAY,GAAG,UAAU,CAAC"}