thor-io.vnext 2.0.6 → 3.1.0-beta.1

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 (178) hide show
  1. package/.gitattributes +17 -17
  2. package/{index.d.ts → build/index.d.ts} +11 -8
  3. package/build/index.js +47 -0
  4. package/build/src/Connection/ClientInfo.d.ts +27 -0
  5. package/{src → build/src}/Connection/ClientInfo.js +7 -0
  6. package/build/src/Connection/Connection.d.ts +117 -0
  7. package/build/src/Connection/Connection.js +202 -0
  8. package/build/src/Connection/IClientInfo.d.ts +20 -0
  9. package/build/src/Controller/ControllerBase.d.ts +134 -0
  10. package/build/src/Controller/ControllerBase.js +543 -0
  11. package/build/src/Controller/Subscription.d.ts +27 -0
  12. package/build/src/Controller/Subscription.js +22 -0
  13. package/build/src/Controllers/BrokerController/Broker.js +145 -0
  14. package/build/src/Controllers/BrokerController/BrokerController.d.ts +61 -0
  15. package/build/src/Controllers/BrokerController/BrokerController.js +115 -0
  16. package/{src/Controllers/BrokerController/Broker.js → build/src/Controllers/BrokerController/BrokerrController.js} +74 -85
  17. package/build/src/Controllers/BrokerController/Models/PeerConnection.d.ts +7 -0
  18. package/build/src/Controllers/BrokerController/Models/PeerConnection.js +14 -0
  19. package/build/src/Controllers/BrokerController/Models/Signal.js +11 -0
  20. package/build/src/Decorators/CanInvoke.d.ts +10 -0
  21. package/build/src/Decorators/CanInvoke.js +22 -0
  22. package/build/src/Decorators/CanSet.d.ts +10 -0
  23. package/build/src/Decorators/CanSet.js +20 -0
  24. package/build/src/Decorators/ControllerProperties.d.ts +10 -0
  25. package/build/src/Decorators/ControllerProperties.js +20 -0
  26. package/build/src/Interfaces/IInterceptor.js +2 -0
  27. package/build/src/Interfaces/ITransport.d.ts +94 -0
  28. package/build/src/Interfaces/ITransportMessage.d.ts +41 -0
  29. package/build/src/Messages/BufferMessage.d.ts +38 -0
  30. package/{src → build/src}/Messages/BufferMessage.js +32 -2
  31. package/build/src/Messages/ErrorMessage.d.ts +29 -0
  32. package/build/src/Messages/ErrorMessage.js +22 -0
  33. package/build/src/Messages/PipeMessage.d.ts +46 -0
  34. package/build/src/Messages/PipeMessage.js +41 -0
  35. package/build/src/Messages/TextMessage.d.ts +88 -0
  36. package/build/src/Messages/TextMessage.js +94 -0
  37. package/build/src/Messages/WebSocketMessage.d.ts +34 -0
  38. package/build/src/Messages/WebSocketMessage.js +41 -0
  39. package/build/src/Plugin.js +32 -0
  40. package/build/src/Server/Plugin.d.ts +37 -0
  41. package/build/src/Server/Plugin.js +32 -0
  42. package/build/src/Server/ThorIOServer.d.ts +68 -0
  43. package/build/src/Server/ThorIOServer.js +131 -0
  44. package/build/src/Subscription.js +22 -0
  45. package/build/src/ThorIO.js +142 -0
  46. package/build/src/ThorIOServer.d.ts +64 -0
  47. package/build/src/ThorIOServer.js +131 -0
  48. package/build/src/Transports/BufferMessageTransport.d.ts +78 -0
  49. package/build/src/Transports/BufferMessageTransport.js +85 -0
  50. package/build/src/Transports/PipeMessageTransport.d.ts +79 -0
  51. package/build/src/Transports/PipeMessageTransport.js +90 -0
  52. package/build/src/Transports/WebSocketMessageTransport.d.ts +87 -0
  53. package/build/src/Transports/WebSocketMessageTransport.js +93 -0
  54. package/build/src/Utils/BufferUtils.d.ts +32 -0
  55. package/build/src/Utils/BufferUtils.js +57 -0
  56. package/build/src/Utils/StringUtils.d.ts +15 -0
  57. package/build/src/Utils/StringUtils.js +31 -0
  58. package/build/src/test.js +5 -0
  59. package/docs/.nojekyll +1 -0
  60. package/docs/assets/hierarchy.js +1 -0
  61. package/docs/assets/highlight.css +43 -0
  62. package/docs/assets/icons.js +18 -0
  63. package/docs/assets/icons.svg +1 -0
  64. package/docs/assets/main.js +60 -0
  65. package/docs/assets/navigation.js +1 -0
  66. package/docs/assets/search.js +1 -0
  67. package/docs/assets/style.css +1610 -0
  68. package/docs/classes/BrokerController.html +164 -0
  69. package/docs/classes/BufferMessage.html +11 -0
  70. package/docs/classes/BufferMessageTransport.html +31 -0
  71. package/docs/classes/BufferUtils.html +16 -0
  72. package/docs/classes/ClientInfo.html +11 -0
  73. package/docs/classes/Connection.html +42 -0
  74. package/docs/classes/ControllerBase.html +144 -0
  75. package/docs/classes/ErrorMessage.html +13 -0
  76. package/docs/classes/PeerConnection.html +4 -0
  77. package/docs/classes/PipeMessage.html +17 -0
  78. package/docs/classes/PipeMessageTransport.html +33 -0
  79. package/docs/classes/Plugin.html +13 -0
  80. package/docs/classes/Signal.html +5 -0
  81. package/docs/classes/StringUtils.html +9 -0
  82. package/docs/classes/Subscription.html +11 -0
  83. package/docs/classes/TextMessage.html +37 -0
  84. package/docs/classes/ThorIOServer.html +25 -0
  85. package/docs/classes/WebSocketMessage.html +18 -0
  86. package/docs/classes/WebSocketMessageTransport.html +35 -0
  87. package/docs/functions/CanInvoke.html +5 -0
  88. package/docs/functions/CanSet.html +5 -0
  89. package/docs/functions/ControllerProperties.html +5 -0
  90. package/docs/hierarchy.html +1 -0
  91. package/docs/index.html +24 -0
  92. package/docs/interfaces/ITransport.html +46 -0
  93. package/docs/interfaces/ITransportMessage.html +21 -0
  94. package/docs/modules.html +1 -0
  95. package/index.ts +32 -35
  96. package/licence +21 -21
  97. package/package.json +48 -49
  98. package/readme.md +32 -71
  99. package/src/Connection/ClientInfo.ts +34 -37
  100. package/src/Connection/Connection.ts +229 -278
  101. package/src/Connection/IClientInfo.ts +22 -0
  102. package/src/Controller/ControllerBase.ts +561 -458
  103. package/src/{Subscription.ts → Controller/Subscription.ts} +32 -34
  104. package/src/Controllers/BrokerController/BrokerController.ts +121 -0
  105. package/src/Controllers/BrokerController/Models/PeerConnection.ts +12 -34
  106. package/src/Controllers/BrokerController/Models/Signal.ts +11 -43
  107. package/src/Decorators/CanInvoke.ts +21 -13
  108. package/src/Decorators/CanSet.ts +19 -12
  109. package/src/Decorators/ControllerProperties.ts +19 -16
  110. package/src/Interfaces/ITransport.ts +107 -23
  111. package/src/Interfaces/ITransportMessage.ts +45 -41
  112. package/src/Messages/BufferMessage.ts +70 -69
  113. package/src/Messages/ErrorMessage.ts +34 -6
  114. package/src/Messages/PipeMessage.ts +56 -62
  115. package/src/Messages/TextMessage.ts +139 -93
  116. package/src/Messages/WebSocketMessage.ts +39 -41
  117. package/src/Server/Plugin.ts +56 -0
  118. package/src/Server/ThorIOServer.ts +121 -0
  119. package/src/ThorIOServer.ts +117 -0
  120. package/src/Transports/BufferMessageTransport.ts +109 -100
  121. package/src/Transports/PipeMessageTransport.ts +112 -104
  122. package/src/Transports/WebSocketMessageTransport.ts +122 -110
  123. package/src/Utils/BufferUtils.ts +55 -61
  124. package/src/Utils/StringUtils.ts +28 -17
  125. package/tsconfig.json +109 -18
  126. package/typedoc.json +6 -0
  127. package/index.js +0 -40
  128. package/src/Connection/ClientInfo.d.ts +0 -6
  129. package/src/Connection/Connection.d.ts +0 -24
  130. package/src/Connection/Connection.js +0 -129
  131. package/src/Controller/ControllerBase.d.ts +0 -43
  132. package/src/Controller/ControllerBase.js +0 -331
  133. package/src/Controllers/BrokerController/Broker.d.ts +0 -21
  134. package/src/Controllers/BrokerController/Broker.ts +0 -153
  135. package/src/Controllers/BrokerController/Models/PeerConnection.d.ts +0 -5
  136. package/src/Controllers/BrokerController/Models/PeerConnection.js +0 -9
  137. package/src/Controllers/BrokerController/Models/Signal.js +0 -10
  138. package/src/Decorators/CanInvoke.d.ts +0 -2
  139. package/src/Decorators/CanInvoke.js +0 -9
  140. package/src/Decorators/CanSet.d.ts +0 -1
  141. package/src/Decorators/CanSet.js +0 -8
  142. package/src/Decorators/ControllerProperties.d.ts +0 -1
  143. package/src/Decorators/ControllerProperties.js +0 -10
  144. package/src/Interfaces/IInterceptor.d.ts +0 -2
  145. package/src/Interfaces/IInterceptor.ts +0 -2
  146. package/src/Interfaces/ITransport.d.ts +0 -18
  147. package/src/Interfaces/ITransportMessage.d.ts +0 -8
  148. package/src/Messages/BufferMessage.d.ts +0 -10
  149. package/src/Messages/ErrorMessage.d.ts +0 -4
  150. package/src/Messages/ErrorMessage.js +0 -8
  151. package/src/Messages/PipeMessage.d.ts +0 -12
  152. package/src/Messages/PipeMessage.js +0 -20
  153. package/src/Messages/TextMessage.d.ts +0 -15
  154. package/src/Messages/TextMessage.js +0 -50
  155. package/src/Messages/WebSocketMessage.d.ts +0 -10
  156. package/src/Messages/WebSocketMessage.js +0 -15
  157. package/src/Plugin.d.ts +0 -6
  158. package/src/Plugin.js +0 -11
  159. package/src/Plugin.ts +0 -37
  160. package/src/Subscription.d.ts +0 -5
  161. package/src/Subscription.js +0 -9
  162. package/src/ThorIO.d.ts +0 -19
  163. package/src/ThorIO.js +0 -67
  164. package/src/ThorIO.ts +0 -153
  165. package/src/Transports/BufferMessageTransport.d.ts +0 -21
  166. package/src/Transports/BufferMessageTransport.js +0 -31
  167. package/src/Transports/PipeMessageTransport.d.ts +0 -20
  168. package/src/Transports/PipeMessageTransport.js +0 -33
  169. package/src/Transports/WebSocketMessageTransport.d.ts +0 -20
  170. package/src/Transports/WebSocketMessageTransport.js +0 -31
  171. package/src/Utils/BufferUtils.d.ts +0 -5
  172. package/src/Utils/BufferUtils.js +0 -29
  173. package/src/Utils/StringUtils.d.ts +0 -4
  174. package/src/Utils/StringUtils.js +0 -13
  175. /package/{src/Interfaces/IInterceptor.js → build/src/Connection/IClientInfo.js} +0 -0
  176. /package/{src → build/src}/Controllers/BrokerController/Models/Signal.d.ts +0 -0
  177. /package/{src → build/src}/Interfaces/ITransport.js +0 -0
  178. /package/{src → build/src}/Interfaces/ITransportMessage.js +0 -0
