@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.
Files changed (80) hide show
  1. package/lib/browser/ws-channel-handler.d.ts +1 -10
  2. package/lib/browser/ws-channel-handler.d.ts.map +1 -1
  3. package/lib/browser/ws-channel-handler.js +22 -11
  4. package/lib/browser/ws-channel-handler.js.map +1 -1
  5. package/lib/common/connection/drivers/simple.d.ts +7 -7
  6. package/lib/common/connection/drivers/simple.d.ts.map +1 -1
  7. package/lib/common/connection/drivers/simple.js.map +1 -1
  8. package/lib/common/index.d.ts +0 -4
  9. package/lib/common/index.d.ts.map +1 -1
  10. package/lib/common/index.js +0 -4
  11. package/lib/common/index.js.map +1 -1
  12. package/lib/common/rpc/connection.d.ts +3 -4
  13. package/lib/common/rpc/connection.d.ts.map +1 -1
  14. package/lib/common/rpc/connection.js +30 -14
  15. package/lib/common/rpc/connection.js.map +1 -1
  16. package/lib/common/rpc/message-io.d.ts +11 -54
  17. package/lib/common/rpc/message-io.d.ts.map +1 -1
  18. package/lib/common/rpc/message-io.js +10 -63
  19. package/lib/common/rpc/message-io.js.map +1 -1
  20. package/lib/common/rpc/multiplexer.d.ts +0 -2
  21. package/lib/common/rpc/multiplexer.d.ts.map +1 -1
  22. package/lib/common/rpc/multiplexer.js +2 -6
  23. package/lib/common/rpc/multiplexer.js.map +1 -1
  24. package/lib/common/rpc-service/index.d.ts +0 -1
  25. package/lib/common/rpc-service/index.d.ts.map +1 -1
  26. package/lib/common/rpc-service/index.js +0 -1
  27. package/lib/common/rpc-service/index.js.map +1 -1
  28. package/lib/common/rpc-service/registry.d.ts +2 -2
  29. package/lib/common/rpc-service/registry.d.ts.map +1 -1
  30. package/lib/common/rpc-service/registry.js +0 -6
  31. package/lib/common/rpc-service/registry.js.map +1 -1
  32. package/lib/common/server-handler.d.ts +1 -7
  33. package/lib/common/server-handler.d.ts.map +1 -1
  34. package/lib/common/server-handler.js +11 -13
  35. package/lib/common/server-handler.js.map +1 -1
  36. package/lib/common/ws-channel.d.ts +201 -11
  37. package/lib/common/ws-channel.d.ts.map +1 -1
  38. package/lib/common/ws-channel.js +85 -49
  39. package/lib/common/ws-channel.js.map +1 -1
  40. package/package.json +5 -5
  41. package/src/browser/ws-channel-handler.ts +26 -29
  42. package/src/common/connection/drivers/simple.ts +5 -5
  43. package/src/common/index.ts +0 -4
  44. package/src/common/rpc/connection.ts +36 -19
  45. package/src/common/rpc/message-io.ts +10 -123
  46. package/src/common/rpc/multiplexer.ts +3 -12
  47. package/src/common/rpc-service/index.ts +0 -1
  48. package/src/common/rpc-service/registry.ts +2 -10
  49. package/src/common/server-handler.ts +26 -24
  50. package/src/common/ws-channel.ts +207 -72
  51. package/lib/common/channel/index.d.ts +0 -2
  52. package/lib/common/channel/index.d.ts.map +0 -1
  53. package/lib/common/channel/index.js +0 -5
  54. package/lib/common/channel/index.js.map +0 -1
  55. package/lib/common/channel/types.d.ts +0 -66
  56. package/lib/common/channel/types.d.ts.map +0 -1
  57. package/lib/common/channel/types.js +0 -8
  58. package/lib/common/channel/types.js.map +0 -1
  59. package/lib/common/serializer/fury.d.ts +0 -122
  60. package/lib/common/serializer/fury.d.ts.map +0 -1
  61. package/lib/common/serializer/fury.js +0 -51
  62. package/lib/common/serializer/fury.js.map +0 -1
  63. package/lib/common/serializer/index.d.ts +0 -6
  64. package/lib/common/serializer/index.d.ts.map +0 -1
  65. package/lib/common/serializer/index.js +0 -21
  66. package/lib/common/serializer/index.js.map +0 -1
  67. package/lib/common/serializer/raw.d.ts +0 -4
  68. package/lib/common/serializer/raw.d.ts.map +0 -1
  69. package/lib/common/serializer/raw.js +0 -8
  70. package/lib/common/serializer/raw.js.map +0 -1
  71. package/lib/common/serializer/types.d.ts +0 -5
  72. package/lib/common/serializer/types.d.ts.map +0 -1
  73. package/lib/common/serializer/types.js +0 -3
  74. package/lib/common/serializer/types.js.map +0 -1
  75. package/src/common/channel/index.ts +0 -1
  76. package/src/common/channel/types.ts +0 -82
  77. package/src/common/serializer/fury.ts +0 -61
  78. package/src/common/serializer/index.ts +0 -23
  79. package/src/common/serializer/raw.ts +0 -8
  80. package/src/common/serializer/types.ts +0 -4
