general.interface.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* General interface used for office work/ */
  2. import { Observable, Subject } from "rxjs"
  3. export interface ConnectionState {
  4. status: 'BUFFER' | 'DIRECT_PUBLISH';
  5. reason?: string;
  6. payload?: any;
  7. }
  8. export interface MessageLog {
  9. appLogLocId: string,
  10. appData: {
  11. msgId: string,
  12. msgLogDateTime: string,
  13. msgDateTime: string, s
  14. msgTag: string[],
  15. msgPayload: string
  16. }
  17. }
  18. export interface ServerResponse {
  19. confirmationMessage: string,
  20. msgId: string
  21. }
  22. // https://grpc.io/docs/what-is-grpc/core-concepts/
  23. export interface GrpcConnectionType {
  24. instanceType: '' | 'server' | 'client'
  25. }
  26. export interface Message {
  27. id: string,
  28. message: MessageLog | string
  29. }
  30. export type State = -1 | 0 | 1 // For status chain effect
  31. export interface ConnectionAttribute {
  32. ConnectionID: ConnectionID,
  33. outGoing: StreamAttribute,
  34. inComing: StreamAttribute,
  35. connectionStatus: Subject<ConnectionState> | null
  36. }
  37. export interface StreamAttribute {
  38. StreamID?: string,
  39. PublisherID?: string,
  40. SubscriberID?: string,
  41. PublisherInstance?: any,
  42. SubscriberInstance?: any,
  43. serverUrl?: string,
  44. MessageToBePublished: Observable<Message> | null
  45. MessageToBeReceived: Subject<Message> | null
  46. }
  47. export interface ConnectionRequest {
  48. database?: string,
  49. server?: ServerRequest,
  50. client?: ClientRequest
  51. }
  52. export interface ServerRequest {
  53. name: string,
  54. serverUrl: string,
  55. connectionType: 'GRPC' | 'HTTP' | 'Socket',
  56. messageToBePublishedFromApplication: Subject<Message>
  57. }
  58. export interface ClientRequest {
  59. name: string,
  60. targetServer: string,
  61. connectionType: 'GRPC' | 'HTTP' | 'Socket',
  62. messageToBeReceivedFromRemote: Subject<Message>
  63. }
  64. export interface ConnectionID {
  65. local: string,
  66. remote: string
  67. }