@gitpod/gitpod-protocol 0.1.5-server-vscode-ouath2.18 → 0.1.5-server-vscode-oauth2.24

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 (330) hide show
  1. package/data/gitpod-schema.json +49 -4
  2. package/lib/accounting-protocol.d.ts +10 -11
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +31 -41
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +20 -2
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +2 -13
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +12 -1
  11. package/lib/analytics.d.ts.map +1 -1
  12. package/lib/analytics.js.map +1 -1
  13. package/lib/auth.d.ts.map +1 -1
  14. package/lib/context-url.d.ts +18 -5
  15. package/lib/context-url.d.ts.map +1 -1
  16. package/lib/context-url.js +63 -10
  17. package/lib/context-url.js.map +1 -1
  18. package/lib/context-url.spec.d.ts +2 -0
  19. package/lib/context-url.spec.d.ts.map +1 -1
  20. package/lib/context-url.spec.js +81 -48
  21. package/lib/context-url.spec.js.map +1 -1
  22. package/lib/email-protocol.d.ts +1 -1
  23. package/lib/email-protocol.d.ts.map +1 -1
  24. package/lib/email-protocol.js +4 -4
  25. package/lib/email-protocol.js.map +1 -1
  26. package/lib/encryption/container-module.d.ts.map +1 -1
  27. package/lib/encryption/container-module.js +4 -4
  28. package/lib/encryption/container-module.js.map +1 -1
  29. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  30. package/lib/encryption/encryption-engine.js +25 -26
  31. package/lib/encryption/encryption-engine.js.map +1 -1
  32. package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
  33. package/lib/encryption/encryption-engine.spec.js +29 -37
  34. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  35. package/lib/encryption/encryption-service.d.ts.map +1 -1
  36. package/lib/encryption/encryption-service.js +30 -44
  37. package/lib/encryption/encryption-service.js.map +1 -1
  38. package/lib/encryption/key-provider.d.ts.map +1 -1
  39. package/lib/encryption/key-provider.js +31 -38
  40. package/lib/encryption/key-provider.js.map +1 -1
  41. package/lib/env.d.ts +1 -2
  42. package/lib/env.d.ts.map +1 -1
  43. package/lib/env.js +17 -19
  44. package/lib/env.js.map +1 -1
  45. package/lib/gitpod-file-parser.d.ts.map +1 -1
  46. package/lib/gitpod-file-parser.js +26 -42
  47. package/lib/gitpod-file-parser.js.map +1 -1
  48. package/lib/gitpod-file-parser.spec.js +145 -142
  49. package/lib/gitpod-file-parser.spec.js.map +1 -1
  50. package/lib/gitpod-service.d.ts +67 -31
  51. package/lib/gitpod-service.d.ts.map +1 -1
  52. package/lib/gitpod-service.js +162 -309
  53. package/lib/gitpod-service.js.map +1 -1
  54. package/lib/headless-workspace-log.d.ts +1 -0
  55. package/lib/headless-workspace-log.d.ts.map +1 -1
  56. package/lib/headless-workspace-log.js +2 -1
  57. package/lib/headless-workspace-log.js.map +1 -1
  58. package/lib/ide-frontend-service.d.ts +1 -1
  59. package/lib/ide-protocol.d.ts +105 -0
  60. package/lib/ide-protocol.d.ts.map +1 -0
  61. package/lib/ide-protocol.js +8 -0
  62. package/lib/ide-protocol.js.map +1 -0
  63. package/lib/index.d.ts +16 -13
  64. package/lib/index.d.ts.map +1 -1
  65. package/lib/index.js +3 -0
  66. package/lib/index.js.map +1 -1
  67. package/lib/installation-admin-protocol.d.ts +27 -0
  68. package/lib/installation-admin-protocol.d.ts.map +1 -0
  69. package/lib/installation-admin-protocol.js +30 -0
  70. package/lib/installation-admin-protocol.js.map +1 -0
  71. package/lib/license-protocol.d.ts.map +1 -1
  72. package/lib/license-protocol.js.map +1 -1
  73. package/lib/messaging/browser/connection.d.ts +3 -3
  74. package/lib/messaging/browser/connection.d.ts.map +1 -1
  75. package/lib/messaging/browser/connection.js +173 -36
  76. package/lib/messaging/browser/connection.js.map +1 -1
  77. package/lib/messaging/browser/window-connection.d.ts +4 -4
  78. package/lib/messaging/browser/window-connection.d.ts.map +1 -1
  79. package/lib/messaging/browser/window-connection.js +42 -59
  80. package/lib/messaging/browser/window-connection.js.map +1 -1
  81. package/lib/messaging/client-call-metrics.d.ts +2 -2
  82. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  83. package/lib/messaging/client-call-metrics.js +37 -38
  84. package/lib/messaging/client-call-metrics.js.map +1 -1
  85. package/lib/messaging/error.d.ts +2 -1
  86. package/lib/messaging/error.d.ts.map +1 -1
  87. package/lib/messaging/error.js +4 -2
  88. package/lib/messaging/error.js.map +1 -1
  89. package/lib/messaging/handler.d.ts +10 -0
  90. package/lib/messaging/handler.d.ts.map +1 -1
  91. package/lib/messaging/handler.js +1 -1
  92. package/lib/messaging/node/connection.d.ts +1 -17
  93. package/lib/messaging/node/connection.d.ts.map +1 -1
  94. package/lib/messaging/node/connection.js +24 -60
  95. package/lib/messaging/node/connection.js.map +1 -1
  96. package/lib/messaging/proxy-factory.d.ts +3 -1
  97. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  98. package/lib/messaging/proxy-factory.js +74 -163
  99. package/lib/messaging/proxy-factory.js.map +1 -1
  100. package/lib/oss-allowlist.d.ts +14 -0
  101. package/lib/oss-allowlist.d.ts.map +1 -0
  102. package/lib/oss-allowlist.js +8 -0
  103. package/lib/oss-allowlist.js.map +1 -0
  104. package/lib/payment-protocol.d.ts.map +1 -1
  105. package/lib/payment-protocol.js +1 -1
  106. package/lib/payment-protocol.js.map +1 -1
  107. package/lib/permission.d.ts +9 -4
  108. package/lib/permission.d.ts.map +1 -1
  109. package/lib/permission.js +39 -31
  110. package/lib/permission.js.map +1 -1
  111. package/lib/plans.d.ts +4 -4
  112. package/lib/plans.d.ts.map +1 -1
  113. package/lib/plans.js +225 -209
  114. package/lib/plans.js.map +1 -1
  115. package/lib/protocol.d.ts +83 -78
  116. package/lib/protocol.d.ts.map +1 -1
  117. package/lib/protocol.js +131 -190
  118. package/lib/protocol.js.map +1 -1
  119. package/lib/snapshot-url.d.ts +14 -0
  120. package/lib/snapshot-url.d.ts.map +1 -0
  121. package/lib/snapshot-url.js +26 -0
  122. package/lib/snapshot-url.js.map +1 -0
  123. package/{src/theia-plugins.ts → lib/snapshot-url.spec.d.ts} +2 -6
  124. package/lib/snapshot-url.spec.d.ts.map +1 -0
  125. package/lib/snapshot-url.spec.js +41 -0
  126. package/lib/snapshot-url.spec.js.map +1 -0
  127. package/lib/team-subscription-protocol.d.ts +5 -3
  128. package/lib/team-subscription-protocol.d.ts.map +1 -1
  129. package/lib/team-subscription-protocol.js +17 -17
  130. package/lib/team-subscription-protocol.js.map +1 -1
  131. package/lib/teams-projects-protocol.d.ts +16 -3
  132. package/lib/teams-projects-protocol.d.ts.map +1 -1
  133. package/lib/teams-projects-protocol.js +11 -15
  134. package/lib/teams-projects-protocol.js.map +1 -1
  135. package/lib/typings/globals.d.ts +2 -2
  136. package/lib/typings/globals.d.ts.map +1 -1
  137. package/lib/util/analytics.d.ts.map +1 -1
  138. package/lib/util/analytics.js +44 -26
  139. package/lib/util/analytics.js.map +1 -1
  140. package/lib/util/async-iterator.d.ts.map +1 -1
  141. package/lib/util/async-iterator.js +57 -135
  142. package/lib/util/async-iterator.js.map +1 -1
  143. package/lib/util/cancelable.js +17 -59
  144. package/lib/util/cancelable.js.map +1 -1
  145. package/lib/util/date-time.js +11 -11
  146. package/lib/util/date-time.js.map +1 -1
  147. package/lib/util/deferred.js +10 -12
  148. package/lib/util/deferred.js.map +1 -1
  149. package/lib/util/disposable.d.ts.map +1 -1
  150. package/lib/util/disposable.js +27 -40
  151. package/lib/util/disposable.js.map +1 -1
  152. package/lib/util/event.d.ts.map +1 -1
  153. package/lib/util/event.js +63 -77
  154. package/lib/util/event.js.map +1 -1
  155. package/lib/util/garbage-collected-cache.d.ts +1 -0
  156. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  157. package/lib/util/garbage-collected-cache.js +27 -47
  158. package/lib/util/garbage-collected-cache.js.map +1 -1
  159. package/lib/util/generate-workspace-id.d.ts +1 -1
  160. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  161. package/lib/util/generate-workspace-id.js +460 -499
  162. package/lib/util/generate-workspace-id.js.map +1 -1
  163. package/lib/util/generate-workspace-id.spec.js +61 -78
  164. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  165. package/lib/util/gitpod-cookie.d.ts +20 -0
  166. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  167. package/lib/util/gitpod-cookie.js +41 -0
  168. package/lib/util/gitpod-cookie.js.map +1 -0
  169. package/lib/util/gitpod-host-url.d.ts +1 -1
  170. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  171. package/lib/util/gitpod-host-url.js +106 -114
  172. package/lib/util/gitpod-host-url.js.map +1 -1
  173. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  174. package/lib/util/gitpod-host-url.spec.js +97 -135
  175. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  176. package/lib/util/grpc.d.ts.map +1 -1
  177. package/lib/util/grpc.js +3 -3
  178. package/lib/util/grpc.js.map +1 -1
  179. package/lib/util/jaeger-client-types.d.ts +68 -0
  180. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  181. package/lib/{theia-plugins.js → util/jaeger-client-types.js} +1 -1
  182. package/lib/util/jaeger-client-types.js.map +1 -0
  183. package/lib/util/logging.d.ts +33 -33
  184. package/lib/util/logging.d.ts.map +1 -1
  185. package/lib/util/logging.js +87 -129
  186. package/lib/util/logging.js.map +1 -1
  187. package/lib/util/make-link.js +5 -5
  188. package/lib/util/make-link.js.map +1 -1
  189. package/lib/util/parse-workspace-id.d.ts +10 -0
  190. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  191. package/lib/util/parse-workspace-id.js +30 -7
  192. package/lib/util/parse-workspace-id.js.map +1 -1
  193. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  194. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  195. package/lib/util/parse-workspace-id.spec.js +123 -84
  196. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  197. package/lib/util/queue.js +16 -55
  198. package/lib/util/queue.js.map +1 -1
  199. package/lib/util/queue.spec.js +147 -288
  200. package/lib/util/queue.spec.js.map +1 -1
  201. package/lib/util/repeat.d.ts +15 -0
  202. package/lib/util/repeat.d.ts.map +1 -0
  203. package/lib/util/repeat.js +55 -0
  204. package/lib/util/repeat.js.map +1 -0
  205. package/lib/util/semaphore.d.ts.map +1 -1
  206. package/lib/util/semaphore.js +15 -46
  207. package/lib/util/semaphore.js.map +1 -1
  208. package/lib/util/skip-if.d.ts.map +1 -1
  209. package/lib/util/skip-if.js +6 -6
  210. package/lib/util/skip-if.js.map +1 -1
  211. package/lib/util/timeutil.d.ts.map +1 -1
  212. package/lib/util/timeutil.js +16 -16
  213. package/lib/util/timeutil.js.map +1 -1
  214. package/lib/util/timeutil.spec.d.ts.map +1 -1
  215. package/lib/util/timeutil.spec.js +21 -24
  216. package/lib/util/timeutil.spec.js.map +1 -1
  217. package/lib/util/tracing.d.ts +52 -6
  218. package/lib/util/tracing.d.ts.map +1 -1
  219. package/lib/util/tracing.js +199 -64
  220. package/lib/util/tracing.js.map +1 -1
  221. package/lib/util/tracing.spec.d.ts +7 -0
  222. package/lib/util/tracing.spec.d.ts.map +1 -0
  223. package/lib/util/tracing.spec.js +121 -0
  224. package/lib/util/tracing.spec.js.map +1 -0
  225. package/lib/util/workspace-port-authentication.d.ts +7 -7
  226. package/lib/util/workspace-port-authentication.d.ts.map +1 -1
  227. package/lib/util/workspace-port-authentication.js +9 -12
  228. package/lib/util/workspace-port-authentication.js.map +1 -1
  229. package/lib/workspace-cluster.d.ts +15 -3
  230. package/lib/workspace-cluster.d.ts.map +1 -1
  231. package/lib/workspace-cluster.js +19 -4
  232. package/lib/workspace-cluster.js.map +1 -1
  233. package/lib/workspace-instance.d.ts +25 -4
  234. package/lib/workspace-instance.d.ts.map +1 -1
  235. package/lib/wsready.d.ts +1 -1
  236. package/lib/wsready.d.ts.map +1 -1
  237. package/lib/wsready.js +2 -2
  238. package/package.json +22 -13
  239. package/pkg-yarn.lock +12 -7
  240. package/provenance-bundle.jsonl +2 -0
  241. package/src/accounting-protocol.ts +53 -53
  242. package/src/admin-protocol.ts +43 -20
  243. package/src/analytics.ts +28 -15
  244. package/src/auth.ts +2 -2
  245. package/src/context-url.spec.ts +37 -9
  246. package/src/context-url.ts +94 -36
  247. package/src/email-protocol.ts +5 -6
  248. package/src/encryption/container-module.ts +2 -3
  249. package/src/encryption/encryption-engine.spec.ts +9 -8
  250. package/src/encryption/encryption-engine.ts +14 -14
  251. package/src/encryption/encryption-service.ts +4 -5
  252. package/src/encryption/key-provider.ts +16 -19
  253. package/src/env.ts +9 -10
  254. package/src/gitpod-file-parser.spec.ts +55 -61
  255. package/src/gitpod-file-parser.ts +16 -17
  256. package/src/gitpod-service.ts +174 -109
  257. package/src/headless-workspace-log.ts +6 -4
  258. package/src/ide-frontend-service.ts +2 -2
  259. package/src/ide-protocol.ts +119 -0
  260. package/src/index.ts +16 -13
  261. package/src/installation-admin-protocol.ts +42 -0
  262. package/src/license-protocol.ts +5 -6
  263. package/src/messaging/browser/connection.ts +185 -21
  264. package/src/messaging/browser/window-connection.ts +39 -29
  265. package/src/messaging/client-call-metrics.ts +70 -71
  266. package/src/messaging/error.ts +6 -5
  267. package/src/messaging/handler.ts +13 -1
  268. package/src/messaging/node/connection.ts +23 -70
  269. package/src/messaging/proxy-factory.ts +32 -33
  270. package/src/oss-allowlist.ts +15 -0
  271. package/src/payment-protocol.ts +2 -2
  272. package/src/permission.ts +40 -33
  273. package/src/plans.ts +236 -189
  274. package/src/protocol.ts +280 -277
  275. package/src/snapshot-url.spec.ts +27 -0
  276. package/src/snapshot-url.ts +27 -0
  277. package/src/team-subscription-protocol.ts +33 -23
  278. package/src/teams-projects-protocol.ts +27 -9
  279. package/src/typings/globals.ts +4 -4
  280. package/src/util/analytics.ts +56 -18
  281. package/src/util/async-iterator.ts +4 -5
  282. package/src/util/cancelable.ts +3 -3
  283. package/src/util/date-time.ts +8 -8
  284. package/src/util/deferred.ts +6 -6
  285. package/src/util/disposable.ts +3 -6
  286. package/src/util/event.ts +9 -11
  287. package/src/util/garbage-collected-cache.ts +9 -6
  288. package/src/util/generate-workspace-id.spec.ts +26 -6
  289. package/src/util/generate-workspace-id.ts +458 -440
  290. package/src/util/gitpod-cookie.ts +38 -0
  291. package/src/util/gitpod-host-url.spec.ts +40 -13
  292. package/src/util/gitpod-host-url.ts +41 -38
  293. package/src/util/grpc.ts +4 -4
  294. package/src/util/jaeger-client-types.ts +102 -0
  295. package/src/util/logging.ts +109 -86
  296. package/src/util/make-link.ts +6 -7
  297. package/src/util/parse-workspace-id.spec.ts +37 -8
  298. package/src/util/parse-workspace-id.ts +32 -7
  299. package/src/util/queue.spec.ts +27 -25
  300. package/src/util/repeat.ts +45 -0
  301. package/src/util/semaphore.ts +4 -6
  302. package/src/util/skip-if.ts +9 -6
  303. package/src/util/timeutil.spec.ts +14 -15
  304. package/src/util/timeutil.ts +15 -11
  305. package/src/util/tracing.spec.ts +88 -0
  306. package/src/util/tracing.ts +202 -31
  307. package/src/util/workspace-port-authentication.ts +10 -13
  308. package/src/workspace-cluster.ts +26 -8
  309. package/src/workspace-instance.ts +53 -23
  310. package/src/wsready.ts +3 -3
  311. package/data/builtin-theia-plugins.json +0 -372
  312. package/lib/messaging/connection-error-handler.d.ts +0 -27
  313. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  314. package/lib/messaging/connection-error-handler.js +0 -46
  315. package/lib/messaging/connection-error-handler.js.map +0 -1
  316. package/lib/theia-plugins.d.ts +0 -11
  317. package/lib/theia-plugins.d.ts.map +0 -1
  318. package/lib/theia-plugins.js.map +0 -1
  319. package/lib/util/repeater.d.ts +0 -22
  320. package/lib/util/repeater.d.ts.map +0 -1
  321. package/lib/util/repeater.js +0 -118
  322. package/lib/util/repeater.js.map +0 -1
  323. package/lib/util/safe-promise.d.ts +0 -11
  324. package/lib/util/safe-promise.d.ts.map +0 -1
  325. package/lib/util/safe-promise.js +0 -34
  326. package/lib/util/safe-promise.js.map +0 -1
  327. package/src/messaging/connection-error-handler.ts +0 -62
  328. package/src/util/jaeger-client.d.ts +0 -105
  329. package/src/util/repeater.ts +0 -49
  330. package/src/util/safe-promise.ts +0 -26