@@ -1,110 +1,122 @@
1
- import { ITransport } from '../Interfaces/ITransport';
2
- import { ITransportMessage } from '../Interfaces/ITransportMessage';
3
- import { WebSocketMessage } from '../Messages/WebSocketMessage';
4
- import { StringUtils } from '../Utils/StringUtils';
5
- import { IInterceptor } from '../Interfaces/IInterceptor';
6
- import { IncomingMessage } from 'http';
7
-
8
- /**
9
- *
10
- *
11
- * @export
12
- * @class WebSocketMessageTransport
13
- * @implements {ITransport}
14
- */
15
- export class WebSocketMessageTransport implements ITransport {
16
-
17
- request: IncomingMessage | Request;
18
-
19
- /**
20
- *
21
- *
22
- * @type {WebSocket}
23
- * @memberOf WebSocketMessageTransport
24
- */
25
- socket: WebSocket;
26
- /**
27
- *
28
- *
29
- *
30
- * @memberOf WebSocketMessageTransport
31
- */
32
- onMessage: (message: ITransportMessage) => void;
33
- ;
34
- /**
35
- *
36
- *
37
- * @type {string}
38
- * @memberOf WebSocketMessageTransport
39
- */
40
- id: string;
41
- /**
42
- *
43
- *
44
- * @param {*} data
45
- *
46
- * @memberOf WebSocketMessageTransport
47
- */
48
- send(data: any) {
49
- this.socket.send(data);
50
- }
51
- /**
52
- *
53
- *
54
- * @param {number} reason
55
- * @param {string} message
56
- *
57
- * @memberOf WebSocketMessageTransport
58
- */
59
- close(reason: number, message: string) {
60
- this.socket.close(reason, message);
61
- }
62
- /**
63
- *
64
- *
65
- * @param {string} name
66
- * @param {*} fn
67
- *
68
- * @memberOf WebSocketMessageTransport
69
- */
70
- addEventListener(name: string, fn: any) {
71
- this.socket.addEventListener(name, fn);
72
- }
73
- /**
74
- * Creates an instance of WebSocketMessageTransport.
75
- *
76
- * @param {*} socket
77
- *
78
- * @memberOf WebSocketMessageTransport
79
- */
80
- constructor(socket: any,req:IncomingMessage) {
81
- this.id = StringUtils.newGuid();
82
- this.request = req;
83
- this.socket = socket;
84
- this.socket.addEventListener("message", (event: any) => {
85
- this.onMessage(new WebSocketMessage(event.data, typeof(event.data) != "string" ));
86
- });
87
- }
88
- interceptors: Map<string, IInterceptor>;
89
- onClose: (ev:any) => void;
90
- onOpen: (ev:any) => void;
91
- /**
92
- *
93
- *
94
- * @readonly
95
- *
96
- * @memberOf WebSocketMessageTransport
97
- */
98
- get readyState() {
99
- return this.socket.readyState;
100
- }
101
- /**
102
- *
103
- *
104
- *
105
- * @memberOf WebSocketMessageTransport
106
- */
107
- ping() {
108
- this.socket["ping"]();
109
- }
110
- }
1
+ import { IncomingMessage } from 'http';
2
+
3
+ import { ITransport } from '../Interfaces/ITransport';
4
+ import { ITransportMessage } from '../Interfaces/ITransportMessage';
5
+ import { WebSocketMessage } from '../Messages/WebSocketMessage';
6
+ import { StringUtils } from '../Utils/StringUtils';
7
+
8
+ /**
9
+ * A transport class for handling WebSocket communication and converting messages
10
+ * to/from the `WebSocketMessage` format.
11
+ *
12
+ * @export
13
+ * @class WebSocketMessageTransport
14
+ * @implements {ITransport}
15
+ */
16
+ export class WebSocketMessageTransport implements ITransport {
17
+ /**
18
+ * The HTTP request associated with the WebSocket connection.
19
+ *
20
+ * @type {IncomingMessage | Request}
21
+ */
22
+ request: IncomingMessage | Request;
23
+
24
+ /**
25
+ * The WebSocket instance used for communication.
26
+ *
27
+ * @type {WebSocket}
28
+ */
29
+ socket: WebSocket;
30
+
31
+ /**
32
+ * Callback for handling incoming messages. Defaults to creating a `WebSocketMessage`.
33
+ *
34
+ * @type {(message: ITransportMessage) => void}
35
+ */
36
+ onMessage: (message: ITransportMessage) => void = (message) => {
37
+ // Default implementation
38
+ };
39
+
40
+ /**
41
+ * Sends data through the WebSocket connection.
42
+ *
43
+ * @param {any} data - The data to be sent.
44
+ */
45
+ send(data: any) {
46
+ this.socket.send(data);
47
+ }
48
+
49
+ /**
50
+ * Closes the WebSocket connection.
51
+ *
52
+ * @param {number} reason - The reason code for closing the connection.
53
+ * @param {string} message - Optional message providing details about the closure.
54
+ */
55
+ close(reason: number, message: string) {
56
+ this.socket.close(reason, message);
57
+ }
58
+
59
+ /**
60
+ * Adds an event listener to the WebSocket instance.
61
+ *
62
+ * @param {string} name - The event name.
63
+ * @param {Function} fn - The callback function to execute when the event occurs.
64
+ */
65
+ addEventListener(name: string, fn: any) {
66
+ this.socket.addEventListener(name, fn);
67
+ }
68
+
69
+ /**
70
+ * Creates an instance of `WebSocketMessageTransport`.
71
+ *
72
+ * @param {WebSocket} socket - The WebSocket object to use for communication.
73
+ * @param {IncomingMessage} req - The initial HTTP request associated with the connection.
74
+ */
75
+ constructor(socket: WebSocket, req: IncomingMessage) {
76
+ this.id = StringUtils.newGuid();
77
+ this.request = req;
78
+ this.socket = socket;
79
+ this.socket.addEventListener("message", (event: MessageEvent) => {
80
+ this.onMessage(new WebSocketMessage(event.data, typeof event.data !== "string"));
81
+ });
82
+ }
83
+
84
+ /**
85
+ * Unique identifier for this transport instance.
86
+ *
87
+ * @type {string}
88
+ */
89
+ id: string;
90
+
91
+ /**
92
+ * Callback for handling the WebSocket `close` event.
93
+ *
94
+ * @type {(ev: CloseEvent) => void}
95
+ */
96
+ onClose: (ev: CloseEvent) => void = (ev: CloseEvent) => { };
97
+
98
+ /**
99
+ * Callback for handling the WebSocket `open` event.
100
+ *
101
+ * @type {(ev: Event) => void}
102
+ */
103
+ onOpen: (ev: Event) => void = (ev: Event) => { };
104
+
105
+ /**
106
+ * The current ready state of the WebSocket connection.
107
+ *
108
+ * @readonly
109
+ * @type {number}
110
+ */
111
+ get readyState() {
112
+ return this.socket.readyState;
113
+ }
114
+
115
+ /**
116
+ * Sends a ping message to maintain the connection or test latency.
117
+ */
118
+ ping() {
119
+ // Assumes the WebSocket implementation supports ping.
120
+ (this.socket as any).ping?.();
121
+ }
122
+ }
@@ -1,61 +1,55 @@
1
- /**
2
- *
3
- *
4
- * @export
5
- * @class Utils
6
- */
7
- export class BufferUtils {
8
- /**
9
- *
10
- *
11
- * @static
12
- * @param {string} str
13
- * @returns {Uint8Array}
14
- *
15
- * @memberOf Utils
16
- */
17
- static stingToBuffer(str: string): Uint8Array {
18
- let len = str.length;
19
- let arr = new Array(len);
20
- for (let i = 0; i < len; i++) {
21
- arr[i] = str.charCodeAt(i) & 0xFF;
22
- }
23
- return new Uint8Array(arr);
24
- }
25
- /**
26
- *
27
- *
28
- * @static
29
- * @param {Uint8Array} byteArray
30
- * @returns {number}
31
- *
32
- * @memberOf Utils
33
- */
34
- static arrayToLong(byteArray: Uint8Array): number {
35
- var value = 0;
36
- for (var i = byteArray.byteLength - 1; i >= 0; i--) {
37
- value = (value * 256) + byteArray[i];
38
- }
39
- return value;
40
- }
41
- /**
42
- *
43
- *
44
- * @static
45
- * @param {number} long
46
- * @returns {Array<number>}
47
- *
48
- * @memberOf Utils
49
- */
50
- static longToArray(long: number): Array<number> {
51
- var byteArray = [0, 0, 0, 0, 0, 0, 0, 0];
52
- for (var index = 0; index < byteArray.length; index++) {
53
- var byte = long & 0xff;
54
- byteArray[index] = byte;
55
- long = (long - byte) / 256;
56
- }
57
- return byteArray;
58
- }
59
- }
60
-
61
-
1
+ /**
2
+ * Utility class for buffer and binary operations.
3
+ *
4
+ * @export
5
+ * @class BufferUtils
6
+ */
7
+ export class BufferUtils {
8
+ /**
9
+ * Converts a string into a `Uint8Array` buffer.
10
+ *
11
+ * @static
12
+ * @param {string} str - The input string to convert.
13
+ * @returns {Uint8Array} The resulting buffer as a `Uint8Array`.
14
+ */
15
+ static stringToBuffer(str: string): Uint8Array {
16
+ let len = str.length;
17
+ let arr = new Array(len);
18
+ for (let i = 0; i < len; i++) {
19
+ arr[i] = str.charCodeAt(i) & 0xFF;
20
+ }
21
+ return new Uint8Array(arr);
22
+ }
23
+
24
+ /**
25
+ * Converts a `Uint8Array` to a long integer.
26
+ *
27
+ * @static
28
+ * @param {Uint8Array} byteArray - The input byte array.
29
+ * @returns {number} The resulting long integer.
30
+ */
31
+ static arrayToLong(byteArray: Uint8Array): number {
32
+ let value = 0;
33
+ for (let i = byteArray.byteLength - 1; i >= 0; i--) {
34
+ value = (value * 256) + byteArray[i];
35
+ }
36
+ return value;
37
+ }
38
+
39
+ /**
40
+ * Converts a long integer to an array of bytes.
41
+ *
42
+ * @static
43
+ * @param {number} long - The long integer to convert.
44
+ * @returns {Array<number>} The resulting array of bytes.
45
+ */
46
+ static longToArray(long: number): Array<number> {
47
+ const byteArray = [0, 0, 0, 0, 0, 0, 0, 0];
48
+ for (let index = 0; index < byteArray.length; index++) {
49
+ const byte = long & 0xff;
50
+ byteArray[index] = byte;
51
+ long = (long - byte) / 256;
52
+ }
53
+ return byteArray;
54
+ }
55
+ }
@@ -1,17 +1,28 @@
1
- export class StringUtils {
2
- /**
3
- * Generate a GUID/UUID like string
4
- *
5
- * @returns
6
- * @memberof StringUtils
7
- */
8
- static newGuid() {
9
- const s4 = () => {
10
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
11
- };
12
- return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
13
- }
14
- static getParamsFromString(query:string){
15
-
16
- }
17
- }
1
+ export class StringUtils {
2
+ /**
3
+ * Generates a GUID/UUID-like string.
4
+ *
5
+ * @returns {string} A GUID/UUID-like string.
6
+ */
7
+ static newGuid(): string {
8
+ const s4 = () => {
9
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
10
+ };
11
+ return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
12
+ }
13
+
14
+ /**
15
+ * Extracts key-value parameters from a query string.
16
+ *
17
+ * @param {string} query - The query string to parse.
18
+ * @returns {Record<string, string>} An object containing the parsed key-value pairs.
19
+ */
20
+ static getParamsFromString(query: string): Record<string, string> {
21
+ const params: Record<string, string> = {};
22
+ query.replace(/^\?/, '').split('&').forEach(param => {
23
+ const [key, value] = param.split('=');
24
+ params[decodeURIComponent(key)] = decodeURIComponent(value || '');
25
+ });
26
+ return params;
27
+ }
28
+ }
package/tsconfig.json CHANGED
@@ -1,18 +1,109 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es6",
4
- "module": "commonjs",
5
- "moduleResolution": "node",
6
- "sourceMap": false,
7
- "emitDecoratorMetadata": true,
8
- "experimentalDecorators": true,
9
- "removeComments": true,
10
- "noImplicitAny": false,
11
- "declaration": true,
12
- "esModuleInterop": true,
13
- "lib": ["es6", "dom"]
14
- },
15
- "exclude": [
16
- "node_modules"
17
- ]
18
- }
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "ES2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ "lib": ["dom"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
+
27
+ /* Modules */
28
+ "module": "commonjs", /* Specify what module code is generated. */
29
+ // "rootDir": "./", /* Specify the root folder within your source files. */
30
+ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42
+ // "resolveJsonModule": true, /* Enable importing .json files. */
43
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
+
46
+ /* JavaScript Support */
47
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
+
51
+ /* Emit */
52
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58
+ "outDir": "./build", /* Specify an output folder for all emitted files. */
59
+ // "removeComments": true, /* Disable emitting comments. */
60
+ // "noEmit": true, /* Disable emitting files from a compilation. */
61
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
63
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
64
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
65
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
66
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
67
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
68
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
69
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
70
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
71
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
72
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
73
+
74
+ /* Interop Constraints */
75
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
76
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
77
+ // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
78
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
79
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
80
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
81
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
82
+
83
+ /* Type Checking */
84
+ "strict": true, /* Enable all strict type-checking options. */
85
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
86
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
87
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
88
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
89
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
90
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
91
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
92
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
93
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
94
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
95
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
96
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
97
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
98
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
99
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
100
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
101
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
102
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
103
+
104
+ /* Completeness */
105
+ "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
106
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
107
+
108
+ }
109
+ }
package/typedoc.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "entryPoints": ["index.ts"], // Your main TypeScript file
3
+ "out": "docs", // Output directory for the documentation
4
+ "readme": "README.md", // Include your README file
5
+ "theme": "default" // Generate Markdown output
6
+ }
package/index.js DELETED
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var ThorIO_1 = require("./src/ThorIO");
4
- exports.ThorIO = ThorIO_1.ThorIO;
5
- var Connection_1 = require("./src/Connection/Connection");
6
- exports.Connection = Connection_1.Connection;
7
- var ControllerBase_1 = require("./src/Controller/ControllerBase");
8
- exports.ControllerBase = ControllerBase_1.ControllerBase;
9
- var Subscription_1 = require("./src/Subscription");
10
- exports.Subscription = Subscription_1.Subscription;
11
- var BufferUtils_1 = require("./src/Utils/BufferUtils");
12
- exports.BufferUtils = BufferUtils_1.BufferUtils;
13
- var Plugin_1 = require("./src/Plugin");
14
- exports.Plugin = Plugin_1.Plugin;
15
- var TextMessage_1 = require("./src/Messages/TextMessage");
16
- exports.TextMessage = TextMessage_1.TextMessage;
17
- var PipeMessage_1 = require("./src/Messages/PipeMessage");
18
- exports.PipeMessage = PipeMessage_1.PipeMessage;
19
- var WebSocketMessage_1 = require("./src/Messages/WebSocketMessage");
20
- exports.WebSocketMessage = WebSocketMessage_1.WebSocketMessage;
21
- var BufferMessage_1 = require("./src/Messages/BufferMessage");
22
- exports.BufferMessage = BufferMessage_1.BufferMessage;
23
- var PipeMessageTransport_1 = require("./src/Transports/PipeMessageTransport");
24
- exports.PipeMessageTransport = PipeMessageTransport_1.PipeMessageTransport;
25
- var WebSocketMessageTransport_1 = require("./src/Transports/WebSocketMessageTransport");
26
- exports.WebSocketMessageTransport = WebSocketMessageTransport_1.WebSocketMessageTransport;
27
- var BufferMessageTransport_1 = require("./src/Transports/BufferMessageTransport");
28
- exports.BufferMessageTransport = BufferMessageTransport_1.BufferMessageTransport;
29
- var CanSet_1 = require("./src/Decorators/CanSet");
30
- exports.CanSet = CanSet_1.CanSet;
31
- var CanInvoke_1 = require("./src/Decorators/CanInvoke");
32
- exports.CanInvoke = CanInvoke_1.CanInvoke;
33
- var ControllerProperties_1 = require("./src/Decorators/ControllerProperties");
34
- exports.ControllerProperties = ControllerProperties_1.ControllerProperties;
35
- var Broker_1 = require("./src/Controllers/BrokerController/Broker");
36
- exports.BrokerController = Broker_1.BrokerController;
37
- var Signal_1 = require("./src/Controllers/BrokerController/Models/Signal");
38
- exports.Signal = Signal_1.Signal;
39
- var PeerConnection_1 = require("./src/Controllers/BrokerController/Models/PeerConnection");
40
- exports.PeerConnection = PeerConnection_1.PeerConnection;
@@ -1,6 +0,0 @@
1
- export declare class ClientInfo {
2
- CI: string;
3
- C: string;
4
- TS: Date;
5
- constructor(ci: string, controller: string);
6
- }
@@ -1,24 +0,0 @@
1
- import { Plugin } from "../Plugin";
2
- import { ITransport } from "../Interfaces/ITransport";
3
- import { ControllerBase } from "../Controller/ControllerBase";
4
- import { ClientInfo } from "./ClientInfo";
5
- export declare class Connection {
6
- transport: ITransport;
7
- connections: Map<string, Connection>;
8
- private controllers;
9
- errors: Array<any>;
10
- pingPongInterval: number;
11
- controllerInstances: Map<string, ControllerBase>;
12
- clientInfo: ClientInfo;
13
- private methodInvoker;
14
- get id(): string;
15
- constructor(transport: ITransport, connections: Map<string, Connection>, controllers: Array<Plugin<ControllerBase>>);
16
- private addError;
17
- hasController(alias: string): boolean;
18
- removeController(alias: string): boolean;
19
- getController(alias: string): ControllerBase;
20
- private addControllerInstance;
21
- private registerSealdController;
22
- resolveController(alias: string): Plugin<ControllerBase>;
23
- locateController(alias: string): ControllerBase;
24
- }