general.interface.ts 1.9 KB

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