@gitpod/gitpod-protocol 0.1.5-pluggable-workspace-cluster.21 → 0.1.5-port-description-3059-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 (250) hide show
  1. package/data/gitpod-schema.json +12 -22
  2. package/lib/accounting-protocol.d.ts +3 -6
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +10 -16
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +15 -4
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js +15 -0
  9. package/lib/admin-protocol.js.map +1 -1
  10. package/lib/analytics.d.ts +45 -0
  11. package/lib/analytics.d.ts.map +1 -0
  12. package/lib/analytics.js +10 -0
  13. package/lib/analytics.js.map +1 -0
  14. package/lib/context-url.d.ts +18 -0
  15. package/lib/context-url.d.ts.map +1 -0
  16. package/lib/context-url.js +49 -0
  17. package/lib/context-url.js.map +1 -0
  18. package/lib/{util/context-url.spec.d.ts → context-url.spec.d.ts} +2 -0
  19. package/lib/context-url.spec.d.ts.map +1 -0
  20. package/lib/context-url.spec.js +73 -0
  21. package/lib/context-url.spec.js.map +1 -0
  22. package/lib/email-protocol.d.ts +1 -2
  23. package/lib/email-protocol.d.ts.map +1 -1
  24. package/lib/email-protocol.js +4 -4
  25. package/lib/email-protocol.js.map +1 -1
  26. package/lib/encryption/container-module.js +4 -4
  27. package/lib/encryption/container-module.js.map +1 -1
  28. package/lib/encryption/encryption-engine.js +19 -20
  29. package/lib/encryption/encryption-engine.js.map +1 -1
  30. package/lib/encryption/encryption-engine.spec.js +29 -36
  31. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  32. package/lib/encryption/encryption-service.js +29 -43
  33. package/lib/encryption/encryption-service.js.map +1 -1
  34. package/lib/encryption/key-provider.js +25 -30
  35. package/lib/encryption/key-provider.js.map +1 -1
  36. package/lib/env.d.ts +1 -2
  37. package/lib/env.d.ts.map +1 -1
  38. package/lib/env.js +20 -21
  39. package/lib/env.js.map +1 -1
  40. package/lib/gitpod-file-parser.js +25 -41
  41. package/lib/gitpod-file-parser.js.map +1 -1
  42. package/lib/gitpod-file-parser.spec.js +116 -116
  43. package/lib/gitpod-file-parser.spec.js.map +1 -1
  44. package/lib/gitpod-service.d.ts +94 -19
  45. package/lib/gitpod-service.d.ts.map +1 -1
  46. package/lib/gitpod-service.js +155 -278
  47. package/lib/gitpod-service.js.map +1 -1
  48. package/lib/headless-workspace-log.d.ts +8 -11
  49. package/lib/headless-workspace-log.d.ts.map +1 -1
  50. package/lib/headless-workspace-log.js +4 -7
  51. package/lib/headless-workspace-log.js.map +1 -1
  52. package/lib/ide-protocol.d.ts +81 -0
  53. package/lib/ide-protocol.d.ts.map +1 -0
  54. package/lib/{util/without.js → ide-protocol.js} +2 -2
  55. package/lib/ide-protocol.js.map +1 -0
  56. package/lib/index.d.ts +4 -0
  57. package/lib/index.d.ts.map +1 -1
  58. package/lib/index.js +4 -0
  59. package/lib/index.js.map +1 -1
  60. package/lib/messaging/browser/connection.d.ts +4 -6
  61. package/lib/messaging/browser/connection.d.ts.map +1 -1
  62. package/lib/messaging/browser/connection.js +175 -44
  63. package/lib/messaging/browser/connection.js.map +1 -1
  64. package/lib/messaging/browser/window-connection.js +35 -55
  65. package/lib/messaging/browser/window-connection.js.map +1 -1
  66. package/lib/messaging/client-call-metrics.d.ts +35 -0
  67. package/lib/messaging/client-call-metrics.d.ts.map +1 -0
  68. package/lib/messaging/client-call-metrics.js +83 -0
  69. package/lib/messaging/client-call-metrics.js.map +1 -0
  70. package/lib/messaging/connection-error-handler.js +11 -23
  71. package/lib/messaging/connection-error-handler.js.map +1 -1
  72. package/lib/messaging/error.d.ts +2 -1
  73. package/lib/messaging/error.d.ts.map +1 -1
  74. package/lib/messaging/error.js +4 -2
  75. package/lib/messaging/error.js.map +1 -1
  76. package/lib/messaging/handler.d.ts +10 -0
  77. package/lib/messaging/handler.d.ts.map +1 -1
  78. package/lib/messaging/node/connection.js +22 -22
  79. package/lib/messaging/node/connection.js.map +1 -1
  80. package/lib/messaging/proxy-factory.d.ts +2 -0
  81. package/lib/messaging/proxy-factory.d.ts.map +1 -1
  82. package/lib/messaging/proxy-factory.js +74 -159
  83. package/lib/messaging/proxy-factory.js.map +1 -1
  84. package/lib/permission.d.ts +2 -1
  85. package/lib/permission.d.ts.map +1 -1
  86. package/lib/permission.js +14 -13
  87. package/lib/permission.js.map +1 -1
  88. package/lib/plans.d.ts +210 -0
  89. package/lib/plans.d.ts.map +1 -0
  90. package/lib/plans.js +570 -0
  91. package/lib/plans.js.map +1 -0
  92. package/lib/protocol.d.ts +66 -13
  93. package/lib/protocol.d.ts.map +1 -1
  94. package/lib/protocol.js +68 -115
  95. package/lib/protocol.js.map +1 -1
  96. package/lib/snapshot-url.d.ts +14 -0
  97. package/lib/snapshot-url.d.ts.map +1 -0
  98. package/lib/snapshot-url.js +26 -0
  99. package/lib/snapshot-url.js.map +1 -0
  100. package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
  101. package/lib/snapshot-url.spec.d.ts.map +1 -0
  102. package/lib/snapshot-url.spec.js +41 -0
  103. package/lib/snapshot-url.spec.js.map +1 -0
  104. package/lib/team-subscription-protocol.d.ts +4 -4
  105. package/lib/team-subscription-protocol.d.ts.map +1 -1
  106. package/lib/team-subscription-protocol.js +15 -12
  107. package/lib/team-subscription-protocol.js.map +1 -1
  108. package/lib/teams-projects-protocol.d.ts +103 -0
  109. package/lib/teams-projects-protocol.d.ts.map +1 -0
  110. package/lib/teams-projects-protocol.js +23 -0
  111. package/lib/teams-projects-protocol.js.map +1 -0
  112. package/lib/util/analytics.d.ts +8 -0
  113. package/lib/util/analytics.d.ts.map +1 -0
  114. package/lib/util/analytics.js +79 -0
  115. package/lib/util/analytics.js.map +1 -0
  116. package/lib/util/async-iterator.js +55 -133
  117. package/lib/util/async-iterator.js.map +1 -1
  118. package/lib/util/cancelable.js +17 -59
  119. package/lib/util/cancelable.js.map +1 -1
  120. package/lib/util/date-time.js +8 -8
  121. package/lib/util/date-time.js.map +1 -1
  122. package/lib/util/deferred.js +10 -12
  123. package/lib/util/deferred.js.map +1 -1
  124. package/lib/util/disposable.js +26 -39
  125. package/lib/util/disposable.js.map +1 -1
  126. package/lib/util/event.js +58 -74
  127. package/lib/util/event.js.map +1 -1
  128. package/lib/util/garbage-collected-cache.js +22 -46
  129. package/lib/util/garbage-collected-cache.js.map +1 -1
  130. package/lib/util/generate-workspace-id.d.ts.map +1 -1
  131. package/lib/util/generate-workspace-id.js +13 -67
  132. package/lib/util/generate-workspace-id.js.map +1 -1
  133. package/lib/util/generate-workspace-id.spec.js +34 -79
  134. package/lib/util/generate-workspace-id.spec.js.map +1 -1
  135. package/lib/util/gitpod-cookie.d.ts +20 -0
  136. package/lib/util/gitpod-cookie.d.ts.map +1 -0
  137. package/lib/util/gitpod-cookie.js +44 -0
  138. package/lib/util/gitpod-cookie.js.map +1 -0
  139. package/lib/util/gitpod-host-url.d.ts +1 -1
  140. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  141. package/lib/util/gitpod-host-url.js +98 -98
  142. package/lib/util/gitpod-host-url.js.map +1 -1
  143. package/lib/util/gitpod-host-url.spec.d.ts +6 -0
  144. package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
  145. package/lib/util/gitpod-host-url.spec.js +102 -30
  146. package/lib/util/gitpod-host-url.spec.js.map +1 -1
  147. package/lib/util/grpc.d.ts +15 -0
  148. package/lib/util/grpc.d.ts.map +1 -0
  149. package/lib/util/grpc.js +18 -0
  150. package/lib/util/grpc.js.map +1 -0
  151. package/lib/util/logging.d.ts +49 -33
  152. package/lib/util/logging.d.ts.map +1 -1
  153. package/lib/util/logging.js +107 -110
  154. package/lib/util/logging.js.map +1 -1
  155. package/lib/util/make-link.js +2 -2
  156. package/lib/util/make-link.js.map +1 -1
  157. package/lib/util/parse-workspace-id.d.ts +10 -0
  158. package/lib/util/parse-workspace-id.d.ts.map +1 -1
  159. package/lib/util/parse-workspace-id.js +31 -7
  160. package/lib/util/parse-workspace-id.js.map +1 -1
  161. package/lib/util/parse-workspace-id.spec.d.ts +4 -0
  162. package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
  163. package/lib/util/parse-workspace-id.spec.js +123 -84
  164. package/lib/util/parse-workspace-id.spec.js.map +1 -1
  165. package/lib/util/queue.js +16 -55
  166. package/lib/util/queue.js.map +1 -1
  167. package/lib/util/queue.spec.js +144 -288
  168. package/lib/util/queue.spec.js.map +1 -1
  169. package/lib/util/repeater.js +35 -88
  170. package/lib/util/repeater.js.map +1 -1
  171. package/lib/util/safe-promise.js +9 -12
  172. package/lib/util/safe-promise.js.map +1 -1
  173. package/lib/util/semaphore.js +15 -46
  174. package/lib/util/semaphore.js.map +1 -1
  175. package/lib/util/skip-if.js +6 -6
  176. package/lib/util/skip-if.js.map +1 -1
  177. package/lib/util/timeutil.js +16 -16
  178. package/lib/util/timeutil.js.map +1 -1
  179. package/lib/util/timeutil.spec.js +21 -24
  180. package/lib/util/timeutil.spec.js.map +1 -1
  181. package/lib/util/tracing.d.ts +14 -1
  182. package/lib/util/tracing.d.ts.map +1 -1
  183. package/lib/util/tracing.js +84 -50
  184. package/lib/util/tracing.js.map +1 -1
  185. package/lib/util/workspace-port-authentication.js +2 -2
  186. package/lib/util/workspace-port-authentication.js.map +1 -1
  187. package/lib/workspace-cluster.d.ts +22 -3
  188. package/lib/workspace-cluster.d.ts.map +1 -1
  189. package/lib/workspace-cluster.js +3 -3
  190. package/lib/workspace-cluster.js.map +1 -1
  191. package/lib/workspace-instance.d.ts +5 -2
  192. package/lib/workspace-instance.d.ts.map +1 -1
  193. package/lib/wsready.d.ts +1 -1
  194. package/lib/wsready.js +2 -2
  195. package/package.json +28 -16
  196. package/pkg-yarn.lock +17 -9
  197. package/src/accounting-protocol.ts +4 -10
  198. package/src/admin-protocol.ts +33 -5
  199. package/src/analytics.ts +54 -0
  200. package/src/context-url.spec.ts +39 -0
  201. package/src/context-url.ts +51 -0
  202. package/src/email-protocol.ts +2 -3
  203. package/src/env.ts +10 -10
  204. package/src/gitpod-service.ts +129 -35
  205. package/src/headless-workspace-log.ts +7 -11
  206. package/src/ide-protocol.ts +92 -0
  207. package/src/index.ts +5 -1
  208. package/src/messaging/browser/connection.ts +184 -23
  209. package/src/messaging/client-call-metrics.ts +97 -0
  210. package/src/messaging/error.ts +5 -2
  211. package/src/messaging/handler.ts +12 -0
  212. package/src/messaging/node/connection.ts +2 -2
  213. package/src/messaging/proxy-factory.ts +13 -5
  214. package/src/permission.ts +2 -1
  215. package/src/plans.ts +632 -0
  216. package/src/protocol.ts +89 -18
  217. package/src/snapshot-url.spec.ts +25 -0
  218. package/src/snapshot-url.ts +27 -0
  219. package/src/team-subscription-protocol.ts +7 -5
  220. package/src/teams-projects-protocol.ts +132 -0
  221. package/src/util/analytics.ts +87 -0
  222. package/src/util/garbage-collected-cache.ts +2 -2
  223. package/src/util/generate-workspace-id.spec.ts +3 -3
  224. package/src/util/generate-workspace-id.ts +2 -0
  225. package/src/util/gitpod-cookie.ts +39 -0
  226. package/src/util/gitpod-host-url.spec.ts +24 -0
  227. package/src/util/gitpod-host-url.ts +23 -10
  228. package/src/util/grpc.ts +15 -0
  229. package/src/util/logging.ts +102 -38
  230. package/src/util/parse-workspace-id.spec.ts +21 -1
  231. package/src/util/parse-workspace-id.ts +32 -6
  232. package/src/util/semaphore.ts +2 -2
  233. package/src/util/skip-if.ts +1 -1
  234. package/src/util/timeutil.ts +4 -4
  235. package/src/util/tracing.ts +65 -3
  236. package/src/workspace-cluster.ts +24 -8
  237. package/src/workspace-instance.ts +25 -13
  238. package/src/wsready.ts +2 -2
  239. package/lib/util/context-url.d.ts +0 -13
  240. package/lib/util/context-url.d.ts.map +0 -1
  241. package/lib/util/context-url.js +0 -26
  242. package/lib/util/context-url.js.map +0 -1
  243. package/lib/util/context-url.spec.d.ts.map +0 -1
  244. package/lib/util/context-url.spec.js +0 -52
  245. package/lib/util/context-url.spec.js.map +0 -1
  246. package/lib/util/without.d.ts +0 -7
  247. package/lib/util/without.d.ts.map +0 -1
  248. package/lib/util/without.js.map +0 -1
  249. package/src/util/context-url.spec.ts +0 -25
  250. package/src/util/context-url.ts +0 -23
