@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
package/lib/auth.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
4
+ * Licensed under the GNU Affero General Public License (AGPL).
5
+ * See License-AGPL.txt in the project root for license information.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.SelectAccountPayload = void 0;
9
+ var SelectAccountPayload;
10
+ (function (SelectAccountPayload) {
11
+ function is(data) {
12
+ return typeof data === "object" && "currentUser" in data && "otherUser" in data;
13
+ }
14
+ SelectAccountPayload.is = is;
15
+ })(SelectAccountPayload = exports.SelectAccountPayload || (exports.SelectAccountPayload = {}));
16
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAkBH,IAAiB,oBAAoB,CAIpC;AAJD,WAAiB,oBAAoB;IACjC,SAAgB,EAAE,CAAC,IAAS;QACxB,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,aAAa,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,CAAC;IACpF,CAAC;IAFe,uBAAE,KAEjB,CAAA;AACL,CAAC,EAJgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAIpC"}
@@ -0,0 +1,18 @@
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
+ export declare namespace ContextURL {
7
+ const INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
8
+ const PREBUILD_PREFIX = "prebuild";
9
+ const IMAGEBUILD_PREFIX = "imagebuild";
10
+ /**
11
+ * The field "contextUrl" might contain prefixes like:
12
+ * - envvar1=value1/...
13
+ * - prebuild/...
14
+ * This is the analogon to the (Prefix)ContextParser structure in "server".
15
+ */
16
+ function parseToURL(contextUrl: string | undefined): URL | undefined;
17
+ }
18
+ //# sourceMappingURL=context-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-url.d.ts","sourceRoot":"","sources":["../src/context-url.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yBAAiB,UAAU,CAAC;IACnB,MAAM,2BAA2B,yBAAyB,CAAC;IAC3D,MAAM,eAAe,aAAa,CAAC;IACnC,MAAM,iBAAiB,eAAe,CAAC;IAE9C;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,CAgC1E;CACF"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
+ * Licensed under the GNU Affero General Public License (AGPL).
5
+ * See License-AGPL.txt in the project root for license information.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ContextURL = void 0;
9
+ var ContextURL;
10
+ (function (ContextURL) {
11
+ ContextURL.INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
12
+ ContextURL.PREBUILD_PREFIX = "prebuild";
13
+ ContextURL.IMAGEBUILD_PREFIX = "imagebuild";
14
+ /**
15
+ * The field "contextUrl" might contain prefixes like:
16
+ * - envvar1=value1/...
17
+ * - prebuild/...
18
+ * This is the analogon to the (Prefix)ContextParser structure in "server".
19
+ */
20
+ function parseToURL(contextUrl) {
21
+ if (contextUrl === undefined) {
22
+ return undefined;
23
+ }
24
+ const segments = contextUrl.split("/");
25
+ if (segments.length === 1) {
26
+ return new URL(segments[0]); // this might be something, we just try
27
+ }
28
+ const segmentsToURL = (offset) => {
29
+ let rest = segments.slice(offset).join("/");
30
+ if (!rest.startsWith("http")) {
31
+ rest = 'https://' + rest;
32
+ }
33
+ return new URL(rest);
34
+ };
35
+ const firstSegment = segments[0];
36
+ if (firstSegment === ContextURL.PREBUILD_PREFIX ||
37
+ firstSegment === ContextURL.INCREMENTAL_PREBUILD_PREFIX ||
38
+ firstSegment === ContextURL.IMAGEBUILD_PREFIX) {
39
+ return segmentsToURL(1);
40
+ }
41
+ // check for env vars
42
+ if (firstSegment.indexOf("=") !== -1) {
43
+ return segmentsToURL(1);
44
+ }
45
+ return segmentsToURL(0);
46
+ }
47
+ ContextURL.parseToURL = parseToURL;
48
+ })(ContextURL = exports.ContextURL || (exports.ContextURL = {}));
49
+ //# sourceMappingURL=context-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-url.js","sourceRoot":"","sources":["../src/context-url.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,IAAiB,UAAU,CA4C1B;AA5CD,WAAiB,UAAU;IACZ,sCAA2B,GAAG,sBAAsB,CAAC;IACrD,0BAAe,GAAG,UAAU,CAAC;IAC7B,4BAAiB,GAAG,YAAY,CAAC;IAE9C;;;;;OAKG;IACH,SAAgB,UAAU,CAAC,UAA8B;QACvD,IAAI,UAAU,KAAK,SAAS,EAAE;YAC5B,OAAO,SAAS,CAAC;SAClB;QAED,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,uCAAuC;SACtE;QAED,MAAM,aAAa,GAAG,CAAC,MAAc,EAAO,EAAE;YAC5C,IAAI,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;gBAC5B,IAAI,GAAG,UAAU,GAAG,IAAI,CAAC;aAC1B;YACD,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC,CAAC;QAGF,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACjC,IAAI,YAAY,KAAK,WAAA,eAAe;YAChC,YAAY,KAAK,WAAA,2BAA2B;YAC5C,YAAY,KAAK,WAAA,iBAAiB,EAAE;YACtC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;SACzB;QAED,qBAAqB;QACrB,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;YACpC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;SACzB;QAED,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAhCe,qBAAU,aAgCzB,CAAA;AACH,CAAC,EA5CgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA4C1B"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+ export declare class ContextUrlTest {
7
+ parseContextUrl_withEnvVar(): void;
8
+ parseContextUrl_withEnvVar_withoutSchema(): void;
9
+ parseContextUrl_withPrebuild(): void;
10
+ parseContextUrl_withPrebuild_withoutSchema(): void;
11
+ }
12
+ //# sourceMappingURL=context-url.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-url.spec.d.ts","sourceRoot":"","sources":["../src/context-url.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,qBACa,cAAc;IAEV,0BAA0B;IAM1B,wCAAwC;IAMxC,4BAA4B;IAM5B,0CAA0C;CAK1D"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
+ * Licensed under the GNU Affero General Public License (AGPL).
5
+ * See License-AGPL.txt in the project root for license information.
6
+ */
7
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
8
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
12
+ };
13
+ var __metadata = (this && this.__metadata) || function (k, v) {
14
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ContextUrlTest = void 0;
18
+ const chai = require("chai");
19
+ const mocha_typescript_1 = require("mocha-typescript");
20
+ const context_url_1 = require("./context-url");
21
+ const expect = chai.expect;
22
+ let ContextUrlTest = class ContextUrlTest {
23
+ parseContextUrl_withEnvVar() {
24
+ const actual = context_url_1.ContextURL.parseToURL("passedin=test%20value/https://github.com/gitpod-io/gitpod-test-repo");
25
+ expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
26
+ expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
27
+ }
28
+ parseContextUrl_withEnvVar_withoutSchema() {
29
+ const actual = context_url_1.ContextURL.parseToURL("passedin=test%20value/github.com/gitpod-io/gitpod-test-repo");
30
+ expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
31
+ expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
32
+ }
33
+ parseContextUrl_withPrebuild() {
34
+ const actual = context_url_1.ContextURL.parseToURL("prebuild/https://github.com/gitpod-io/gitpod-test-repo");
35
+ expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
36
+ expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
37
+ }
38
+ parseContextUrl_withPrebuild_withoutSchema() {
39
+ const actual = context_url_1.ContextURL.parseToURL("prebuild/github.com/gitpod-io/gitpod-test-repo");
40
+ expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
41
+ expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
42
+ }
43
+ };
44
+ __decorate([
45
+ mocha_typescript_1.test,
46
+ __metadata("design:type", Function),
47
+ __metadata("design:paramtypes", []),
48
+ __metadata("design:returntype", void 0)
49
+ ], ContextUrlTest.prototype, "parseContextUrl_withEnvVar", null);
50
+ __decorate([
51
+ mocha_typescript_1.test,
52
+ __metadata("design:type", Function),
53
+ __metadata("design:paramtypes", []),
54
+ __metadata("design:returntype", void 0)
55
+ ], ContextUrlTest.prototype, "parseContextUrl_withEnvVar_withoutSchema", null);
56
+ __decorate([
57
+ mocha_typescript_1.test,
58
+ __metadata("design:type", Function),
59
+ __metadata("design:paramtypes", []),
60
+ __metadata("design:returntype", void 0)
61
+ ], ContextUrlTest.prototype, "parseContextUrl_withPrebuild", null);
62
+ __decorate([
63
+ mocha_typescript_1.test,
64
+ __metadata("design:type", Function),
65
+ __metadata("design:paramtypes", []),
66
+ __metadata("design:returntype", void 0)
67
+ ], ContextUrlTest.prototype, "parseContextUrl_withPrebuild_withoutSchema", null);
68
+ ContextUrlTest = __decorate([
69
+ mocha_typescript_1.suite
70
+ ], ContextUrlTest);
71
+ exports.ContextUrlTest = ContextUrlTest;
72
+ module.exports = new ContextUrlTest();
73
+ //# sourceMappingURL=context-url.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-url.spec.js","sourceRoot":"","sources":["../src/context-url.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,6BAA6B;AAC7B,uDAA+C;AAC/C,+CAA2C;AAC3C,MAAM,MAAM,GAAG,IAAI,CA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C,YAAY,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACrE,CAAC;CACJ,CAAA;AAvBS;IAAL,uBAAI;;;;gEAIJ;AAEK;IAAL,uBAAI;;;;8EAIJ;AAEK;IAAL,uBAAI;;;;kEAIJ;AAEK;IAAL,uBAAI;;;;gFAIJ;AAxBQ,cAAc;IAD1B,wBAAK;GACO,cAAc,CAyB1B;AAzBY,wCAAc;AA0B3B,MAAM,CAAC,OAAO,GAAG,IAAI,cAAc,EAAE,CAAA"}
@@ -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
  */
@@ -44,6 +44,6 @@ export declare type EMail = {
44
44
  params: EMailParameters;
45
45
  } & EMailStatus;
46
46
  export declare namespace EMail {
47
- const create: (ts: Pick<EMail, "userId" | "recipientAddress" | "campaignId" | "params" | "scheduledInternalTime" | "scheduledSendgridTime" | "error">) => EMail;
47
+ const create: (ts: Omit<EMail, 'uid'>) => EMail;
48
48
  }
49
49
  //# sourceMappingURL=email-protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-protocol.d.ts","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,oBAAY,UAAU,GAAG,mBAAmB,GACtC,mBAAmB,CAAC;AAE1B,MAAM,WAAW,WAAW;IACxB,wDAAwD;IACxD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mEAAmE;IACnE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,yBAAiB,WAAW,CAAC;IACzB,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AW,YAAY;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC5B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,aAAa,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,0BAA0B;IAC1B,cAAc,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACvC,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,cAAc,EAAE,EAAE,CAAC;CACtB;AAED,oBAAY,KAAK,GAAG;IAChB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,MAAM,EAAE,eAAe,CAAC;CAC3B,GAAG,WAAW,CAAC;AAEhB,yBAAiB,KAAK,CAAC;IACZ,MAAM,MAAM,OAAQ,KAAK,KAAK,EAAE,KAAK,CAAC,KAAG,KAI/C,CAAA;CACJ"}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
4
  * Licensed under the GNU Affero General Public License (AGPL).
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- var uuidv4 = require("uuid/v4");
8
+ exports.EMail = exports.EMailStatus = void 0;
9
+ const uuid_1 = require("uuid");
9
10
  var EMailStatus;
10
11
  (function (EMailStatus) {
11
12
  function getState(status) {
@@ -18,9 +19,9 @@ var EMailStatus;
18
19
  })(EMailStatus = exports.EMailStatus || (exports.EMailStatus = {}));
19
20
  var EMail;
20
21
  (function (EMail) {
21
- EMail.create = function (ts) {
22
- var withId = ts;
23
- withId.uid = uuidv4();
22
+ EMail.create = (ts) => {
23
+ const withId = ts;
24
+ withId.uid = (0, uuid_1.v4)();
24
25
  return withId;
25
26
  };
26
27
  })(EMail = exports.EMail || (exports.EMail = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"email-protocol.js","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAGH,gCAAmC;AAanC,IAAiB,WAAW,CAO3B;AAPD,WAAiB,WAAW;IACxB,SAAgB,QAAQ,CAAC,MAAmB;QACxC,IAAI,MAAM,CAAC,qBAAqB,EAAE;YAC9B,OAAO,mBAAmB,CAAC;SAC9B;QACD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IALe,oBAAQ,WAKvB,CAAA;AACL,CAAC,EAPgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAO3B;AAiCD,IAAiB,KAAK,CAMrB;AAND,WAAiB,KAAK;IACL,YAAM,GAAG,UAAC,EAAyB;QAC5C,IAAM,MAAM,GAAG,EAAW,CAAC;QAC3B,MAAM,CAAC,GAAG,GAAG,MAAM,EAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAClB,CAAC,CAAA;AACL,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB"}
1
+ {"version":3,"file":"email-protocol.js","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+BAAoC;AAapC,IAAiB,WAAW,CAO3B;AAPD,WAAiB,WAAW;IACxB,SAAgB,QAAQ,CAAC,MAAmB;QACxC,IAAI,MAAM,CAAC,qBAAqB,EAAE;YAC9B,OAAO,mBAAmB,CAAC;SAC9B;QACD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IALe,oBAAQ,WAKvB,CAAA;AACL,CAAC,EAPgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAO3B;AAiCD,IAAiB,KAAK,CAMrB;AAND,WAAiB,KAAK;IACL,YAAM,GAAG,CAAC,EAAsB,EAAS,EAAE;QACpD,MAAM,MAAM,GAAG,EAAW,CAAC;QAC3B,MAAM,CAAC,GAAG,GAAG,IAAA,SAAM,GAAE,CAAC;QACtB,OAAO,MAAM,CAAC;IAClB,CAAC,CAAA;AACL,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
4
  * Licensed under the GNU Affero General Public License (AGPL).
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- var key_provider_1 = require("./key-provider");
9
- var encryption_engine_1 = require("./encryption-engine");
10
- var encryption_service_1 = require("./encryption-service");
8
+ exports.encryptionModule = void 0;
9
+ const key_provider_1 = require("./key-provider");
10
+ const encryption_engine_1 = require("./encryption-engine");
11
+ const encryption_service_1 = require("./encryption-service");
11
12
  /**
12
13
  * User have to provide a binding for KeyProviderConfig!!!
13
14
  * Example:
@@ -18,9 +19,10 @@ var encryption_service_1 = require("./encryption-service");
18
19
  * };
19
20
  * }).inSingletonScope();
20
21
  */
21
- exports.encryptionModule = function (bind) {
22
+ const encryptionModule = bind => {
22
23
  bind(key_provider_1.KeyProvider).to(key_provider_1.KeyProviderImpl).inSingletonScope();
23
24
  bind(encryption_engine_1.EncryptionEngine).to(encryption_engine_1.EncryptionEngineImpl).inSingletonScope();
24
25
  bind(encryption_service_1.EncryptionService).to(encryption_service_1.EncryptionServiceImpl).inSingletonScope();
25
26
  };
27
+ exports.encryptionModule = encryptionModule;
26
28
  //# sourceMappingURL=container-module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"container-module.js","sourceRoot":"","sources":["../../src/encryption/container-module.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAGH,+CAA8D;AAC9D,yDAA6E;AAC7E,2DAAgF;AAEhF;;;;;;;;;GASG;AACU,QAAA,gBAAgB,GAAuC,UAAA,IAAI;IAEpE,IAAI,CAAC,0BAAW,CAAC,CAAC,EAAE,CAAC,8BAAe,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEzD,IAAI,CAAC,oCAAgB,CAAC,CAAC,EAAE,CAAC,wCAAoB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACnE,IAAI,CAAC,sCAAiB,CAAC,CAAC,EAAE,CAAC,0CAAqB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACzE,CAAC,CAAC"}
1
+ {"version":3,"file":"container-module.js","sourceRoot":"","sources":["../../src/encryption/container-module.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,iDAA8D;AAC9D,2DAA6E;AAC7E,6DAAgF;AAEhF;;;;;;;;;GASG;AACI,MAAM,gBAAgB,GAAuC,IAAI,CAAC,EAAE;IAEvE,IAAI,CAAC,0BAAW,CAAC,CAAC,EAAE,CAAC,8BAAe,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEzD,IAAI,CAAC,oCAAgB,CAAC,CAAC,EAAE,CAAC,wCAAoB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACnE,IAAI,CAAC,sCAAiB,CAAC,CAAC,EAAE,CAAC,0CAAqB,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACzE,CAAC,CAAC;AANW,QAAA,gBAAgB,oBAM3B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
4
  * Licensed under the GNU Affero General Public License (AGPL).
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
@@ -11,8 +11,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
11
11
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- var crypto = require("crypto");
15
- var inversify_1 = require("inversify");
14
+ exports.EncryptionEngineImpl = exports.EncryptionEngine = void 0;
15
+ const crypto = require("crypto");
16
+ const inversify_1 = require("inversify");
16
17
  exports.EncryptionEngine = Symbol('EncryptionEngine');
17
18
  /**
18
19
  * For starters, let's use aes-cbc-256 with:
@@ -20,33 +21,32 @@ exports.EncryptionEngine = Symbol('EncryptionEngine');
20
21
  * - no salt, as we pass in a real key (no salting needed to turn a password into a key)
21
22
  * The implementation closely follows the exampes in https://nodejs.org/api/crypto.html.
22
23
  */
23
- var EncryptionEngineImpl = /** @class */ (function () {
24
- function EncryptionEngineImpl() {
24
+ let EncryptionEngineImpl = class EncryptionEngineImpl {
25
+ constructor() {
25
26
  this.algorithm = 'aes-256-cbc';
26
27
  this.enc = 'base64';
27
28
  }
28
- EncryptionEngineImpl.prototype.encrypt = function (data, key) {
29
- var iv = crypto.randomBytes(16);
30
- var cipher = crypto.createCipheriv(this.algorithm, key, iv);
31
- var encrypted = cipher.update(new Buffer(data, 'utf8'));
32
- var finalEncrypted = Buffer.concat([encrypted, cipher.final()]);
29
+ encrypt(data, key) {
30
+ const iv = crypto.randomBytes(16);
31
+ const cipher = crypto.createCipheriv(this.algorithm, key, iv);
32
+ const encrypted = cipher.update(new Buffer(data, 'utf8'));
33
+ const finalEncrypted = Buffer.concat([encrypted, cipher.final()]);
33
34
  return {
34
35
  data: finalEncrypted.toString(this.enc),
35
36
  keyParams: {
36
37
  iv: iv.toString(this.enc)
37
38
  }
38
39
  };
39
- };
40
- EncryptionEngineImpl.prototype.decrypt = function (encryptedData, key) {
41
- var decipher = crypto.createDecipheriv(this.algorithm, key, new Buffer(encryptedData.keyParams.iv, this.enc));
42
- var decrypted = decipher.update(new Buffer(encryptedData.data, this.enc));
43
- var finalDecrypted = Buffer.concat([decrypted, decipher.final()]);
40
+ }
41
+ decrypt(encryptedData, key) {
42
+ const decipher = crypto.createDecipheriv(this.algorithm, key, new Buffer(encryptedData.keyParams.iv, this.enc));
43
+ let decrypted = decipher.update(new Buffer(encryptedData.data, this.enc));
44
+ const finalDecrypted = Buffer.concat([decrypted, decipher.final()]);
44
45
  return finalDecrypted.toString('utf8');
45
- };
46
- EncryptionEngineImpl = __decorate([
47
- inversify_1.injectable()
48
- ], EncryptionEngineImpl);
49
- return EncryptionEngineImpl;
50
- }());
46
+ }
47
+ };
48
+ EncryptionEngineImpl = __decorate([
49
+ (0, inversify_1.injectable)()
50
+ ], EncryptionEngineImpl);
51
51
  exports.EncryptionEngineImpl = EncryptionEngineImpl;
52
52
  //# sourceMappingURL=encryption-engine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"encryption-engine.js","sourceRoot":"","sources":["../../src/encryption/encryption-engine.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;AAEH,+BAAiC;AACjC,uCAAuC;AAY1B,QAAA,gBAAgB,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAS3D;;;;;GAKG;AAEH;IAAA;QACa,cAAS,GAAG,aAAa,CAAC;QAC1B,QAAG,GAAG,QAAQ,CAAC;IAqB5B,CAAC;IAnBG,sCAAO,GAAP,UAAQ,IAAY,EAAE,GAAW;QAC7B,IAAM,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAClC,IAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAA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C,KAAK,EAAE,CAAC,CAAC,CAAC;QACpE,OAAO,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACJ,CAAA;AAvBY,oBAAoB;IAD/B,IAAA,sBAAU,GAAE;GACD,oBAAoB,CAuBhC;AAvBY,oDAAoB"}
@@ -1,10 +1,10 @@
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
  */
6
6
  declare class TestEncryptionEngineImpl {
7
- protected readonly testkey: string;
7
+ protected get testkey(): string;
8
8
  basicSymmetry(): void;
9
9
  }
10
10
  export declare const t: TestEncryptionEngineImpl;
@@ -1 +1 @@
1
- {"version":3,"file":"encryption-engine.spec.d.ts","sourceRoot":"","sources":["../../src/encryption/encryption-engine.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,cAAa,wBAAwB;uBAEnB,OAAO;IAMf,aAAa;CAWtB;AACD,eAAO,MAAM,CAAC,0BAAiC,CAAC"}
1
+ {"version":3,"file":"encryption-engine.spec.d.ts","sourceRoot":"","sources":["../../src/encryption/encryption-engine.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,cAAa,wBAAwB;IAEjC,SAAS,KAAK,OAAO,WAIpB;IAEK,aAAa;CAWtB;AACD,eAAO,MAAM,CAAC,0BAAiC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
4
  * Licensed under the GNU Affero General Public License (AGPL).
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
@@ -14,45 +14,39 @@ var __metadata = (this && this.__metadata) || function (k, v) {
14
14
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- var mocha_typescript_1 = require("mocha-typescript");
18
- var chai = require("chai");
19
- var path = require("path");
20
- var fs = require("fs");
21
- var encryption_engine_1 = require("./encryption-engine");
22
- var expect = chai.expect;
23
- var TestEncryptionEngineImpl = /** @class */ (function () {
24
- function TestEncryptionEngineImpl() {
17
+ exports.t = void 0;
18
+ const mocha_typescript_1 = require("mocha-typescript");
19
+ const chai = require("chai");
20
+ const path = require("path");
21
+ const fs = require("fs");
22
+ const encryption_engine_1 = require("./encryption-engine");
23
+ const expect = chai.expect;
24
+ let TestEncryptionEngineImpl = class TestEncryptionEngineImpl {
25
+ // Created with openssl rand -rand /dev/urandom -out key -base64 32
26
+ get testkey() {
27
+ const keyFilePath = path.resolve(__dirname, '../../test/fixtures/encryption/testkey');
28
+ const keyBuffer = fs.readFileSync(keyFilePath);
29
+ return keyBuffer.toString().trim();
25
30
  }
26
- Object.defineProperty(TestEncryptionEngineImpl.prototype, "testkey", {
27
- // Created with openssl rand -rand /dev/urandom -out key -base64 32
28
- get: function () {
29
- var keyFilePath = path.resolve(__dirname, '../../test/fixtures/encryption/testkey');
30
- var keyBuffer = fs.readFileSync(keyFilePath);
31
- return keyBuffer.toString().trim();
32
- },
33
- enumerable: true,
34
- configurable: true
35
- });
36
31
  ;
37
- TestEncryptionEngineImpl.prototype.basicSymmetry = function () {
38
- var plaintext = "12345678901234567890";
39
- var key = new Buffer(this.testkey, 'base64');
40
- var cut = new encryption_engine_1.EncryptionEngineImpl();
41
- var encryptedData = cut.encrypt(plaintext, key);
32
+ basicSymmetry() {
33
+ const plaintext = "12345678901234567890";
34
+ const key = new Buffer(this.testkey, 'base64');
35
+ const cut = new encryption_engine_1.EncryptionEngineImpl();
36
+ const encryptedData = cut.encrypt(plaintext, key);
42
37
  expect(encryptedData).to.be.not.undefined;
43
- var decryptedPlaintext = cut.decrypt(encryptedData, key);
38
+ const decryptedPlaintext = cut.decrypt(encryptedData, key);
44
39
  expect(decryptedPlaintext).equals(plaintext);
45
- };
46
- __decorate([
47
- mocha_typescript_1.test,
48
- __metadata("design:type", Function),
49
- __metadata("design:paramtypes", []),
50
- __metadata("design:returntype", void 0)
51
- ], TestEncryptionEngineImpl.prototype, "basicSymmetry", null);
52
- TestEncryptionEngineImpl = __decorate([
53
- mocha_typescript_1.suite
54
- ], TestEncryptionEngineImpl);
55
- return TestEncryptionEngineImpl;
56
- }());
40
+ }
41
+ };
42
+ __decorate([
43
+ mocha_typescript_1.test,
44
+ __metadata("design:type", Function),
45
+ __metadata("design:paramtypes", []),
46
+ __metadata("design:returntype", void 0)
47
+ ], TestEncryptionEngineImpl.prototype, "basicSymmetry", null);
48
+ TestEncryptionEngineImpl = __decorate([
49
+ mocha_typescript_1.suite
50
+ ], TestEncryptionEngineImpl);
57
51
  exports.t = new TestEncryptionEngineImpl();
58
52
  //# sourceMappingURL=encryption-engine.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"encryption-engine.spec.js","sourceRoot":"","sources":["../../src/encryption/encryption-engine.spec.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;AAEH,qDAA+C;AAC/C,2BAA6B;AAC7B,2BAA6B;AAC7B,uBAAyB;AAEzB,yDAA2D;AAE3D,IAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAEpB;IAAA;IAmBP,CAAC;IAjBG,sBAAc,6CAAO;QADrB,mEAAmE;aACnE;YACI,IAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,wCAAwC,CAAC,CAAC;YACtF,IAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;YAC/C,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QACvC,CAAC;;;OAAA;IAAA,CAAC;IAEI,gDAAa,GAAb;QACF,IAAM,SAAS,GAAG,sBAAsB,CAAC;QACzC,IAAM,GAAG,GAAG,IAAI,M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MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,IAAI,wCAAoB,EAAE,CAAC;QACvC,MAAM,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAClD,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;QAE1C,MAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAC3D,MAAM,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACjD,CAAC;CACJ,CAAA;AAXS;IAAL,uBAAI;;;;6DAUJ;AAlBQ,wBAAwB;IAApC,wBAAK;GAAO,wBAAwB,CAmBpC;AACY,QAAA,CAAC,GAAG,IAAI,wBAAwB,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
3
  * Licensed under the GNU Affero General Public License (AGPL).
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
@@ -1,20 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 TypeFox GmbH. All rights reserved.
3
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
4
4
  * Licensed under the GNU Affero General Public License (AGPL).
5
5
  * See License-AGPL.txt in the project root for license information.
6
6
  */
7
- var __assign = (this && this.__assign) || function () {
8
- __assign = Object.assign || function(t) {
9
- for (var s, i = 1, n = arguments.length; i < n; i++) {
10
- s = arguments[i];
11
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
12
- t[p] = s[p];
13
- }
14
- return t;
15
- };
16
- return __assign.apply(this, arguments);
17
- };
18
7
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
8
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
9
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -25,42 +14,40 @@ var __metadata = (this && this.__metadata) || function (k, v) {
25
14
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
26
15
  };
27
16
  Object.defineProperty(exports, "__esModule", { value: true });
28
- var inversify_1 = require("inversify");
29
- var encryption_engine_1 = require("./encryption-engine");
30
- var key_provider_1 = require("./key-provider");
17
+ exports.EncryptionServiceImpl = exports.EncryptionService = void 0;
18
+ const inversify_1 = require("inversify");
19
+ const encryption_engine_1 = require("./encryption-engine");
20
+ const key_provider_1 = require("./key-provider");
31
21
  exports.EncryptionService = Symbol('EncryptionService');
32
- var EncryptionServiceImpl = /** @class */ (function () {
33
- function EncryptionServiceImpl() {
22
+ let EncryptionServiceImpl = class EncryptionServiceImpl {
23
+ encrypt(data) {
24
+ const dataStr = this.serialize(data);
25
+ const key = this.keyProvider.getPrimaryKey();
26
+ const encryptedData = this.engine.encrypt(dataStr, key.material);
27
+ return Object.assign(Object.assign({}, encryptedData), { keyMetadata: key.metadata });
34
28
  }
35
- EncryptionServiceImpl.prototype.encrypt = function (data) {
36
- var dataStr = this.serialize(data);
37
- var key = this.keyProvider.getPrimaryKey();
38
- var encryptedData = this.engine.encrypt(dataStr, key.material);
39
- return __assign(__assign({}, encryptedData), { keyMetadata: key.metadata });
40
- };
41
- EncryptionServiceImpl.prototype.decrypt = function (encrypted) {
42
- var key = this.keyProvider.getKeyFor(encrypted.keyMetadata);
43
- var serializedData = this.engine.decrypt(encrypted, key.material);
29
+ decrypt(encrypted) {
30
+ const key = this.keyProvider.getKeyFor(encrypted.keyMetadata);
31
+ const serializedData = this.engine.decrypt(encrypted, key.material);
44
32
  return this.deserialize(serializedData);
45
- };
46
- EncryptionServiceImpl.prototype.serialize = function (data) {
33
+ }
34
+ serialize(data) {
47
35
  return JSON.stringify(data);
48
- };
49
- EncryptionServiceImpl.prototype.deserialize = function (data) {
36
+ }
37
+ deserialize(data) {
50
38
  return JSON.parse(data);
51
- };
52
- __decorate([
53
- inversify_1.inject(encryption_engine_1.EncryptionEngine),
54
- __metadata("design:type", Object)
55
- ], EncryptionServiceImpl.prototype, "engine", void 0);
56
- __decorate([
57
- inversify_1.inject(key_provider_1.KeyProvider),
58
- __metadata("design:type", Object)
59
- ], EncryptionServiceImpl.prototype, "keyProvider", void 0);
60
- EncryptionServiceImpl = __decorate([
61
- inversify_1.injectable()
62
- ], EncryptionServiceImpl);
63
- return EncryptionServiceImpl;
64
- }());
39
+ }
40
+ };
41
+ __decorate([
42
+ (0, inversify_1.inject)(encryption_engine_1.EncryptionEngine),
43
+ __metadata("design:type", Object)
44
+ ], EncryptionServiceImpl.prototype, "engine", void 0);
45
+ __decorate([
46
+ (0, inversify_1.inject)(key_provider_1.KeyProvider),
47
+ __metadata("design:type", Object)
48
+ ], EncryptionServiceImpl.prototype, "keyProvider", void 0);
49
+ EncryptionServiceImpl = __decorate([
50
+ (0, inversify_1.injectable)()
51
+ ], EncryptionServiceImpl);
65
52
  exports.EncryptionServiceImpl = EncryptionServiceImpl;
66
53
  //# sourceMappingURL=encryption-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"encryption-service.js","sourceRoot":"","sources":["../../src/encryption/encryption-service.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAA+C;AAE/C,yDAAsE;AACtE,+CAA0D;AAO7C,QAAA,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAO7D;IAAA;IA4BA,CAAC;IAxBG,uCAAO,GAAP,UAAW,IAAO;QACd,IAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACrC,IAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC;QAE7C,IAAM,aAAa,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