@gitpod/gitpod-protocol 0.1.5-v0.6.0-beta4 → 0.1.5-vn-implement-jetbrains-terminals.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 (299) hide show
  1. package/data/builtin-theia-plugins.json +9 -9
  2. package/data/gitpod-schema.json +25 -24
  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 +31 -4
  8. package/lib/admin-protocol.d.ts.map +1 -1
  9. package/lib/admin-protocol.js +15 -0
  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 +31 -0
  20. package/lib/context-url.d.ts.map +1 -0
  21. package/lib/context-url.js +102 -0
  22. package/lib/context-url.js.map +1 -0
  23. package/lib/context-url.spec.d.ts +14 -0
  24. package/lib/context-url.spec.d.ts.map +1 -0
  25. package/lib/context-url.spec.js +94 -0
  26. package/lib/context-url.spec.js.map +1 -0
  27. package/lib/email-protocol.d.ts +1 -2
  28. package/lib/email-protocol.d.ts.map +1 -1
  29. package/lib/email-protocol.js +4 -4
  30. package/lib/email-protocol.js.map +1 -1
  31. package/lib/encryption/container-module.js +5 -4
  32. package/lib/encryption/container-module.js.map +1 -1
  33. package/lib/encryption/encryption-engine.js +19 -20
  34. package/lib/encryption/encryption-engine.js.map +1 -1
  35. package/lib/encryption/encryption-engine.spec.js +29 -36
  36. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  37. package/lib/encryption/encryption-service.js +29 -43
  38. package/lib/encryption/encryption-service.js.map +1 -1
  39. package/lib/encryption/key-provider.js +25 -30
  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 +20 -21
  44. package/lib/env.js.map +1 -1
  45. package/lib/gitpod-file-parser.js +25 -41
  46. package/lib/gitpod-file-parser.js.map +1 -1
  47. package/lib/gitpod-file-parser.spec.js +116 -116
  48. package/lib/gitpod-file-parser.spec.js.map +1 -1
  49. package/lib/gitpod-service.d.ts +162 -20
  50. package/lib/gitpod-service.d.ts.map +1 -1
  51. package/lib/gitpod-service.js +170 -256
  52. package/lib/gitpod-service.js.map +1 -1
  53. package/lib/headless-workspace-log.d.ts +8 -11
  54. package/lib/headless-workspace-log.d.ts.map +1 -1
  55. package/lib/headless-workspace-log.js +4 -7
  56. package/lib/headless-workspace-log.js.map +1 -1
  57. package/lib/ide-frontend-service.d.ts +4 -0
  58. package/lib/ide-frontend-service.d.ts.map +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 +6 -0
  64. package/lib/index.d.ts.map +1 -1
  65. package/lib/index.js +7 -1
  66. package/lib/index.js.map +1 -1
  67. package/lib/installation-admin-protocol.d.ts +21 -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/messaging/browser/connection.d.ts +5 -3
  72. package/lib/messaging/browser/connection.d.ts.map +1 -1
  73. package/lib/messaging/browser/connection.js +183 -33
  74. package/lib/messaging/browser/connection.js.map +1 -1
  75. package/lib/messaging/browser/window-connection.js +35 -55
  76. package/lib/messaging/browser/window-connection.js.map +1 -1
  77. package/lib/messaging/client-call-metrics.d.ts +35 -0
  78. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  79. package/lib/messaging/client-call-metrics.js +83 -0
  80. package/lib/messaging/client-call-metrics.js.map +1 -0
  81. package/lib/messaging/error.d.ts +5 -1
  82. package/lib/messaging/error.d.ts.map +1 -1
  83. package/lib/messaging/error.js +10 -2
  84. package/lib/messaging/error.js.map +1 -1
  85. package/lib/messaging/handler.d.ts +10 -0
  86. package/lib/messaging/handler.d.ts.map +1 -1
  87. package/lib/messaging/node/connection.d.ts +1 -17
  88. package/lib/messaging/node/connection.d.ts.map +1 -1
  89. package/lib/messaging/node/connection.js +23 -59
  90. package/lib/messaging/node/connection.js.map +1 -1
  91. package/lib/messaging/proxy-factory.d.ts +2 -0
  92. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  93. package/lib/messaging/proxy-factory.js +74 -159
  94. package/lib/messaging/proxy-factory.js.map +1 -1
  95. package/lib/oss-allowlist.d.ts +14 -0
  96. package/lib/oss-allowlist.d.ts.map +1 -0
  97. package/lib/oss-allowlist.js +8 -0
  98. package/lib/oss-allowlist.js.map +1 -0
  99. package/lib/payment-protocol.d.ts +18 -0
  100. package/lib/payment-protocol.d.ts.map +1 -0
  101. package/lib/payment-protocol.js +13 -0
  102. package/lib/payment-protocol.js.map +1 -0
  103. package/lib/permission.d.ts +5 -3
  104. package/lib/permission.d.ts.map +1 -1
  105. package/lib/permission.js +18 -17
  106. package/lib/permission.js.map +1 -1
  107. package/lib/plans.d.ts +210 -0
  108. package/lib/plans.d.ts.map +1 -0
  109. package/lib/plans.js +570 -0
  110. package/lib/plans.js.map +1 -0
  111. package/lib/protocol.d.ts +120 -58
  112. package/lib/protocol.d.ts.map +1 -1
  113. package/lib/protocol.js +116 -130
  114. package/lib/protocol.js.map +1 -1
  115. package/lib/snapshot-url.d.ts +14 -0
  116. package/lib/snapshot-url.d.ts.map +1 -0
  117. package/lib/snapshot-url.js +26 -0
  118. package/lib/snapshot-url.js.map +1 -0
  119. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  120. package/lib/snapshot-url.spec.d.ts.map +1 -0
  121. package/lib/snapshot-url.spec.js +41 -0
  122. package/lib/snapshot-url.spec.js.map +1 -0
  123. package/lib/team-subscription-protocol.d.ts +73 -0
  124. package/lib/team-subscription-protocol.d.ts.map +1 -0
  125. package/lib/team-subscription-protocol.js +63 -0
  126. package/lib/team-subscription-protocol.js.map +1 -0
  127. package/lib/teams-projects-protocol.d.ts +113 -0
  128. package/lib/teams-projects-protocol.d.ts.map +1 -0
  129. package/lib/teams-projects-protocol.js +30 -0
  130. package/lib/teams-projects-protocol.js.map +1 -0
  131. package/lib/util/analytics.d.ts +8 -0
  132. package/lib/util/analytics.d.ts.map +1 -0
  133. package/lib/util/analytics.js +79 -0
  134. package/lib/util/analytics.js.map +1 -0
  135. package/lib/util/async-iterator.js +55 -133
  136. package/lib/util/async-iterator.js.map +1 -1
  137. package/lib/util/cancelable.js +17 -59
  138. package/lib/util/cancelable.js.map +1 -1
  139. package/lib/util/date-time.js +8 -8
  140. package/lib/util/date-time.js.map +1 -1
  141. package/lib/util/deferred.js +10 -12
  142. package/lib/util/deferred.js.map +1 -1
  143. package/lib/util/disposable.js +26 -39
  144. package/lib/util/disposable.js.map +1 -1
  145. package/lib/util/event.js +58 -74
  146. package/lib/util/event.js.map +1 -1
  147. package/lib/util/garbage-collected-cache.d.ts +1 -0
  148. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  149. package/lib/util/garbage-collected-cache.js +26 -46
  150. package/lib/util/garbage-collected-cache.js.map +1 -1
  151. package/lib/util/generate-workspace-id.d.ts +4 -0
  152. package/lib/util/generate-workspace-id.d.ts.map +1 -0
  153. package/lib/util/generate-workspace-id.js +487 -0
  154. package/lib/util/generate-workspace-id.js.map +1 -0
  155. package/lib/util/{without.d.ts → generate-workspace-id.spec.d.ts} +2 -2
  156. package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
  157. package/lib/util/generate-workspace-id.spec.js +87 -0
  158. package/lib/util/generate-workspace-id.spec.js.map +1 -0
  159. package/lib/util/gitpod-cookie.d.ts +20 -0
  160. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  161. package/lib/util/gitpod-cookie.js +44 -0
  162. package/lib/util/gitpod-cookie.js.map +1 -0
  163. package/lib/util/gitpod-host-url.d.ts +2 -2
  164. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  165. package/lib/util/gitpod-host-url.js +96 -95
  166. package/lib/util/gitpod-host-url.js.map +1 -1
  167. package/lib/util/gitpod-host-url.spec.d.ts +8 -1
  168. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  169. package/lib/util/gitpod-host-url.spec.js +104 -22
  170. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  171. package/lib/util/grpc.d.ts +15 -0
  172. package/lib/util/grpc.d.ts.map +1 -0
  173. package/lib/util/grpc.js +18 -0
  174. package/lib/util/grpc.js.map +1 -0
  175. package/lib/util/jaeger-client-types.d.ts +68 -0
  176. package/lib/util/jaeger-client-types.d.ts.map +1 -0
  177. package/lib/util/{without.js → jaeger-client-types.js} +1 -1
  178. package/lib/util/jaeger-client-types.js.map +1 -0
  179. package/lib/util/logging.d.ts +49 -33
  180. package/lib/util/logging.d.ts.map +1 -1
  181. package/lib/util/logging.js +107 -110
  182. package/lib/util/logging.js.map +1 -1
  183. package/lib/util/make-link.js +2 -2
  184. package/lib/util/make-link.js.map +1 -1
  185. package/lib/util/parse-workspace-id.d.ts +13 -3
  186. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  187. package/lib/util/parse-workspace-id.js +38 -8
  188. package/lib/util/parse-workspace-id.js.map +1 -1
  189. package/lib/util/parse-workspace-id.spec.d.ts +8 -0
  190. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  191. package/lib/util/parse-workspace-id.spec.js +127 -47
  192. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  193. package/lib/util/queue.js +16 -55
  194. package/lib/util/queue.js.map +1 -1
  195. package/lib/util/queue.spec.js +144 -288
  196. package/lib/util/queue.spec.js.map +1 -1
  197. package/lib/util/repeat.d.ts +15 -0
  198. package/lib/util/repeat.d.ts.map +1 -0
  199. package/lib/util/repeat.js +55 -0
  200. package/lib/util/repeat.js.map +1 -0
  201. package/lib/util/semaphore.js +15 -46
  202. package/lib/util/semaphore.js.map +1 -1
  203. package/lib/util/skip-if.js +6 -6
  204. package/lib/util/skip-if.js.map +1 -1
  205. package/lib/util/timeutil.js +28 -16
  206. package/lib/util/timeutil.js.map +1 -1
  207. package/lib/util/timeutil.spec.js +21 -24
  208. package/lib/util/timeutil.spec.js.map +1 -1
  209. package/lib/util/tracing.d.ts +51 -5
  210. package/lib/util/tracing.d.ts.map +1 -1
  211. package/lib/util/tracing.js +197 -62
  212. package/lib/util/tracing.js.map +1 -1
  213. package/lib/util/tracing.spec.d.ts +7 -0
  214. package/lib/util/tracing.spec.d.ts.map +1 -0
  215. package/lib/util/tracing.spec.js +121 -0
  216. package/lib/util/tracing.spec.js.map +1 -0
  217. package/lib/util/workspace-port-authentication.js +3 -2
  218. package/lib/util/workspace-port-authentication.js.map +1 -1
  219. package/lib/workspace-cluster.d.ts +71 -0
  220. package/lib/workspace-cluster.d.ts.map +1 -0
  221. package/lib/workspace-cluster.js +16 -0
  222. package/lib/workspace-cluster.js.map +1 -0
  223. package/lib/workspace-instance.d.ts +26 -2
  224. package/lib/workspace-instance.d.ts.map +1 -1
  225. package/lib/wsready.d.ts +1 -1
  226. package/lib/wsready.js +2 -2
  227. package/package.json +33 -17
  228. package/pkg-yarn.lock +18 -9
  229. package/provenance-bundle.jsonl +2 -0
  230. package/src/accounting-protocol.ts +229 -0
  231. package/src/admin-protocol.ts +53 -5
  232. package/src/analytics.ts +54 -0
  233. package/src/auth.ts +27 -0
  234. package/src/context-url.spec.ts +53 -0
  235. package/src/context-url.ts +107 -0
  236. package/src/email-protocol.ts +2 -3
  237. package/src/env.ts +10 -10
  238. package/src/gitpod-service.ts +237 -38
  239. package/src/headless-workspace-log.ts +7 -11
  240. package/src/ide-frontend-service.ts +5 -1
  241. package/src/ide-protocol.ts +119 -0
  242. package/src/index.ts +7 -1
  243. package/src/installation-admin-protocol.ts +35 -0
  244. package/src/messaging/browser/connection.ts +195 -14
  245. package/src/messaging/client-call-metrics.ts +97 -0
  246. package/src/messaging/error.ts +14 -2
  247. package/src/messaging/handler.ts +12 -0
  248. package/src/messaging/node/connection.ts +21 -68
  249. package/src/messaging/proxy-factory.ts +14 -6
  250. package/src/oss-allowlist.ts +15 -0
  251. package/src/payment-protocol.ts +20 -0
  252. package/src/permission.ts +7 -6
  253. package/src/plans.ts +632 -0
  254. package/src/protocol.ts +194 -87
  255. package/src/snapshot-url.spec.ts +25 -0
  256. package/src/snapshot-url.ts +27 -0
  257. package/src/team-subscription-protocol.ts +113 -0
  258. package/src/teams-projects-protocol.ts +147 -0
  259. package/src/util/analytics.ts +87 -0
  260. package/src/util/deferred.ts +1 -1
  261. package/src/util/garbage-collected-cache.ts +9 -3
  262. package/src/util/generate-workspace-id.spec.ts +48 -0
  263. package/src/util/generate-workspace-id.ts +475 -0
  264. package/src/util/gitpod-cookie.ts +39 -0
  265. package/src/util/gitpod-host-url.spec.ts +30 -1
  266. package/src/util/gitpod-host-url.ts +27 -13
  267. package/src/util/grpc.ts +15 -0
  268. package/src/util/jaeger-client-types.ts +102 -0
  269. package/src/util/logging.ts +102 -38
  270. package/src/util/parse-workspace-id.spec.ts +45 -4
  271. package/src/util/parse-workspace-id.ts +38 -7
  272. package/src/util/queue.spec.ts +1 -1
  273. package/src/util/repeat.ts +45 -0
  274. package/src/util/semaphore.ts +2 -2
  275. package/src/util/skip-if.ts +1 -1
  276. package/src/util/timeutil.ts +4 -4
  277. package/src/util/tracing.spec.ts +83 -0
  278. package/src/util/tracing.ts +183 -17
  279. package/src/workspace-cluster.ts +91 -0
  280. package/src/workspace-instance.ts +51 -13
  281. package/src/wsready.ts +2 -2
  282. package/lib/messaging/connection-error-handler.d.ts +0 -27
  283. package/lib/messaging/connection-error-handler.d.ts.map +0 -1
  284. package/lib/messaging/connection-error-handler.js +0 -46
  285. package/lib/messaging/connection-error-handler.js.map +0 -1
  286. package/lib/util/repeater.d.ts +0 -22
  287. package/lib/util/repeater.d.ts.map +0 -1
  288. package/lib/util/repeater.js +0 -118
  289. package/lib/util/repeater.js.map +0 -1
  290. package/lib/util/safe-promise.d.ts +0 -11
  291. package/lib/util/safe-promise.d.ts.map +0 -1
  292. package/lib/util/safe-promise.js +0 -34
  293. package/lib/util/safe-promise.js.map +0 -1
  294. package/lib/util/without.d.ts.map +0 -1
  295. package/lib/util/without.js.map +0 -1
  296. package/src/messaging/connection-error-handler.ts +0 -62
  297. package/src/util/jaeger-client.d.ts +0 -105
  298. package/src/util/repeater.ts +0 -49
  299. package/src/util/safe-promise.ts +0 -26
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+ import { Workspace } from ".";
7
+ /**
8
+ * The whole point of these methods is to overcome inconsistencies in our data model.
9
+ * Ideally we remove it at some point once we fixed our model, as it:
10
+ * - duplicates logic
11
+ * - but additional burden on clients (using this, copying this to other languages!)
12
+ *
13
+ * TODO(gpl) See if we can get this into `server` code to remove the burden from clients
14
+ */
15
+ export declare namespace ContextURL {
16
+ const INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
17
+ const PREBUILD_PREFIX = "prebuild";
18
+ const IMAGEBUILD_PREFIX = "imagebuild";
19
+ const SNAPSHOT_PREFIX = "snapshot";
20
+ const REFERRER_PREFIX = "referrer:";
21
+ /**
22
+ * This function will (try to) return the HTTP(S) URL of the context the user originally created this workspace on.
23
+ * Especially it will not contain any modifiers or be of different scheme than HTTP(S).
24
+ *
25
+ * Use this function if you need to provided a _working_ URL to the original context.
26
+ * @param ws
27
+ * @returns
28
+ */
29
+ function getNormalizedURL(ws: Pick<Workspace, "context" | "contextURL"> | undefined): URL | undefined;
30
+ }
31
+ //# 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,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAE9B;;;;;;;GAOG;AACH,yBAAiB,UAAU,CAAC;IACnB,MAAM,2BAA2B,yBAAyB,CAAC;IAC3D,MAAM,eAAe,aAAa,CAAC;IACnC,MAAM,iBAAiB,eAAe,CAAC;IACvC,MAAM,eAAe,aAAa,CAAC;IACnC,MAAM,eAAe,cAAc,CAAC;IAE3C;;;;;;;OAOG;IACH,SAAgB,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAAC,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,CAY3G;CA+DF"}
@@ -0,0 +1,102 @@
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
+ /**
10
+ * The whole point of these methods is to overcome inconsistencies in our data model.
11
+ * Ideally we remove it at some point once we fixed our model, as it:
12
+ * - duplicates logic
13
+ * - but additional burden on clients (using this, copying this to other languages!)
14
+ *
15
+ * TODO(gpl) See if we can get this into `server` code to remove the burden from clients
16
+ */
17
+ var ContextURL;
18
+ (function (ContextURL) {
19
+ ContextURL.INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
20
+ ContextURL.PREBUILD_PREFIX = "prebuild";
21
+ ContextURL.IMAGEBUILD_PREFIX = "imagebuild";
22
+ ContextURL.SNAPSHOT_PREFIX = "snapshot";
23
+ ContextURL.REFERRER_PREFIX = 'referrer:';
24
+ /**
25
+ * This function will (try to) return the HTTP(S) URL of the context the user originally created this workspace on.
26
+ * Especially it will not contain any modifiers or be of different scheme than HTTP(S).
27
+ *
28
+ * Use this function if you need to provided a _working_ URL to the original context.
29
+ * @param ws
30
+ * @returns
31
+ */
32
+ function getNormalizedURL(ws) {
33
+ const normalized = normalize(ws);
34
+ if (!normalized) {
35
+ return undefined;
36
+ }
37
+ try {
38
+ return new URL(normalized);
39
+ }
40
+ catch (err) {
41
+ console.error(`unable to parse URL from normalized contextURL: '${normalized}'`, err);
42
+ }
43
+ return undefined;
44
+ }
45
+ ContextURL.getNormalizedURL = getNormalizedURL;
46
+ function normalize(ws) {
47
+ if (!ws) {
48
+ return undefined;
49
+ }
50
+ if (ws.context.normalizedContextURL) {
51
+ return ws.context.normalizedContextURL;
52
+ }
53
+ // fallback: we do not yet set normalizedContextURL on all workspaces, yet, let alone older existing workspaces
54
+ let fallback = undefined;
55
+ try {
56
+ fallback = removePrefixes(ws.contextURL);
57
+ }
58
+ catch (err) {
59
+ console.error(`unable to remove prefixes from contextURL: '${ws.contextURL}'`, err);
60
+ }
61
+ return fallback;
62
+ }
63
+ /**
64
+ * The field "contextUrl" might contain prefixes like:
65
+ * - envvar1=value1/...
66
+ * - prebuild/...
67
+ * This is the analogon to the (Prefix)ContextParser structure in "server".
68
+ */
69
+ function removePrefixes(contextUrl) {
70
+ if (contextUrl === undefined) {
71
+ return undefined;
72
+ }
73
+ const segments = contextUrl.split("/");
74
+ if (segments.length === 1) {
75
+ return segments[0]; // this might be something, we just try
76
+ }
77
+ const segmentsToURL = (offset) => {
78
+ let rest = segments.slice(offset).join("/");
79
+ if (/^git@[^:\/]+:/.test(rest)) {
80
+ rest = rest.replace(/^git@([^:\/]+):/, 'https://$1/');
81
+ }
82
+ if (!rest.startsWith("http")) {
83
+ rest = 'https://' + rest;
84
+ }
85
+ return rest;
86
+ };
87
+ const firstSegment = segments[0];
88
+ if (firstSegment === ContextURL.PREBUILD_PREFIX ||
89
+ firstSegment === ContextURL.INCREMENTAL_PREBUILD_PREFIX ||
90
+ firstSegment === ContextURL.IMAGEBUILD_PREFIX ||
91
+ firstSegment === ContextURL.SNAPSHOT_PREFIX ||
92
+ firstSegment.startsWith(ContextURL.REFERRER_PREFIX)) {
93
+ return segmentsToURL(1);
94
+ }
95
+ // check for env vars
96
+ if (firstSegment.indexOf("=") !== -1) {
97
+ return segmentsToURL(1);
98
+ }
99
+ return segmentsToURL(0);
100
+ }
101
+ })(ContextURL = exports.ContextURL || (exports.ContextURL = {}));
102
+ //# 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;;;AAIH;;;;;;;GAOG;AACH,IAAiB,UAAU,CA0F1B;AA1FD,WAAiB,UAAU;IACZ,sCAA2B,GAAG,sBAAsB,CAAC;IACrD,0BAAe,GAAG,UAAU,CAAC;IAC7B,4BAAiB,GAAG,YAAY,CAAC;IACjC,0BAAe,GAAG,UAAU,CAAC;IAC7B,0BAAe,GAAG,WAAW,CAAC;IAE3C;;;;;;;OAOG;IACH,SAAgB,gBAAgB,CAAC,EAAyD;QACxF,MAAM,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,SAAS,CAAC;SAClB;QAED,IAAI;YACF,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;SAC5B;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,CAAC,KAAK,CAAC,oDAAoD,UAAU,GAAG,EAAE,GAAG,CAAC,CAAC;SACvF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAZe,2BAAgB,mBAY/B,CAAA;IAED,SAAS,SAAS,CAAC,EAAyD;QAC1E,IAAI,CAAC,EAAE,EAAE;YACP,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,EAAE,CAAC,OAAO,CAAC,oBAAoB,EAAE;YACnC,OAAO,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC;SACxC;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WAAA,eAAe,CAAC,EAAE;YAC5C,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;AACH,CAAC,EA1FgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QA0F1B"}
@@ -0,0 +1,14 @@
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_withEnvVar_sshUrl(): void;
10
+ parseContextUrl_withPrebuild(): void;
11
+ parseContextUrl_withPrebuild_withoutSchema(): void;
12
+ parseContextUrl_badUrl(): void;
13
+ }
14
+ //# 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;AAUH,qBACa,cAAc;IAEV,0BAA0B;IAM1B,wCAAwC;IAMxC,iCAAiC;IAMjC,4BAA4B;IAM5B,0CAA0C;IAM1C,sBAAsB;CAItC"}
@@ -0,0 +1,94 @@
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.getNormalizedURL({ contextURL: "passedin=test%20value/https://github.com/gitpod-io/gitpod-test-repo", context: {} });
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.getNormalizedURL({ contextURL: "passedin=test%20value/github.com/gitpod-io/gitpod-test-repo", context: {} });
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_withEnvVar_sshUrl() {
34
+ const actual = context_url_1.ContextURL.getNormalizedURL({ contextURL: "passedin=test%20value/git@github.com:gitpod-io/gitpod-test-repo.git", context: {} });
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.git");
37
+ }
38
+ parseContextUrl_withPrebuild() {
39
+ const actual = context_url_1.ContextURL.getNormalizedURL({ contextURL: "prebuild/https://github.com/gitpod-io/gitpod-test-repo", context: {} });
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
+ parseContextUrl_withPrebuild_withoutSchema() {
44
+ const actual = context_url_1.ContextURL.getNormalizedURL({ contextURL: "prebuild/github.com/gitpod-io/gitpod-test-repo", context: {} });
45
+ expect(actual === null || actual === void 0 ? void 0 : actual.host).to.equal("github.com");
46
+ expect(actual === null || actual === void 0 ? void 0 : actual.pathname).to.equal("/gitpod-io/gitpod-test-repo");
47
+ }
48
+ parseContextUrl_badUrl() {
49
+ const actual = context_url_1.ContextURL.getNormalizedURL({ contextURL: "[Object object]", context: {} });
50
+ expect(actual).to.be.undefined;
51
+ }
52
+ };
53
+ __decorate([
54
+ mocha_typescript_1.test,
55
+ __metadata("design:type", Function),
56
+ __metadata("design:paramtypes", []),
57
+ __metadata("design:returntype", void 0)
58
+ ], ContextUrlTest.prototype, "parseContextUrl_withEnvVar", null);
59
+ __decorate([
60
+ mocha_typescript_1.test,
61
+ __metadata("design:type", Function),
62
+ __metadata("design:paramtypes", []),
63
+ __metadata("design:returntype", void 0)
64
+ ], ContextUrlTest.prototype, "parseContextUrl_withEnvVar_withoutSchema", null);
65
+ __decorate([
66
+ mocha_typescript_1.test,
67
+ __metadata("design:type", Function),
68
+ __metadata("design:paramtypes", []),
69
+ __metadata("design:returntype", void 0)
70
+ ], ContextUrlTest.prototype, "parseContextUrl_withEnvVar_sshUrl", null);
71
+ __decorate([
72
+ mocha_typescript_1.test,
73
+ __metadata("design:type", Function),
74
+ __metadata("design:paramtypes", []),
75
+ __metadata("design:returntype", void 0)
76
+ ], ContextUrlTest.prototype, "parseContextUrl_withPrebuild", null);
77
+ __decorate([
78
+ mocha_typescript_1.test,
79
+ __metadata("design:type", Function),
80
+ __metadata("design:paramtypes", []),
81
+ __metadata("design:returntype", void 0)
82
+ ], ContextUrlTest.prototype, "parseContextUrl_withPrebuild_withoutSchema", null);
83
+ __decorate([
84
+ mocha_typescript_1.test,
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", []),
87
+ __metadata("design:returntype", void 0)
88
+ ], ContextUrlTest.prototype, "parseContextUrl_badUrl", null);
89
+ ContextUrlTest = __decorate([
90
+ mocha_typescript_1.suite
91
+ ], ContextUrlTest);
92
+ exports.ContextUrlTest = ContextUrlTest;
93
+ module.exports = new ContextUrlTest();
94
+ //# 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;AAE/C,+CAA2C;AAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAK3B,IAAa,cAAc,GAA3B,MAAa,cAAc;IAEV,0BAA0B;QACnC,MAAM,MAAM,GAAG,wBAAU,CAAC,gBAAgB,CAAC,EAAE,UAAU,EAAE,qEAAqE,EAAE,OAAO,EAAE,EAAE,EAAkB,CAAC,CAAC;QAC/J,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5C,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACrE,CAAC;IAEY,wCAAwC;QACjD,MAAM,MAAM,GAAG,wBAAU,CAAC,gBAAgB,CAAC,EAAE,UAAU,EAAE,6DAA6D,EAAE,OAAO,EAAE,EAAE,EAAkB,CAAC,CAAC;QACvJ,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,CAAC,CAAC,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AM,uBAAN,MAAM,CAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACrE,CAAC;IAEY,sBAAsB;QAC/B,MAAM,MAAM,GAAG,wBAAU,CAAC,gBAAgB,CAAC,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,EAAE,EAAkB,CAAC,CAAC;QAC3G,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;IACnC,CAAC;CACJ,CAAA;AAlCS;IAAL,uBAAI;;;;gEAIJ;AAEK;IAAL,uBAAI;;;;8EAIJ;AAEK;IAAL,uBAAI;;;;uEAIJ;AAEK;IAAL,uBAAI;;;;kEAIJ;AAEK;IAAL,uBAAI;;;;gFAIJ;AAEK;IAAL,uBAAI;;;;4DAGJ;AAnCQ,cAAc;IAD1B,wBAAK;GACO,cAAc,CAoC1B;AApCY,wCAAc;AAqC3B,MAAM,CAAC,OAAO,GAAG,IAAI,cAAc,EAAE,CAAA"}
@@ -3,7 +3,6 @@
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
- import { Without } from "./util/without";
7
6
  export declare type EMailState = "scheduledInternal" | "scheduledSendgrid";
