fix(core): update

This commit is contained in:
Philipp Kunz 2022-01-19 18:36:13 +01:00
parent 12d7310b90
commit 9435796333
7 changed files with 26 additions and 286 deletions

281
package-lock.json generated
View File

@ -2620,9 +2620,9 @@
} }
}, },
"node_modules/@pushrocks/smartsocket": { "node_modules/@pushrocks/smartsocket": {
"version": "1.2.14", "version": "1.2.15",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.2.14.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.2.15.tgz",
"integrity": "sha512-X55iqiQhfHCMr4//4zqcmDRvpseXe7liMvJtS77zaEN5YVCYMMOrVDToNWP0fHRAaoRtJvBpvRYqSv5OeapiNA==", "integrity": "sha512-2BEEnqd7h8UHIKSNno91ZyYAqtlWgjyC3OkfyH3k/Q0zcD9D0PiekUXeSl2cvsq7sso/3J9mN8OJEESyh6GxTQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@apiglobal/typedrequest-interfaces": "^1.0.15", "@apiglobal/typedrequest-interfaces": "^1.0.15",
@ -2637,131 +2637,8 @@
"@pushrocks/smartpromise": "^3.1.6", "@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.19", "@pushrocks/smartrx": "^2.0.19",
"@pushrocks/smarttime": "^3.0.43", "@pushrocks/smarttime": "^3.0.43",
"@types/socket.io": "^3.0.2", "socket.io": "^4.4.1",
"@types/socket.io-client": "^3.0.0", "socket.io-client": "^4.4.1"
"socket.io": "^3.1.0",
"socket.io-client": "^3.1.0"
}
},
"node_modules/@pushrocks/smartsocket/node_modules/engine.io": {
"version": "4.1.2",
"resolved": "https://verdaccio.lossless.one/engine.io/-/engine.io-4.1.2.tgz",
"integrity": "sha512-t5z6zjXuVLhXDMiFJPYsPOWEER8B0tIsD3ETgw19S1yg9zryvUfY3Vhtk3Gf4sihw/bQGIqQ//gjvVlu+Ca0bQ==",
"license": "MIT",
"dependencies": {
"accepts": "~1.3.4",
"base64id": "2.0.0",
"cookie": "~0.4.1",
"cors": "~2.8.5",
"debug": "~4.3.1",
"engine.io-parser": "~4.0.0",
"ws": "~7.4.2"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/@pushrocks/smartsocket/node_modules/engine.io-client": {
"version": "4.1.4",
"resolved": "https://verdaccio.lossless.one/engine.io-client/-/engine.io-client-4.1.4.tgz",
"integrity": "sha512-843fqAdKeUMFqKi1sSjnR11tJ4wi8sIefu6+JC1OzkkJBmjtc/gM/rZ53tJfu5Iae/3gApm5veoS+v+gtT0+Fg==",
"license": "MIT",
"dependencies": {
"base64-arraybuffer": "0.1.4",
"component-emitter": "~1.3.0",
"debug": "~4.3.1",
"engine.io-parser": "~4.0.1",
"has-cors": "1.1.0",
"parseqs": "0.0.6",
"parseuri": "0.0.6",
"ws": "~7.4.2",
"xmlhttprequest-ssl": "~1.6.2",
"yeast": "0.1.2"
}
},
"node_modules/@pushrocks/smartsocket/node_modules/engine.io-parser": {
"version": "4.0.3",
"resolved": "https://verdaccio.lossless.one/engine.io-parser/-/engine.io-parser-4.0.3.tgz",
"integrity": "sha512-xEAAY0msNnESNPc00e19y5heTPX4y/TJ36gr8t1voOaNmTojP9b3oK3BbJLFufW2XFPQaaijpFewm2g2Um3uqA==",
"license": "MIT",
"dependencies": {
"base64-arraybuffer": "0.1.4"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@pushrocks/smartsocket/node_modules/socket.io": {
"version": "3.1.2",
"resolved": "https://verdaccio.lossless.one/socket.io/-/socket.io-3.1.2.tgz",
"integrity": "sha512-JubKZnTQ4Z8G4IZWtaAZSiRP3I/inpy8c/Bsx2jrwGrTbKeVU5xd6qkKMHpChYeM3dWZSO0QACiGK+obhBNwYw==",
"license": "MIT",
"dependencies": {
"@types/cookie": "^0.4.0",
"@types/cors": "^2.8.8",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",
"base64id": "~2.0.0",
"debug": "~4.3.1",
"engine.io": "~4.1.0",
"socket.io-adapter": "~2.1.0",
"socket.io-parser": "~4.0.3"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/@pushrocks/smartsocket/node_modules/socket.io-adapter": {
"version": "2.1.0",
"resolved": "https://verdaccio.lossless.one/socket.io-adapter/-/socket.io-adapter-2.1.0.tgz",
"integrity": "sha512-+vDov/aTsLjViYTwS9fPy5pEtTkrbEKsw2M+oVSoFGw6OD1IpvlV1VPhUzNbofCQ8oyMbdYJqDtGdmHQK6TdPg==",
"license": "MIT"
},
"node_modules/@pushrocks/smartsocket/node_modules/socket.io-client": {
"version": "3.1.3",
"resolved": "https://verdaccio.lossless.one/socket.io-client/-/socket.io-client-3.1.3.tgz",
"integrity": "sha512-4sIGOGOmCg3AOgGi7EEr6ZkTZRkrXwub70bBB/F0JSkMOUFpA77WsL87o34DffQQ31PkbMUIadGOk+3tx1KGbw==",
"license": "MIT",
"dependencies": {
"@types/component-emitter": "^1.2.10",
"backo2": "~1.0.2",
"component-emitter": "~1.3.0",
"debug": "~4.3.1",
"engine.io-client": "~4.1.0",
"parseuri": "0.0.6",
"socket.io-parser": "~4.0.4"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/@pushrocks/smartsocket/node_modules/ws": {
"version": "7.4.6",
"resolved": "https://verdaccio.lossless.one/ws/-/ws-7.4.6.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
"license": "MIT",
"engines": {
"node": ">=8.3.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/@pushrocks/smartsocket/node_modules/xmlhttprequest-ssl": {
"version": "1.6.3",
"resolved": "https://verdaccio.lossless.one/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.3.tgz",
"integrity": "sha512-3XfeQE/wNkvrIktn2Kf0869fC0BN6UpydVasGIeSm2B1Llihf7/0UfZM+eCkOw3P7bP4+qPgqhm7ZoxuJtFU0Q==",
"engines": {
"node": ">=0.4.0"
} }
}, },
"node_modules/@pushrocks/smartspawn": { "node_modules/@pushrocks/smartspawn": {
@ -3398,26 +3275,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/socket.io": {
"version": "3.0.2",
"resolved": "https://verdaccio.lossless.one/@types%2fsocket.io/-/socket.io-3.0.2.tgz",
"integrity": "sha512-pu0sN9m5VjCxBZVK8hW37ZcMe8rjn4HHggBN5CbaRTvFwv5jOmuIRZEuddsBPa9Th0ts0SIo3Niukq+95cMBbQ==",
"deprecated": "This is a stub types definition. socket.io provides its own type definitions, so you do not need this installed.",
"license": "MIT",
"dependencies": {
"socket.io": "*"
}
},
"node_modules/@types/socket.io-client": {
"version": "3.0.0",
"resolved": "https://verdaccio.lossless.one/@types%2fsocket.io-client/-/socket.io-client-3.0.0.tgz",
"integrity": "sha512-s+IPvFoEIjKA3RdJz/Z2dGR4gLgysKi8owcnrVwNjgvc01Lk68LJDDsG2GRqegFITcxmvCMYM7bhMpwEMlHmDg==",
"deprecated": "This is a stub types definition. socket.io-client provides its own type definitions, so you do not need this installed.",
"license": "MIT",
"dependencies": {
"socket.io-client": "*"
}
},
"node_modules/@types/through2": { "node_modules/@types/through2": {
"version": "2.0.36", "version": "2.0.36",
"resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz",
@ -4071,14 +3928,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/base64-arraybuffer": {
"version": "0.1.4",
"resolved": "https://verdaccio.lossless.one/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz",
"integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/base64-js": { "node_modules/base64-js": {
"version": "1.5.1", "version": "1.5.1",
"resolved": "https://verdaccio.lossless.one/base64-js/-/base64-js-1.5.1.tgz", "resolved": "https://verdaccio.lossless.one/base64-js/-/base64-js-1.5.1.tgz",
@ -17498,9 +17347,9 @@
} }
}, },
"@pushrocks/smartsocket": { "@pushrocks/smartsocket": {
"version": "1.2.14", "version": "1.2.15",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.2.14.tgz", "resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartsocket/-/smartsocket-1.2.15.tgz",
"integrity": "sha512-X55iqiQhfHCMr4//4zqcmDRvpseXe7liMvJtS77zaEN5YVCYMMOrVDToNWP0fHRAaoRtJvBpvRYqSv5OeapiNA==", "integrity": "sha512-2BEEnqd7h8UHIKSNno91ZyYAqtlWgjyC3OkfyH3k/Q0zcD9D0PiekUXeSl2cvsq7sso/3J9mN8OJEESyh6GxTQ==",
"requires": { "requires": {
"@apiglobal/typedrequest-interfaces": "^1.0.15", "@apiglobal/typedrequest-interfaces": "^1.0.15",
"@pushrocks/isohash": "^1.0.2", "@pushrocks/isohash": "^1.0.2",
@ -17514,97 +17363,8 @@
"@pushrocks/smartpromise": "^3.1.6", "@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.19", "@pushrocks/smartrx": "^2.0.19",
"@pushrocks/smarttime": "^3.0.43", "@pushrocks/smarttime": "^3.0.43",
"@types/socket.io": "^3.0.2", "socket.io": "^4.4.1",
"@types/socket.io-client": "^3.0.0", "socket.io-client": "^4.4.1"
"socket.io": "^3.1.0",
"socket.io-client": "^3.1.0"
},
"dependencies": {
"engine.io": {
"version": "4.1.2",
"resolved": "https://verdaccio.lossless.one/engine.io/-/engine.io-4.1.2.tgz",
"integrity": "sha512-t5z6zjXuVLhXDMiFJPYsPOWEER8B0tIsD3ETgw19S1yg9zryvUfY3Vhtk3Gf4sihw/bQGIqQ//gjvVlu+Ca0bQ==",
"requires": {
"accepts": "~1.3.4",
"base64id": "2.0.0",
"cookie": "~0.4.1",
"cors": "~2.8.5",
"debug": "~4.3.1",
"engine.io-parser": "~4.0.0",
"ws": "~7.4.2"
}
},
"engine.io-client": {
"version": "4.1.4",
"resolved": "https://verdaccio.lossless.one/engine.io-client/-/engine.io-client-4.1.4.tgz",
"integrity": "sha512-843fqAdKeUMFqKi1sSjnR11tJ4wi8sIefu6+JC1OzkkJBmjtc/gM/rZ53tJfu5Iae/3gApm5veoS+v+gtT0+Fg==",
"requires": {
"base64-arraybuffer": "0.1.4",
"component-emitter": "~1.3.0",
"debug": "~4.3.1",
"engine.io-parser": "~4.0.1",
"has-cors": "1.1.0",
"parseqs": "0.0.6",
"parseuri": "0.0.6",
"ws": "~7.4.2",
"xmlhttprequest-ssl": "~1.6.2",
"yeast": "0.1.2"
}
},
"engine.io-parser": {
"version": "4.0.3",
"resolved": "https://verdaccio.lossless.one/engine.io-parser/-/engine.io-parser-4.0.3.tgz",
"integrity": "sha512-xEAAY0msNnESNPc00e19y5heTPX4y/TJ36gr8t1voOaNmTojP9b3oK3BbJLFufW2XFPQaaijpFewm2g2Um3uqA==",
"requires": {
"base64-arraybuffer": "0.1.4"
}
},
"socket.io": {
"version": "3.1.2",
"resolved": "https://verdaccio.lossless.one/socket.io/-/socket.io-3.1.2.tgz",
"integrity": "sha512-JubKZnTQ4Z8G4IZWtaAZSiRP3I/inpy8c/Bsx2jrwGrTbKeVU5xd6qkKMHpChYeM3dWZSO0QACiGK+obhBNwYw==",
"requires": {
"@types/cookie": "^0.4.0",
"@types/cors": "^2.8.8",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",
"base64id": "~2.0.0",
"debug": "~4.3.1",
"engine.io": "~4.1.0",
"socket.io-adapter": "~2.1.0",
"socket.io-parser": "~4.0.3"
}
},
"socket.io-adapter": {
"version": "2.1.0",
"resolved": "https://verdaccio.lossless.one/socket.io-adapter/-/socket.io-adapter-2.1.0.tgz",
"integrity": "sha512-+vDov/aTsLjViYTwS9fPy5pEtTkrbEKsw2M+oVSoFGw6OD1IpvlV1VPhUzNbofCQ8oyMbdYJqDtGdmHQK6TdPg=="
},
"socket.io-client": {
"version": "3.1.3",
"resolved": "https://verdaccio.lossless.one/socket.io-client/-/socket.io-client-3.1.3.tgz",
"integrity": "sha512-4sIGOGOmCg3AOgGi7EEr6ZkTZRkrXwub70bBB/F0JSkMOUFpA77WsL87o34DffQQ31PkbMUIadGOk+3tx1KGbw==",
"requires": {
"@types/component-emitter": "^1.2.10",
"backo2": "~1.0.2",
"component-emitter": "~1.3.0",
"debug": "~4.3.1",
"engine.io-client": "~4.1.0",
"parseuri": "0.0.6",
"socket.io-parser": "~4.0.4"
}
},
"ws": {
"version": "7.4.6",
"resolved": "https://verdaccio.lossless.one/ws/-/ws-7.4.6.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
"requires": {}
},
"xmlhttprequest-ssl": {
"version": "1.6.3",
"resolved": "https://verdaccio.lossless.one/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.6.3.tgz",
"integrity": "sha512-3XfeQE/wNkvrIktn2Kf0869fC0BN6UpydVasGIeSm2B1Llihf7/0UfZM+eCkOw3P7bP4+qPgqhm7ZoxuJtFU0Q=="
}
} }
}, },
"@pushrocks/smartspawn": { "@pushrocks/smartspawn": {
@ -18128,22 +17888,6 @@
"integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=", "integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps=",
"dev": true "dev": true
}, },
"@types/socket.io": {
"version": "3.0.2",
"resolved": "https://verdaccio.lossless.one/@types%2fsocket.io/-/socket.io-3.0.2.tgz",
"integrity": "sha512-pu0sN9m5VjCxBZVK8hW37ZcMe8rjn4HHggBN5CbaRTvFwv5jOmuIRZEuddsBPa9Th0ts0SIo3Niukq+95cMBbQ==",
"requires": {
"socket.io": "*"
}
},
"@types/socket.io-client": {
"version": "3.0.0",
"resolved": "https://verdaccio.lossless.one/@types%2fsocket.io-client/-/socket.io-client-3.0.0.tgz",
"integrity": "sha512-s+IPvFoEIjKA3RdJz/Z2dGR4gLgysKi8owcnrVwNjgvc01Lk68LJDDsG2GRqegFITcxmvCMYM7bhMpwEMlHmDg==",
"requires": {
"socket.io-client": "*"
}
},
"@types/through2": { "@types/through2": {
"version": "2.0.36", "version": "2.0.36",
"resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz", "resolved": "https://verdaccio.lossless.one/@types%2fthrough2/-/through2-2.0.36.tgz",
@ -18648,11 +18392,6 @@
} }
} }
}, },
"base64-arraybuffer": {
"version": "0.1.4",
"resolved": "https://verdaccio.lossless.one/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz",
"integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI="
},
"base64-js": { "base64-js": {
"version": "1.5.1", "version": "1.5.1",
"resolved": "https://verdaccio.lossless.one/base64-js/-/base64-js-1.5.1.tgz", "resolved": "https://verdaccio.lossless.one/base64-js/-/base64-js-1.5.1.tgz",

View File

@ -6,8 +6,7 @@
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "(tstest test/)",
"build": "tsbuild --web --skiplibcheck", "build": "(tsbuild --web && tsbundle --from ./ts/index.ts --to dist_bundle/bundle.js)"
"buildswitch": "(tsbuild --web && tsbundle --from ./ts/index.ts --to dist_bundle/bundle.js)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -57,7 +57,6 @@ tap.test('should register a new Function', async () => {
funcName: 'testFunction2', funcName: 'testFunction2',
}); });
testSmartsocket.addSocketFunction(testSocketFunctionForServer); testSmartsocket.addSocketFunction(testSocketFunctionForServer);
console.log(testSmartsocket.socketFunctions);
}); });
tap.test('should start listening when .started is called', async () => { tap.test('should start listening when .started is called', async () => {
@ -72,7 +71,6 @@ tap.test('should react to a new websocket connection from client', async () => {
alias: 'testClient1', alias: 'testClient1',
}); });
testSmartsocketClient.addSocketFunction(testSocketFunctionClient); testSmartsocketClient.addSocketFunction(testSocketFunctionClient);
console.log(testSmartsocketClient.socketFunctions);
await testSmartsocketClient.connect(); await testSmartsocketClient.connect();
}); });