@@ -1,3 +1,5 @@
1
+ import { Type } from '@furyjs/fury';
2
+
1
3
  import { EventEmitter } from '@opensumi/events';
2
4
  import {
3
5
  DisposableCollection,
@@ -7,12 +9,52 @@ import {
7
9
  randomString,
8
10
  } from '@opensumi/ide-core-common';
9
11
 
10
- import { ChannelMessage, ErrorMessageCode } from './channel/types';
11
12
  import { IConnectionShape } from './connection/types';
13
+ import { oneOf } from './fury-extends/one-of';
12
14
  import { ISumiConnectionOptions, SumiConnection } from './rpc/connection';
13
- import { furySerializer, wrapSerializer } from './serializer';
14
15
  import { ILogger } from './types';
15
16
 
17
+ /**
18
+ * `ping` and `pong` are used to detect whether the connection is alive.
19
+ */
20
+ export interface PingMessage {
21
+ kind: 'ping';
22
+ id: string;
23
+ clientId: string;
24
+ }
25
+
26
+ /**
27
+ * when server receive a `ping` message, it should reply a `pong` message, vice versa.
28
+ */
29
+ export interface PongMessage {
30
+ kind: 'pong';
31
+ id: string;
32
+ clientId: string;
33
+ }
34
+
35
+ /**
36
+ * `data` message indicate that the channel has received some data.
37
+ * the `content` field is the data, it should be a string.
38
+ */
39
+ export interface DataMessage {
40
+ kind: 'data';
41
+ id: string;
42
+ content: string;
43
+ }
44
+
45
+ export interface BinaryMessage {
46
+ kind: 'binary';
47
+ id: string;
48
+ binary: Uint8Array;
49
+ }
50
+
51
+ export interface CloseMessage {
52
+ kind: 'close';
53
+ id: string;
54
+ code: number;
55
+ reason: string;
56
+ }
57
+
16
58
  export interface IWSChannelCreateOptions {
17
59
  /**
18
60
  * every channel's unique id, it only used in client to server architecture.
@@ -38,25 +80,25 @@ export class WSChannel {
38
80
 
39
81
  protected onBinaryQueue = this._disposables.add(new EventQueue<Uint8Array>());
40
82
 
41
- protected sendQueue: ChannelMessage[] = [];
83
+ protected sendQueue: Uint8Array[] = [];
42
84
  protected _isServerReady = false;
43
85
  protected _ensureServerReady: boolean | undefined;
44
86
 
45
87
  public id: string;
46
88
 
47
89
  public channelPath: string;
48
- public clientId: string;
49
-
50
- protected LOG_TAG = '[WSChannel]';
51
90
 
52
91
  logger: ILogger = console;
53
92
 
54
93
  static forClient(connection: IConnectionShape<Uint8Array>, options: IWSChannelCreateOptions) {
55
94
  const disposable = new DisposableCollection();
95
+ const channel = new WSChannel(connection, options);
56
96
 
57
- const wrappedConnection = wrapSerializer(connection, furySerializer);
58
- const channel = new WSChannel(wrappedConnection, options);
59
- disposable.push(channel.listen());
97
+ disposable.push(
98
+ connection.onMessage((data) => {
99
+ channel.dispatch(parse(data));
100
+ }),
101
+ );
60
102
 
61
103
  connection.onceClose(() => {
62
104
  disposable.dispose();
@@ -65,10 +107,10 @@ export class WSChannel {
65
107
  return channel;
66
108
  }
67
109
 
68
- constructor(public connection: IConnectionShape<ChannelMessage>, options: IWSChannelCreateOptions) {
110
+ constructor(public connection: IConnectionShape<Uint8Array>, options: IWSChannelCreateOptions) {
69
111
  const { id, logger, ensureServerReady } = options;
70
112
  this.id = id;
71
- this.LOG_TAG = `[WSChannel id=${this.id}]`;
113
+
72
114
  if (logger) {
73
115
  this.logger = logger;
74
116
  }
@@ -78,7 +120,7 @@ export class WSChannel {
78
120
  this._disposables.add(this.emitter.on('binary', (data) => this.onBinaryQueue.push(data)));
79
121
  }
80
122
 
81
- protected inqueue(data: ChannelMessage) {
123
+ protected inqueue(data: Uint8Array) {
82
124
  if (this._ensureServerReady && !this._isServerReady) {
83
125
  if (!this.sendQueue) {
84
126
  this.sendQueue = [];
@@ -140,20 +182,6 @@ export class WSChannel {
140
182
  case 'binary':
141
183
  this.emitter.emit('binary', msg.binary);
142
184
  break;
143
- case 'error':
144
- this.logger.error(this.LOG_TAG, `receive error: id: ${msg.id}, code: ${msg.code}, error: ${msg.message}`);
145
- switch (msg.code) {
146
- case ErrorMessageCode.ChannelNotFound:
147
- // 有 channelPath 说明该 channel 曾经被打开过
148
- // 重新打开 channel
149
- if (this.channelPath) {
150
- // 暂停消息发送, 直到收到 server-ready
151
- this.pause();
152
- this.open(this.channelPath, this.clientId);
153
- }
154
- break;
155
- }
156
- break;
157
185
  }
158
186
  }
159
187
 
@@ -164,9 +192,6 @@ export class WSChannel {
164
192
  */
165
193
  open(path: string, clientId: string, connectionToken = randomString(16)) {
166
194
  this.channelPath = path;
167
- this.clientId = clientId;
168
-
169
- this.LOG_TAG = `[WSChannel id=${this.id} path=${path}]`;
170
195
 
171
196
  if (this.stateTracer.has(connectionToken)) {
172
197
  this.logger.warn(
@@ -177,13 +202,15 @@ export class WSChannel {
177
202
 
178
203
  this.stateTracer.record(connectionToken);
179
204
 
180
- this.connection.send({
181
- kind: 'open',
182
- id: this.id,
183
- path,
184
- clientId,
185
- connectionToken,
186
- });
205
+ this.connection.send(
206
+ stringify({
207
+ kind: 'open',
208
+ id: this.id,
209
+ path,
210
+ clientId,
211
+ connectionToken,
212
+ }),
213
+ );
187
214
 
188
215
  if (this._ensureServerReady) {
189
216
  this.ensureOpenSend(path, clientId, connectionToken);
@@ -210,19 +237,23 @@ export class WSChannel {
210
237
  }
211
238
 
212
239
  send(content: string) {
213
- this.inqueue({
214
- kind: 'data',
215
- id: this.id,
216
- content,
217
- });
240
+ this.inqueue(
241
+ stringify({
242
+ kind: 'data',
243
+ id: this.id,
244
+ content,
245
+ }),
246
+ );
218
247
  }
219
248
 
220
249
  sendBinary(data: Uint8Array) {
221
- this.inqueue({
222
- kind: 'binary',
223
- id: this.id,
224
- binary: data,
225
- });
250
+ this.inqueue(
251
+ stringify({
252
+ kind: 'binary',
253
+ id: this.id,
254
+ binary: data,
255
+ }),
256
+ );
226
257
  }
227
258
  onError() {}
228
259
  close(code?: number, reason?: string) {
@@ -255,12 +286,6 @@ export class WSChannel {
255
286
  return conn;
256
287
  }
257
288
 
258
- listen() {
259
- return this.connection.onMessage((data) => {
260
- this.dispatch(data);
261
- });
262
- }
263
-
264
289
  dispose() {
265
290
  if (this.timer) {
266
291
  clearTimeout(this.timer);
@@ -268,13 +293,6 @@ export class WSChannel {
268
293
  this.sendQueue = [];
269
294
  this._disposables.dispose();
270
295
  }
271
-
272
- ping() {
273
- this.connection.send({
274
- kind: 'ping',
275
- id: this.id,
276
- });
277
- }
278
296
  }
279
297
 
280
298
  interface IWSServerChannelCreateOptions extends IWSChannelCreateOptions {
@@ -288,17 +306,18 @@ export class WSServerChannel extends WSChannel {
288
306
  messageQueue: ChannelMessage[] = [];
289
307
 
290
308
  clientId: string;
291
- constructor(public connection: IConnectionShape<ChannelMessage>, options: IWSServerChannelCreateOptions) {
309
+ constructor(public connection: IConnectionShape<Uint8Array>, options: IWSServerChannelCreateOptions) {
292
310
  super(connection, options);
293
311
  this.clientId = options.clientId;
294
312
  }
295
-
296
313
  serverReady(token: string) {
297
- this.connection.send({
298
- kind: 'server-ready',
299
- id: this.id,
300
- token,
301
- });
314
+ this.connection.send(
315
+ stringify({
316
+ kind: 'server-ready',
317
+ id: this.id,
318
+ token,
319
+ }),
320
+ );
302
321
  }
303
322
 
304
323
  dispatch(msg: ChannelMessage) {
@@ -309,12 +328,128 @@ export class WSServerChannel extends WSChannel {
309
328
  case 'binary':
310
329
  this.emitter.emit('binary', msg.binary);
311
330
  break;
312
- case 'ping':
313
- this.connection.send({
314
- kind: 'pong',
315
- id: this.id,
316
- });
317
- break;
318
331
  }
319
332
  }
320
333
  }
334
+
335
+ export type ChannelMessage =
336
+ | PingMessage
337
+ | PongMessage
338
+ | OpenMessage
339
+ | ServerReadyMessage
340
+ | DataMessage
341
+ | BinaryMessage
342
+ | CloseMessage
343
+ | ErrorMessage;
344
+
345
+ export const PingProtocol = Type.object('ping', {
346
+ clientId: Type.string(),
347
+ id: Type.string(),
348
+ });
349
+
350
+ export const PongProtocol = Type.object('pong', {
351
+ clientId: Type.string(),
352
+ id: Type.string(),
353
+ });
354
+
355
+ /**
356
+ * `open` message is used to open a new channel.
357
+ * `path` is used to identify which handler should be used to handle the channel.
358
+ * `clientId` is used to identify the client.
359
+ */
360
+ export interface OpenMessage {
361
+ kind: 'open';
362
+ id: string;
363
+ path: string;
364
+ clientId: string;
365
+ connectionToken: string;
366
+ }
367
+
368
+ export const OpenProtocol = Type.object('open', {
369
+ clientId: Type.string(),
370
+ id: Type.string(),
371
+ path: Type.string(),
372
+ connectionToken: Type.string(),
373
+ });
374
+
375
+ /**
376
+ * when server receive a `open` message, it should reply a `server-ready` message.
377
+ * this is indicate that the channel is ready to use.
378
+ */
379
+ export interface ServerReadyMessage {
380
+ kind: 'server-ready';
381
+ id: string;
382
+ token: string;
383
+ }
384
+
385
+ export const ServerReadyProtocol = Type.object('server-ready', {
386
+ id: Type.string(),
387
+ token: Type.string(),
388
+ });
389
+
390
+ export enum ErrorMessageCode {
391
+ ChannelNotFound = 1,
392
+ }
393
+
394
+ export interface ErrorMessage {
395
+ kind: 'error';
396
+ id: string;
397
+ code: ErrorMessageCode;
398
+ message: string;
399
+ }
400
+
401
+ export const ErrorProtocol = Type.object('error', {
402
+ id: Type.string(),
403
+ code: Type.uint16(),
404
+ message: Type.string(),
405
+ });
406
+
407
+ export const DataProtocol = Type.object('data', {
408
+ id: Type.string(),
409
+ content: Type.string(),
410
+ });
411
+
412
+ export const BinaryProtocol = Type.object('binary', {
413
+ id: Type.string(),
414
+ binary: Type.binary(),
415
+ });
416
+
417
+ export const CloseProtocol = Type.object('close', {
418
+ id: Type.string(),
419
+ code: Type.uint32(),
420
+ reason: Type.string(),
421
+ });
422
+
423
+ const serializer = oneOf([
424
+ PingProtocol,
425
+ PongProtocol,
426
+ OpenProtocol,
427
+ ServerReadyProtocol,
428
+ DataProtocol,
429
+ BinaryProtocol,
430
+ CloseProtocol,
431
+ ErrorProtocol,
432
+ ]);
433
+
434
+ export function stringify(obj: ChannelMessage): Uint8Array {
435
+ return serializer.serialize(obj);
436
+ }
437
+
438
+ export function parse(input: Uint8Array): ChannelMessage {
439
+ return serializer.deserialize(input) as any;
440
+ }
441
+
442
+ const _pingMessage: PingMessage = {
443
+ kind: 'ping',
444
+ id: '',
445
+ clientId: '',
446
+ };
447
+
448
+ const _pongMessage: PongMessage = {
449
+ kind: 'pong',
450
+ id: '',
451
+ clientId: '',
452
+ };
453
+
454
+ export const pingMessage = stringify(_pingMessage);
455
+ export const pongMessage = stringify(_pongMessage);
@@ -1,2 +0,0 @@
1
- export * from './types';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/channel/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./types"), exports);
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/channel/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB"}
@@ -1,66 +0,0 @@
1
- export type ChannelMessage = PingMessage | PongMessage | OpenMessage | ServerReadyMessage | DataMessage | BinaryMessage | CloseMessage | ErrorMessage;
2
- /**
3
- * `ping` and `pong` are used to detect whether the connection is alive.
4
- */
5
- export interface PingMessage {
6
- kind: 'ping';
7
- id: string;
8
- }
9
- /**
10
- * when server receive a `ping` message, it should reply a `pong` message, vice versa.
11
- */
12
- export interface PongMessage {
13
- kind: 'pong';
14
- id: string;
15
- }
16
- /**
17
- * `data` message indicate that the channel has received some data.
18
- * the `content` field is the data, it should be a string.
19
- */
20
- export interface DataMessage {
21
- kind: 'data';
22
- id: string;
23
- content: string;
24
- }
25
- export interface BinaryMessage {
26
- kind: 'binary';
27
- id: string;
28
- binary: Uint8Array;
29
- }
30
- export interface CloseMessage {
31
- kind: 'close';
32
- id: string;
33
- code: number;
34
- reason: string;
35
- }
36
- /**
37
- * `open` message is used to open a new channel.
38
- * `path` is used to identify which handler should be used to handle the channel.
39
- * `clientId` is used to identify the client.
40
- */
41
- export interface OpenMessage {
42
- kind: 'open';
43
- id: string;
44
- path: string;
45
- clientId: string;
46
- connectionToken: string;
47
- }
48
- export declare enum ErrorMessageCode {
49
- ChannelNotFound = 1
50
- }
51
- export interface ErrorMessage {
52
- kind: 'error';
53
- id: string;
54
- code: ErrorMessageCode;
55
- message: string;
56
- }
57
- /**
58
- * when server receive a `open` message, it should reply a `server-ready` message.
59
- * this is indicate that the channel is ready to use.
60
- */
61
- export interface ServerReadyMessage {
62
- kind: 'server-ready';
63
- id: string;
64
- token: string;
65
- }
66
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/common/channel/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,WAAW,GACX,WAAW,GACX,kBAAkB,GAClB,WAAW,GACX,aAAa,GACb,YAAY,GACZ,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,oBAAY,gBAAgB;IAC1B,eAAe,IAAI;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorMessageCode = void 0;
4
- var ErrorMessageCode;
5
- (function (ErrorMessageCode) {
6
- ErrorMessageCode[ErrorMessageCode["ChannelNotFound"] = 1] = "ChannelNotFound";
7
- })(ErrorMessageCode = exports.ErrorMessageCode || (exports.ErrorMessageCode = {}));
8
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/common/channel/types.ts"],"names":[],"mappings":";;;AA8DA,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,6EAAmB,CAAA;AACrB,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAE3B"}
@@ -1,122 +0,0 @@
1
- import { ChannelMessage } from '../channel/types';
2
- import { ISerializer } from './types';
3
- export declare const PingProtocol: {
4
- type: import("@furyjs/fury").InternalSerializerType.FURY_TYPE_TAG;
5
- options: {
6
- tag: string;
7
- props: {
8
- id: {
9
- type: import("@furyjs/fury").InternalSerializerType.STRING;
10
- };
11
- } | undefined;
12
- };
13
- };
14
- export declare const PongProtocol: {
15
- type: import("@furyjs/fury").InternalSerializerType.FURY_TYPE_TAG;
16
- options: {
17
- tag: string;
18
- props: {
19
- id: {
20
- type: import("@furyjs/fury").InternalSerializerType.STRING;
21
- };
22
- } | undefined;
23
- };
24
- };
25
- export declare const OpenProtocol: {
26
- type: import("@furyjs/fury").InternalSerializerType.FURY_TYPE_TAG;
27
- options: {
28
- tag: string;
29
- props: {
30
- clientId: {
31
- type: import("@furyjs/fury").InternalSerializerType.STRING;
32
- };
33
- id: {
34
- type: import("@furyjs/fury").InternalSerializerType.STRING;
35
- };
36
- path: {
37
- type: import("@furyjs/fury").InternalSerializerType.STRING;
38
- };
39
- connectionToken: {
40
- type: import("@furyjs/fury").InternalSerializerType.STRING;
41
- };
42
- } | undefined;
43
- };
44
- };
45
- export declare const ServerReadyProtocol: {
46
- type: import("@furyjs/fury").InternalSerializerType.FURY_TYPE_TAG;
47
- options: {
48
- tag: string;
49
- props: {
50
- id: {
51
- type: import("@furyjs/fury").InternalSerializerType.STRING;
52
- };
53
- token: {
54
- type: import("@furyjs/fury").InternalSerializerType.STRING;
55
- };
56
- } | undefined;
57
- };
58
- };
59
- export declare const ErrorProtocol: {
60
- type: import("@furyjs/fury").InternalSerializerType.FURY_TYPE_TAG;
61
- options: {
62
- tag: string;
63
- props: {
64
- id: {
65
- type: import("@furyjs/fury").InternalSerializerType.STRING;
66
- };
67
- code: {
68
- type: import("@furyjs/fury").InternalSerializerType.UINT16;
69
- };
70
- message: {
71
- type: import("@furyjs/fury").InternalSerializerType.STRING;
72
- };
73
- } | undefined;
74
- };
75
- };
76
- export declare const DataProtocol: {
77
- type: import("@furyjs/fury").InternalSerializerType.FURY_TYPE_TAG;
78
- options: {
79
- tag: string;
80
- props: {
81
- id: {
82
- type: import("@furyjs/fury").InternalSerializerType.STRING;
83
- };
84
- content: {
85
- type: import("@furyjs/fury").InternalSerializerType.STRING;
86
- };
87
- } | undefined;
88
- };
89
- };
90
- export declare const BinaryProtocol: {
91
- type: import("@furyjs/fury").InternalSerializerType.FURY_TYPE_TAG;
92
- options: {
93
- tag: string;
94
- props: {
95
- id: {
96
- type: import("@furyjs/fury").InternalSerializerType.STRING;
97
- };
98
- binary: {
99
- type: import("@furyjs/fury").InternalSerializerType.BINARY;
100
- };
101
- } | undefined;
102
- };
103
- };
104
- export declare const CloseProtocol: {
105
- type: import("@furyjs/fury").InternalSerializerType.FURY_TYPE_TAG;
106
- options: {
107
- tag: string;
108
- props: {
109
- id: {
110
- type: import("@furyjs/fury").InternalSerializerType.STRING;
111
- };
112
- code: {
113
- type: import("@furyjs/fury").InternalSerializerType.UINT32;
114
- };
115
- reason: {
116
- type: import("@furyjs/fury").InternalSerializerType.STRING;
117
- };
118
- } | undefined;
119
- };
120
- };
121
- export declare const furySerializer: ISerializer<ChannelMessage, Uint8Array>;
122
- //# sourceMappingURL=fury.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fury.d.ts","sourceRoot":"","sources":["../../../src/common/serializer/fury.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,YAAY;;;;;;;;;;CAEvB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;CAEvB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;CAKvB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;CAG9B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;CAIxB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAGvB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAGzB,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;CAIxB,CAAC;AAaH,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,cAAc,EAAE,UAAU,CAAc,CAAC"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.furySerializer = exports.CloseProtocol = exports.BinaryProtocol = exports.DataProtocol = exports.ErrorProtocol = exports.ServerReadyProtocol = exports.OpenProtocol = exports.PongProtocol = exports.PingProtocol = void 0;
4
- const fury_1 = require("@furyjs/fury");
5
- const one_of_1 = require("../fury-extends/one-of");
6
- exports.PingProtocol = fury_1.Type.object('ping', {
7
- id: fury_1.Type.string(),
8
- });
9
- exports.PongProtocol = fury_1.Type.object('pong', {
10
- id: fury_1.Type.string(),
11
- });
12
- exports.OpenProtocol = fury_1.Type.object('open', {
13
- clientId: fury_1.Type.string(),
14
- id: fury_1.Type.string(),
15
- path: fury_1.Type.string(),
16
- connectionToken: fury_1.Type.string(),
17
- });
18
- exports.ServerReadyProtocol = fury_1.Type.object('server-ready', {
19
- id: fury_1.Type.string(),
20
- token: fury_1.Type.string(),
21
- });
22
- exports.ErrorProtocol = fury_1.Type.object('error', {
23
- id: fury_1.Type.string(),
24
- code: fury_1.Type.uint16(),
25
- message: fury_1.Type.string(),
26
- });
27
- exports.DataProtocol = fury_1.Type.object('data', {
28
- id: fury_1.Type.string(),
29
- content: fury_1.Type.string(),
30
- });
31
- exports.BinaryProtocol = fury_1.Type.object('binary', {
32
- id: fury_1.Type.string(),
33
- binary: fury_1.Type.binary(),
34
- });
35
- exports.CloseProtocol = fury_1.Type.object('close', {
36
- id: fury_1.Type.string(),
37
- code: fury_1.Type.uint32(),
38
- reason: fury_1.Type.string(),
39
- });
40
- const serializer = (0, one_of_1.oneOf)([
41
- exports.PingProtocol,
42
- exports.PongProtocol,
43
- exports.OpenProtocol,
44
- exports.ServerReadyProtocol,
45
- exports.DataProtocol,
46
- exports.BinaryProtocol,
47
- exports.CloseProtocol,
48
- exports.ErrorProtocol,
49
- ]);
50
- exports.furySerializer = serializer;
51
- //# sourceMappingURL=fury.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fury.js","sourceRoot":"","sources":["../../../src/common/serializer/fury.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AAGpC,mDAA+C;AAIlC,QAAA,YAAY,GAAG,WAAI,CAAC,MAAM,CAAC,MAAM,EAAE;IAC9C,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAEU,QAAA,YAAY,GAAG,WAAI,CAAC,MAAM,CAAC,MAAM,EAAE;IAC9C,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAEU,QAAA,YAAY,GAAG,WAAI,CAAC,MAAM,CAAC,MAAM,EAAE;IAC9C,QAAQ,EAAE,WAAI,CAAC,MAAM,EAAE;IACvB,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,WAAI,CAAC,MAAM,EAAE;IACnB,eAAe,EAAE,WAAI,CAAC,MAAM,EAAE;CAC/B,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,WAAI,CAAC,MAAM,CAAC,cAAc,EAAE;IAC7D,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,WAAI,CAAC,MAAM,EAAE;CACrB,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,WAAI,CAAC,MAAM,CAAC,OAAO,EAAE;IAChD,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,WAAI,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,WAAI,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEU,QAAA,YAAY,GAAG,WAAI,CAAC,MAAM,CAAC,MAAM,EAAE;IAC9C,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,WAAI,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,WAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;IAClD,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,WAAI,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,WAAI,CAAC,MAAM,CAAC,OAAO,EAAE;IAChD,EAAE,EAAE,WAAI,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,WAAI,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,WAAI,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,IAAA,cAAK,EAAC;IACvB,oBAAY;IACZ,oBAAY;IACZ,oBAAY;IACZ,2BAAmB;IACnB,oBAAY;IACZ,sBAAc;IACd,qBAAa;IACb,qBAAa;CACd,CAAC,CAAC;AAEU,QAAA,cAAc,GAA4C,UAAU,CAAC"}
@@ -1,6 +0,0 @@
1
- import { IConnectionShape } from '../connection/types';
2
- import { ISerializer } from './types';
3
- export * from './fury';
4
- export * from './types';
5
- export declare const wrapSerializer: <FROM, TO>(connection: IConnectionShape<TO>, serializer: ISerializer<FROM, TO>) => IConnectionShape<FROM>;
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/serializer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,cAAc,2GAezB,CAAC"}