@gitpod/gitpod-protocol 0.1.5-test.9 → 0.1.5-tweak-workspaceconfig-origin-docs-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.
- package/data/builtin-theia-plugins.json +28 -18
- package/data/gitpod-schema.json +17 -17
- package/lib/accounting-protocol.d.ts +155 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +109 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +22 -5
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +16 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +45 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/auth.d.ts +25 -0
- package/lib/auth.d.ts.map +1 -0
- package/lib/auth.js +16 -0
- package/lib/auth.js.map +1 -0
- package/lib/context-url.d.ts +18 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +49 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +12 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +73 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +2 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +6 -5
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts +1 -1
- package/lib/encryption/container-module.js +7 -5
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts +1 -1
- package/lib/encryption/encryption-engine.js +21 -21
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts +2 -2
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +31 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts +1 -1
- package/lib/encryption/encryption-service.js +31 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts +2 -2
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +27 -31
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +2 -3
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +21 -21
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts +1 -1
- package/lib/gitpod-file-parser.js +27 -42
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.d.ts +1 -1
- package/lib/gitpod-file-parser.spec.js +117 -117
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +186 -34
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +239 -116
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +9 -12
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +5 -7
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +26 -0
- package/lib/ide-frontend-service.d.ts.map +1 -0
- package/lib/ide-frontend-service.js +8 -0
- package/lib/ide-frontend-service.js.map +1 -0
- package/lib/ide-protocol.d.ts +81 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/{util/without.js → ide-protocol.js} +2 -2
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +5 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -12
- package/lib/index.js.map +1 -1
- package/lib/license-protocol.d.ts +1 -1
- package/lib/license-protocol.js +2 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +6 -4
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +188 -48
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +26 -0
- package/lib/messaging/browser/window-connection.d.ts.map +1 -0
- package/lib/messaging/browser/window-connection.js +68 -0
- package/lib/messaging/browser/window-connection.js.map +1 -0
- package/lib/messaging/client-call-metrics.d.ts +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/connection-error-handler.js +12 -23
- package/lib/messaging/connection-error-handler.js.map +1 -1
- package/lib/messaging/error.d.ts +6 -2
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +13 -4
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -0
- package/lib/messaging/handler.js.map +1 -1
- package/lib/messaging/node/connection.js +23 -22
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +2 -0
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -169
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +14 -12
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +21 -19
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +210 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +570 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +123 -30
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +121 -117
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +3 -4
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +73 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +63 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +103 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +23 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/theia-plugins.d.ts +1 -1
- package/lib/theia-plugins.js +1 -1
- package/lib/typings/globals.d.ts +12 -0
- package/lib/typings/globals.d.ts.map +1 -0
- package/lib/typings/globals.js +7 -0
- package/lib/typings/globals.js.map +1 -0
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +79 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts +1 -1
- package/lib/util/async-iterator.js +57 -134
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.d.ts +1 -1
- package/lib/util/cancelable.js +19 -60
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.d.ts +1 -1
- package/lib/util/date-time.js +10 -9
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deep-partial.d.ts +1 -1
- package/lib/util/deep-partial.js +1 -1
- package/lib/util/deferred.d.ts +1 -1
- package/lib/util/deferred.js +12 -13
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts +2 -2
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -39
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +59 -74
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -1
- package/lib/util/garbage-collected-cache.js +24 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +4 -0
- package/lib/util/generate-workspace-id.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.js +470 -0
- package/lib/util/generate-workspace-id.js.map +1 -0
- package/lib/util/generate-workspace-id.spec.d.ts +7 -0
- package/lib/util/generate-workspace-id.spec.d.ts.map +1 -0
- package/lib/util/generate-workspace-id.spec.js +63 -0
- package/lib/util/generate-workspace-id.spec.js.map +1 -0
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +44 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +8 -3
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +106 -76
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +16 -0
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -0
- package/lib/util/gitpod-host-url.spec.js +124 -0
- package/lib/util/gitpod-host-url.spec.js.map +1 -0
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/logging.d.ts +57 -34
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +119 -110
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.d.ts +1 -1
- package/lib/util/make-link.js +4 -3
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +14 -4
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +39 -8
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +9 -1
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +129 -48
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.d.ts +1 -1
- package/lib/util/queue.js +18 -56
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.d.ts +1 -1
- package/lib/util/queue.spec.js +145 -287
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeater.d.ts +1 -1
- package/lib/util/repeater.js +37 -89
- package/lib/util/repeater.js.map +1 -1
- package/lib/util/safe-promise.d.ts +1 -1
- package/lib/util/safe-promise.js +11 -13
- package/lib/util/safe-promise.js.map +1 -1
- package/lib/util/semaphore.d.ts +1 -1
- package/lib/util/semaphore.js +17 -47
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts +1 -1
- package/lib/util/skip-if.js +8 -7
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +1 -1
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +30 -17
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts +1 -1
- package/lib/util/timeutil.spec.js +23 -25
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +15 -2
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +86 -51
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/workspace-port-authentication.d.ts +1 -1
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +5 -3
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +74 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +16 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +10 -4
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/workspace-instance.js +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.js +3 -2
- package/lib/wsready.js.map +1 -1
- package/package.json +32 -16
- package/pkg-yarn.lock +18 -9
- package/src/accounting-protocol.ts +229 -0
- package/src/admin-protocol.ts +41 -6
- package/src/analytics.ts +54 -0
- package/src/auth.ts +27 -0
- package/src/context-url.spec.ts +39 -0
- package/src/context-url.ts +51 -0
- package/src/email-protocol.ts +3 -4
- package/src/encryption/container-module.ts +1 -1
- package/src/encryption/encryption-engine.spec.ts +1 -1
- package/src/encryption/encryption-engine.ts +1 -1
- package/src/encryption/encryption-service.ts +1 -1
- package/src/encryption/key-provider.ts +1 -1
- package/src/env.ts +11 -11
- package/src/gitpod-file-parser.spec.ts +1 -1
- package/src/gitpod-file-parser.ts +1 -1
- package/src/gitpod-service.ts +386 -52
- package/src/headless-workspace-log.ts +8 -12
- package/src/ide-frontend-service.ts +28 -0
- package/src/ide-protocol.ts +92 -0
- package/src/index.ts +6 -2
- package/src/license-protocol.ts +1 -1
- package/src/messaging/browser/connection.ts +201 -23
- package/src/messaging/browser/window-connection.ts +72 -0
- package/src/messaging/client-call-metrics.ts +97 -0
- package/src/messaging/error.ts +16 -4
- package/src/messaging/handler.ts +12 -0
- package/src/messaging/node/connection.ts +2 -2
- package/src/messaging/proxy-factory.ts +16 -14
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +9 -8
- package/src/plans.ts +632 -0
- package/src/protocol.ts +204 -61
- package/src/snapshot-url.spec.ts +25 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +113 -0
- package/src/teams-projects-protocol.ts +132 -0
- package/src/theia-plugins.ts +1 -1
- package/src/typings/globals.ts +12 -0
- package/src/util/analytics.ts +87 -0
- package/src/util/async-iterator.ts +1 -1
- package/src/util/cancelable.ts +1 -1
- package/src/util/date-time.ts +1 -1
- package/src/util/deep-partial.ts +1 -1
- package/src/util/deferred.ts +2 -2
- package/src/util/garbage-collected-cache.ts +3 -3
- package/src/util/generate-workspace-id.spec.ts +31 -0
- package/src/util/generate-workspace-id.ts +457 -0
- package/src/util/gitpod-cookie.ts +39 -0
- package/src/util/gitpod-host-url.spec.ts +49 -0
- package/src/util/gitpod-host-url.ts +58 -14
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client.d.ts +1 -1
- package/src/util/logging.ts +111 -39
- package/src/util/make-link.ts +1 -1
- package/src/util/parse-workspace-id.spec.ts +46 -5
- package/src/util/parse-workspace-id.ts +39 -8
- package/src/util/queue.spec.ts +2 -2
- package/src/util/queue.ts +1 -1
- package/src/util/repeater.ts +1 -1
- package/src/util/safe-promise.ts +1 -1
- package/src/util/semaphore.ts +3 -3
- package/src/util/skip-if.ts +2 -2
- package/src/util/timeutil.spec.ts +1 -1
- package/src/util/timeutil.ts +5 -5
- package/src/util/tracing.ts +66 -4
- package/src/util/workspace-port-authentication.ts +1 -1
- package/src/workspace-cluster.ts +96 -0
- package/src/workspace-instance.ts +38 -16
- package/src/wsready.ts +2 -2
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
* `IDEServer` provides a list of available IDEs.
|
|
9
|
+
*/
|
|
10
|
+
export interface IDEServer {
|
|
11
|
+
/**
|
|
12
|
+
* Returns the IDE preferences.
|
|
13
|
+
*/
|
|
14
|
+
getIDEOptions(): Promise<IDEOptions>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IDEOptions {
|
|
18
|
+
/**
|
|
19
|
+
* A list of available IDEs.
|
|
20
|
+
*/
|
|
21
|
+
options: { [key: string]: IDEOption };
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The default (browser) IDE when the user has not specified one.
|
|
25
|
+
*/
|
|
26
|
+
defaultIde: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The default desktop IDE when the user has not specified one.
|
|
30
|
+
*/
|
|
31
|
+
defaultDesktopIde: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IDEOption {
|
|
35
|
+
/**
|
|
36
|
+
* To ensure a stable order one can set an `orderKey`.
|
|
37
|
+
*/
|
|
38
|
+
orderKey?: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Human readable title text of the IDE (plain text only).
|
|
42
|
+
*/
|
|
43
|
+
title: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The type of the IDE, currently 'browser' or 'desktop'.
|
|
47
|
+
*/
|
|
48
|
+
type: 'browser' | 'desktop';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The logo for the IDE. That could be a key in (see
|
|
52
|
+
* components/dashboard/src/images/ideLogos.ts) or a URL.
|
|
53
|
+
*/
|
|
54
|
+
logo: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Text of an optional tooltip (plain text only).
|
|
58
|
+
*/
|
|
59
|
+
tooltip?: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Text of an optional label next to the IDE option like “Insiders” (plain
|
|
63
|
+
* text only).
|
|
64
|
+
*/
|
|
65
|
+
label?: string;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Notes to the IDE option that are renderd in the preferences when a user
|
|
69
|
+
* chooses this IDE.
|
|
70
|
+
*/
|
|
71
|
+
notes?: string[];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* If `true` this IDE option is not visible in the IDE preferences.
|
|
75
|
+
*/
|
|
76
|
+
hidden?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The image ref to the IDE image.
|
|
80
|
+
*/
|
|
81
|
+
image: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* When this is `true`, the tag of this image is resolved to the latest
|
|
85
|
+
* image digest regularly.
|
|
86
|
+
*
|
|
87
|
+
* This is useful if this image points to a tag like `nightly` that will be
|
|
88
|
+
* updated regularly. When `resolveImageDigest` is `true`, we make sure that
|
|
89
|
+
* we resolve the tag regularly to the most recent image version.
|
|
90
|
+
*/
|
|
91
|
+
resolveImageDigest?: boolean;
|
|
92
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 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
|
*/
|
|
@@ -13,4 +13,8 @@ export * from './license-protocol';
|
|
|
13
13
|
export * from './workspace-instance';
|
|
14
14
|
export * from './permission';
|
|
15
15
|
export * from './admin-protocol';
|
|
16
|
-
export * from './email-protocol';
|
|
16
|
+
export * from './email-protocol';
|
|
17
|
+
export * from './headless-workspace-log';
|
|
18
|
+
export * from './context-url';
|
|
19
|
+
export * from './teams-projects-protocol';
|
|
20
|
+
export * from './snapshot-url';
|
package/src/license-protocol.ts
CHANGED
|
@@ -5,17 +5,19 @@
|
|
|
5
5
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { Logger, ConsoleLogger, toSocket, IWebSocket } from "vscode-ws-jsonrpc";
|
|
9
|
+
import { createMessageConnection } from "vscode-jsonrpc";
|
|
10
|
+
import { AbstractMessageWriter } from "vscode-jsonrpc/lib/messageWriter";
|
|
11
|
+
import { AbstractMessageReader } from "vscode-jsonrpc/lib/messageReader";
|
|
10
12
|
import { JsonRpcProxyFactory, JsonRpcProxy } from "../proxy-factory";
|
|
11
|
-
import { ConnectionHandler } from "../handler";
|
|
12
|
-
import ReconnectingWebSocket from 'reconnecting-websocket';
|
|
13
|
+
import { ConnectionEventHandler, ConnectionHandler } from "../handler";
|
|
14
|
+
import ReconnectingWebSocket, { Event } from 'reconnecting-websocket';
|
|
13
15
|
|
|
14
16
|
export interface WebSocketOptions {
|
|
15
17
|
onerror?: (event: Event) => void;
|
|
18
|
+
onListening?: (socket: ReconnectingWebSocket) => void;
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
@injectable()
|
|
19
21
|
export class WebSocketConnectionProvider {
|
|
20
22
|
|
|
21
23
|
/**
|
|
@@ -25,21 +27,37 @@ export class WebSocketConnectionProvider {
|
|
|
25
27
|
* An optional target can be provided to handle
|
|
26
28
|
* notifications and requests from a remote side.
|
|
27
29
|
*/
|
|
28
|
-
createProxy<T extends object>(path: string
|
|
30
|
+
createProxy<T extends object>(path: string | Promise<string>, target?: object, options?: WebSocketOptions): JsonRpcProxy<T> {
|
|
29
31
|
const factory = new JsonRpcProxyFactory<T>(target);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const startListening = (path: string) => {
|
|
33
|
+
const socket = this.listen({
|
|
34
|
+
path,
|
|
35
|
+
onConnection: c => factory.listen(c),
|
|
36
|
+
}, {
|
|
37
|
+
onTransportDidClose: () => factory.fireConnectionClosed(),
|
|
38
|
+
onTransportDidOpen: () => factory.fireConnectionOpened(),
|
|
39
|
+
},
|
|
40
|
+
options
|
|
41
|
+
);
|
|
42
|
+
if (options?.onListening) {
|
|
43
|
+
options.onListening(socket as any as ReconnectingWebSocket)
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if (typeof path === "string") {
|
|
48
|
+
startListening(path);
|
|
49
|
+
} else {
|
|
50
|
+
path.then(path => startListening(path));
|
|
51
|
+
}
|
|
34
52
|
return factory.createProxy();
|
|
35
53
|
}
|
|
36
54
|
|
|
37
55
|
/**
|
|
38
56
|
* Install a connection handler for the given path.
|
|
39
57
|
*/
|
|
40
|
-
listen(handler: ConnectionHandler, options?: WebSocketOptions):
|
|
58
|
+
listen(handler: ConnectionHandler, eventHandler: ConnectionEventHandler, options?: WebSocketOptions): WebSocket {
|
|
41
59
|
const url = handler.path;
|
|
42
|
-
const webSocket = this.createWebSocket(url
|
|
60
|
+
const webSocket = this.createWebSocket(url);
|
|
43
61
|
|
|
44
62
|
const logger = this.createLogger();
|
|
45
63
|
if (options && options.onerror) {
|
|
@@ -52,11 +70,13 @@ export class WebSocketConnectionProvider {
|
|
|
52
70
|
logger.error(JSON.stringify(error));
|
|
53
71
|
});
|
|
54
72
|
}
|
|
55
|
-
doListen(
|
|
56
|
-
webSocket,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
doListen(
|
|
74
|
+
webSocket as any as ReconnectingWebSocket,
|
|
75
|
+
handler,
|
|
76
|
+
eventHandler,
|
|
77
|
+
logger,
|
|
78
|
+
);
|
|
79
|
+
return webSocket;
|
|
60
80
|
}
|
|
61
81
|
|
|
62
82
|
protected createLogger(): Logger {
|
|
@@ -66,16 +86,174 @@ export class WebSocketConnectionProvider {
|
|
|
66
86
|
/**
|
|
67
87
|
* Creates a web socket for the given url
|
|
68
88
|
*/
|
|
69
|
-
createWebSocket(url: string
|
|
70
|
-
|
|
89
|
+
createWebSocket(url: string): WebSocket {
|
|
90
|
+
return new ReconnectingWebSocket(url, undefined, {
|
|
71
91
|
maxReconnectionDelay: 10000,
|
|
72
92
|
minReconnectionDelay: 1000,
|
|
73
93
|
reconnectionDelayGrowFactor: 1.3,
|
|
74
94
|
maxRetries: Infinity,
|
|
75
|
-
debug: false
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
95
|
+
debug: false,
|
|
96
|
+
WebSocket: WebSocket
|
|
97
|
+
}) as any;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// The following was extracted from vscode-ws-jsonrpc to make these changes:
|
|
103
|
+
// - switch from WebSocket to ReconnectingWebSocket
|
|
104
|
+
// - webSocket.onopen: making sure it's only ever called once so we're re-using MessageConnection
|
|
105
|
+
// - WebSocketMessageWriter: buffer and re-try messages instead of throwing an error immidiately
|
|
106
|
+
// - WebSocketMessageReader: don't close MessageConnection on 'socket.onclose'
|
|
107
|
+
function doListen(resocket: ReconnectingWebSocket, handler: ConnectionHandler, eventHandler: ConnectionEventHandler, logger: Logger) {
|
|
108
|
+
resocket.addEventListener("close", () => eventHandler.onTransportDidClose());
|
|
109
|
+
|
|
110
|
+
let alreadyOpened = false;
|
|
111
|
+
resocket.onopen = () => {
|
|
112
|
+
// trigerr "open" every time we re-open the underlying websocket
|
|
113
|
+
eventHandler.onTransportDidOpen();
|
|
114
|
+
|
|
115
|
+
// make sure we're only ever creating one MessageConnection, irregardless of how many times we have to re-open the underlying (reconnecting) websocket
|
|
116
|
+
if (alreadyOpened) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
alreadyOpened = true;
|
|
120
|
+
|
|
121
|
+
const connection = createWebSocketConnection(resocket, logger);
|
|
122
|
+
handler.onConnection(connection);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function createWebSocketConnection(resocket: ReconnectingWebSocket, logger: Logger) {
|
|
127
|
+
const socket = toSocket(resocket as any);
|
|
128
|
+
const messageReader = new NonClosingWebSocketMessageReader(socket);
|
|
129
|
+
const messageWriter = new BufferingWebSocketMessageWriter(resocket, logger);
|
|
130
|
+
const connection = createMessageConnection(messageReader, messageWriter, logger);
|
|
131
|
+
connection.onClose(() => connection.dispose());
|
|
132
|
+
return connection;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* This takes vscode-ws-jsonrpc/lib/socket/writer/WebSocketMessageWriter and adds a buffer
|
|
137
|
+
*/
|
|
138
|
+
class BufferingWebSocketMessageWriter extends AbstractMessageWriter {
|
|
139
|
+
protected readonly socket: ReconnectingWebSocket;
|
|
140
|
+
protected readonly logger: Logger;
|
|
141
|
+
protected errorCount: number = 0;
|
|
142
|
+
|
|
143
|
+
protected buffer: any[] = [];
|
|
144
|
+
|
|
145
|
+
constructor(socket: ReconnectingWebSocket, logger: Logger) {
|
|
146
|
+
super();
|
|
147
|
+
this.socket = socket;
|
|
148
|
+
this.logger = logger;
|
|
149
|
+
|
|
150
|
+
socket.addEventListener("open", (event: Event) => this.flushBuffer());
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
write(msg: any) {
|
|
154
|
+
if (this.socket.readyState !== ReconnectingWebSocket.OPEN) {
|
|
155
|
+
this.bufferMsg(msg);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
try {
|
|
160
|
+
const content = JSON.stringify(msg);
|
|
161
|
+
this.socket.send(content);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
this.errorCount++;
|
|
164
|
+
this.fireError(e, msg, this.errorCount);
|
|
165
|
+
|
|
166
|
+
this.bufferMsg(msg);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
protected flushBuffer() {
|
|
171
|
+
if (this.buffer.length === 0) {
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const buffer = [...this.buffer];
|
|
176
|
+
this.buffer = [];
|
|
177
|
+
for (const msg of buffer) {
|
|
178
|
+
this.write(msg);
|
|
179
|
+
}
|
|
180
|
+
//this.logger.info(`flushed buffer (${this.buffer.length})`)
|
|
79
181
|
}
|
|
80
182
|
|
|
183
|
+
protected bufferMsg(msg: any) {
|
|
184
|
+
this.buffer.push(msg);
|
|
185
|
+
//this.logger.info(`buffered message (${this.buffer.length})`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* This takes vscode-ws-jsonrpc/lib/socket/reader/WebSocketMessageReader and removes the "onClose -> fireClose" connection
|
|
192
|
+
*/
|
|
193
|
+
class NonClosingWebSocketMessageReader extends AbstractMessageReader {
|
|
194
|
+
protected readonly socket: IWebSocket;
|
|
195
|
+
protected readonly events: any[] = [];
|
|
196
|
+
protected state: 'initial' | 'listening' | 'closed' = 'initial';
|
|
197
|
+
protected callback: (message: any) => void = () => {};
|
|
198
|
+
|
|
199
|
+
constructor(socket: IWebSocket) {
|
|
200
|
+
super();
|
|
201
|
+
this.socket = socket;
|
|
202
|
+
this.socket.onMessage(message => this.readMessage(message));
|
|
203
|
+
this.socket.onError(error => this.fireError(error));
|
|
204
|
+
this.socket.onClose((code, reason) => {
|
|
205
|
+
if (code !== 1000) {
|
|
206
|
+
const error = {
|
|
207
|
+
name: '' + code,
|
|
208
|
+
message: `Error during socket reconnect: code = ${code}, reason = ${reason}`
|
|
209
|
+
};
|
|
210
|
+
this.fireError(error);
|
|
211
|
+
}
|
|
212
|
+
// this.fireClose(); // <-- reason for this class to be copied over
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
listen(callback: (message: any) => void) {
|
|
216
|
+
if (this.state === 'initial') {
|
|
217
|
+
this.state = 'listening';
|
|
218
|
+
this.callback = callback;
|
|
219
|
+
while (this.events.length !== 0) {
|
|
220
|
+
const event = this.events.pop();
|
|
221
|
+
if (event.message) {
|
|
222
|
+
this.readMessage(event.message);
|
|
223
|
+
}
|
|
224
|
+
else if (event.error) {
|
|
225
|
+
this.fireError(event.error);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
this.fireClose();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
readMessage(message: any) {
|
|
234
|
+
if (this.state === 'initial') {
|
|
235
|
+
this.events.splice(0, 0, { message });
|
|
236
|
+
}
|
|
237
|
+
else if (this.state === 'listening') {
|
|
238
|
+
const data = JSON.parse(message);
|
|
239
|
+
this.callback(data);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
fireError(error: any) {
|
|
243
|
+
if (this.state === 'initial') {
|
|
244
|
+
this.events.splice(0, 0, { error });
|
|
245
|
+
}
|
|
246
|
+
else if (this.state === 'listening') {
|
|
247
|
+
super.fireError(error);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
fireClose() {
|
|
251
|
+
if (this.state === 'initial') {
|
|
252
|
+
this.events.splice(0, 0, {});
|
|
253
|
+
}
|
|
254
|
+
else if (this.state === 'listening') {
|
|
255
|
+
super.fireClose();
|
|
256
|
+
}
|
|
257
|
+
this.state = 'closed';
|
|
258
|
+
}
|
|
81
259
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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 { Message } from 'vscode-jsonrpc/lib/messages';
|
|
8
|
+
import { AbstractMessageWriter, MessageWriter } from 'vscode-jsonrpc/lib/messageWriter';
|
|
9
|
+
import { AbstractMessageReader, MessageReader, DataCallback } from 'vscode-jsonrpc/lib/messageReader';
|
|
10
|
+
import { MessageConnection, createMessageConnection } from 'vscode-jsonrpc/lib/main';
|
|
11
|
+
import { ConsoleLogger } from 'vscode-ws-jsonrpc';
|
|
12
|
+
|
|
13
|
+
interface WindowMessage extends Message {
|
|
14
|
+
serviceId: string
|
|
15
|
+
}
|
|
16
|
+
function isWindowMessage(value: any): value is WindowMessage {
|
|
17
|
+
return !!value && typeof value === 'object' &&
|
|
18
|
+
('jsonrpc' in value && typeof value['jsonrpc'] === 'string') &&
|
|
19
|
+
('serviceId' in value && typeof value['serviceId'] === 'string');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class WindowMessageWriter extends AbstractMessageWriter implements MessageWriter {
|
|
23
|
+
|
|
24
|
+
constructor(readonly serviceId: string, readonly window: Window, readonly targetOrigin: string) {
|
|
25
|
+
super();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
write(msg: Message): void {
|
|
29
|
+
const { serviceId } = this;
|
|
30
|
+
this.window.postMessage(Object.assign(msg, { serviceId }), this.targetOrigin);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class WindowMessageReader extends AbstractMessageReader implements MessageReader {
|
|
36
|
+
|
|
37
|
+
protected callback?: DataCallback;
|
|
38
|
+
protected readonly buffer: Message[] = [];
|
|
39
|
+
|
|
40
|
+
constructor(readonly serviceId: string, readonly sourceOrigin: string) {
|
|
41
|
+
super();
|
|
42
|
+
window.addEventListener('message', event => {
|
|
43
|
+
if (this.sourceOrigin !== '*' && event.origin !== this.sourceOrigin) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (!isWindowMessage(event.data) || event.data.serviceId !== this.serviceId) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (this.callback) {
|
|
50
|
+
this.callback(event.data);
|
|
51
|
+
} else {
|
|
52
|
+
this.buffer.push(event.data);
|
|
53
|
+
}
|
|
54
|
+
}, false);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
listen(callback: DataCallback): void {
|
|
58
|
+
let message;
|
|
59
|
+
while (message = this.buffer.pop()) {
|
|
60
|
+
callback(message);
|
|
61
|
+
}
|
|
62
|
+
Object.freeze(this.buffer);
|
|
63
|
+
this.callback = callback;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function createWindowMessageConnection(serviceId: string, window: Window, sourceOrigin: string, targetOrigin = sourceOrigin): MessageConnection {
|
|
69
|
+
const reader = new WindowMessageReader(serviceId, sourceOrigin);
|
|
70
|
+
const writer = new WindowMessageWriter(serviceId, window, targetOrigin);
|
|
71
|
+
return createMessageConnection(reader, writer, new ConsoleLogger());
|
|
72
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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 { injectable } from 'inversify';
|
|
8
|
+
import * as prometheusClient from 'prom-client';
|
|
9
|
+
|
|
10
|
+
type GrpcMethodType = 'unary' | 'client_stream' | 'server_stream' | 'bidi_stream';
|
|
11
|
+
export interface IGrpcCallMetricsLabels {
|
|
12
|
+
service: string,
|
|
13
|
+
method: string,
|
|
14
|
+
type: GrpcMethodType,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IGrpcCallMetricsLabelsWithCode extends IGrpcCallMetricsLabels {
|
|
18
|
+
code: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const IClientCallMetrics = Symbol("IClientCallMetrics");
|
|
22
|
+
|
|
23
|
+
export interface IClientCallMetrics {
|
|
24
|
+
started(labels: IGrpcCallMetricsLabels) : void;
|
|
25
|
+
sent(labels: IGrpcCallMetricsLabels) : void;
|
|
26
|
+
received(labels: IGrpcCallMetricsLabels) : void;
|
|
27
|
+
handled(labels: IGrpcCallMetricsLabelsWithCode) : void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@injectable()
|
|
31
|
+
export class PrometheusClientCallMetrics implements IClientCallMetrics {
|
|
32
|
+
|
|
33
|
+
readonly startedCounter: prometheusClient.Counter<string>;
|
|
34
|
+
readonly sentCounter: prometheusClient.Counter<string>;
|
|
35
|
+
readonly receivedCounter: prometheusClient.Counter<string>;
|
|
36
|
+
readonly handledCounter: prometheusClient.Counter<string>;
|
|
37
|
+
|
|
38
|
+
constructor() {
|
|
39
|
+
this.startedCounter = new prometheusClient.Counter({
|
|
40
|
+
name: 'grpc_client_started_total',
|
|
41
|
+
help: 'Total number of RPCs started on the client.',
|
|
42
|
+
labelNames: ['grpc_service', 'grpc_method', 'grpc_type'],
|
|
43
|
+
registers: [prometheusClient.register]
|
|
44
|
+
});
|
|
45
|
+
this.sentCounter = new prometheusClient.Counter({
|
|
46
|
+
name: 'grpc_client_msg_sent_total',
|
|
47
|
+
help: ' Total number of gRPC stream messages sent by the client.',
|
|
48
|
+
labelNames: ['grpc_service', 'grpc_method', 'grpc_type'],
|
|
49
|
+
registers: [prometheusClient.register]
|
|
50
|
+
});
|
|
51
|
+
this.receivedCounter = new prometheusClient.Counter({
|
|
52
|
+
name: 'grpc_client_msg_received_total',
|
|
53
|
+
help: 'Total number of RPC stream messages received by the client.',
|
|
54
|
+
labelNames: ['grpc_service', 'grpc_method', 'grpc_type'],
|
|
55
|
+
registers: [prometheusClient.register]
|
|
56
|
+
});
|
|
57
|
+
this.handledCounter = new prometheusClient.Counter({
|
|
58
|
+
name: 'grpc_client_handled_total',
|
|
59
|
+
help: 'Total number of RPCs completed by the client, regardless of success or failure.',
|
|
60
|
+
labelNames: ['grpc_service', 'grpc_method', 'grpc_type', 'grpc_code'],
|
|
61
|
+
registers: [prometheusClient.register]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
started(labels: IGrpcCallMetricsLabels): void {
|
|
66
|
+
this.startedCounter.inc({
|
|
67
|
+
grpc_service: labels.service,
|
|
68
|
+
grpc_method: labels.method,
|
|
69
|
+
grpc_type: labels.type
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
sent(labels: IGrpcCallMetricsLabels): void {
|
|
74
|
+
this.sentCounter.inc({
|
|
75
|
+
grpc_service: labels.service,
|
|
76
|
+
grpc_method: labels.method,
|
|
77
|
+
grpc_type: labels.type
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
received(labels: IGrpcCallMetricsLabels): void {
|
|
82
|
+
this.receivedCounter.inc({
|
|
83
|
+
grpc_service: labels.service,
|
|
84
|
+
grpc_method: labels.method,
|
|
85
|
+
grpc_type: labels.type
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
handled(labels: IGrpcCallMetricsLabelsWithCode): void {
|
|
90
|
+
this.handledCounter.inc({
|
|
91
|
+
grpc_service: labels.service,
|
|
92
|
+
grpc_method: labels.method,
|
|
93
|
+
grpc_type: labels.type,
|
|
94
|
+
grpc_code: labels.code
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
package/src/messaging/error.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020
|
|
2
|
+
* Copyright (c) 2020 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
|
*/
|
|
@@ -25,21 +25,30 @@ export namespace ErrorCodes {
|
|
|
25
25
|
// 410 No User
|
|
26
26
|
export const SETUP_REQUIRED = 410;
|
|
27
27
|
|
|
28
|
+
// 429 Too Many Requests
|
|
29
|
+
export const TOO_MANY_REQUESTS = 429;
|
|
30
|
+
|
|
28
31
|
// 430 Repository not whitelisted (custom status code)
|
|
29
32
|
export const REPOSITORY_NOT_WHITELISTED = 430;
|
|
30
33
|
|
|
31
34
|
// 460 Context Parse Error (custom status code)
|
|
32
35
|
export const CONTEXT_PARSE_ERROR = 460;
|
|
33
36
|
|
|
37
|
+
// 461 Invalid gitpod yml
|
|
38
|
+
export const INVALID_GITPOD_YML = 461;
|
|
39
|
+
|
|
34
40
|
// 450 Payment error
|
|
35
41
|
export const PAYMENT_ERROR = 450;
|
|
36
42
|
|
|
37
43
|
// 470 User Blocked (custom status code)
|
|
38
44
|
export const USER_BLOCKED = 470;
|
|
39
45
|
|
|
40
|
-
// 471 User
|
|
46
|
+
// 471 User Deleted (custom status code)
|
|
41
47
|
export const USER_DELETED = 471;
|
|
42
48
|
|
|
49
|
+
// 472 Terms Acceptance Required (custom status code)
|
|
50
|
+
export const USER_TERMS_ACCEPTANCE_REQUIRED = 472;
|
|
51
|
+
|
|
43
52
|
// 480 Plan does not allow private repos
|
|
44
53
|
export const PLAN_DOES_NOT_ALLOW_PRIVATE_REPOS = 480;
|
|
45
54
|
|
|
@@ -58,12 +67,15 @@ export namespace ErrorCodes {
|
|
|
58
67
|
// 555 EE License Required
|
|
59
68
|
export const EE_LICENSE_REQUIRED = 555;
|
|
60
69
|
|
|
70
|
+
// 601 SaaS Feature
|
|
71
|
+
export const SAAS_FEATURE = 601;
|
|
72
|
+
|
|
61
73
|
// 610 Invalid Team Subscription Quantity
|
|
62
74
|
export const TEAM_SUBSCRIPTION_INVALID_QUANTITY = 610;
|
|
63
75
|
|
|
64
76
|
// 620 Team Subscription Assignment Failed
|
|
65
77
|
export const TEAM_SUBSCRIPTION_ASSIGNMENT_FAILED = 620;
|
|
66
78
|
|
|
67
|
-
//
|
|
68
|
-
export const
|
|
79
|
+
// 630 Snapshot Error
|
|
80
|
+
export const SNAPSHOT_ERROR = 630;
|
|
69
81
|
}
|
package/src/messaging/handler.ts
CHANGED
|
@@ -13,3 +13,15 @@ export interface ConnectionHandler {
|
|
|
13
13
|
readonly path: string;
|
|
14
14
|
onConnection(connection: MessageConnection, session?: object): void;
|
|
15
15
|
}
|
|
16
|
+
|
|
17
|
+
export interface ConnectionEventHandler {
|
|
18
|
+
/**
|
|
19
|
+
* Called when the transport underpinning the connection got closed
|
|
20
|
+
*/
|
|
21
|
+
onTransportDidClose(): void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Called when the transport underpinning the connection is (re-)opened
|
|
25
|
+
*/
|
|
26
|
+
onTransportDidOpen(): void;
|
|
27
|
+
}
|
|
@@ -65,13 +65,13 @@ export function toIWebSocket(webSocket: ws) {
|
|
|
65
65
|
send: content => {
|
|
66
66
|
if (webSocket.readyState !== ws.OPEN) {
|
|
67
67
|
if (sendsAfterOpen++ > 3) {
|
|
68
|
-
log.
|
|
68
|
+
//log.debug(`Repeated try to send on closed web socket (readyState was ${webSocket.readyState})`, { ws });
|
|
69
69
|
}
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
webSocket.send(content, err => {
|
|
73
73
|
if (err) {
|
|
74
|
-
log.error('
|
|
74
|
+
log.error('error in ws.send()', err, { ws });
|
|
75
75
|
}
|
|
76
76
|
})
|
|
77
77
|
},
|