@gitpod/gitpod-protocol 0.1.5-tar-sh-active-users.27 → 0.1.5-tar-sh-active-users-new.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.
- package/data/gitpod-schema.json +27 -0
- package/lib/attribution.d.ts +3 -0
- package/lib/attribution.d.ts.map +1 -1
- package/lib/attribution.js +10 -0
- package/lib/attribution.js.map +1 -1
- package/lib/billing-mode.d.ts +2 -1
- package/lib/billing-mode.d.ts.map +1 -1
- package/lib/billing-mode.js +8 -0
- package/lib/billing-mode.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +3 -3
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +1 -1
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/key-provider.js +1 -1
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/experiments/configcat.d.ts +1 -0
- package/lib/experiments/configcat.d.ts.map +1 -1
- package/lib/experiments/configcat.js +5 -1
- package/lib/experiments/configcat.js.map +1 -1
- package/lib/experiments/types.d.ts +2 -1
- package/lib/experiments/types.d.ts.map +1 -1
- package/lib/gitpod-service.d.ts +1 -16
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/messaging/error.d.ts +1 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +2 -0
- package/lib/messaging/error.js.map +1 -1
- package/lib/plans.js +2 -2
- package/lib/plans.js.map +1 -1
- package/lib/protocol.d.ts +23 -14
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +12 -8
- package/lib/protocol.js.map +1 -1
- package/lib/usage.d.ts +1 -2
- package/lib/usage.d.ts.map +1 -1
- package/lib/util/nice-grpc.d.ts +9 -0
- package/lib/util/nice-grpc.d.ts.map +1 -0
- package/lib/util/nice-grpc.js +119 -0
- package/lib/util/nice-grpc.js.map +1 -0
- package/lib/wsready.d.ts +3 -3
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +2 -0
- package/lib/wsready.js.map +1 -1
- package/package.json +3 -1
- package/pkg-yarn.lock +3 -1
- package/provenance-bundle.jsonl +1 -1
- package/src/attribution.ts +11 -0
- package/src/billing-mode.ts +11 -1
- package/src/encryption/encryption-engine.spec.ts +1 -1
- package/src/encryption/encryption-engine.ts +7 -3
- package/src/encryption/key-provider.ts +1 -1
- package/src/experiments/configcat.ts +4 -0
- package/src/experiments/types.ts +4 -1
- package/src/gitpod-service.ts +1 -18
- package/src/index.ts +0 -1
- package/src/messaging/error.ts +3 -0
- package/src/plans.ts +2 -2
- package/src/protocol.ts +27 -19
- package/src/usage.ts +1 -2
- package/src/util/nice-grpc.ts +93 -0
- package/src/wsready.ts +4 -5
- package/lib/email-protocol.d.ts +0 -49
- package/lib/email-protocol.d.ts.map +0 -1
- package/lib/email-protocol.js +0 -28
- package/lib/email-protocol.js.map +0 -1
- package/src/email-protocol.ts +0 -65
package/src/plans.ts
CHANGED
|
@@ -131,7 +131,7 @@ export namespace Plans {
|
|
|
131
131
|
githubPlanNumber: 1,
|
|
132
132
|
|
|
133
133
|
type: "free",
|
|
134
|
-
name: "
|
|
134
|
+
name: "Free",
|
|
135
135
|
currency: "USD",
|
|
136
136
|
pricePerMonth: 0,
|
|
137
137
|
hoursPerMonth: 100,
|
|
@@ -146,7 +146,7 @@ export namespace Plans {
|
|
|
146
146
|
githubPlanNumber: 5,
|
|
147
147
|
|
|
148
148
|
type: "free-50",
|
|
149
|
-
name: "
|
|
149
|
+
name: "Free",
|
|
150
150
|
currency: "USD",
|
|
151
151
|
pricePerMonth: 0,
|
|
152
152
|
hoursPerMonth: 50,
|
package/src/protocol.ts
CHANGED
|
@@ -286,6 +286,8 @@ export interface UserFeatureSettings {
|
|
|
286
286
|
permanentWSFeatureFlags?: NamedWorkspaceFeatureFlag[];
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
export type BillingTier = "paid" | "free";
|
|
290
|
+
|
|
289
291
|
/**
|
|
290
292
|
* The values of this type MUST MATCH enum values in WorkspaceFeatureFlag from ws-manager/client/core_pb.d.ts
|
|
291
293
|
* If they don't we'll break things during workspace startup.
|
|
@@ -298,6 +300,15 @@ export const WorkspaceFeatureFlags = {
|
|
|
298
300
|
workspace_connection_limiting: undefined,
|
|
299
301
|
};
|
|
300
302
|
export type NamedWorkspaceFeatureFlag = keyof typeof WorkspaceFeatureFlags;
|
|
303
|
+
export namespace NamedWorkspaceFeatureFlag {
|
|
304
|
+
export const WORKSPACE_PERSISTED_FEATTURE_FLAGS: NamedWorkspaceFeatureFlag[] = [
|
|
305
|
+
"full_workspace_backup",
|
|
306
|
+
"persistent_volume_claim",
|
|
307
|
+
];
|
|
308
|
+
export function isWorkspacePersisted(ff: NamedWorkspaceFeatureFlag): boolean {
|
|
309
|
+
return WORKSPACE_PERSISTED_FEATTURE_FLAGS.includes(ff);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
301
312
|
|
|
302
313
|
export interface EnvVarWithValue {
|
|
303
314
|
name: string;
|
|
@@ -628,6 +639,7 @@ export interface PendingGithubEvent {
|
|
|
628
639
|
creationDate: Date;
|
|
629
640
|
type: string;
|
|
630
641
|
event: string;
|
|
642
|
+
deleted: boolean;
|
|
631
643
|
}
|
|
632
644
|
|
|
633
645
|
export interface Snapshot {
|
|
@@ -636,7 +648,6 @@ export interface Snapshot {
|
|
|
636
648
|
availableTime?: string;
|
|
637
649
|
originalWorkspaceId: string;
|
|
638
650
|
bucketId: string;
|
|
639
|
-
layoutData?: string;
|
|
640
651
|
state: SnapshotState;
|
|
641
652
|
message?: string;
|
|
642
653
|
}
|
|
@@ -650,12 +661,6 @@ export interface VolumeSnapshot {
|
|
|
650
661
|
|
|
651
662
|
export type SnapshotState = "pending" | "available" | "error";
|
|
652
663
|
|
|
653
|
-
export interface LayoutData {
|
|
654
|
-
workspaceId: string;
|
|
655
|
-
lastUpdatedTime: string;
|
|
656
|
-
layoutData: string;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
664
|
export interface Workspace {
|
|
660
665
|
id: string;
|
|
661
666
|
creationTime: string;
|
|
@@ -717,7 +722,7 @@ export interface Workspace {
|
|
|
717
722
|
|
|
718
723
|
export type WorkspaceSoftDeletion = "user" | "gc";
|
|
719
724
|
|
|
720
|
-
export type WorkspaceType = "regular" | "prebuild"
|
|
725
|
+
export type WorkspaceType = "regular" | "prebuild";
|
|
721
726
|
|
|
722
727
|
export namespace Workspace {
|
|
723
728
|
export function getFullRepositoryName(ws: Workspace): string | undefined {
|
|
@@ -790,6 +795,8 @@ export interface JetBrainsConfig {
|
|
|
790
795
|
goland?: JetBrainsProductConfig;
|
|
791
796
|
pycharm?: JetBrainsProductConfig;
|
|
792
797
|
phpstorm?: JetBrainsProductConfig;
|
|
798
|
+
rubymine?: JetBrainsProductConfig;
|
|
799
|
+
webstorm?: JetBrainsProductConfig;
|
|
793
800
|
}
|
|
794
801
|
export interface JetBrainsProductConfig {
|
|
795
802
|
prebuilds?: JetBrainsPrebuilds;
|
|
@@ -804,6 +811,12 @@ export interface RepositoryCloneInformation {
|
|
|
804
811
|
checkoutLocation?: string;
|
|
805
812
|
}
|
|
806
813
|
|
|
814
|
+
export interface CoreDumpConfig {
|
|
815
|
+
enabled?: boolean;
|
|
816
|
+
softLimit?: number;
|
|
817
|
+
hardLimit?: number;
|
|
818
|
+
}
|
|
819
|
+
|
|
807
820
|
export interface WorkspaceConfig {
|
|
808
821
|
mainConfiguration?: string;
|
|
809
822
|
additionalRepositories?: RepositoryCloneInformation[];
|
|
@@ -816,6 +829,7 @@ export interface WorkspaceConfig {
|
|
|
816
829
|
github?: GithubAppConfig;
|
|
817
830
|
vscode?: VSCodeConfig;
|
|
818
831
|
jetbrains?: JetBrainsConfig;
|
|
832
|
+
coreDump?: CoreDumpConfig;
|
|
819
833
|
|
|
820
834
|
/** deprecated. Enabled by default **/
|
|
821
835
|
experimentalNetwork?: boolean;
|
|
@@ -1147,17 +1161,6 @@ export namespace WithEnvvarsContext {
|
|
|
1147
1161
|
}
|
|
1148
1162
|
}
|
|
1149
1163
|
|
|
1150
|
-
export interface WorkspaceProbeContext extends WorkspaceContext {
|
|
1151
|
-
responseURL: string;
|
|
1152
|
-
responseToken: string;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
export namespace WorkspaceProbeContext {
|
|
1156
|
-
export function is(context: any): context is WorkspaceProbeContext {
|
|
1157
|
-
return context && "responseURL" in context && "responseToken" in context;
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1161
1164
|
export type RefType = "branch" | "tag" | "revision";
|
|
1162
1165
|
export namespace RefType {
|
|
1163
1166
|
export const getRefType = (commit: Commit): RefType => {
|
|
@@ -1504,6 +1507,11 @@ export interface Terms {
|
|
|
1504
1507
|
readonly formElements?: object;
|
|
1505
1508
|
}
|
|
1506
1509
|
|
|
1510
|
+
export interface StripeConfig {
|
|
1511
|
+
individualUsagePriceIds: { [currency: string]: string };
|
|
1512
|
+
teamUsagePriceIds: { [currency: string]: string };
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1507
1515
|
export type BillingStrategy = "other" | "stripe";
|
|
1508
1516
|
export interface CostCenter {
|
|
1509
1517
|
readonly id: AttributionId;
|
package/src/usage.ts
CHANGED
|
@@ -28,8 +28,7 @@ export interface PaginationRequest {
|
|
|
28
28
|
export interface ListUsageResponse {
|
|
29
29
|
usageEntriesList: Usage[];
|
|
30
30
|
pagination?: PaginationResponse;
|
|
31
|
-
|
|
32
|
-
creditBalanceAtEnd: number;
|
|
31
|
+
creditsUsed: number;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
export interface PaginationResponse {
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
import { isAbortError } from "abort-controller-x";
|
|
8
|
+
import {
|
|
9
|
+
CallOptions,
|
|
10
|
+
ClientError,
|
|
11
|
+
ClientMiddleware,
|
|
12
|
+
ClientMiddlewareCall,
|
|
13
|
+
Status,
|
|
14
|
+
MethodDescriptor,
|
|
15
|
+
} from "nice-grpc-common";
|
|
16
|
+
import { GrpcMethodType, IClientCallMetrics } from "./grpc";
|
|
17
|
+
|
|
18
|
+
function getLabels(method: MethodDescriptor) {
|
|
19
|
+
const callType = method.requestStream
|
|
20
|
+
? method.responseStream
|
|
21
|
+
? "bidi_stream"
|
|
22
|
+
: "client_stream"
|
|
23
|
+
: method.responseStream
|
|
24
|
+
? "server_stream"
|
|
25
|
+
: "unary";
|
|
26
|
+
const { path } = method;
|
|
27
|
+
const [serviceName, methodName] = path.split("/").slice(1);
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
type: callType as GrpcMethodType,
|
|
31
|
+
service: serviceName,
|
|
32
|
+
method: methodName,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function* incrementStreamMessagesCounter<T>(iterable: AsyncIterable<T>, callback: () => void): AsyncIterable<T> {
|
|
37
|
+
for await (const item of iterable) {
|
|
38
|
+
callback();
|
|
39
|
+
yield item;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function prometheusClientMiddleware(metrics: IClientCallMetrics): ClientMiddleware {
|
|
44
|
+
return async function* prometheusClientMiddlewareGenerator<Request, Response>(
|
|
45
|
+
call: ClientMiddlewareCall<Request, Response>,
|
|
46
|
+
options: CallOptions,
|
|
47
|
+
): AsyncGenerator<Response, Response | void, undefined> {
|
|
48
|
+
const labels = getLabels(call.method);
|
|
49
|
+
|
|
50
|
+
metrics.started(labels);
|
|
51
|
+
|
|
52
|
+
let settled = false;
|
|
53
|
+
let status: Status = Status.OK;
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
let request;
|
|
57
|
+
|
|
58
|
+
if (!call.requestStream) {
|
|
59
|
+
request = call.request;
|
|
60
|
+
} else {
|
|
61
|
+
request = incrementStreamMessagesCounter(call.request, metrics.sent.bind(metrics, labels));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (!call.responseStream) {
|
|
65
|
+
const response = yield* call.next(request, options);
|
|
66
|
+
settled = true;
|
|
67
|
+
return response;
|
|
68
|
+
} else {
|
|
69
|
+
yield* incrementStreamMessagesCounter(
|
|
70
|
+
call.next(request, options),
|
|
71
|
+
metrics.received.bind(metrics, labels),
|
|
72
|
+
);
|
|
73
|
+
settled = true;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
} catch (err) {
|
|
77
|
+
settled = true;
|
|
78
|
+
if (err instanceof ClientError) {
|
|
79
|
+
status = err.code;
|
|
80
|
+
} else if (isAbortError(err)) {
|
|
81
|
+
status = Status.CANCELLED;
|
|
82
|
+
} else {
|
|
83
|
+
status = Status.UNKNOWN;
|
|
84
|
+
}
|
|
85
|
+
throw err;
|
|
86
|
+
} finally {
|
|
87
|
+
if (!settled) {
|
|
88
|
+
status = Status.CANCELLED;
|
|
89
|
+
}
|
|
90
|
+
metrics.handled({ ...labels, code: Status[status] });
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
package/src/wsready.ts
CHANGED
|
@@ -4,15 +4,14 @@
|
|
|
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-
|
|
7
|
+
// generated using github.com/32leaves/bel on 2022-09-26 00:48:43.566671023 +0000 UTC m=+0.008587770
|
|
8
8
|
// DO NOT MODIFY
|
|
9
9
|
|
|
10
|
-
export interface WorkspaceReadyMessage {
|
|
11
|
-
source: WorkspaceInitSource;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
10
|
export enum WorkspaceInitSource {
|
|
15
11
|
WorkspaceInitFromBackup = "from-backup",
|
|
16
12
|
WorkspaceInitFromPrebuild = "from-prebuild",
|
|
17
13
|
WorkspaceInitFromOther = "from-other",
|
|
18
14
|
}
|
|
15
|
+
export interface WorkspaceReadyMessage {
|
|
16
|
+
source: WorkspaceInitSource
|
|
17
|
+
}
|
package/lib/email-protocol.d.ts
DELETED
|
@@ -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"}
|
package/lib/email-protocol.js
DELETED
|
@@ -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"}
|
package/src/email-protocol.ts
DELETED
|
@@ -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
|
-
}
|