@gitpod/gitpod-protocol 0.1.5-wth-update-mysql-dependencies-2.31 → 0.1.5-wth-test.80

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 (295) hide show
  1. package/data/gitpod-schema.json +25 -24
  2. package/lib/accounting-protocol.d.ts +3 -6
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +10 -16
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +26 -4
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +15 -0
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +44 -0
  11. package/lib/analytics.d.ts.map +1 -0
  12. package/lib/analytics.js +10 -0
  13. package/lib/analytics.js.map +1 -0
  14. package/lib/context-url.d.ts +31 -0
  15. package/lib/context-url.d.ts.map +1 -0
  16. package/lib/context-url.js +102 -0
  17. package/lib/context-url.js.map +1 -0
  18. package/lib/context-url.spec.d.ts +14 -0
  19. package/lib/context-url.spec.d.ts.map +1 -0
  20. package/lib/context-url.spec.js +94 -0
  21. package/lib/context-url.spec.js.map +1 -0
  22. package/lib/email-protocol.d.ts +1 -2
  23. package/lib/email-protocol.d.ts.map +1 -1
  24. package/lib/email-protocol.js +4 -4
  25. package/lib/email-protocol.js.map +1 -1
  26. package/lib/encryption/container-module.js +5 -4
  27. package/lib/encryption/container-module.js.map +1 -1
  28. package/lib/encryption/encryption-engine.js +19 -20
  29. package/lib/encryption/encryption-engine.js.map +1 -1
  30. package/lib/encryption/encryption-engine.spec.js +29 -36
  31. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  32. package/lib/encryption/encryption-service.js +29 -43
  33. package/lib/encryption/encryption-service.js.map +1 -1
  34. package/lib/encryption/key-provider.js +25 -30
  35. package/lib/encryption/key-provider.js.map +1 -1
  36. package/lib/env.d.ts +1 -2
  37. package/lib/env.d.ts.map +1 -1
  38. package/lib/env.js +20 -21
  39. package/lib/env.js.map +1 -1
  40. package/lib/gitpod-file-parser.js +25 -41
  41. package/lib/gitpod-file-parser.js.map +1 -1
  42. package/lib/gitpod-file-parser.spec.js +116 -116
  43. package/lib/gitpod-file-parser.spec.js.map +1 -1
  44. package/lib/gitpod-service.d.ts +124 -22
  45. package/lib/gitpod-service.d.ts.map +1 -1
  46. package/lib/gitpod-service.js +169 -278
  47. package/lib/gitpod-service.js.map +1 -1
  48. package/lib/headless-workspace-log.d.ts +8 -11
  49. package/lib/headless-workspace-log.d.ts.map +1 -1
  50. package/lib/headless-workspace-log.js +4 -7
  51. package/lib/headless-workspace-log.js.map +1 -1
  52. package/lib/ide-protocol.d.ts +105 -0
  53. package/lib/ide-protocol.d.ts.map +1 -0
  54. package/lib/ide-protocol.js +8 -0
  55. package/lib/ide-protocol.js.map +1 -0
  56. package/lib/index.d.ts +6 -0
  57. package/lib/index.d.ts.map +1 -1
  58. package/lib/index.js +7 -1
  59. package/lib/index.js.map +1 -1
  60. package/lib/installation-admin-protocol.d.ts +27 -0
  61. package/lib/installation-admin-protocol.d.ts.map +1 -0
  62. package/lib/installation-admin-protocol.js +30 -0
  63. package/lib/installation-admin-protocol.js.map +1 -0
  64. package/lib/messaging/browser/connection.d.ts +5 -3
  65. package/lib/messaging/browser/connection.d.ts.map +1 -1
  66. package/lib/messaging/browser/connection.js +183 -33
  67. package/lib/messaging/browser/connection.js.map +1 -1
  68. package/lib/messaging/browser/window-connection.js +35 -55
  69. package/lib/messaging/browser/window-connection.js.map +1 -1
  70. package/lib/messaging/client-call-metrics.d.ts +35 -0
  71. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  72. package/lib/messaging/client-call-metrics.js +83 -0
  73. package/lib/messaging/client-call-metrics.js.map +1 -0
  74. package/lib/messaging/error.d.ts +3 -1
  75. package/lib/messaging/error.d.ts.map +1 -1
  76. package/lib/messaging/error.js +6 -2
  77. package/lib/messaging/error.js.map +1 -1
  78. package/lib/messaging/handler.d.ts +10 -0
  79. package/lib/messaging/handler.d.ts.map +1 -1
  80. package/lib/messaging/node/connection.d.ts +1 -17
  81. package/lib/messaging/node/connection.d.ts.map +1 -1
  82. package/lib/messaging/node/connection.js +23 -59
  83. package/lib/messaging/node/connection.js.map +1 -1
  84. package/lib/messaging/proxy-factory.d.ts +2 -0
  85. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  86. package/lib/messaging/proxy-factory.js +74 -159
  87. package/lib/messaging/proxy-factory.js.map +1 -1
  88. package/lib/oss-allowlist.d.ts +14 -0
  89. package/lib/oss-allowlist.d.ts.map +1 -0
  90. package/lib/oss-allowlist.js +8 -0
  91. package/lib/oss-allowlist.js.map +1 -0
  92. package/lib/permission.d.ts +8 -1
  93. package/lib/permission.d.ts.map +1 -1
  94. package/lib/permission.js +36 -15
  95. package/lib/permission.js.map +1 -1
  96. package/lib/plans.d.ts +210 -0
  97. package/lib/plans.d.ts.map +1 -0
  98. package/lib/plans.js +570 -0
  99. package/lib/plans.js.map +1 -0
  100. package/lib/protocol.d.ts +121 -54
  101. package/lib/protocol.d.ts.map +1 -1
  102. package/lib/protocol.js +117 -131
  103. package/lib/protocol.js.map +1 -1
  104. package/lib/snapshot-url.d.ts +14 -0
  105. package/lib/snapshot-url.d.ts.map +1 -0
  106. package/lib/snapshot-url.js +26 -0
  107. package/lib/snapshot-url.js.map +1 -0
  108. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  109. package/lib/snapshot-url.spec.d.ts.map +1 -0
  110. package/lib/snapshot-url.spec.js +41 -0
  111. package/lib/snapshot-url.spec.js.map +1 -0
  112. package/lib/team-subscription-protocol.d.ts +4 -4
  113. package/lib/team-subscription-protocol.d.ts.map +1 -1
  114. package/lib/team-subscription-protocol.js +15 -12
  115. package/lib/team-subscription-protocol.js.map +1 -1
  116. package/lib/teams-projects-protocol.d.ts +113 -0
  117. package/lib/teams-projects-protocol.d.ts.map +1 -0
  118. package/lib/teams-projects-protocol.js +30 -0
  119. package/lib/teams-projects-protocol.js.map +1 -0
  120. package/lib/util/analytics.d.ts +8 -0
  121. package/lib/util/analytics.d.ts.map +1 -0
  122. package/lib/util/analytics.js +88 -0
  123. package/lib/util/analytics.js.map +1 -0
  124. package/lib/util/async-iterator.js +55 -133
  125. package/lib/util/async-iterator.js.map +1 -1
  126. package/lib/util/cancelable.js +17 -59
  127. package/lib/util/cancelable.js.map +1 -1
  128. package/lib/util/date-time.js +8 -8
  129. package/lib/util/date-time.js.map +1 -1
  130. package/lib/util/deferred.js +10 -12
  131. package/lib/util/deferred.js.map +1 -1
  132. package/lib/util/disposable.js +26 -39
  133. package/lib/util/disposable.js.map +1 -1
  134. package/lib/util/event.js +58 -74
  135. package/lib/util/event.js.map +1 -1
  136. package/lib/util/garbage-collected-cache.d.ts +1 -0
  137. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  138. package/lib/util/garbage-collected-cache.js +26 -46
  139. package/lib/util/garbage-collected-cache.js.map +1 -1
  140. package/lib/util/generate-workspace-id.d.ts +1 -1
  141. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  142. package/lib/util/generate-workspace-id.js +31 -68
  143. package/lib/util/generate-workspace-id.js.map +1 -1
  144. package/lib/util/generate-workspace-id.spec.js +57 -78
  145. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  146. package/lib/util/gitpod-cookie.d.ts +20 -0
  147. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  148. package/lib/util/gitpod-cookie.js +44 -0
  149. package/lib/util/gitpod-cookie.js.map +1 -0
  150. package/lib/util/gitpod-host-url.d.ts +1 -2
  151. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  152. package/lib/util/gitpod-host-url.js +95 -98
  153. package/lib/util/gitpod-host-url.js.map +1 -1
  154. package/lib/util/gitpod-host-url.spec.d.ts +7 -1
  155. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  156. package/lib/util/gitpod-host-url.spec.js +103 -31
  157. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  158. package/lib/util/grpc.d.ts +15 -0
  159. package/lib/util/grpc.d.ts.map +1 -0
  160. package/lib/util/grpc.js +18 -0
  161. package/lib/util/grpc.js.map +1 -0
  162. package/lib/util/jaeger-client-types.d.ts +68 -0
  163. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  164. package/lib/util/{without.js → jaeger-client-types.js} +1 -1
  165. package/lib/util/jaeger-client-types.js.map +1 -0
  166. package/lib/util/logging.d.ts +49 -33
  167. package/lib/util/logging.d.ts.map +1 -1
  168. package/lib/util/logging.js +107 -110
  169. package/lib/util/logging.js.map +1 -1
  170. package/lib/util/make-link.js +2 -2
  171. package/lib/util/make-link.js.map +1 -1
  172. package/lib/util/parse-workspace-id.d.ts +10 -0
  173. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  174. package/lib/util/parse-workspace-id.js +32 -7
  175. package/lib/util/parse-workspace-id.js.map +1 -1
  176. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  177. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  178. package/lib/util/parse-workspace-id.spec.js +123 -84
  179. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  180. package/lib/util/queue.js +16 -55
  181. package/lib/util/queue.js.map +1 -1
  182. package/lib/util/queue.spec.js +144 -288
  183. package/lib/util/queue.spec.js.map +1 -1
  184. package/lib/util/repeat.d.ts +15 -0
  185. package/lib/util/repeat.d.ts.map +1 -0
  186. package/lib/util/repeat.js +55 -0
  187. package/lib/util/repeat.js.map +1 -0
  188. package/lib/util/semaphore.js +15 -46
  189. package/lib/util/semaphore.js.map +1 -1
  190. package/lib/util/skip-if.js +6 -6
  191. package/lib/util/skip-if.js.map +1 -1
  192. package/lib/util/timeutil.js +28 -16
  193. package/lib/util/timeutil.js.map +1 -1
  194. package/lib/util/timeutil.spec.js +21 -24
  195. package/lib/util/timeutil.spec.js.map +1 -1
  196. package/lib/util/tracing.d.ts +51 -5
  197. package/lib/util/tracing.d.ts.map +1 -1
  198. package/lib/util/tracing.js +197 -62
  199. package/lib/util/tracing.js.map +1 -1
  200. package/lib/util/tracing.spec.d.ts +7 -0
  201. package/lib/util/tracing.spec.d.ts.map +1 -0
  202. package/lib/util/tracing.spec.js +121 -0
  203. package/lib/util/tracing.spec.js.map +1 -0
  204. package/lib/util/workspace-port-authentication.js +3 -2
  205. package/lib/util/workspace-port-authentication.js.map +1 -1
  206. package/lib/workspace-cluster.d.ts +76 -0
  207. package/lib/workspace-cluster.d.ts.map +1 -0
  208. package/lib/workspace-cluster.js +33 -0
  209. package/lib/workspace-cluster.js.map +1 -0
  210. package/lib/workspace-instance.d.ts +24 -2
  211. package/lib/workspace-instance.d.ts.map +1 -1
  212. package/lib/wsready.d.ts +1 -1
  213. package/lib/wsready.js +2 -2
  214. package/package.json +31 -17
  215. package/pkg-yarn.lock +17 -9
  216. package/provenance-bundle.jsonl +2 -0
  217. package/src/accounting-protocol.ts +4 -10
  218. package/src/admin-protocol.ts +47 -5
  219. package/src/analytics.ts +52 -0
  220. package/src/context-url.spec.ts +53 -0
  221. package/src/context-url.ts +107 -0
  222. package/src/email-protocol.ts +2 -3
  223. package/src/env.ts +10 -10
  224. package/src/gitpod-service.ts +181 -44
  225. package/src/headless-workspace-log.ts +7 -11
  226. package/src/ide-frontend-service.ts +1 -1
  227. package/src/ide-protocol.ts +119 -0
  228. package/src/index.ts +7 -1
  229. package/src/installation-admin-protocol.ts +42 -0
  230. package/src/messaging/browser/connection.ts +195 -14
  231. package/src/messaging/client-call-metrics.ts +97 -0
  232. package/src/messaging/error.ts +8 -2
  233. package/src/messaging/handler.ts +12 -0
  234. package/src/messaging/node/connection.ts +21 -68
  235. package/src/messaging/proxy-factory.ts +14 -6
  236. package/src/oss-allowlist.ts +15 -0
  237. package/src/permission.ts +24 -4
  238. package/src/plans.ts +632 -0
  239. package/src/protocol.ts +196 -85
  240. package/src/snapshot-url.spec.ts +25 -0
  241. package/src/snapshot-url.ts +27 -0
  242. package/src/team-subscription-protocol.ts +7 -5
  243. package/src/teams-projects-protocol.ts +147 -0
  244. package/src/util/analytics.ts +105 -0
  245. package/src/util/deferred.ts +1 -1
  246. package/src/util/garbage-collected-cache.ts +9 -3
  247. package/src/util/generate-workspace-id.spec.ts +20 -3
  248. package/src/util/generate-workspace-id.ts +22 -2
  249. package/src/util/gitpod-cookie.ts +39 -0
  250. package/src/util/gitpod-host-url.spec.ts +25 -1
  251. package/src/util/gitpod-host-url.ts +22 -13
  252. package/src/util/grpc.ts +15 -0
  253. package/src/util/jaeger-client-types.ts +102 -0
  254. package/src/util/logging.ts +102 -38
  255. package/src/util/parse-workspace-id.spec.ts +21 -1
  256. package/src/util/parse-workspace-id.ts +32 -6
  257. package/src/util/queue.spec.ts +1 -1
  258. package/src/util/repeat.ts +45 -0
  259. package/src/util/semaphore.ts +2 -2
  260. package/src/util/skip-if.ts +1 -1
  261. package/src/util/timeutil.ts +4 -4
  262. package/src/util/tracing.spec.ts +83 -0
  263. package/src/util/tracing.ts +183 -17
  264. package/src/workspace-cluster.ts +104 -0
  265. package/src/workspace-instance.ts +45 -13
  266. package/src/wsready.ts +2 -2
  267. package/lib/messaging/connection-error-handler.d.ts +0 -27
  268. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  269. package/lib/messaging/connection-error-handler.js +0 -46
  270. package/lib/messaging/connection-error-handler.js.map +0 -1
  271. package/lib/util/context-url.d.ts +0 -13
  272. package/lib/util/context-url.d.ts.map +0 -1
  273. package/lib/util/context-url.js +0 -26
  274. package/lib/util/context-url.js.map +0 -1
  275. package/lib/util/context-url.spec.d.ts +0 -10
  276. package/lib/util/context-url.spec.d.ts.map +0 -1
  277. package/lib/util/context-url.spec.js +0 -52
  278. package/lib/util/context-url.spec.js.map +0 -1
  279. package/lib/util/repeater.d.ts +0 -22
  280. package/lib/util/repeater.d.ts.map +0 -1
  281. package/lib/util/repeater.js +0 -118
  282. package/lib/util/repeater.js.map +0 -1
  283. package/lib/util/safe-promise.d.ts +0 -11
  284. package/lib/util/safe-promise.d.ts.map +0 -1
  285. package/lib/util/safe-promise.js +0 -34
  286. package/lib/util/safe-promise.js.map +0 -1
  287. package/lib/util/without.d.ts +0 -7
  288. package/lib/util/without.d.ts.map +0 -1
  289. package/lib/util/without.js.map +0 -1
  290. package/src/messaging/connection-error-handler.ts +0 -62
  291. package/src/util/context-url.spec.ts +0 -25
  292. package/src/util/context-url.ts +0 -23
  293. package/src/util/jaeger-client.d.ts +0 -105
  294. package/src/util/repeater.ts +0 -49
  295. package/src/util/safe-promise.ts +0 -26
