@gitpod/gitpod-protocol 0.1.5-vn-fix-undefined-context-ref-on-jb-gateway.1 → 0.1.5-vn-jetbrains-backend-plugin-223.7

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 (183) hide show
  1. package/data/gitpod-schema.json +63 -113
  2. package/lib/accounting-protocol.d.ts +1 -0
  3. package/lib/accounting-protocol.d.ts.map +1 -1
  4. package/lib/accounting-protocol.js +4 -0
  5. package/lib/accounting-protocol.js.map +1 -1
  6. package/lib/admin-protocol.d.ts +7 -0
  7. package/lib/admin-protocol.d.ts.map +1 -1
  8. package/lib/admin-protocol.js.map +1 -1
  9. package/lib/attribution.d.ts +20 -0
  10. package/lib/attribution.d.ts.map +1 -0
  11. package/lib/attribution.js +40 -0
  12. package/lib/attribution.js.map +1 -0
  13. package/lib/billing-mode.d.ts +41 -0
  14. package/lib/billing-mode.d.ts.map +1 -0
  15. package/lib/billing-mode.js +44 -0
  16. package/lib/billing-mode.js.map +1 -0
  17. package/lib/blocked-repositories-protocol.d.ts +13 -0
  18. package/lib/blocked-repositories-protocol.d.ts.map +1 -0
  19. package/lib/blocked-repositories-protocol.js +8 -0
  20. package/lib/blocked-repositories-protocol.js.map +1 -0
  21. package/lib/context-url.js +1 -1
  22. package/lib/context-url.js.map +1 -1
  23. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  24. package/lib/encryption/encryption-engine.js +3 -3
  25. package/lib/encryption/encryption-engine.js.map +1 -1
  26. package/lib/encryption/encryption-engine.spec.js +1 -1
  27. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  28. package/lib/encryption/key-provider.js +1 -1
  29. package/lib/encryption/key-provider.js.map +1 -1
  30. package/lib/experiments/always-default.d.ts +8 -0
  31. package/lib/experiments/always-default.d.ts.map +1 -0
  32. package/lib/experiments/always-default.js +20 -0
  33. package/lib/experiments/always-default.js.map +1 -0
  34. package/lib/experiments/configcat-server.d.ts +10 -0
  35. package/lib/experiments/configcat-server.d.ts.map +1 -0
  36. package/lib/experiments/configcat-server.js +36 -0
  37. package/lib/experiments/configcat-server.js.map +1 -0
  38. package/lib/experiments/configcat.d.ts +23 -0
  39. package/lib/experiments/configcat.d.ts.map +1 -0
  40. package/lib/experiments/configcat.js +57 -0
  41. package/lib/experiments/configcat.js.map +1 -0
  42. package/lib/experiments/types.d.ts +24 -0
  43. package/lib/experiments/types.d.ts.map +1 -0
  44. package/lib/experiments/types.js +10 -0
  45. package/lib/experiments/types.js.map +1 -0
  46. package/lib/gitpod-service.d.ts +35 -11
  47. package/lib/gitpod-service.d.ts.map +1 -1
  48. package/lib/gitpod-service.js +13 -1
  49. package/lib/gitpod-service.js.map +1 -1
  50. package/lib/ide-protocol.d.ts +8 -0
  51. package/lib/ide-protocol.d.ts.map +1 -1
  52. package/lib/index.d.ts +1 -1
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +1 -1
  55. package/lib/index.js.map +1 -1
  56. package/lib/installation-admin-protocol.d.ts +3 -0
  57. package/lib/installation-admin-protocol.d.ts.map +1 -1
  58. package/lib/installation-admin-protocol.js +1 -0
  59. package/lib/installation-admin-protocol.js.map +1 -1
  60. package/lib/messaging/client-call-metrics.d.ts +1 -17
  61. package/lib/messaging/client-call-metrics.d.ts.map +1 -1
  62. package/lib/messaging/client-call-metrics.js +1 -2
  63. package/lib/messaging/client-call-metrics.js.map +1 -1
  64. package/lib/messaging/error.d.ts +6 -1
  65. package/lib/messaging/error.d.ts.map +1 -1
  66. package/lib/messaging/error.js +13 -3
  67. package/lib/messaging/error.js.map +1 -1
  68. package/lib/plans.d.ts +1 -0
  69. package/lib/plans.d.ts.map +1 -1
  70. package/lib/plans.js +4 -0
  71. package/lib/plans.js.map +1 -1
  72. package/lib/protocol.d.ts +88 -12
  73. package/lib/protocol.d.ts.map +1 -1
  74. package/lib/protocol.js +117 -11
  75. package/lib/protocol.js.map +1 -1
  76. package/lib/protocol.spec.d.ts +7 -0
  77. package/lib/protocol.spec.d.ts.map +1 -0
  78. package/lib/protocol.spec.js +127 -0
  79. package/lib/protocol.spec.js.map +1 -0
  80. package/lib/team-subscription-protocol.d.ts +2 -0
  81. package/lib/team-subscription-protocol.d.ts.map +1 -1
  82. package/lib/team-subscription-protocol.js +4 -0
  83. package/lib/team-subscription-protocol.js.map +1 -1
  84. package/lib/teams-projects-protocol.d.ts +14 -1
  85. package/lib/teams-projects-protocol.d.ts.map +1 -1
  86. package/lib/teams-projects-protocol.js.map +1 -1
  87. package/lib/usage.d.ts +61 -0
  88. package/lib/usage.d.ts.map +1 -0
  89. package/lib/usage.js +14 -0
  90. package/lib/usage.js.map +1 -0
  91. package/lib/util/debug-app.d.ts +25 -0
  92. package/lib/util/debug-app.d.ts.map +1 -0
  93. package/lib/util/debug-app.js +100 -0
  94. package/lib/util/debug-app.js.map +1 -0
  95. package/lib/util/garbage-collected-cache.d.ts.map +1 -1
  96. package/lib/util/garbage-collected-cache.js +5 -0
  97. package/lib/util/garbage-collected-cache.js.map +1 -1
  98. package/lib/util/gitpod-host-url.d.ts +3 -0
  99. package/lib/util/gitpod-host-url.d.ts.map +1 -1
  100. package/lib/util/gitpod-host-url.js +18 -0
  101. package/lib/util/gitpod-host-url.js.map +1 -1
  102. package/lib/util/grpc.d.ts +19 -0
  103. package/lib/util/grpc.d.ts.map +1 -1
  104. package/lib/util/grpc.js +73 -1
  105. package/lib/util/grpc.js.map +1 -1
  106. package/lib/util/logging.d.ts.map +1 -1
  107. package/lib/util/logging.js +8 -1
  108. package/lib/util/logging.js.map +1 -1
  109. package/lib/util/logging.spec.d.ts +7 -0
  110. package/lib/util/logging.spec.d.ts.map +1 -0
  111. package/lib/util/logging.spec.js +52 -0
  112. package/lib/util/logging.spec.js.map +1 -0
  113. package/lib/util/timeutil.d.ts +2 -0
  114. package/lib/util/timeutil.d.ts.map +1 -1
  115. package/lib/util/timeutil.js +13 -1
  116. package/lib/util/timeutil.js.map +1 -1
  117. package/lib/util/timeutil.spec.d.ts +2 -0
  118. package/lib/util/timeutil.spec.d.ts.map +1 -1
  119. package/lib/util/timeutil.spec.js +34 -0
  120. package/lib/util/timeutil.spec.js.map +1 -1
  121. package/lib/webhook-event.d.ts +44 -0
  122. package/lib/webhook-event.d.ts.map +1 -0
  123. package/lib/webhook-event.js +8 -0
  124. package/lib/webhook-event.js.map +1 -0
  125. package/lib/workspace-class.d.ts +14 -0
  126. package/lib/workspace-class.d.ts.map +1 -0
  127. package/lib/workspace-class.js +8 -0
  128. package/lib/workspace-class.js.map +1 -0
  129. package/lib/workspace-cluster.d.ts +5 -7
  130. package/lib/workspace-cluster.d.ts.map +1 -1
  131. package/lib/workspace-cluster.js.map +1 -1
  132. package/lib/workspace-instance.d.ts +12 -0
  133. package/lib/workspace-instance.d.ts.map +1 -1
  134. package/lib/wsready.d.ts +3 -3
  135. package/lib/wsready.d.ts.map +1 -1
  136. package/lib/wsready.js +0 -2
  137. package/lib/wsready.js.map +1 -1
  138. package/package.json +12 -6
  139. package/pkg-yarn.lock +8 -5
  140. package/provenance-bundle.jsonl +1 -1
  141. package/src/accounting-protocol.ts +3 -0
  142. package/src/admin-protocol.ts +10 -0
  143. package/src/attribution.ts +48 -0
  144. package/src/billing-mode.ts +77 -0
  145. package/src/blocked-repositories-protocol.ts +13 -0
  146. package/src/context-url.ts +1 -1
  147. package/src/encryption/encryption-engine.spec.ts +1 -1
  148. package/src/encryption/encryption-engine.ts +7 -3
  149. package/src/encryption/key-provider.ts +1 -1
  150. package/src/experiments/always-default.ts +24 -0
  151. package/src/experiments/configcat-server.ts +41 -0
  152. package/src/experiments/configcat.ts +62 -0
  153. package/src/experiments/types.ts +38 -0
  154. package/src/gitpod-service.ts +58 -10
  155. package/src/ide-protocol.ts +10 -0
  156. package/src/index.ts +1 -1
  157. package/src/installation-admin-protocol.ts +3 -0
  158. package/src/messaging/client-call-metrics.ts +1 -20
  159. package/src/messaging/error.ts +19 -4
  160. package/src/plans.ts +4 -0
  161. package/src/protocol.spec.ts +97 -0
  162. package/src/protocol.ts +196 -18
  163. package/src/team-subscription-protocol.ts +4 -0
  164. package/src/teams-projects-protocol.ts +15 -1
  165. package/src/usage.ts +71 -0
  166. package/src/util/debug-app.ts +81 -0
  167. package/src/util/garbage-collected-cache.ts +5 -0
  168. package/src/util/gitpod-host-url.ts +21 -0
  169. package/src/util/grpc.ts +89 -0
  170. package/src/util/logging.spec.ts +23 -0
  171. package/src/util/logging.ts +11 -2
  172. package/src/util/timeutil.spec.ts +28 -1
  173. package/src/util/timeutil.ts +12 -0
  174. package/src/webhook-event.ts +55 -0
  175. package/src/workspace-class.ts +14 -0
  176. package/src/workspace-cluster.ts +2 -4
  177. package/src/workspace-instance.ts +20 -0
  178. package/src/wsready.ts +5 -4
  179. package/lib/email-protocol.d.ts +0 -49
  180. package/lib/email-protocol.d.ts.map +0 -1
  181. package/lib/email-protocol.js +0 -28
  182. package/lib/email-protocol.js.map +0 -1
  183. package/src/email-protocol.ts +0 -65
