Compare commits

..

32 Commits

Author SHA1 Message Date
b680ab8c23 3.0.16 2024-02-24 14:45:32 +01:00
f0547b33d3 fix(core): update 2024-02-24 14:45:31 +01:00
20c5b115d8 3.0.15 2024-02-24 14:45:18 +01:00
c3801ecd53 fix(core): update 2024-02-24 14:45:17 +01:00
51f03a45b6 3.0.14 2024-02-24 11:10:04 +01:00
ed8879a4c8 fix(core): update 2024-02-24 11:10:03 +01:00
806970c701 3.0.13 2024-02-23 20:18:20 +01:00
9638f74440 fix(core): update 2024-02-23 20:18:19 +01:00
b538c4fbdb 3.0.12 2024-02-23 17:02:13 +01:00
1d3dc08e39 fix(core): update 2024-02-23 17:02:12 +01:00
56f59bf640 3.0.11 2024-02-23 16:00:37 +01:00
268df991c4 fix(core): update 2024-02-23 16:00:36 +01:00
b3d8dd1573 3.0.10 2024-02-23 15:48:32 +01:00
0fb36ea928 fix(core): update 2024-02-23 15:48:31 +01:00
10148f7c50 3.0.9 2024-02-22 15:15:45 +01:00
274bf30973 fix(core): update 2024-02-22 15:15:44 +01:00
e3ff1c3c4b 3.0.8 2024-02-22 13:28:47 +01:00
446a9d1723 fix(core): update 2024-02-22 13:28:47 +01:00
a749f91a8f 3.0.7 2024-02-21 21:01:35 +01:00
8ea6db7b7f fix(core): update 2024-02-21 21:01:35 +01:00
715ee43bcc 3.0.6 2024-02-21 14:54:45 +01:00
c314b4e86f fix(core): update 2024-02-21 14:54:45 +01:00
5824d34764 3.0.5 2024-02-21 01:57:19 +01:00
5eb9035dfe fix(core): update 2024-02-21 01:57:19 +01:00
a49b1813fb 3.0.4 2024-02-21 01:55:50 +01:00
e33ae24f17 fix(core): update 2024-02-21 01:55:49 +01:00
2e13632fec 3.0.3 2024-02-21 00:34:24 +01:00
9175af027b fix(core): update 2024-02-21 00:34:24 +01:00
f9524a62d7 3.0.2 2024-02-20 20:47:12 +01:00
7889e04915 fix(core): update 2024-02-20 20:47:12 +01:00
a81b9eced6 3.0.1 2023-08-04 13:19:24 +02:00
4aa06fe830 fix(core): update 2023-08-04 13:19:23 +02:00
4 changed files with 92 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@api.global/typedrequest-interfaces",
"version": "3.0.0",
"version": "3.0.16",
"private": false,
"description": "interfaces for making typed requests",
"main": "dist_ts/index.js",

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@api.global/typedrequest-interfaces',
version: '3.0.0',
version: '3.0.16',
description: 'interfaces for making typed requests'
}

View File

@ -11,6 +11,14 @@ export interface ITypedRequest {
jwt: string;
};
/**
* localData tracks things within typedrequest.
* needed for VirtualStreams
*/
localData?: {
firstTypedrouter?: any;
};
/**
* server data that is added for dealing with the request server side. Will be omitted when sending the response
*/
@ -44,6 +52,8 @@ export interface ITypedRequest {
/**
* a correlation id that
* used for matching request and response
* !important. Don't remove.
*/
correlation?: {
id: string;
@ -65,3 +75,76 @@ export interface ITag {
}
export type implementsTag<T, U extends T> = {};
// stream stuff
export interface IVirtualStream<T = ArrayBufferLike> {
// Properties
side: 'requesting' | 'responding';
streamId: string;
// Methods
handleStreamTr(streamTrArg: IStreamRequest): Promise<IStreamRequest>;
cleanup(): Promise<void>;
sendData(dataArg: T): Promise<void>;
fetchData(): Promise<T>;
pipeWebStream(webStream: any): void; // Consider defining a more specific type for webStream if possible
}
export interface IUnifiedStreamDataPackage {
/**
* the stream id, so Virtual Streams can talk to each other
*/
streamId: string;
/**
* stream data is sent in cycles. This id is used to match the request and response
*/
cycleId: string;
cycle: 'request' | 'response';
/**
* the main purpose of the data package
* start: indicates the start of a stream
* chunk: indicates a binary chunk of data
* read: indicates the introduction to send data
* end: indicates the end of a stream
* feedback: indicates a feedback message
*/
mainPurpose: 'start' | 'chunk' | 'read' | 'end' | 'feedback' | 'keepAlive';
/**
* the data package
*/
chunkData?: any;
/**
* feedback message
*/
feedback?: {
message?: string;
data?: any;
sha265?: string;
};
/**
* keepAlive boolean
*/
keepAlive?: boolean;
/**
* is backpressure detected on the readable side?
*/
backpressure?: boolean;
/**
* does the writable side have more data scheduled to be sent?
*/
next?: boolean;
}
export interface IStreamRequest extends implementsTR<ITypedRequest, IStreamRequest> {
method: '##VirtualStream##';
request: IUnifiedStreamDataPackage;
response: IUnifiedStreamDataPackage;
}

View File

@ -3,9 +3,12 @@
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true,
}
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}