@gitpod/gitpod-protocol 0.1.5-test.6 → 0.1.5-tweak-workspaceconfig-origin-docs-fork.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 (331) hide show
  1. package/data/builtin-theia-plugins.json +28 -18
  2. package/data/gitpod-schema.json +17 -17
  3. package/lib/accounting-protocol.d.ts +155 -0
  4. package/lib/accounting-protocol.d.ts.map +1 -0
  5. package/lib/accounting-protocol.js +109 -0
  6. package/lib/accounting-protocol.js.map +1 -0
  7. package/lib/admin-protocol.d.ts +22 -5
  8. package/lib/admin-protocol.d.ts.map +1 -1
  9. package/lib/admin-protocol.js +16 -1
  10. package/lib/admin-protocol.js.map +1 -1
  11. package/lib/analytics.d.ts +45 -0
  12. package/lib/analytics.d.ts.map +1 -0
  13. package/lib/analytics.js +10 -0
  14. package/lib/analytics.js.map +1 -0
  15. package/lib/auth.d.ts +25 -0
  16. package/lib/auth.d.ts.map +1 -0
  17. package/lib/auth.js +16 -0
  18. package/lib/auth.js.map +1 -0
  19. package/lib/context-url.d.ts +18 -0
  20. package/lib/context-url.d.ts.map +1 -0
  21. package/lib/context-url.js +49 -0
  22. package/lib/context-url.js.map +1 -0
  23. package/lib/context-url.spec.d.ts +12 -0
  24. package/lib/context-url.spec.d.ts.map +1 -0
  25. package/lib/context-url.spec.js +73 -0
  26. package/lib/context-url.spec.js.map +1 -0
  27. package/lib/email-protocol.d.ts +2 -2
  28. package/lib/email-protocol.d.ts.map +1 -1
  29. package/lib/email-protocol.js +6 -5
  30. package/lib/email-protocol.js.map +1 -1
  31. package/lib/encryption/container-module.d.ts +1 -1
  32. package/lib/encryption/container-module.js +7 -5
  33. package/lib/encryption/container-module.js.map +1 -1
  34. package/lib/encryption/encryption-engine.d.ts +1 -1
  35. package/lib/encryption/encryption-engine.js +21 -21
  36. package/lib/encryption/encryption-engine.js.map +1 -1
  37. package/lib/encryption/encryption-engine.spec.d.ts +2 -2
  38. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  39. package/lib/encryption/encryption-engine.spec.js +31 -37
  40. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  41. package/lib/encryption/encryption-service.d.ts +1 -1
  42. package/lib/encryption/encryption-service.js +31 -44
  43. package/lib/encryption/encryption-service.js.map +1 -1
  44. package/lib/encryption/key-provider.d.ts +2 -2
  45. package/lib/encryption/key-provider.d.ts.map +1 -1
  46. package/lib/encryption/key-provider.js +27 -31
  47. package/lib/encryption/key-provider.js.map +1 -1
  48. package/lib/env.d.ts +2 -3
  49. package/lib/env.d.ts.map +1 -1
  50. package/lib/env.js +21 -21
  51. package/lib/env.js.map +1 -1
  52. package/lib/gitpod-file-parser.d.ts +1 -1
  53. package/lib/gitpod-file-parser.js +27 -42
  54. package/lib/gitpod-file-parser.js.map +1 -1
  55. package/lib/gitpod-file-parser.spec.d.ts +1 -1
  56. package/lib/gitpod-file-parser.spec.js +117 -117
  57. package/lib/gitpod-file-parser.spec.js.map +1 -1
  58. package/lib/gitpod-service.d.ts +186 -34
  59. package/lib/gitpod-service.d.ts.map +1 -1
  60. package/lib/gitpod-service.js +239 -116
  61. package/lib/gitpod-service.js.map +1 -1
  62. package/lib/headless-workspace-log.d.ts +9 -12
  63. package/lib/headless-workspace-log.d.ts.map +1 -1
  64. package/lib/headless-workspace-log.js +5 -7
  65. package/lib/headless-workspace-log.js.map +1 -1
  66. package/lib/ide-frontend-service.d.ts +26 -0
  67. package/lib/ide-frontend-service.d.ts.map +1 -0
  68. package/lib/ide-frontend-service.js +8 -0
  69. package/lib/ide-frontend-service.js.map +1 -0
  70. package/lib/ide-protocol.d.ts +81 -0
  71. package/lib/ide-protocol.d.ts.map +1 -0
  72. package/lib/{util/without.js → ide-protocol.js} +2 -2
  73. package/lib/ide-protocol.js.map +1 -0
  74. package/lib/index.d.ts +5 -1
  75. package/lib/index.d.ts.map +1 -1
  76. package/lib/index.js +25 -12
  77. package/lib/index.js.map +1 -1
  78. package/lib/license-protocol.d.ts +1 -1
  79. package/lib/license-protocol.js +2 -1
  80. package/lib/license-protocol.js.map +1 -1
  81. package/lib/messaging/browser/connection.d.ts +6 -4
  82. package/lib/messaging/browser/connection.d.ts.map +1 -1
  83. package/lib/messaging/browser/connection.js +188 -48
  84. package/lib/messaging/browser/connection.js.map +1 -1
  85. package/lib/messaging/browser/window-connection.d.ts +26 -0
  86. package/lib/messaging/browser/window-connection.d.ts.map +1 -0
  87. package/lib/messaging/browser/window-connection.js +68 -0
  88. package/lib/messaging/browser/window-connection.js.map +1 -0
  89. package/lib/messaging/client-call-metrics.d.ts +35 -0
  90. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  91. package/lib/messaging/client-call-metrics.js +83 -0
  92. package/lib/messaging/client-call-metrics.js.map +1 -0
  93. package/lib/messaging/connection-error-handler.js +12 -23
  94. package/lib/messaging/connection-error-handler.js.map +1 -1
  95. package/lib/messaging/error.d.ts +6 -2
  96. package/lib/messaging/error.d.ts.map +1 -1
  97. package/lib/messaging/error.js +13 -4
  98. package/lib/messaging/error.js.map +1 -1
  99. package/lib/messaging/handler.d.ts +10 -0
  100. package/lib/messaging/handler.d.ts.map +1 -1
  101. package/lib/messaging/handler.js +1 -0
  102. package/lib/messaging/handler.js.map +1 -1
  103. package/lib/messaging/node/connection.js +23 -22
  104. package/lib/messaging/node/connection.js.map +1 -1
  105. package/lib/messaging/proxy-factory.d.ts +2 -0
  106. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  107. package/lib/messaging/proxy-factory.js +75 -169
  108. package/lib/messaging/proxy-factory.js.map +1 -1
  109. package/lib/payment-protocol.d.ts +18 -0
  110. package/lib/payment-protocol.d.ts.map +1 -0
  111. package/lib/payment-protocol.js +13 -0
  112. package/lib/payment-protocol.js.map +1 -0
  113. package/lib/permission.d.ts +14 -12
  114. package/lib/permission.d.ts.map +1 -1
  115. package/lib/permission.js +21 -19
  116. package/lib/permission.js.map +1 -1
  117. package/lib/plans.d.ts +210 -0
  118. package/lib/plans.d.ts.map +1 -0
  119. package/lib/plans.js +570 -0
  120. package/lib/plans.js.map +1 -0
  121. package/lib/protocol.d.ts +123 -30
  122. package/lib/protocol.d.ts.map +1 -1
  123. package/lib/protocol.js +121 -117
  124. package/lib/protocol.js.map +1 -1
  125. package/lib/snapshot-url.d.ts +14 -0
  126. package/lib/snapshot-url.d.ts.map +1 -0
  127. package/lib/snapshot-url.js +26 -0
  128. package/lib/snapshot-url.js.map +1 -0
  129. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +3 -4
  130. package/lib/snapshot-url.spec.d.ts.map +1 -0
  131. package/lib/snapshot-url.spec.js +41 -0
  132. package/lib/snapshot-url.spec.js.map +1 -0
  133. package/lib/team-subscription-protocol.d.ts +73 -0
  134. package/lib/team-subscription-protocol.d.ts.map +1 -0
  135. package/lib/team-subscription-protocol.js +63 -0
  136. package/lib/team-subscription-protocol.js.map +1 -0
  137. package/lib/teams-projects-protocol.d.ts +103 -0
  138. package/lib/teams-projects-protocol.d.ts.map +1 -0
  139. package/lib/teams-projects-protocol.js +23 -0
  140. package/lib/teams-projects-protocol.js.map +1 -0
  141. package/lib/theia-plugins.d.ts +1 -1
  142. package/lib/theia-plugins.js +1 -1
  143. package/lib/typings/globals.d.ts +12 -0
  144. package/lib/typings/globals.d.ts.map +1 -0
  145. package/lib/typings/globals.js +7 -0
  146. package/lib/typings/globals.js.map +1 -0
  147. package/lib/util/analytics.d.ts +8 -0
  148. package/lib/util/analytics.d.ts.map +1 -0
  149. package/lib/util/analytics.js +79 -0
  150. package/lib/util/analytics.js.map +1 -0
  151. package/lib/util/async-iterator.d.ts +1 -1
  152. package/lib/util/async-iterator.js +57 -134
  153. package/lib/util/async-iterator.js.map +1 -1
  154. package/lib/util/cancelable.d.ts +1 -1
  155. package/lib/util/cancelable.js +19 -60
  156. package/lib/util/cancelable.js.map +1 -1
  157. package/lib/util/date-time.d.ts +1 -1
  158. package/lib/util/date-time.js +10 -9
  159. package/lib/util/date-time.js.map +1 -1
  160. package/lib/util/deep-partial.d.ts +1 -1
  161. package/lib/util/deep-partial.js +1 -1
  162. package/lib/util/deferred.d.ts +1 -1
  163. package/lib/util/deferred.js +12 -13
  164. package/lib/util/deferred.js.map +1 -1
  165. package/lib/util/disposable.d.ts +2 -2
  166. package/lib/util/disposable.d.ts.map +1 -1
  167. package/lib/util/disposable.js +27 -39
  168. package/lib/util/disposable.js.map +1 -1
  169. package/lib/util/event.d.ts +1 -1
  170. package/lib/util/event.d.ts.map +1 -1
  171. package/lib/util/event.js +59 -74
  172. package/lib/util/event.js.map +1 -1
  173. package/lib/util/garbage-collected-cache.d.ts +1 -1
  174. package/lib/util/garbage-collected-cache.js +24 -47
  175. package/lib/util/garbage-collected-cache.js.map +1 -1
  176. package/lib/util/generate-workspace-id.d.ts +4 -0
  177. package/lib/util/generate-workspace-id.d.ts.map +1 -0
  178. package/lib/util/generate-workspace-id.js +470 -0
  179. package/lib/util/generate-workspace-id.js.map +1 -0
  180. package/lib/util/generate-workspace-id.spec.d.ts +7 -0
  181. package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
  182. package/lib/util/generate-workspace-id.spec.js +63 -0
  183. package/lib/util/generate-workspace-id.spec.js.map +1 -0
  184. package/lib/util/gitpod-cookie.d.ts +20 -0
  185. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  186. package/lib/util/gitpod-cookie.js +44 -0
  187. package/lib/util/gitpod-cookie.js.map +1 -0
  188. package/lib/util/gitpod-host-url.d.ts +8 -3
  189. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  190. package/lib/util/gitpod-host-url.js +106 -76
  191. package/lib/util/gitpod-host-url.js.map +1 -1
  192. package/lib/util/gitpod-host-url.spec.d.ts +16 -0
  193. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
  194. package/lib/util/gitpod-host-url.spec.js +124 -0
  195. package/lib/util/gitpod-host-url.spec.js.map +1 -0
  196. package/lib/util/grpc.d.ts +15 -0
  197. package/lib/util/grpc.d.ts.map +1 -0
  198. package/lib/util/grpc.js +18 -0
  199. package/lib/util/grpc.js.map +1 -0
  200. package/lib/util/logging.d.ts +57 -34
  201. package/lib/util/logging.d.ts.map +1 -1
  202. package/lib/util/logging.js +119 -110
  203. package/lib/util/logging.js.map +1 -1
  204. package/lib/util/make-link.d.ts +1 -1
  205. package/lib/util/make-link.js +4 -3
  206. package/lib/util/make-link.js.map +1 -1
  207. package/lib/util/parse-workspace-id.d.ts +14 -4
  208. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  209. package/lib/util/parse-workspace-id.js +39 -8
  210. package/lib/util/parse-workspace-id.js.map +1 -1
  211. package/lib/util/parse-workspace-id.spec.d.ts +9 -1
  212. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  213. package/lib/util/parse-workspace-id.spec.js +129 -48
  214. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  215. package/lib/util/queue.d.ts +1 -1
  216. package/lib/util/queue.js +18 -56
  217. package/lib/util/queue.js.map +1 -1
  218. package/lib/util/queue.spec.d.ts +1 -1
  219. package/lib/util/queue.spec.js +145 -287
  220. package/lib/util/queue.spec.js.map +1 -1
  221. package/lib/util/repeater.d.ts +1 -1
  222. package/lib/util/repeater.js +37 -89
  223. package/lib/util/repeater.js.map +1 -1
  224. package/lib/util/safe-promise.d.ts +1 -1
  225. package/lib/util/safe-promise.js +11 -13
  226. package/lib/util/safe-promise.js.map +1 -1
  227. package/lib/util/semaphore.d.ts +1 -1
  228. package/lib/util/semaphore.js +17 -47
  229. package/lib/util/semaphore.js.map +1 -1
  230. package/lib/util/skip-if.d.ts +1 -1
  231. package/lib/util/skip-if.js +8 -7
  232. package/lib/util/skip-if.js.map +1 -1
  233. package/lib/util/timeutil.d.ts +1 -1
  234. package/lib/util/timeutil.d.ts.map +1 -1
  235. package/lib/util/timeutil.js +30 -17
  236. package/lib/util/timeutil.js.map +1 -1
  237. package/lib/util/timeutil.spec.d.ts +1 -1
  238. package/lib/util/timeutil.spec.js +23 -25
  239. package/lib/util/timeutil.spec.js.map +1 -1
  240. package/lib/util/tracing.d.ts +15 -2
  241. package/lib/util/tracing.d.ts.map +1 -1
  242. package/lib/util/tracing.js +86 -51
  243. package/lib/util/tracing.js.map +1 -1
  244. package/lib/util/workspace-port-authentication.d.ts +1 -1
  245. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  246. package/lib/util/workspace-port-authentication.js +5 -3
  247. package/lib/util/workspace-port-authentication.js.map +1 -1
  248. package/lib/workspace-cluster.d.ts +74 -0
  249. package/lib/workspace-cluster.d.ts.map +1 -0
  250. package/lib/workspace-cluster.js +16 -0
  251. package/lib/workspace-cluster.js.map +1 -0
  252. package/lib/workspace-instance.d.ts +10 -4
  253. package/lib/workspace-instance.d.ts.map +1 -1
  254. package/lib/workspace-instance.js +1 -1
  255. package/lib/wsready.d.ts +1 -1
  256. package/lib/wsready.js +3 -2
  257. package/lib/wsready.js.map +1 -1
  258. package/package.json +32 -16
  259. package/pkg-yarn.lock +18 -9
  260. package/src/accounting-protocol.ts +229 -0
  261. package/src/admin-protocol.ts +41 -6
  262. package/src/analytics.ts +54 -0
  263. package/src/auth.ts +27 -0
  264. package/src/context-url.spec.ts +39 -0
  265. package/src/context-url.ts +51 -0
  266. package/src/email-protocol.ts +3 -4
  267. package/src/encryption/container-module.ts +1 -1
  268. package/src/encryption/encryption-engine.spec.ts +1 -1
  269. package/src/encryption/encryption-engine.ts +1 -1
  270. package/src/encryption/encryption-service.ts +1 -1
  271. package/src/encryption/key-provider.ts +1 -1
  272. package/src/env.ts +11 -11
  273. package/src/gitpod-file-parser.spec.ts +1 -1
  274. package/src/gitpod-file-parser.ts +1 -1
  275. package/src/gitpod-service.ts +386 -52
  276. package/src/headless-workspace-log.ts +8 -12
  277. package/src/ide-frontend-service.ts +28 -0
  278. package/src/ide-protocol.ts +92 -0
  279. package/src/index.ts +6 -2
  280. package/src/license-protocol.ts +1 -1
  281. package/src/messaging/browser/connection.ts +201 -23
  282. package/src/messaging/browser/window-connection.ts +72 -0
  283. package/src/messaging/client-call-metrics.ts +97 -0
  284. package/src/messaging/error.ts +16 -4
  285. package/src/messaging/handler.ts +12 -0
  286. package/src/messaging/node/connection.ts +2 -2
  287. package/src/messaging/proxy-factory.ts +16 -14
  288. package/src/payment-protocol.ts +20 -0
  289. package/src/permission.ts +9 -8
  290. package/src/plans.ts +632 -0
  291. package/src/protocol.ts +204 -61
  292. package/src/snapshot-url.spec.ts +25 -0
  293. package/src/snapshot-url.ts +27 -0
  294. package/src/team-subscription-protocol.ts +113 -0
  295. package/src/teams-projects-protocol.ts +132 -0
  296. package/src/theia-plugins.ts +1 -1
  297. package/src/typings/globals.ts +12 -0
  298. package/src/util/analytics.ts +87 -0
  299. package/src/util/async-iterator.ts +1 -1
  300. package/src/util/cancelable.ts +1 -1
  301. package/src/util/date-time.ts +1 -1
  302. package/src/util/deep-partial.ts +1 -1
  303. package/src/util/deferred.ts +2 -2
  304. package/src/util/garbage-collected-cache.ts +3 -3
  305. package/src/util/generate-workspace-id.spec.ts +31 -0
  306. package/src/util/generate-workspace-id.ts +457 -0
  307. package/src/util/gitpod-cookie.ts +39 -0
  308. package/src/util/gitpod-host-url.spec.ts +49 -0
  309. package/src/util/gitpod-host-url.ts +58 -14
  310. package/src/util/grpc.ts +15 -0
  311. package/src/util/jaeger-client.d.ts +1 -1
  312. package/src/util/logging.ts +111 -39
  313. package/src/util/make-link.ts +1 -1
  314. package/src/util/parse-workspace-id.spec.ts +46 -5
  315. package/src/util/parse-workspace-id.ts +39 -8
  316. package/src/util/queue.spec.ts +2 -2
  317. package/src/util/queue.ts +1 -1
  318. package/src/util/repeater.ts +1 -1
  319. package/src/util/safe-promise.ts +1 -1
  320. package/src/util/semaphore.ts +3 -3
  321. package/src/util/skip-if.ts +2 -2
  322. package/src/util/timeutil.spec.ts +1 -1
  323. package/src/util/timeutil.ts +5 -5
  324. package/src/util/tracing.ts +66 -4
  325. package/src/util/workspace-port-authentication.ts +1 -1
  326. package/src/workspace-cluster.ts +96 -0
  327. package/src/workspace-instance.ts +38 -16
  328. package/src/wsready.ts +2 -2
  329. package/lib/util/without.d.ts +0 -7
  330. package/lib/util/without.d.ts.map +0 -1
  331. package/lib/util/without.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
