@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
@@ -0,0 +1,63 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.TeamSubscriptionSlot = exports.TeamSubscription = void 0;
9
+ const uuid_1 = require("uuid");
10
+ var TeamSubscription;
11
+ (function (TeamSubscription) {
12
+ TeamSubscription.create = (ts) => {
13
+ const withId = ts;
14
+ withId.id = (0, uuid_1.v4)();
15
+ return withId;
16
+ };
17
+ TeamSubscription.isActive = (ts, date) => {
18
+ return ts.startDate <= date && (ts.endDate === undefined || date < ts.endDate);
19
+ };
20
+ })(TeamSubscription = exports.TeamSubscription || (exports.TeamSubscription = {}));
21
+ var TeamSubscriptionSlot;
22
+ (function (TeamSubscriptionSlot) {
23
+ TeamSubscriptionSlot.create = (ts) => {
24
+ const withId = ts;
25
+ withId.id = (0, uuid_1.v4)();
26
+ return withId;
27
+ };
28
+ TeamSubscriptionSlot.assign = (slot, assigneeId, subscriptionId, assigneeIdentifier) => {
29
+ slot.assigneeId = assigneeId;
30
+ slot.subscriptionId = subscriptionId;
31
+ slot.assigneeIdentifier = assigneeIdentifier;
32
+ };
33
+ TeamSubscriptionSlot.deactivate = (slot, cancellationDate) => {
34
+ slot.subscriptionId = undefined;
35
+ slot.cancellationDate = cancellationDate;
36
+ };
37
+ TeamSubscriptionSlot.reactivate = (slot, subscriptionId) => {
38
+ slot.subscriptionId = subscriptionId;
39
+ slot.cancellationDate = undefined;
40
+ };
41
+ TeamSubscriptionSlot.status = (slot, now) => {
42
+ if (slot.cancellationDate) {
43
+ if (slot.cancellationDate < now) {
44
+ return 'cancelled';
45
+ }
46
+ else {
47
+ return 'deactivated';
48
+ }
49
+ }
50
+ else {
51
+ if (slot.subscriptionId) {
52
+ return 'assigned';
53
+ }
54
+ else {
55
+ return 'unassigned';
56
+ }
57
+ }
58
+ };
59
+ TeamSubscriptionSlot.isActive = (slot) => {
60
+ return !slot.cancellationDate;
61
+ };
62
+ })(TeamSubscriptionSlot = exports.TeamSubscriptionSlot || (exports.TeamSubscriptionSlot = {}));
63
+ //# sourceMappingURL=team-subscription-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team-subscription-protocol.js","sourceRoot":"","sources":["../src/team-subscription-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+BAAoC;AAgBpC,IAAiB,gBAAgB,CAShC;AATD,WAAiB,gBAAgB;IAChB,uBAAM,GAAG,CAAC,EAAgC,EAAoB,EAAE;QACzE,MAAM,MAAM,GAAG,EAAsB,CAAC;QACtC,MAAM,CAAC,EAAE,GAAG,IAAA,SAAM,GAAE,CAAC;QACrB,OAAO,MAAM,CAAC;IAClB,CAAC,CAAA;IACY,yBAAQ,GAAG,CAAC,EAAoB,EAAE,IAAY,EAAW,EAAE;QACpE,OAAO,EAAE,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC;IACnF,CAAC,CAAA;AACL,CAAC,EATgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAShC;AAkBD,IAAiB,oBAAoB,CAsCpC;AAtCD,WAAiB,oBAAoB;IACpB,2BAAM,GAAG,CAAC,EAAoC,EAAwB,EAAE;QACjF,MAAM,MAAM,GAAG,EAA0B,CAAC;QAC1C,MAAM,CAAC,EAAE,GAAG,IAAA,SAAM,GAAE,CAAC;QACrB,OAAO,MAAM,CAAC;IAClB,CAAC,CAAA;IACY,2BAAM,GAAG,CAAC,IAA0B,EAAE,UAAkB,EAAE,cAAsB,EAAE,kBAAsC,EAAE,EAAE;QACrI,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IACjD,CAAC,CAAA;IACY,+BAAU,GAAG,CAAC,IAA0B,EAAE,gBAAwB,EAAE,EAAE;QAC/E,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC7C,CAAC,CAAA;IACY,+BAAU,GAAG,CAAC,IAA0B,EAAE,cAAuB,EAAE,EAAE;QAC9E,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;IACtC,CAAC,CAAA;IACY,2BAAM,GAAG,CAAC,IAA0B,EAAE,GAAW,EAA6B,EAAE;QACzF,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACvB,IAAI,IAAI,CAAC,gBAAgB,GAAG,GAAG,EAAE;gBAC7B,OAAO,WAAW,CAAC;aACtB;iBAAM;gBACH,OAAO,aAAa,CAAC;aACxB;SACJ;aAAM;YACH,IAAI,IAAI,CAAC,cAAc,EAAE;gBACrB,OAAO,UAAU,CAAC;aACrB;iBAAM;gBACH,OAAO,YAAY,CAAC;aACvB;SACJ;IAEL,CAAC,CAAA;IACY,6BAAQ,GAAG,CAAC,IAA0B,EAAW,EAAE;QAC5D,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAClC,CAAC,CAAA;AACL,CAAC,EAtCgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAsCpC"}
@@ -0,0 +1,103 @@
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 { PrebuiltWorkspaceState } from "./protocol";
7
+ export interface ProjectConfig {
8
+ '.gitpod.yml': string;
9
+ }
10
+ export interface Project {
11
+ id: string;
12
+ name: string;
13
+ slug?: string;
14
+ cloneUrl: string;
15
+ teamId?: string;
16
+ userId?: string;
17
+ appInstallationId: string;
18
+ config?: ProjectConfig;
19
+ creationTime: string;
20
+ /** This is a flag that triggers the HARD DELETION of this entity */
21
+ deleted?: boolean;
22
+ markedDeleted?: boolean;
23
+ }
24
+ export declare namespace Project {
25
+ const create: (project: Omit<Project, 'id' | 'creationTime'>) => Project;
26
+ interface Overview {
27
+ branches: BranchDetails[];
28
+ }
29
+ interface BranchDetails {
30
+ name: string;
31
+ url: string;
32
+ isDefault: boolean;
33
+ changeTitle: string;
34
+ changeDate?: string;
35
+ changeAuthor?: string;
36
+ changeAuthorAvatar?: string;
37
+ changePR?: string;
38
+ changeUrl?: string;
39
+ changeHash: string;
40
+ }
41
+ }
42
+ export interface PrebuildWithStatus {
43
+ info: PrebuildInfo;
44
+ status: PrebuiltWorkspaceState;
45
+ error?: string;
46
+ }
47
+ export interface PrebuildInfo {
48
+ id: string;
49
+ buildWorkspaceId: string;
50
+ teamId?: string;
51
+ userId?: string;
52
+ projectId: string;
53
+ projectName: string;
54
+ cloneUrl: string;
55
+ branch: string;
56
+ startedAt: string;
57
+ startedBy: string;
58
+ startedByAvatar?: string;
59
+ changeTitle: string;
60
+ changeDate: string;
61
+ changeAuthor: string;
62
+ changeAuthorAvatar?: string;
63
+ changePR?: string;
64
+ changeUrl?: string;
65
+ changeHash: string;
66
+ }
67
+ export declare namespace PrebuildInfo {
68
+ function is(data?: any): data is PrebuildInfo;
69
+ }
70
+ export interface StartPrebuildResult {
71
+ prebuildId: string;
72
+ wsid: string;
73
+ done: boolean;
74
+ }
75
+ export interface Team {
76
+ id: string;
77
+ name: string;
78
+ slug: string;
79
+ creationTime: string;
80
+ markedDeleted?: boolean;
81
+ /** This is a flag that triggers the HARD DELETION of this entity */
82
+ deleted?: boolean;
83
+ }
84
+ export declare type TeamMemberRole = "owner" | "member";
85
+ export interface TeamMemberInfo {
86
+ userId: string;
87
+ fullName?: string;
88
+ primaryEmail?: string;
89
+ avatarUrl?: string;
90
+ role: TeamMemberRole;
91
+ memberSince: string;
92
+ }
93
+ export interface TeamMembershipInvite {
94
+ id: string;
95
+ teamId: string;
96
+ role: TeamMemberRole;
97
+ creationTime: string;
98
+ invalidationTime: string;
99
+ invitedEmail?: string;
100
+ /** This is a flag that triggers the HARD DELETION of this entity */
101
+ deleted?: boolean;
102
+ }
103
+ //# sourceMappingURL=teams-projects-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teams-projects-protocol.d.ts","sourceRoot":"","sources":["../src/teams-projects-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,MAAM,WAAW,aAAa;IAC1B,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,yBAAiB,OAAO,CAAC;IACd,MAAM,MAAM,YAAa,KAAK,OAAO,EAAE,IAAI,GAAG,cAAc,CAAC,KAAG,OAMtE,CAAA;IAED,UAAiB,QAAQ;QACrB,QAAQ,EAAE,aAAa,EAAE,CAAA;KAC5B;IAED,UAAiB,aAAa;QAC1B,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,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IACb,IAAI,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,IAAI;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,oBAAY,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEhD,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,cAAc,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,oEAAoE;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,23 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.PrebuildInfo = exports.Project = void 0;
9
+ const uuid_1 = require("uuid");
10
+ var Project;
11
+ (function (Project) {
12
+ Project.create = (project) => {
13
+ return Object.assign(Object.assign({}, project), { id: (0, uuid_1.v4)(), creationTime: new Date().toISOString() });
14
+ };
15
+ })(Project = exports.Project || (exports.Project = {}));
16
+ var PrebuildInfo;
17
+ (function (PrebuildInfo) {
18
+ function is(data) {
19
+ return typeof data === "object" && ["id", "buildWorkspaceId", "projectId", "branch"].every(p => p in data);
20
+ }
21
+ PrebuildInfo.is = is;
22
+ })(PrebuildInfo = exports.PrebuildInfo || (exports.PrebuildInfo = {}));
23
+ //# sourceMappingURL=teams-projects-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"teams-projects-protocol.js","sourceRoot":"","sources":["../src/teams-projects-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,+BAAoC;AAqBpC,IAAiB,OAAO,CA2BvB;AA3BD,WAAiB,OAAO;IACP,cAAM,GAAG,CAAC,OAA6C,EAAW,EAAE;QAC7E,uCACO,OAAO,KACV,EAAE,EAAE,IAAA,SAAM,GAAE,EACZ,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,IACxC;IACN,CAAC,CAAA;AAoBL,CAAC,EA3BgB,OAAO,GAAP,eAAO,KAAP,eAAO,QA2BvB;AAiCD,IAAiB,YAAY,CAI5B;AAJD,WAAiB,YAAY;IACzB,SAAgB,EAAE,CAAC,IAAU;QACzB,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;IAC/G,CAAC;IAFe,eAAE,KAEjB,CAAA;AACL,CAAC,EAJgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAI5B"}
@@ -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
  */
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2020 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
+ interface Window {
7
+ gitpod: {
8
+ service: import('../gitpod-service').GitpodService;
9
+ ideService?: import('../ide-frontend-service').IDEFrontendService;
10
+ };
11
+ }
12
+ //# sourceMappingURL=globals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../src/typings/globals.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,UAAU,MAAM;IACZ,MAAM,EAAE;QACJ,OAAO,EAAE,OAAO,mBAAmB,EAAE,aAAa,CAAA;QAClD,UAAU,CAAC,EAAE,OAAO,yBAAyB,EAAE,kBAAkB,CAAA;KACpE,CAAA;CACJ"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2020 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
+ //# sourceMappingURL=globals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.js","sourceRoot":"","sources":["../../src/typings/globals.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -0,0 +1,8 @@
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 { IAnalyticsWriter } from "../analytics";
7
+ export declare function newAnalyticsWriterFromEnv(): IAnalyticsWriter;
8
+ //# sourceMappingURL=analytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/util/analytics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAA8C,MAAM,cAAc,CAAC;AAI5F,wBAAgB,yBAAyB,IAAI,gBAAgB,CAS5D"}
@@ -0,0 +1,79 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.newAnalyticsWriterFromEnv = void 0;
9
+ const Analytics = require("analytics-node");
10
+ const logging_1 = require("./logging");
11
+ function newAnalyticsWriterFromEnv() {
12
+ switch (process.env.GITPOD_ANALYTICS_WRITER) {
13
+ case "segment":
14
+ return new SegmentAnalyticsWriter(process.env.GITPOD_ANALYTICS_SEGMENT_KEY || "");
15
+ case "log":
16
+ return new LogAnalyticsWriter();
17
+ default:
18
+ return new NoAnalyticsWriter();
19
+ }
20
+ }
21
+ exports.newAnalyticsWriterFromEnv = newAnalyticsWriterFromEnv;
22
+ class SegmentAnalyticsWriter {
23
+ constructor(writeKey) {
24
+ this.analytics = new Analytics(writeKey);
25
+ }
26
+ identify(msg) {
27
+ try {
28
+ this.analytics.identify(msg, (err) => {
29
+ if (err) {
30
+ logging_1.log.warn("analytics.identify failed", err);
31
+ }
32
+ });
33
+ }
34
+ catch (err) {
35
+ logging_1.log.warn("analytics.identify failed", err);
36
+ }
37
+ }
38
+ track(msg) {
39
+ try {
40
+ this.analytics.track(msg, (err) => {
41
+ if (err) {
42
+ logging_1.log.warn("analytics.track failed", err);
43
+ }
44
+ });
45
+ }
46
+ catch (err) {
47
+ logging_1.log.warn("analytics.track failed", err);
48
+ }
49
+ }
50
+ page(msg) {
51
+ try {
52
+ this.analytics.page(msg, (err) => {
53
+ if (err) {
54
+ logging_1.log.warn("analytics.page failed", err);
55
+ }
56
+ });
57
+ }
58
+ catch (err) {
59
+ logging_1.log.warn("analytics.page failed", err);
60
+ }
61
+ }
62
+ }
63
+ class LogAnalyticsWriter {
64
+ identify(msg) {
65
+ logging_1.log.debug("analytics identify", msg);
66
+ }
67
+ track(msg) {
68
+ logging_1.log.debug("analytics track", msg);
69
+ }
70
+ page(msg) {
71
+ logging_1.log.debug("analytics page", msg);
72
+ }
73
+ }
74
+ class NoAnalyticsWriter {
75
+ identify(msg) { }
76
+ track(msg) { }
77
+ page(msg) { }
78
+ }
79
+ //# sourceMappingURL=analytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/util/analytics.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,4CAA6C;AAE7C,uCAAgC;AAGhC,SAAgB,yBAAyB;IACrC,QAAQ,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;QACzC,KAAK,SAAS;YACV,OAAO,IAAI,sBAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAC;QACtF,KAAK,KAAK;YACN,OAAO,IAAI,kBAAkB,EAAE,CAAC;QACpC;YACI,OAAO,IAAI,iBAAiB,EAAE,CAAC;KACtC;AACL,CAAC;AATD,8DASC;AAED,MAAM,sBAAsB;IAIxB,YAAY,QAAgB;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAEG,QAAQ,CAAC,GAAoB;QAC7B,IAAI;YACA,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAU,EAAE,EAAE;gBACxC,IAAI,GAAG,EAAE;oBACL,aAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;iBAC9C;YACL,CAAC,CAAC,CAAC;SACN;QAAC,OAAO,GAAG,EAAE;YACV,aAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;SAC9C;IACL,CAAC;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yright (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,33 +13,6 @@ 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
  var __asyncValues = (this && this.__asyncValues) || function (o) {
44
17
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
45
18
  var m = o[Symbol.asyncIterator], i;
@@ -48,6 +21,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
48
21
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
49
22
  };
