topsyde-utils 1.0.166 → 1.0.167

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.
@@ -1,2 +1,3 @@
1
- import { WebsocketStructuredMessage } from "./websocket.types";
1
+ import { I_WebsocketEntity, WebsocketStructuredMessage } from "./websocket.types";
2
2
  export declare function IsWebsocketStructuredMessage(message: any): message is WebsocketStructuredMessage;
3
+ export declare function IsWebsocketClient(entity: any): entity is I_WebsocketEntity;
@@ -1,4 +1,17 @@
1
1
  export function IsWebsocketStructuredMessage(message) {
2
2
  return typeof message === "object" && message !== null && "type" in message && "content" in message;
3
3
  }
4
+ export function IsWebsocketClient(entity) {
5
+ return (typeof entity === "object" &&
6
+ entity !== null &&
7
+ "id" in entity &&
8
+ "name" in entity &&
9
+ "ws" in entity &&
10
+ typeof entity.ws === "object" &&
11
+ entity.ws !== null &&
12
+ "send" in entity.ws &&
13
+ typeof entity.ws.send === "function" &&
14
+ "close" in entity.ws &&
15
+ typeof entity.ws.close === "function");
16
+ }
4
17
  //# sourceMappingURL=websocket.guards.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"websocket.guards.js","sourceRoot":"","sources":["../../../../src/server/bun/websocket/websocket.guards.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,4BAA4B,CAAC,OAAY;IACxD,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,MAAM,IAAI,OAAO,IAAI,SAAS,IAAI,OAAO,CAAC;AACrG,CAAC","sourcesContent":["import { WebsocketStructuredMessage } from \"./websocket.types\";\n\nexport function IsWebsocketStructuredMessage(message: any): message is WebsocketStructuredMessage {\n\treturn typeof message === \"object\" && message !== null && \"type\" in message && \"content\" in message;\n}\n\n"]}
1
+ {"version":3,"file":"websocket.guards.js","sourceRoot":"","sources":["../../../../src/server/bun/websocket/websocket.guards.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,4BAA4B,CAAC,OAAY;IACxD,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,MAAM,IAAI,OAAO,IAAI,SAAS,IAAI,OAAO,CAAC;AACrG,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAW;IAC5C,OAAO,CACN,OAAO,MAAM,KAAK,QAAQ;QAC1B,MAAM,KAAK,IAAI;QACf,IAAI,IAAI,MAAM;QACd,MAAM,IAAI,MAAM;QAChB,IAAI,IAAI,MAAM;QACd,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ;QAC7B,MAAM,CAAC,EAAE,KAAK,IAAI;QAClB,MAAM,IAAI,MAAM,CAAC,EAAE;QACnB,OAAO,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,UAAU;QACpC,OAAO,IAAI,MAAM,CAAC,EAAE;QACpB,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,KAAK,UAAU,CACrC,CAAC;AACH,CAAC","sourcesContent":["import { I_WebsocketClient, I_WebsocketEntity, WebsocketStructuredMessage } from \"./websocket.types\";\nimport { type ServerWebSocket } from \"bun\";\n\nexport function IsWebsocketStructuredMessage(message: any): message is WebsocketStructuredMessage {\n\treturn typeof message === \"object\" && message !== null && \"type\" in message && \"content\" in message;\n}\n\nexport function IsWebsocketClient(entity: any): entity is I_WebsocketEntity {\n\treturn (\n\t\ttypeof entity === \"object\" &&\n\t\tentity !== null &&\n\t\t\"id\" in entity &&\n\t\t\"name\" in entity &&\n\t\t\"ws\" in entity &&\n\t\ttypeof entity.ws === \"object\" &&\n\t\tentity.ws !== null &&\n\t\t\"send\" in entity.ws &&\n\t\ttypeof entity.ws.send === \"function\" &&\n\t\t\"close\" in entity.ws &&\n\t\ttypeof entity.ws.close === \"function\"\n\t);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "topsyde-utils",
3
- "version": "1.0.166",
3
+ "version": "1.0.167",
4
4
  "description": "A bundle of TypeScript utility classes and functions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,6 +1,22 @@
1
- import { WebsocketStructuredMessage } from "./websocket.types";
1
+ import { I_WebsocketClient, I_WebsocketEntity, WebsocketStructuredMessage } from "./websocket.types";
2
+ import { type ServerWebSocket } from "bun";
2
3
 
3
4
  export function IsWebsocketStructuredMessage(message: any): message is WebsocketStructuredMessage {
4
5
  return typeof message === "object" && message !== null && "type" in message && "content" in message;
5
6
  }
6
7
 
8
+ export function IsWebsocketClient(entity: any): entity is I_WebsocketEntity {
9
+ return (
10
+ typeof entity === "object" &&
11
+ entity !== null &&
12
+ "id" in entity &&
13
+ "name" in entity &&
14
+ "ws" in entity &&
15
+ typeof entity.ws === "object" &&
16
+ entity.ws !== null &&
17
+ "send" in entity.ws &&
18
+ typeof entity.ws.send === "function" &&
19
+ "close" in entity.ws &&
20
+ typeof entity.ws.close === "function"
21
+ );
22
+ }