@@ -0,0 +1,23 @@
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
+ import { suite, test } from "mocha-typescript";
8
+ import { log } from "./logging";
9
+
10
+ @suite
11
+ class TestLogging {
12
+ @test public async testLogInfo_output() {
13
+ const testObj = {
14
+ null: null,
15
+ undefined: undefined,
16
+ empty: "",
17
+ foo: "bar",
18
+ number: 0,
19
+ };
20
+ log.info("info logging test", testObj);
21
+ }
22
+ }
23
+ module.exports = new TestLogging();
@@ -6,6 +6,7 @@
6
6
 
7
7
  const inspect: (object: any) => string = require("util").inspect; // undefined in frontend
8
8
 
9
+ let plainLogging: boolean = false; // set to true during development to get non JSON output
9
10
  let jsonLogging: boolean = false;
10
11
  let component: string | undefined;
11
12
  let version: string | undefined;
@@ -309,7 +310,7 @@ function makeLogItem(
309
310
  }
310
311
 
311
312
  const payload: any = payloadArgs.length == 0 ? undefined : payloadArgs.length == 1 ? payloadArgs[0] : payloadArgs;
312
- const logItem: any = {
313
+ const logItem = {
313
314
  // undefined fields get eliminated in JSON.stringify()
314
315
  ...reportedErrorEvent,
315
316
  component,
@@ -321,11 +322,19 @@ function makeLogItem(
321
322
  payload,
322
323
  loggedViaConsole: calledViaConsole ? true : undefined,
323
324
  };
325
+ if (plainLogging) {
326
+ return `[${logItem.severity}] [${logItem.component}] ${logItem.message}
327
+ ${JSON.stringify(payload || "", undefined, " ")}
328
+ ${error || ""}
329
+ `.trim();
330
+ }
324
331
  let result: string = stringifyLogItem(logItem);
325
332
 
326
333
  if (result.length > maxAllowedLogItemLength && payload !== undefined) {
327
334
  delete logItem.payload;
328
- logItem.payloadStub = `Payload stripped as log item was longer than ${maxAllowedLogItemLength} characters`;
335
+ (<any>(
336
+ logItem
337
+ )).payloadStub = `Payload stripped as log item was longer than ${maxAllowedLogItemLength} characters`;
329
338
 
330
339
  result = stringifyLogItem(logItem);
331
340
 
@@ -7,10 +7,16 @@
7
7
  import * as chai from "chai";
8
8
  const expect = chai.expect;
9
9
  import { suite, test } from "mocha-typescript";
10
- import { oneMonthLater } from "./timeutil";
10
+ import { daysBefore, hoursBefore, oneMonthLater } from "./timeutil";
11
11
 
12
12
  @suite()
13
13
  export class TimeutilSpec {
14
+ @test
15
+ testDaysBefore() {
16
+ const now = new Date().toISOString();
17
+ expect(daysBefore(now, 2)).to.be.eq(hoursBefore(now, 48));
18
+ }
19
+
14
20
  @test
15
21
  testTimeutil() {
16
22
  // targeting a 1st, 1th of Jan => 1st of Feb
@@ -39,4 +45,25 @@ export class TimeutilSpec {
39
45
  const later = oneMonthLater(from.toISOString(), day);
40
46
  expect(later, `expected ${later} to be equal ${expectation}`).to.be.equal(expectation.toISOString());
41
47
  }
48
+
49
+ @test
50
+ testDaysBefore2() {
51
+ const tests: { date: Date; daysEarlier: number; expectation: string }[] = [
52
+ {
53
+ date: new Date("2021-07-13T00:00:00.000Z"),
54
+ daysEarlier: 365,
55
+ expectation: "2020-07-13T00:00:00.000Z",
56
+ },
57
+ {
58
+ date: new Date("2019-02-01T00:00:00.000Z"),
59
+ daysEarlier: 365,
60
+ expectation: "2018-02-01T00:00:00.000Z",
61
+ },
62
+ ];
63
+
64
+ for (const t of tests) {
65
+ const actual = daysBefore(t.date.toISOString(), t.daysEarlier);
66
+ expect(actual).to.equal(t.expectation, `expected ${actual} to be equal ${t.expectation}`);
67
+ }
68
+ }
42
69
  }
@@ -47,6 +47,18 @@ export const orderAsc = (d1: string, d2: string): number => liftDate(d1, d2, (d1
47
47
  export const liftDate1 = <T>(d1: string, f: (d1: Date) => T): T => f(new Date(d1));
48
48
  export const liftDate = <T>(d1: string, d2: string, f: (d1: Date, d2: Date) => T): T => f(new Date(d1), new Date(d2));
49
49
 
50
+ export function daysBefore(date: string, days: number): string {
51
+ const result = new Date(date);
52
+ result.setDate(result.getDate() - days);
53
+ return result.toISOString();
54
+ }
55
+
56
+ export function hoursBefore(date: string, hours: number): string {
57
+ const result = new Date(date);
58
+ result.setHours(result.getHours() - hours);
59
+ return result.toISOString();
60
+ }
61
+
50
62
  export function hoursLater(date: string, hours: number): string {
51
63
  const result = new Date(date);
52
64
  result.setHours(result.getHours() + hours);
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright (c) 2022 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 interface WebhookEvent {
8
+ id: string;
9
+ creationTime: string;
10
+ type: "push" | string;
11
+
12
+ /**
13
+ * Typically the webhook installer is referenced here.
14
+ */
15
+ authorizedUserId?: string;
16
+
17
+ /**
18
+ * webhook event's payload
19
+ */
20
+ rawEvent: string;
21
+
22
+ /**
23
+ * The general status of the received webhook event.
24
+ */
25
+ status: WebhookEvent.Status;
26
+
27
+ /**
28
+ * Optional message to help understand errors with handling events.
29
+ */
30
+ message?: string;
31
+
32
+ /**
33
+ * If the webhook event is considered to trigger a prebuild, the `prebuildStatus`
34
+ * contains a more specific status.
35
+ */
36
+ prebuildStatus?: WebhookEvent.PrebuildStatus;
37
+
38
+ /**
39
+ * If `prebuildStatus` is `prebuild_triggered` this points to a prebuild.
40
+ */
41
+ prebuildId?: string;
42
+
43
+ projectId?: string;
44
+
45
+ cloneUrl?: string;
46
+
47
+ branch?: string;
48
+
49
+ commit?: string;
50
+ }
51
+
52
+ export namespace WebhookEvent {
53
+ export type Status = "received" | "dismissed_unauthorized" | "ignored" | "processed";
54
+ export type PrebuildStatus = "ignored_unconfigured" | "prebuild_trigger_failed" | "prebuild_triggered";
55
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2022 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 interface SupportedWorkspaceClass {
8
+ id: string;
9
+ category: string;
10
+ displayName: string;
11
+ description: string;
12
+ powerups: number;
13
+ isSelected: boolean;
14
+ }
@@ -56,12 +56,10 @@ export type WorkspaceManagerConnectionInfo = Pick<WorkspaceCluster, "name" | "ur
56
56
  export type AdmissionConstraint =
57
57
  | AdmissionConstraintFeaturePreview
58
58
  | AdmissionConstraintHasPermission
59
- | AdmissionConstraintHasUserLevel
60
- | AdmissionConstraintHasMoreResources;
59
+ | AdmissionConstraintHasClass;
61
60
  export type AdmissionConstraintFeaturePreview = { type: "has-feature-preview" };
62
61
  export type AdmissionConstraintHasPermission = { type: "has-permission"; permission: PermissionName };
63
- export type AdmissionConstraintHasUserLevel = { type: "has-user-level"; level: string };
64
- export type AdmissionConstraintHasMoreResources = { type: "has-more-resources" };
62
+ export type AdmissionConstraintHasClass = { type: "has-class"; id: string; displayName: string };
65
63
 
66
64
  export namespace AdmissionConstraint {
67
65
  export function is(o: any): o is AdmissionConstraint {
@@ -56,10 +56,27 @@ export interface WorkspaceInstance {
56
56
  * Contains information about the image build, if there was any
57
57
  */
58
58
  imageBuildInfo?: ImageBuildInfo;
59
+
60
+ /**
61
+ * workspace class, also known as workspace size, determines the type of
62
+ * resources that are provided to the workspace.
63
+ */
64
+ workspaceClass?: string;
65
+
66
+ /**
67
+ * Identifies the team or user to which this instance's runtime should be attributed to
68
+ * (e.g. for usage analytics or billing purposes).
69
+ */
70
+ usageAttributionId?: string;
59
71
  }
60
72
 
61
73
  // WorkspaceInstanceStatus describes the current state of a workspace instance
62
74
  export interface WorkspaceInstanceStatus {
75
+ // version is the current version of the workspace instance status
76
+ // Note: consider this value opague. The only guarantee given is that it imposes
77
+ // a partial order on status updates, i.e. a.version > b.version -> a newer than b.
78
+ version?: number;
79
+
63
80
  // phase describes a high-level state of the workspace instance
64
81
  phase: WorkspaceInstancePhase;
65
82
 
@@ -229,6 +246,9 @@ export interface WorkspaceInstanceConfiguration {
229
246
  // desktopIdeImage is the ref of the desktop IDE image this instance uses.
230
247
  desktopIdeImage?: string;
231
248
 
249
+ // desktopIdePluginImage is the ref of the desktop IDE plugin image this instance uses.
250
+ desktopIdePluginImage?: string;
251
+
232
252
  // supervisorImage is the ref of the supervisor image this instance uses.
233
253
  supervisorImage?: string;
234
254
 
package/src/wsready.ts CHANGED
@@ -4,14 +4,15 @@
4
4
  * See License-AGPL.txt in the project root for license information.
5
5
  */
6
6
 
7
- // generated using github.com/32leaves/bel on 2022-05-18 18:19:49.011672619 +0000 UTC m=+0.006607361
7
+ // generated using github.com/32leaves/bel on 2022-07-21 07:41:48.081573085 +0000 UTC m=+0.009109470
8
8
  // DO NOT MODIFY
9
9
 
10
+ export interface WorkspaceReadyMessage {
11
+ source: WorkspaceInitSource;
12
+ }
13
+
10
14
  export enum WorkspaceInitSource {
11
15
  WorkspaceInitFromBackup = "from-backup",
12
16
  WorkspaceInitFromPrebuild = "from-prebuild",
13
17
  WorkspaceInitFromOther = "from-other",
14
18
  }
15
- export interface WorkspaceReadyMessage {
16
- source: WorkspaceInitSource;
17
- }
@@ -1,49 +0,0 @@
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 type EMailState = "scheduledInternal" | "scheduledSendgrid";
7
- export interface EMailStatus {
8
- /** The time the email entry was inserted into the DB */
9
- scheduledInternalTime: string;
10
- /** The time the email state transitioned to "scheduledSendgrid" */
11
- scheduledSendgridTime?: string;
12
- /** In case of any errors during sending with Sendgrid it gets noted here */
13
- error?: string;
14
- }
15
- export declare namespace EMailStatus {
16
- function getState(status: EMailStatus): EMailState;
17
- }
18
- export interface EmailAddress {
19
- name?: string;
20
- email: string;
21
- }
22
- export interface EMailParameters {
23
- /** undefined means default from template */
24
- subject?: string;
25
- /** The sender address */
26
- senderAddress: string | EmailAddress;
27
- /** The replyTo address */
28
- replyToAddress?: string | EmailAddress;
29
- /** The SendGrid template id */
30
- templateId: string;
31
- /** The parameters for the SendGrid template */
32
- templateParams: {};
33
- }
34
- export declare type EMail = {
35
- /** The unique id of this email (uuid/v4 for now) */
36
- uid: string;
37
- /** The id of the user this email was sent to */
38
- userId: string;
39
- /** The address this email was sent to */
40
- recipientAddress: string;
41
- /** Which campaign scheduled this email */
42
- campaignId: string;
43
- /** The parameters this email was sent with (template id, template params, etc) */
44
- params: EMailParameters;
45
- } & EMailStatus;
46
- export declare namespace EMail {
47
- const create: (ts: Omit<EMail, "uid">) => EMail;
48
- }
49
- //# sourceMappingURL=email-protocol.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email-protocol.d.ts","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,oBAAY,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAEnE,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,CAAC;CACL"}
@@ -1,28 +0,0 @@
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.EMail = exports.EMailStatus = void 0;
9
- const uuid_1 = require("uuid");
10
- var EMailStatus;
11
- (function (EMailStatus) {
12
- function getState(status) {
13
- if (status.scheduledSendgridTime) {
14
- return "scheduledSendgrid";
15
- }
16
- return "scheduledInternal";
17
- }
18
- EMailStatus.getState = getState;
19
- })(EMailStatus = exports.EMailStatus || (exports.EMailStatus = {}));
20
- var EMail;
21
- (function (EMail) {
22
- EMail.create = (ts) => {
23
- const withId = ts;
24
- withId.uid = (0, uuid_1.v4)();
25
- return withId;
26
- };
27
- })(EMail = exports.EMail || (exports.EMail = {}));
28
- //# sourceMappingURL=email-protocol.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email-protocol.js","sourceRoot":"","sources":["../src/email-protocol.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+BAAoC;AAYpC,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,CAAC;AACN,CAAC,EANgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAMrB"}
@@ -1,65 +0,0 @@
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 { v4 as uuidv4 } from "uuid";
8
-
9
- export type EMailState = "scheduledInternal" | "scheduledSendgrid";
10
-
11
- export interface EMailStatus {
12
- /** The time the email entry was inserted into the DB */
13
- scheduledInternalTime: string;
14
- /** The time the email state transitioned to "scheduledSendgrid" */
15
- scheduledSendgridTime?: string;
16
- /** In case of any errors during sending with Sendgrid it gets noted here */
17
- error?: string;
18
- }
19
- export namespace EMailStatus {
20
- export function getState(status: EMailStatus): EMailState {
21
- if (status.scheduledSendgridTime) {
22
- return "scheduledSendgrid";
23
- }
24
- return "scheduledInternal";
25
- }
26
- }
27
-
28
- export interface EmailAddress {
29
- name?: string;
30
- email: string;
31
- }
32
-
33
- export interface EMailParameters {
34
- /** undefined means default from template */
35
- subject?: string;
36
- /** The sender address */
37
- senderAddress: string | EmailAddress;
38
- /** The replyTo address */
39
- replyToAddress?: string | EmailAddress;
40
- /** The SendGrid template id */
41
- templateId: string;
42
- /** The parameters for the SendGrid template */
43
- templateParams: {};
44
- }
45
-
46
- export type EMail = {
47
- /** The unique id of this email (uuid/v4 for now) */
48
- uid: string;
49
- /** The id of the user this email was sent to */
50
- userId: string;
51
- /** The address this email was sent to */
52
- recipientAddress: string;
53
- /** Which campaign scheduled this email */
54
- campaignId: string;
55
- /** The parameters this email was sent with (template id, template params, etc) */
56
- params: EMailParameters;
57
- } & EMailStatus;
58
-
59
- export namespace EMail {
60
- export const create = (ts: Omit<EMail, "uid">): EMail => {
61
- const withId = ts as EMail;
62
- withId.uid = uuidv4();
63
- return withId;
64
- };
65
- }