Compare commits

...

6 Commits

Author SHA1 Message Date
9b96c22d6a 3.0.24 2024-05-25 02:15:09 +02:00
262891ccf3 fix(core): update 2024-05-25 02:15:08 +02:00
0d60b29ff7 3.0.23 2024-05-05 17:15:44 +02:00
ecca2a9f32 fix(core): update 2024-05-05 17:15:44 +02:00
3643e5e753 3.0.22 2024-05-05 16:42:22 +02:00
4cba418f13 fix(core): update 2024-05-05 16:42:22 +02:00
6 changed files with 4712 additions and 2624 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@api.global/typedrequest",
"version": "3.0.21",
"version": "3.0.24",
"private": false,
"description": "A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.",
"main": "dist_ts/index.js",
@ -14,20 +14,20 @@
"buildDocs": "tsdoc"
},
"devDependencies": {
"@api.global/typedserver": "^3.0.27",
"@git.zone/tsbuild": "^2.1.72",
"@api.global/typedserver": "^3.0.44",
"@git.zone/tsbuild": "^2.1.80",
"@git.zone/tsbundle": "^2.0.15",
"@git.zone/tsrun": "^1.2.44",
"@git.zone/tstest": "^1.0.88",
"@git.zone/tstest": "^1.0.90",
"@push.rocks/smartenv": "^5.0.12",
"@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^20.12.7"
"@types/node": "^20.12.12"
},
"dependencies": {
"@api.global/typedrequest-interfaces": "^3.0.18",
"@api.global/typedrequest-interfaces": "^3.0.19",
"@push.rocks/isounique": "^1.0.5",
"@push.rocks/lik": "^6.0.14",
"@push.rocks/smartbuffer": "^3.0.2",
"@push.rocks/lik": "^6.0.15",
"@push.rocks/smartbuffer": "^3.0.4",
"@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartpromise": "^4.0.3",
"@push.rocks/webrequest": "^3.0.37",

7304
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -44,4 +44,4 @@ tap.skip.test('test', async (tools) => {
await tools.delayFor(5000);
})
tap.start();
export default tap.start();

View File

@ -106,4 +106,4 @@ tap.test('should end the server', async (toolsArg) => {
setTimeout(() => process.exit(0), 100);
});
tap.start();
export default tap.start();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedrequest',
version: '3.0.21',
version: '3.0.24',
description: 'A TypeScript library for making typed requests towards APIs, including facilities for handling requests, routing, and virtual stream handling.'
}

View File

@ -1,5 +1,5 @@
import * as plugins from './plugins.js';
import type { TypedRouter } from './typedrequest.classes.typedrouter.js';
import { TypedRouter } from './typedrequest.classes.typedrouter.js';
export interface ICommFunctions {
sendMethod?: (
@ -15,7 +15,7 @@ export interface ICommFunctions {
* 3. It has a Readable and Writable side.
* 4. The Writable side is Readable on the other side and vice versa.
*/
export class VirtualStream<T = ArrayBufferLike> implements plugins.typedRequestInterfaces.IVirtualStream<T> {
export class VirtualStream<T = Uint8Array> implements plugins.typedRequestInterfaces.IVirtualStream<T> {
// STATIC
public static encodePayloadForNetwork(
objectPayload: any,
@ -79,7 +79,11 @@ export class VirtualStream<T = ArrayBufferLike> implements plugins.typedRequestI
}
public static decodePayloadFromNetwork(objectPayload: any, commFunctions: ICommFunctions): any {
if (plugins.smartbuffer.isBufferLike(objectPayload)) {
if (
plugins.smartbuffer.isBufferLike(objectPayload)
|| objectPayload instanceof TypedRouter
) {
return objectPayload;
}
if (objectPayload !== null && typeof objectPayload === 'object') {