@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,457 @@
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
+ import randomNumber = require("random-number-csprng");
7
+
8
+ export async function generateWorkspaceID(): Promise<string> {
9
+ return (await random(colors))+'-'+(await random(animals))+'-'+(await random(characters, 8));
10
+ }
11
+
12
+ async function random(array: string[], length: number = 1): Promise<string> {
13
+ var result = '';
14
+ for ( var i = 0; i < length; i++ ) {
15
+ result += array[await randomNumber(0, array.length-1)];
16
+ }
17
+ return result;
18
+ }
19
+
20
+ const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'.split('');
21
+
22
+ export const colors = [
23
+ 'amaranth',
24
+ 'amber',
25
+ 'amethyst',
26
+ 'apricot',
27
+ 'aqua',
28
+ 'aquamarine',
29
+ 'azure',
30
+ 'beige',
31
+ 'black',
32
+ 'blue',
33
+ 'blush',
34
+ 'bronze',
35
+ 'brown',
36
+ 'chocolate',
37
+ 'coffee',
38
+ 'copper',
39
+ 'coral',
40
+ 'crimson',
41
+ 'cyan',
42
+ 'emerald',
43
+ 'fuchsia',
44
+ 'gold',
45
+ 'gray',
46
+ 'green',
47
+ 'harlequin',
48
+ 'indigo',
49
+ 'ivory',
50
+ 'jade',
51
+ 'kumquat',
52
+ 'lavender',
53
+ 'lime',
54
+ 'magenta',
55
+ 'maroon',
56
+ 'moccasin',
57
+ 'olive',
58
+ 'orange',
59
+ 'peach',
60
+ 'pink',
61
+ 'plum',
62
+ 'purple',
63
+ 'red',
64
+ 'rose',
65
+ 'salmon',
66
+ 'sapphire',
67
+ 'scarlet',
68
+ 'silver',
69
+ 'tan',
70
+ 'teal',
71
+ 'tomato',
72
+ 'turquoise',
73
+ 'violet',
74
+ 'white',
75
+ 'yellow',
76
+ ];
77
+
78
+ export const animals = [
79
+ 'canidae',
80
+ 'felidae',
81
+ 'cat',
82
+ 'cattle',
83
+ 'dog',
84
+ 'donkey',
85
+ 'goat',
86
+ 'horse',
87
+ 'pig',
88
+ 'rabbit',
89
+ 'aardvark',
90
+ 'aardwolf',
91
+ 'albatross',
92
+ 'alligator',
93
+ 'alpaca',
94
+ 'amphibian',
95
+ 'anaconda',
96
+ 'angelfish',
97
+ 'anglerfish',
98
+ 'ant',
99
+ 'anteater',
100
+ 'antelope',
101
+ 'antlion',
102
+ 'ape',
103
+ 'aphid',
104
+ 'armadillo',
105
+ 'asp',
106
+ 'baboon',
107
+ 'badger',
108
+ 'bandicoot',
109
+ 'barnacle',
110
+ 'barracuda',
111
+ 'basilisk',
112
+ 'bass',
113
+ 'bat',
114
+ 'bear',
115
+ 'beaver',
116
+ 'bedbug',
117
+ 'bee',
118
+ 'beetle',
119
+ 'bird',
120
+ 'bison',
121
+ 'blackbird',
122
+ 'boa',
123
+ 'boar',
124
+ 'bobcat',
125
+ 'bobolink',
126
+ 'bonobo',
127
+ 'booby',
128
+ 'bovid',
129
+ 'bug',
130
+ 'butterfly',
131
+ 'buzzard',
132
+ 'camel',
133
+ 'canid',
134
+ 'capybara',
135
+ 'cardinal',
136
+ 'caribou',
137
+ 'carp',
138
+ 'cat',
139
+ 'catshark',
140
+ 'caterpillar',
141
+ 'catfish',
142
+ 'cattle',
143
+ 'centipede',
144
+ 'cephalopod',
145
+ 'chameleon',
146
+ 'cheetah',
147
+ 'chickadee',
148
+ 'chicken',
149
+ 'chimpanzee',
150
+ 'chinchilla',
151
+ 'chipmunk',
152
+ 'clam',
153
+ 'clownfish',
154
+ 'cobra',
155
+ 'cockroach',
156
+ 'cod',
157
+ 'condor',
158
+ 'constrictor',
159
+ 'coral',
160
+ 'cougar',
161
+ 'cow',
162
+ 'coyote',
163
+ 'crab',
164
+ 'crane',
165
+ 'crawdad',
166
+ 'crayfish',
167
+ 'cricket',
168
+ 'crocodile',
169
+ 'crow',
170
+ 'cuckoo',
171
+ 'cicada',
172
+ 'damselfly',
173
+ 'deer',
174
+ 'dingo',
175
+ 'dinosaur',
176
+ 'dodo',
177
+ 'dog',
178
+ 'dolphin',
179
+ 'donkey',
180
+ 'dormouse',
181
+ 'dove',
182
+ 'dragonfly',
183
+ 'dragon',
184
+ 'duck',
185
+ 'eagle',
186
+ 'earthworm',
187
+ 'earwig',
188
+ 'echidna',
189
+ 'eel',
190
+ 'egret',
191
+ 'elephant',
192
+ 'elk',
193
+ 'emu',
194
+ 'ermine',
195
+ 'falcon',
196
+ 'ferret',
197
+ 'finch',
198
+ 'firefly',
199
+ 'fish',
200
+ 'flamingo',
201
+ 'flea',
202
+ 'fly',
203
+ 'flyingfish',
204
+ 'fowl',
205
+ 'fox',
206
+ 'frog',
207
+ 'gamefowl',
208
+ 'galliform',
209
+ 'gazelle',
210
+ 'gecko',
211
+ 'gerbil',
212
+ 'gibbon',
213
+ 'giraffe',
214
+ 'goat',
215
+ 'goldfish',
216
+ 'goose',
217
+ 'gopher',
218
+ 'gorilla',
219
+ 'grasshopper',
220
+ 'grouse',
221
+ 'guan',
222
+ 'guanaco',
223
+ 'guineafowl',
224
+ 'gull',
225
+ 'guppy',
226
+ 'haddock',
227
+ 'halibut',
228
+ 'hamster',
229
+ 'hare',
230
+ 'harrier',
231
+ 'hawk',
232
+ 'hedgehog',
233
+ 'heron',
234
+ 'herring',
235
+ 'hippopotamus',
236
+ 'hookworm',
237
+ 'hornet',
238
+ 'horse',
239
+ 'hoverfly',
240
+ 'hummingbird',
241
+ 'hyena',
242
+ 'iguana',
243
+ 'impala',
244
+ 'jackal',
245
+ 'jaguar',
246
+ 'jay',
247
+ 'jellyfish',
248
+ 'junglefowl',
249
+ 'kangaroo',
250
+ 'kingfisher',
251
+ 'kite',
252
+ 'kiwi',
253
+ 'koala',
254
+ 'koi',
255
+ 'krill',
256
+ 'ladybug',
257
+ 'lamprey',
258
+ 'landfowl',
259
+ 'lark',
260
+ 'leech',
261
+ 'lemming',
262
+ 'lemur',
263
+ 'leopard',
264
+ 'leopon',
265
+ 'limpet',
266
+ 'lion',
267
+ 'lizard',
268
+ 'llama',
269
+ 'lobster',
270
+ 'locust',
271
+ 'loon',
272
+ 'louse',
273
+ 'lungfish',
274
+ 'lynx',
275
+ 'macaw',
276
+ 'mackerel',
277
+ 'magpie',
278
+ 'mammal',
279
+ 'manatee',
280
+ 'mandrill',
281
+ 'marlin',
282
+ 'marmoset',
283
+ 'marmot',
284
+ 'marsupial',
285
+ 'marten',
286
+ 'mastodon',
287
+ 'meadowlark',
288
+ 'meerkat',
289
+ 'mink',
290
+ 'minnow',
291
+ 'mite',
292
+ 'mockingbird',
293
+ 'mole',
294
+ 'mollusk',
295
+ 'mongoose',
296
+ 'monkey',
297
+ 'moose',
298
+ 'mosquito',
299
+ 'moth',
300
+ 'mouse',
301
+ 'mule',
302
+ 'muskox',
303
+ 'narwhal',
304
+ 'newt',
305
+ 'nightingale',
306
+ 'ocelot',
307
+ 'octopus',
308
+ 'opossum',
309
+ 'orangutan',
310
+ 'orca',
311
+ 'ostrich',
312
+ 'otter',
313
+ 'owl',
314
+ 'ox',
315
+ 'panda',
316
+ 'panther',
317
+ 'parakeet',
318
+ 'parrot',
319
+ 'parrotfish',
320
+ 'partridge',
321
+ 'peacock',
322
+ 'peafowl',
323
+ 'pelican',
324
+ 'penguin',
325
+ 'perch',
326
+ 'pheasant',
327
+ 'pig',
328
+ 'pigeon',
329
+ 'pike',
330
+ 'pinniped',
331
+ 'piranha',
332
+ 'planarian',
333
+ 'platypus',
334
+ 'pony',
335
+ 'porcupine',
336
+ 'porpoise',
337
+ 'possum',
338
+ 'prawn',
339
+ 'primate',
340
+ 'ptarmigan',
341
+ 'puffin',
342
+ 'puma',
343
+ 'python',
344
+ 'quail',
345
+ 'quelea',
346
+ 'quokka',
347
+ 'rabbit',
348
+ 'raccoon',
349
+ 'rat',
350
+ 'rattlesnake',
351
+ 'raven',
352
+ 'reindeer',
353
+ 'reptile',
354
+ 'rhinoceros',
355
+ 'roadrunner',
356
+ 'rodent',
357
+ 'rook',
358
+ 'rooster',
359
+ 'roundworm',
360
+ 'sailfish',
361
+ 'salamander',
362
+ 'salmon',
363
+ 'sawfish',
364
+ 'scallop',
365
+ 'scorpion',
366
+ 'seahorse',
367
+ 'shark',
368
+ 'sheep',
369
+ 'shrew',
370
+ 'shrimp',
371
+ 'silkworm',
372
+ 'silverfish',
373
+ 'skink',
374
+ 'skunk',
375
+ 'sloth',
376
+ 'slug',
377
+ 'smelt',
378
+ 'snail',
379
+ 'snake',
380
+ 'snipe',
381
+ 'sole',
382
+ 'sparrow',
383
+ 'spider',
384
+ 'spoonbill',
385
+ 'squid',
386
+ 'squirrel',
387
+ 'starfish',
388
+ 'stingray',
389
+ 'stoat',
390
+ 'stork',
391
+ 'sturgeon',
392
+ 'swallow',
393
+ 'swan',
394
+ 'swift',
395
+ 'swordfish',
396
+ 'swordtail',
397
+ 'tahr',
398
+ 'takin',
399
+ 'tapir',
400
+ 'tarantula',
401
+ 'tarsier',
402
+ 'termite',
403
+ 'tern',
404
+ 'thrush',
405
+ 'tick',
406
+ 'tiger',
407
+ 'tiglon',
408
+ 'toad',
409
+ 'tortoise',
410
+ 'toucan',
411
+ 'trout',
412
+ 'tuna',
413
+ 'turkey',
414
+ 'turtle',
415
+ 'tyrannosaurus',
416
+ 'urial',
417
+ 'vicuna',
418
+ 'viper',
419
+ 'vole',
420
+ 'vulture',
421
+ 'wallaby',
422
+ 'walrus',
423
+ 'wasp',
424
+ 'warbler',
425
+ 'weasel',
426
+ 'whale',
427
+ 'whippet',
428
+ 'whitefish',
429
+ 'wildcat',
430
+ 'wildebeest',
431
+ 'wildfowl',
432
+ 'wolf',
433
+ 'wolverine',
434
+ 'wombat',
435
+ 'woodpecker',
436
+ 'worm',
437
+ 'wren',
438
+ 'xerinae',
439
+ 'yak',
440
+ 'zebra',
441
+ 'alpaca',
442
+ 'cat',
443
+ 'cattle',
444
+ 'chicken',
445
+ 'dog',
446
+ 'donkey',
447
+ 'ferret',
448
+ 'gayal',
449
+ 'goldfish',
450
+ 'guppy',
451
+ 'horse',
452
+ 'koi',
453
+ 'llama',
454
+ 'sheep',
455
+ 'yak',
456
+ 'unicorn',
457
+ ]
@@ -0,0 +1,39 @@
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 * as cookie from 'cookie';
7
+
8
+
9
+ /**
10
+ * This cookie indicates whether the connected client is a Gitpod user (= "has logged in within the last year") or not.
11
+ * This is used by "gitpod.io" and "www.gitpod.io" to display different content/buttons.
12
+ */
13
+ export const NAME = "gitpod-user";
14
+ export const VALUE = "true";
15
+
16
+ /**
17
+ * @param domain The domain the Gitpod installation is installed onto
18
+ * @returns
19
+ */
20
+ export function options(domain: string): cookie.CookieSerializeOptions {
21
+ // Reference: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies
22
+ return {
23
+ path: "/", // make sure we send the cookie to all sub-pages
24
+ httpOnly: false,
25
+ secure: false,
26
+ maxAge: 60 * 60 * 24 * 365, // 1 year
27
+ sameSite: "lax", // default: true. "Lax" needed to ensure we see cookies from users that neavigate to gitpod.io from external sites
28
+ domain: `.${domain}`, // explicilty include subdomains to not only cover "gitpod.io", but also "www.gitpod.io" or workspaces
29
+ };
30
+ };
31
+
32
+ export function generateCookie(domain: string): string {
33
+ return cookie.serialize(NAME, VALUE, options(domain));
34
+ };
35
+
36
+ export function isPresent(cookies: string): boolean {
37
+ // needs to match the old (gitpod-user=loggedIn) and new (gitpod-user=true) values to ensure a smooth transition during rollout.
38
+ return !!cookies.match(`${NAME}=`);
39
+ };
@@ -0,0 +1,49 @@
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
+
7
+ import * as chai from 'chai';
8
+ import { suite, test } from 'mocha-typescript';
9
+ import { GitpodHostUrl } from './gitpod-host-url';
10
+ const expect = chai.expect;
11
+
12
+ @suite
13
+ export class GitpodHostUrlTest {
14
+
15
+ @test public parseWorkspaceId_pathBased() {
16
+ const actual = GitpodHostUrl.fromWorkspaceUrl("http://35.223.201.195/workspace/bc77e03d-c781-4235-bca0-e24087f5e472/").workspaceId;
17
+ expect(actual).to.equal("bc77e03d-c781-4235-bca0-e24087f5e472");
18
+ }
19
+
20
+ @test public parseWorkspaceId_hosts_withEnvVarsInjected() {
21
+ const actual = GitpodHostUrl.fromWorkspaceUrl("https://gray-grasshopper-nfbitfia.ws-eu02.gitpod-staging.com/#passedin=test%20value/https://github.com/gitpod-io/gitpod-test-repo").workspaceId;
22
+ expect(actual).to.equal("gray-grasshopper-nfbitfia");
23
+ }
24
+
25
+ @test public async testWithoutWorkspacePrefix() {
26
+ expect(GitpodHostUrl.fromWorkspaceUrl("https://3000-moccasin-ferret-155799b3.ws-eu02.gitpod-staging.com/").withoutWorkspacePrefix().toString()).to.equal("https://gitpod-staging.com/");
27
+ }
28
+
29
+ @test public async testWithoutWorkspacePrefix2() {
30
+ expect(GitpodHostUrl.fromWorkspaceUrl("https://gitpod-staging.com/").withoutWorkspacePrefix().toString()).to.equal("https://gitpod-staging.com/");
31
+ }
32
+
33
+ @test public async testWithoutWorkspacePrefix3() {
34
+ expect(GitpodHostUrl.fromWorkspaceUrl("https://gray-rook-5523v5d8.ws-dev.my-branch-1234.staging.gitpod-dev.com/").withoutWorkspacePrefix().toString()).to.equal("https://my-branch-1234.staging.gitpod-dev.com/");
35
+ }
36
+
37
+ @test public async testWithoutWorkspacePrefix4() {
38
+ expect(GitpodHostUrl.fromWorkspaceUrl("https://my-branch-1234.staging.gitpod-dev.com/").withoutWorkspacePrefix().toString()).to.equal("https://my-branch-1234.staging.gitpod-dev.com/");
39
+ }
40
+
41
+ @test public async testWithoutWorkspacePrefix5() {
42
+ expect(GitpodHostUrl.fromWorkspaceUrl("https://abc-nice-brunch-4224.staging.gitpod-dev.com/").withoutWorkspacePrefix().toString()).to.equal("https://abc-nice-brunch-4224.staging.gitpod-dev.com/");
43
+ }
44
+
45
+ @test public async testWithoutWorkspacePrefix6() {
46
+ expect(GitpodHostUrl.fromWorkspaceUrl("https://gray-rook-5523v5d8.ws-dev.abc-nice-brunch-4224.staging.gitpod-dev.com/").withoutWorkspacePrefix().toString()).to.equal("https://abc-nice-brunch-4224.staging.gitpod-dev.com/");
47
+ }
48
+ }
49
+ module.exports = new GitpodHostUrlTest()
@@ -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
  */