@@ -22,314 +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,
305
- mocha_typescript_1.timeout(3000),
306
- mocha_typescript_1.slow(3000),
307
- __metadata("design:type", Function),
308
- __metadata("design:paramtypes", []),
309
- __metadata("design:returntype", Promise)
310
- ], QueueSpec.prototype, "isExecutedInOrderSleep", null);
311
- __decorate([
312
- mocha_typescript_1.test,
313
- __metadata("design:type", Function),
314
- __metadata("design:paramtypes", []),
315
- __metadata("design:returntype", Promise)
316
- ], QueueSpec.prototype, "continueDespiteError", null);
317
- __decorate([
318
- mocha_typescript_1.test,
319
- __metadata("design:type", Function),
320
- __metadata("design:paramtypes", []),
321
- __metadata("design:returntype", Promise)
322
- ], QueueSpec.prototype, "mustCatchError", null);
323
- __decorate([
324
- mocha_typescript_1.test,
325
- __metadata("design:type", Function),
326
- __metadata("design:paramtypes", []),
327
- __metadata("design:returntype", Promise)
328
- ], QueueSpec.prototype, "expectUncaughtError", null);
329
- QueueSpec = __decorate([
330
- mocha_typescript_1.suite
331
- ], QueueSpec);
332
- return QueueSpec;
333
- }());
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);
334
190
  module.exports = new QueueSpec();
