@litert/televoke 0.4.7 → 1.0.0-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.
- package/CHANGES.md +4 -2
- 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 +36 -0
- package/lib/shared/BinaryStream.d.ts.map +1 -0
- package/lib/shared/BinaryStream.js +100 -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 +448 -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 +281 -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 +177 -0
- package/lib/shared/Encodings/v2/EncoderV2.js.map +1 -0
- package/lib/shared/Encodings/v2/Encoding.v2.decl.d.ts +99 -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 +61 -0
- package/lib/shared/Errors.d.ts.map +1 -0
- package/lib/shared/Errors.js +76 -0
- package/lib/shared/Errors.js.map +1 -0
- package/lib/shared/Shared.decl.d.ts +313 -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 +141 -0
- package/src/lib/shared/BinaryStreamManager.ts +142 -0
- package/src/lib/shared/Channel.impl.ts +658 -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 +406 -0
- package/src/lib/shared/Encodings/v2/EncoderV2.ts +284 -0
- package/src/lib/shared/Encodings/v2/Encoding.v2.decl.ts +138 -0
- package/src/lib/shared/Encodings/v2/index.ts +20 -0
- package/src/lib/shared/Errors.ts +95 -0
- package/src/lib/shared/Shared.decl.ts +366 -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 -148
- 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 -209
- 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,57 +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
|
-
import { IGateway } from './Gateway';
|
|
17
|
-
import { IRouter } from './Router';
|
|
18
|
-
import { Events } from '@litert/observable';
|
|
19
|
-
export interface IServerEvents extends Events.ICallbackDefinitions {
|
|
20
|
-
handler_error(e: unknown): void;
|
|
21
|
-
}
|
|
22
|
-
export interface IServer extends Events.IObservable<IServerEvents> {
|
|
23
|
-
/**
|
|
24
|
-
* Mount a new gateway.
|
|
25
|
-
*
|
|
26
|
-
* @param name The name of the gateway.
|
|
27
|
-
* @param gateway The gateway object.
|
|
28
|
-
*/
|
|
29
|
-
addGateway(name: string, gateway: IGateway): this;
|
|
30
|
-
/**
|
|
31
|
-
* Get a mounted gateway by name.
|
|
32
|
-
*
|
|
33
|
-
* @param name The name of the gateway.
|
|
34
|
-
*/
|
|
35
|
-
getGateway(name: string): IGateway;
|
|
36
|
-
/**
|
|
37
|
-
* Unmount a gateway.
|
|
38
|
-
*
|
|
39
|
-
* @param name The name of the gateway.
|
|
40
|
-
*/
|
|
41
|
-
removeGateway(name: string): this;
|
|
42
|
-
/**
|
|
43
|
-
* Inject a router object for the server.
|
|
44
|
-
*
|
|
45
|
-
* @param router The router object.
|
|
46
|
-
*/
|
|
47
|
-
setRouter(router: IRouter): this;
|
|
48
|
-
/**
|
|
49
|
-
* Start the server.
|
|
50
|
-
*/
|
|
51
|
-
start(): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Stop the server.
|
|
54
|
-
*/
|
|
55
|
-
close(): Promise<void>;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=Server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../../src/lib/Server/Common/Server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,oBAAoB;IAG9D,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAEnC;AAED,MAAM,WAAW,OAAQ,SAAQ,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC;IAE9D;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,CAAC;IAElD;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IAEnC;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAElC;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
//# sourceMappingURL=Server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Server.js","sourceRoot":"","sources":["../../../src/lib/Server/Common/Server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG"}
|
|
@@ -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
|
-
export * from './Gateway';
|
|
17
|
-
export * from './Request';
|
|
18
|
-
export * from './Router';
|
|
19
|
-
export * from './Server';
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/Server/Common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
29
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
__exportStar(require("./Gateway"), exports);
|
|
33
|
-
__exportStar(require("./Request"), exports);
|
|
34
|
-
__exportStar(require("./Router"), exports);
|
|
35
|
-
__exportStar(require("./Server"), exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/Server/Common/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;AAEH,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,2CAAyB"}
|
package/lib/Server/Errors.d.ts
DELETED
|
@@ -1,25 +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
|
-
export declare const E_GATEWAY_STARTING: import("@litert/exception").IExceptionConstructor;
|
|
17
|
-
export declare const E_GATEWAY_CLOSING: import("@litert/exception").IExceptionConstructor;
|
|
18
|
-
export declare const E_SERVER_STARTING: import("@litert/exception").IExceptionConstructor;
|
|
19
|
-
export declare const E_SERVER_CLOSING: import("@litert/exception").IExceptionConstructor;
|
|
20
|
-
export declare const E_SERVER_BUSY: import("@litert/exception").IExceptionConstructor;
|
|
21
|
-
export declare const E_NO_SERVER_ATTACHED: import("@litert/exception").IExceptionConstructor;
|
|
22
|
-
export declare const E_SERVER_NOT_READY: import("@litert/exception").IExceptionConstructor;
|
|
23
|
-
export declare const E_GATEWAY_BUSY: import("@litert/exception").IExceptionConstructor;
|
|
24
|
-
export declare const E_GATEWAY_NOT_FOUND: import("@litert/exception").IExceptionConstructor;
|
|
25
|
-
//# sourceMappingURL=Errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../../src/lib/Server/Errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,eAAO,MAAM,kBAAkB,mDAK7B,CAAC;AAEH,eAAO,MAAM,iBAAiB,mDAK5B,CAAC;AAEH,eAAO,MAAM,iBAAiB,mDAK5B,CAAC;AAEH,eAAO,MAAM,gBAAgB,mDAK3B,CAAC;AAEH,eAAO,MAAM,aAAa,mDAKxB,CAAC;AAEH,eAAO,MAAM,oBAAoB,mDAK/B,CAAC;AAEH,eAAO,MAAM,kBAAkB,mDAK7B,CAAC;AAEH,eAAO,MAAM,cAAc,mDAKzB,CAAC;AAEH,eAAO,MAAM,mBAAmB,mDAK9B,CAAC"}
|
package/lib/Server/Errors.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.E_GATEWAY_NOT_FOUND = exports.E_GATEWAY_BUSY = exports.E_SERVER_NOT_READY = exports.E_NO_SERVER_ATTACHED = exports.E_SERVER_BUSY = exports.E_SERVER_CLOSING = exports.E_SERVER_STARTING = exports.E_GATEWAY_CLOSING = exports.E_GATEWAY_STARTING = void 0;
|
|
19
|
-
const Errors_1 = require("../Errors");
|
|
20
|
-
exports.E_GATEWAY_STARTING = Errors_1.errorRegistry.register({
|
|
21
|
-
name: 'gateway_starting',
|
|
22
|
-
message: 'A gateway has already been starting.',
|
|
23
|
-
metadata: {},
|
|
24
|
-
type: 'public'
|
|
25
|
-
});
|
|
26
|
-
exports.E_GATEWAY_CLOSING = Errors_1.errorRegistry.register({
|
|
27
|
-
name: 'gateway_closing',
|
|
28
|
-
message: 'A gateway has already been closing.',
|
|
29
|
-
metadata: {},
|
|
30
|
-
type: 'public'
|
|
31
|
-
});
|
|
32
|
-
exports.E_SERVER_STARTING = Errors_1.errorRegistry.register({
|
|
33
|
-
name: 'server_starting',
|
|
34
|
-
message: 'A server has already been starting.',
|
|
35
|
-
metadata: {},
|
|
36
|
-
type: 'public'
|
|
37
|
-
});
|
|
38
|
-
exports.E_SERVER_CLOSING = Errors_1.errorRegistry.register({
|
|
39
|
-
name: 'server_closing',
|
|
40
|
-
message: 'A server has already been closing.',
|
|
41
|
-
metadata: {},
|
|
42
|
-
type: 'public'
|
|
43
|
-
});
|
|
44
|
-
exports.E_SERVER_BUSY = Errors_1.errorRegistry.register({
|
|
45
|
-
name: 'server_busy',
|
|
46
|
-
message: 'It is not able to update server currnetly.',
|
|
47
|
-
metadata: {},
|
|
48
|
-
type: 'public'
|
|
49
|
-
});
|
|
50
|
-
exports.E_NO_SERVER_ATTACHED = Errors_1.errorRegistry.register({
|
|
51
|
-
name: 'no_server_attached',
|
|
52
|
-
message: 'The gateway does not attach to a server.',
|
|
53
|
-
metadata: {},
|
|
54
|
-
type: 'public'
|
|
55
|
-
});
|
|
56
|
-
exports.E_SERVER_NOT_READY = Errors_1.errorRegistry.register({
|
|
57
|
-
name: 'server_not_ready',
|
|
58
|
-
message: 'The server is not setup completely.',
|
|
59
|
-
metadata: {},
|
|
60
|
-
type: 'public'
|
|
61
|
-
});
|
|
62
|
-
exports.E_GATEWAY_BUSY = Errors_1.errorRegistry.register({
|
|
63
|
-
name: 'gateway_busy',
|
|
64
|
-
message: 'The gateway has been attached to a server.',
|
|
65
|
-
metadata: {},
|
|
66
|
-
type: 'public'
|
|
67
|
-
});
|
|
68
|
-
exports.E_GATEWAY_NOT_FOUND = Errors_1.errorRegistry.register({
|
|
69
|
-
name: 'gateway_not_found',
|
|
70
|
-
message: 'No such a gateway.',
|
|
71
|
-
metadata: {},
|
|
72
|
-
type: 'public'
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=Errors.js.map
|
package/lib/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AkB,GAAG,sBAAa,CAAC,QAAQ,CAAC;IACrD,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,qCAAqC;IAC9C,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,QAAQ;CACjB,CAAC,CAAC;AAEU,QAAA,cAAc,GAAG,sBAAa,CAAC,QAAQ,CAAC;IACjD,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,4CAA4C;IACrD,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,QAAQ;CACjB,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,sBAAa,CAAC,QAAQ,CAAC;IACtD,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,QAAQ;CACjB,CAAC,CAAC"}
|
|
@@ -1,18 +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
|
-
import * as C from '../Common';
|
|
17
|
-
export declare function createHttpGateway(host: string, port: number, backlog?: number): C.IGateway;
|
|
18
|
-
//# sourceMappingURL=Http.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Http.d.ts","sourceRoot":"","sources":["../../../src/lib/Server/Gateways/Http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AA4L/B,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,CAG1F"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createHttpGateway = void 0;
|
|
19
|
-
const G = require("../../Common");
|
|
20
|
-
const E = require("../Errors");
|
|
21
|
-
const $Http = require("http");
|
|
22
|
-
var EStatus;
|
|
23
|
-
(function (EStatus) {
|
|
24
|
-
EStatus[EStatus["IDLE"] = 0] = "IDLE";
|
|
25
|
-
EStatus[EStatus["STARTING"] = 1] = "STARTING";
|
|
26
|
-
EStatus[EStatus["WORKING"] = 2] = "WORKING";
|
|
27
|
-
EStatus[EStatus["CLOSING"] = 3] = "CLOSING";
|
|
28
|
-
})(EStatus || (EStatus = {}));
|
|
29
|
-
const INVALID_REQUEST_RESPONSE = Buffer.from('{"rid":"null","body":INVALID REQUEST,"sst":1698886839989,"srt":0,"code":4}');
|
|
30
|
-
function refuseBadRequest(resp) {
|
|
31
|
-
try {
|
|
32
|
-
resp.writeHead(400, {
|
|
33
|
-
'content-length': INVALID_REQUEST_RESPONSE.byteLength,
|
|
34
|
-
});
|
|
35
|
-
const socket = resp.socket;
|
|
36
|
-
resp.end(INVALID_REQUEST_RESPONSE);
|
|
37
|
-
socket.destroy();
|
|
38
|
-
}
|
|
39
|
-
catch (_a) {
|
|
40
|
-
// do nothing.
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
class HttpGateway {
|
|
44
|
-
constructor(host, port, _backlog) {
|
|
45
|
-
this.host = host;
|
|
46
|
-
this.port = port;
|
|
47
|
-
this._backlog = _backlog;
|
|
48
|
-
this._server = $Http.createServer(this._onRequest.bind(this));
|
|
49
|
-
this._status = EStatus.IDLE;
|
|
50
|
-
}
|
|
51
|
-
_onRequest(req, resp) {
|
|
52
|
-
if (req.method !== 'POST' || !req.headers['content-length']) {
|
|
53
|
-
refuseBadRequest(resp);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const length = parseInt(req.headers['content-length']);
|
|
57
|
-
if (!Number.isSafeInteger(length) || length > G.MAX_PACKET_SIZE) { // Maximum request packet is 64MB
|
|
58
|
-
refuseBadRequest(resp);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const buf = Buffer.allocUnsafe(length);
|
|
62
|
-
let offset = 0;
|
|
63
|
-
resp.on('error', this.onError);
|
|
64
|
-
req.on('error', this.onError).on('data', (chunk) => {
|
|
65
|
-
const index = offset;
|
|
66
|
-
offset += chunk.byteLength;
|
|
67
|
-
if (offset > length) {
|
|
68
|
-
req.removeAllListeners('end');
|
|
69
|
-
req.removeAllListeners('data');
|
|
70
|
-
refuseBadRequest(resp);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
chunk.copy(buf, index);
|
|
74
|
-
}).on('end', () => {
|
|
75
|
-
let input;
|
|
76
|
-
if (offset !== length || buf[0] !== 123 || buf[offset - 1] !== 125) {
|
|
77
|
-
refuseBadRequest(resp);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
input = JSON.parse(buf);
|
|
82
|
-
input.ip = req.socket.address().address;
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
refuseBadRequest(resp);
|
|
86
|
-
this.onError(e);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.onRequest(input, (content) => {
|
|
90
|
-
if (resp.writable) {
|
|
91
|
-
const data = JSON.stringify(content);
|
|
92
|
-
resp.setHeader('content-length', Buffer.byteLength(data));
|
|
93
|
-
resp.end(data);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
async start() {
|
|
99
|
-
if (!this.onError || !this.onRequest) {
|
|
100
|
-
throw new E.E_NO_SERVER_ATTACHED();
|
|
101
|
-
}
|
|
102
|
-
switch (this._status) {
|
|
103
|
-
case EStatus.IDLE:
|
|
104
|
-
this._status = EStatus.STARTING;
|
|
105
|
-
return new Promise((resolve, reject) => {
|
|
106
|
-
this._server.listen(this.port, this.host, this._backlog)
|
|
107
|
-
.once('listening', () => {
|
|
108
|
-
this._server.removeAllListeners('error');
|
|
109
|
-
this._status = EStatus.WORKING;
|
|
110
|
-
if (this.port === 0) {
|
|
111
|
-
this.port = this._server.address().port;
|
|
112
|
-
}
|
|
113
|
-
resolve();
|
|
114
|
-
})
|
|
115
|
-
.once('error', (e) => {
|
|
116
|
-
this._server.removeAllListeners('listening');
|
|
117
|
-
this._status = EStatus.IDLE;
|
|
118
|
-
reject(e);
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
case EStatus.STARTING:
|
|
122
|
-
throw new E.E_GATEWAY_STARTING();
|
|
123
|
-
case EStatus.CLOSING:
|
|
124
|
-
throw new E.E_GATEWAY_CLOSING();
|
|
125
|
-
case EStatus.WORKING:
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
async close() {
|
|
130
|
-
switch (this._status) {
|
|
131
|
-
case EStatus.IDLE:
|
|
132
|
-
return;
|
|
133
|
-
case EStatus.STARTING:
|
|
134
|
-
throw new E.E_GATEWAY_STARTING();
|
|
135
|
-
case EStatus.CLOSING:
|
|
136
|
-
throw new E.E_GATEWAY_CLOSING();
|
|
137
|
-
case EStatus.WORKING:
|
|
138
|
-
return new Promise((resolve) => {
|
|
139
|
-
this._server.close(() => { resolve(); });
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function createHttpGateway(host, port, backlog) {
|
|
145
|
-
return new HttpGateway(host, port, backlog);
|
|
146
|
-
}
|
|
147
|
-
exports.createHttpGateway = createHttpGateway;
|
|
148
|
-
//# sourceMappingURL=Http.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Http.js","sourceRoot":"","sources":["../../../src/lib/Server/Gateways/Http.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,kCAAkC;AAClC,+BAA+B;AAC/B,8BAA8B;AAE9B,IAAK,OAMJ;AAND,WAAK,OAAO;IAER,qCAAI,CAAA;IACJ,6CAAQ,CAAA;IACR,2CAAO,CAAA;IACP,2CAAO,CAAA;AACX,CAAC,EANI,OAAO,KAAP,OAAO,QAMX;AAED,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC;AAE3H,SAAS,gBAAgB,CAAC,IAA0B;IAEhD,IAAI;QAEA,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;YAChB,gBAAgB,EAAE,wBAAwB,CAAC,UAAU;SACxD,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,MAAO,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,EAAE,CAAC;KACpB;IACD,WAAM;QAEF,cAAc;KACjB;AACL,CAAC;AAED,MAAM,WAAW;I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KAAK,OAAO,CAAC,IAAI;gBACb,OAAO;YACX,KAAK,OAAO,CAAC,QAAQ;gBACjB,MAAM,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;YACrC,KAAK,OAAO,CAAC,OAAO;gBAChB,MAAM,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;YACpC,KAAK,OAAO,CAAC,OAAO;gBAChB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;oBAE3B,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,CAAC,CAAC,CAAC;SACV;IACL,CAAC;CACJ;AAED,SAAgB,iBAAiB,CAAC,IAAY,EAAE,IAAY,EAAE,OAAgB;IAE1E,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAHD,8CAGC"}
|
|
@@ -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
|
-
import * as C from '../Common';
|
|
17
|
-
/**
|
|
18
|
-
* Create a gateway of TCP-base televoke/1 protocol.
|
|
19
|
-
*
|
|
20
|
-
* @deprecated This legacy TCP-based televoke/1 protocol is no longer maintained, and will be removed in v2.0.0
|
|
21
|
-
*/
|
|
22
|
-
export declare function createTCPGateway(host: string, port: number, backlog?: number): C.IGateway;
|
|
23
|
-
//# sourceMappingURL=TCP.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TCP.d.ts","sourceRoot":"","sources":["../../../src/lib/Server/Gateways/TCP.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,WAAW,CAAC;AAoM/B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,CAGzF"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2021 Angus.Fenying <fenying@litert.org>
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createTCPGateway = void 0;
|
|
19
|
-
const E = require("../Errors");
|
|
20
|
-
const $Net = require("net");
|
|
21
|
-
const Encoder_1 = require("../../Encoder/Encoder");
|
|
22
|
-
const Decoder_1 = require("../../Encoder/Decoder");
|
|
23
|
-
var EStatus;
|
|
24
|
-
(function (EStatus) {
|
|
25
|
-
EStatus[EStatus["IDLE"] = 0] = "IDLE";
|
|
26
|
-
EStatus[EStatus["STARTING"] = 1] = "STARTING";
|
|
27
|
-
EStatus[EStatus["WORKING"] = 2] = "WORKING";
|
|
28
|
-
EStatus[EStatus["CLOSING"] = 3] = "CLOSING";
|
|
29
|
-
})(EStatus || (EStatus = {}));
|
|
30
|
-
var EClientStatus;
|
|
31
|
-
(function (EClientStatus) {
|
|
32
|
-
EClientStatus[EClientStatus["WORKING"] = 0] = "WORKING";
|
|
33
|
-
EClientStatus[EClientStatus["CLOSING"] = 1] = "CLOSING";
|
|
34
|
-
})(EClientStatus || (EClientStatus = {}));
|
|
35
|
-
class TCPGateway {
|
|
36
|
-
constructor(host, port, _backlog) {
|
|
37
|
-
this.host = host;
|
|
38
|
-
this.port = port;
|
|
39
|
-
this._backlog = _backlog;
|
|
40
|
-
this._socket = $Net.createServer(this._onConnect.bind(this));
|
|
41
|
-
this._status = EStatus.IDLE;
|
|
42
|
-
this._clients = {};
|
|
43
|
-
this._clientIdCounter = 0;
|
|
44
|
-
}
|
|
45
|
-
_onConnect(socket) {
|
|
46
|
-
const clientId = this._clientIdCounter++;
|
|
47
|
-
const encoder = (0, Encoder_1.createEncoder)();
|
|
48
|
-
const decoder = (0, Decoder_1.createDecoder)();
|
|
49
|
-
const client = {
|
|
50
|
-
decoder,
|
|
51
|
-
socket,
|
|
52
|
-
status: EClientStatus.WORKING,
|
|
53
|
-
loads: 0
|
|
54
|
-
};
|
|
55
|
-
decoder.onLogicError = decoder.onProtocolError = (e) => {
|
|
56
|
-
delete this._clients[clientId];
|
|
57
|
-
socket.destroy();
|
|
58
|
-
this.onError(e);
|
|
59
|
-
};
|
|
60
|
-
decoder.onData = (data) => {
|
|
61
|
-
client.loads++;
|
|
62
|
-
data.ip = socket.address().address;
|
|
63
|
-
this.onRequest(data, (content) => {
|
|
64
|
-
if (socket.writable) {
|
|
65
|
-
encoder.encode(socket, content);
|
|
66
|
-
}
|
|
67
|
-
if (!--client.loads && client.status === EClientStatus.CLOSING) {
|
|
68
|
-
socket.end();
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
this._clients[clientId] = client;
|
|
73
|
-
socket.on('data', decoder.decode.bind(decoder)).on('end', () => {
|
|
74
|
-
client.status = EClientStatus.CLOSING;
|
|
75
|
-
delete this._clients[clientId];
|
|
76
|
-
}).on('error', this.onError).on('close', () => delete this._clients[clientId]);
|
|
77
|
-
}
|
|
78
|
-
async start() {
|
|
79
|
-
if (!this.onError || !this.onRequest) {
|
|
80
|
-
throw new E.E_NO_SERVER_ATTACHED();
|
|
81
|
-
}
|
|
82
|
-
switch (this._status) {
|
|
83
|
-
case EStatus.IDLE:
|
|
84
|
-
this._status = EStatus.STARTING;
|
|
85
|
-
return new Promise((resolve, reject) => {
|
|
86
|
-
this._socket.listen(this.port, this.host, this._backlog)
|
|
87
|
-
.once('listening', () => {
|
|
88
|
-
this._socket.removeAllListeners('error');
|
|
89
|
-
this._status = EStatus.WORKING;
|
|
90
|
-
if (this.port === 0) {
|
|
91
|
-
this.port = this._socket.address().port;
|
|
92
|
-
}
|
|
93
|
-
resolve();
|
|
94
|
-
})
|
|
95
|
-
.once('error', (e) => {
|
|
96
|
-
this._socket.removeAllListeners('listening');
|
|
97
|
-
this._status = EStatus.IDLE;
|
|
98
|
-
reject(e);
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
case EStatus.STARTING:
|
|
102
|
-
throw new E.E_GATEWAY_STARTING();
|
|
103
|
-
case EStatus.CLOSING:
|
|
104
|
-
throw new E.E_GATEWAY_CLOSING();
|
|
105
|
-
case EStatus.WORKING:
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async close() {
|
|
110
|
-
switch (this._status) {
|
|
111
|
-
case EStatus.IDLE:
|
|
112
|
-
return;
|
|
113
|
-
case EStatus.STARTING:
|
|
114
|
-
throw new E.E_GATEWAY_STARTING();
|
|
115
|
-
case EStatus.CLOSING:
|
|
116
|
-
throw new E.E_GATEWAY_CLOSING();
|
|
117
|
-
case EStatus.WORKING:
|
|
118
|
-
return new Promise((resolve) => {
|
|
119
|
-
this._socket.close(() => { resolve(); });
|
|
120
|
-
for (const clientId in this._clients) {
|
|
121
|
-
this._closeClient(clientId);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
_closeClient(clientId) {
|
|
127
|
-
if (this._clients[clientId].loads) {
|
|
128
|
-
this._clients[clientId].decoder.onData = () => void 0;
|
|
129
|
-
this._clients[clientId].status = EClientStatus.CLOSING;
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
this._clients[clientId].socket.end();
|
|
133
|
-
}
|
|
134
|
-
delete this._clients[clientId];
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Create a gateway of TCP-base televoke/1 protocol.
|
|
139
|
-
*
|
|
140
|
-
* @deprecated This legacy TCP-based televoke/1 protocol is no longer maintained, and will be removed in v2.0.0
|
|
141
|
-
*/
|
|
142
|
-
function createTCPGateway(host, port, backlog) {
|
|
143
|
-
return new TCPGateway(host, port, backlog);
|
|
144
|
-
}
|
|
145
|
-
exports.createTCPGateway = createTCPGateway;
|
|
146
|
-
//# sourceMappingURL=TCP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TCP.js","sourceRoot":"","sources":["../../../src/lib/Server/Gateways/TCP.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,+BAA+B;AAC/B,4BAA4B;AAC5B,mDAAsD;AACtD,mDAAsD;AAEtD,IAAK,OAMJ;AAND,WAAK,OAAO;IAER,qCAAI,CAAA;IACJ,6CAAQ,CAAA;IACR,2CAAO,CAAA;IACP,2CAAO,CAAA;AACX,CAAC,EANI,OAAO,KAAP,OAAO,QAMX;AAED,IAAK,aAIJ;AAJD,WAAK,aAAa;IAEd,uDAAO,CAAA;IACP,uDAAO,CAAA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AG,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;oBAEzC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE;wBAElC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;qBAC/B;gBACL,CAAC,CAAC,CAAC;SACV;IACL,CAAC;IAEO,YAAY,CAAC,QAAyB;QAE1C,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE;YAE/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YACtD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC;SAC1D;aACI;YAED,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;SACxC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACJ;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAY,EAAE,IAAY,EAAE,OAAgB;IAEzE,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAHD,4CAGC"}
|
package/lib/Server/Server.d.ts
DELETED
|
@@ -1,18 +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
|
-
import * as C from './Common';
|
|
17
|
-
export declare function createServer(): C.IServer;
|
|
18
|
-
//# sourceMappingURL=Server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../src/lib/Server/Server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAwP9B,wBAAgB,YAAY,IAAI,CAAC,CAAC,OAAO,CAGxC"}
|