@gitpod/gitpod-protocol 0.1.5-se-better-ts-api.3 → 0.1.5-se-flexible-termination-period.2

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 (50) hide show
  1. package/data/gitpod-schema.json +23 -0
  2. package/lib/billing-mode.d.ts +2 -1
  3. package/lib/billing-mode.d.ts.map +1 -1
  4. package/lib/billing-mode.js +8 -0
  5. package/lib/billing-mode.js.map +1 -1
  6. package/lib/encryption/encryption-engine.d.ts.map +1 -1
  7. package/lib/encryption/encryption-engine.js +3 -3
  8. package/lib/encryption/encryption-engine.js.map +1 -1
  9. package/lib/encryption/encryption-engine.spec.js +1 -1
  10. package/lib/encryption/encryption-engine.spec.js.map +1 -1
  11. package/lib/encryption/key-provider.js +1 -1
  12. package/lib/encryption/key-provider.js.map +1 -1
  13. package/lib/experiments/configcat.d.ts +1 -0
  14. package/lib/experiments/configcat.d.ts.map +1 -1
  15. package/lib/experiments/configcat.js +5 -1
  16. package/lib/experiments/configcat.js.map +1 -1
  17. package/lib/experiments/types.d.ts +2 -1
  18. package/lib/experiments/types.d.ts.map +1 -1
  19. package/lib/gitpod-service.d.ts +6 -11
  20. package/lib/gitpod-service.d.ts.map +1 -1
  21. package/lib/gitpod-service.js +12 -0
  22. package/lib/gitpod-service.js.map +1 -1
  23. package/lib/messaging/error.d.ts +1 -0
  24. package/lib/messaging/error.d.ts.map +1 -1
  25. package/lib/messaging/error.js +2 -0
  26. package/lib/messaging/error.js.map +1 -1
  27. package/lib/protocol.d.ts +25 -8
  28. package/lib/protocol.d.ts.map +1 -1
  29. package/lib/protocol.js +13 -8
  30. package/lib/protocol.js.map +1 -1
  31. package/lib/usage.d.ts +1 -2
  32. package/lib/usage.d.ts.map +1 -1
  33. package/lib/util/timeutil.spec.d.ts +1 -0
  34. package/lib/util/timeutil.spec.d.ts.map +1 -1
  35. package/lib/util/timeutil.spec.js +24 -0
  36. package/lib/util/timeutil.spec.js.map +1 -1
  37. package/package.json +1 -1
  38. package/pkg-yarn.lock +1 -1
  39. package/provenance-bundle.jsonl +1 -1
  40. package/src/billing-mode.ts +11 -1
  41. package/src/encryption/encryption-engine.spec.ts +1 -1
  42. package/src/encryption/encryption-engine.ts +7 -3
  43. package/src/encryption/key-provider.ts +1 -1
  44. package/src/experiments/configcat.ts +4 -0
  45. package/src/experiments/types.ts +4 -1
  46. package/src/gitpod-service.ts +18 -11
  47. package/src/messaging/error.ts +3 -0
  48. package/src/protocol.ts +27 -12
  49. package/src/usage.ts +1 -2
  50. package/src/util/timeutil.spec.ts +21 -0
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.
@@ -295,8 +297,18 @@ export const WorkspaceFeatureFlags = {
295
297
  persistent_volume_claim: undefined,
296
298
  protected_secrets: undefined,
297
299
  workspace_class_limiting: undefined,
300
+ workspace_connection_limiting: undefined,
298
301
  };
299
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
+ }
300
312
 
301
313
  export interface EnvVarWithValue {
302
314
  name: string;
@@ -716,7 +728,7 @@ export interface Workspace {
716
728
 
717
729
  export type WorkspaceSoftDeletion = "user" | "gc";
718
730
 
719
- export type WorkspaceType = "regular" | "prebuild" | "probe"; // TODO(gpl) Removed prove here
731
+ export type WorkspaceType = "regular" | "prebuild";
720
732
 
721
733
  export namespace Workspace {
722
734
  export function getFullRepositoryName(ws: Workspace): string | undefined {
@@ -803,6 +815,12 @@ export interface RepositoryCloneInformation {
803
815
  checkoutLocation?: string;
804
816
  }
805
817
 
818
+ export interface CoreDumpConfig {
819
+ enabled?: boolean;
820
+ softLimit?: number;
821
+ hardLimit?: number;
822
+ }
823
+
806
824
  export interface WorkspaceConfig {
807
825
  mainConfiguration?: string;
808
826
  additionalRepositories?: RepositoryCloneInformation[];
@@ -815,6 +833,8 @@ export interface WorkspaceConfig {
815
833
  github?: GithubAppConfig;
816
834
  vscode?: VSCodeConfig;
817
835
  jetbrains?: JetBrainsConfig;
836
+ coreDump?: CoreDumpConfig;
837
+ terminationGracePeriodSeconds?: number;
818
838
 
819
839
  /** deprecated. Enabled by default **/
820
840
  experimentalNetwork?: boolean;
@@ -1146,17 +1166,6 @@ export namespace WithEnvvarsContext {
1146
1166
  }
1147
1167
  }
1148
1168
 
1149
- export interface WorkspaceProbeContext extends WorkspaceContext {
1150
- responseURL: string;
1151
- responseToken: string;
1152
- }
1153
-
1154
- export namespace WorkspaceProbeContext {
1155
- export function is(context: any): context is WorkspaceProbeContext {
1156
- return context && "responseURL" in context && "responseToken" in context;
1157
- }
1158
- }
1159
-
1160
1169
  export type RefType = "branch" | "tag" | "revision";
1161
1170
  export namespace RefType {
1162
1171
  export const getRefType = (commit: Commit): RefType => {
@@ -1503,6 +1512,12 @@ export interface Terms {
1503
1512
  readonly formElements?: object;
1504
1513
  }
1505
1514
 
1515
+ export interface StripeConfig {
1516
+ usageProductPriceIds: { [currency: string]: string };
1517
+ individualUsagePriceIds?: { [currency: string]: string };
1518
+ teamUsagePriceIds?: { [currency: string]: string };
1519
+ }
1520
+
1506
1521
  export type BillingStrategy = "other" | "stripe";
1507
1522
  export interface CostCenter {
1508
1523
  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
- creditBalanceAtStart: number;
32
- creditBalanceAtEnd: number;
31
+ creditsUsed: number;
33
32
  }
34
33
 
35
34
  export interface PaginationResponse {
@@ -45,4 +45,25 @@ export class TimeutilSpec {
45
45
  const later = oneMonthLater(from.toISOString(), day);
46
46
  expect(later, `expected ${later} to be equal ${expectation}`).to.be.equal(expectation.toISOString());
47
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
+ }
48
69
  }