general.interface.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 type ConnectionStatus = `ON` | `OFF`
  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. connectionState?: ConnectionStatus,
  46. MessageToBePublished: Observable<Message> | null
  47. MessageToBeReceived: Subject<Message> | null
  48. }
  49. export interface ConnectionRequest {
  50. database?: string,
  51. server?: ServerRequest,
  52. client?: ClientRequest
  53. }
  54. export interface ServerRequest {
  55. name: string,
  56. serverUrl: string,
  57. connectionType: 'GRPC' | 'HTTP' | 'Socket',
  58. messageToBePublishedFromApplication: Subject<Message>
  59. }
  60. export interface ClientRequest {
  61. name: string,
  62. targetServer: string,
  63. connectionType: 'GRPC' | 'HTTP' | 'Socket',
  64. messageToBeReceivedFromRemote: Subject<Message>
  65. }
  66. export interface ConnectionID {
  67. local: string,
  68. remote: string
  69. }