general.interface.ts 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* General interface used for office work/ */
  2. import { Observable, Subject } from "rxjs"
  3. import { BaseMessage } from "../dependencies/logging/interface/export";
  4. export interface ConnectionState {
  5. uuid?: string | number;
  6. status: 'BUFFER' | 'DIRECT_PUBLISH' | 'LIMIT_EXCEEDED' | 'TARGET_PUBLISH' | 'TARGET_BUFFER'
  7. reason?: string;
  8. payload?: any;
  9. }
  10. export interface MessageLog {
  11. appLogLocId: string,
  12. appData: {
  13. msgId: string,
  14. msgLogDateTime: string,
  15. msgDateTime: string, s
  16. msgTag: string[],
  17. msgPayload: string
  18. }
  19. }
  20. export interface ServerResponse {
  21. confirmationMessage: string,
  22. msgId: string
  23. }
  24. // https://grpc.io/docs/what-is-grpc/core-concepts/
  25. export interface GrpcConnectionType {
  26. instanceType: '' | 'server' | 'client'
  27. }
  28. export interface Message {
  29. id: string,
  30. message: MessageLog | string
  31. }
  32. export type State = -1 | 0 | 1 // For status chain effect
  33. export interface ConnectionAttribute {
  34. ConnectionID: ConnectionID,
  35. outGoing: StreamAttribute,
  36. inComing: StreamAttribute,
  37. connectionStatus: Subject<ConnectionState> | null
  38. }
  39. export interface StreamAttribute {
  40. StreamID?: string,
  41. PublisherID?: string,
  42. SubscriberID?: string,
  43. PublisherInstance?: any,
  44. SubscriberInstance?: any,
  45. serverUrl?: string,
  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. }
  70. export interface ClientNotificationState {
  71. event: string,
  72. message: string,
  73. status?: 'ONLINE' | 'OFFLINE' | null
  74. }
  75. export interface WrappedMessage {
  76. timeReceived: any, // this property is for sender to sort
  77. payload: BaseMessage,
  78. thisMessageID?: string,
  79. previousMessageID?: string // this property is for receiver to sort
  80. }