4
  * Licensed under the GNU Affero General Public License (AGPL).
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
@@ -22,312 +22,170 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  step((generator = generator.apply(thisArg, _arguments || [])).next());
23
23
  });
24
24
  };
25
- var __generator = (this && this.__generator) || function (thisArg, body) {
26
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
- function verb(n) { return function (v) { return step([n, v]); }; }
29
- function step(op) {
30
- if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
32
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
33
- if (y = 0, t) op = [op[0] & 2, t.value];
34
- switch (op[0]) {
35
- case 0: case 1: t = op; break;
36
- case 4: _.label++; return { value: op[1], done: false };
37
- case 5: _.label++; y = op[1]; op = [0]; continue;
38
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
- default:
40
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
- if (t[2]) _.ops.pop();
45
- _.trys.pop(); continue;
46
- }
47
- op = body.call(thisArg, _);
48
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
- }
51
- };
52
- var __values = (this && this.__values) || function(o) {
53
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
54
- if (m) return m.call(o);
55
- if (o && typeof o.length === "number") return {
56
- next: function () {
57
- if (o && i >= o.length) o = void 0;
58
- return { value: o && o[i++], done: !o };
59
- }
60
- };
61
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
62
- };
63
- var __read = (this && this.__read) || function (o, n) {
64
- var m = typeof Symbol === "function" && o[Symbol.iterator];
65
- if (!m) return o;
66
- var i = m.call(o), r, ar = [], e;
67
- try {
68
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
69
- }
70
- catch (error) { e = { error: error }; }
71
- finally {
72
- try {
73
- if (r && !r.done && (m = i["return"])) m.call(i);
74
- }
75
- finally { if (e) throw e.error; }
76
- }
77
- return ar;
78
- };
79
25
  Object.defineProperty(exports, "__esModule", { value: true });