View File

@ -91,7 +91,13 @@ export class SmartsocketClient {
public async connect() { public async connect() {
const done = plugins.smartpromise.defer(); const done = plugins.smartpromise.defer();
const smartenvInstance = new plugins.smartenv.Smartenv(); const smartenvInstance = new plugins.smartenv.Smartenv();
const socketIoClient = plugins.socketIoClient; const socketIoClient: any = await smartenvInstance.getEnvAwareModule({
nodeModuleName: 'socket.io-client',
webUrlArg: 'https://cdn.jsdelivr.net/npm/socket.io-client@4/dist/socket.io.js',
getFunction: () => {
return (globalThis as any).io;
},
});
logger.log('info', 'trying to connect...'); logger.log('info', 'trying to connect...');
const socketUrl = `${this.serverUrl}:${this.serverPort}`; const socketUrl = `${this.serverUrl}:${this.serverPort}`;
this.socketConnection = new SocketConnection({ this.socketConnection = new SocketConnection({

View File

@ -26,7 +26,7 @@ export interface ISocketConnectionConstructorOptions {
authenticated: boolean; authenticated: boolean;
side: TSocketConnectionSide; side: TSocketConnectionSide;
smartsocketHost: Smartsocket | SmartsocketClient; smartsocketHost: Smartsocket | SmartsocketClient;
socket: pluginsTyped.socketIo.Socket | plugins.socketIoClient.Socket; socket: pluginsTyped.socketIo.Socket | pluginsTyped.socketIoClient.Socket;
} }
/** /**
@ -47,7 +47,7 @@ export class SocketConnection {
public side: TSocketConnectionSide; public side: TSocketConnectionSide;
public authenticated: boolean = false; public authenticated: boolean = false;
public smartsocketRef: Smartsocket | SmartsocketClient; public smartsocketRef: Smartsocket | SmartsocketClient;
public socket: pluginsTyped.socketIo.Socket | plugins.socketIoClient.Socket; public socket: pluginsTyped.socketIo.Socket | pluginsTyped.socketIoClient.Socket;
public eventSubject = new plugins.smartrx.rxjs.Subject<interfaces.TConnectionStatus>(); public eventSubject = new plugins.smartrx.rxjs.Subject<interfaces.TConnectionStatus>();
public eventStatus: interfaces.TConnectionStatus = 'new'; public eventStatus: interfaces.TConnectionStatus = 'new';

View File

@ -27,9 +27,3 @@ export {
smarttime, smarttime,
smartrx, smartrx,
}; };
// thirdparty
import * as socketIoClient from 'socket.io-client';
export {
socketIoClient
}

View File

@ -11,6 +11,10 @@ export { smartexpress };
// third party scope // third party scope
import type socketIo from 'socket.io'; import type socketIo from 'socket.io';
import type socketIoClient from 'socket.io-client'; import type { Socket as ClientSocket, connect as ClientIo } from 'socket.io-client';
export { socketIoClient, socketIo }; export { socketIo };
export namespace socketIoClient {
export type Socket = ClientSocket;
export type connect = typeof ClientIo;
}