Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
56f59bf640 | |||
268df991c4 | |||
b3d8dd1573 | |||
0fb36ea928 | |||
10148f7c50 | |||
274bf30973 | |||
e3ff1c3c4b | |||
446a9d1723 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@api.global/typedrequest-interfaces",
|
||||
"version": "3.0.7",
|
||||
"version": "3.0.11",
|
||||
"private": false,
|
||||
"description": "interfaces for making typed requests",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@api.global/typedrequest-interfaces',
|
||||
version: '3.0.7',
|
||||
version: '3.0.11',
|
||||
description: 'interfaces for making typed requests'
|
||||
}
|
||||
|
66
ts/index.ts
66
ts/index.ts
@ -17,7 +17,7 @@ export interface ITypedRequest {
|
||||
*/
|
||||
localData?: {
|
||||
firstTypedrouter?: any;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* server data that is added for dealing with the request server side. Will be omitted when sending the response
|
||||
@ -76,19 +76,55 @@ export interface ITag {
|
||||
|
||||
export type implementsTag<T, U extends T> = {};
|
||||
|
||||
export interface IStreamRequest extends implementsTR<
|
||||
ITypedRequest,
|
||||
IStreamRequest
|
||||
> {
|
||||
method: '##VirtualStream##';
|
||||
request: {
|
||||
streamId: string;
|
||||
streamChunk: any;
|
||||
keepAlive: boolean;
|
||||
};
|
||||
response: {
|
||||
streamId: string;
|
||||
streamChunk: any;
|
||||
keepAlive: boolean;
|
||||
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
|
||||
* binaryChunk: indicates a binary chunk of data
|
||||
* object: indicates a json object
|
||||
* end: indicates the end of a stream
|
||||
* feedback: indicates a feedback message
|
||||
*/
|
||||
mainPurpose: 'start' | 'binaryChunk' | 'object' | 'end' | 'feedback' | 'keepAlive';
|
||||
|
||||
/**
|
||||
* the data package
|
||||
*/
|
||||
chunkData?: any;
|
||||
|
||||
/**
|
||||
* feedback message
|
||||
*/
|
||||
feedback?: {
|
||||
message?: string;
|
||||
data?: any;
|
||||
sha265?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* keepAlive boolean
|
||||
*/
|
||||
keepAlive?: boolean;
|
||||
|
||||
/**
|
||||
* is there more data scheduled to be sent?
|
||||
*/
|
||||
next?: boolean;
|
||||
}
|
||||
|
||||
export interface IStreamRequest extends implementsTR<ITypedRequest, IStreamRequest> {
|
||||
method: '##VirtualStream##';
|
||||
request: IUnifiedStreamDataPackage;
|
||||
response: IUnifiedStreamDataPackage;
|
||||
}
|
||||
|
Reference in New Issue
Block a user