@opensumi/ide-connection 3.0.4-next-1716970216.0 → 3.0.4-next-1717045696.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/lib/browser/ws-channel-handler.d.ts +1 -10
- package/lib/browser/ws-channel-handler.d.ts.map +1 -1
- package/lib/browser/ws-channel-handler.js +22 -11
- package/lib/browser/ws-channel-handler.js.map +1 -1
- package/lib/common/connection/drivers/simple.d.ts +7 -7
- package/lib/common/connection/drivers/simple.d.ts.map +1 -1
- package/lib/common/connection/drivers/simple.js.map +1 -1
- package/lib/common/index.d.ts +0 -4
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +0 -4
- package/lib/common/index.js.map +1 -1
- package/lib/common/rpc/connection.d.ts +3 -4
- package/lib/common/rpc/connection.d.ts.map +1 -1
- package/lib/common/rpc/connection.js +30 -14
- package/lib/common/rpc/connection.js.map +1 -1
- package/lib/common/rpc/message-io.d.ts +11 -54
- package/lib/common/rpc/message-io.d.ts.map +1 -1
- package/lib/common/rpc/message-io.js +10 -63
- package/lib/common/rpc/message-io.js.map +1 -1
- package/lib/common/rpc/multiplexer.d.ts +0 -2
- package/lib/common/rpc/multiplexer.d.ts.map +1 -1
- package/lib/common/rpc/multiplexer.js +2 -6
- package/lib/common/rpc/multiplexer.js.map +1 -1
- package/lib/common/rpc-service/index.d.ts +0 -1
- package/lib/common/rpc-service/index.d.ts.map +1 -1
- package/lib/common/rpc-service/index.js +0 -1
- package/lib/common/rpc-service/index.js.map +1 -1
- package/lib/common/rpc-service/registry.d.ts +2 -2
- package/lib/common/rpc-service/registry.d.ts.map +1 -1
- package/lib/common/rpc-service/registry.js +0 -6
- package/lib/common/rpc-service/registry.js.map +1 -1
- package/lib/common/server-handler.d.ts +1 -7
- package/lib/common/server-handler.d.ts.map +1 -1
- package/lib/common/server-handler.js +11 -13
- package/lib/common/server-handler.js.map +1 -1
- package/lib/common/ws-channel.d.ts +201 -11
- package/lib/common/ws-channel.d.ts.map +1 -1
- package/lib/common/ws-channel.js +85 -49
- package/lib/common/ws-channel.js.map +1 -1
- package/package.json +5 -5
- package/src/browser/ws-channel-handler.ts +26 -29
- package/src/common/connection/drivers/simple.ts +5 -5
- package/src/common/index.ts +0 -4
- package/src/common/rpc/connection.ts +36 -19
- package/src/common/rpc/message-io.ts +10 -123
- package/src/common/rpc/multiplexer.ts +3 -12
- package/src/common/rpc-service/index.ts +0 -1
- package/src/common/rpc-service/registry.ts +2 -10
- package/src/common/server-handler.ts +26 -24
- package/src/common/ws-channel.ts +207 -72
- package/lib/common/channel/index.d.ts +0 -2
- package/lib/common/channel/index.d.ts.map +0 -1
- package/lib/common/channel/index.js +0 -5
- package/lib/common/channel/index.js.map +0 -1
- package/lib/common/channel/types.d.ts +0 -66
- package/lib/common/channel/types.d.ts.map +0 -1
- package/lib/common/channel/types.js +0 -8
- package/lib/common/channel/types.js.map +0 -1
- package/lib/common/serializer/fury.d.ts +0 -122
- package/lib/common/serializer/fury.d.ts.map +0 -1
- package/lib/common/serializer/fury.js +0 -51
- package/lib/common/serializer/fury.js.map +0 -1
- package/lib/common/serializer/index.d.ts +0 -6
- package/lib/common/serializer/index.d.ts.map +0 -1
- package/lib/common/serializer/index.js +0 -21
- package/lib/common/serializer/index.js.map +0 -1
- package/lib/common/serializer/raw.d.ts +0 -4
- package/lib/common/serializer/raw.d.ts.map +0 -1
- package/lib/common/serializer/raw.js +0 -8
- package/lib/common/serializer/raw.js.map +0 -1
- package/lib/common/serializer/types.d.ts +0 -5
- package/lib/common/serializer/types.d.ts.map +0 -1
- package/lib/common/serializer/types.js +0 -3
- package/lib/common/serializer/types.js.map +0 -1
- package/src/common/channel/index.ts +0 -1
- package/src/common/channel/types.ts +0 -82
- package/src/common/serializer/fury.ts +0 -61
- package/src/common/serializer/index.ts +0 -23
- package/src/common/serializer/raw.ts +0 -8
- package/src/common/serializer/types.ts +0 -4
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wrapSerializer = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
tslib_1.__exportStar(require("./fury"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
7
|
-
const wrapSerializer = (connection, serializer) => ({
|
|
8
|
-
onceClose(cb) {
|
|
9
|
-
return connection.onceClose(cb);
|
|
10
|
-
},
|
|
11
|
-
onMessage(cb) {
|
|
12
|
-
return connection.onMessage((data) => {
|
|
13
|
-
cb(serializer.deserialize(data));
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
send(data) {
|
|
17
|
-
connection.send(serializer.serialize(data));
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
exports.wrapSerializer = wrapSerializer;
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/serializer/index.ts"],"names":[],"mappings":";;;;AAIA,iDAAuB;AACvB,kDAAwB;AAEjB,MAAM,cAAc,GAAG,CAC5B,UAAgC,EAChC,UAAiC,EACT,EAAE,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE;QACV,OAAO,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IACD,SAAS,CAAC,EAAE;QACV,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;YACnC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,CAAC,IAAI;QACP,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;CACF,CAAC,CAAC;AAfU,QAAA,cAAc,kBAexB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../../src/common/serializer/raw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,cAAc,EAAE,cAAc,CAGrE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw.js","sourceRoot":"","sources":["../../../src/common/serializer/raw.ts"],"names":[],"mappings":";;;AAIa,QAAA,aAAa,GAAgD;IACxE,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO;IAC/B,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO;CAClC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/serializer/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,EAAE;IACnC,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC;IAC1B,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC;CAC7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/common/serializer/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './types';
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export type ChannelMessage =
|
|
2
|
-
| PingMessage
|
|
3
|
-
| PongMessage
|
|
4
|
-
| OpenMessage
|
|
5
|
-
| ServerReadyMessage
|
|
6
|
-
| DataMessage
|
|
7
|
-
| BinaryMessage
|
|
8
|
-
| CloseMessage
|
|
9
|
-
| ErrorMessage;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* `ping` and `pong` are used to detect whether the connection is alive.
|
|
13
|
-
*/
|
|
14
|
-
export interface PingMessage {
|
|
15
|
-
kind: 'ping';
|
|
16
|
-
id: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* when server receive a `ping` message, it should reply a `pong` message, vice versa.
|
|
21
|
-
*/
|
|
22
|
-
export interface PongMessage {
|
|
23
|
-
kind: 'pong';
|
|
24
|
-
id: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* `data` message indicate that the channel has received some data.
|
|
29
|
-
* the `content` field is the data, it should be a string.
|
|
30
|
-
*/
|
|
31
|
-
export interface DataMessage {
|
|
32
|
-
kind: 'data';
|
|
33
|
-
id: string;
|
|
34
|
-
content: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface BinaryMessage {
|
|
38
|
-
kind: 'binary';
|
|
39
|
-
id: string;
|
|
40
|
-
binary: Uint8Array;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface CloseMessage {
|
|
44
|
-
kind: 'close';
|
|
45
|
-
id: string;
|
|
46
|
-
code: number;
|
|
47
|
-
reason: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* `open` message is used to open a new channel.
|
|
52
|
-
* `path` is used to identify which handler should be used to handle the channel.
|
|
53
|
-
* `clientId` is used to identify the client.
|
|
54
|
-
*/
|
|
55
|
-
export interface OpenMessage {
|
|
56
|
-
kind: 'open';
|
|
57
|
-
id: string;
|
|
58
|
-
path: string;
|
|
59
|
-
clientId: string;
|
|
60
|
-
connectionToken: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export enum ErrorMessageCode {
|
|
64
|
-
ChannelNotFound = 1,
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface ErrorMessage {
|
|
68
|
-
kind: 'error';
|
|
69
|
-
id: string;
|
|
70
|
-
code: ErrorMessageCode;
|
|
71
|
-
message: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* when server receive a `open` message, it should reply a `server-ready` message.
|
|
76
|
-
* this is indicate that the channel is ready to use.
|
|
77
|
-
*/
|
|
78
|
-
export interface ServerReadyMessage {
|
|
79
|
-
kind: 'server-ready';
|
|
80
|
-
id: string;
|
|
81
|
-
token: string;
|
|
82
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Type } from '@furyjs/fury';
|
|
2
|
-
|
|
3
|
-
import { ChannelMessage } from '../channel/types';
|
|
4
|
-
import { oneOf } from '../fury-extends/one-of';
|
|
5
|
-
|
|
6
|
-
import { ISerializer } from './types';
|
|
7
|
-
|
|
8
|
-
export const PingProtocol = Type.object('ping', {
|
|
9
|
-
id: Type.string(),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export const PongProtocol = Type.object('pong', {
|
|
13
|
-
id: Type.string(),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const OpenProtocol = Type.object('open', {
|
|
17
|
-
clientId: Type.string(),
|
|
18
|
-
id: Type.string(),
|
|
19
|
-
path: Type.string(),
|
|
20
|
-
connectionToken: Type.string(),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export const ServerReadyProtocol = Type.object('server-ready', {
|
|
24
|
-
id: Type.string(),
|
|
25
|
-
token: Type.string(),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export const ErrorProtocol = Type.object('error', {
|
|
29
|
-
id: Type.string(),
|
|
30
|
-
code: Type.uint16(),
|
|
31
|
-
message: Type.string(),
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export const DataProtocol = Type.object('data', {
|
|
35
|
-
id: Type.string(),
|
|
36
|
-
content: Type.string(),
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export const BinaryProtocol = Type.object('binary', {
|
|
40
|
-
id: Type.string(),
|
|
41
|
-
binary: Type.binary(),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export const CloseProtocol = Type.object('close', {
|
|
45
|
-
id: Type.string(),
|
|
46
|
-
code: Type.uint32(),
|
|
47
|
-
reason: Type.string(),
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const serializer = oneOf([
|
|
51
|
-
PingProtocol,
|
|
52
|
-
PongProtocol,
|
|
53
|
-
OpenProtocol,
|
|
54
|
-
ServerReadyProtocol,
|
|
55
|
-
DataProtocol,
|
|
56
|
-
BinaryProtocol,
|
|
57
|
-
CloseProtocol,
|
|
58
|
-
ErrorProtocol,
|
|
59
|
-
]);
|
|
60
|
-
|
|
61
|
-
export const furySerializer: ISerializer<ChannelMessage, Uint8Array> = serializer;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { IConnectionShape } from '../connection/types';
|
|
2
|
-
|
|
3
|
-
import { ISerializer } from './types';
|
|
4
|
-
|
|
5
|
-
export * from './fury';
|
|
6
|
-
export * from './types';
|
|
7
|
-
|
|
8
|
-
export const wrapSerializer = <FROM, TO>(
|
|
9
|
-
connection: IConnectionShape<TO>,
|
|
10
|
-
serializer: ISerializer<FROM, TO>,
|
|
11
|
-
): IConnectionShape<FROM> => ({
|
|
12
|
-
onceClose(cb) {
|
|
13
|
-
return connection.onceClose(cb);
|
|
14
|
-
},
|
|
15
|
-
onMessage(cb) {
|
|
16
|
-
return connection.onMessage((data) => {
|
|
17
|
-
cb(serializer.deserialize(data));
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
send(data) {
|
|
21
|
-
connection.send(serializer.serialize(data));
|
|
22
|
-
},
|
|
23
|
-
});
|