50
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.AsyncCachingIteratorImpl = exports.filter = exports.find = void 0;
51
25
  // Use asyncIterators with es2015
52
26
  if (typeof Symbol.asyncIterator === 'undefined') {
53
27
  Symbol.asyncIterator = Symbol.asyncIterator || Symbol('asyncIterator');
@@ -55,131 +29,80 @@ if (typeof Symbol.asyncIterator === 'undefined') {
55
29
  function find(it, predicate) {
56
30
  var it_1, it_1_1;
57
31
  var e_1, _a;
58
- return __awaiter(this, void 0, void 0, function () {
59
- var t, e_1_1;
60
- return __generator(this, function (_b) {
61
- switch (_b.label) {
62
- case 0:
63
- _b.trys.push([0, 5, 6, 11]);
64
- it_1 = __asyncValues(it);
65
- _b.label = 1;
66
- case 1: return [4 /*yield*/, it_1.next()];
67
- case 2:
68
- if (!(it_1_1 = _b.sent(), !it_1_1.done)) return [3 /*break*/, 4];
69
- t = it_1_1.value;
70
- if (predicate(t)) {
71
- return [2 /*return*/, t];
72
- }
73
- _b.label = 3;
74
- case 3: return [3 /*break*/, 1];
75
- case 4: return [3 /*break*/, 11];
76
- case 5:
77
- e_1_1 = _b.sent();
78
- e_1 = { error: e_1_1 };
79
- return [3 /*break*/, 11];
80
- case 6:
81
- _b.trys.push([6, , 9, 10]);
82
- if (!(it_1_1 && !it_1_1.done && (_a = it_1.return))) return [3 /*break*/, 8];
83
- return [4 /*yield*/, _a.call(it_1)];
84
- case 7:
85
- _b.sent();
86
- _b.label = 8;
87
- case 8: return [3 /*break*/, 10];
88
- case 9:
89
- if (e_1) throw e_1.error;
90
- return [7 /*endfinally*/];
91
- case 10: return [7 /*endfinally*/];
92
- case 11: return [2 /*return*/, undefined];
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ try {
34
+ for (it_1 = __asyncValues(it); it_1_1 = yield it_1.next(), !it_1_1.done;) {
35
+ const t = it_1_1.value;
36
+ if (predicate(t)) {
37
+ return t;
38
+ }
93
39
  }
94
- });
40
+ }
41
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
42
+ finally {
43
+ try {
44
+ if (it_1_1 && !it_1_1.done && (_a = it_1.return)) yield _a.call(it_1);
45
+ }
46
+ finally { if (e_1) throw e_1.error; }
47
+ }
48
+ return undefined;
95
49
  });
96
50
  }
97
51
  exports.find = find;
98
52
  function filter(it, predicate) {
99
53
  var it_2, it_2_1;
100
54
  var e_2, _a;
101
- return __awaiter(this, void 0, void 0, function () {
102
- var result, t, e_2_1;
103
- return __generator(this, function (_b) {
104
- switch (_b.label) {
105
- case 0:
106
- result = [];
107
- _b.label = 1;
108
- case 1:
109
- _b.trys.push([1, 6, 7, 12]);
110
- it_2 = __asyncValues(it);
111
- _b.label = 2;
112
- case 2: return [4 /*yield*/, it_2.next()];
113
- case 3:
114
- if (!(it_2_1 = _b.sent(), !it_2_1.done)) return [3 /*break*/, 5];
115
- t = it_2_1.value;
116
- if (predicate(t)) {
117
- result.push(t);
118
- }
119
- _b.label = 4;
120
- case 4: return [3 /*break*/, 2];
121
- case 5: return [3 /*break*/, 12];
122
- case 6:
123
- e_2_1 = _b.sent();
124
- e_2 = { error: e_2_1 };
125
- return [3 /*break*/, 12];
126
- case 7:
127
- _b.trys.push([7, , 10, 11]);
128
- if (!(it_2_1 && !it_2_1.done && (_a = it_2.return))) return [3 /*break*/, 9];
129
- return [4 /*yield*/, _a.call(it_2)];
130
- case 8:
131
- _b.sent();
132
- _b.label = 9;
133
- case 9: return [3 /*break*/, 11];
134
- case 10:
135
- if (e_2) throw e_2.error;
136
- return [7 /*endfinally*/];
137
- case 11: return [7 /*endfinally*/];
138
- case 12: return [2 /*return*/, result];
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const result = [];
57
+ try {
58
+ for (it_2 = __asyncValues(it); it_2_1 = yield it_2.next(), !it_2_1.done;) {
59
+ const t = it_2_1.value;
60
+ if (predicate(t)) {
61
+ result.push(t);
62
+ }
139
63
  }
140
- });
64
+ }
65
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
66
+ finally {
67
+ try {
68
+ if (it_2_1 && !it_2_1.done && (_a = it_2.return)) yield _a.call(it_2);
69
+ }
70
+ finally { if (e_2) throw e_2.error; }
71
+ }
72
+ return result;
141
73
  });
142
74
  }
143
75
  exports.filter = filter;
144
- var AsyncCachingIteratorImpl = /** @class */ (function () {
145
- function AsyncCachingIteratorImpl(iterable) {
76
+ class AsyncCachingIteratorImpl {
77
+ constructor(iterable) {
146
78
  this.iterable = iterable;
147
79
  this.cache = [];
148
80
  this.cursor = 0;
149
81
  this.cacheRead = false;
150
82
  }
151
- AsyncCachingIteratorImpl.prototype.resetCursor = function () {
83
+ resetCursor() {
152
84
  this.cursor = 0;
153
85
  this.cacheRead = false;
154
- };
155
- AsyncCachingIteratorImpl.prototype.next = function (value) {
156
- return __awaiter(this, void 0, void 0, function () {
157
- var result;
158
- return __generator(this, function (_a) {
159
- switch (_a.label) {
160
- case 0:
161
- if (!this.cacheRead && this.cursor < this.cache.length) {
162
- return [2 /*return*/, {
163
- done: false,
164
- value: this.cache[this.cursor++]
165
- }];
166
- }
167
- this.cacheRead = true;
168
- return [4 /*yield*/, this.iterable.next(value)];
169
- case 1:
170
- result = _a.sent();
171
- if (!result.done) {
172
- this.cache.push(result.value);
173
- }
174
- return [2 /*return*/, result];
175
- }
176
- });
86
+ }
87
+ next(value) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ if (!this.cacheRead && this.cursor < this.cache.length) {
90
+ return {
91
+ done: false,
92
+ value: this.cache[this.cursor++]
93
+ };
94
+ }
95
+ this.cacheRead = true;
96
+ const result = yield this.iterable.next(value);
97
+ if (!result.done) {
98
+ this.cache.push(result.value);
99
+ }
100
+ return result;
177
101
  });
178
- };
179
- AsyncCachingIteratorImpl.prototype[Symbol.asyncIterator] = function () {
102
+ }
103
+ [Symbol.asyncIterator]() {
180
104
  return this;
181
- };
182
- return AsyncCachingIteratorImpl;
183
- }());
105
+ }
106
+ }
184
107
  exports.AsyncCachingIteratorImpl = AsyncCachingIteratorImpl;
185
108
  //# sourceMappingURL=async-iterator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"async-iterator.js","sourceRoot":"","sources":["../../src/util/async-iterator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iCAAiC;AACjC,IAAI,OAAQ,MAAc,CAAC,aAAa,KAAK,WAAW,EAAE;IACrD,MAAc,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;CACnF;AAED,SAAsB,IAAI,CAAI,EAA4B,EAAE,SAAgC;;;;;;;;;oBAClE,OAAA,cAAA,EAAE,CAAA;;;;;oBAAP,CAAC,eAAA,CAAA;oBACd,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE;wBACd,sBAAO,CAAC,EAAC;qBACZ;;;;;;;;;;;;;;;;;;;;yBAEL,sBAAO,SAAS,EAAC;;;;CACpB;AAPD,oBAOC;AACD,SAAsB,MAAM,CAAI,EAA4B,EAAE,SAAgC;;;;;;;;oBACpF,MAAM,GAAG,EAAE,CAAC;;;;oBACI,OAAA,cAAA,EAAE,CAAA;;;;;oBAAP,CAAC,eAAA,CAAA;oBACd,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE;w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M,EAAE,CAAC;iBACnC,CAAC;aACL;YACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YAEtB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aACjC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;KAAA;IAED,CAAC,MAAM,CAAC,aAAa,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAhCD,4DAgCC"}
@@ -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
  */