@@ -12,7 +12,13 @@ export interface UrlChange {
12
12
  }
13
13
  export type UrlUpdate = UrlChange | Partial<URL>;
14
14
 
15
- export const workspaceIDRegex = /([a-z0-9]{4,8}-)+([a-z0-9]{12})/;
15
+ const basewoWkspaceIDRegex = "(([a-f][0-9a-f]{7}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})|([0-9a-z]{2,16}-[0-9a-z]{2,16}-[0-9a-z]{8}))";
16
+
17
+ // this pattern matches v4 UUIDs as well as the new generated workspace ids (e.g. pink-panda-ns35kd21)
18
+ const workspaceIDRegex = RegExp(`^${basewoWkspaceIDRegex}$`);
19
+
20
+ // this pattern matches URL prefixes of workspaces
21
+ const workspaceUrlPrefixRegex = RegExp(`^([0-9]{4,6}-)?${basewoWkspaceIDRegex}\\.`);
16
22
 
17
23
  export class GitpodHostUrl {
18
24
  readonly url: URL;
@@ -30,6 +36,10 @@ export class GitpodHostUrl {
30
36
  }
31
37
  }
32
38
 
39
+ static fromWorkspaceUrl(url: string) {
40
+ return new GitpodHostUrl(new URL(url));
41
+ }
42
+
33
43
  withWorkspacePrefix(workspaceId: string, region: string) {
34
44
  return this.withDomainPrefix(`${workspaceId}.ws-${region}.`);
35
45
  }