335
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;AAC7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6BAA6B,CAAC,CAAC;aACvC;QACL,CAAC;KAAA;IAEkB,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"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+ import { Disposable } from "..";
7
+ /**
8
+ * This intends to be a drop-in replacement for 'setInterval' implemented with a 'setTimeout' chain
9
+ * to ensure we're not creating more timeouts than we can process.
10
+ * @param op
11
+ * @param everyMilliseconds
12
+ * @returns
13
+ */
14
+ export declare function repeat(op: () => Promise<void> | void, everyMilliseconds: number): Disposable;
15
+ //# sourceMappingURL=repeat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../src/util/repeat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGhC;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,iBAAiB,EAAE,MAAM,GAAG,UAAU,CA4B5F"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
4
+ * Licensed under the GNU Affero General Public License (AGPL).
5
+ * See License-AGPL.txt in the project root for license information.
6
+ */
7
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14
+ });
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.repeat = void 0;
18
+ const __1 = require("..");
19
+ const logging_1 = require("./logging");
20
+ /**
21
+ * This intends to be a drop-in replacement for 'setInterval' implemented with a 'setTimeout' chain
22
+ * to ensure we're not creating more timeouts than we can process.
23
+ * @param op
24
+ * @param everyMilliseconds
25
+ * @returns
26
+ */
27
+ function repeat(op, everyMilliseconds) {
28
+ let timer = undefined;
29
+ let stopped = false;
30
+ const repeated = () => {
31
+ if (stopped) {
32
+ // in case we missed the clearTimeout i 'await'
33
+ return;
34
+ }
35
+ timer = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
36
+ try {
37
+ yield op();
38
+ }
39
+ catch (err) {
40
+ // catch error here to
41
+ logging_1.log.error(err);
42
+ }
43
+ repeated(); // chain ourselves - after the 'await'
44
+ }), everyMilliseconds);
45
+ };
46
+ repeated();
47
+ return __1.Disposable.create(() => {
48
+ stopped = true;
49
+ if (timer) {
50
+ clearTimeout(timer);
51
+ }
52
+ });
53
+ }
54
+ exports.repeat = repeat;
55
+ //# sourceMappingURL=repeat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../src/util/repeat.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,0BAAgC;AAChC,uCAAgC;AAEhC;;;;;;GAMG;AACH,SAAgB,MAAM,CAAC,EAA8B,EAAE,iBAAyB;IAC5E,IAAI,KAAK,GAA+B,SAAS,CAAC;IAClD,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,QAAQ,GAAG,GAAG,EAAE;QAClB,IAAI,OAAO,EAAE;YACT,+CAA+C;YAC/C,OAAO;SACV;QAED,KAAK,GAAG,UAAU,CAAC,GAAS,EAAE;YAC1B,IAAI;gBACA,MAAM,EAAE,EAAE,CAAC;aACd;YAAC,OAAO,GAAG,EAAE;gBACV,sBAAsB;gBACtB,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aAClB;YAED,QAAQ,EAAE,CAAC,CAAC,sCAAsC;QACtD,CAAC,CAAA,EAAE,iBAAiB,CAAC,CAAC;IAC1B,CAAC,CAAC;IACF,QAAQ,EAAE,CAAC;IAEX,OAAO,cAAU,CAAC,MAAM,CAAC,GAAG,EAAE;QAC1B,OAAO,GAAG,IAAI,CAAC;QACf,IAAI,KAAK,EAAE;YACP,YAAY,CAAC,KAAK,CAAC,CAAC;SACvB;IACL,CAAC,CAAC,CAAC;AACP,CAAC;AA5BD,wBA4BC"}