80
- var mocha_typescript_1 = require("mocha-typescript");
81
- var chai = require("chai");
82
- var chaiSubset = require('chai-subset');
26
+ const mocha_typescript_1 = require("mocha-typescript");
27
+ const chai = require("chai");
28
+ const chaiSubset = require('chai-subset');
83
29
  chai.use(chaiSubset);
84
- var __1 = require("..");
85
- var assert_1 = require("assert");
86
- var deferred_1 = require("./deferred");
87
- var expect = chai.expect;
88
- var QueueSpec = /** @class */ (function () {
89
- function QueueSpec() {
90
- }
91
- QueueSpec.prototype.before = function () {
30
+ const __1 = require("..");
31
+ const assert_1 = require("assert");
32
+ const deferred_1 = require("./deferred");
33
+ const expect = chai.expect;
34
+ let QueueSpec = class QueueSpec {
35
+ before() {
92
36
  this.queue = new __1.Queue();
93
37
  this.seq = [];
94
- };
95
- QueueSpec.prototype.exec = function (seqNr, nextTick, sleep) {
96
- if (nextTick === void 0) { nextTick = false; }
97
- if (sleep === void 0) { sleep = 0; }
98
- return __awaiter(this, void 0, void 0, function () {
99
- var _this = this;
100
- return __generator(this, function (_a) {
101
- return [2 /*return*/, this.queue.enqueue(function () { return __awaiter(_this, void 0, void 0, function () {
102
- var push;
103
- var _this = this;
104
- return __generator(this, function (_a) {
105
- switch (_a.label) {
106
- case 0:
107
- push = function () { return __awaiter(_this, void 0, void 0, function () {
108
- var _this = this;
109
- return __generator(this, function (_a) {
110
- if (sleep > 0)
111
- return [2 /*return*/, new Promise(function (resolve) {
112
- setTimeout(function () {
113
- _this.seq.push(seqNr);
114
- resolve();
115
- }, sleep);
116
- })];
117
- else
118
- this.seq.push(seqNr);
119
- return [2 /*return*/];
120
- });
121
- }); };
122
- if (!nextTick) return [3 /*break*/, 1];
123
- return [2 /*return*/, new Promise(function (resolve) {
124
- process.nextTick(function () {
125
- push().then(resolve);
126
- });
127
- })];
128
- case 1: return [4 /*yield*/, push()];
129
- case 2:
130
- _a.sent();
131
- _a.label = 3;
132
- case 3: return [2 /*return*/];
133
- }
38
+ }
39
+ exec(seqNr, nextTick = false, sleep = 0) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ return this.queue.enqueue(() => __awaiter(this, void 0, void 0, function* () {
42
+ const push = () => __awaiter(this, void 0, void 0, function* () {
43
+ if (sleep > 0)
44
+ return new Promise((resolve) => {
45
+ setTimeout(() => {
46
+ this.seq.push(seqNr);
47
+ resolve(undefined);
48
+ }, sleep);
134
49
  });
135
- }); })];
136
- });
50
+ else
51
+ this.seq.push(seqNr);
52
+ });
53
+ if (nextTick)
54
+ return new Promise((resolve) => {
55
+ process.nextTick(() => {
56
+ push().then(resolve);
57
+ });
58
+ });
59
+ else
60
+ yield push();
61
+ }));
137
62
  });
138
- };
139
- QueueSpec.prototype.execError = function (seqNr) {
140
- var _this = this;
141
- var deferred = new deferred_1.Deferred();
142
- this.queue.enqueue(function () { return __awaiter(_this, void 0, void 0, function () {
143
- return __generator(this, function (_a) {
144
- this.seq.push(seqNr);
145
- throw new Error('test error');
146
- });
147
- }); }).then(function () {
63
+ }
64
+ execError(seqNr) {
65
+ const deferred = new deferred_1.Deferred();
66
+ this.queue.enqueue(() => __awaiter(this, void 0, void 0, function* () {
67
+ this.seq.push(seqNr);
68
+ throw new Error('test error');
69
+ })).then(() => {
148
70
  deferred.reject(false);
149
- }).catch(function () {
71
+ }).catch(() => {
150
72
  deferred.resolve(true);
151
73
  });
152
74
  return deferred;
153
- };
154
- QueueSpec.prototype.expectArray = function (actual, expected) {
155
- var e_1, _a;
75
+ }
76
+ expectArray(actual, expected) {
156
77
  expect(actual).to.have.lengthOf(expected.length);
157
- var expIt = expected.entries();
158
- try {
159
- for (var actual_1 = __values(actual), actual_1_1 = actual_1.next(); !actual_1_1.done; actual_1_1 = actual_1.next()) {
160
- var act = actual_1_1.value;
161
- var _b = __read(expIt.next().value, 2), exp = _b[1];
162
- expect(act).to.deep.equal(exp);
163
- }
78
+ const expIt = expected.entries();
79
+ for (const act of actual) {
80
+ const { value: [, exp] } = expIt.next();
81
+ expect(act).to.deep.equal(exp);
164
82
  }
165
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
166
- finally {
167
- try {
168
- if (actual_1_1 && !actual_1_1.done && (_a = actual_1.return)) _a.call(actual_1);
169
- }
170
- finally { if (e_1) throw e_1.error; }
171
- }
172
- };
173
- QueueSpec.prototype.isExecutedInOrder = function () {
174
- return __awaiter(this, void 0, void 0, function () {
175
- return __generator(this, function (_a) {
176
- switch (_a.label) {
177
- case 0:
178
- this.exec(1);
179
- return [4 /*yield*/, this.exec(2)];
180
- case 1:
181
- _a.sent();
182
- this.expectArray(this.seq, [1, 2]);
183
- return [2 /*return*/];
184
- }
185
- });
83
+ }
84
+ isExecutedInOrder() {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ this.exec(1);
87
+ yield this.exec(2);
88
+ this.expectArray(this.seq, [1, 2]);
186
89
  });
187
- };
188
- QueueSpec.prototype.isExecutedInOrderSkipTick = function () {
189
- return __awaiter(this, void 0, void 0, function () {
190
- return __generator(this, function (_a) {
191
- switch (_a.label) {
192
- case 0:
193
- this.exec(1, true);
194
- return [4 /*yield*/, this.exec(2)];
195
- case 1:
196
- _a.sent();
197
- this.expectArray(this.seq, [1, 2]);
198
- return [2 /*return*/];
199
- }
200
- });
90
+ }
91
+ isExecutedInOrderSkipTick() {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ this.exec(1, true);
94
+ yield this.exec(2);
95
+ this.expectArray(this.seq, [1, 2]);
201
96
  });
202
- };
203
- QueueSpec.prototype.isExecutedInOrderSleep = function () {
204
- return __awaiter(this, void 0, void 0, function () {
205
- return __generator(this, function (_a) {
206
- switch (_a.label) {
207
- case 0:
208
- this.exec(1, false, 2000);
209
- return [4 /*yield*/, this.exec(2)];
210
- case 1:
211
- _a.sent();
212
- this.expectArray(this.seq, [1, 2]);
213
- return [2 /*return*/];
214
- }
215
- });
97
+ }
98
+ isExecutedInOrderSleep() {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ this.exec(1, false, 2000);
101
+ yield this.exec(2);
102
+ this.expectArray(this.seq, [1, 2]);
216
103
  });
217
- };
218
- QueueSpec.prototype.continueDespiteError = function () {
219
- return __awaiter(this, void 0, void 0, function () {
220
- var receivedError, _a;
221
- return __generator(this, function (_b) {
222
- switch (_b.label) {
223
- case 0:
224
- this.exec(1);
225
- receivedError = this.execError(2);
226
- return [4 /*yield*/, this.exec(3)];
227
- case 1:
228
- _b.sent();
229
- expect(receivedError.isResolved).to.equal(true);
230
- _a = expect;
231
- return [4 /*yield*/, receivedError.promise];
232
- case 2:
233
- _a.apply(void 0, [_b.sent()]).to.equal(true);
234
- this.expectArray(this.seq, [1, 2, 3]);
235
- return [2 /*return*/];
236
- }
237
- });
104
+ }
105
+ continueDespiteError() {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ this.exec(1);
108
+ const receivedError = this.execError(2);
109
+ yield this.exec(3);
110
+ expect(receivedError.isResolved).to.equal(true);
111
+ expect(yield receivedError.promise).to.equal(true);
112
+ this.expectArray(this.seq, [1, 2, 3]);
238
113
  });
239
- };
240
- QueueSpec.prototype.mustCatchError = function () {
241
- return __awaiter(this, void 0, void 0, function () {
242
- var f, p;
243
- var _this = this;
244
- return __generator(this, function (_a) {
245
- f = function () { return __awaiter(_this, void 0, void 0, function () {
246
- return __generator(this, function (_a) {
247
- throw new Error();
248
- });
249
- }); };
250
- try {
251
- p = this.queue.enqueue(function () { return __awaiter(_this, void 0, void 0, function () {
252
- return __generator(this, function (_a) {
253
- return [2 /*return*/, f()];
254
- });
255
- }); });
256
- p.catch(function (err) {
257
- // Silence unhandled promise rejection messages
258
- });
259
- }
260
- catch (err) {
261
- assert_1.fail("We expect to catch no error");
262
- }
263
- return [2 /*return*/];
114
+ }
115
+ mustCatchError() {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ const f = () => __awaiter(this, void 0, void 0, function* () {
118
+ throw new Error();
264
119
  });
265
- });
266
- };
267
- QueueSpec.prototype.expectUncaughtError = function () {
268
- return __awaiter(this, void 0, void 0, function () {
269
- var f, p;
270
- var _this = this;
271
- return __generator(this, function (_a) {
272
- f = function () { return __awaiter(_this, void 0, void 0, function () {
273
- return __generator(this, function (_a) {
274
- throw new Error();
275
- });
276
- }); };
277
- p = this.queue.enqueue(function () { return __awaiter(_this, void 0, void 0, function () {
278
- return __generator(this, function (_a) {
279
- return [2 /*return*/, f()];
280
- });
281
- }); });
282
- p.then(function (r) {
283
- assert_1.fail("Expected to catch error!");
284
- }).catch(function (err) {
120
+ try {
121
+ const p = this.queue.enqueue(() => __awaiter(this, void 0, void 0, function* () {
122
+ return f();
123
+ }));
124
+ p.catch((err) => {
285
125
  // Silence unhandled promise rejection messages
286
126
  });
287
- return [2 /*return*/];
127
+ }
128
+ catch (err) {
129
+ (0, assert_1.fail)("We expect to catch no error");
130
+ }
131
+ });
132
+ }
133
+ expectUncaughtError() {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ const f = () => __awaiter(this, void 0, void 0, function* () {
136
+ throw new Error();
137
+ });
138
+ const p = this.queue.enqueue(() => __awaiter(this, void 0, void 0, function* () {
139
+ return f();
140
+ }));
141
+ p.then((r) => {
142
+ (0, assert_1.fail)("Expected to catch error!");
143
+ }).catch((err) => {
144
+ // Silence unhandled promise rejection messages
288
145
  });
289
146
  });
290
- };
291
- __decorate([
292
- mocha_typescript_1.test,
293
- __metadata("design:type", Function),
294
- __metadata("design:paramtypes", []),
295
- __metadata("design:returntype", Promise)
296
- ], QueueSpec.prototype, "isExecutedInOrder", null);
297
- __decorate([
298
- mocha_typescript_1.test,
299
- __metadata("design:type", Function),
300
- __metadata("design:paramtypes", []),
301
- __metadata("design:returntype", Promise)
302
- ], QueueSpec.prototype, "isExecutedInOrderSkipTick", null);
303
- __decorate([
304
- mocha_typescript_1.test, mocha_typescript_1.timeout(3000), mocha_typescript_1.slow(3000),
305
- __metadata("design:type", Function),
306
- __metadata("design:paramtypes", []),
307
- __metadata("design:returntype", Promise)
308
- ], QueueSpec.prototype, "isExecutedInOrderSleep", null);
309
- __decorate([
310
- mocha_typescript_1.test,
311
- __metadata("design:type", Function),
312
- __metadata("design:paramtypes", []),
313
- __metadata("design:returntype", Promise)
314
- ], QueueSpec.prototype, "continueDespiteError", null);
315
- __decorate([
316
- mocha_typescript_1.test,
317
- __metadata("design:type", Function),
318
- __metadata("design:paramtypes", []),
319
- __metadata("design:returntype", Promise)
320
- ], QueueSpec.prototype, "mustCatchError", null);
321
- __decorate([
322
- mocha_typescript_1.test,
323
- __metadata("design:type", Function),
324
- __metadata("design:paramtypes", []),
325
- __metadata("design:returntype", Promise)
326
- ], QueueSpec.prototype, "expectUncaughtError", null);
327
- QueueSpec = __decorate([
328
- mocha_typescript_1.suite
329
- ], QueueSpec);
330
- return QueueSpec;
331
- }());
147
+ }
148
+ };
149
+ __decorate([
150
+ mocha_typescript_1.test,
151
+ __metadata("design:type", Function),
152
+ __metadata("design:paramtypes", []),
153
+ __metadata("design:returntype", Promise)
154
+ ], QueueSpec.prototype, "isExecutedInOrder", null);
155
+ __decorate([
156
+ mocha_typescript_1.test,
157
+ __metadata("design:type", Function),
158
+ __metadata("design:paramtypes", []),
159
+ __metadata("design:returntype", Promise)
160
+ ], QueueSpec.prototype, "isExecutedInOrderSkipTick", null);
161
+ __decorate([
162
+ mocha_typescript_1.test,
163
+ (0, mocha_typescript_1.timeout)(3000),
164
+ (0, mocha_typescript_1.slow)(3000),
165
+ __metadata("design:type", Function),
166
+ __metadata("design:paramtypes", []),
167
+ __metadata("design:returntype", Promise)
168
+ ], QueueSpec.prototype, "isExecutedInOrderSleep", null);
169
+ __decorate([
170
+ mocha_typescript_1.test,
171
+ __metadata("design:type", Function),
172
+ __metadata("design:paramtypes", []),
173
+ __metadata("design:returntype", Promise)
174
+ ], QueueSpec.prototype, "continueDespiteError", null);
175
+ __decorate([
176
+ mocha_typescript_1.test,
177
+ __metadata("design:type", Function),
178
+ __metadata("design:paramtypes", []),
179
+ __metadata("design:returntype", Promise)
180
+ ], QueueSpec.prototype, "mustCatchError", null);
181
+ __decorate([
182
+ mocha_typescript_1.test,
183
+ __metadata("design:type", Function),
184
+ __metadata("design:paramtypes", []),
185
+ __metadata("design:returntype", Promise)
186
+ ], QueueSpec.prototype, "expectUncaughtError", null);
187
+ QueueSpec = __decorate([
188
+ mocha_typescript_1.suite
189
+ ], QueueSpec);
332
190
  module.exports = new QueueSpec();
333
191
  //# sourceMappingURL=queue.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"queue.spec.js","sourceRoot":"","sources":["../../src/util/queue.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,qDAA6D;AAC7D,2BAA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mBAAmB;;YAClC,MAAM,CAAC,GAAG,GAAS,EAAE;gBACjB,MAAM,IAAI,KAAK,EAAE,CAAC;YACtB,CAAC,CAAA,CAAA;YACD,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAS,EAAE;gBACpC,OAAO,CAAC,EAAE,CAAC;YACf,CAAC,CAAA,CAAC,CAAC;YACH,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;gBACT,IAAA,aAAI,EAAC,0BAA0B,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACb,+CAA+C;YACnD,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ,CAAA;AA9DS;IAAL,uBAAI;;;;kDAKJ;AAEK;IAAL,uBAAI;;;;0DAKJ;AAEgC;IAAhC,uBAAI;IAAE,IAAA,0BAAO,EAAC,IAAI,CAAC;IAAE,IAAA,uBAAI,EAAC,IAAI,CAAC;;;;uDAK/B;AAGK;IAAL,uBAAI;;;;qDAQJ;AAEK;IAAL,uBAAI;;;;+CAeJ;AAEK;IAAL,uBAAI;;;;oDAYJ;AAtHQ,SAAS;IAArB,wBAAK;GAAO,SAAS,CAuHrB;AACD,MAAM,CAAC,OAAO,GAAG,IAAI,SAAS,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
4
  * Licensed under the GNU Affero General Public License (AGPL).
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
@@ -13,105 +13,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  step((generator = generator.apply(thisArg, _arguments || [])).next());
14
14
  });
15
15
  };
16
- var __generator = (this && this.__generator) || function (thisArg, body) {
17
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
18
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
19
- function verb(n) { return function (v) { return step([n, v]); }; }
20
- function step(op) {
21
- if (f) throw new TypeError("Generator is already executing.");
22
- while (_) try {
23
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
24
- if (y = 0, t) op = [op[0] & 2, t.value];
25
- switch (op[0]) {
26
- case 0: case 1: t = op; break;
27
- case 4: _.label++; return { value: op[1], done: false };
28
- case 5: _.label++; y = op[1]; op = [0]; continue;
29
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
30
- default:
31
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
32
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
33
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
34
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
35
- if (t[2]) _.ops.pop();
36
- _.trys.pop(); continue;
37
- }
38
- op = body.call(thisArg, _);
39
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
40
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
41
- }
42
- };
43
16
  Object.defineProperty(exports, "__esModule", { value: true });
44
- var deferred_1 = require("./deferred");
45
- var logging_1 = require("./logging");
17
+ exports.Repeater = void 0;
18
+ const deferred_1 = require("./deferred");
19
+ const logging_1 = require("./logging");
46
20
  /**
47
21
  * Repeats a given function until it is stopped
48
22
  */
49
- var Repeater = /** @class */ (function () {
50
- function Repeater(fn, timeout) {
23
+ class Repeater {
24
+ constructor(fn, timeout) {
51
25
  this.fn = fn;
52
26
  this.timeout = timeout;
53
27
  }
54
- Repeater.prototype.start = function () {
55
- return __awaiter(this, void 0, void 0, function () {
56
- return __generator(this, function (_a) {
57
- this.run();
58
- return [2 /*return*/];
59
- });
28
+ start() {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ this.run();
60
31
  });
61
- };
62
- Repeater.prototype.run = function () {
63
- return __awaiter(this, void 0, void 0, function () {
64
- var err_1;
65
- return __generator(this, function (_a) {
66
- switch (_a.label) {
67
- case 0:
68
- this.shouldRun = true;
69
- this.finished = new deferred_1.Deferred();
70
- _a.label = 1;
71
- case 1:
72
- if (!this.shouldRun) return [3 /*break*/, 7];
73
- _a.label = 2;
74
- case 2:
75
- _a.trys.push([2, 4, , 5]);
76
- return [4 /*yield*/, this.fn()];
77
- case 3:
78
- _a.sent();
79
- return [3 /*break*/, 5];
80
- case 4:
81
- err_1 = _a.sent();
82
- logging_1.log.error(err_1);
83
- return [3 /*break*/, 5];
84
- case 5: return [4 /*yield*/, this.sleep(this.timeout)];
85
- case 6:
86
- _a.sent();
87
- return [3 /*break*/, 1];
88
- case 7:
89
- this.finished.resolve();
90
- return [2 /*return*/];
32
+ }
33
+ run() {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ this.shouldRun = true;
36
+ this.finished = new deferred_1.Deferred();
37
+ while (this.shouldRun) {
38
+ try {
39
+ yield this.fn();
40
+ }
41
+ catch (err) {
42
+ logging_1.log.error(err);
91
43
  }
92
- });
44
+ yield this.sleep(this.timeout);
45
+ }
46
+ this.finished.resolve();
93
47
  });
94
- };
95
- Repeater.prototype.sleep = function (timeout) {
96
- return __awaiter(this, void 0, void 0, function () {
97
- var _this = this;
98
- return __generator(this, function (_a) {
99
- return [2 /*return*/, new Promise(function (resolve) { return _this.timer = setTimeout(resolve, timeout); })];
100
- });
48
+ }
49
+ sleep(timeout) {
50
+ return __awaiter(this, void 0, void 0, function* () {
51
+ return new Promise(resolve => this.timer = setTimeout(resolve, timeout));
101
52
  });
102
- };
103
- Repeater.prototype.stop = function () {
104
- return __awaiter(this, void 0, void 0, function () {
105
- return __generator(this, function (_a) {
106
- this.shouldRun = false;
107
- if (this.timer) {
108
- clearTimeout(this.timer);
109
- }
110
- return [2 /*return*/, this.finished.promise];
111
- });
53
+ }
54
+ stop() {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ this.shouldRun = false;
57
+ if (this.timer) {
58
+ clearTimeout(this.timer);
59
+ }
60
+ return this.finished.promise;
112
61
  });
113
- };
114
- return Repeater;
115
- }());
62
+ }
63
+ }
116
64
  exports.Repeater = Repeater;
117
65
  //# sourceMappingURL=repeater.js.map