6 Commits

Author SHA1 Message Date
jkunz 87d986d404 v2.0.4
Default (tags) / security (push) Failing after 1s
Default (tags) / test (push) Failing after 1s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-04-30 10:27:40 +00:00
jkunz 9ef4ac4a71 fix(build): tighten TypeScript build configuration and fix Deno binary websocket sending 2026-04-30 10:27:40 +00:00
jkunz a957feb868 v2.0.3
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-23 11:17:59 +00:00
jkunz bbc569b628 fix(adapter.node): unref the node server before closing connections during shutdown 2026-03-23 11:17:59 +00:00
jkunz 8b02e8d002 v2.0.2
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-23 10:31:54 +00:00
jkunz a2b2dc1a56 fix(adapter.node): close websocket server and active connections when stopping the Node adapter 2026-03-23 10:31:54 +00:00
10 changed files with 2035 additions and 3953 deletions
+27
View File
@@ -0,0 +1,27 @@
{
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartserve",
"description": "a cross platform server module for Node, Deno and Bun",
"npmPackagename": "@push.rocks/smartserve",
"license": "MIT",
"projectDomain": "push.rocks"
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
},
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
},
"@ship.zone/szci": {
"npmGlobalTools": []
}
}
+20
View File
@@ -1,5 +1,25 @@
# Changelog # Changelog
## 2026-04-30 - 2.0.4 - fix(build)
tighten TypeScript build configuration and fix Deno binary websocket sending
- enable stricter TypeScript checks with noImplicitAny and Node type definitions
- fix Deno adapter binary payload handling by converting ArrayBuffer inputs to a BufferSource-compatible payload
- add explicit interceptor option typing to satisfy stricter compilation
- update build tooling and runtime dependencies and include project config and license files in the published package
## 2026-03-23 - 2.0.3 - fix(adapter.node)
unref the node server before closing connections during shutdown
- Calls server.unref() before closing all connections so shutdown does not keep the Node.js event loop alive.
- Improves shutdown behavior for the Node adapter when stopping HTTP or HTTPS servers.
## 2026-03-23 - 2.0.2 - fix(adapter.node)
close websocket server and active connections when stopping the Node adapter
- Store the WebSocketServer instance on the adapter so it can be closed during shutdown.
- Close all active HTTP connections before closing the underlying Node server to improve shutdown cleanup.
## 2025-12-20 - 2.0.1 - fix(readme) ## 2025-12-20 - 2.0.1 - fix(readme)
update README: rework features, add OpenAPI/Swagger, compression, request validation, examples, and runtime stats update README: rework features, add OpenAPI/Swagger, compression, request validation, examples, and runtime stats
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Task Venture Capital GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+14 -17
View File
@@ -1,6 +1,6 @@
{ {
"name": "@push.rocks/smartserve", "name": "@push.rocks/smartserve",
"version": "2.0.1", "version": "2.0.4",
"private": false, "private": false,
"description": "a cross platform server module for Node, Deno and Bun", "description": "a cross platform server module for Node, Deno and Bun",
"exports": { "exports": {
@@ -11,28 +11,26 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/ --verbose)", "test": "(tstest test/ --verbose)",
"build": "(tsbuild --web --allowimplicitany)", "build": "(tsbuild --web)",
"buildDocs": "(tsdoc)" "buildDocs": "(tsdoc)"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^3.1.2", "@git.zone/tsbuild": "^4.4.0",
"@git.zone/tsbundle": "^2.6.3", "@git.zone/tsrun": "^2.0.2",
"@git.zone/tsrun": "^2.0.0", "@git.zone/tstest": "^3.6.3",
"@git.zone/tstest": "^3.1.3", "@types/node": "^25.6.0",
"@push.rocks/tapbundle": "^6.0.3",
"@types/node": "^24.10.1",
"@types/ws": "^8.18.1" "@types/ws": "^8.18.1"
}, },
"dependencies": { "dependencies": {
"@api.global/typedrequest": "^3.2.5", "@api.global/typedrequest": "^3.3.0",
"@cfworker/json-schema": "^4.1.1", "@cfworker/json-schema": "^4.1.1",
"@push.rocks/lik": "^6.2.2", "@push.rocks/lik": "^6.4.1",
"@push.rocks/smartenv": "^6.0.0", "@push.rocks/smartenv": "^6.0.0",
"@push.rocks/smartlog": "^3.1.10", "@push.rocks/smartlog": "^3.2.2",
"@push.rocks/smartpath": "^6.0.0", "@push.rocks/smartpath": "^6.0.0",
"ws": "^8.18.0" "ws": "^8.20.0"
}, },
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", "packageManager": "pnpm@10.28.2",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://code.foss.global/push.rocks/smartserve.git" "url": "https://code.foss.global/push.rocks/smartserve.git"
@@ -50,10 +48,9 @@
"dist_ts_web/**/*", "dist_ts_web/**/*",
"assets/**/*", "assets/**/*",
"cli.js", "cli.js",
".smartconfig.json",
"license",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
], ]
"pnpm": {
"overrides": {}
}
} }
+1932 -3927
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@push.rocks/smartserve', name: '@push.rocks/smartserve',
version: '2.0.1', version: '2.0.4',
description: 'a cross platform server module for Node, Deno and Bun' description: 'a cross platform server module for Node, Deno and Bun'
} }
+4 -1
View File
@@ -158,7 +158,10 @@ export class DenoAdapter extends BaseAdapter {
protocol: socket.protocol, protocol: socket.protocol,
extensions: socket.extensions, extensions: socket.extensions,
send: (data: string) => socket.send(data), send: (data: string) => socket.send(data),
sendBinary: (data: Uint8Array | ArrayBuffer) => socket.send(data), sendBinary: (data: Uint8Array | ArrayBuffer) => {
const payload = data instanceof ArrayBuffer ? data : new Uint8Array(data);
socket.send(payload as BufferSource);
},
close: (code?: number, reason?: string) => socket.close(code, reason), close: (code?: number, reason?: string) => socket.close(code, reason),
ping: () => { /* Deno handles ping/pong automatically */ }, ping: () => { /* Deno handles ping/pong automatically */ },
terminate: () => socket.close(), terminate: () => socket.close(),
+11 -4
View File
@@ -7,6 +7,7 @@ import { BaseAdapter, type IAdapterCharacteristics, type TRequestHandler } from
*/ */
export class NodeAdapter extends BaseAdapter { export class NodeAdapter extends BaseAdapter {
private server: plugins.http.Server | plugins.https.Server | null = null; private server: plugins.http.Server | plugins.https.Server | null = null;
private wss: any = null;
get name(): 'node' { get name(): 'node' {
return 'node'; return 'node';
@@ -92,8 +93,14 @@ export class NodeAdapter extends BaseAdapter {
} }
async stop(): Promise<void> { async stop(): Promise<void> {
if (this.wss) {
this.wss.close();
this.wss = null;
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.server) { if (this.server) {
this.server.unref();
this.server.closeAllConnections();
this.server.close((err) => { this.server.close((err) => {
if (err) reject(err); if (err) reject(err);
else resolve(); else resolve();
@@ -254,19 +261,19 @@ export class NodeAdapter extends BaseAdapter {
// Dynamic import of ws library // Dynamic import of ws library
const { WebSocketServer } = await import('ws'); const { WebSocketServer } = await import('ws');
const wss = new WebSocketServer({ noServer: true }); this.wss = new WebSocketServer({ noServer: true });
// Get internal callbacks if typedRouter mode // Get internal callbacks if typedRouter mode
const callbacks = (hooks as any)._connectionCallbacks as IWebSocketConnectionCallbacks | undefined; const callbacks = (hooks as any)._connectionCallbacks as IWebSocketConnectionCallbacks | undefined;
const typedRouter = hooks.typedRouter; const typedRouter = hooks.typedRouter;
this.server.on('upgrade', (request, socket, head) => { this.server.on('upgrade', (request, socket, head) => {
wss.handleUpgrade(request, socket, head, (ws) => { this.wss.handleUpgrade(request, socket, head, (ws: any) => {
wss.emit('connection', ws, request); this.wss.emit('connection', ws, request);
}); });
}); });
wss.on('connection', (ws: any, request: any) => { this.wss.on('connection', (ws: any, request: any) => {
const peer = this.wrapNodeWebSocket(ws, request); const peer = this.wrapNodeWebSocket(ws, request);
// Register connection if typedRouter mode // Register connection if typedRouter mode
+2 -2
View File
@@ -97,7 +97,7 @@ export function Guard<TBody = unknown>(
return undefined; return undefined;
}; };
return createInterceptDecorator({ request: interceptor }); return createInterceptDecorator({ request: interceptor } as IInterceptOptions);
} }
/** /**
@@ -119,7 +119,7 @@ export function Transform<TRes = unknown>(
? transformOrTransforms ? transformOrTransforms
: [transformOrTransforms]; : [transformOrTransforms];
return createInterceptDecorator({ response: transforms }); return createInterceptDecorator({ response: transforms } as IInterceptOptions);
} }
/** /**
+3 -1
View File
@@ -3,8 +3,10 @@
"target": "ES2022", "target": "ES2022",
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
"noImplicitAny": true,
"esModuleInterop": true, "esModuleInterop": true,
"verbatimModuleSyntax": true "verbatimModuleSyntax": true,
"types": ["node"]
}, },
"exclude": [ "exclude": [
"dist_*/**/*.d.ts" "dist_*/**/*.d.ts"