@litert/televoke 0.4.6 → 1.0.0-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/CHANGES.md +6 -0
- package/README.md +13 -8
- package/lib/client/Client.decl.d.ts +47 -0
- package/lib/client/Client.decl.d.ts.map +1 -0
- package/lib/client/Client.decl.js +18 -0
- package/lib/client/Client.decl.js.map +1 -0
- package/lib/client/JsonApiClient.impl.d.ts +28 -0
- package/lib/client/JsonApiClient.impl.d.ts.map +1 -0
- package/lib/client/JsonApiClient.impl.js +169 -0
- package/lib/client/JsonApiClient.impl.js.map +1 -0
- package/lib/client/LegacyHttpClient.impl.d.ts +62 -0
- package/lib/client/LegacyHttpClient.impl.d.ts.map +1 -0
- package/lib/client/LegacyHttpClient.impl.js +163 -0
- package/lib/client/LegacyHttpClient.impl.js.map +1 -0
- package/lib/client/index.d.ts +19 -0
- package/lib/client/index.d.ts.map +1 -0
- package/lib/client/index.js +35 -0
- package/lib/client/index.js.map +1 -0
- package/lib/index.d.ts +18 -20
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -20
- package/lib/index.js.map +1 -1
- package/lib/server/LegacyServerChannel.impl.d.ts +38 -0
- package/lib/server/LegacyServerChannel.impl.d.ts.map +1 -0
- package/lib/server/LegacyServerChannel.impl.js +51 -0
- package/lib/server/LegacyServerChannel.impl.js.map +1 -0
- package/lib/server/Server.decl.d.ts +81 -0
- package/lib/server/Server.decl.d.ts.map +1 -0
- package/lib/server/Server.decl.js +18 -0
- package/lib/server/Server.decl.js.map +1 -0
- package/lib/server/Server.impl.d.ts +33 -0
- package/lib/server/Server.impl.d.ts.map +1 -0
- package/lib/server/Server.impl.js +58 -0
- package/lib/server/Server.impl.js.map +1 -0
- package/lib/server/ServerChannel.d.ts +20 -0
- package/lib/server/ServerChannel.d.ts.map +1 -0
- package/lib/server/ServerChannel.js +23 -0
- package/lib/server/ServerChannel.js.map +1 -0
- package/lib/server/SimpleJsonApiRouter.d.ts +28 -0
- package/lib/server/SimpleJsonApiRouter.d.ts.map +1 -0
- package/lib/server/SimpleJsonApiRouter.js +92 -0
- package/lib/server/SimpleJsonApiRouter.js.map +1 -0
- package/lib/server/index.d.ts +19 -0
- package/lib/server/index.d.ts.map +1 -0
- package/lib/server/index.js +35 -0
- package/lib/server/index.js.map +1 -0
- package/lib/shared/BinaryStream.d.ts +32 -0
- package/lib/shared/BinaryStream.d.ts.map +1 -0
- package/lib/shared/BinaryStream.js +93 -0
- package/lib/shared/BinaryStream.js.map +1 -0
- package/lib/shared/BinaryStreamManager.d.ts +52 -0
- package/lib/shared/BinaryStreamManager.d.ts.map +1 -0
- package/lib/shared/BinaryStreamManager.js +105 -0
- package/lib/shared/BinaryStreamManager.js.map +1 -0
- package/lib/shared/Channel.impl.d.ts +79 -0
- package/lib/shared/Channel.impl.d.ts.map +1 -0
- package/lib/shared/Channel.impl.js +433 -0
- package/lib/shared/Channel.impl.js.map +1 -0
- package/lib/shared/Constants.d.ts +32 -0
- package/lib/shared/Constants.d.ts.map +1 -0
- package/lib/shared/Constants.js +35 -0
- package/lib/shared/Constants.js.map +1 -0
- package/lib/shared/Encodings/index.d.ts +18 -0
- package/lib/shared/Encodings/index.d.ts.map +1 -0
- package/lib/shared/Encodings/index.js +21 -0
- package/lib/shared/Encodings/index.js.map +1 -0
- package/lib/shared/Encodings/v1/EncoderV1.d.ts +22 -0
- package/lib/shared/Encodings/v1/EncoderV1.d.ts.map +1 -0
- package/lib/shared/Encodings/v1/EncoderV1.js +47 -0
- package/lib/shared/Encodings/v1/EncoderV1.js.map +1 -0
- package/lib/shared/Encodings/v1/Protocol.v1.decls.d.ts +78 -0
- package/lib/shared/Encodings/v1/Protocol.v1.decls.d.ts.map +1 -0
- package/lib/shared/Encodings/v1/Protocol.v1.decls.js +53 -0
- package/lib/shared/Encodings/v1/Protocol.v1.decls.js.map +1 -0
- package/lib/shared/Encodings/v1/index.d.ts +18 -0
- package/lib/shared/Encodings/v1/index.d.ts.map +1 -0
- package/lib/shared/Encodings/v1/index.js +34 -0
- package/lib/shared/Encodings/v1/index.js.map +1 -0
- package/lib/shared/Encodings/v2/Constants.v2.d.ts +29 -0
- package/lib/shared/Encodings/v2/Constants.v2.d.ts.map +1 -0
- package/lib/shared/Encodings/v2/Constants.v2.js +34 -0
- package/lib/shared/Encodings/v2/Constants.v2.js.map +1 -0
- package/lib/shared/Encodings/v2/DecoderV2.d.ts +27 -0
- package/lib/shared/Encodings/v2/DecoderV2.d.ts.map +1 -0
- package/lib/shared/Encodings/v2/DecoderV2.js +279 -0
- package/lib/shared/Encodings/v2/DecoderV2.js.map +1 -0
- package/lib/shared/Encodings/v2/EncoderV2.d.ts +21 -0
- package/lib/shared/Encodings/v2/EncoderV2.d.ts.map +1 -0
- package/lib/shared/Encodings/v2/EncoderV2.js +176 -0
- package/lib/shared/Encodings/v2/EncoderV2.js.map +1 -0
- package/lib/shared/Encodings/v2/Encoding.v2.decl.d.ts +95 -0
- package/lib/shared/Encodings/v2/Encoding.v2.decl.d.ts.map +1 -0
- package/lib/shared/Encodings/v2/Encoding.v2.decl.js +18 -0
- package/lib/shared/Encodings/v2/Encoding.v2.decl.js.map +1 -0
- package/lib/shared/Encodings/v2/index.d.ts +20 -0
- package/lib/shared/Encodings/v2/index.d.ts.map +1 -0
- package/lib/shared/Encodings/v2/index.js +35 -0
- package/lib/shared/Encodings/v2/index.js.map +1 -0
- package/lib/shared/Errors.d.ts +60 -0
- package/lib/shared/Errors.d.ts.map +1 -0
- package/lib/shared/Errors.js +75 -0
- package/lib/shared/Errors.js.map +1 -0
- package/lib/shared/Shared.decl.d.ts +296 -0
- package/lib/shared/Shared.decl.d.ts.map +1 -0
- package/lib/shared/Shared.decl.js +18 -0
- package/lib/shared/Shared.decl.js.map +1 -0
- package/lib/shared/Utils.d.ts +25 -0
- package/lib/shared/Utils.d.ts.map +1 -0
- package/lib/shared/Utils.js +46 -0
- package/lib/shared/Utils.js.map +1 -0
- package/lib/shared/index.d.ts +23 -0
- package/lib/shared/index.d.ts.map +1 -0
- package/lib/shared/index.js +39 -0
- package/lib/shared/index.js.map +1 -0
- package/lib/transporters/Transporter.decl.d.ts +90 -0
- package/lib/transporters/Transporter.decl.d.ts.map +1 -0
- package/lib/transporters/Transporter.decl.js +18 -0
- package/lib/transporters/Transporter.decl.js.map +1 -0
- package/lib/transporters/http-listener/AbstractHttpListener.d.ts +32 -0
- package/lib/transporters/http-listener/AbstractHttpListener.d.ts.map +1 -0
- package/lib/transporters/http-listener/AbstractHttpListener.js +46 -0
- package/lib/transporters/http-listener/AbstractHttpListener.js.map +1 -0
- package/lib/transporters/http-listener/Http.Decl.d.ts +95 -0
- package/lib/transporters/http-listener/Http.Decl.d.ts.map +1 -0
- package/lib/transporters/http-listener/Http.Decl.js +52 -0
- package/lib/transporters/http-listener/Http.Decl.js.map +1 -0
- package/lib/transporters/http-listener/HttpListener.d.ts +18 -0
- package/lib/transporters/http-listener/HttpListener.d.ts.map +1 -0
- package/lib/transporters/http-listener/HttpListener.js +73 -0
- package/lib/transporters/http-listener/HttpListener.js.map +1 -0
- package/lib/transporters/http-listener/HttpUnixSocketListener.d.ts +18 -0
- package/lib/transporters/http-listener/HttpUnixSocketListener.d.ts.map +1 -0
- package/lib/transporters/http-listener/HttpUnixSocketListener.js +72 -0
- package/lib/transporters/http-listener/HttpUnixSocketListener.js.map +1 -0
- package/lib/transporters/http-listener/HttpsListener.d.ts +18 -0
- package/lib/transporters/http-listener/HttpsListener.d.ts.map +1 -0
- package/lib/transporters/http-listener/HttpsListener.js +73 -0
- package/lib/transporters/http-listener/HttpsListener.js.map +1 -0
- package/lib/transporters/http-listener/index.d.ts +20 -0
- package/lib/transporters/http-listener/index.d.ts.map +1 -0
- package/lib/transporters/http-listener/index.js +36 -0
- package/lib/transporters/http-listener/index.js.map +1 -0
- package/lib/transporters/index.d.ts +17 -0
- package/lib/transporters/index.d.ts.map +1 -0
- package/lib/transporters/index.js +18 -0
- package/lib/transporters/index.js.map +1 -0
- package/lib/transporters/legacy-http/LegacyHttp.Server.d.ts +24 -0
- package/lib/transporters/legacy-http/LegacyHttp.Server.d.ts.map +1 -0
- package/lib/transporters/legacy-http/LegacyHttp.Server.js +167 -0
- package/lib/transporters/legacy-http/LegacyHttp.Server.js.map +1 -0
- package/lib/transporters/legacy-http/LegacyHttp.Transporter.d.ts +28 -0
- package/lib/transporters/legacy-http/LegacyHttp.Transporter.d.ts.map +1 -0
- package/lib/transporters/legacy-http/LegacyHttp.Transporter.js +55 -0
- package/lib/transporters/legacy-http/LegacyHttp.Transporter.js.map +1 -0
- package/lib/transporters/legacy-http/index.d.ts +18 -0
- package/lib/transporters/legacy-http/index.d.ts.map +1 -0
- package/lib/transporters/legacy-http/index.js +34 -0
- package/lib/transporters/legacy-http/index.js.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Tcp.Client.d.ts +19 -0
- package/lib/transporters/lwdfx/LwDFX.Tcp.Client.d.ts.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Tcp.Client.js +33 -0
- package/lib/transporters/lwdfx/LwDFX.Tcp.Client.js.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Tcp.Server.d.ts +21 -0
- package/lib/transporters/lwdfx/LwDFX.Tcp.Server.d.ts.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Tcp.Server.js +64 -0
- package/lib/transporters/lwdfx/LwDFX.Tcp.Server.js.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Tls.Client.d.ts +19 -0
- package/lib/transporters/lwdfx/LwDFX.Tls.Client.d.ts.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Tls.Client.js +33 -0
- package/lib/transporters/lwdfx/LwDFX.Tls.Client.js.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Tls.Server.d.ts +21 -0
- package/lib/transporters/lwdfx/LwDFX.Tls.Server.d.ts.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Tls.Server.js +64 -0
- package/lib/transporters/lwdfx/LwDFX.Tls.Server.js.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Transporter.d.ts +34 -0
- package/lib/transporters/lwdfx/LwDFX.Transporter.d.ts.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.Transporter.js +78 -0
- package/lib/transporters/lwdfx/LwDFX.Transporter.js.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.d.ts +19 -0
- package/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.d.ts.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.js +33 -0
- package/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.js.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.d.ts +21 -0
- package/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.d.ts.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.js +64 -0
- package/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.js.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.decl.d.ts +18 -0
- package/lib/transporters/lwdfx/LwDFX.decl.d.ts.map +1 -0
- package/lib/transporters/lwdfx/LwDFX.decl.js +18 -0
- package/lib/transporters/lwdfx/LwDFX.decl.js.map +1 -0
- package/lib/transporters/lwdfx/index.d.ts +23 -0
- package/lib/transporters/lwdfx/index.d.ts.map +1 -0
- package/lib/transporters/lwdfx/index.js +39 -0
- package/lib/transporters/lwdfx/index.js.map +1 -0
- package/lib/transporters/memory/Memory.Impl.d.ts +43 -0
- package/lib/transporters/memory/Memory.Impl.d.ts.map +1 -0
- package/lib/transporters/memory/Memory.Impl.js +227 -0
- package/lib/transporters/memory/Memory.Impl.js.map +1 -0
- package/lib/transporters/memory/index.d.ts +17 -0
- package/lib/transporters/memory/index.d.ts.map +1 -0
- package/lib/transporters/memory/index.js +33 -0
- package/lib/transporters/memory/index.js.map +1 -0
- package/lib/transporters/websocket/WebSocket.Client.d.ts +20 -0
- package/lib/transporters/websocket/WebSocket.Client.d.ts.map +1 -0
- package/lib/transporters/websocket/WebSocket.Client.js +68 -0
- package/lib/transporters/websocket/WebSocket.Client.js.map +1 -0
- package/lib/transporters/websocket/WebSocket.Server.d.ts +25 -0
- package/lib/transporters/websocket/WebSocket.Server.d.ts.map +1 -0
- package/lib/transporters/websocket/WebSocket.Server.js +87 -0
- package/lib/transporters/websocket/WebSocket.Server.js.map +1 -0
- package/lib/transporters/websocket/WebSocket.Transporter.d.ts +34 -0
- package/lib/transporters/websocket/WebSocket.Transporter.d.ts.map +1 -0
- package/lib/transporters/websocket/WebSocket.Transporter.js +106 -0
- package/lib/transporters/websocket/WebSocket.Transporter.js.map +1 -0
- package/lib/transporters/websocket/WebSocket.decl.d.ts +19 -0
- package/lib/transporters/websocket/WebSocket.decl.d.ts.map +1 -0
- package/lib/transporters/websocket/WebSocket.decl.js +22 -0
- package/lib/transporters/websocket/WebSocket.decl.js.map +1 -0
- package/lib/transporters/websocket/index.d.ts +19 -0
- package/lib/transporters/websocket/index.d.ts.map +1 -0
- package/lib/transporters/websocket/index.js +35 -0
- package/lib/transporters/websocket/index.js.map +1 -0
- package/package.json +12 -12
- package/src/lib/client/Client.decl.ts +61 -0
- package/src/lib/client/JsonApiClient.impl.ts +258 -0
- package/src/lib/client/LegacyHttpClient.impl.ts +278 -0
- package/src/lib/client/index.ts +19 -0
- package/src/lib/index.ts +18 -20
- package/src/lib/server/LegacyServerChannel.impl.ts +71 -0
- package/src/lib/server/Server.decl.ts +109 -0
- package/src/lib/server/Server.impl.ts +90 -0
- package/src/lib/server/ServerChannel.ts +20 -0
- package/src/lib/server/SimpleJsonApiRouter.ts +135 -0
- package/src/lib/server/index.ts +19 -0
- package/src/lib/shared/BinaryStream.ts +131 -0
- package/src/lib/shared/BinaryStreamManager.ts +142 -0
- package/src/lib/shared/Channel.impl.ts +641 -0
- package/src/lib/shared/Constants.ts +35 -0
- package/src/lib/shared/Encodings/index.ts +18 -0
- package/src/lib/shared/Encodings/v1/EncoderV1.ts +66 -0
- package/src/lib/shared/Encodings/v1/Protocol.v1.decls.ts +96 -0
- package/src/lib/shared/Encodings/v1/index.ts +18 -0
- package/src/lib/shared/Encodings/v2/Constants.v2.ts +31 -0
- package/src/lib/shared/Encodings/v2/DecoderV2.ts +404 -0
- package/src/lib/shared/Encodings/v2/EncoderV2.ts +283 -0
- package/src/lib/shared/Encodings/v2/Encoding.v2.decl.ts +133 -0
- package/src/lib/shared/Encodings/v2/index.ts +20 -0
- package/src/lib/shared/Errors.ts +94 -0
- package/src/lib/shared/Shared.decl.ts +347 -0
- package/src/lib/shared/Utils.ts +51 -0
- package/src/lib/shared/index.ts +23 -0
- package/src/lib/transporters/Transporter.decl.ts +117 -0
- package/src/lib/transporters/http-listener/AbstractHttpListener.ts +57 -0
- package/src/lib/transporters/http-listener/Http.Decl.ts +141 -0
- package/src/lib/transporters/http-listener/HttpListener.ts +102 -0
- package/src/lib/transporters/http-listener/HttpUnixSocketListener.ts +97 -0
- package/src/lib/transporters/http-listener/HttpsListener.ts +102 -0
- package/src/lib/transporters/http-listener/index.ts +20 -0
- package/src/lib/transporters/index.ts +17 -0
- package/src/lib/transporters/legacy-http/LegacyHttp.Server.ts +262 -0
- package/src/lib/transporters/legacy-http/LegacyHttp.Transporter.ts +66 -0
- package/src/lib/transporters/legacy-http/index.ts +18 -0
- package/src/lib/transporters/lwdfx/LwDFX.Tcp.Client.ts +34 -0
- package/src/lib/transporters/lwdfx/LwDFX.Tcp.Server.ts +94 -0
- package/src/lib/transporters/lwdfx/LwDFX.Tls.Client.ts +34 -0
- package/src/lib/transporters/lwdfx/LwDFX.Tls.Server.ts +94 -0
- package/src/lib/transporters/lwdfx/LwDFX.Transporter.ts +100 -0
- package/src/lib/transporters/lwdfx/LwDFX.UnixSocket.Client.ts +34 -0
- package/src/lib/transporters/lwdfx/LwDFX.UnixSocket.Server.ts +94 -0
- package/src/lib/transporters/lwdfx/LwDFX.decl.ts +19 -0
- package/src/lib/transporters/lwdfx/index.ts +23 -0
- package/src/lib/transporters/memory/Memory.Impl.ts +363 -0
- package/src/lib/transporters/memory/index.ts +17 -0
- package/src/lib/transporters/websocket/WebSocket.Client.ts +76 -0
- package/src/lib/transporters/websocket/WebSocket.Server.ts +118 -0
- package/src/lib/transporters/websocket/WebSocket.Transporter.ts +132 -0
- package/src/lib/transporters/websocket/WebSocket.decl.ts +21 -0
- package/src/lib/transporters/websocket/index.ts +19 -0
- package/lib/Client/BuiltInRIDGenerator.d.ts +0 -4
- package/lib/Client/BuiltInRIDGenerator.d.ts.map +0 -1
- package/lib/Client/BuiltInRIDGenerator.js +0 -18
- package/lib/Client/BuiltInRIDGenerator.js.map +0 -1
- package/lib/Client/Common.d.ts +0 -47
- package/lib/Client/Common.d.ts.map +0 -1
- package/lib/Client/Common.js +0 -18
- package/lib/Client/Common.js.map +0 -1
- package/lib/Client/Errors.d.ts +0 -26
- package/lib/Client/Errors.d.ts.map +0 -1
- package/lib/Client/Errors.js +0 -80
- package/lib/Client/Errors.js.map +0 -1
- package/lib/Client/HttpClient.d.ts +0 -37
- package/lib/Client/HttpClient.d.ts.map +0 -1
- package/lib/Client/HttpClient.js +0 -148
- package/lib/Client/HttpClient.js.map +0 -1
- package/lib/Client/HttpsClient.d.ts +0 -40
- package/lib/Client/HttpsClient.d.ts.map +0 -1
- package/lib/Client/HttpsClient.js +0 -144
- package/lib/Client/HttpsClient.js.map +0 -1
- package/lib/Client/TCPClient.d.ts +0 -34
- package/lib/Client/TCPClient.d.ts.map +0 -1
- package/lib/Client/TCPClient.js +0 -271
- package/lib/Client/TCPClient.js.map +0 -1
- package/lib/Client/TLSClient.d.ts +0 -34
- package/lib/Client/TLSClient.d.ts.map +0 -1
- package/lib/Client/TLSClient.js +0 -265
- package/lib/Client/TLSClient.js.map +0 -1
- package/lib/Client/index.d.ts +0 -23
- package/lib/Client/index.d.ts.map +0 -1
- package/lib/Client/index.js +0 -39
- package/lib/Client/index.js.map +0 -1
- package/lib/Common/API.d.ts +0 -19
- package/lib/Common/API.d.ts.map +0 -1
- package/lib/Common/API.js +0 -18
- package/lib/Common/API.js.map +0 -1
- package/lib/Common/Encoding.d.ts +0 -32
- package/lib/Common/Encoding.d.ts.map +0 -1
- package/lib/Common/Encoding.js +0 -20
- package/lib/Common/Encoding.js.map +0 -1
- package/lib/Common/Request.d.ts +0 -23
- package/lib/Common/Request.d.ts.map +0 -1
- package/lib/Common/Request.js +0 -18
- package/lib/Common/Request.js.map +0 -1
- package/lib/Common/Response.d.ts +0 -60
- package/lib/Common/Response.d.ts.map +0 -1
- package/lib/Common/Response.js +0 -42
- package/lib/Common/Response.js.map +0 -1
- package/lib/Common/index.d.ts +0 -20
- package/lib/Common/index.d.ts.map +0 -1
- package/lib/Common/index.js +0 -36
- package/lib/Common/index.js.map +0 -1
- package/lib/Encoder/Decoder.d.ts +0 -18
- package/lib/Encoder/Decoder.d.ts.map +0 -1
- package/lib/Encoder/Decoder.js +0 -136
- package/lib/Encoder/Decoder.js.map +0 -1
- package/lib/Encoder/Encoder.d.ts +0 -18
- package/lib/Encoder/Encoder.d.ts.map +0 -1
- package/lib/Encoder/Encoder.js +0 -35
- package/lib/Encoder/Encoder.js.map +0 -1
- package/lib/Encoder/Errors.d.ts +0 -17
- package/lib/Encoder/Errors.d.ts.map +0 -1
- package/lib/Encoder/Errors.js +0 -26
- package/lib/Encoder/Errors.js.map +0 -1
- package/lib/Errors.d.ts +0 -20
- package/lib/Errors.d.ts.map +0 -1
- package/lib/Errors.js +0 -40
- package/lib/Errors.js.map +0 -1
- package/lib/Server/Common/Gateway.d.ts +0 -26
- package/lib/Server/Common/Gateway.d.ts.map +0 -1
- package/lib/Server/Common/Gateway.js +0 -18
- package/lib/Server/Common/Gateway.js.map +0 -1
- package/lib/Server/Common/Request.d.ts +0 -21
- package/lib/Server/Common/Request.d.ts.map +0 -1
- package/lib/Server/Common/Request.js +0 -18
- package/lib/Server/Common/Request.js.map +0 -1
- package/lib/Server/Common/Router.d.ts +0 -41
- package/lib/Server/Common/Router.d.ts.map +0 -1
- package/lib/Server/Common/Router.js +0 -18
- package/lib/Server/Common/Router.js.map +0 -1
- package/lib/Server/Common/Server.d.ts +0 -57
- package/lib/Server/Common/Server.d.ts.map +0 -1
- package/lib/Server/Common/Server.js +0 -18
- package/lib/Server/Common/Server.js.map +0 -1
- package/lib/Server/Common/index.d.ts +0 -20
- package/lib/Server/Common/index.d.ts.map +0 -1
- package/lib/Server/Common/index.js +0 -36
- package/lib/Server/Common/index.js.map +0 -1
- package/lib/Server/Errors.d.ts +0 -25
- package/lib/Server/Errors.d.ts.map +0 -1
- package/lib/Server/Errors.js +0 -74
- package/lib/Server/Errors.js.map +0 -1
- package/lib/Server/Gateways/Http.d.ts +0 -18
- package/lib/Server/Gateways/Http.d.ts.map +0 -1
- package/lib/Server/Gateways/Http.js +0 -144
- package/lib/Server/Gateways/Http.js.map +0 -1
- package/lib/Server/Gateways/TCP.d.ts +0 -23
- package/lib/Server/Gateways/TCP.d.ts.map +0 -1
- package/lib/Server/Gateways/TCP.js +0 -146
- package/lib/Server/Gateways/TCP.js.map +0 -1
- package/lib/Server/Server.d.ts +0 -18
- package/lib/Server/Server.d.ts.map +0 -1
- package/lib/Server/Server.js +0 -200
- package/lib/Server/Server.js.map +0 -1
- package/lib/Server/SimpleRouter.d.ts +0 -41
- package/lib/Server/SimpleRouter.d.ts.map +0 -1
- package/lib/Server/SimpleRouter.js +0 -54
- package/lib/Server/SimpleRouter.js.map +0 -1
- package/lib/Server/index.d.ts +0 -22
- package/lib/Server/index.d.ts.map +0 -1
- package/lib/Server/index.js +0 -38
- package/lib/Server/index.js.map +0 -1
- package/src/lib/Client/BuiltInRIDGenerator.ts +0 -21
- package/src/lib/Client/Common.ts +0 -63
- package/src/lib/Client/Errors.ts +0 -87
- package/src/lib/Client/HttpClient.ts +0 -232
- package/src/lib/Client/HttpsClient.ts +0 -238
- package/src/lib/Client/TCPClient.ts +0 -420
- package/src/lib/Client/TLSClient.ts +0 -422
- package/src/lib/Client/index.ts +0 -23
- package/src/lib/Common/API.ts +0 -20
- package/src/lib/Common/Encoding.ts +0 -42
- package/src/lib/Common/Request.ts +0 -28
- package/src/lib/Common/Response.ts +0 -67
- package/src/lib/Common/index.ts +0 -20
- package/src/lib/Encoder/Decoder.ts +0 -206
- package/src/lib/Encoder/Encoder.ts +0 -41
- package/src/lib/Encoder/Errors.ts +0 -24
- package/src/lib/Errors.ts +0 -40
- package/src/lib/Server/Common/Gateway.ts +0 -37
- package/src/lib/Server/Common/Request.ts +0 -24
- package/src/lib/Server/Common/Router.ts +0 -52
- package/src/lib/Server/Common/Server.ts +0 -68
- package/src/lib/Server/Common/index.ts +0 -20
- package/src/lib/Server/Errors.ts +0 -80
- package/src/lib/Server/Gateways/Http.ts +0 -203
- package/src/lib/Server/Gateways/TCP.ts +0 -221
- package/src/lib/Server/Server.ts +0 -268
- package/src/lib/Server/SimpleRouter.ts +0 -95
- package/src/lib/Server/index.ts +0 -22
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import * as $TLS from 'tls';
|
|
18
|
-
import * as C from './Common';
|
|
19
|
-
import * as G from '../Common';
|
|
20
|
-
import { Promises, Events } from '@litert/observable';
|
|
21
|
-
import * as E from './Errors';
|
|
22
|
-
import { createDecoder } from '../Encoder/Decoder';
|
|
23
|
-
import { createEncoder } from '../Encoder/Encoder';
|
|
24
|
-
|
|
25
|
-
enum EStatus {
|
|
26
|
-
|
|
27
|
-
IDLE,
|
|
28
|
-
CONNECTING,
|
|
29
|
-
CLOSING,
|
|
30
|
-
WORKING,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface IRequest {
|
|
34
|
-
|
|
35
|
-
api: string;
|
|
36
|
-
|
|
37
|
-
cst: number;
|
|
38
|
-
|
|
39
|
-
returnRaw: boolean;
|
|
40
|
-
|
|
41
|
-
pr: Promises.IPromiseHandle;
|
|
42
|
-
|
|
43
|
-
timer?: NodeJS.Timeout;
|
|
44
|
-
|
|
45
|
-
packet?: G.IRawRequest;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
class TLSClient extends Events.EventEmitter<Events.ICallbackDefinitions> implements C.IClient {
|
|
49
|
-
|
|
50
|
-
private static readonly _$promises = Promises.getGlobalFactory();
|
|
51
|
-
|
|
52
|
-
private static _$clientCounter = 0;
|
|
53
|
-
|
|
54
|
-
private _socket!: $TLS.TLSSocket;
|
|
55
|
-
|
|
56
|
-
private _status: EStatus = EStatus.IDLE;
|
|
57
|
-
|
|
58
|
-
private readonly _clientId: number = TLSClient._$clientCounter++;
|
|
59
|
-
|
|
60
|
-
private readonly _connPrId: string;
|
|
61
|
-
|
|
62
|
-
private readonly _closePrId: string;
|
|
63
|
-
|
|
64
|
-
private _sent: Record<string, IRequest> = {};
|
|
65
|
-
|
|
66
|
-
private _sentQty: number = 0;
|
|
67
|
-
|
|
68
|
-
private _sending: Record<string, IRequest> = {};
|
|
69
|
-
|
|
70
|
-
private _sendingQty: number = 0;
|
|
71
|
-
|
|
72
|
-
private readonly _encoder = createEncoder();
|
|
73
|
-
|
|
74
|
-
public constructor(
|
|
75
|
-
private readonly _host: string,
|
|
76
|
-
private readonly _port: number,
|
|
77
|
-
private readonly _ridGenerator: C.IRIDGenerator,
|
|
78
|
-
private readonly _timeout: number = 30000,
|
|
79
|
-
private readonly _apiNameWrapper?: (name: string) => string,
|
|
80
|
-
private readonly _tlsOptions?: $TLS.ConnectionOptions
|
|
81
|
-
) {
|
|
82
|
-
|
|
83
|
-
super();
|
|
84
|
-
|
|
85
|
-
this._connPrId = `litert:televoke:tcp:client:${this._clientId}:connect`;
|
|
86
|
-
this._closePrId = `litert:televoke:tcp:client:${this._clientId}:close`;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public invoke(api: any, ...args: any[]): Promise<any> {
|
|
90
|
-
|
|
91
|
-
return this._call(api, false, args);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
public call(api: any, ...args: any[]): Promise<any> {
|
|
95
|
-
|
|
96
|
-
return this._call(api, true, args);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
private _call(api: any, returnRaw: boolean, args: any[]): Promise<any> {
|
|
100
|
-
|
|
101
|
-
const rid = this._ridGenerator();
|
|
102
|
-
|
|
103
|
-
let pr: Promises.IPromiseHandle;
|
|
104
|
-
|
|
105
|
-
switch (this._status) {
|
|
106
|
-
|
|
107
|
-
case EStatus.IDLE:
|
|
108
|
-
return Promise.reject(new E.E_CONN_NOT_READY());
|
|
109
|
-
case EStatus.WORKING: {
|
|
110
|
-
const NOW = Date.now();
|
|
111
|
-
this._encoder.encode(this._socket, {
|
|
112
|
-
ttl: this._timeout,
|
|
113
|
-
rid,
|
|
114
|
-
cst: NOW,
|
|
115
|
-
args,
|
|
116
|
-
api: this._apiNameWrapper ? this._apiNameWrapper(api) : api
|
|
117
|
-
});
|
|
118
|
-
this._sentQty++;
|
|
119
|
-
this._sent[rid] = {
|
|
120
|
-
api,
|
|
121
|
-
cst: NOW,
|
|
122
|
-
returnRaw,
|
|
123
|
-
pr: pr = TLSClient._$promises.createPromise(),
|
|
124
|
-
timer: this._timeout > 0 ? setTimeout(() => {
|
|
125
|
-
|
|
126
|
-
const req = this._sent[rid];
|
|
127
|
-
|
|
128
|
-
if (req) {
|
|
129
|
-
|
|
130
|
-
delete this._sent[rid];
|
|
131
|
-
this._sentQty--;
|
|
132
|
-
req.pr.reject(new E.E_REQUEST_TIMEOUT({
|
|
133
|
-
metadata: { api: req.api, requestId: rid, time: req.cst, details: null }
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (this._status === EStatus.CLOSING && !this._sentQty) {
|
|
138
|
-
|
|
139
|
-
this._socket.destroy();
|
|
140
|
-
this._status = EStatus.IDLE;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}, this._timeout) : undefined
|
|
144
|
-
};
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case EStatus.CONNECTING: {
|
|
148
|
-
const NOW = Date.now();
|
|
149
|
-
this._sendingQty++;
|
|
150
|
-
this._sending[rid] = {
|
|
151
|
-
api,
|
|
152
|
-
pr: pr = TLSClient._$promises.createPromise(),
|
|
153
|
-
cst: NOW,
|
|
154
|
-
returnRaw,
|
|
155
|
-
packet: {
|
|
156
|
-
ttl: this._timeout,
|
|
157
|
-
rid,
|
|
158
|
-
cst: NOW,
|
|
159
|
-
args,
|
|
160
|
-
api: this._apiNameWrapper ? this._apiNameWrapper(api) : api
|
|
161
|
-
},
|
|
162
|
-
timer: this._timeout > 0 ? setTimeout(() => {
|
|
163
|
-
|
|
164
|
-
let req = this._sent[rid];
|
|
165
|
-
|
|
166
|
-
if (req) {
|
|
167
|
-
|
|
168
|
-
delete this._sent[rid];
|
|
169
|
-
|
|
170
|
-
this._sentQty--;
|
|
171
|
-
|
|
172
|
-
req.pr.reject(new E.E_REQUEST_TIMEOUT({
|
|
173
|
-
metadata: { api: req.api, requestId: rid, time: req.cst, details: null }
|
|
174
|
-
}));
|
|
175
|
-
|
|
176
|
-
if (this._status === EStatus.CLOSING && !this._sentQty) {
|
|
177
|
-
|
|
178
|
-
this._socket.destroy();
|
|
179
|
-
this._status = EStatus.IDLE;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
req = this._sending[rid];
|
|
186
|
-
|
|
187
|
-
if (req) {
|
|
188
|
-
|
|
189
|
-
delete this._sending[rid];
|
|
190
|
-
|
|
191
|
-
this._sendingQty--;
|
|
192
|
-
|
|
193
|
-
req.pr.reject(new E.E_REQUEST_TIMEOUT({
|
|
194
|
-
metadata: { api: req.api, requestId: rid, time: req.cst, details: null }
|
|
195
|
-
}));
|
|
196
|
-
|
|
197
|
-
if (this._status === EStatus.CLOSING && !this._sentQty) {
|
|
198
|
-
|
|
199
|
-
this._socket.destroy();
|
|
200
|
-
this._status = EStatus.IDLE;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
}, this._timeout) : undefined
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
case EStatus.CLOSING:
|
|
210
|
-
throw new E.E_CONN_CLOSING();
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return pr.promise;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
public connect(): Promise<void> {
|
|
217
|
-
|
|
218
|
-
switch (this._status) {
|
|
219
|
-
|
|
220
|
-
case EStatus.WORKING:
|
|
221
|
-
return Promise.resolve();
|
|
222
|
-
case EStatus.CONNECTING:
|
|
223
|
-
return TLSClient._$promises.findPromise(this._connPrId)!.promise;
|
|
224
|
-
case EStatus.CLOSING:
|
|
225
|
-
this._status = EStatus.WORKING;
|
|
226
|
-
break;
|
|
227
|
-
case EStatus.IDLE:
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
this._socket = $TLS.connect({
|
|
232
|
-
host: this._host,
|
|
233
|
-
port: this._port,
|
|
234
|
-
...this._tlsOptions
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
const pr = TLSClient._$promises.createPromise({ id: this._connPrId });
|
|
238
|
-
|
|
239
|
-
this._socket.once('connect', () => {
|
|
240
|
-
|
|
241
|
-
this._status = EStatus.WORKING;
|
|
242
|
-
|
|
243
|
-
this._socket.removeAllListeners('error');
|
|
244
|
-
|
|
245
|
-
const decoder = createDecoder<G.IRawResponse>();
|
|
246
|
-
|
|
247
|
-
decoder.onLogicError = (e: unknown) => this.emit('error', e);
|
|
248
|
-
decoder.onProtocolError = (e: unknown) => this.emit('error', e);
|
|
249
|
-
|
|
250
|
-
decoder.onData = (rawData: G.IRawResponse): void => {
|
|
251
|
-
|
|
252
|
-
const data = rawData as C.IResponse<any>;
|
|
253
|
-
|
|
254
|
-
const req = this._sent[data.rid];
|
|
255
|
-
|
|
256
|
-
if (!req) {
|
|
257
|
-
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
data.cst = req.cst;
|
|
262
|
-
data.crt = Date.now();
|
|
263
|
-
|
|
264
|
-
this._sentQty--;
|
|
265
|
-
delete this._sent[data.rid];
|
|
266
|
-
|
|
267
|
-
if (req.timer) {
|
|
268
|
-
|
|
269
|
-
clearTimeout(req.timer);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (this._status === EStatus.CLOSING && !this._sentQty) {
|
|
273
|
-
|
|
274
|
-
this._socket.end();
|
|
275
|
-
this._status = EStatus.IDLE;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
switch (data.code) {
|
|
279
|
-
case G.EResponseCode.OK:
|
|
280
|
-
req.pr.resolve(req.returnRaw ? data : data.body);
|
|
281
|
-
break;
|
|
282
|
-
case G.EResponseCode.SYSTEM_ERROR:
|
|
283
|
-
req.pr.reject(new E.E_SERVER_INTERNAL_ERROR({
|
|
284
|
-
api: req.api, ...data
|
|
285
|
-
}));
|
|
286
|
-
break;
|
|
287
|
-
case G.EResponseCode.FAILURE:
|
|
288
|
-
req.pr.reject(new E.E_SERVER_LOGIC_FAILURE({
|
|
289
|
-
api: req.api, ...data
|
|
290
|
-
}));
|
|
291
|
-
break;
|
|
292
|
-
case G.EResponseCode.API_NOT_FOUND:
|
|
293
|
-
req.pr.reject(new E.E_API_NOT_FOUND({
|
|
294
|
-
api: req.api, ...data
|
|
295
|
-
}));
|
|
296
|
-
break;
|
|
297
|
-
default:
|
|
298
|
-
req.pr.reject(new E.E_SERVER_UNKNOWN_ERROR({
|
|
299
|
-
api: req.api, ...data
|
|
300
|
-
}));
|
|
301
|
-
break;
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
this._socket.on('data', decoder.decode.bind(decoder)).on('end', () => {
|
|
306
|
-
|
|
307
|
-
if (this._sentQty) {
|
|
308
|
-
|
|
309
|
-
const ls = this._sent;
|
|
310
|
-
|
|
311
|
-
this._sent = {};
|
|
312
|
-
|
|
313
|
-
for (const rid in ls) {
|
|
314
|
-
|
|
315
|
-
this._sent[rid].pr.reject(new E.E_CONN_LOST());
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
this._sentQty = 0;
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
if (this._sendingQty) {
|
|
323
|
-
|
|
324
|
-
for (const rid in this._sending) {
|
|
325
|
-
|
|
326
|
-
const req = this._sending[rid];
|
|
327
|
-
|
|
328
|
-
this._encoder.encode(this._socket, req.packet);
|
|
329
|
-
|
|
330
|
-
this._sent[rid] = req;
|
|
331
|
-
this._sentQty++;
|
|
332
|
-
delete req.packet;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
this._sending = {};
|
|
336
|
-
this._sendingQty = 0;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
pr.resolve();
|
|
340
|
-
|
|
341
|
-
}).once('error', (e) => {
|
|
342
|
-
|
|
343
|
-
this._socket = undefined as any;
|
|
344
|
-
pr.reject(e);
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
return pr.promise;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
public close(): Promise<void> {
|
|
351
|
-
|
|
352
|
-
switch (this._status) {
|
|
353
|
-
|
|
354
|
-
case EStatus.IDLE:
|
|
355
|
-
return Promise.resolve();
|
|
356
|
-
case EStatus.CLOSING:
|
|
357
|
-
return TLSClient._$promises.findPromise(this._closePrId)!.promise;
|
|
358
|
-
case EStatus.WORKING:
|
|
359
|
-
break;
|
|
360
|
-
case EStatus.CONNECTING:
|
|
361
|
-
TLSClient._$promises.findPromise(this._connPrId)!.reject(new E.E_OPERATION_ABORTED());
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
if (this._sentQty) {
|
|
365
|
-
|
|
366
|
-
this._status = EStatus.CLOSING;
|
|
367
|
-
|
|
368
|
-
return TLSClient._$promises.createPromise({ id: this._closePrId }).promise;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
if (this._sendingQty) {
|
|
372
|
-
|
|
373
|
-
for (const rid in this._sending) {
|
|
374
|
-
|
|
375
|
-
const req = this._sending[rid];
|
|
376
|
-
|
|
377
|
-
req.pr.reject(new E.E_CONN_LOST({
|
|
378
|
-
metadata: { api: req.api, requestId: rid, time: Date.now(), details: null }
|
|
379
|
-
}));
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
this._sending = {};
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
this._socket.destroy();
|
|
386
|
-
this._socket = undefined as any;
|
|
387
|
-
this._status = EStatus.IDLE;
|
|
388
|
-
return Promise.resolve();
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
export interface ITLSClientOptions {
|
|
393
|
-
|
|
394
|
-
host: string;
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* The port of TLS server.
|
|
398
|
-
*
|
|
399
|
-
* @default 443
|
|
400
|
-
*/
|
|
401
|
-
port?: number;
|
|
402
|
-
|
|
403
|
-
ridGenerator: C.IRIDGenerator;
|
|
404
|
-
|
|
405
|
-
timeout?: number;
|
|
406
|
-
|
|
407
|
-
apiNameWrapper?: (name: string) => string;
|
|
408
|
-
|
|
409
|
-
tlsOptions?: $TLS.ConnectionOptions;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
export function createTLSClient<TAPIs extends G.IServiceAPIs>(opts: ITLSClientOptions): C.IClient<TAPIs> {
|
|
413
|
-
|
|
414
|
-
return new TLSClient(
|
|
415
|
-
opts.host,
|
|
416
|
-
opts.port ?? 443,
|
|
417
|
-
opts.ridGenerator,
|
|
418
|
-
opts.timeout,
|
|
419
|
-
opts.apiNameWrapper,
|
|
420
|
-
opts.tlsOptions
|
|
421
|
-
);
|
|
422
|
-
}
|
package/src/lib/Client/index.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export * from './Errors';
|
|
18
|
-
export * from './Common';
|
|
19
|
-
export * from './TCPClient';
|
|
20
|
-
export * from './TLSClient';
|
|
21
|
-
export * from './HttpClient';
|
|
22
|
-
export * from './HttpsClient';
|
|
23
|
-
export * from './BuiltInRIDGenerator';
|
package/src/lib/Common/API.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
18
|
-
export interface IServiceAPIs {}
|
|
19
|
-
|
|
20
|
-
export type IFunction = (...args: any[]) => any;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export const MAX_PACKET_SIZE = 67108864;
|
|
18
|
-
|
|
19
|
-
export interface IWritable {
|
|
20
|
-
|
|
21
|
-
write(buf: Buffer | string, cb?: () => void): void;
|
|
22
|
-
|
|
23
|
-
writable: boolean;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface IEncoder {
|
|
27
|
-
|
|
28
|
-
encode(socket: IWritable, content: any): void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IDecoder<T> {
|
|
32
|
-
|
|
33
|
-
onProtocolError: (e: unknown) => void;
|
|
34
|
-
|
|
35
|
-
onLogicError: (e: unknown) => void;
|
|
36
|
-
|
|
37
|
-
onData: (data: T) => void;
|
|
38
|
-
|
|
39
|
-
decode(chunk: Buffer): void;
|
|
40
|
-
|
|
41
|
-
reset(): void;
|
|
42
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export interface IRawRequest<T = any> {
|
|
18
|
-
|
|
19
|
-
ttl: number;
|
|
20
|
-
|
|
21
|
-
api: string;
|
|
22
|
-
|
|
23
|
-
args: T;
|
|
24
|
-
|
|
25
|
-
cst: number;
|
|
26
|
-
|
|
27
|
-
rid: string | number;
|
|
28
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export enum EResponseCode {
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* API was called succeed
|
|
21
|
-
*/
|
|
22
|
-
OK,
|
|
23
|
-
/**
|
|
24
|
-
* The invoked API does not exist on the remote server.
|
|
25
|
-
*/
|
|
26
|
-
API_NOT_FOUND,
|
|
27
|
-
/**
|
|
28
|
-
* Some unexpected error happened.
|
|
29
|
-
*/
|
|
30
|
-
SYSTEM_ERROR,
|
|
31
|
-
/**
|
|
32
|
-
* Logical error happened inside the API handler.
|
|
33
|
-
*/
|
|
34
|
-
FAILURE,
|
|
35
|
-
/**
|
|
36
|
-
* The arguments inside the request is malformed.
|
|
37
|
-
*/
|
|
38
|
-
MALFORMED_ARGUMENTS
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface IRawResponse<T = any> {
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The time when server sent the response.
|
|
45
|
-
*/
|
|
46
|
-
sst: number;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The time when server received the request.
|
|
50
|
-
*/
|
|
51
|
-
srt: number;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The identity of the request.
|
|
55
|
-
*/
|
|
56
|
-
rid: string | number;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The protocol status code of the response.
|
|
60
|
-
*/
|
|
61
|
-
code: number;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The content of API response.
|
|
65
|
-
*/
|
|
66
|
-
body: T;
|
|
67
|
-
}
|
package/src/lib/Common/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export * from './Encoding';
|
|
18
|
-
export * from './Request';
|
|
19
|
-
export * from './Response';
|
|
20
|
-
export * from './API';
|