@gitpod/gitpod-protocol 0.1.5-vn-integrate-gitpod-yml-tasks-into-jetbrainsa.5 → 0.1.5-vn-6525.77

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 (267) hide show
  1. package/data/gitpod-schema.json +28 -2
  2. package/lib/accounting-protocol.d.ts +10 -10
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +22 -31
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +4 -2
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js.map +1 -1
  9. package/lib/analytics.d.ts +4 -5
  10. package/lib/analytics.d.ts.map +1 -1
  11. package/lib/analytics.js.map +1 -1
  12. package/lib/auth.d.ts.map +1 -1
  13. package/lib/context-url.d.ts.map +1 -1
  14. package/lib/context-url.js +3 -3
  15. package/lib/context-url.js.map +1 -1
  16. package/lib/context-url.spec.d.ts.map +1 -1
  17. package/lib/context-url.spec.js +20 -5
  18. package/lib/context-url.spec.js.map +1 -1
  19. package/lib/email-protocol.d.ts +1 -1
  20. package/lib/email-protocol.d.ts.map +1 -1
  21. package/lib/email-protocol.js.map +1 -1
  22. package/lib/encryption/container-module.d.ts.map +1 -1
  23. package/lib/encryption/container-module.js +1 -1
  24. package/lib/encryption/container-module.js.map +1 -1
  25. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  26. package/lib/encryption/encryption-engine.js +7 -7
  27. package/lib/encryption/encryption-engine.js.map +1 -1
  28. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  29. package/lib/encryption/encryption-engine.spec.js +2 -3
  30. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  31. package/lib/encryption/encryption-service.d.ts.map +1 -1
  32. package/lib/encryption/encryption-service.js +1 -1
  33. package/lib/encryption/encryption-service.js.map +1 -1
  34. package/lib/encryption/key-provider.d.ts.map +1 -1
  35. package/lib/encryption/key-provider.js +7 -9
  36. package/lib/encryption/key-provider.js.map +1 -1
  37. package/lib/env.d.ts +1 -1
  38. package/lib/env.d.ts.map +1 -1
  39. package/lib/env.js +5 -5
  40. package/lib/env.js.map +1 -1
  41. package/lib/gitpod-file-parser.d.ts.map +1 -1
  42. package/lib/gitpod-file-parser.js +6 -6
  43. package/lib/gitpod-file-parser.js.map +1 -1
  44. package/lib/gitpod-file-parser.spec.js +42 -39
  45. package/lib/gitpod-file-parser.spec.js.map +1 -1
  46. package/lib/gitpod-service.d.ts +23 -26
  47. package/lib/gitpod-service.d.ts.map +1 -1
  48. package/lib/gitpod-service.js +32 -26
  49. package/lib/gitpod-service.js.map +1 -1
  50. package/lib/headless-workspace-log.d.ts +1 -0
  51. package/lib/headless-workspace-log.d.ts.map +1 -1
  52. package/lib/headless-workspace-log.js +2 -1
  53. package/lib/headless-workspace-log.js.map +1 -1
  54. package/lib/ide-frontend-service.d.ts +1 -1
  55. package/lib/ide-protocol.d.ts +6 -6
  56. package/lib/ide-protocol.d.ts.map +1 -1
  57. package/lib/index.d.ts +16 -16
  58. package/lib/installation-admin-protocol.d.ts +1 -1
  59. package/lib/installation-admin-protocol.d.ts.map +1 -1
  60. package/lib/installation-admin-protocol.js +2 -2
  61. package/lib/installation-admin-protocol.js.map +1 -1
  62. package/lib/license-protocol.d.ts.map +1 -1
  63. package/lib/license-protocol.js.map +1 -1
  64. package/lib/messaging/browser/connection.d.ts +1 -1
  65. package/lib/messaging/browser/connection.d.ts.map +1 -1
  66. package/lib/messaging/browser/connection.js +19 -19
  67. package/lib/messaging/browser/connection.js.map +1 -1
  68. package/lib/messaging/browser/window-connection.d.ts +4 -4
  69. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  70. package/lib/messaging/browser/window-connection.js +9 -6
  71. package/lib/messaging/browser/window-connection.js.map +1 -1
  72. package/lib/messaging/client-call-metrics.d.ts +2 -2
  73. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  74. package/lib/messaging/client-call-metrics.js +20 -20
  75. package/lib/messaging/client-call-metrics.js.map +1 -1
  76. package/lib/messaging/error.d.ts.map +1 -1
  77. package/lib/messaging/error.js.map +1 -1
  78. package/lib/messaging/handler.d.ts.map +1 -1
  79. package/lib/messaging/handler.js +1 -1
  80. package/lib/messaging/node/connection.js +8 -8
  81. package/lib/messaging/node/connection.js.map +1 -1
  82. package/lib/messaging/proxy-factory.d.ts +1 -1
  83. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  84. package/lib/messaging/proxy-factory.js +7 -9
  85. package/lib/messaging/proxy-factory.js.map +1 -1
  86. package/lib/payment-protocol.d.ts.map +1 -1
  87. package/lib/payment-protocol.js +1 -1
  88. package/lib/payment-protocol.js.map +1 -1
  89. package/lib/permission.d.ts +2 -2
  90. package/lib/permission.d.ts.map +1 -1
  91. package/lib/permission.js +12 -23
  92. package/lib/permission.js.map +1 -1
  93. package/lib/plans.d.ts +3 -3
  94. package/lib/plans.d.ts.map +1 -1
  95. package/lib/plans.js +206 -171
  96. package/lib/plans.js.map +1 -1
  97. package/lib/protocol.d.ts +53 -37
  98. package/lib/protocol.d.ts.map +1 -1
  99. package/lib/protocol.js +85 -86
  100. package/lib/protocol.js.map +1 -1
  101. package/lib/snapshot-url.spec.js.map +1 -1
  102. package/lib/team-subscription-protocol.d.ts +5 -3
  103. package/lib/team-subscription-protocol.d.ts.map +1 -1
  104. package/lib/team-subscription-protocol.js +4 -4
  105. package/lib/team-subscription-protocol.js.map +1 -1
  106. package/lib/teams-projects-protocol.d.ts +3 -3
  107. package/lib/teams-projects-protocol.d.ts.map +1 -1
  108. package/lib/teams-projects-protocol.js +1 -1
  109. package/lib/teams-projects-protocol.js.map +1 -1
  110. package/lib/typings/globals.d.ts +2 -2
  111. package/lib/typings/globals.d.ts.map +1 -1
  112. package/lib/util/analytics.d.ts.map +1 -1
  113. package/lib/util/analytics.js +12 -3
  114. package/lib/util/analytics.js.map +1 -1
  115. package/lib/util/async-iterator.d.ts.map +1 -1
  116. package/lib/util/async-iterator.js +3 -3
  117. package/lib/util/async-iterator.js.map +1 -1
  118. package/lib/util/cancelable.js.map +1 -1
  119. package/lib/util/date-time.js +6 -6
  120. package/lib/util/date-time.js.map +1 -1
  121. package/lib/util/deferred.js.map +1 -1
  122. package/lib/util/disposable.d.ts.map +1 -1
  123. package/lib/util/disposable.js +2 -2
  124. package/lib/util/disposable.js.map +1 -1
  125. package/lib/util/event.d.ts.map +1 -1
  126. package/lib/util/event.js +5 -3
  127. package/lib/util/event.js.map +1 -1
  128. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  129. package/lib/util/garbage-collected-cache.js +1 -1
  130. package/lib/util/garbage-collected-cache.js.map +1 -1
  131. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  132. package/lib/util/generate-workspace-id.js +435 -435
  133. package/lib/util/generate-workspace-id.js.map +1 -1
  134. package/lib/util/generate-workspace-id.spec.js +10 -6
  135. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  136. package/lib/util/gitpod-cookie.d.ts +1 -1
  137. package/lib/util/gitpod-cookie.d.ts.map +1 -1
  138. package/lib/util/gitpod-cookie.js +0 -3
  139. package/lib/util/gitpod-cookie.js.map +1 -1
  140. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  141. package/lib/util/gitpod-host-url.js +31 -29
  142. package/lib/util/gitpod-host-url.js.map +1 -1
  143. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  144. package/lib/util/gitpod-host-url.spec.js +15 -5
  145. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  146. package/lib/util/grpc.d.ts.map +1 -1
  147. package/lib/util/grpc.js.map +1 -1
  148. package/lib/util/jaeger-client-types.d.ts.map +1 -1
  149. package/lib/util/logging.d.ts +1 -1
  150. package/lib/util/logging.d.ts.map +1 -1
  151. package/lib/util/logging.js +22 -23
  152. package/lib/util/logging.js.map +1 -1
  153. package/lib/util/make-link.js +5 -5
  154. package/lib/util/make-link.js.map +1 -1
  155. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  156. package/lib/util/parse-workspace-id.js +1 -2
  157. package/lib/util/parse-workspace-id.js.map +1 -1
  158. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  159. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  160. package/lib/util/queue.spec.js +9 -6
  161. package/lib/util/queue.spec.js.map +1 -1
  162. package/lib/util/semaphore.d.ts.map +1 -1
  163. package/lib/util/semaphore.js.map +1 -1
  164. package/lib/util/skip-if.d.ts.map +1 -1
  165. package/lib/util/skip-if.js.map +1 -1
  166. package/lib/util/timeutil.d.ts.map +1 -1
  167. package/lib/util/timeutil.js +2 -2
  168. package/lib/util/timeutil.js.map +1 -1
  169. package/lib/util/timeutil.spec.d.ts.map +1 -1
  170. package/lib/util/timeutil.spec.js.map +1 -1
  171. package/lib/util/tracing.d.ts +6 -6
  172. package/lib/util/tracing.d.ts.map +1 -1
  173. package/lib/util/tracing.js +6 -6
  174. package/lib/util/tracing.js.map +1 -1
  175. package/lib/util/tracing.spec.js +3 -3
  176. package/lib/util/tracing.spec.js.map +1 -1
  177. package/lib/util/workspace-port-authentication.d.ts +7 -7
  178. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  179. package/lib/util/workspace-port-authentication.js +8 -11
  180. package/lib/util/workspace-port-authentication.js.map +1 -1
  181. package/lib/workspace-cluster.d.ts +1 -1
  182. package/lib/workspace-cluster.d.ts.map +1 -1
  183. package/lib/workspace-cluster.js +2 -4
  184. package/lib/workspace-cluster.js.map +1 -1
  185. package/lib/workspace-instance.d.ts +2 -2
  186. package/lib/workspace-instance.d.ts.map +1 -1
  187. package/lib/wsready.d.ts +1 -1
  188. package/lib/wsready.d.ts.map +1 -1
  189. package/lib/wsready.js +2 -2
  190. package/package.json +2 -2
  191. package/pkg-yarn.lock +2 -2
  192. package/provenance-bundle.jsonl +1 -1
  193. package/src/accounting-protocol.ts +53 -51
  194. package/src/admin-protocol.ts +25 -21
  195. package/src/analytics.ts +26 -28
  196. package/src/auth.ts +2 -2
  197. package/src/context-url.spec.ts +25 -11
  198. package/src/context-url.ts +80 -78
  199. package/src/email-protocol.ts +5 -6
  200. package/src/encryption/container-module.ts +2 -3
  201. package/src/encryption/encryption-engine.spec.ts +9 -8
  202. package/src/encryption/encryption-engine.ts +14 -14
  203. package/src/encryption/encryption-service.ts +4 -5
  204. package/src/encryption/key-provider.ts +16 -19
  205. package/src/env.ts +9 -9
  206. package/src/gitpod-file-parser.spec.ts +55 -61
  207. package/src/gitpod-file-parser.ts +16 -17
  208. package/src/gitpod-service.ts +130 -104
  209. package/src/headless-workspace-log.ts +6 -4
  210. package/src/ide-frontend-service.ts +2 -2
  211. package/src/ide-protocol.ts +8 -8
  212. package/src/index.ts +16 -16
  213. package/src/installation-admin-protocol.ts +9 -9
  214. package/src/license-protocol.ts +5 -6
  215. package/src/messaging/browser/connection.ts +45 -47
  216. package/src/messaging/browser/window-connection.ts +39 -29
  217. package/src/messaging/client-call-metrics.ts +70 -71
  218. package/src/messaging/error.ts +1 -3
  219. package/src/messaging/handler.ts +6 -6
  220. package/src/messaging/node/connection.ts +8 -8
  221. package/src/messaging/proxy-factory.ts +23 -30
  222. package/src/oss-allowlist.ts +3 -3
  223. package/src/payment-protocol.ts +2 -2
  224. package/src/permission.ts +20 -31
  225. package/src/plans.ts +236 -189
  226. package/src/protocol.ts +239 -239
  227. package/src/snapshot-url.spec.ts +9 -7
  228. package/src/team-subscription-protocol.ts +33 -23
  229. package/src/teams-projects-protocol.ts +8 -8
  230. package/src/typings/globals.ts +4 -4
  231. package/src/util/analytics.ts +46 -24
  232. package/src/util/async-iterator.ts +4 -5
  233. package/src/util/cancelable.ts +3 -3
  234. package/src/util/date-time.ts +8 -8
  235. package/src/util/deferred.ts +6 -6
  236. package/src/util/disposable.ts +3 -6
  237. package/src/util/event.ts +9 -11
  238. package/src/util/garbage-collected-cache.ts +3 -6
  239. package/src/util/generate-workspace-id.spec.ts +18 -15
  240. package/src/util/generate-workspace-id.ts +453 -453
  241. package/src/util/gitpod-cookie.ts +8 -9
  242. package/src/util/gitpod-host-url.spec.ts +40 -13
  243. package/src/util/gitpod-host-url.ts +37 -34
  244. package/src/util/grpc.ts +1 -1
  245. package/src/util/jaeger-client-types.ts +2 -2
  246. package/src/util/logging.ts +49 -39
  247. package/src/util/make-link.ts +6 -7
  248. package/src/util/parse-workspace-id.spec.ts +17 -8
  249. package/src/util/parse-workspace-id.ts +5 -6
  250. package/src/util/queue.spec.ts +27 -25
  251. package/src/util/repeat.ts +1 -1
  252. package/src/util/semaphore.ts +4 -6
  253. package/src/util/skip-if.ts +9 -6
  254. package/src/util/timeutil.spec.ts +14 -15
  255. package/src/util/timeutil.ts +15 -11
  256. package/src/util/tracing.spec.ts +28 -23
  257. package/src/util/tracing.ts +46 -41
  258. package/src/util/workspace-port-authentication.ts +10 -13
  259. package/src/workspace-cluster.ts +15 -12
  260. package/src/workspace-instance.ts +27 -23
  261. package/src/wsready.ts +3 -3
  262. package/data/builtin-theia-plugins.json +0 -372
  263. package/lib/theia-plugins.d.ts +0 -11
  264. package/lib/theia-plugins.d.ts.map +0 -1
  265. package/lib/theia-plugins.js +0 -8
  266. package/lib/theia-plugins.js.map +0 -1
  267. package/src/theia-plugins.ts +0 -11
