general.interface.ts 2.0 KB

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