Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5748bd8280 | |||
| 4e8ea21df2 | |||
| 6f4be3baaa | |||
| a484060888 | |||
| c1b15daaca | |||
| f9397feaf0 | |||
| 889ec9c8ec | |||
| 5d460cf002 | |||
| 5e6ec0d311 | |||
| dd834590cc | |||
| 96b7354dae | |||
| 3a5533c4fe | |||
| 1f5f84763d | |||
| 6474112275 | |||
| a46c0cf395 | |||
| 8be5c352f4 | |||
| caaf947a46 | |||
| 2ec88494be | |||
| b80346d742 | |||
| aced21a968 | |||
| fa40e3a5dc | |||
| 9bb0008381 | |||
| 67bbea8811 | |||
| dc826cb65a |
@@ -64,7 +64,7 @@ testBuild:
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
- npmci npm build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- docker
|
||||
|
||||
17
package.json
17
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@apiglobal/typedsocket",
|
||||
"version": "2.0.9",
|
||||
"version": "2.0.21",
|
||||
"private": false,
|
||||
"description": "a typedrequest extension supporting websockets",
|
||||
"main": "dist_ts/index.js",
|
||||
@@ -17,18 +17,19 @@
|
||||
"@gitzone/tsbuild": "^2.1.63",
|
||||
"@gitzone/tsbundle": "^2.0.6",
|
||||
"@gitzone/tsrun": "^1.2.39",
|
||||
"@gitzone/tstest": "^1.0.72",
|
||||
"@pushrocks/smartenv": "^5.0.2",
|
||||
"@gitzone/tstest": "^1.0.74",
|
||||
"@pushrocks/smartenv": "^5.0.5",
|
||||
"@pushrocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^18.6.3"
|
||||
"@types/node": "^18.15.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apiglobal/typedrequest": "^2.0.8",
|
||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||
"@apiglobal/typedrequest-interfaces": "2.0.1",
|
||||
"@pushrocks/isohash": "^2.0.0",
|
||||
"@pushrocks/smartjson": "^5.0.3",
|
||||
"@pushrocks/smartsocket": "^2.0.7",
|
||||
"@pushrocks/smartstring": "^4.0.2"
|
||||
"@pushrocks/smartjson": "^5.0.5",
|
||||
"@pushrocks/smartsocket": "^2.0.16",
|
||||
"@pushrocks/smartstring": "^4.0.2",
|
||||
"@pushrocks/smarturl": "^3.0.5"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
|
||||
1987
pnpm-lock.yaml
generated
1987
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,6 @@ Code Style | [](htt
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -37,7 +36,6 @@ We are always happy for code contributions. If you are not the code contributing
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
## Legal
|
||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@apiglobal/typedsocket',
|
||||
version: '2.0.9',
|
||||
version: '2.0.21',
|
||||
description: 'a typedrequest extension supporting websockets'
|
||||
}
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
import * as plugins from './typedsocket.plugins.js';
|
||||
export * from './typedsocket.classes.typedsocket.js';
|
||||
|
||||
export const useWindowLocationOriginUrl = () => {
|
||||
const windowLocationResult = plugins.smarturl.Smarturl.createFromUrl(globalThis.location.origin).toString();
|
||||
return windowLocationResult;
|
||||
}
|
||||
@@ -97,8 +97,10 @@ export class TypedSocket {
|
||||
},
|
||||
smartsocketClient
|
||||
);
|
||||
|
||||
console.log(`typedsocket triggering smartsocket to connect...`);
|
||||
const before = Date.now();
|
||||
await smartsocketClient.connect();
|
||||
console.log(`typedsocket triggered smartsocket connected in ${Date.now() - before}ms!!!`)
|
||||
|
||||
return typedsocket;
|
||||
}
|
||||
@@ -126,13 +128,16 @@ export class TypedSocket {
|
||||
this.socketServerOrClient = socketServerOrClientArg;
|
||||
}
|
||||
|
||||
public addTag(keyArg: string, payloadArg: any) {
|
||||
public addTag<T extends plugins.typedrequestInterfaces.ITag = any>(
|
||||
nameArg: T['name'],
|
||||
payloadArg: T['payload']
|
||||
) {
|
||||
if (
|
||||
this.side === 'client' &&
|
||||
this.socketServerOrClient instanceof plugins.smartsocket.SmartsocketClient
|
||||
) {
|
||||
this.socketServerOrClient.socketConnection.addTag({
|
||||
id: keyArg,
|
||||
id: nameArg,
|
||||
payload: payloadArg,
|
||||
});
|
||||
} else {
|
||||
@@ -189,7 +194,9 @@ export class TypedSocket {
|
||||
return allMatching[0];
|
||||
}
|
||||
|
||||
public async findAllTargetConnectionsByTag(keyArg: string, payloadArg?: any) {
|
||||
public async findAllTargetConnectionsByTag<
|
||||
TTag extends plugins.typedrequestInterfaces.ITag = any
|
||||
>(keyArg: TTag['name'], payloadArg?: TTag['payload']) {
|
||||
return this.findAllTargetConnections(async (socketConnectionArg) => {
|
||||
let result: boolean;
|
||||
if (!payloadArg) {
|
||||
@@ -204,7 +211,10 @@ export class TypedSocket {
|
||||
});
|
||||
}
|
||||
|
||||
public async findTargetConnectionByTag(keyArg: string, payloadArg?: any) {
|
||||
public async findTargetConnectionByTag<TTag extends plugins.typedrequestInterfaces.ITag = any>(
|
||||
keyArg: TTag['name'],
|
||||
payloadArg?: TTag['payload']
|
||||
) {
|
||||
const allResults = await this.findAllTargetConnectionsByTag(keyArg, payloadArg);
|
||||
return allResults[0];
|
||||
}
|
||||
|
||||
@@ -9,5 +9,6 @@ import * as isohash from '@pushrocks/isohash';
|
||||
import * as smartjson from '@pushrocks/smartjson';
|
||||
import * as smartsocket from '@pushrocks/smartsocket';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
import * as smarturl from '@pushrocks/smarturl';
|
||||
|
||||
export { isohash, smartjson, smartsocket, smartstring };
|
||||
export { isohash, smartjson, smartsocket, smartstring, smarturl };
|
||||
|
||||
Reference in New Issue
Block a user