@@ -4,16 +4,18 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import { suite, test } from "mocha-typescript"
8
- import * as chai from "chai"
7
+ import { suite, test } from "mocha-typescript";
8
+ import * as chai from "chai";
9
9
  import { SnapshotUrl } from ".";
10
10
 
11
- const expect = chai.expect
12
-
13
- @suite class TestSnapshotUrlParser {
11
+ const expect = chai.expect;
14
12
 
13
+ @suite
14
+ class TestSnapshotUrlParser {
15
15
  @test public testPositive() {
16
- const actual = SnapshotUrl.parse("workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar@gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd");
16
+ const actual = SnapshotUrl.parse(
17
+ "workspaces/c362d434-6faa-4ce0-9ad4-91b4a87c4abe/3f0556f7-4afa-11e9-98d5-52f8983b9279.tar@gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
18
+ );
17
19
 
18
20
  expect(actual).to.deep.equal(<SnapshotUrl>{
19
21
  bucketId: "gitpod-prodcopy-user-e1e28f18-0354-4a5d-b6b4-8879a2ff73fd",
@@ -22,4 +24,4 @@ const expect = chai.expect
22
24
  });
23
25
  }
24
26
  }
25
- module.exports = new TestSnapshotUrlParser() // Only to circumvent no usage warning :-/
27
+ module.exports = new TestSnapshotUrlParser(); // Only to circumvent no usage warning :-/
@@ -4,7 +4,7 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import { v4 as uuidv4 } from 'uuid';
7
+ import { v4 as uuidv4 } from "uuid";
8
8
  import { Subscription } from "./accounting-protocol";
9
9
 
10
10
  export interface TeamSubscription {
@@ -18,17 +18,19 @@ export interface TeamSubscription {
18
18
  paymentReference: string;
19
19
  cancellationDate?: string;
20
20
  deleted?: boolean;
21
+ /** If this flag is set slots are not eligibile for clusters with "more-resources" - even if their plan might be */
22
+ excludeFromMoreResources: boolean;
21
23
  }
22
24
 
23
25
  export namespace TeamSubscription {
24
- export const create = (ts: Omit<TeamSubscription, 'id'>): TeamSubscription => {
26
+ export const create = (ts: Omit<TeamSubscription, "id">): TeamSubscription => {
25
27
  const withId = ts as TeamSubscription;
26
28
  withId.id = uuidv4();
27
29
  return withId;
28
- }
30
+ };
29
31
  export const isActive = (ts: TeamSubscription, date: string): boolean => {
30
32
  return ts.startDate <= date && (ts.endDate === undefined || date < ts.endDate);
31
- }
33
+ };
32
34
  }
33
35
 
34
36
  /**
@@ -42,49 +44,57 @@ export interface TeamSubscriptionSlot {
42
44
  subscriptionId?: string;
43
45
  cancellationDate?: string;
44
46
  }
45
- export type TeamSubscriptionSlotDeactivated = TeamSubscriptionSlot & { assigneeId: string, assigneeIdentifier: AssigneeIdentifier };
46
- export type TeamSubscriptionSlotAssigned = TeamSubscriptionSlot & TeamSubscriptionSlotDeactivated & { subscriptionId: string };
47
+ export type TeamSubscriptionSlotDeactivated = TeamSubscriptionSlot & {
48
+ assigneeId: string;
49
+ assigneeIdentifier: AssigneeIdentifier;
50
+ };
51
+ export type TeamSubscriptionSlotAssigned = TeamSubscriptionSlot &
52
+ TeamSubscriptionSlotDeactivated & { subscriptionId: string };
47
53
 
48
- export type TeamSubscriptionSlotState = 'unassigned' | 'assigned' | 'deactivated' | 'cancelled';
54
+ export type TeamSubscriptionSlotState = "unassigned" | "assigned" | "deactivated" | "cancelled";
49
55
 
50
56
  export namespace TeamSubscriptionSlot {
51
- export const create = (ts: Omit<TeamSubscriptionSlot, 'id'>): TeamSubscriptionSlot => {
57
+ export const create = (ts: Omit<TeamSubscriptionSlot, "id">): TeamSubscriptionSlot => {
52
58
  const withId = ts as TeamSubscriptionSlot;
53
59
  withId.id = uuidv4();
54
60
  return withId;
55
- }
56
- export const assign = (slot: TeamSubscriptionSlot, assigneeId: string, subscriptionId: string, assigneeIdentifier: AssigneeIdentifier) => {
61
+ };
62
+ export const assign = (
63
+ slot: TeamSubscriptionSlot,
64
+ assigneeId: string,
65
+ subscriptionId: string,
66
+ assigneeIdentifier: AssigneeIdentifier,
67
+ ) => {
57
68
  slot.assigneeId = assigneeId;
58
69
  slot.subscriptionId = subscriptionId;
59
70
  slot.assigneeIdentifier = assigneeIdentifier;
60
- }
71
+ };
61
72
  export const deactivate = (slot: TeamSubscriptionSlot, cancellationDate: string) => {
62
73
  slot.subscriptionId = undefined;
63
74
  slot.cancellationDate = cancellationDate;
64
- }
75
+ };
65
76
  export const reactivate = (slot: TeamSubscriptionSlot, subscriptionId?: string) => {
66
77
  slot.subscriptionId = subscriptionId;
67
78
  slot.cancellationDate = undefined;
68
- }
79
+ };
69
80
  export const status = (slot: TeamSubscriptionSlot, now: string): TeamSubscriptionSlotState => {
70
81
  if (slot.cancellationDate) {
71
82
  if (slot.cancellationDate < now) {
72
- return 'cancelled';
83
+ return "cancelled";
73
84
  } else {
74
- return 'deactivated';
85
+ return "deactivated";
75
86
  }
76
87
  } else {
77
88
  if (slot.subscriptionId) {
78
- return 'assigned';
89
+ return "assigned";
79
90
  } else {
80
- return 'unassigned';
91
+ return "unassigned";
81
92
  }
82
93
  }
83
-
84
- }
94
+ };
85
95
  export const isActive = (slot: TeamSubscriptionSlot): boolean => {
86
96
  return !slot.cancellationDate;
87
- }
97
+ };
88
98
  }
89
99
 
90
100
  /**
@@ -107,7 +117,7 @@ export interface TeamSubscriptionSlotResolved {
107
117
  export type AssigneeIdentifier = AssigneeIdentityIdentifier;
108
118
  export interface AssigneeIdentityIdentifier {
109
119
  identity: {
110
- authHost: string,
111
- authName: string
112
- }
120
+ authHost: string;
121
+ authName: string;
122
+ };
113
123
  }
@@ -5,11 +5,11 @@
5
5
  */
6
6
 
7
7
  import { PrebuiltWorkspaceState } from "./protocol";
8
- import { v4 as uuidv4 } from 'uuid';
8
+ import { v4 as uuidv4 } from "uuid";
9
9
  import { DeepPartial } from "./util/deep-partial";
10
10
 
11
11
  export interface ProjectConfig {
12
- '.gitpod.yml': string;
12
+ ".gitpod.yml": string;
13
13
  }
14
14
 
15
15
  export interface ProjectSettings {
@@ -33,13 +33,13 @@ export interface Project {
33
33
  }
34
34
 
35
35
  export namespace Project {
36
- export const create = (project: Omit<Project, 'id' | 'creationTime'>): Project => {
36
+ export const create = (project: Omit<Project, "id" | "creationTime">): Project => {
37
37
  return {
38
38
  ...project,
39
39
  id: uuidv4(),
40
- creationTime: new Date().toISOString()
40
+ creationTime: new Date().toISOString(),
41
41
  };
42
- }
42
+ };
43
43
 
44
44
  export interface Overview {
45
45
  branches: BranchDetails[];
@@ -67,7 +67,7 @@ export namespace Project {
67
67
  }
68
68
  }
69
69
 
70
- export type PartialProject = DeepPartial<Project> & Pick<Project, 'id'>;
70
+ export type PartialProject = DeepPartial<Project> & Pick<Project, "id">;
71
71
 
72
72
  export interface PrebuildWithStatus {
73
73
  info: PrebuildInfo;
@@ -103,7 +103,7 @@ export interface PrebuildInfo {
103
103
  }
104
104
  export namespace PrebuildInfo {
105
105
  export function is(data?: any): data is PrebuildInfo {
106
- return typeof data === "object" && ["id", "buildWorkspaceId", "projectId", "branch"].every(p => p in data);
106
+ return typeof data === "object" && ["id", "buildWorkspaceId", "projectId", "branch"].every((p) => p in data);
107
107
  }
108
108
  }
109
109
 
@@ -144,4 +144,4 @@ export interface TeamMembershipInvite {
144
144
 
145
145
  /** This is a flag that triggers the HARD DELETION of this entity */
146
146
  deleted?: boolean;
147
- }
147
+ }
@@ -6,7 +6,7 @@
6
6
 
7
7
  interface Window {
8
8
  gitpod: {
9
- service: import('../gitpod-service').GitpodService
10
- ideService?: import('../ide-frontend-service').IDEFrontendService
11
- }
12
- }
9
+ service: import("../gitpod-service").GitpodService;
10
+ ideService?: import("../ide-frontend-service").IDEFrontendService;
11
+ };
12
+ }
@@ -6,8 +6,7 @@
6
6
 
7
7
  import Analytics = require("analytics-node");
8
8
  import { IAnalyticsWriter, IdentifyMessage, TrackMessage, PageMessage } from "../analytics";
9
- import { log } from './logging';
10
-
9
+ import { log } from "./logging";
11
10
 
12
11
  export function newAnalyticsWriterFromEnv(): IAnalyticsWriter {
13
12
  switch (process.env.GITPOD_ANALYTICS_WRITER) {
@@ -21,20 +20,28 @@ export function newAnalyticsWriterFromEnv(): IAnalyticsWriter {
21
20
  }
22
21
 
23
22
  class SegmentAnalyticsWriter implements IAnalyticsWriter {
24
-
25
23
  protected readonly analytics: Analytics;
26
24
 
27
25
  constructor(writeKey: string) {
28
26
  this.analytics = new Analytics(writeKey);
29
27
  }
30
28
 
31
- identify(msg: IdentifyMessage) {
29
+ identify(msg: IdentifyMessage) {
32
30
  try {
33
- this.analytics.identify(msg, (err: Error) => {
34
- if (err) {
35
- log.warn("analytics.identify failed", err);
36
- }
37
- });
31
+ this.analytics.identify(
32
+ {
33
+ ...msg,
34
+ integrations: {
35
+ All: true,
36
+ Mixpanel: !!msg.userId,
37
+ },
38
+ },
39
+ (err: Error) => {
40
+ if (err) {
41
+ log.warn("analytics.identify failed", err);
42
+ }
43
+ },
44
+ );
38
45
  } catch (err) {
39
46
  log.warn("analytics.identify failed", err);
40
47
  }
@@ -42,32 +49,48 @@ class SegmentAnalyticsWriter implements IAnalyticsWriter {
42
49
 
43
50
  track(msg: TrackMessage) {
44
51
  try {
45
- this.analytics.track(msg, (err: Error) => {
46
- if (err) {
47
- log.warn("analytics.track failed", err);
48
- }
49
- });
52
+ this.analytics.track(
53
+ {
54
+ ...msg,
55
+ integrations: {
56
+ All: true,
57
+ Mixpanel: !!msg.userId,
58
+ },
59
+ },
60
+ (err: Error) => {
61
+ if (err) {
62
+ log.warn("analytics.track failed", err);
63
+ }
64
+ },
65
+ );
50
66
  } catch (err) {
51
67
  log.warn("analytics.track failed", err);
52
68
  }
53
69
  }
54
70
 
55
71
  page(msg: PageMessage) {
56
- try{
57
- this.analytics.page(msg, (err: Error) => {
58
- if (err) {
59
- log.warn("analytics.page failed", err);
60
- }
61
- });
72
+ try {
73
+ this.analytics.page(
74
+ {
75
+ ...msg,
76
+ integrations: {
77
+ All: true,
78
+ Mixpanel: !!msg.userId,
79
+ },
80
+ },
81
+ (err: Error) => {
82
+ if (err) {
83
+ log.warn("analytics.page failed", err);
84
+ }
85
+ },
86
+ );
62
87
  } catch (err) {
63
88
  log.warn("analytics.page failed", err);
64
89
  }
65
90
  }
66
-
67
91
  }
68
92
 
69
93
  class LogAnalyticsWriter implements IAnalyticsWriter {
70
-
71
94
  identify(msg: IdentifyMessage): void {
72
95
  log.debug("analytics identify", msg);
73
96
  }
@@ -77,11 +100,10 @@ class LogAnalyticsWriter implements IAnalyticsWriter {
77
100
  page(msg: PageMessage): void {
78
101
  log.debug("analytics page", msg);
79
102
  }
80
-
81
103
  }
82
104
 
83
105
  class NoAnalyticsWriter implements IAnalyticsWriter {
84
106
  identify(msg: IdentifyMessage): void {}
85
107
  track(msg: TrackMessage): void {}
86
108
  page(msg: PageMessage): void {}
87
- }
109
+ }
@@ -5,8 +5,8 @@
5
5
  */
6
6
 
7
7
  // Use asyncIterators with es2015
8
- if (typeof (Symbol as any).asyncIterator === 'undefined') {
9
- (Symbol as any).asyncIterator = Symbol.asyncIterator || Symbol('asyncIterator');
8
+ if (typeof (Symbol as any).asyncIterator === "undefined") {
9
+ (Symbol as any).asyncIterator = Symbol.asyncIterator || Symbol("asyncIterator");
10
10
  }
11
11
 
12
12
  export async function find<T>(it: AsyncIterableIterator<T>, predicate: (value: T) => boolean): Promise<T | undefined> {
@@ -31,12 +31,11 @@ export interface AsyncCachingIterator<T> extends AsyncIterableIterator<T> {
31
31
  resetCursor(): void;
32
32
  }
33
33
  export class AsyncCachingIteratorImpl<T> implements AsyncIterableIterator<T>, AsyncCachingIterator<T> {
34
-
35
34
  protected cache: T[] = [];
36
35
  protected cursor = 0;
37
36
  protected cacheRead = false;
38
37
 
39
- constructor(protected readonly iterable: AsyncIterableIterator<T>) { }
38
+ constructor(protected readonly iterable: AsyncIterableIterator<T>) {}
40
39
 
41
40
  public resetCursor() {
42
41
  this.cursor = 0;
@@ -47,7 +46,7 @@ export class AsyncCachingIteratorImpl<T> implements AsyncIterableIterator<T>, As
47
46
  if (!this.cacheRead && this.cursor < this.cache.length) {
48
47
  return {
49
48
  done: false,
50
- value: this.cache[this.cursor++]
49
+ value: this.cache[this.cursor++],
51
50
  };
52
51
  }
53
52
  this.cacheRead = true;
@@ -9,10 +9,10 @@ import { Disposable } from "./disposable";
9
9
  export class Cancelable<T> implements Disposable {
10
10
  protected canceled: boolean;
11
11
 
12
- constructor(protected readonly activity: (cancel: boolean) => Promise<T> | undefined) { }
12
+ constructor(protected readonly activity: (cancel: boolean) => Promise<T> | undefined) {}
13
13
 
14
14
  public async run(): Promise<T | undefined> {
15
- for(let r = await this.activity(this.canceled); ; r = await this.activity(this.canceled)) {
15
+ for (let r = await this.activity(this.canceled); ; r = await this.activity(this.canceled)) {
16
16
  if (this.canceled) {
17
17
  return;
18
18
  } else if (r !== undefined) {
@@ -28,4 +28,4 @@ export class Cancelable<T> implements Disposable {
28
28
  dispose(): void {
29
29
  this.cancel();
30
30
  }
31
- }
31
+ }
@@ -5,26 +5,26 @@
5
5
  */
6
6
 
7
7
  export function formatDate(date?: string) {
8
- return date ? new Date(date).toLocaleString() : '';
8
+ return date ? new Date(date).toLocaleString() : "";
9
9
  }
10
10
 
11
11
  export function formatHours(hours?: number) {
12
12
  if (hours === undefined) {
13
- return '';
13
+ return "";
14
14
  }
15
15
  const h = Math.floor(Math.abs(hours));
16
- const rm = (Math.abs(hours) - h) * 60.;
16
+ const rm = (Math.abs(hours) - h) * 60;
17
17
  const m = Math.floor(rm);
18
- const rs = (rm - m) * 60.;
18
+ const rs = (rm - m) * 60;
19
19
  const s = Math.floor(rs);
20
- const result = h + ':' + pad2(m) + ':' + pad2(s);
20
+ const result = h + ":" + pad2(m) + ":" + pad2(s);
21
21
  if (hours < 0) {
22
- return `-${result}`
22
+ return `-${result}`;
23
23
  } else {
24
- return `${result}`
24
+ return `${result}`;
25
25
  }
26
26
  }
27
27
 
28
28
  function pad2(n: number) {
29
- return n < 10 ? '0' + n : '' + n;
29
+ return n < 10 ? "0" + n : "" + n;
30
30
  }
@@ -19,12 +19,12 @@ export class Deferred<T> {
19
19
  promise = new Promise<T>((resolve, reject) => {
20
20
  this.resolve = (o) => {
21
21
  this.isResolved = true;
22
- resolve(o as any)
23
- clearTimeout(this.timer)
22
+ resolve(o as any);
23
+ clearTimeout(this.timer);
24
24
  };
25
25
  this.reject = (e) => {
26
- reject(e)
27
- clearTimeout(this.timer)
28
- }
26
+ reject(e);
27
+ clearTimeout(this.timer);
28
+ };
29
29
  });
30
- }
30
+ }
@@ -16,10 +16,10 @@ export interface Disposable {
16
16
  export namespace Disposable {
17
17
  export function create(func: () => void): Disposable {
18
18
  return {
19
- dispose: func
19
+ dispose: func,
20
20
  };
21
21
  }
22
- export const NULL = create(() => { });
22
+ export const NULL = create(() => {});
23
23
  }
24
24
 
25
25
  export class DisposableCollection implements Disposable {
@@ -69,9 +69,6 @@ export class DisposableCollection implements Disposable {
69
69
  }
70
70
 
71
71
  pushAll(disposables: Disposable[]): Disposable[] {
72
- return disposables.map(disposable =>
73
- this.push(disposable)
74
- );
72
+ return disposables.map((disposable) => this.push(disposable));
75
73
  }
76
-
77
74
  }
package/src/util/event.ts CHANGED
@@ -6,13 +6,12 @@
6
6
  */
7
7
 
8
8
  import { Disposable } from "./disposable";
9
- import { log } from './logging';
9
+ import { log } from "./logging";
10
10
 
11
11
  /**
12
12
  * Represents a typed event.
13
13
  */
14
14
  export interface Event<T> {
15
-
16
15
  /**
17
16
  *
18
17
  * @param listener The listener function will be call when the event happens.
@@ -24,12 +23,13 @@ export interface Event<T> {
24
23
  }
25
24
 
26
25
  export namespace Event {
27
- const _disposable = { dispose() { } };
28
- export const None: Event<any> = function () { return _disposable; };
26
+ const _disposable = { dispose() {} };
27
+ export const None: Event<any> = function () {
28
+ return _disposable;
29
+ };
29
30
  }
30
31
 
31
32
  class CallbackList {
32
-
33
33
  private _callbacks: Function[] | undefined;
34
34
  private _contexts: any[] | undefined;
35
35
 
@@ -66,7 +66,7 @@ class CallbackList {
66
66
  }
67
67
 
68
68
  if (foundCallbackWithDifferentContext) {
69
- throw new Error('When adding a listener with a context, you should remove it with the same context');
69
+ throw new Error("When adding a listener with a context, you should remove it with the same context");
70
70
  }
71
71
  }
72
72
 
@@ -105,14 +105,12 @@ export interface EmitterOptions {
105
105
  }
106
106
 
107
107
  export class Emitter<T> {
108
-
109
- private static _noop = function () { };
108
+ private static _noop = function () {};
110
109
 
111
110
  private _event: Event<T>;
112
111
  private _callbacks: CallbackList | undefined;
113
112
 
114
- constructor(private _options?: EmitterOptions) {
115
- }
113
+ constructor(private _options?: EmitterOptions) {}
116
114
 
117
115
  /**
118
116
  * For the public to allow to subscribe
@@ -137,7 +135,7 @@ export class Emitter<T> {
137
135
  if (this._options && this._options.onLastListenerRemove && this._callbacks!.isEmpty()) {
138
136
  this._options.onLastListenerRemove(this);
139
137
  }
140
- }
138
+ },
141
139
  };
142
140
  if (Array.isArray(disposables)) {
143
141
  disposables.push(result);
@@ -6,7 +6,6 @@
6
6
 
7
7
  import { repeat } from "./repeat";
8
8
 
9
-
10
9
  interface CacheEntry<T> {
11
10
  key: string;
12
11
  value: T;
@@ -16,9 +15,7 @@ interface CacheEntry<T> {
16
15
  export class GarbageCollectedCache<T> {
17
16
  protected readonly store = new Map<string, CacheEntry<T>>();
18
17
 
19
- constructor(
20
- protected readonly defaultMaxAgeSeconds: number,
21
- protected readonly gcIntervalSeconds: number) {
18
+ constructor(protected readonly defaultMaxAgeSeconds: number, protected readonly gcIntervalSeconds: number) {
22
19
  this.regularlyCollectGarbage();
23
20
  }
24
21
 
@@ -61,6 +58,6 @@ export class GarbageCollectedCache<T> {
61
58
  }
62
59
 
63
60
  protected calcExpiryDate(maxAgeSeconds?: number): number {
64
- return Date.now() + ((maxAgeSeconds || this.defaultMaxAgeSeconds) * 1000);
61
+ return Date.now() + (maxAgeSeconds || this.defaultMaxAgeSeconds) * 1000;
65
62
  }
66
- }
63
+ }
@@ -4,15 +4,15 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import { suite, test } from "mocha-typescript"
8
- import * as chai from "chai"
7
+ import { suite, test } from "mocha-typescript";
8
+ import * as chai from "chai";
9
9
  import { generateWorkspaceID, colors, animals } from "./generate-workspace-id";
10
10
  import { GitpodHostUrl } from "./gitpod-host-url";
11
11
 
12
- const expect = chai.expect
13
-
14
- @suite class TestGenerateWorkspaceId {
12
+ const expect = chai.expect;
15
13
 
14
+ @suite
15
+ class TestGenerateWorkspaceId {
16
16
  @test public async testGenerateWorkspaceId() {
17
17
  for (let i = 0; i < 100; i++) {
18
18
  const id = await generateWorkspaceID();
@@ -29,20 +29,23 @@ const expect = chai.expect
29
29
 
30
30
  @test public async testCustomName() {
31
31
  const data = [
32
- ['foo','bar','foo-bar-'],
33
- ['f','bar','.{2,16}-bar-'],
34
- ['gitpod-io','gitpod','gitpodio-gitpod-'],
35
- ['this is rather long and has some "§$"% special chars','also here pretty long and needs abbreviation','thisisratherlon-alsohere-'],
36
- ['breatheco-de', 'python-flask-api-tutorial', 'breathecode-pythonflaska-'],
37
- ['UPPER', "CaSe", "upper-case-"]
38
- ]
32
+ ["foo", "bar", "foo-bar-"],
33
+ ["f", "bar", ".{2,16}-bar-"],
34
+ ["gitpod-io", "gitpod", "gitpodio-gitpod-"],
35
+ [
36
+ 'this is rather long and has some "§$"% special chars',
37
+ "also here pretty long and needs abbreviation",
38
+ "thisisratherlon-alsohere-",
39
+ ],
40
+ ["breatheco-de", "python-flask-api-tutorial", "breathecode-pythonflaska-"],
41
+ ["UPPER", "CaSe", "upper-case-"],
42
+ ];
39
43
  for (const d of data) {
40
44
  const id = await generateWorkspaceID(d[0], d[1]);
41
- expect(id).match(new RegExp("^"+d[2]));
45
+ expect(id).match(new RegExp("^" + d[2]));
42
46
  expect(new GitpodHostUrl().withWorkspacePrefix(id, "eu").workspaceId).to.equal(id);
43
47
  expect(id.length <= 36, `"${id}" is longer than 36 chars (${id.length})`).to.be.true;
44
48
  }
45
49
  }
46
-
47
50
  }
48
- module.exports = new TestGenerateWorkspaceId()
51
+ module.exports = new TestGenerateWorkspaceId();