@@ -39,7 +49,7 @@ export class GitpodHostUrl {
39
49
  }
40
50
 
41
51
  withoutWorkspacePrefix(): GitpodHostUrl {
42
- if (!this.url.host.match(workspaceIDRegex)) {
52
+ if (!this.url.host.match(workspaceUrlPrefixRegex)) {
43
53
  // URL has no workspace prefix
44
54
  return this;
45
55
  }
@@ -75,29 +85,40 @@ export class GitpodHostUrl {
75
85
  }
76
86
 
77
87
  asDashboard(): GitpodHostUrl {
78
- return this.with(url => ({ pathname: '/workspaces/' }));
88
+ return this.with(url => ({ pathname: '/' }));
79
89
  }
80
90
 
81
91
  asLogin(): GitpodHostUrl {
82
- return this.with(url => ({ pathname: '/login/' }));
92
+ return this.with(url => ({ pathname: '/login' }));
83
93
  }
84
94
 
85
95
  asUpgradeSubscription(): GitpodHostUrl {
86
- return this.with(url => ({ pathname: '/upgrade-subscription/' }));
96
+ return this.with(url => ({ pathname: '/plans' }));
87
97
  }
88
98
 
89
99
  asAccessControl(): GitpodHostUrl {
90
- return this.with(url => ({ pathname: '/access-control/' }));
100
+ return this.with(url => ({ pathname: '/integrations' }));
91
101
  }
92
102
 
93
103
  asSettings(): GitpodHostUrl {
94
- return this.with(url => ({ pathname: '/settings/' }));
104
+ return this.with(url => ({ pathname: '/settings' }));
105
+ }
106
+
107
+ asPreferences(): GitpodHostUrl {
108
+ return this.with(url => ({ pathname: '/preferences' }));
95
109
  }
96
110
 
97
111
  asGraphQLApi(): GitpodHostUrl {
98
112
  return this.with(url => ({ pathname: '/graphql/' }));
99
113
  }
100
114
 
115
+ asStart(workspaceId = this.workspaceId): GitpodHostUrl {
116
+ return this.withoutWorkspacePrefix().with({
117
+ pathname: '/start/',
118
+ hash: '#' + workspaceId
119
+ });
120
+ }
121
+
101
122
  asWorkspaceAuth(instanceID: string, redirect?: boolean): GitpodHostUrl {
102
123
  return this.with(url => ({ pathname: `/api/auth/workspace-cookie/${instanceID}`, search: redirect ? "redirect" : "" }));
103
124
  }
@@ -114,18 +135,41 @@ export class GitpodHostUrl {
114
135
  return result;
115
136
  }
116
137
 
117
- get workspaceId(): string | undefined {
118
- const hostSegs = window.location.host.split(".");
119
- if (hostSegs.length > 1 && hostSegs[0].match(workspaceIDRegex)) {
120
- // URL has a workspace prefix
121
- return hostSegs[0];
138
+ get workspaceId(): string | undefined {
139
+ const hostSegs = this.url.host.split(".");
140
+ if (hostSegs.length > 1) {
141
+ const matchResults = hostSegs[0].match(workspaceIDRegex);
142
+ if (matchResults) {
143
+ // URL has a workspace prefix
144
+ // port prefixes are excluded
145
+ return matchResults[0];
146
+ }
122
147
  }
123
148
 
124
- const pathSegs = window.location.pathname.split("/")
149
+ const pathSegs = this.url.pathname.split("/")
125
150
  if (pathSegs.length > 3 && pathSegs[1] === "workspace") {
126
151
  return pathSegs[2];
127
152
  }
128
153
 
129
154
  return undefined;
130
155
  }
156
+
157
+ get blobServe(): boolean {
158
+ const hostSegments = this.url.host.split(".");
159
+ if (hostSegments[0] === 'blobserve') {
160
+ return true;
161
+ }
162
+
163
+ const pathSegments = this.url.pathname.split("/")
164
+ return pathSegments[0] === "blobserve";
165
+ }
166
+
167
+ asSorry(message: string) {
168
+ return this.with({ pathname: '/sorry', hash: message });
169
+ }
170
+
171
+ asApiLogout(): GitpodHostUrl {
172
+ return this.withApi(url => ({ pathname: '/logout/' }));
173
+ }
174
+
131
175
  }
@@ -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
+
7
+ export const defaultGRPCOptions = {
8
+ "grpc.keepalive_timeout_ms": 10000,
9
+ "grpc.keepalive_time_ms": 60000,
10
+ "grpc.http2.min_time_between_pings_ms": 10000,
11
+ "grpc.keepalive_permit_without_calls": 1,
12
+ "grpc-node.max_session_memory": 50,
13
+ "grpc.max_reconnect_backoff_ms": 5000,
14
+ "grpc.max_receive_message_length": 1024 * 1024 * 16,
15
+ };
@@ -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
  */