fix(core): implement basic functionality

This commit is contained in:
Philipp Kunz 2020-12-26 18:14:19 +00:00
parent 07655937f6
commit 09cd4c3feb
6 changed files with 312 additions and 303 deletions

396
package-lock.json generated
View File

@ -5,9 +5,9 @@
"requires": true,
"dependencies": {
"@apiglobal/typedrequest": {
"version": "1.0.55",
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.55.tgz",
"integrity": "sha512-MAtZNH0PTy0k312IAMBUdS3bM3K7WXP/+K76WZ3qOwFVF7uDpHCqsa/xTKLVuoNGatc2ybRxiecBbb0BOS/QoQ==",
"version": "1.0.56",
"resolved": "https://verdaccio.lossless.one/@apiglobal%2ftypedrequest/-/typedrequest-1.0.56.tgz",
"integrity": "sha512-FH5bY8t1XqdPL2gXzlIydmzpv0BV8WWCAQVyWIM7kqQ/j0EI5sgoCkqYFFh/FWrsvPBx7qM288zC157Btwcycg==",
"requires": {
"@apiglobal/typedrequest-interfaces": "^1.0.15",
"@pushrocks/isounique": "^1.0.4",
@ -1954,25 +1954,25 @@
}
},
"@pushrocks/smartsocket": {
"version": "1.1.68",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.1.68.tgz",
"integrity": "sha512-7VLd5oAffdHJ+ODxxvETlqhbdeT66Zyxb0TM1Pun+lBZgaqN4jdnBLQDakO/LjPcNSAmvg/kH/GvlWlF6R7SAg==",
"version": "1.2.0",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.2.0.tgz",
"integrity": "sha512-jveC4DrfcC6FQuNi0j3MIrrSblN3afxcCZcR1dP6rNDTZYdBVQ4nVlfX0yH9ba/ZIa1mDK66ZdNQ96cP3FdRZA==",
"requires": {
"@apiglobal/typedrequest-interfaces": "^1.0.15",
"@pushrocks/isohash": "^1.0.2",
"@pushrocks/isounique": "^1.0.4",
"@pushrocks/lik": "^4.0.17",
"@pushrocks/lik": "^4.0.20",
"@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartenv": "^4.0.15",
"@pushrocks/smartexpress": "^3.0.76",
"@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartexpress": "^3.0.99",
"@pushrocks/smartlog": "^2.0.39",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartpromise": "^3.1.3",
"@pushrocks/smartrx": "^2.0.19",
"@pushrocks/smarttime": "^3.0.35",
"@types/socket.io": "^2.1.11",
"@types/socket.io-client": "^1.4.33",
"socket.io": "^2.3.0",
"socket.io-client": "^2.3.0"
"@pushrocks/smarttime": "^3.0.37",
"@types/socket.io": "^2.1.12",
"@types/socket.io-client": "^1.4.34",
"socket.io": "^3.0.4",
"socket.io-client": "^3.0.4"
}
},
"@pushrocks/smartstring": {
@ -2216,6 +2216,11 @@
}
}
},
"@types/component-emitter": {
"version": "1.2.10",
"resolved": "https://verdaccio.lossless.one/@types%2fcomponent-emitter/-/component-emitter-1.2.10.tgz",
"integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg=="
},
"@types/connect": {
"version": "3.4.34",
"resolved": "https://verdaccio.lossless.one/@types%2fconnect/-/connect-3.4.34.tgz",
@ -2224,6 +2229,11 @@
"@types/node": "*"
}
},
"@types/cookie": {
"version": "0.4.0",
"resolved": "https://verdaccio.lossless.one/@types%2fcookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-y7mImlc/rNkvCRmg8gC3/lj87S7pTUIJ6QGjwHR9WQJcFs+ZMTOaoPrkdFA/YdbuqVEmEbb5RdhVxMkAcgOnpg=="
},
"@types/cors": {
"version": "2.8.9",
"resolved": "https://verdaccio.lossless.one/@types%2fcors/-/cors-2.8.9.tgz",
@ -2349,9 +2359,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/node": {
"version": "14.14.14",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.14.tgz",
"integrity": "sha512-UHnOPWVWV1z+VV8k6L1HhG7UbGBgIdghqF3l9Ny9ApPghbjICXkUJSd/b9gOgQfjM1r+37cipdw/HJ3F6ICEnQ=="
"version": "14.14.16",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.16.tgz",
"integrity": "sha512-naXYePhweTi+BMv11TgioE2/FXU4fSl29HAH1ffxVciNsH3rYXjNP2yM8wqmSm7jS20gM8TIklKiTen+1iVncw=="
},
"@types/parcel-bundler": {
"version": "1.12.1",
@ -2537,11 +2547,6 @@
"integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==",
"dev": true
},
"after": {
"version": "0.8.2",
"resolved": "https://verdaccio.lossless.one/after/-/after-0.8.2.tgz",
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8="
},
"agent-base": {
"version": "4.3.0",
"resolved": "https://verdaccio.lossless.one/agent-base/-/agent-base-4.3.0.tgz",
@ -2679,11 +2684,6 @@
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
"dev": true
},
"arraybuffer.slice": {
"version": "0.0.7",
"resolved": "https://verdaccio.lossless.one/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz",
"integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog=="
},
"asn1": {
"version": "0.2.4",
"resolved": "https://verdaccio.lossless.one/asn1/-/asn1-0.2.4.tgz",
@ -2766,7 +2766,8 @@
"async-limiter": {
"version": "1.0.1",
"resolved": "https://verdaccio.lossless.one/async-limiter/-/async-limiter-1.0.1.tgz",
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
"integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==",
"dev": true
},
"asynckit": {
"version": "0.4.0",
@ -2944,14 +2945,6 @@
"tweetnacl": "^0.14.3"
}
},
"better-assert": {
"version": "1.0.2",
"resolved": "https://verdaccio.lossless.one/better-assert/-/better-assert-1.0.2.tgz",
"integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=",
"requires": {
"callsite": "1.0.0"
}
},
"binary-extensions": {
"version": "1.13.1",
"resolved": "https://verdaccio.lossless.one/binary-extensions/-/binary-extensions-1.13.1.tgz",
@ -2967,11 +2960,6 @@
"file-uri-to-path": "1.0.0"
}
},
"blob": {
"version": "0.0.5",
"resolved": "https://verdaccio.lossless.one/blob/-/blob-0.0.5.tgz",
"integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig=="
},
"bn.js": {
"version": "5.1.3",
"resolved": "https://verdaccio.lossless.one/bn.js/-/bn.js-5.1.3.tgz",
@ -3373,11 +3361,6 @@
"caller-callsite": "^2.0.0"
}
},
"callsite": {
"version": "1.0.0",
"resolved": "https://verdaccio.lossless.one/callsite/-/callsite-1.0.0.tgz",
"integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA="
},
"callsites": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/callsites/-/callsites-2.0.0.tgz",
@ -3729,11 +3712,6 @@
"resolved": "https://verdaccio.lossless.one/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
},
"component-inherit": {
"version": "0.0.3",
"resolved": "https://verdaccio.lossless.one/component-inherit/-/component-inherit-0.0.3.tgz",
"integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM="
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://verdaccio.lossless.one/concat-map/-/concat-map-0.0.1.tgz",
@ -4721,22 +4699,23 @@
}
},
"engine.io": {
"version": "3.4.2",
"resolved": "https://verdaccio.lossless.one/engine.io/-/engine.io-3.4.2.tgz",
"integrity": "sha512-b4Q85dFkGw+TqgytGPrGgACRUhsdKc9S9ErRAXpPGy/CXKs4tYoHDkvIRdsseAF7NjfVwjRFIn6KTnbw7LwJZg==",
"version": "4.0.5",
"resolved": "https://verdaccio.lossless.one/engine.io/-/engine.io-4.0.5.tgz",
"integrity": "sha512-Ri+whTNr2PKklxQkfbGjwEo+kCBUM4Qxk4wtLqLrhH+b1up2NFL9g9pjYWiCV/oazwB0rArnvF/ZmZN2ab5Hpg==",
"requires": {
"accepts": "~1.3.4",
"base64id": "2.0.0",
"cookie": "0.3.1",
"cookie": "~0.4.1",
"cors": "~2.8.5",
"debug": "~4.1.0",
"engine.io-parser": "~2.2.0",
"engine.io-parser": "~4.0.0",
"ws": "^7.1.2"
},
"dependencies": {
"cookie": {
"version": "0.3.1",
"resolved": "https://verdaccio.lossless.one/cookie/-/cookie-0.3.1.tgz",
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
"version": "0.4.1",
"resolved": "https://verdaccio.lossless.one/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
},
"debug": {
"version": "4.1.1",
@ -4754,66 +4733,43 @@
}
},
"engine.io-client": {
"version": "3.4.4",
"resolved": "https://verdaccio.lossless.one/engine.io-client/-/engine.io-client-3.4.4.tgz",
"integrity": "sha512-iU4CRr38Fecj8HoZEnFtm2EiKGbYZcPn3cHxqNGl/tmdWRf60KhK+9vE0JeSjgnlS/0oynEfLgKbT9ALpim0sQ==",
"version": "4.0.5",
"resolved": "https://verdaccio.lossless.one/engine.io-client/-/engine.io-client-4.0.5.tgz",
"integrity": "sha512-1lkn0QdekHQPMTcxUh8LqIuxQHNtKV5GvqkQzmZ1rYKAvB6puMm13U7K1ps3OQZ4joE46asQiAKrcdL9weNEVw==",
"requires": {
"base64-arraybuffer": "0.1.4",
"component-emitter": "~1.3.0",
"component-inherit": "0.0.3",
"debug": "~3.1.0",
"engine.io-parser": "~2.2.0",
"debug": "~4.1.0",
"engine.io-parser": "~4.0.1",
"has-cors": "1.1.0",
"indexof": "0.0.1",
"parseqs": "0.0.6",
"parseuri": "0.0.6",
"ws": "~6.1.0",
"ws": "~7.2.1",
"xmlhttprequest-ssl": "~1.5.4",
"yeast": "0.1.2"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://verdaccio.lossless.one/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"version": "4.1.1",
"resolved": "https://verdaccio.lossless.one/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "2.0.0"
"ms": "^2.1.1"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"parseqs": {
"version": "0.0.6",
"resolved": "https://verdaccio.lossless.one/parseqs/-/parseqs-0.0.6.tgz",
"integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w=="
},
"parseuri": {
"version": "0.0.6",
"resolved": "https://verdaccio.lossless.one/parseuri/-/parseuri-0.0.6.tgz",
"integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow=="
},
"ws": {
"version": "6.1.4",
"resolved": "https://verdaccio.lossless.one/ws/-/ws-6.1.4.tgz",
"integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==",
"requires": {
"async-limiter": "~1.0.0"
}
"version": "7.2.5",
"resolved": "https://verdaccio.lossless.one/ws/-/ws-7.2.5.tgz",
"integrity": "sha512-C34cIU4+DB2vMyAbmEKossWq2ZQDr6QEyuuCzWrM9zfw1sGc0mYiJ0UnG9zzNykt49C2Fi34hvr2vssFQRS6EA=="
}
}
},
"engine.io-parser": {
"version": "2.2.1",
"resolved": "https://verdaccio.lossless.one/engine.io-parser/-/engine.io-parser-2.2.1.tgz",
"integrity": "sha512-x+dN/fBH8Ro8TFwJ+rkB2AmuVw9Yu2mockR/p3W8f8YtExwFgDvBDi0GWyb4ZLkpahtDGZgtr3zLovanJghPqg==",
"version": "4.0.2",
"resolved": "https://verdaccio.lossless.one/engine.io-parser/-/engine.io-parser-4.0.2.tgz",
"integrity": "sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg==",
"requires": {
"after": "0.8.2",
"arraybuffer.slice": "~0.0.7",
"base64-arraybuffer": "0.1.4",
"blob": "0.0.5",
"has-binary2": "~1.0.2"
"base64-arraybuffer": "0.1.4"
}
},
"entities": {
@ -6283,21 +6239,6 @@
}
}
},
"has-binary2": {
"version": "1.0.3",
"resolved": "https://verdaccio.lossless.one/has-binary2/-/has-binary2-1.0.3.tgz",
"integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==",
"requires": {
"isarray": "2.0.1"
},
"dependencies": {
"isarray": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/isarray/-/isarray-2.0.1.tgz",
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
}
}
},
"has-cors": {
"version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/has-cors/-/has-cors-1.1.0.tgz",
@ -6647,11 +6588,6 @@
"integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=",
"dev": true
},
"indexof": {
"version": "0.0.1",
"resolved": "https://verdaccio.lossless.one/indexof/-/indexof-0.0.1.tgz",
"integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10="
},
"inflight": {
"version": "1.0.6",
"resolved": "https://verdaccio.lossless.one/inflight/-/inflight-1.0.6.tgz",
@ -7840,11 +7776,6 @@
"resolved": "https://verdaccio.lossless.one/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"object-component": {
"version": "0.0.3",
"resolved": "https://verdaccio.lossless.one/object-component/-/object-component-0.0.3.tgz",
"integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE="
},
"object-copy": {
"version": "0.1.0",
"resolved": "https://verdaccio.lossless.one/object-copy/-/object-copy-0.1.0.tgz",
@ -8190,20 +8121,14 @@
"dev": true
},
"parseqs": {
"version": "0.0.5",
"resolved": "https://verdaccio.lossless.one/parseqs/-/parseqs-0.0.5.tgz",
"integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=",
"requires": {
"better-assert": "~1.0.0"
}
"version": "0.0.6",
"resolved": "https://verdaccio.lossless.one/parseqs/-/parseqs-0.0.6.tgz",
"integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w=="
},
"parseuri": {
"version": "0.0.5",
"resolved": "https://verdaccio.lossless.one/parseuri/-/parseuri-0.0.5.tgz",
"integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=",
"requires": {
"better-assert": "~1.0.0"
}
"version": "0.0.6",
"resolved": "https://verdaccio.lossless.one/parseuri/-/parseuri-0.0.6.tgz",
"integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow=="
},
"parseurl": {
"version": "1.3.3",
@ -9951,28 +9876,21 @@
}
},
"socket.io": {
"version": "2.3.0",
"resolved": "https://verdaccio.lossless.one/socket.io/-/socket.io-2.3.0.tgz",
"integrity": "sha512-2A892lrj0GcgR/9Qk81EaY2gYhCBxurV0PfmmESO6p27QPrUK1J3zdns+5QPqvUYK2q657nSj0guoIil9+7eFg==",
"version": "3.0.4",
"resolved": "https://verdaccio.lossless.one/socket.io/-/socket.io-3.0.4.tgz",
"integrity": "sha512-Vj1jUoO75WGc9txWd311ZJJqS9Dr8QtNJJ7gk2r7dcM/yGe9sit7qOijQl3GAwhpBOz/W8CwkD7R6yob07nLbA==",
"requires": {
"@types/cookie": "^0.4.0",
"@types/cors": "^2.8.8",
"@types/node": "^14.14.7",
"accepts": "~1.3.4",
"base64id": "~2.0.0",
"debug": "~4.1.0",
"engine.io": "~3.4.0",
"has-binary2": "~1.0.2",
"socket.io-adapter": "~1.1.0",
"socket.io-client": "2.3.0",
"socket.io-parser": "~3.4.0"
"engine.io": "~4.0.0",
"socket.io-adapter": "~2.0.3",
"socket.io-parser": "~4.0.1"
},
"dependencies": {
"base64-arraybuffer": {
"version": "0.1.5",
"resolved": "https://verdaccio.lossless.one/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz",
"integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg="
},
"component-emitter": {
"version": "1.2.1",
"resolved": "https://verdaccio.lossless.one/component-emitter/-/component-emitter-1.2.1.tgz",
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY="
},
"debug": {
"version": "4.1.1",
"resolved": "https://verdaccio.lossless.one/debug/-/debug-4.1.1.tgz",
@ -9980,145 +9898,49 @@
"requires": {
"ms": "^2.1.1"
}
},
"isarray": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/isarray/-/isarray-2.0.1.tgz",
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
},
"socket.io-client": {
"version": "2.3.0",
"resolved": "https://verdaccio.lossless.one/socket.io-client/-/socket.io-client-2.3.0.tgz",
"integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==",
"requires": {
"backo2": "1.0.2",
"base64-arraybuffer": "0.1.5",
"component-bind": "1.0.0",
"component-emitter": "1.2.1",
"debug": "~4.1.0",
"engine.io-client": "~3.4.0",
"has-binary2": "~1.0.2",
"has-cors": "1.1.0",
"indexof": "0.0.1",
"object-component": "0.0.3",
"parseqs": "0.0.5",
"parseuri": "0.0.5",
"socket.io-parser": "~3.3.0",
"to-array": "0.1.4"
},
"dependencies": {
"ms": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"socket.io-parser": {
"version": "3.3.1",
"resolved": "https://verdaccio.lossless.one/socket.io-parser/-/socket.io-parser-3.3.1.tgz",
"integrity": "sha512-1QLvVAe8dTz+mKmZ07Swxt+LAo4Y1ff50rlyoEx00TQmDFVQYPfcqGvIDJLGaBdhdNCecXtyKpD+EgKGcmmbuQ==",
"requires": {
"component-emitter": "~1.3.0",
"debug": "~3.1.0",
"isarray": "2.0.1"
},
"dependencies": {
"component-emitter": {
"version": "1.3.0",
"resolved": "https://verdaccio.lossless.one/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
},
"debug": {
"version": "3.1.0",
"resolved": "https://verdaccio.lossless.one/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
}
}
}
}
}
}
},
"socket.io-adapter": {
"version": "1.1.2",
"resolved": "https://verdaccio.lossless.one/socket.io-adapter/-/socket.io-adapter-1.1.2.tgz",
"integrity": "sha512-WzZRUj1kUjrTIrUKpZLEzFZ1OLj5FwLlAFQs9kuZJzJi5DKdU7FsWc36SNmA8iDOtwBQyT8FkrriRM8vXLYz8g=="
"version": "2.0.3",
"resolved": "https://verdaccio.lossless.one/socket.io-adapter/-/socket.io-adapter-2.0.3.tgz",
"integrity": "sha512-2wo4EXgxOGSFueqvHAdnmi5JLZzWqMArjuP4nqC26AtLh5PoCPsaRbRdah2xhcwTAMooZfjYiNVNkkmmSMaxOQ=="
},
"socket.io-client": {
"version": "2.3.1",
"resolved": "https://verdaccio.lossless.one/socket.io-client/-/socket.io-client-2.3.1.tgz",
"integrity": "sha512-YXmXn3pA8abPOY//JtYxou95Ihvzmg8U6kQyolArkIyLd0pgVhrfor/iMsox8cn07WCOOvvuJ6XKegzIucPutQ==",
"version": "3.0.4",
"resolved": "https://verdaccio.lossless.one/socket.io-client/-/socket.io-client-3.0.4.tgz",
"integrity": "sha512-qMvBuS+W9JIN2mkfAWDCxuIt+jpIKDf8C0604zEqx1JrPaPSS6cN0F3B2GYWC83TqBeVJXW66GFxWV3KD88n0Q==",
"requires": {
"@types/component-emitter": "^1.2.10",
"backo2": "1.0.2",
"component-bind": "1.0.0",
"component-emitter": "~1.3.0",
"debug": "~3.1.0",
"engine.io-client": "~3.4.0",
"has-binary2": "~1.0.2",
"indexof": "0.0.1",
"parseqs": "0.0.6",
"parseuri": "0.0.6",
"socket.io-parser": "~3.3.0",
"to-array": "0.1.4"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://verdaccio.lossless.one/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"isarray": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/isarray/-/isarray-2.0.1.tgz",
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
},
"ms": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"parseqs": {
"version": "0.0.6",
"resolved": "https://verdaccio.lossless.one/parseqs/-/parseqs-0.0.6.tgz",
"integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w=="
},
"parseuri": {
"version": "0.0.6",
"resolved": "https://verdaccio.lossless.one/parseuri/-/parseuri-0.0.6.tgz",
"integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow=="
},
"socket.io-parser": {
"version": "3.3.1",
"resolved": "https://verdaccio.lossless.one/socket.io-parser/-/socket.io-parser-3.3.1.tgz",
"integrity": "sha512-1QLvVAe8dTz+mKmZ07Swxt+LAo4Y1ff50rlyoEx00TQmDFVQYPfcqGvIDJLGaBdhdNCecXtyKpD+EgKGcmmbuQ==",
"requires": {
"component-emitter": "~1.3.0",
"debug": "~3.1.0",
"isarray": "2.0.1"
}
}
}
},
"socket.io-parser": {
"version": "3.4.1",
"resolved": "https://verdaccio.lossless.one/socket.io-parser/-/socket.io-parser-3.4.1.tgz",
"integrity": "sha512-11hMgzL+WCLWf1uFtHSNvliI++tcRUWdoeYuwIl+Axvwy9z2gQM+7nJyN3STj1tLj5JyIUH8/gpDGxzAlDdi0A==",
"requires": {
"component-emitter": "1.2.1",
"debug": "~4.1.0",
"isarray": "2.0.1"
"engine.io-client": "~4.0.0",
"parseuri": "0.0.6",
"socket.io-parser": "~4.0.1"
},
"dependencies": {
"debug": {
"version": "4.1.1",
"resolved": "https://verdaccio.lossless.one/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "^2.1.1"
}
}
}
},
"socket.io-parser": {
"version": "4.0.2",
"resolved": "https://verdaccio.lossless.one/socket.io-parser/-/socket.io-parser-4.0.2.tgz",
"integrity": "sha512-Bs3IYHDivwf+bAAuW/8xwJgIiBNtlvnjYRc4PbXgniLmcP1BrakBoq/QhO24rgtgW7VZ7uAaswRGxutUnlAK7g==",
"requires": {
"@types/component-emitter": "^1.2.10",
"component-emitter": "~1.3.0",
"debug": "~4.1.0"
},
"dependencies": {
"component-emitter": {
"version": "1.2.1",
"resolved": "https://verdaccio.lossless.one/component-emitter/-/component-emitter-1.2.1.tgz",
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY="
},
"debug": {
"version": "4.1.1",
"resolved": "https://verdaccio.lossless.one/debug/-/debug-4.1.1.tgz",
@ -10126,11 +9948,6 @@
"requires": {
"ms": "^2.1.1"
}
},
"isarray": {
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/isarray/-/isarray-2.0.1.tgz",
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
}
}
},
@ -10630,11 +10447,6 @@
"integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==",
"dev": true
},
"to-array": {
"version": "0.1.4",
"resolved": "https://verdaccio.lossless.one/to-array/-/to-array-0.1.4.tgz",
"integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA="
},
"to-arraybuffer": {
"version": "1.0.1",
"resolved": "https://verdaccio.lossless.one/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz",

View File

@ -16,13 +16,15 @@
"@gitzone/tsbundle": "^1.0.78",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.11.2",
"@types/node": "^14.14.16",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@apiglobal/typedrequest": "^1.0.55",
"@pushrocks/smartsocket": "^1.1.68"
"@apiglobal/typedrequest": "^1.0.56",
"@apiglobal/typedrequest-interfaces": "^1.0.15",
"@pushrocks/isohash": "^1.0.2",
"@pushrocks/smartsocket": "^1.2.0"
},
"browserslist": [
"last 1 chrome versions"

View File

@ -0,0 +1,9 @@
import { tap, expect } from '@pushrocks/tapbundle';
import * as typedsocket from '../ts/index';
tap.test('should create a client', async () => {
console.log('Browser test') // TODO: implement browser tests
});
tap.start();

View File

@ -1,10 +1,48 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as typedrequest from '@apiglobal/typedrequest';
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
import * as typedsocket from '../ts/index';
import { request } from 'http';
let testTypedSocket: typedsocket.TypedSocket;
interface IRequest_Client_Server extends typedrequestInterfaces.implementsTR<
typedrequestInterfaces.ITypedRequest,
IRequest_Client_Server
> {
method: 'sayhi';
request: {
greeting: string;
};
response: {
answer: string
}
}
tap.test('first test', async () => {
testTypedSocket = new typedsocket.TypedSocket();
let testTypedSocketServer: typedsocket.TypedSocket;
let testTypedSocketClient: typedsocket.TypedSocket;
const testTypedRouter = new typedrequest.TypedRouter();
tap.test('should add some handlers', async () => {
testTypedRouter.addTypedHandler<IRequest_Client_Server>(new typedrequest.TypedHandler('sayhi', async requestData => {
return {
answer: `ok, got it : ${requestData.greeting}`
}
}));
})
tap.test('first test', async (tools) => {
testTypedSocketServer = await typedsocket.TypedSocket.createServer(testTypedRouter);
testTypedSocketClient = await typedsocket.TypedSocket.createClient(testTypedRouter, 'http://localhost');
});
tap.test('should run without problems for a little bit', async tools => {
await tools.delayFor(5000);
})
tap.test('should disconnect', async () => {
await testTypedSocketClient.stop();
await testTypedSocketServer.stop();
})
tap.start();

View File

@ -1,9 +1,153 @@
import * as plugins from './typedsocket.plugins';
const publicRoleName = 'publicRoleName';
const publicRolePass = 'publicRolePass';
export class TypedSocket {
public static async createServer () {}
// STATIC
/**
* creates a typedsocket server
* note: this will fail in browser environments as server libs are not bundled.
*/
public static async createServer(
typedrouterArg: plugins.typedrequest.TypedRouter,
smartexpressServerArg?: any
): Promise<TypedSocket> {
const smartsocketServer = new plugins.smartsocket.Smartsocket({
port: 3000,
});
if (smartexpressServerArg) {
smartsocketServer.setExternalServer('smartexpress', smartexpressServerArg);
}
const publicRole = new plugins.smartsocket.SocketRole({
name: publicRoleName,
passwordHash: await plugins.isohash.sha256FromString(publicRolePass),
});
smartsocketServer.addSocketRoles([publicRole]);
smartsocketServer.socketFunctions.add(
new plugins.smartsocket.SocketFunction({
funcName: 'processMessage',
allowedRoles: [publicRole],
funcDef: async (dataArg, socketConnectionArg) => {
return typedrouterArg.routeAndAddResponse(dataArg);
},
})
);
const typedsocket = new TypedSocket(
typedrouterArg,
async <T extends plugins.typedrequestInterfaces.ITypedRequest>(
dataArg: T,
targetConnectionArg?: plugins.smartsocket.SocketConnection
): Promise<T> => {
if (!targetConnectionArg) {
if ((smartsocketServer.socketConnections.getArray().length = 1)) {
console.log(
'Since no targetConnection was supplied and there is only one active one present, choosing that one automatically'
);
targetConnectionArg = smartsocketServer.socketConnections.getArray()[0];
} else {
throw new Error('you need to specify the wanted targetConnection');
}
}
const response: T = (smartsocketServer.clientCall(
'processMessage',
dataArg,
targetConnectionArg
) as any) as T;
return response;
},
smartsocketServer
);
public static createCleint() {}
await smartsocketServer.start();
constructor() {}
}
return typedsocket;
}
public static async createClient(
typedrouterArg: plugins.typedrequest.TypedRouter,
serverUrl: string
): Promise<TypedSocket> {
const smartsocketClient = new plugins.smartsocket.SmartsocketClient({
alias: 'client1',
role: publicRoleName,
password: publicRolePass,
port: 3000,
url: serverUrl,
autoReconnect: true,
});
smartsocketClient.socketFunctions.add(
new plugins.smartsocket.SocketFunction({
funcName: 'processMessage',
allowedRoles: [],
funcDef: async (dataArg, socketConnectionArg) => {
return typedrouterArg.routeAndAddResponse(dataArg);
},
})
);
const typedsocket = new TypedSocket(
typedrouterArg,
async <T extends plugins.typedrequestInterfaces.ITypedRequest>(dataArg: T): Promise<T> => {
const response: T = (smartsocketClient.serverCall('processMessage', dataArg) as any) as T;
return response;
},
smartsocketClient
);
await smartsocketClient.connect();
return typedsocket;
}
// INSTANCE
public typedrouter: plugins.typedrequest.TypedRouter;
private postMethod: plugins.typedrequest.IPostMethod &
((
typedRequestPostObject: plugins.typedrequestInterfaces.ITypedRequest,
socketConnectionArg?: plugins.smartsocket.SocketConnection
) => Promise<plugins.typedrequestInterfaces.ITypedRequest>);
private socketServerOrClient: plugins.smartsocket.Smartsocket | plugins.smartsocket.SmartsocketClient;
constructor(
typedrouterArg: plugins.typedrequest.TypedRouter,
postMethodArg: plugins.typedrequest.IPostMethod,
socketServerOrClientArg: plugins.smartsocket.Smartsocket | plugins.smartsocket.SmartsocketClient
) {
this.typedrouter = typedrouterArg;
this.postMethod = postMethodArg;
this.socketServerOrClient = socketServerOrClientArg;
}
public createTypedRequest<T extends plugins.typedrequestInterfaces.ITypedRequest>(
methodName: T['method'],
targetConnection?: plugins.smartsocket.SocketConnection
): plugins.typedrequest.TypedRequest<T> {
const typedrequest = new plugins.typedrequest.TypedRequest<T>(
new plugins.typedrequest.TypedTarget({
postMethod: async (requestDataArg) => {
const result = await this.postMethod(requestDataArg, targetConnection);
return result;
},
}),
methodName
);
return typedrequest;
}
public async findTargetConnection(
findFuncArg: (connectionArg: plugins.smartsocket.SocketConnection) => boolean
) {
if (this.socketServerOrClient instanceof plugins.smartsocket.Smartsocket) {
for (const socketConnection of this.socketServerOrClient.socketConnections.getArray()) {
if (findFuncArg(socketConnection)) {
return socketConnection;
}
}
} else {
console.warn('this method >>findTargetConnection<< is only available from the server');
}
}
public async stop() {
await this.socketServerOrClient.stop()
}
}

View File

@ -1,13 +1,17 @@
// @apiglobal scope
import * as typedrequest from '@apiglobal/typedrequest';
import * as typedrequestInterfaces from '@apiglobal/typedrequest-interfaces';
export {
typedrequest
typedrequest,
typedrequestInterfaces,
}
// @pushrocks scope
import * as isohash from '@pushrocks/isohash';
import * as smartsocket from '@pushrocks/smartsocket';
export {
isohash,
smartsocket
}