From 14966304e317306e2848d5adc126ba73f4616dcd Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Wed, 3 Dec 2025 09:34:33 +0000 Subject: [PATCH] BREAKING CHANGE(TypedSocket.createServer): Remove SmartExpress attachment support from createServer and upgrade smartsocket to ^3.0.0 --- changelog.md | 8 ++++++++ package.json | 2 +- pnpm-lock.yaml | 27 +++++++++++++++++++++++---- readme.md | 17 +---------------- ts/00_commitinfo_data.ts | 2 +- ts/typedsocket.classes.typedsocket.ts | 6 +----- 6 files changed, 35 insertions(+), 27 deletions(-) diff --git a/changelog.md b/changelog.md index eb8ee1a..1ea08f4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 2025-12-03 - 4.0.0 - BREAKING CHANGE(TypedSocket.createServer) +Remove SmartExpress attachment support from createServer and upgrade smartsocket to ^3.0.0 + +- Bump dependency @push.rocks/smartsocket from ^2.1.0 to ^3.0.0. +- Remove optional SmartExpress attachment parameter from TypedSocket.createServer and remove the setExternalServer call — createServer now only accepts a TypedRouter and starts its own Smartsocket server. +- Update README: remove the SmartExpress integration section and adjust the API docs to reflect the new createServer(router) signature. +- Adjust TypeScript implementation to match the simplified createServer signature and behavior. + ## 2025-12-02 - 3.1.1 - fix(package) Include pnpm packageManager metadata in package.json diff --git a/package.json b/package.json index 02f86ae..dac1e28 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "@push.rocks/isohash": "^2.0.1", "@push.rocks/smartjson": "^5.2.0", "@push.rocks/smartrx": "^3.0.10", - "@push.rocks/smartsocket": "^2.1.0", + "@push.rocks/smartsocket": "^3.0.0", "@push.rocks/smartstring": "^4.1.0", "@push.rocks/smarturl": "^3.1.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ae1dc29..e782159 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,8 +24,8 @@ importers: specifier: ^3.0.10 version: 3.0.10 '@push.rocks/smartsocket': - specifier: ^2.1.0 - version: 2.1.0 + specifier: ^3.0.0 + version: 3.0.0 '@push.rocks/smartstring': specifier: ^4.1.0 version: 4.1.0 @@ -1176,6 +1176,9 @@ packages: '@push.rocks/smartsocket@2.1.0': resolution: {integrity: sha512-etOGyfiDFQz/1WJnD3jFL2N7ykujTjiudAz6qZTz82xE5oabKuKX+Cn8SdM9dOwzyWmBUKbUdll8QhovAXjn+g==} + '@push.rocks/smartsocket@3.0.0': + resolution: {integrity: sha512-8pUbOybNBwXF+D9VsuC+3LjD+r9uRzcgcwFRcpic6WGVqW0c5hI8D8YwKDHkL11XJJD7yNRJnsoIc618EVUvuQ==} + '@push.rocks/smartspawn@3.0.3': resolution: {integrity: sha512-DyrGPV69wwOiJgKkyruk5hS3UEGZ99xFAqBE9O2nM8VXCRLbbty3xt1Ug5Z092ZZmJYaaGMSnMw3ijyZJFCT0Q==} @@ -5121,10 +5124,8 @@ snapshots: lit: 3.2.1 transitivePeerDependencies: - '@nuxt/kit' - - bufferutil - react - supports-color - - utf-8-validate - vue '@api.global/typedserver@3.0.80': @@ -7531,6 +7532,24 @@ snapshots: - utf-8-validate - vue + '@push.rocks/smartsocket@3.0.0': + dependencies: + '@api.global/typedrequest-interfaces': 3.0.19 + '@push.rocks/isohash': 2.0.1 + '@push.rocks/isounique': 1.0.5 + '@push.rocks/lik': 6.2.2 + '@push.rocks/smartdelay': 3.0.5 + '@push.rocks/smartenv': 6.0.0 + '@push.rocks/smartjson': 5.2.0 + '@push.rocks/smartlog': 3.1.10 + '@push.rocks/smartpromise': 4.2.3 + '@push.rocks/smartrx': 3.0.10 + '@push.rocks/smarttime': 4.1.1 + ws: 8.18.3 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + '@push.rocks/smartspawn@3.0.3': dependencies: '@push.rocks/smartpromise': 4.2.3 diff --git a/readme.md b/readme.md index 34526ee..54c11a3 100644 --- a/readme.md +++ b/readme.md @@ -13,7 +13,6 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community - 🔌 **Auto-reconnect** - Client automatically reconnects on connection loss - 🏷️ **Connection Tagging** - Tag and filter connections for targeted messaging - 🌐 **Browser Compatible** - Works in both Node.js and browser environments -- 🔗 **SmartExpress Integration** - Optional integration with existing SmartExpress servers - 🚀 **SmartServe Integration** - Native support for SmartServe's WebSocket handling ## Install @@ -80,20 +79,6 @@ typedRouter.addTypedHandler( const server = await TypedSocket.createServer(typedRouter); ``` -#### Integration with SmartExpress - -If you have an existing SmartExpress server, you can attach TypedSocket to it: - -```typescript -import { TypedSocket } from '@api.global/typedsocket'; -import * as smartexpress from '@push.rocks/smartexpress'; - -const smartExpressServer = new smartexpress.Server({ port: 8080 }); -await smartExpressServer.start(); - -const server = await TypedSocket.createServer(typedRouter, smartExpressServer); -``` - #### Integration with SmartServe For SmartServe-based applications, use `fromSmartServe()` for native integration: @@ -265,7 +250,7 @@ await server.stop(); | Method | Description | |--------|-------------| -| `createServer(router, smartExpressServer?)` | Creates a WebSocket server. Optionally attach to an existing SmartExpress server. | +| `createServer(router)` | Creates a WebSocket server (defaults to port 3000). | | `createClient(router, serverUrl, alias?)` | Creates a WebSocket client that connects to the specified server URL. | | `fromSmartServe(smartServe, router)` | Creates a TypedSocket bound to an existing SmartServe instance. | | `useWindowLocationOriginUrl()` | Returns the current window location origin (browser only). | diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 999444c..4aa59a7 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@api.global/typedsocket', - version: '3.1.1', + version: '4.0.0', description: 'A library for creating typed WebSocket connections, supporting bi-directional communication with type safety.' } diff --git a/ts/typedsocket.classes.typedsocket.ts b/ts/typedsocket.classes.typedsocket.ts index d25b285..23cafc8 100644 --- a/ts/typedsocket.classes.typedsocket.ts +++ b/ts/typedsocket.classes.typedsocket.ts @@ -38,16 +38,12 @@ export class TypedSocket { * note: this will fail in browser environments as server libs are not bundled. */ public static async createServer( - typedrouterArg: plugins.typedrequest.TypedRouter, - smartexpressServerArg?: any + typedrouterArg: plugins.typedrequest.TypedRouter ): Promise { const smartsocketServer = new plugins.smartsocket.Smartsocket({ alias: 'typedsocketServer', port: 3000, }); - if (smartexpressServerArg) { - smartsocketServer.setExternalServer('smartexpress', smartexpressServerArg); - } smartsocketServer.socketFunctions.add( new plugins.smartsocket.SocketFunction({