8
7
  export interface EMailStatus {
9
8
  /** The time the email entry was inserted into the DB */
@@ -45,6 +44,6 @@ export declare type EMail = {
45
44
  params: EMailParameters;
46
45
  } & EMailStatus;
47
46
  export declare namespace EMail {
48
- const create: (ts: Without<EMail, 'uid'>) => EMail;
47
+ const create: (ts: Omit<EMail, 'uid'>) => EMail;
49
48
  }
50
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;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,oBAAY,UAAU,GAAG,mB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E1B,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,SAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAKxD;CACJ;AAED,MAAM,WAAW,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"}
@@ -6,7 +6,7 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.EMail = exports.EMailStatus = void 0;
9
- var uuidv4 = require("uuid/v4");
9
+ const uuid_1 = require("uuid");
10
10
  var EMailStatus;
11
11
  (function (EMailStatus) {
12
12
  function getState(status) {
@@ -19,9 +19,9 @@ var EMailStatus;
19
19
  })(EMailStatus = exports.EMailStatus || (exports.EMailStatus = {}));
20
20
  var EMail;
21
21
  (function (EMail) {
22
- EMail.create = function (ts) {
23
- var withId = ts;
24
- withId.uid = uuidv4();
22
+ EMail.create = (ts) => {
23
+ const withId = ts;
24
+ withId.uid = (0, uuid_1.v4)();
25
25
  return withId;
26
26
  };
27
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"}
@@ -6,9 +6,9 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.encryptionModule = void 0;
9
- var key_provider_1 = require("./key-provider");
10
- var encryption_engine_1 = require("./encryption-engine");
11
- var encryption_service_1 = require("./encryption-service");
9
+ const key_provider_1 = require("./key-provider");
10
+ const encryption_engine_1 = require("./encryption-engine");
11
+ const encryption_service_1 = require("./encryption-service");
12
12
  /**
13
13
  * User have to provide a binding for KeyProviderConfig!!!
14
14
  * Example:
@@ -19,9 +19,10 @@ var encryption_service_1 = require("./encryption-service");
19
19
  * };
20
20
  * }).inSingletonScope();
21
21
  */
22
- exports.encryptionModule = function (bind) {
22
+ const encryptionModule = bind => {
23
23
  bind(key_provider_1.KeyProvider).to(key_provider_1.KeyProviderImpl).inSingletonScope();
24
24
  bind(encryption_engine_1.EncryptionEngine).to(encryption_engine_1.EncryptionEngineImpl).inSingletonScope();
25
25
  bind(encryption_service_1.EncryptionService).to(encryption_service_1.EncryptionServiceImpl).inSingletonScope();
26
26
  };
27
+ exports.encryptionModule = encryptionModule;
27
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"}
@@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.EncryptionEngineImpl = exports.EncryptionEngine = void 0;
15
- var crypto = require("crypto");
16
- var inversify_1 = require("inversify");
15
+ const crypto = require("crypto");
16
+ const inversify_1 = require("inversify");
17
17
  exports.EncryptionEngine = Symbol('EncryptionEngine');
18
18
  /**
19
19
  * For starters, let's use aes-cbc-256 with:
@@ -21,33 +21,32 @@ exports.EncryptionEngine = Symbol('EncryptionEngine');
21
21
  * - no salt, as we pass in a real key (no salting needed to turn a password into a key)
22
22
  * The implementation closely follows the exampes in https://nodejs.org/api/crypto.html.
23
23
  */
24
- var EncryptionEngineImpl = /** @class */ (function () {
25
- function EncryptionEngineImpl() {
24
+ let EncryptionEngineImpl = class EncryptionEngineImpl {
25
+ constructor() {
26
26
  this.algorithm = 'aes-256-cbc';
27
27
  this.enc = 'base64';
28
28
  }
29
- EncryptionEngineImpl.prototype.encrypt = function (data, key) {
30
- var iv = crypto.randomBytes(16);
31
- var cipher = crypto.createCipheriv(this.algorithm, key, iv);
32
- var encrypted = cipher.update(new Buffer(data, 'utf8'));
33
- 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()]);
34
34
  return {
35
35
  data: finalEncrypted.toString(this.enc),
36
36
  keyParams: {
37
37
  iv: iv.toString(this.enc)
38
38
  }
39
39
  };
40
- };
41
- EncryptionEngineImpl.prototype.decrypt = function (encryptedData, key) {
42
- var decipher = crypto.createDecipheriv(this.algorithm, key, new Buffer(encryptedData.keyParams.iv, this.enc));
43
- var decrypted = decipher.update(new Buffer(encryptedData.data, this.enc));
44
- 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()]);
45
45
  return finalDecrypted.toString('utf8');
46
- };
47
- EncryptionEngineImpl = __decorate([
48
- inversify_1.injectable()
49
- ], EncryptionEngineImpl);
50
- return EncryptionEngineImpl;
51
- }());
46
+ }
47
+ };
48
+ EncryptionEngineImpl = __decorate([
49
+ (0, inversify_1.injectable)()
50
+ ], EncryptionEngineImpl);
52
51
  exports.EncryptionEngineImpl = EncryptionEngineImpl;
53
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,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAC9D,IAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1D,IAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAClE,OAAO;YACH,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;YACvC,SAAS,EAAE;gBACP,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;aAC5B;SACJ,CAAC;IACN,CAAC;IAED,sCAAO,GAAP,UAAQ,aAA4B,EAAE,GAAW;QAC7C,IAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE,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,EAAE,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;YACvC,SAAS,EAAE;gBACP,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;aAC5B;SACJ,CAAC;IACN,CAAC;IAED,OAAO,CAAC,aAA4B,EAAE,GAAW;QAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAChH,IAAI,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1E,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,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"}
@@ -15,45 +15,38 @@ var __metadata = (this && this.__metadata) || function (k, v) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.t = void 0;
18
- var mocha_typescript_1 = require("mocha-typescript");
19
- var chai = require("chai");
20
- var path = require("path");
21
- var fs = require("fs");
22
- var encryption_engine_1 = require("./encryption-engine");
23
- var expect = chai.expect;
24
- var TestEncryptionEngineImpl = /** @class */ (function () {
25
- function TestEncryptionEngineImpl() {
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();
26
30
  }
27
- Object.defineProperty(TestEncryptionEngineImpl.prototype, "testkey", {
28
- // Created with openssl rand -rand /dev/urandom -out key -base64 32
29
- get: function () {
30
- var keyFilePath = path.resolve(__dirname, '../../test/fixtures/encryption/testkey');
31
- var keyBuffer = fs.readFileSync(keyFilePath);
32
- return keyBuffer.toString().trim();
33
- },
34
- enumerable: false,
35
- configurable: true
36
- });
37
31
  ;
38
- TestEncryptionEngineImpl.prototype.basicSymmetry = function () {
39
- var plaintext = "12345678901234567890";
40
- var key = new Buffer(this.testkey, 'base64');
41
- var cut = new encryption_engine_1.EncryptionEngineImpl();
42
- 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);
43
37
  expect(encryptedData).to.be.not.undefined;
44
- var decryptedPlaintext = cut.decrypt(encryptedData, key);
38
+ const decryptedPlaintext = cut.decrypt(encryptedData, key);
45
39
  expect(decryptedPlaintext).equals(plaintext);
46
- };
47
- __decorate([
48
- mocha_typescript_1.test,
49
- __metadata("design:type", Function),
50
- __metadata("design:paramtypes", []),
51
- __metadata("design:returntype", void 0)
52
- ], TestEncryptionEngineImpl.prototype, "basicSymmetry", null);
53
- TestEncryptionEngineImpl = __decorate([
54
- mocha_typescript_1.suite
55
- ], TestEncryptionEngineImpl);
56
- return TestEncryptionEngineImpl;
57
- }());
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);
58
51
  exports.t = new TestEncryptionEngineImpl();
