general.interface.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* General interface used for office work/ */
  2. import { Subject } from "rxjs"
  3. export enum ColorCode {
  4. 'GREEN' = 'GREEN',
  5. 'YELLOW' = 'YELLOW',
  6. 'RED' = 'RED'
  7. }
  8. export enum ConnectionStatus {
  9. 'GREEN' = 'GREEN',
  10. 'YELLOW' = 'YELLOW',
  11. 'RED' = 'RED'
  12. }
  13. export interface messageTransmissionInterface {
  14. id?: string,
  15. state: '' | 'attempt to send' | 'failed sent' | 'sent successfully',
  16. date?: Date,
  17. msg: string
  18. }
  19. export interface MessageLog {
  20. appLogLocId: string,
  21. appData: {
  22. msgId: string,
  23. msgLogDateTime: string,
  24. msgDateTime: string, s
  25. msgTag: string[],
  26. msgPayload: string
  27. }
  28. }
  29. export interface ServerResponse {
  30. confirmationMessage: string,
  31. msgId: string
  32. }
  33. export interface ReportStatus {
  34. code: ColorCode,
  35. message: string,
  36. payload?: any,
  37. }
  38. // https://grpc.io/docs/what-is-grpc/core-concepts/
  39. export interface GrpcConnectionType {
  40. instanceType: '' | 'server' | 'client'
  41. }
  42. export interface Message {
  43. id: string,
  44. message: MessageLog | string
  45. }
  46. export type Status = -1 | 0 | 1 // For status chain effect
  47. export interface ConnectionAttribute {
  48. ConnectionID: ConnectionID,
  49. outGoing: ChannelAttribute,
  50. inComing: ChannelAttribute,
  51. connectionStatus: Subject<ReportStatus>
  52. }
  53. export interface ChannelAttribute {
  54. ChannelID?: string,
  55. PublisherID?: string,
  56. SubscriberID?: string,
  57. PublisherInstance?: any,
  58. SubscriberInstance?: any,
  59. MessageToBePublished: Subject<Message> | null
  60. MessageToBeReceived: Subject<Message> | null
  61. }
  62. export interface ConnectionRequest {
  63. database: string,
  64. server: ServerRequest,
  65. client: ClientRequest
  66. }
  67. export interface ServerRequest {
  68. serverUrl: string,
  69. connectionType: 'GRPC' | 'HTTP' | 'Socket',
  70. messageToBePublishedfromApplication: Subject<Message>
  71. }
  72. export interface ClientRequest {
  73. targetServer: string,
  74. connectionType: 'GRPC' | 'HTTP' | 'Socket',
  75. messageToBeReceivedFromRemote: Subject<Message>
  76. }
  77. export interface ConnectionID {
  78. local: string,
  79. remote: string
  80. }