rpc-typescript
Version:
An RCP library for TypeScript
84 lines (54 loc) • 1.48 kB
text/typescript
export type KnownTransports = 'http' | 'electron';
export type TransportConfig = {
/**
* Used to select the http transport.
*/
transport: 'http';
/**
* Determines the method for the underlying http protocol.
*/
httpMethod: HttpMethods;
} | {
/**
* Used to select the electron transport.
*/
transport: 'electron';
};
export type HttpMethods =
'GET' |
'POST' |
'PATCH' |
'DELETE' |
'PUT' |
'OPTIONS'
;
type GeneralMethodConfig = {
/**
* Determines the name of the context in which, the method is declared.
*/
contextDomain?: string;
/**
* Overrides the name of the method.
*/
name?: string;
/**
* Custom transformers and interceptors.
*/
transformers?: string[];
};
export type ProxyMethodConfig = GeneralMethodConfig & TransportConfig & {
}
export type StubMethodConfig = GeneralMethodConfig & TransportConfig & {
};
export type ClassReference<T = any> = new (...args: any[]) => T;
export type ContractReference<T> = ClassReference<T> | string;
type GeneralContractConfig = {
/**
* Determines the name of the context in which, the contract is declared.
*/
contextDomain?: string;
};
export type ProxyContractConfig = GeneralContractConfig & {
};
export type StubContractConfig = GeneralContractConfig & {
};