59
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,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAE/C,IAAM,GAAG,GAAG,IAAI,wCAAoB,EAAE,CAAC;QACvC,IAAM,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,IAAM,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAC3D,MAAM,CAAC,kBAAkB,CAAC,CAAC,MAAM,C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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"}
@@ -4,17 +4,6 @@
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);
@@ -26,42 +15,39 @@ var __metadata = (this && this.__metadata) || function (k, v) {
26
15
  };
27
16
  Object.defineProperty(exports, "__esModule", { value: true });
28
17
  exports.EncryptionServiceImpl = exports.EncryptionService = void 0;
29
- var inversify_1 = require("inversify");
30
- var encryption_engine_1 = require("./encryption-engine");
31
- var key_provider_1 = require("./key-provider");
18
+ const inversify_1 = require("inversify");
19
+ const encryption_engine_1 = require("./encryption-engine");
20
+ const key_provider_1 = require("./key-provider");
32
21
  exports.EncryptionService = Symbol('EncryptionService');
33
- var EncryptionServiceImpl = /** @class */ (function () {
34
- 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 });
35
28
  }
36
- EncryptionServiceImpl.prototype.encrypt = function (data) {
37
- var dataStr = this.serialize(data);
38
- var key = this.keyProvider.getPrimaryKey();
39
- var encryptedData = this.engine.encrypt(dataStr, key.material);
40
- return __assign(__assign({}, encryptedData), { keyMetadata: key.metadata });
41
- };
42
- EncryptionServiceImpl.prototype.decrypt = function (encrypted) {
43
- var key = this.keyProvider.getKeyFor(encrypted.keyMetadata);
44
- 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);
45
32
  return this.deserialize(serializedData);