@@ -4,7 +4,7 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
  import { DeepPartial } from "./util/deep-partial";
7
- import { Without } from './util/without';
7
+ import { PermissionName } from './permission';
8
8
  export interface WorkspaceCluster {
9
9
  name: string;
10
10
  url: string;
@@ -13,6 +13,8 @@ export interface WorkspaceCluster {
13
13
  maxScore: number;
14
14
  score: number;
15
15
  govern: boolean;
16
+ admissionConstraints?: AdmissionConstraint[];
17
+ admissionPreferences?: AdmissionPreference[];
16
18
  }
17
19
  export declare type WorkspaceClusterState = "available" | "cordoned" | "draining";
18
20
  export interface TLSConfig {
@@ -23,8 +25,25 @@ export interface TLSConfig {
23
25
  export declare namespace TLSConfig {
24
26
  const loadFromBase64File: (path: string) => string;
25
27
  }
26
- export declare type WorkspaceClusterWoTls = Without<WorkspaceCluster, "tls">;
28
+ export declare type WorkspaceClusterWoTLS = Omit<WorkspaceCluster, "tls">;
27
29
  export declare type WorkspaceManagerConnectionInfo = Pick<WorkspaceCluster, "name" | "url" | "tls">;
30
+ export declare type AdmissionConstraint = AdmissionConstraintFeaturePreview | AdmissionConstraintHasRole | AdmissionConstraintHasUserLevel;
31
+ export declare type AdmissionConstraintFeaturePreview = {
32
+ type: "has-feature-preview";
33
+ };
34
+ export declare type AdmissionConstraintHasRole = {
35
+ type: "has-permission";
36
+ permission: PermissionName;
37
+ };
38
+ export declare type AdmissionConstraintHasUserLevel = {
39
+ type: "has-user-level";
40
+ level: string;
41
+ };
42
+ export declare type AdmissionPreference = AdmissionPreferenceUserLevel;
43
+ export declare type AdmissionPreferenceUserLevel = {
44
+ type: 'user-level';
45
+ level: string;
46
+ };
28
47
  export declare const WorkspaceClusterDB: unique symbol;
29
48
  export interface WorkspaceClusterDB {
30
49
  /**
@@ -47,7 +66,7 @@ export interface WorkspaceClusterDB {
47
66
  * Lists all WorkspaceClusterWoTls for which the given predicate is true (does not return TLS for size/speed concerns)
48
67
  * @param predicate
49
68
  */
50
- findFiltered(predicate: DeepPartial<WorkspaceClusterFilter>): Promise<WorkspaceClusterWoTls[]>;
69
+ findFiltered(predicate: DeepPartial<WorkspaceClusterFilter>): Promise<WorkspaceClusterWoTLS[]>;
51
70
  }
52
71
  export interface WorkspaceClusterFilter extends Pick<WorkspaceCluster, "state" | "govern" | "url"> {
53
72
  minScore: number;
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-cluster.d.ts","sourceRoot":"","sources":["../src/workspace-cluster.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAI7B,IAAI,EAAE,MAAM,CAAC;IAGb,GAAG,EAAE,MAAM,CAAC;IAGZ,GAAG,CAAC,EAAE,SAAS,CAAC;IAGhB,KAAK,EAAE,qBAAqB,CAAC;IAG7B,QAAQ,EAAE,MAAM,CAAC;IAGjB,KAAK,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,OAAO,CAAC;CACnB;AACD,oBAAY,qBAAqB,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAC1E,MAAM,WAAW,SAAS;IAEtB,EAAE,EAAE,MAAM,CAAC;IAEX,GAAG,EAAE,MAAM,CAAC;IAEZ,GAAG,EAAE,MAAM,CAAC;CACf;AACD,yBAAiB,SAAS,CAAC;IAChB,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAA6E,CAAC;CACnI;AACD,oBAAY,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACrE,oBAAY,8BAA8B,GAAG,IAAI,CAAC,gB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,SAAS,CAAC,CAAC;IAEhE;;;OAGG;IACH,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,sBAAsB,CAAC,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;CAClG;AACD,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC9F,QAAQ,EAAE,MAAM,CAAC;CACpB"}
@@ -6,11 +6,11 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.WorkspaceClusterDB = exports.TLSConfig = void 0;
9
- var fs = require("fs");
10
- var env_1 = require("./env");
9
+ const fs = require("fs");
10
+ const env_1 = require("./env");
11
11
  var TLSConfig;
12
12
  (function (TLSConfig) {
13
- TLSConfig.loadFromBase64File = function (path) { return fs.readFileSync(env_1.filePathTelepresenceAware(path)).toString("base64"); };
13
+ TLSConfig.loadFromBase64File = (path) => fs.readFileSync((0, env_1.filePathTelepresenceAware)(path)).toString("base64");
14
14
  })(TLSConfig = exports.TLSConfig || (exports.TLSConfig = {}));
15
15
  exports.WorkspaceClusterDB = Symbol("WorkspaceClusterDB");
16
16
  //# sourceMappingURL=workspace-cluster.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-cluster.js","sourceRoot":"","sources":["../src/workspace-cluster.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,uBAAyB;AACzB,6BAAkD;AAqClD,IAAiB,SAAS,CAEzB;AAFD,WAAiB,SAAS;IACT,4BAAkB,GAAG,UAAC,IAAY,IAAa,OAAA,EAAE,CAAC,YAAY,CAAC,+BAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAnE,CAAmE,CAAC;AACpI,CAAC,EAFgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEzB;AAIY,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"workspace-cluster.js","sourceRoot":"","sources":["../src/workspace-cluster.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,yBAAyB;AACzB,+BAAkD;AA4ClD,IAAiB,SAAS,CAEzB;AAFD,WAAiB,SAAS;IACT,4BAAkB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,IAAA,+BAAyB,EAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpI,CAAC,EAFgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEzB;AAaY,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC"}
@@ -10,6 +10,7 @@ export interface WorkspaceInstance {
10
10
  creationTime: string;
11
11
  deployedTime?: string;
12
12
  startedTime?: string;
13
+ stoppingTime?: string;
13
14
  stoppedTime?: string;
14
15
  ideUrl: string;
15
16
  region: string;
@@ -35,16 +36,16 @@ export interface WorkspaceInstanceConditions {
35
36
  failed?: string;
36
37
  timeout?: string;
37
38
  pullingImages?: boolean;
38
- serviceExists?: boolean;
39
39
  deployed?: boolean;
40
40
  neededImageBuild?: boolean;
41
41
  firstUserActivity?: string;
42
+ headlessTaskFailed?: string;
43
+ stoppedByRequest?: boolean;
42
44
  }
43
45
  export declare type AdmissionLevel = 'owner_only' | 'everyone';
44
46
  export declare type PortVisibility = 'public' | 'private';
45
47
  export interface WorkspaceInstancePort {
46
48
  port: number;
47
- targetPort?: number;
48
49
  visibility?: PortVisibility;
49
50
  url?: string;
50
51
  }
@@ -62,5 +63,7 @@ export interface WorkspaceInstanceConfiguration {
62
63
  theiaVersion?: string;
63
64
  featureFlags?: NamedWorkspaceFeatureFlag[];
64
65
  ideImage: string;
66
+ desktopIdeImage?: string;
67
+ supervisorImage?: string;
65
68
  }
66
69
  //# sourceMappingURL=workspace-instance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-instance.d.ts","sourceRoot":"","sources":["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B;AAGD,oBAAY,cAAc,GAAG,YAAY,GAAG,UAAU,CAAC;AAGvD,oBAAY,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAGlD,MAAM,WAAW,qBAAqB;IAElC,IAAI,EAAE,MAAM,CAAC;IAGb,UAAU,CAAC,EAAE,cAAc,CAAC;IAG5B,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,2BAA2B;IAExC,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAG3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAG7B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAG1B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAG5B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAG3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAChC;AAGD,MAAM,WAAW,8BAA8B;IAG3C,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,YAAY,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAG3C,QAAQ,EAAE,MAAM,CAAC;IAGjB,eAAe,CAAC,EAAE,MAAM,CAAA;IAGxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B"}
package/lib/wsready.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
2
+ * Copyright (c) 2021 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
  */
package/lib/wsready.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
+ * Copyright (c) 2021 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
8
  exports.WorkspaceInitSource = void 0;
9
- // generated using github.com/32leaves/bel on 2020-06-11 14:47:30.351829728 +0000 UTC m=+0.002956090
9
+ // generated using github.com/32leaves/bel on 2021-11-04 12:16:53.917570766 +0000 UTC m=+0.006002884
10
10
  // DO NOT MODIFY
11
11
  var WorkspaceInitSource;
12
12
  (function (WorkspaceInitSource) {
package/package.json CHANGED
@@ -1,33 +1,45 @@
1
1
  {
2
2
  "dependencies": {
3
+ "@types/react": "17.0.32",
3
4
  "ajv": "^6.5.4",
4
- "inversify": "^5.0.1",
5
- "jaeger-client": "3.17.2",
5
+ "analytics-node": "^4.0.1",
6
+ "cookie": "^0.4.1",
7
+ "inversify": "^5.1.1",
8
+ "jaeger-client": "^3.18.1",
6
9
  "js-yaml": "^3.10.0",
7
- "opentracing": "^0.14.4",
8
- "prom-client": "^10.2.0",
10
+ "opentracing": "^0.14.5",
11
+ "prom-client": "^13.2.0",
9
12
  "random-number-csprng": "^1.0.2",
10
- "reconnecting-websocket": "^4.2.0",
11
- "reflect-metadata": "^0.1.10",
12
- "uuid": "^3.3.3",
13
+ "react": "17.0.2",
14
+ "react-dom": "17.0.2",
15
+ "reconnecting-websocket": "^4.4.0",
16
+ "reflect-metadata": "^0.1.13",
17
+ "uuid": "^8.3.2",
18
+ "vscode-jsonrpc": "^5.0.1",
19
+ "vscode-languageserver-protocol": "3.16.0",
20
+ "vscode-languageserver-types": "3.16.0",
13
21
  "vscode-uri": "^1.0.1",
14
22
  "vscode-ws-jsonrpc": "^0.2.0",
15
- "ws": "^5.2.2"
23
+ "ws": "^7.4.6"
16
24
  },
17
25
  "devDependencies": {
18
- "@types/chai-subset": "^1.3.1",
26
+ "@types/analytics-node": "^3.1.5",
27
+ "@types/chai-subset": "^1.3.3",
28
+ "@types/cookie": "^0.4.1",
19
29
  "@types/js-yaml": "^3.10.1",
30
+ "@types/mocha": "^5.2.7",
31
+ "@types/node": "^16.11.6",
20
32
  "@types/random-number-csprng": "^1.0.0",
21
- "@types/uuid": "^3.4.5",
33
+ "@types/uuid": "^8.3.1",
22
34
  "@types/ws": "^5.1.2",
23
- "chai": "^4.1.2",
35
+ "chai": "^4.3.4",
24
36
  "chai-subset": "^1.6.0",
25
37
  "mocha": "^5.0.0",
26
38
  "mocha-typescript": "^1.1.11",
27
39
  "rimraf": "^2.6.2",
28
40
  "ts-node": "^9.0.0",
29
- "typescript": "~4.1.2",
30
- "typescript-json-schema": "^0.43.0",
41
+ "typescript": "~4.4.2",
42
+ "typescript-json-schema": "^0.50.1",
31
43
  "typescript-parser": "^2.6.1"
32
44
  },
33
45
  "files": [
@@ -43,9 +55,9 @@
43
55
  "build": "tsc",
44
56
  "clean": "rimraf lib",
45
57
  "prepare": "yarn run clean && yarn run build",
46
- "test": "mocha --opts mocha.opts '**/*.spec.ts'",
58
+ "test": "mocha --opts mocha.opts './**/*.spec.ts' --exclude './node_modules/**'",
47
59
  "watch": "leeway exec --package .:lib --transitive-dependencies --filter-type yarn --components --parallel -- tsc -w --preserveWatchOutput"
48
60
  },
49
61
  "types": "./lib/index.d.ts",
50
- "version": "0.1.5-pluggable-workspace-cluster.21"
51
- }
62
+ "version": "0.1.5-port-description-3059-fork.0"
63
+ }
package/pkg-yarn.lock CHANGED
@@ -4,19 +4,27 @@
4
4
 
5
5
  "@gitpod/gitpod-protocol@0.1.5":
6
6
  version "0.1.5"
7
- resolved "file:///tmp/cache/3a2b24d58c92429bc60efd23a639e535d9aa7887.tar.gz"
7
+ resolved "file:///tmp/cache/315dc4f3bc0ed7115f4ad492a0465ced896ddb36.tar.gz"
8
8
  dependencies:
9
+ "@types/react" "17.0.32"
9
10
  ajv "^6.5.4"
10
- inversify "^5.0.1"
11
- jaeger-client "3.17.2"
11
+ analytics-node "^4.0.1"
12
+ cookie "^0.4.1"
13
+ inversify "^5.1.1"
14
+ jaeger-client "^3.18.1"
12
15
  js-yaml "^3.10.0"
13
- opentracing "^0.14.4"
14
- prom-client "^10.2.0"
16
+ opentracing "^0.14.5"
17
+ prom-client "^13.2.0"
15
18
  random-number-csprng "^1.0.2"
16
- reconnecting-websocket "^4.2.0"
17
- reflect-metadata "^0.1.10"
18
- uuid "^3.3.3"
19
+ react "17.0.2"
20
+ react-dom "17.0.2"
21
+ reconnecting-websocket "^4.4.0"
22
+ reflect-metadata "^0.1.13"
23
+ uuid "^8.3.2"
24
+ vscode-jsonrpc "^5.0.1"
25
+ vscode-languageserver-protocol "3.16.0"
26
+ vscode-languageserver-types "3.16.0"
19
27
  vscode-uri "^1.0.1"
20
28
  vscode-ws-jsonrpc "^0.2.0"
21
- ws "^5.2.2"
29
+ ws "^7.4.6"
22
30
 
@@ -4,8 +4,7 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import * as uuidv4 from 'uuid/v4';
8
- import { Without } from "./util/without";
7
+ import { v4 as uuidv4 } from 'uuid';
9
8
  import { User } from './protocol';
10
9
  import { oneMonthLater } from './util/timeutil';
11
10
 
@@ -47,7 +46,7 @@ export interface AccountEntry {
47
46
  description?: object;
48
47
  }
49
48
  export namespace AccountEntry {
50
- export function create<T extends AccountEntry>(entry: Without<T, 'uid'>): T {
49
+ export function create<T extends AccountEntry>(entry: Omit<T, 'uid'>): T {
51
50
  const result = entry as T;
52
51
  result.uid = uuidv4();
53
52
  return result;
@@ -91,7 +90,6 @@ export interface SessionDescription {
91
90
  contextUrl: string;
92
91
  workspaceId: string;
93
92
  workspaceInstanceId: string;
94
- private: boolean;
95
93
  }
96
94
  export namespace SessionDescription {
97
95
  export function is(obj: any): obj is SessionDescription {
@@ -100,7 +98,6 @@ export namespace SessionDescription {
100
98
  && obj.hasOwnProperty('contextUrl')
101
99
  && obj.hasOwnProperty('workspaceId')
102
100
  && obj.hasOwnProperty('workspaceInstanceId')
103
- && obj.hasOwnProperty('private');
104
101
  }
105
102
  }
106
103
 
@@ -164,7 +161,7 @@ export namespace AssignedTeamSubscription {
164
161
  }
165
162
 
166
163
  export namespace Subscription {
167
- export function create(newSubscription: Without<Subscription, 'uid'>) {
164
+ export function create(newSubscription: Omit<Subscription, 'uid'>) {
168
165
  const subscription = newSubscription as Subscription;
169
166
  subscription.uid = uuidv4();
170
167
  return subscription;
@@ -193,9 +190,6 @@ export namespace Subscription {
193
190
  export function isDowngraded(s: Subscription) {
194
191
  return s.paymentData && s.paymentData.downgradeDate;
195
192
  };
196
- export function isCancelled(s: Subscription) {
197
- return !!s.cancellationDate;
198
- };
199
193
  export function calculateCurrentPeriod(startDate: string, now: Date) {
200
194
  let nextStartDate = startDate;
201
195
  do {
@@ -215,7 +209,7 @@ export interface Period {
215
209
 
216
210
  export type MaybePeriod = Period | undefined;
217
211
 
218
- export type AccountEntryFixedPeriod = Without<AccountEntry, 'uid'> & { expiryDate: string };
212
+ export type AccountEntryFixedPeriod = Omit<AccountEntry, 'uid'> & { expiryDate: string };
219
213
  export interface AccountStatement extends Period {
220
214
  userId: string;
221
215
  /**
@@ -5,7 +5,6 @@
5
5
  */
6
6
 
7
7
  import { User, Workspace, NamedWorkspaceFeatureFlag } from "./protocol";
8
- import { Without } from "./util/without";
9
8
  import { WorkspaceInstance, WorkspaceInstancePhase } from "./workspace-instance";
10
9
  import { RoleOrPermission } from "./permission";
11
10
  import { AccountStatement } from "./accounting-protocol";
@@ -21,6 +20,7 @@ export interface AdminServer {
21
20
  adminGetWorkspaces(req: AdminGetWorkspacesRequest): Promise<AdminGetListResult<WorkspaceAndInstance>>;
22
21
  adminGetWorkspace(id: string): Promise<WorkspaceAndInstance>;
23
22
  adminForceStopWorkspace(id: string): Promise<void>;
23
+ adminRestoreSoftDeletedWorkspace(id: string): Promise<void>;
24
24
 
25
25
  adminSetLicense(key: string): Promise<void>;
26
26
 
@@ -28,6 +28,7 @@ export interface AdminServer {
28
28
  adminSetProfessionalOpenSource(userId: string, shouldGetProfOSS: boolean): Promise<void>;
29
29
  adminIsStudent(userId: string): Promise<boolean>;
30
30
  adminAddStudentEmailDomain(userId: string, domain: string): Promise<void>;
31
+ adminGrantExtraHours(userId: string, extraHours: number): Promise<void>;
31
32
  }
32
33
 
33
34
  export interface AdminGetListRequest<T> {
@@ -64,7 +65,7 @@ export interface AdminModifyPermanentWorkspaceFeatureFlagRequest {
64
65
  }[]
65
66
  }
66
67
 
67
- export interface WorkspaceAndInstance extends Without<Workspace, "id"|"creationTime">, Without<WorkspaceInstance, "id"|"creationTime"> {
68
+ export interface WorkspaceAndInstance extends Omit<Workspace, "id"|"creationTime">, Omit<WorkspaceInstance, "id"|"creationTime"> {
68
69
  workspaceId: string;
69
70
  workspaceCreationTime: string;
70
71
  instanceId: string;
@@ -72,6 +73,33 @@ export interface WorkspaceAndInstance extends Without<Workspace, "id"|"creationT
72
73
  phase: WorkspaceInstancePhase;
73
74
  }
74
75
 
75
- export interface AdminGetWorkspacesRequest extends AdminGetListRequest<WorkspaceAndInstance> {
76
- ownerId?: string
77
- }
76
+ export namespace WorkspaceAndInstance {
77
+ export function toWorkspace(wai: WorkspaceAndInstance): Workspace {
78
+ return {
79
+ id: wai.workspaceId,
80
+ creationTime: wai.workspaceCreationTime,
81
+ ... wai
82
+ };
83
+ }
84
+
85
+ export function toInstance(wai: WorkspaceAndInstance): WorkspaceInstance | undefined {
86
+ if (!wai.instanceId) {
87
+ return undefined;
88
+ }
89
+ return {
90
+ id: wai.instanceId,
91
+ creationTime: wai.instanceCreationTime,
92
+ ... wai
93
+ };
94
+ }
95
+ }
96
+
97
+ export type AdminGetWorkspacesRequest = AdminGetListRequest<WorkspaceAndInstance> & AdminGetWorkspacesQuery;
98
+ /** The fields are meant to be used either OR (not combined) */
99
+ export type AdminGetWorkspacesQuery = {
100
+ /** we use this field in case we have a UUIDv4 and don't know whether it's an (old) workspace or instance id */
101
+ instanceIdOrWorkspaceId?: string;
102
+ instanceId?: string;
103
+ workspaceId?: string;
104
+ ownerId?: string;
105
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copyright (c) 2021 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+
8
+ export const IAnalyticsWriter = Symbol("IAnalyticsWriter");
9
+
10
+ type Identity =
11
+ | { userId: string | number }
12
+ | { userId?: string | number; anonymousId: string | number };
13
+
14
+ interface Message {
15
+ messageId?: string;
16
+ }
17
+
18
+ export type IdentifyMessage = Message & Identity & {
19
+ traits?: any;
20
+ timestamp?: Date;
21
+ context?: any;
22
+ };
23
+
24
+ export type TrackMessage = Message & Identity & {
25
+ event: string;
26
+ properties?: any;
27
+ timestamp?: Date;
28
+ context?: any;
29
+ };
30
+
31
+ export type PageMessage = Message & Identity & {
32
+ properties?: any;
33
+ timestamp?: Date;
34
+ context?: any;
35
+ };
36
+
37
+ export type RemoteTrackMessage = Omit<TrackMessage, "timestamp" | "userId" | "anonymousId"> & {
38
+ anonymousId?: string | number;
39
+ };
40
+ export type RemotePageMessage = Omit<PageMessage, "timestamp" | "userId"> & {
41
+ anonymousId?: string | number;
42
+ };
43
+
44
+ export type RemoteIdentifyMessage = Omit<IdentifyMessage, "timestamp" | "userId" | "anonymousId">;
45
+
46
+ export interface IAnalyticsWriter {
47
+
48
+ identify(msg: IdentifyMessage): void;
49
+
50
+ track(msg: TrackMessage): void;
51
+
52
+ page(msg: PageMessage): void;
53
+
54
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+ import * as chai from 'chai';
8
+ import { suite, test } from 'mocha-typescript';
9
+ import { ContextURL } from './context-url';
10
+ const expect = chai.expect;
11
+
12
+ @suite
13
+ export class ContextUrlTest {
14
+
15
+ @test public parseContextUrl_withEnvVar() {
16
+ const actual = ContextURL.parseToURL("passedin=test%20value/https://github.com/gitpod-io/gitpod-test-repo");
17
+ expect(actual?.host).to.equal("github.com");
18
+ expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
19
+ }
20
+
21
+ @test public parseContextUrl_withEnvVar_withoutSchema() {
22
+ const actual = ContextURL.parseToURL("passedin=test%20value/github.com/gitpod-io/gitpod-test-repo");
23
+ expect(actual?.host).to.equal("github.com");
24
+ expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
25
+ }
26
+
27
+ @test public parseContextUrl_withPrebuild() {
28
+ const actual = ContextURL.parseToURL("prebuild/https://github.com/gitpod-io/gitpod-test-repo");
29
+ expect(actual?.host).to.equal("github.com");
30
+ expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
31
+ }
32
+
33
+ @test public parseContextUrl_withPrebuild_withoutSchema() {
34
+ const actual = ContextURL.parseToURL("prebuild/github.com/gitpod-io/gitpod-test-repo");
35
+ expect(actual?.host).to.equal("github.com");
36
+ expect(actual?.pathname).to.equal("/gitpod-io/gitpod-test-repo");
37
+ }
38
+ }
39
+ module.exports = new ContextUrlTest()
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Copyright (c) 2020 Gitpod GmbH. All rights reserved.
3
+ * Licensed under the GNU Affero General Public License (AGPL).
4
+ * See License-AGPL.txt in the project root for license information.
5
+ */
6
+
7
+ export namespace ContextURL {
8
+ export const INCREMENTAL_PREBUILD_PREFIX = "incremental-prebuild";
9
+ export const PREBUILD_PREFIX = "prebuild";
10
+ export const IMAGEBUILD_PREFIX = "imagebuild";
11
+
12
+ /**
13
+ * The field "contextUrl" might contain prefixes like:
14
+ * - envvar1=value1/...
15
+ * - prebuild/...
16
+ * This is the analogon to the (Prefix)ContextParser structure in "server".
17
+ */
18
+ export function parseToURL(contextUrl: string | undefined): URL | undefined {
19
+ if (contextUrl === undefined) {
20
+ return undefined;
21
+ }
22
+
23
+ const segments = contextUrl.split("/");
24
+ if (segments.length === 1) {
25
+ return new URL(segments[0]); // this might be something, we just try
26
+ }
27
+
28
+ const segmentsToURL = (offset: number): URL => {
29
+ let rest = segments.slice(offset).join("/");
30
+ if (!rest.startsWith("http")) {
31
+ rest = 'https://' + rest;
32
+ }
33
+ return new URL(rest);
34
+ };
35
+
36
+
37
+ const firstSegment = segments[0];
38
+ if (firstSegment === PREBUILD_PREFIX ||
39
+ firstSegment === INCREMENTAL_PREBUILD_PREFIX ||
40
+ firstSegment === IMAGEBUILD_PREFIX) {
41
+ return segmentsToURL(1);
42
+ }
43
+
44
+ // check for env vars
45
+ if (firstSegment.indexOf("=") !== -1) {
46
+ return segmentsToURL(1);
47
+ }
48
+
49
+ return segmentsToURL(0);
50
+ }
51
+ }
@@ -4,8 +4,7 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- import { Without } from "./util/without";
8
- import uuidv4 = require("uuid/v4");
7
+ import { v4 as uuidv4 } from 'uuid';
9
8
 
10
9
  export type EMailState = "scheduledInternal"
11
10
  | "scheduledSendgrid";
@@ -59,7 +58,7 @@ export type EMail = {
59
58
  } & EMailStatus;
60
59
 
61
60
  export namespace EMail {
62
- export const create = (ts: Without<EMail, 'uid'>): EMail => {
61
+ export const create = (ts: Omit<EMail, 'uid'>): EMail => {
63
62
  const withId = ts as EMail;
64
63
  withId.uid = uuidv4();
65
64
  return withId;
package/src/env.ts CHANGED
@@ -13,18 +13,18 @@ const legacyStagenameTranslation: { [key: string]: KubeStage } = {
13
13
  "dev": "dev"
14
14
  }
15
15
 
16
+ export function translateLegacyStagename(kubeStage: string): KubeStage {
17
+ const stage = legacyStagenameTranslation[kubeStage];
18
+ if (!stage) {
19
+ throw new Error(`Invalid KUBE_STAGE: ${kubeStage}`);
20
+ }
21
+
22
+ return stage;
23
+ }
24
+
16
25
  @injectable()
17
26
  export abstract class AbstractComponentEnv {
18
- readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE', (kubeStage) => {
19
- const stage = legacyStagenameTranslation[kubeStage];
20
- if (!stage) {
21
- throw new Error(`Environment variable invalid: KUBE_STAGE=${kubeStage}`);
22
- }
23
-
24
- return stage;
25
- });
26
- readonly kubeNamespace: string = getEnvVar('KUBE_NAMESPACE');
27
- readonly version: string = getEnvVar('VERSION');
27
+ readonly kubeStage: KubeStage = getEnvVarParsed('KUBE_STAGE', translateLegacyStagename);
28
28
 
29
29
  readonly installationLongname: string = getEnvVar("GITPOD_INSTALLATION_LONGNAME")
30
30
  readonly installationShortname: string = getEnvVar("GITPOD_INSTALLATION_SHORTNAME")