@@ -14,71 +14,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
14
14
  step((generator = generator.apply(thisArg, _arguments || [])).next());
15
15
  });
16
16
  };
17
- var __generator = (this && this.__generator) || function (thisArg, body) {
18
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
- function verb(n) { return function (v) { return step([n, v]); }; }
21
- function step(op) {
22
- if (f) throw new TypeError("Generator is already executing.");
23
- while (_) try {
24
- 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;
25
- if (y = 0, t) op = [op[0] & 2, t.value];
26
- switch (op[0]) {
27
- case 0: case 1: t = op; break;
28
- case 4: _.label++; return { value: op[1], done: false };
29
- case 5: _.label++; y = op[1]; op = [0]; continue;
30
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
- default:
32
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
- if (t[2]) _.ops.pop();
37
- _.trys.pop(); continue;
38
- }
39
- op = body.call(thisArg, _);
40
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
- }
43
- };
44
- var __read = (this && this.__read) || function (o, n) {
45
- var m = typeof Symbol === "function" && o[Symbol.iterator];
46
- if (!m) return o;
47
- var i = m.call(o), r, ar = [], e;
48
- try {
49
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
50
- }
51
- catch (error) { e = { error: error }; }
52
- finally {
53
- try {
54
- if (r && !r.done && (m = i["return"])) m.call(i);
55
- }
56
- finally { if (e) throw e.error; }
57
- }
58
- return ar;
59
- };
60
- var __spread = (this && this.__spread) || function () {
61
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
62
- return ar;
63
- };
64
17
  Object.defineProperty(exports, "__esModule", { value: true });
65
18
  exports.JsonRpcProxyFactory = exports.JsonRpcConnectionHandler = void 0;
66
- var vscode_jsonrpc_1 = require("vscode-jsonrpc");
67
- var event_1 = require("../util/event");
68
- var logging_1 = require("../util/logging");
69
- var JsonRpcConnectionHandler = /** @class */ (function () {
70
- function JsonRpcConnectionHandler(path, targetFactory) {
19
+ const vscode_jsonrpc_1 = require("vscode-jsonrpc");
20
+ const event_1 = require("../util/event");
21
+ const logging_1 = require("../util/logging");
22
+ class JsonRpcConnectionHandler {
23
+ constructor(path, targetFactory) {
71
24
  this.path = path;
72
25
  this.targetFactory = targetFactory;
73
26
  }
74
- JsonRpcConnectionHandler.prototype.onConnection = function (connection, request) {
75
- var factory = new JsonRpcProxyFactory();
76
- var proxy = factory.createProxy();
27
+ onConnection(connection, request) {
28
+ const factory = new JsonRpcProxyFactory();
29
+ const proxy = factory.createProxy();
77
30
  factory.target = this.targetFactory(proxy, request);
78
31
  factory.listen(connection);
79
- };
80
- return JsonRpcConnectionHandler;
81
- }());
32
+ }
33
+ }
82
34
  exports.JsonRpcConnectionHandler = JsonRpcConnectionHandler;
83
35
  /**
84
36
  * Factory for JSON-RPC proxy objects.
@@ -122,57 +74,45 @@ exports.JsonRpcConnectionHandler = JsonRpcConnectionHandler;
122
74
  *
123
75
  * @param <T> - The type of the object to expose to JSON-RPC.
124
76
  */
125
- var JsonRpcProxyFactory = /** @class */ (function () {
77
+ class JsonRpcProxyFactory {
126
78
  /**
127
79
  * Build a new JsonRpcProxyFactory.
128
80
  *
129
81
  * @param target - The object to expose to JSON-RPC methods calls. If this
130
82
  * is omitted, the proxy won't be able to handle requests, only send them.
131
83
  */
132
- function JsonRpcProxyFactory(target) {
84
+ constructor(target) {
133
85
  this.target = target;
134
86
  this.onDidOpenConnectionEmitter = new event_1.Emitter();
135
87
  this.onDidCloseConnectionEmitter = new event_1.Emitter();
136
88
  this.waitForConnection();
137
89
  }
138
- JsonRpcProxyFactory.prototype.waitForConnection = function () {
139
- var _this = this;
140
- this.connectionPromise = new Promise(function (resolve) {
141
- return _this.connectionPromiseResolve = resolve;
142
- });
143
- this.connectionPromise.then(function (connection) {
144
- connection.onClose(function () {
145
- return _this.onDidCloseConnectionEmitter.fire(undefined);
146
- });
147
- _this.onDidOpenConnectionEmitter.fire(undefined);
90
+ waitForConnection() {
91
+ this.connectionPromise = new Promise((resolve) => (this.connectionPromiseResolve = resolve));
92
+ this.connectionPromise.then((connection) => {
93
+ connection.onClose(() => this.fireConnectionClosed());
94
+ this.fireConnectionOpened();
148
95
  });
149
- };
96
+ }
97
+ fireConnectionClosed() {
98
+ this.onDidCloseConnectionEmitter.fire(undefined);
99
+ }
100
+ fireConnectionOpened() {
101
+ this.onDidOpenConnectionEmitter.fire(undefined);
102
+ }
150
103
  /**
151
104
  * Connect a MessageConnection to the factory.
152
105
  *
153
106
  * This connection will be used to send/receive JSON-RPC requests and
154
107
  * response.
155
108
  */
156
- JsonRpcProxyFactory.prototype.listen = function (connection) {
157
- var _this = this;
158
- connection.onRequest(function (method) {
159
- var params = [];
160
- for (var _i = 1; _i < arguments.length; _i++) {
161
- params[_i - 1] = arguments[_i];
162
- }
163
- return _this.onRequest.apply(_this, __spread([method], params));
164
- });
165
- connection.onNotification(function (method) {
166
- var params = [];
167
- for (var _i = 1; _i < arguments.length; _i++) {
168
- params[_i - 1] = arguments[_i];
169
- }
170
- return _this.onNotification.apply(_this, __spread([method], params));
171
- });
172
- connection.onDispose(function () { return _this.waitForConnection(); });
109
+ listen(connection) {
110
+ connection.onRequest((method, ...params) => this.onRequest(method, ...params));
111
+ connection.onNotification((method, ...params) => this.onNotification(method, ...params));
112
+ connection.onDispose(() => this.waitForConnection());
173
113
  connection.listen();
174
114
  this.connectionPromiseResolve(connection);
175
- };
115
+ }
176
116
  /**
177
117
  * Process an incoming JSON-RPC method call.
178
118
  *
@@ -185,50 +125,33 @@ var JsonRpcProxyFactory = /** @class */ (function () {
185
125
  *
186
126
  * @returns A promise of the method call completion.
187
127
  */
188
- JsonRpcProxyFactory.prototype.onRequest = function (method) {
189
- var args = [];
190
- for (var _i = 1; _i < arguments.length; _i++) {
191
- args[_i - 1] = arguments[_i];
192
- }
193
- return __awaiter(this, void 0, void 0, function () {
194
- var e_1;
195
- var _a;
196
- return __generator(this, function (_b) {
197
- switch (_b.label) {
198
- case 0:
199
- _b.trys.push([0, 2, , 3]);
200
- return [4 /*yield*/, (_a = this.target)[method].apply(_a, __spread(args))];
201
- case 1: return [2 /*return*/, _b.sent()];
202
- case 2:
203
- e_1 = _b.sent();
204
- if (e_1 instanceof vscode_jsonrpc_1.ResponseError) {
205
- logging_1.log.info("Request " + method + " unsuccessful: " + e_1.code + "/\"" + e_1.message + "\"", { method: method, args: args });
206
- }
207
- else {
208
- logging_1.log.error("Request " + method + " failed with internal server error", e_1, { method: method, args: args });
209
- }
210
- throw e_1;
211
- case 3: return [2 /*return*/];
128
+ onRequest(method, ...args) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ try {
131
+ return yield this.target[method](...args);
132
+ }
133
+ catch (e) {
134
+ if (e instanceof vscode_jsonrpc_1.ResponseError) {
135
+ logging_1.log.info(`Request ${method} unsuccessful: ${e.code}/"${e.message}"`, { method, args });
212
136
  }
213
- });
137
+ else {
138
+ logging_1.log.error(`Request ${method} failed with internal server error`, e, { method, args });
139
+ }
140
+ throw e;
141
+ }
214
142
  });
215
- };
143
+ }
216
144
  /**
217
145
  * Process an incoming JSON-RPC notification.
218
146
  *
219
147
  * Same as [[onRequest]], but called on incoming notifications rather than
220
148
  * methods calls.
221
149
  */
222
- JsonRpcProxyFactory.prototype.onNotification = function (method) {
223
- var _a;
224
- var args = [];
225
- for (var _i = 1; _i < arguments.length; _i++) {
226
- args[_i - 1] = arguments[_i];
227
- }
150
+ onNotification(method, ...args) {
228
151
  if (this.target[method]) {
229
- (_a = this.target)[method].apply(_a, __spread(args));
152
+ this.target[method](...args);
230
153
  }
231
- };
154
+ }
232
155
  /**
233
156
  * Create a Proxy exposing the interface of an object of type T. This Proxy
234
157
  * can be used to do JSON-RPC method calls on the remote target object as
@@ -236,10 +159,10 @@ var JsonRpcProxyFactory = /** @class */ (function () {
236
159
  *
237
160
  * If `T` implements `JsonRpcServer` then a client is used as a target object for a remote target object.
238
161
  */
239
- JsonRpcProxyFactory.prototype.createProxy = function () {
240
- var result = new Proxy(this, this);
162
+ createProxy() {
163
+ const result = new Proxy(this, this);
241
164
  return result;
242
- };
165
+ }
243
166
  /**
244
167
  * Get a callable object that executes a JSON-RPC method call.
245
168
  *
@@ -262,46 +185,35 @@ var JsonRpcProxyFactory = /** @class */ (function () {
262
185
  * @param receiver - unused.
263
186
  * @returns A callable that executes the JSON-RPC call.
264
187
  */
265
- JsonRpcProxyFactory.prototype.get = function (target, p, receiver) {
266
- var _this = this;
267
- if (p === 'setClient') {
268
- return function (client) {
269
- _this.target = client;
188
+ get(target, p, receiver) {
189
+ if (p === "setClient") {
190
+ return (client) => {
191
+ this.target = client;
270
192
  };
271
193
  }
272
- if (p === 'onDidOpenConnection') {
194
+ if (p === "onDidOpenConnection") {
273
195
  return this.onDidOpenConnectionEmitter.event;
274
196
  }
275
- if (p === 'onDidCloseConnection') {
197
+ if (p === "onDidCloseConnection") {
276
198
  return this.onDidCloseConnectionEmitter.event;
277
199
  }
278
- var isNotify = this.isNotification(p);
279
- return function () {
280
- var args = [];
281
- for (var _i = 0; _i < arguments.length; _i++) {
282
- args[_i] = arguments[_i];
200
+ const isNotify = this.isNotification(p);
201
+ return (...args) => this.connectionPromise.then((connection) => new Promise((resolve, reject) => {
202
+ try {
203
+ if (isNotify) {
204
+ connection.sendNotification(p.toString(), ...args);
205
+ resolve(undefined);
206
+ }
207
+ else {
208
+ const resultPromise = connection.sendRequest(p.toString(), ...args);
209
+ resultPromise.catch((err) => reject(err)).then((result) => resolve(result));
210
+ }
283
211
  }
284
- return _this.connectionPromise.then(function (connection) {
285
- return new Promise(function (resolve, reject) {
286
- try {
287
- if (isNotify) {
288
- connection.sendNotification.apply(connection, __spread([p.toString()], args));
289
- resolve(undefined);
290
- }
291
- else {
292
- var resultPromise = connection.sendRequest.apply(connection, __spread([p.toString()], args));
293
- resultPromise
294
- .catch(function (err) { return reject(err); })
295
- .then(function (result) { return resolve(result); });
296
- }
297
- }
298
- catch (err) {
299
- reject(err);
300
- }
301
- });
302
- });
303
- };
304
- };
212
+ catch (err) {
213
+ reject(err);
214
+ }
215
+ }));
216
+ }
305
217
  /**
306
218
  * Return whether the given property represents a notification.
307
219
  *
@@ -311,10 +223,9 @@ var JsonRpcProxyFactory = /** @class */ (function () {
311
223
  * @param p - The property being called on the proxy.
312
224
  * @return Whether `p` represents a notification.
313
225
  */
314
- JsonRpcProxyFactory.prototype.isNotification = function (p) {
226
+ isNotification(p) {
315
227
  return p.toString().startsWith("notify") || p.toString().startsWith("on");
316
- };
317
- return JsonRpcProxyFactory;
318
- }());
228
+ }
229
+ }
319
230
  exports.JsonRpcProxyFactory = JsonRpcProxyFactory;
320
231
  //# sourceMappingURL=proxy-factory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"proxy-factory.js","sourceRoot":"","sources":["../../src/messaging/proxy-factory.ts"],"names":[],"m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C,GAAG,CAAC,CAAC;aACf;QACL,CAAC,CAAC,CACT,CAAC;IACV,CAAC;IAED;;;;;;;;OAQG;IACO,cAAc,CAAC,CAAc;QACnC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9E,CAAC;CACJ;AAlKD,kDAkKC"}
@@ -0,0 +1,14 @@
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
+ export interface OssAllowList {
7
+ /**
8
+ * A string that identifies a GitHub/GitLab/Bitbucket identity of the form "<host>/<profilename>"
9
+ * E.g., "github.com/geropl"
10
+ */
11
+ identity: string;
12
+ deleted?: boolean;
13
+ }
14
+ //# sourceMappingURL=oss-allowlist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oss-allowlist.d.ts","sourceRoot":"","sources":["../src/oss-allowlist.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,8 @@
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
+ //# sourceMappingURL=oss-allowlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oss-allowlist.js","sourceRoot":"","sources":["../src/oss-allowlist.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1 +1 @@
1
- {"version":3,"file":"payment-protocol.d.ts","sourceRoot":"","sources":["../src/payment-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEF,yBAAiB,eAAe,CAAC;IACvB,MAAM,+BAA+B,uBAAuB,CAAA;CACtE;AAED,MAAM,WAAW,UAAU;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"payment-protocol.d.ts","sourceRoot":"","sources":["../src/payment-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yBAAiB,eAAe,CAAC;IACtB,MAAM,+BAA+B,uBAAuB,CAAC;CACvE;AAED,MAAM,WAAW,UAAU;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAClB"}
@@ -8,6 +8,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.PaymentProtocol = void 0;
9
9
  var PaymentProtocol;
10
10
  (function (PaymentProtocol) {
11
- PaymentProtocol.UPDATE_GITPOD_SUBSCRIPTION_PATH = '/payment/chargebee';
11
+ PaymentProtocol.UPDATE_GITPOD_SUBSCRIPTION_PATH = "/payment/chargebee";
12
12
  })(PaymentProtocol = exports.PaymentProtocol || (exports.PaymentProtocol = {}));
13
13
  //# sourceMappingURL=payment-protocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"payment-protocol.js","sourceRoot":"","sources":["../src/payment-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEF,IAAiB,eAAe,CAEhC;AAFA,WAAiB,eAAe;IAChB,+CAA+B,GAAG,oBAAoB,CAAA;AACvE,CAAC,EAFiB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAEhC"}
1
+ {"version":3,"file":"payment-protocol.js","sourceRoot":"","sources":["../src/payment-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,IAAiB,eAAe,CAE/B;AAFD,WAAiB,eAAe;IACf,+CAA+B,GAAG,oBAAoB,CAAC;AACxE,CAAC,EAFgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAE/B"}
@@ -10,18 +10,18 @@ export declare const Permissions: {
10
10
  "registry-access": undefined;
11
11
  "admin-users": undefined;
12
12
  "admin-workspaces": undefined;
13
+ "admin-projects": undefined;
13
14
  "admin-api": undefined;
14
15
  "ide-settings": undefined;
15
16
  "new-workspace-cluster": undefined;
16
- "teams-and-projects": undefined;
17
17
  };
18
- export declare type PermissionName = keyof (typeof Permissions);
18
+ export declare type PermissionName = keyof typeof Permissions;
19
19
  export declare const Roles: {
20
20
  devops: undefined;
21
21
  viewer: undefined;
22
22
  admin: undefined;
23
23
  };
24
- export declare type RoleName = keyof (typeof Roles);
24
+ export declare type RoleName = keyof typeof Roles;
25
25
  export declare type RoleOrPermission = RoleName | PermissionName;
26
26
  export declare namespace RoleName {
27
27
  const is: (o: any) => o is "devops" | "viewer" | "admin";
@@ -30,6 +30,9 @@ export interface Role {
30
30
  name: RoleName;
31
31
  permissions: PermissionName[];
32
32
  }
33
+ export declare namespace RolesOrPermissions {
34
+ function toPermissionSet(rolesOrPermissions: RoleOrPermission[] | undefined): Set<PermissionName>;
35
+ }
33
36
  export declare namespace Permission {
34
37
  /** The permission to monitor the (live) state of a Gitpod installation */
35
38
  const MONITOR: PermissionName;
@@ -41,11 +44,13 @@ export declare namespace Permission {
41
44
  const ADMIN_USERS: PermissionName;
42
45
  /** The permission for accessing all workspace data */
43
46
  const ADMIN_WORKSPACES: PermissionName;
47
+ /** The permission for accessing all projects data */
48
+ const ADMIN_PROJECTS: PermissionName;
44
49
  /** The permission to access the admin API */
45
50
  const ADMIN_API: PermissionName;
46
51
  /** The permission to access the IDE settings */
47
52
  const IDE_SETTINGS: PermissionName;
48
- const is: (o: any) => o is "monitor" | "enforcement" | "privileged-ws" | "registry-access" | "admin-users" | "admin-workspaces" | "admin-api" | "ide-settings" | "new-workspace-cluster" | "teams-and-projects";
53
+ const is: (o: any) => o is "monitor" | "enforcement" | "privileged-ws" | "registry-access" | "admin-users" | "admin-workspaces" | "admin-projects" | "admin-api" | "ide-settings" | "new-workspace-cluster";
49
54
  const all: () => PermissionName[];
50
55
  }
51
56
  export declare namespace Role {
@@ -1 +1 @@
1
- {"version":3,"file":"permission.d.ts","sourceRoot":"","sources":["../src/permission.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,eAAO,MAAM,WAAW;;;;;;;;;;;CAWvB,CAAC;AACF,oBAAY,cAAc,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AACxD,eAAO,MAAM,KAAK;;;;CAAkE,CAAC;AACrF,oBAAY,QAAQ,GAAG,MAAM,CAAC,OAAO,KAAK,CAAC,CAAC;AAC5C,oBAAY,gBAAgB,GAAG,QAAQ,GAAG,cAAc,CAAC;AAEzD,yBAAiB,QAAQ,CAAC;IACf,MAAM,EAAE,MAAO,GAAG,uCAGxB,CAAA;CACJ;AAED,MAAM,WAAW,IAAI;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,cAAc,EAAE,CAAC;CACjC;AAED,yBAAiB,UAAU,CAAC;IACxB,0EAA0E;IACnE,MAAM,OAAO,EAAE,cAA0B,CAAC;IAEjD,uEAAuE;IAChE,MAAM,WAAW,EAAE,cAA8B,CAAC;IAEzD,sGAAsG;IAC/F,MAAM,eAAe,EAAE,cAAkC,CAAC;IAEjE,iDAAiD;IAC1C,MAAM,WAAW,EAAE,cAA8B,CAAC;IAEzD,sDAAsD;IAC/C,MAAM,gBAAgB,EAAE,cAAmC,CAAC;IAEnE,6CAA6C;IACtC,MAAM,SAAS,EAAE,cAA4B,CAAC;IAErD,gDAAgD;IACzC,MAAM,YAAY,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AW,EAAE,cAA8B,CAAC;IAEzD,sDAAsD;IAC/C,MAAM,gBAAgB,EAAE,cAAmC,CAAC;IAEnE,qDAAqD;IAC9C,MAAM,cAAc,EAAE,cAAiC,CAAC;IAE/D,6CAA6C;IACtC,MAAM,SAAS,EAAE,cAA4B,CAAC;IAErD,gDAAgD;IACzC,MAAM,YAAY,EAAE,cAA+B,CAAC;IAEpD,MAAM,EAAE,MAAO,GAAG,0LAExB,CAAC;IAEK,MAAM,GAAG,QAAO,cAAc,EAEpC,CAAC;CACL;AAED,yBAAiB,IAAI,CAAC;IAClB,iDAAiD;IAC1C,MAAM,MAAM,EAAE,IAGpB,CAAC;IAEF,kEAAkE;IAC3D,MAAM,MAAM,EAAE,IAGpB,CAAC;IAEK,MAAM,KAAK,EAAE,IASnB,CAAC;IAEK,MAAM,SAAS,SAAU,QAAQ,KAAG,IAM1C,CAAC;IAEK,MAAM,GAAG,QAAO,IAAI,EAI1B,CAAC;CACL"}
package/lib/permission.js CHANGED
@@ -5,28 +5,44 @@
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Role = exports.Permission = exports.RoleName = exports.Roles = exports.Permissions = void 0;
8
+ exports.Role = exports.Permission = exports.RolesOrPermissions = exports.RoleName = exports.Roles = exports.Permissions = void 0;
9
9
  // see below for explanation
10
10
  exports.Permissions = {
11
- "monitor": undefined,
12
- "enforcement": undefined,
11
+ monitor: undefined,
12
+ enforcement: undefined,
13
13
  "privileged-ws": undefined,
14
14
  "registry-access": undefined,
15
15
  "admin-users": undefined,
16
16
  "admin-workspaces": undefined,
17
+ "admin-projects": undefined,
17
18
  "admin-api": undefined,
18
19
  "ide-settings": undefined,
19
20
  "new-workspace-cluster": undefined,
20
- "teams-and-projects": undefined,
21
21
  };
22
- exports.Roles = { "devops": undefined, "viewer": undefined, "admin": undefined };
22
+ exports.Roles = { devops: undefined, viewer: undefined, admin: undefined };
23
23
  var RoleName;
24
24
  (function (RoleName) {
25
- RoleName.is = function (o) {
26
- return typeof (o) === 'string'
27
- && Role.all().some(function (r) { return r.name === o; });
25
+ RoleName.is = (o) => {
26
+ return typeof o === "string" && Role.all().some((r) => r.name === o);
28
27
  };
29
28
  })(RoleName = exports.RoleName || (exports.RoleName = {}));
29
+ var RolesOrPermissions;
30
+ (function (RolesOrPermissions) {
31
+ function toPermissionSet(rolesOrPermissions) {
32
+ rolesOrPermissions = rolesOrPermissions || [];
33
+ const permissions = new Set();
34
+ for (const rop of rolesOrPermissions) {
35
+ if (Permission.is(rop)) {
36
+ permissions.add(rop);
37
+ }
38
+ else if (RoleName.is(rop)) {
39
+ Role.getByName(rop).permissions.forEach((p) => permissions.add(p));
40
+ }
41
+ }
42
+ return permissions;
43
+ }
44
+ RolesOrPermissions.toPermissionSet = toPermissionSet;
45
+ })(RolesOrPermissions = exports.RolesOrPermissions || (exports.RolesOrPermissions = {}));
30
46
  var Permission;
31
47
  (function (Permission) {
32
48
  /** The permission to monitor the (live) state of a Gitpod installation */
@@ -39,18 +55,17 @@ var Permission;
39
55
  Permission.ADMIN_USERS = "admin-users";
40
56
  /** The permission for accessing all workspace data */
41
57
  Permission.ADMIN_WORKSPACES = "admin-workspaces";
58
+ /** The permission for accessing all projects data */
59
+ Permission.ADMIN_PROJECTS = "admin-projects";
42
60
  /** The permission to access the admin API */
43
61
  Permission.ADMIN_API = "admin-api";
44
62
  /** The permission to access the IDE settings */
45
63
  Permission.IDE_SETTINGS = "ide-settings";
46
- Permission.is = function (o) {
47
- return typeof (o) === 'string'
48
- && Permission.all().some(function (p) { return p === o; });
64
+ Permission.is = (o) => {
65
+ return typeof o === "string" && Permission.all().some((p) => p === o);
49
66
  };
50
- Permission.all = function () {
51
- return Object.keys(Permission)
52
- .map(function (k) { return Permission[k]; })
53
- .filter(function (k) { return typeof (k) === 'string'; });
67
+ Permission.all = () => {
68
+ return Object.keys(exports.Permissions);
54
69
  };
55
70
  })(Permission = exports.Permission || (exports.Permission = {}));
56
71
  var Role;
@@ -58,41 +73,34 @@ var Role;
58
73
  /** The default role for all Gitpod developers */
59
74
  Role.DEVOPS = {
60
75
  name: "devops",
61
- permissions: [
62
- Permission.MONITOR,
63
- Permission.ENFORCEMENT,
64
- Permission.REGISTRY_ACCESS,
65
- Permission.IDE_SETTINGS
66
- ]
76
+ permissions: [Permission.MONITOR, Permission.ENFORCEMENT, Permission.REGISTRY_ACCESS, Permission.IDE_SETTINGS],
67
77
  };
68
78
  /** A role for people that are allowed to view Gitpod internals */
69
79
  Role.VIEWER = {
70
80
  name: "viewer",
71
- permissions: [
72
- Permission.MONITOR,
73
- Permission.REGISTRY_ACCESS,
74
- ]
81
+ permissions: [Permission.MONITOR, Permission.REGISTRY_ACCESS],
75
82
  };
76
83
  Role.ADMIN = {
77
84
  name: "admin",
78
85
  permissions: [
79
86
  Permission.ADMIN_USERS,
80
87
  Permission.ADMIN_WORKSPACES,
88
+ Permission.ADMIN_PROJECTS,
81
89
  Permission.ADMIN_API,
82
90
  Permission.ENFORCEMENT,
83
- ]
91
+ ],
84
92
  };
85
- Role.getByName = function (name) {
86
- var result = Role.all().find(function (r) { return r.name === name; });
93
+ Role.getByName = (name) => {
94
+ const result = Role.all().find((r) => r.name === name);
87
95
  if (!result) {
88
96
  throw Error("Unknown RoleName: " + name);
89
97
  }
90
98
  return result;
91
99
  };
92
- Role.all = function () {
100
+ Role.all = () => {
93
101
  return Object.keys(Role)
94
- .map(function (k) { return Role[k]; })
95
- .filter(function (k) { return typeof (k) === 'object'; });
102
+ .map((k) => Role[k])
103
+ .filter((k) => typeof k === "object");
96
104
  };
97
105
  })(Role = exports.Role || (exports.Role = {}));
98
106
  //# sourceMappingURL=permission.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"permission.js","sourceRoot":"","sources":["../src/permission.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,4BAA4B;AACf,QAAA,WAAW,GAAG;IACvB,SAAS,EAAE,SAAS;IACpB,aAAa,EAA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AAY,CAAC,CAAC,CAAC,CAAC;aAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;IAC9C,CAAC,CAAC;AACN,CAAC,EArCgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAqCpB"}
package/lib/plans.d.ts CHANGED
@@ -3,7 +3,7 @@
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
  */
6
- export declare type Currency = 'USD' | 'EUR';
6
+ export declare type Currency = "USD" | "EUR";
7
7
  export declare namespace Currency {
8
8
  const getAll: () => Currency[];
9
9
  const getSymbol: (c: Currency) => "$" | "€";
@@ -11,8 +11,8 @@ export declare namespace Currency {
11
11
  /**
12
12
  * Different plans of the same type MAY have different prices ($/€, for example) but MUST have the same feature set.
13
13
  */
14
- export declare type PlanType = 'free' | 'free-50' | 'free-open-source' | 'student' | 'basic' | 'personal' | 'professional' | 'professional-new';
15
- export declare type HoursPerMonthType = number | 'unlimited';
14
+ export declare type PlanType = "free" | "free-50" | "free-open-source" | "student" | "basic" | "personal" | "professional" | "professional-new";
15
+ export declare type HoursPerMonthType = number | "unlimited";
16
16
  export interface Plan {
17
17
  chargebeeId: string;
18
18
  githubId?: number;
@@ -163,7 +163,7 @@ export declare namespace Plans {
163
163
  * This function returns all individual plans that might be active (= we have subscriptions for) at the moment
164
164
  */
165
165
  function getAvailablePlans(currency: Currency): Plan[];
166
- const getAvailableTeamPlans: (currency?: "USD" | "EUR" | undefined) => Plan[];
166
+ const getAvailableTeamPlans: (currency?: Currency | undefined) => Plan[];
167
167
  function getById(id: string | undefined): Plan | undefined;
168
168
  function getByTypeAndCurrency(type: PlanType, currency: Currency): Plan | undefined;
169
169
  function getProPlan(currency: Currency): Plan;