46
- };
47
- EncryptionServiceImpl.prototype.serialize = function (data) {
33
+ }
34
+ serialize(data) {
48
35
  return JSON.stringify(data);
49
- };
50
- EncryptionServiceImpl.prototype.deserialize = function (data) {
36
+ }
37
+ deserialize(data) {
51
38
  return JSON.parse(data);
52
- };
53
- __decorate([
54
- inversify_1.inject(encryption_engine_1.EncryptionEngine),
55
- __metadata("design:type", Object)
56
- ], EncryptionServiceImpl.prototype, "engine", void 0);
57
- __decorate([
58
- inversify_1.inject(key_provider_1.KeyProvider),
59
- __metadata("design:type", Object)
60
- ], EncryptionServiceImpl.prototype, "keyProvider", void 0);
61
- EncryptionServiceImpl = __decorate([
62
- inversify_1.injectable()
63
- ], EncryptionServiceImpl);
64
- return EncryptionServiceImpl;
65
- }());
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);
66
52
  exports.EncryptionServiceImpl = EncryptionServiceImpl;
67
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,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACjE,6BACO,aAAa,KAChB,WAAW,EAAE,GAAG,CAAC,QAAQ,IAC3B;IACN,CAAC;IAED,uCAAO,GAAP,UAAW,SAAuB;QAC9B,IAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC9D,IAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAES,yCAAS,GAAnB,UAAoB,IAAS;QACzB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAES,2CAAW,GAArB,UAAyB,IAAY;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;IACjC,CAAC;IA1ByB;QAAzB,kBAAM,CAAC,oCAAgB,CAAC;;yDAA6C;IACjD;QAApB,kBAAM,CAAC,0BAAW,CAAC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