enzo il y a 11 mois
Parent
commit
4441404879

+ 16 - 0
.env

@@ -0,0 +1,16 @@
+PORT = '3000'
+PORT2 = '4000'
+URL = 'http://localhost:3000'
+URL2 = 'http://localhost:4000'
+
+MONGO = 'mongodb://localhost:27017/'
+
+BUILD_PROCESS=yes
+
+Storage = 'Mongo'
+
+ReconnectionAttempt = '60'
+
+TimeOut = '10'
+
+MaxBufferLoad = '10'

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+node_modules
+*.js
+*.js.map
+*payload.json

+ 21 - 0
README.md

@@ -0,0 +1,21 @@
+# FIs-Retransmission
+
+## Description
+
+FIs-Retransmission is a Node.js application that provides a service for buffering and storing messages in case of disruptions in the established connection. This service is designed to ensure message reliability in potentially unreliable network environments.
+
+## Installation
+
+To get started with FIs-Retransmission, you can clone the repository and install its dependencies using npm:
+
+## Execution Intsructions
+
+Several batch files are prepared for ease of use. After building and the project, please change the path in the startgrpc.bat && startgrpc2.bat to your own path, and just type in start "<startgrpc or batchfile of your choosing>.bat"
+
+
+```bash
+git clone https://github.com/your-username/FIs-Retransmission.git
+cd FIs-Retransmission
+npm install
+
+

+ 60 - 0
grpc/grpc1.ts

@@ -0,0 +1,60 @@
+import { Subject } from "rxjs";
+import { GrpcService } from "../services/grpc.service";
+import * as fs from 'fs'
+import { FisErrorHandlingService } from "../services/error.handling.service.fis";
+import { ReportStatus } from "../interfaces/general.interface";
+
+const messagesJSON: any = fs.readFileSync('payload.json')
+const errorHandlingService: FisErrorHandlingService = new FisErrorHandlingService()
+const gprcService: GrpcService = new GrpcService()
+
+let parsedMessages: any[] = JSON.parse(messagesJSON) // load the fake messages generated for this trial 
+let dataMessages = stream() // Emulate messges to be sent over to target server
+let messageToBePublished: Subject<any> = new Subject()
+let statusControl: Subject<ReportStatus> = new Subject()
+
+/* For server streaming */
+// errorHandlingService.handleMessage(dataMessages, statusControl).subscribe((messages) => {
+//   messageToBePublished.next(messages)
+// })
+// let server1 = 'localhost:3000'
+// gprcService.createGrpcInstance(server1, messageToBePublished, statusControl, { instanceType: 'server', serviceMethod: 'server streaming' })
+
+
+/* For bidiretional streaming*/
+errorHandlingService.handleMessage(dataMessages, statusControl).subscribe((messages) => {
+  messageToBePublished.next(messages)
+})
+let server1 = 'localhost:3000'
+gprcService.createGrpcInstance(server1, messageToBePublished, statusControl, { instanceType: 'server', serviceMethod: 'bidirectional' })
+
+
+// setTimeout(() => {
+//   gprcService.stopServer(server1).then((res) => {
+//     gprcService.getAllGrpcServerConnectionInstance()
+//   })
+// }, 3000)
+
+// setTimeout(() => {
+//   gprcService.createGrpcServerStreamingServer(server1).then((res) => {
+//     gprcService.getAllGrpcServerConnectionInstance()
+//   })
+// }, 10000)
+
+
+// this is just to publish an array of fake data as a Subject
+function stream(): Subject<any> {
+  let result: Subject<any> = new Subject()
+  let messages: any[] = parsedMessages
+  let count = 0
+  const intervalId = setInterval(() => {
+    result.next(messages[count]);
+    count++;
+    if (count >= 1000) {
+      clearInterval(intervalId);
+      result.complete();
+    }
+  }, 500)
+
+  return result
+}

+ 70 - 0
grpc/grpc2.ts

@@ -0,0 +1,70 @@
+import * as fs from 'fs'
+import { Subject } from 'rxjs';
+import { ColorCode, ReportStatus } from '../interfaces/general.interface';
+import { GrpcService } from '../services/grpc.service';
+import { FisErrorHandlingService } from '../services/error.handling.service.fis';
+
+// Subject for bidirectional communication
+const errorHandlingService: FisErrorHandlingService = new FisErrorHandlingService()
+const grpcService: GrpcService = new GrpcService()
+const messagesJSON: any = fs.readFileSync('payload.json')
+let parsedMessages: any[] = JSON.parse(messagesJSON) // load the fake messages generated for this trial 
+let messageToBeReleased: Subject<any> = new Subject() // Sample message to be transmitted over to target server
+let statusControl: Subject<ReportStatus> = new Subject() // Listening for error events and states
+let dataMessages = stream() // Emulate messges to be sent over to target server
+let server1: string = 'localhost:3000'
+let unaryRequestSubject: Subject<any> = new Subject()
+
+/* Server Streaming Test case */
+// errorHandlingService.handleMessage(unaryRequestSubject, statusControl).subscribe((messages) => {
+//   messageToBeReleased.next(messages)
+// })
+// grpcService.createGrpcInstance(server1, messageToBeReleased, statusControl, { instanceType: 'client', serviceMethod: 'server streaming' })
+
+/* Bidirectional streaming test case */
+errorHandlingService.handleMessage(dataMessages, statusControl).subscribe((messages) => {
+  messageToBeReleased.next(messages)
+})
+grpcService.createGrpcInstance(server1, messageToBeReleased, statusControl, { instanceType: 'client', serviceMethod: 'bidirectional' })
+
+
+
+let testMessageRequest = {
+  appLogLocId: "68ca0bae-2acd-44f2-b54c-836d6af92890",
+  appData: {
+    msgId: "74023eec-2cf9-422c-ab15-e65c6e08b213",
+    msgLogDateTime: "2023-09-10T17:07:35.262Z",
+    msgDateTime: "2023-01-16T04:51:29.595Z",
+    msgTag: [
+      "free",
+      "enterprise",
+      "rich"
+    ],
+    msgPayload: "Autus ducimus deinde thema. Succurro tui denuncio nostrum summisse aiunt statua. Cribro commemoro utique.\nUlterius apparatus copia argentum solium textor denego inventore thymbra aegre. Acsi cometes color perspiciatis. Pax caste derelinquo amicitia tui molestiae culpo cohaero.\nRepudiandae desipio tero decretum atrocitas. Trado aptus sunt utor arcus quos molestias. Tabella enim curto clibanus cavus usus villa.\nCondico viriliter reprehenderit unus curriculum. Numquam velut adsuesco adversus veritatis callide delibero umquam vulariter deporto. Inventore astrum cavus ambulo creptio.\nSuspendo demo carus fuga. Decerno dolores deficio accusator. Aestus quod dedico contigo magni."
+  }
+}
+
+setTimeout(() => {
+  // messageToBeReleased.next(testMessageRequest)
+}, 1000)
+// setTimeout(() => {
+//   unaryRequestSubject.next(testMessageRequest)
+// }, 7000)
+
+// this is just to publish an array of fake data as a Subject
+function stream(): Subject<any> {
+  let result: Subject<any> = new Subject()
+  let messages: any[] = parsedMessages
+  let count = 0
+  const intervalId = setInterval(() => {
+    result.next(messages[count]);
+    count++;
+    if (count >= 1000) {
+      clearInterval(intervalId);
+      result.complete();
+    }
+  }, 500)
+
+  return result
+}
+

+ 0 - 0
grpc/health.ts


+ 40 - 0
interfaces/general.interface.ts

@@ -0,0 +1,40 @@
+/* General interface used for office work/ */
+
+
+export enum ColorCode {
+    'GREEN' = 'GREEN',
+    "YELLOW" = "YELLOW",
+    "RED" = "RED"
+}
+
+export interface messageTransmissionInterface {
+    id?: string,
+    state: '' | 'attempt to send' | 'failed sent' | 'sent successfully',
+    date?: Date,
+    msg: string
+}
+export interface MessageLog { // this one specifically for office work case only. FIS copyright LOL
+    appLogLocId: string,
+    appData: {
+        msgId: string,
+        msgLogDateTime: string,
+        msgDateTime: string,
+        msgTag: string[],
+        msgPayload: string
+    }
+}
+export interface ServerResponse {
+    confirmationMessage: string,
+    msgId: string
+}
+
+export interface ReportStatus {
+    code: ColorCode,
+    message: string,
+    payload?: any
+}
+// https://grpc.io/docs/what-is-grpc/core-concepts/
+export interface GrpcConnectionType {
+    instanceType: '' | 'server' | 'client'
+    serviceMethod: '' | 'unary' | 'server streaming' | 'client streaming' | 'bidirectional'
+}

+ 26 - 0
killgrpc.bat

@@ -0,0 +1,26 @@
+@echo off
+
+REM Kill all node.exe processes except for the one associated with your build script
+for /f "tokens=2" %%a in ('tasklist ^| findstr /i /c:"node.exe" /c:"BUILD_PROCESS=yes"') do (
+  taskkill /F /PID %%a
+)
+
+REM Close the terminal window (Windows Terminal)
+taskkill /F /IM WindowsTerminal.exe
+
+REM Start the build watch process using Node.js
+start cmd /k "npm run watch"
+
+
+
+
+//REM Close the terminal window
+//taskkill /F /IM WindowsTerminal.exe
+
+
+// taskkill /F /IM cmd.exe
+
+//REM Stop server 1
+//taskkill /F /IM node.exe /T
+
+//REM Add more server stop commands as needed

+ 38 - 0
models/message.schema.ts

@@ -0,0 +1,38 @@
+import mongoose from 'mongoose';
+const { Schema } = mongoose;
+
+const appData = {
+    msgId: {
+        type: String,
+        required: true,
+    },
+    msgLogDateTime: {
+        type: Date,
+        required: true,
+        default: () => Date.now()
+    },
+    msgDateTime: {
+        type: Date,
+        required: true,
+        default: () => Date.now()
+    },
+    msgTag: [String],
+    msgPayload: {
+        type: String,
+        required: true
+    }
+}
+
+const appDataSchema = new mongoose.Schema(
+    appData
+)
+const messageSchema = new mongoose.Schema({
+    appLogLocId: {
+        type: String,
+        ref: `appLogLoc`,
+        required: true
+    },
+    appData: appData
+});
+
+module.exports = messageSchema

+ 1272 - 0
package-lock.json

@@ -0,0 +1,1272 @@
+{
+  "name": "fis-restransmission",
+  "version": "1.0.0",
+  "lockfileVersion": 3,
+  "requires": true,
+  "packages": {
+    "": {
+      "name": "fis-restransmission",
+      "version": "1.0.0",
+      "license": "ISC",
+      "dependencies": {
+        "@faker-js/faker": "^8.1.0",
+        "@grpc/grpc-js": "^1.9.4",
+        "dotenv": "^16.3.1",
+        "express": "^4.18.2",
+        "grpc-health-check": "^2.0.0",
+        "lodash": "^4.17.21",
+        "mongo": "^0.1.0",
+        "mongoose": "^7.6.0",
+        "rxjs": "^7.8.1"
+      },
+      "devDependencies": {
+        "@types/node": "^20.6.0",
+        "typescript": "^5.2.2"
+      }
+    },
+    "node_modules/@faker-js/faker": {
+      "version": "8.1.0",
+      "resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.1.0.tgz",
+      "integrity": "sha512-38DT60rumHfBYynif3lmtxMqMqmsOQIxQgEuPZxCk2yUYN0eqWpTACgxi0VpidvsJB8CRxCpvP7B3anK85FjtQ==",
+      "funding": [
+        {
+          "type": "opencollective",
+          "url": "https://opencollective.com/fakerjs"
+        }
+      ],
+      "engines": {
+        "node": "^14.17.0 || ^16.13.0 || >=18.0.0",
+        "npm": ">=6.14.13"
+      }
+    },
+    "node_modules/@grpc/grpc-js": {
+      "version": "1.9.5",
+      "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.5.tgz",
+      "integrity": "sha512-iouYNlPxRAwZ2XboDT+OfRKHuaKHiqjB5VFYZ0NFrHkbEF+AV3muIUY9olQsp8uxU4VvRCMiRk9ftzFDGb61aw==",
+      "dependencies": {
+        "@grpc/proto-loader": "^0.7.8",
+        "@types/node": ">=12.12.47"
+      },
+      "engines": {
+        "node": "^8.13.0 || >=10.10.0"
+      }
+    },
+    "node_modules/@grpc/proto-loader": {
+      "version": "0.7.10",
+      "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.10.tgz",
+      "integrity": "sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==",
+      "dependencies": {
+        "lodash.camelcase": "^4.3.0",
+        "long": "^5.0.0",
+        "protobufjs": "^7.2.4",
+        "yargs": "^17.7.2"
+      },
+      "bin": {
+        "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js"
+      },
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/@mongodb-js/saslprep": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.0.tgz",
+      "integrity": "sha512-Xfijy7HvfzzqiOAhAepF4SGN5e9leLkMvg/OPOF97XemjfVCYN/oWa75wnkc6mltMSTwY+XlbhWgUOJmkFspSw==",
+      "dependencies": {
+        "sparse-bitfield": "^3.0.3"
+      }
+    },
+    "node_modules/@protobufjs/aspromise": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
+      "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="
+    },
+    "node_modules/@protobufjs/base64": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
+      "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
+    },
+    "node_modules/@protobufjs/codegen": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
+      "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
+    },
+    "node_modules/@protobufjs/eventemitter": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
+      "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="
+    },
+    "node_modules/@protobufjs/fetch": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
+      "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
+      "dependencies": {
+        "@protobufjs/aspromise": "^1.1.1",
+        "@protobufjs/inquire": "^1.1.0"
+      }
+    },
+    "node_modules/@protobufjs/float": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
+      "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="
+    },
+    "node_modules/@protobufjs/inquire": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
+      "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="
+    },
+    "node_modules/@protobufjs/path": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
+      "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="
+    },
+    "node_modules/@protobufjs/pool": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
+      "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="
+    },
+    "node_modules/@protobufjs/utf8": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
+      "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
+    },
+    "node_modules/@types/node": {
+      "version": "20.8.5",
+      "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.5.tgz",
+      "integrity": "sha512-SPlobFgbidfIeOYlzXiEjSYeIJiOCthv+9tSQVpvk4PAdIIc+2SmjNVzWXk9t0Y7dl73Zdf+OgXKHX9XtkqUpw==",
+      "dependencies": {
+        "undici-types": "~5.25.1"
+      }
+    },
+    "node_modules/@types/webidl-conversions": {
+      "version": "7.0.1",
+      "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.1.tgz",
+      "integrity": "sha512-8hKOnOan+Uu+NgMaCouhg3cT9x5fFZ92Jwf+uDLXLu/MFRbXxlWwGeQY7KVHkeSft6RvY+tdxklUBuyY9eIEKg=="
+    },
+    "node_modules/@types/whatwg-url": {
+      "version": "8.2.2",
+      "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
+      "integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA==",
+      "dependencies": {
+        "@types/node": "*",
+        "@types/webidl-conversions": "*"
+      }
+    },
+    "node_modules/accepts": {
+      "version": "1.3.8",
+      "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
+      "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
+      "dependencies": {
+        "mime-types": "~2.1.34",
+        "negotiator": "0.6.3"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/ansi-regex": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+      "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/ansi-styles": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+      "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+      "dependencies": {
+        "color-convert": "^2.0.1"
+      },
+      "engines": {
+        "node": ">=8"
+      },
+      "funding": {
+        "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+      }
+    },
+    "node_modules/array-flatten": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
+      "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
+    },
+    "node_modules/body-parser": {
+      "version": "1.20.1",
+      "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
+      "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
+      "dependencies": {
+        "bytes": "3.1.2",
+        "content-type": "~1.0.4",
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "destroy": "1.2.0",
+        "http-errors": "2.0.0",
+        "iconv-lite": "0.4.24",
+        "on-finished": "2.4.1",
+        "qs": "6.11.0",
+        "raw-body": "2.5.1",
+        "type-is": "~1.6.18",
+        "unpipe": "1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8",
+        "npm": "1.2.8000 || >= 1.4.16"
+      }
+    },
+    "node_modules/bson": {
+      "version": "6.1.0",
+      "resolved": "https://registry.npmjs.org/bson/-/bson-6.1.0.tgz",
+      "integrity": "sha512-yiQ3KxvpVoRpx1oD1uPz4Jit9tAVTJgjdmjDKtUErkOoL9VNoF8Dd58qtAOL5E40exx2jvAT9sqdRSK/r+SHlA==",
+      "engines": {
+        "node": ">=16.20.1"
+      }
+    },
+    "node_modules/bytes": {
+      "version": "3.1.2",
+      "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+      "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/call-bind": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
+      "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
+      "dependencies": {
+        "function-bind": "^1.1.1",
+        "get-intrinsic": "^1.0.2"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/cliui": {
+      "version": "8.0.1",
+      "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+      "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+      "dependencies": {
+        "string-width": "^4.2.0",
+        "strip-ansi": "^6.0.1",
+        "wrap-ansi": "^7.0.0"
+      },
+      "engines": {
+        "node": ">=12"
+      }
+    },
+    "node_modules/color-convert": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+      "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+      "dependencies": {
+        "color-name": "~1.1.4"
+      },
+      "engines": {
+        "node": ">=7.0.0"
+      }
+    },
+    "node_modules/color-name": {
+      "version": "1.1.4",
+      "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+      "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+    },
+    "node_modules/content-disposition": {
+      "version": "0.5.4",
+      "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
+      "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
+      "dependencies": {
+        "safe-buffer": "5.2.1"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/content-type": {
+      "version": "1.0.5",
+      "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+      "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/cookie": {
+      "version": "0.5.0",
+      "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
+      "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/cookie-signature": {
+      "version": "1.0.6",
+      "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
+      "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
+    },
+    "node_modules/debug": {
+      "version": "2.6.9",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+      "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+      "dependencies": {
+        "ms": "2.0.0"
+      }
+    },
+    "node_modules/depd": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+      "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/destroy": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+      "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+      "engines": {
+        "node": ">= 0.8",
+        "npm": "1.2.8000 || >= 1.4.16"
+      }
+    },
+    "node_modules/dotenv": {
+      "version": "16.3.1",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
+      "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
+      "engines": {
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://github.com/motdotla/dotenv?sponsor=1"
+      }
+    },
+    "node_modules/ee-first": {
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+      "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
+    },
+    "node_modules/emoji-regex": {
+      "version": "8.0.0",
+      "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+      "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
+    },
+    "node_modules/encodeurl": {
+      "version": "1.0.2",
+      "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
+      "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/escalade": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+      "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/escape-html": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+      "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
+    },
+    "node_modules/etag": {
+      "version": "1.8.1",
+      "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+      "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/express": {
+      "version": "4.18.2",
+      "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
+      "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
+      "dependencies": {
+        "accepts": "~1.3.8",
+        "array-flatten": "1.1.1",
+        "body-parser": "1.20.1",
+        "content-disposition": "0.5.4",
+        "content-type": "~1.0.4",
+        "cookie": "0.5.0",
+        "cookie-signature": "1.0.6",
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "encodeurl": "~1.0.2",
+        "escape-html": "~1.0.3",
+        "etag": "~1.8.1",
+        "finalhandler": "1.2.0",
+        "fresh": "0.5.2",
+        "http-errors": "2.0.0",
+        "merge-descriptors": "1.0.1",
+        "methods": "~1.1.2",
+        "on-finished": "2.4.1",
+        "parseurl": "~1.3.3",
+        "path-to-regexp": "0.1.7",
+        "proxy-addr": "~2.0.7",
+        "qs": "6.11.0",
+        "range-parser": "~1.2.1",
+        "safe-buffer": "5.2.1",
+        "send": "0.18.0",
+        "serve-static": "1.15.0",
+        "setprototypeof": "1.2.0",
+        "statuses": "2.0.1",
+        "type-is": "~1.6.18",
+        "utils-merge": "1.0.1",
+        "vary": "~1.1.2"
+      },
+      "engines": {
+        "node": ">= 0.10.0"
+      }
+    },
+    "node_modules/finalhandler": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
+      "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
+      "dependencies": {
+        "debug": "2.6.9",
+        "encodeurl": "~1.0.2",
+        "escape-html": "~1.0.3",
+        "on-finished": "2.4.1",
+        "parseurl": "~1.3.3",
+        "statuses": "2.0.1",
+        "unpipe": "~1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/forwarded": {
+      "version": "0.2.0",
+      "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+      "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/fresh": {
+      "version": "0.5.2",
+      "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+      "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/function-bind": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+      "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/get-caller-file": {
+      "version": "2.0.5",
+      "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+      "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+      "engines": {
+        "node": "6.* || 8.* || >= 10.*"
+      }
+    },
+    "node_modules/get-intrinsic": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
+      "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
+      "dependencies": {
+        "function-bind": "^1.1.1",
+        "has": "^1.0.3",
+        "has-proto": "^1.0.1",
+        "has-symbols": "^1.0.3"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/grpc-health-check": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/grpc-health-check/-/grpc-health-check-2.0.0.tgz",
+      "integrity": "sha512-VzfzZzFg03qG5nJGeZaCjm9r6Fj3Lgosnlk8bSRg6diMXNVQ7K778mIQVnfax1VVO+NFth1mjQWLV2iJHMpf5A==",
+      "dependencies": {
+        "@grpc/proto-loader": "^0.7.10",
+        "typescript": "^5.2.2"
+      }
+    },
+    "node_modules/has": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz",
+      "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==",
+      "engines": {
+        "node": ">= 0.4.0"
+      }
+    },
+    "node_modules/has-proto": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
+      "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/has-symbols": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
+      "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
+      "engines": {
+        "node": ">= 0.4"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/http-errors": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
+      "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
+      "dependencies": {
+        "depd": "2.0.0",
+        "inherits": "2.0.4",
+        "setprototypeof": "1.2.0",
+        "statuses": "2.0.1",
+        "toidentifier": "1.0.1"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/iconv-lite": {
+      "version": "0.4.24",
+      "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+      "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+      "dependencies": {
+        "safer-buffer": ">= 2.1.2 < 3"
+      },
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/inherits": {
+      "version": "2.0.4",
+      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+    },
+    "node_modules/ip": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
+      "integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ=="
+    },
+    "node_modules/ipaddr.js": {
+      "version": "1.9.1",
+      "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+      "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+      "engines": {
+        "node": ">= 0.10"
+      }
+    },
+    "node_modules/is-fullwidth-code-point": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+      "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/kareem": {
+      "version": "2.5.1",
+      "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.5.1.tgz",
+      "integrity": "sha512-7jFxRVm+jD+rkq3kY0iZDJfsO2/t4BBPeEb2qKn2lR/9KhuksYk5hxzfRYWMPV8P/x2d0kHD306YyWLzjjH+uA==",
+      "engines": {
+        "node": ">=12.0.0"
+      }
+    },
+    "node_modules/lodash": {
+      "version": "4.17.21",
+      "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
+    },
+    "node_modules/lodash.camelcase": {
+      "version": "4.3.0",
+      "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz",
+      "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA=="
+    },
+    "node_modules/long": {
+      "version": "5.2.3",
+      "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
+      "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q=="
+    },
+    "node_modules/media-typer": {
+      "version": "0.3.0",
+      "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+      "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/memory-pager": {
+      "version": "1.5.0",
+      "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
+      "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg=="
+    },
+    "node_modules/merge-descriptors": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
+      "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
+    },
+    "node_modules/methods": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
+      "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/mime": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+      "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+      "bin": {
+        "mime": "cli.js"
+      },
+      "engines": {
+        "node": ">=4"
+      }
+    },
+    "node_modules/mime-db": {
+      "version": "1.52.0",
+      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+      "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/mime-types": {
+      "version": "2.1.35",
+      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+      "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+      "dependencies": {
+        "mime-db": "1.52.0"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/mongo": {
+      "version": "0.1.0",
+      "resolved": "https://registry.npmjs.org/mongo/-/mongo-0.1.0.tgz",
+      "integrity": "sha512-2MPq+GCNKhah0V/g/HIQI/S1h6Ycd87KPuXAITkeXWT6wncvABFxOaXdzCKlRvLSQRUkDimllrRrhoHUTD8usg==",
+      "dependencies": {
+        "mongodb": "*"
+      },
+      "engines": {
+        "node": ">= 0.4.0"
+      }
+    },
+    "node_modules/mongodb": {
+      "version": "6.1.0",
+      "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.1.0.tgz",
+      "integrity": "sha512-AvzNY0zMkpothZ5mJAaIo2bGDjlJQqqAbn9fvtVgwIIUPEfdrqGxqNjjbuKyrgQxg2EvCmfWdjq+4uj96c0YPw==",
+      "dependencies": {
+        "@mongodb-js/saslprep": "^1.1.0",
+        "bson": "^6.1.0",
+        "mongodb-connection-string-url": "^2.6.0"
+      },
+      "engines": {
+        "node": ">=16.20.1"
+      },
+      "peerDependencies": {
+        "@aws-sdk/credential-providers": "^3.188.0",
+        "@mongodb-js/zstd": "^1.1.0",
+        "gcp-metadata": "^5.2.0",
+        "kerberos": "^2.0.1",
+        "mongodb-client-encryption": ">=6.0.0 <7",
+        "snappy": "^7.2.2",
+        "socks": "^2.7.1"
+      },
+      "peerDependenciesMeta": {
+        "@aws-sdk/credential-providers": {
+          "optional": true
+        },
+        "@mongodb-js/zstd": {
+          "optional": true
+        },
+        "gcp-metadata": {
+          "optional": true
+        },
+        "kerberos": {
+          "optional": true
+        },
+        "mongodb-client-encryption": {
+          "optional": true
+        },
+        "snappy": {
+          "optional": true
+        },
+        "socks": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/mongodb-connection-string-url": {
+      "version": "2.6.0",
+      "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
+      "integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ==",
+      "dependencies": {
+        "@types/whatwg-url": "^8.2.1",
+        "whatwg-url": "^11.0.0"
+      }
+    },
+    "node_modules/mongoose": {
+      "version": "7.6.1",
+      "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-7.6.1.tgz",
+      "integrity": "sha512-Iflr60FL7mabBdgAtumLTwEGdZGV6IKHfF7F75En2JWpPitorwQeCFqWPcPHRnBxncKANl3gwI9nh2Yb4y3/sA==",
+      "dependencies": {
+        "bson": "^5.5.0",
+        "kareem": "2.5.1",
+        "mongodb": "5.9.0",
+        "mpath": "0.9.0",
+        "mquery": "5.0.0",
+        "ms": "2.1.3",
+        "sift": "16.0.1"
+      },
+      "engines": {
+        "node": ">=14.20.1"
+      },
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/mongoose"
+      }
+    },
+    "node_modules/mongoose/node_modules/bson": {
+      "version": "5.5.0",
+      "resolved": "https://registry.npmjs.org/bson/-/bson-5.5.0.tgz",
+      "integrity": "sha512-B+QB4YmDx9RStKv8LLSl/aVIEV3nYJc3cJNNTK2Cd1TL+7P+cNpw9mAPeCgc5K+j01Dv6sxUzcITXDx7ZU3F0w==",
+      "engines": {
+        "node": ">=14.20.1"
+      }
+    },
+    "node_modules/mongoose/node_modules/mongodb": {
+      "version": "5.9.0",
+      "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.9.0.tgz",
+      "integrity": "sha512-g+GCMHN1CoRUA+wb1Agv0TI4YTSiWr42B5ulkiAfLLHitGK1R+PkSAf3Lr5rPZwi/3F04LiaZEW0Kxro9Fi2TA==",
+      "dependencies": {
+        "bson": "^5.5.0",
+        "mongodb-connection-string-url": "^2.6.0",
+        "socks": "^2.7.1"
+      },
+      "engines": {
+        "node": ">=14.20.1"
+      },
+      "optionalDependencies": {
+        "@mongodb-js/saslprep": "^1.1.0"
+      },
+      "peerDependencies": {
+        "@aws-sdk/credential-providers": "^3.188.0",
+        "@mongodb-js/zstd": "^1.0.0",
+        "kerberos": "^1.0.0 || ^2.0.0",
+        "mongodb-client-encryption": ">=2.3.0 <3",
+        "snappy": "^7.2.2"
+      },
+      "peerDependenciesMeta": {
+        "@aws-sdk/credential-providers": {
+          "optional": true
+        },
+        "@mongodb-js/zstd": {
+          "optional": true
+        },
+        "kerberos": {
+          "optional": true
+        },
+        "mongodb-client-encryption": {
+          "optional": true
+        },
+        "snappy": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/mongoose/node_modules/ms": {
+      "version": "2.1.3",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
+    },
+    "node_modules/mpath": {
+      "version": "0.9.0",
+      "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
+      "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
+      "engines": {
+        "node": ">=4.0.0"
+      }
+    },
+    "node_modules/mquery": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz",
+      "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==",
+      "dependencies": {
+        "debug": "4.x"
+      },
+      "engines": {
+        "node": ">=14.0.0"
+      }
+    },
+    "node_modules/mquery/node_modules/debug": {
+      "version": "4.3.4",
+      "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+      "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+      "dependencies": {
+        "ms": "2.1.2"
+      },
+      "engines": {
+        "node": ">=6.0"
+      },
+      "peerDependenciesMeta": {
+        "supports-color": {
+          "optional": true
+        }
+      }
+    },
+    "node_modules/mquery/node_modules/ms": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+      "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
+    },
+    "node_modules/ms": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+      "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
+    },
+    "node_modules/negotiator": {
+      "version": "0.6.3",
+      "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
+      "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/object-inspect": {
+      "version": "1.12.3",
+      "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
+      "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/on-finished": {
+      "version": "2.4.1",
+      "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+      "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+      "dependencies": {
+        "ee-first": "1.1.1"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/parseurl": {
+      "version": "1.3.3",
+      "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+      "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/path-to-regexp": {
+      "version": "0.1.7",
+      "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
+      "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
+    },
+    "node_modules/protobufjs": {
+      "version": "7.2.5",
+      "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz",
+      "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==",
+      "hasInstallScript": true,
+      "dependencies": {
+        "@protobufjs/aspromise": "^1.1.2",
+        "@protobufjs/base64": "^1.1.2",
+        "@protobufjs/codegen": "^2.0.4",
+        "@protobufjs/eventemitter": "^1.1.0",
+        "@protobufjs/fetch": "^1.1.0",
+        "@protobufjs/float": "^1.0.2",
+        "@protobufjs/inquire": "^1.1.0",
+        "@protobufjs/path": "^1.1.2",
+        "@protobufjs/pool": "^1.1.0",
+        "@protobufjs/utf8": "^1.1.0",
+        "@types/node": ">=13.7.0",
+        "long": "^5.0.0"
+      },
+      "engines": {
+        "node": ">=12.0.0"
+      }
+    },
+    "node_modules/proxy-addr": {
+      "version": "2.0.7",
+      "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
+      "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
+      "dependencies": {
+        "forwarded": "0.2.0",
+        "ipaddr.js": "1.9.1"
+      },
+      "engines": {
+        "node": ">= 0.10"
+      }
+    },
+    "node_modules/punycode": {
+      "version": "2.3.0",
+      "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz",
+      "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==",
+      "engines": {
+        "node": ">=6"
+      }
+    },
+    "node_modules/qs": {
+      "version": "6.11.0",
+      "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
+      "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
+      "dependencies": {
+        "side-channel": "^1.0.4"
+      },
+      "engines": {
+        "node": ">=0.6"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/range-parser": {
+      "version": "1.2.1",
+      "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+      "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/raw-body": {
+      "version": "2.5.1",
+      "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
+      "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
+      "dependencies": {
+        "bytes": "3.1.2",
+        "http-errors": "2.0.0",
+        "iconv-lite": "0.4.24",
+        "unpipe": "1.0.0"
+      },
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/require-directory": {
+      "version": "2.1.1",
+      "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+      "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
+    "node_modules/rxjs": {
+      "version": "7.8.1",
+      "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
+      "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
+      "dependencies": {
+        "tslib": "^2.1.0"
+      }
+    },
+    "node_modules/safe-buffer": {
+      "version": "5.2.1",
+      "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+      "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+      "funding": [
+        {
+          "type": "github",
+          "url": "https://github.com/sponsors/feross"
+        },
+        {
+          "type": "patreon",
+          "url": "https://www.patreon.com/feross"
+        },
+        {
+          "type": "consulting",
+          "url": "https://feross.org/support"
+        }
+      ]
+    },
+    "node_modules/safer-buffer": {
+      "version": "2.1.2",
+      "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+      "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
+    },
+    "node_modules/send": {
+      "version": "0.18.0",
+      "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
+      "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
+      "dependencies": {
+        "debug": "2.6.9",
+        "depd": "2.0.0",
+        "destroy": "1.2.0",
+        "encodeurl": "~1.0.2",
+        "escape-html": "~1.0.3",
+        "etag": "~1.8.1",
+        "fresh": "0.5.2",
+        "http-errors": "2.0.0",
+        "mime": "1.6.0",
+        "ms": "2.1.3",
+        "on-finished": "2.4.1",
+        "range-parser": "~1.2.1",
+        "statuses": "2.0.1"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/send/node_modules/ms": {
+      "version": "2.1.3",
+      "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+      "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
+    },
+    "node_modules/serve-static": {
+      "version": "1.15.0",
+      "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
+      "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
+      "dependencies": {
+        "encodeurl": "~1.0.2",
+        "escape-html": "~1.0.3",
+        "parseurl": "~1.3.3",
+        "send": "0.18.0"
+      },
+      "engines": {
+        "node": ">= 0.8.0"
+      }
+    },
+    "node_modules/setprototypeof": {
+      "version": "1.2.0",
+      "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+      "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
+    },
+    "node_modules/side-channel": {
+      "version": "1.0.4",
+      "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
+      "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
+      "dependencies": {
+        "call-bind": "^1.0.0",
+        "get-intrinsic": "^1.0.2",
+        "object-inspect": "^1.9.0"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/ljharb"
+      }
+    },
+    "node_modules/sift": {
+      "version": "16.0.1",
+      "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz",
+      "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ=="
+    },
+    "node_modules/smart-buffer": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
+      "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
+      "engines": {
+        "node": ">= 6.0.0",
+        "npm": ">= 3.0.0"
+      }
+    },
+    "node_modules/socks": {
+      "version": "2.7.1",
+      "resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
+      "integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
+      "dependencies": {
+        "ip": "^2.0.0",
+        "smart-buffer": "^4.2.0"
+      },
+      "engines": {
+        "node": ">= 10.13.0",
+        "npm": ">= 3.0.0"
+      }
+    },
+    "node_modules/sparse-bitfield": {
+      "version": "3.0.3",
+      "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
+      "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
+      "dependencies": {
+        "memory-pager": "^1.0.2"
+      }
+    },
+    "node_modules/statuses": {
+      "version": "2.0.1",
+      "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
+      "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/string-width": {
+      "version": "4.2.3",
+      "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+      "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+      "dependencies": {
+        "emoji-regex": "^8.0.0",
+        "is-fullwidth-code-point": "^3.0.0",
+        "strip-ansi": "^6.0.1"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/strip-ansi": {
+      "version": "6.0.1",
+      "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+      "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+      "dependencies": {
+        "ansi-regex": "^5.0.1"
+      },
+      "engines": {
+        "node": ">=8"
+      }
+    },
+    "node_modules/toidentifier": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+      "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+      "engines": {
+        "node": ">=0.6"
+      }
+    },
+    "node_modules/tr46": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
+      "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==",
+      "dependencies": {
+        "punycode": "^2.1.1"
+      },
+      "engines": {
+        "node": ">=12"
+      }
+    },
+    "node_modules/tslib": {
+      "version": "2.6.2",
+      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
+      "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="
+    },
+    "node_modules/type-is": {
+      "version": "1.6.18",
+      "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+      "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+      "dependencies": {
+        "media-typer": "0.3.0",
+        "mime-types": "~2.1.24"
+      },
+      "engines": {
+        "node": ">= 0.6"
+      }
+    },
+    "node_modules/typescript": {
+      "version": "5.2.2",
+      "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
+      "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
+      "bin": {
+        "tsc": "bin/tsc",
+        "tsserver": "bin/tsserver"
+      },
+      "engines": {
+        "node": ">=14.17"
+      }
+    },
+    "node_modules/undici-types": {
+      "version": "5.25.3",
+      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz",
+      "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA=="
+    },
+    "node_modules/unpipe": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+      "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/utils-merge": {
+      "version": "1.0.1",
+      "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+      "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
+      "engines": {
+        "node": ">= 0.4.0"
+      }
+    },
+    "node_modules/vary": {
+      "version": "1.1.2",
+      "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+      "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+      "engines": {
+        "node": ">= 0.8"
+      }
+    },
+    "node_modules/webidl-conversions": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+      "engines": {
+        "node": ">=12"
+      }
+    },
+    "node_modules/whatwg-url": {
+      "version": "11.0.0",
+      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
+      "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==",
+      "dependencies": {
+        "tr46": "^3.0.0",
+        "webidl-conversions": "^7.0.0"
+      },
+      "engines": {
+        "node": ">=12"
+      }
+    },
+    "node_modules/wrap-ansi": {
+      "version": "7.0.0",
+      "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+      "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+      "dependencies": {
+        "ansi-styles": "^4.0.0",
+        "string-width": "^4.1.0",
+        "strip-ansi": "^6.0.0"
+      },
+      "engines": {
+        "node": ">=10"
+      },
+      "funding": {
+        "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+      }
+    },
+    "node_modules/y18n": {
+      "version": "5.0.8",
+      "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+      "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/yargs": {
+      "version": "17.7.2",
+      "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+      "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+      "dependencies": {
+        "cliui": "^8.0.1",
+        "escalade": "^3.1.1",
+        "get-caller-file": "^2.0.5",
+        "require-directory": "^2.1.1",
+        "string-width": "^4.2.3",
+        "y18n": "^5.0.5",
+        "yargs-parser": "^21.1.1"
+      },
+      "engines": {
+        "node": ">=12"
+      }
+    },
+    "node_modules/yargs-parser": {
+      "version": "21.1.1",
+      "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+      "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+      "engines": {
+        "node": ">=12"
+      }
+    }
+  }
+}

+ 23 - 3
package.json

@@ -4,8 +4,28 @@
   "description": "For message buffering",
   "main": "index.js",
   "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
+    "build": "tsc -p tsconfig.json",
+    "watch": "tsc -p tsconfig.json --watch",
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "generatedata": "node services/utility/generateData.js",
+    "grpc1": "node grpc/grpc1.js",
+    "grpc2": "node grpc/grpc2.js"
   },
   "author": "",
-  "license": "ISC"
-}
+  "license": "ISC",
+  "dependencies": {
+    "@faker-js/faker": "^8.1.0",
+    "@grpc/grpc-js": "^1.9.4",
+    "dotenv": "^16.3.1",
+    "express": "^4.18.2",
+    "grpc-health-check": "^2.0.0",
+    "lodash": "^4.17.21",
+    "mongo": "^0.1.0",
+    "mongoose": "^7.6.0",
+    "rxjs": "^7.8.1"
+  },
+  "devDependencies": {
+    "@types/node": "^20.6.0",
+    "typescript": "^5.2.2"
+  }
+}

+ 377 - 0
services/error.handling.service.fis.ts

@@ -0,0 +1,377 @@
+import * as _ from 'lodash'
+import * as fs from 'fs'
+import mongoose, { Model, Schema } from 'mongoose';
+import { Observable, Subject, Subscription, from } from 'rxjs'
+import { ColorCode, MessageLog, ReportStatus } from '../interfaces/general.interface'
+require('dotenv').config();
+
+// Implement status chain refactoring
+export class FisErrorHandlingService {
+    private mongoUrl: string = process.env.MONGO + 'emergencyStorage'
+    private bufferedStorage: MessageLog[] = []
+    private mongoConnection: any
+    private messageModel: any
+    private maximumBufferLength: number = parseInt(process.env.MaxBufferLoad as string) // right now just put as 15
+
+    constructor() {
+        // Connect to mongoDB. 
+        this.manageMongoConnection()
+    }
+
+    // Main function that intercepts outgoing messages by communicating || intepreting report status from grpc connection as indicator 
+    public handleMessage(messageToBePublished: Subject<MessageLog>, statusReport: Subject<ReportStatus>): Subject<MessageLog> {
+        let releaseMessageSubject: Subject<MessageLog> = new Subject() // A return value
+        // Using the concept of toggling to improve the eficacy of subscription control && data flow
+        let messageReleaseSubscription: Subscription | null = null
+        let messageBufferSubscription: Subscription | null = null
+        let messageStreamToMongo: Subscription | null = null
+        this.checkBufferLimit(messageToBePublished, statusReport)
+        statusReport.subscribe((report: any) => {
+            if (report.code == ColorCode.GREEN) {
+                console.log(`Connection status report && ${report.message ?? 'No Message'}`)
+                /* Status Chain begins */
+                let status: Status = 1
+                if (status === 1) {
+                    messageStreamToMongo = this.deactivateMongoStreamSubscription(messageStreamToMongo)
+                    if (messageStreamToMongo) status = -1
+                }
+                if (status === 1) {
+                    messageBufferSubscription = this.deactivateBufferSubscription(messageBufferSubscription)
+                    if (messageBufferSubscription) status = -1
+                }
+                if (status === 1) {
+                    messageReleaseSubscription = this.activateReleaseSubscription(messageReleaseSubscription, messageToBePublished, releaseMessageSubject)
+                    if (!messageReleaseSubscription) status = -1
+                }
+                if (status === 1) {
+                    this.releaseMessageFromLocalBuffer(this.bufferedStorage).then((resObs: Observable<MessageLog>) => {
+                        resObs.subscribe({
+                            next: message => releaseMessageSubject.next(message),
+                            error: err => console.error(err),
+                            complete: () => {
+                                this.bufferedStorage = []
+                                console.log(`Reset buffer Storage count: ${this.bufferedStorage.length}. All messages have been released back into the stream.`)
+                            }
+                        })
+                    }).catch((err) => {
+                        status = -1
+                        console.error(err)
+                    })
+                }
+                if (status === 1) {
+                    this.releaseMessageFromMongoStorage().then((resObs: Subject<MessageLog>) => {
+                        resObs.subscribe({
+                            next: message => releaseMessageSubject.next(message),
+                            error: err => console.error(err),
+                            complete: () => console.log(`All Mongo data are transferred `)
+                        })
+                    }).catch((err) => {
+                        status = -1
+                        console.error(err)
+                    })
+                }
+                if (status === -1) {
+                    console.log(`Something Went Wrong in handling ${ColorCode.RED} report.`)
+                }
+
+            }
+            if (report.code == ColorCode.YELLOW) {
+                if (report.payload) {
+                    console.log(`Rebuffering ${report.payload.appData?.msgId} into buffer...`)
+                    this.bufferedStorage.push(report.payload)
+                }
+                console.log(`Connection status report && ${report.message ?? 'No Message'}`)
+
+                let status: Status = 1
+                /* Status Chain begins */
+                if (status === 1) {
+                    messageBufferSubscription = this.activateBufferSubscription(this.bufferedStorage, messageBufferSubscription, messageToBePublished)
+                    if (!messageBufferSubscription) status = -1
+                }
+                if (status === 1) {
+                    messageReleaseSubscription = this.deactivateReleaseSubscription(messageReleaseSubscription)
+                    if (messageReleaseSubscription) status = -1
+                }
+                if (status === -1) {
+                    console.log(`Something Went Wrong in handling ${ColorCode.RED} report.`)
+                }
+            }
+            if (report.code == ColorCode.RED) {
+                console.log(`Connection status report: Server down. ${report.message} lol`)
+
+                let status: Status = 1
+                if (status === 1) {
+                    messageStreamToMongo = this.activateMongoStreamSubscription(messageStreamToMongo, messageToBePublished)
+                    if (!messageStreamToMongo) status = -1
+                }
+                if (status === 1) {
+                    messageBufferSubscription = this.deactivateBufferSubscription(messageBufferSubscription)
+                    if (messageBufferSubscription) status = -1
+                }
+                if (status === 1) {
+                    this.transferBufferedMessagseToMongoStorage(this.bufferedStorage, messageBufferSubscription).then((res: MessageLog[]) => {
+                        if (res.length !== this.bufferedStorage.length || this.bufferedStorage.length > 0) status = -1 // this promise function should return an empty array
+                    })
+                }
+                if (status === -1) {
+                    console.log(`Something Went Wrong in handling ${ColorCode.RED} report.`)
+                }
+
+            }
+            if (!report.code || report.code == "") {
+                console.log(`Unknown message...`)
+            }
+        })
+        return releaseMessageSubject
+    }
+
+    private checkBufferLimit(message: Subject<any>, statusReport: Subject<ReportStatus>) {
+        message.subscribe(() => {
+            if (this.bufferedStorage.length >= this.maximumBufferLength) {
+                // for every messges that comes in, check the bufffer size, if it exceesd more than designated amount, push a red report status i
+                console.log(`Buffer length exceeds limit imposed!!!`)
+                let report: ReportStatus = {
+                    code: ColorCode.RED,
+                    message: `Buffer is exceeding limit. Initiate storage transfer to designated database. `
+                }
+                statusReport.next(report)
+
+            }
+        })
+    }
+
+    // Release the incoming Messages to be returned to the caller
+    private activateReleaseSubscription(messageReleaseSubscription, messageToBePublished, releaseMessageSubject): Subscription | null {
+        if (!messageReleaseSubscription) {
+            messageReleaseSubscription = messageToBePublished.subscribe({
+                next: (message: MessageLog) => {
+                    console.log(`Releasing ${message.appData.msgId}...`);
+                    releaseMessageSubject.next(message);
+                },
+                error: (err) => console.error(err),
+                complete: () => { },
+            });
+            console.log(`Subscription message release activated.`);
+        } else {
+            console.log(`Subscription message release is already active.`);
+        }
+        return messageReleaseSubscription
+    }
+
+    // Stop the incoming Messaes to be returned to caller
+    private deactivateReleaseSubscription(messageReleaseSubscription): Subscription | null {
+        if (messageReleaseSubscription) {
+            messageReleaseSubscription.unsubscribe();
+            messageReleaseSubscription = null;
+            console.log(`Subscription message release deactivated.`);
+        } else {
+            console.log(`Subscription message release is already deactivated.`);
+        }
+        return messageReleaseSubscription
+    }
+
+    // Begin to push the incoming messages into local instantarray
+    private activateBufferSubscription(bufferStorage: MessageLog[], messageBufferSubscription: Subscription | null, messageToBePublished: Subject<any>): Subscription | null {
+        if (!messageBufferSubscription) {
+            messageBufferSubscription = messageToBePublished.subscribe({
+                next: (message: MessageLog) => {
+                    console.log(`Buffering ${message.appData.msgId}...  Local array length: ${bufferStorage.length}`);
+                    bufferStorage.push(message)
+                },
+                error: (err) => console.error(err),
+                complete: () => { },
+            });
+            console.log(`Subscription message buffer activated.`);
+        } else {
+            console.log(`Subscription message buffer is already active.`);
+        }
+        return messageBufferSubscription
+    }
+
+    // Stop pushing the incoming messages into local instantarray
+    private deactivateBufferSubscription(messageBufferSubscription: Subscription | null): Subscription | null {
+        if (messageBufferSubscription) {
+            messageBufferSubscription.unsubscribe();
+            messageBufferSubscription = null;
+            console.log(`Subscription message buffer deactivated.`);
+        } else {
+            console.log(`Subscription message buffer is already deactivated.`);
+        }
+        return null
+    }
+
+    // Change the streaming direction of the incoming messages into mongo streaming subject( to be saved in local databse )
+    private activateMongoStreamSubscription(messageStreamToMongo: Subscription | null, messageToBePublished: Subject<any>): Subscription | null {
+        if (!messageStreamToMongo) {
+            messageStreamToMongo = messageToBePublished.subscribe({
+                next: (message: MessageLog) => {
+                    console.log(`Saving ${message.appData.msgId}...`);
+                    this.saveToMongo(message)
+                },
+                error: (err) => console.error(err),
+                complete: () => { },
+            });
+            console.log(`Subscription message streaming to Mongo activated.`);
+        } else {
+            console.log(`Subscription message streaming to Mongo  is already active.`);
+        }
+        return messageStreamToMongo
+    }
+
+    // Stop or cut off the mongo streaming
+    private deactivateMongoStreamSubscription(messageStreamToMongo: Subscription | null): Subscription | null {
+        if (messageStreamToMongo) {
+            messageStreamToMongo.unsubscribe();
+            messageStreamToMongo = null;
+            console.log(`Subscription message streaming to Mongo deactivated.`);
+        } else {
+            console.log(`Subscription message streaming to Mongo is already deactivated.`);
+        }
+        return messageStreamToMongo
+    }
+
+    // Store in json file in this project folder. To be enabled in future
+    private async transferMessageToLocalStorage(message: Subject<MessageLog>): Promise<void> {
+        let localArray: MessageLog[] = this.bufferedStorage
+        let filename = `localstorage.json`;
+
+        while (localArray.length > 0) {
+            let objectToWrite = this.bufferedStorage[0];
+            await writeMessage(objectToWrite, filename)
+        }
+        message.subscribe((message: MessageLog) => {
+            writeMessage(message, filename)
+        })
+
+        if (localArray.length < 1) this.bufferedStorage = localArray
+        console.log('Local Array is empty. Finished transferring to files.')
+
+        async function writeMessage(message: MessageLog, filename: string) {
+            try {
+                let stringifiedMessage = JSON.stringify(message);
+                await fs.promises.appendFile(filename, stringifiedMessage + "\r\n")
+                console.log(`Successfully transferred ${filename}`);
+                localArray.shift();
+            } catch (err) {
+                console.error(`Error trasferring ${filename}:`, err);
+            }
+        }
+    }
+
+    // To be used by mongoStreamSubscription to perform the saving execution
+    private async saveToMongo(message: MessageLog): Promise<boolean> {
+        return new Promise((resolve, reject) => {
+            // let messageModel: Model<any> = this.mongoConnection.model('Message', require('../models/message.schema'))
+            this.messageModel.create(message).then(() => {
+                console.log(`Saved MessageID ${message.appData.msgId} into ${this.mongoUrl}`);
+                resolve(true)
+            }).catch((err) => {
+                console.log(`MongoSaveError: ${err.message}`)
+                reject(err)
+            })
+        })
+    }
+
+    // As the name implies, transder all the messages from the local instance into mongoStorage. Local instance should be emptied after transfer is completed
+    private async transferBufferedMessagseToMongoStorage(bufferedMessage: MessageLog[], messageBufferSubscription): Promise<MessageLog[]> {
+        return new Promise((resolve, reject) => {
+            let bufferedStorage: Observable<MessageLog> = from(bufferedMessage)
+            bufferedStorage.subscribe({
+                next: (message: MessageLog) => {
+                    this.saveToMongo(message).then((res) => {
+                        console.log(`Message ${message.appData.msgId} saved successfully...`)
+                    }).catch((err) => console.error(err))
+                },
+                error: (error) => {
+                    reject(error)
+                    console.error(error)
+                },
+                complete: () => {
+                    this.bufferedStorage = []
+                    if (messageBufferSubscription) {
+                        console.log(`All ${bufferedMessage.length} buffered messages have been sent for transfer to ${this.mongoUrl}. Current length: ${this.bufferedStorage.length}`)
+                    }
+                    resolve(this.bufferedStorage)
+                }
+            })
+        })
+    }
+
+    // Transfer stored messages from the local instance back into the stream to be returned to the caller.
+    private async releaseMessageFromLocalBuffer(bufferedStorage: MessageLog[]): Promise<Observable<MessageLog>> {
+        return new Promise((resolve, reject) => {
+            if (bufferedStorage.length > 1) {
+                let caseVariable = this.bufferedStorage.length > 1;
+                console.log(`Releasing data from local buffer instance. There ${caseVariable ? "is" : "are"} ${this.bufferedStorage.length} messages...`);
+                let returnArrayObs: Observable<MessageLog> = from(bufferedStorage)
+                resolve(returnArrayObs)
+            } else {
+                let message = `There is no data in stored in local instance`
+                reject(message)
+            }
+        })
+    }
+
+    // Transder all the stored messages in designated mongo databases. It should be empty after all the data has been transferred.
+    private async releaseMessageFromMongoStorage(): Promise<Subject<MessageLog>> {
+        return new Promise((resolve, reject) => {
+            let dataSubject: Subject<MessageLog> = new Subject()
+            this.extractAllMessages(dataSubject)
+            resolve(dataSubject)
+        })
+    }
+
+    // Connect to designated mongodatabase.
+    private async connectToMongoDatabase(): Promise<any> {
+        return new Promise((resolve, reject) => {
+            console.log(this.mongoUrl)
+            this.mongoConnection = mongoose.createConnection(this.mongoUrl)
+            this.mongoConnection.on('error', (error) => {
+                console.error('Connection error:', error);
+                resolve('')
+            });
+            this.mongoConnection.once('open', () => {
+                console.log(`Connected to ${process.env.MONGO}`);
+                this.messageModel = this.mongoConnection.model('Message', require('../models/message.schema'));
+            });
+        })
+    }
+
+    // Manage mongoCOnnectino. The logic used would be different across differnet application. This will loop the process indefinitely os it is always trying to connect to database.
+    private async manageMongoConnection(): Promise<boolean> {
+        while (true) {
+            try {
+                await this.connectToMongoDatabase()
+            } catch (error) {
+                console.log(`Something Wrong occured. Please check at manageMongoConnection`)
+            }
+            await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for 1 second before the next attempt
+        }
+    }
+
+    public async extractAllMessages(subjectArgs: Subject<any>): Promise<void> {
+        if (this.messageModel) {
+            const eventStream = this.messageModel.find().lean().cursor()
+            eventStream.on('data', (message) => {
+                // Emit each document to the subject
+                subjectArgs.next(message);
+            });
+            eventStream.on('end', async () => {
+                // All data has been streamed, complete the subject
+                subjectArgs.complete();
+                // Delete the data once it has been streamed
+                try {
+                    await this.messageModel.deleteMany({});
+                    console.log('Data in Mongo deleted successfully.');
+                } catch (err) {
+                    console.error('Error deleting data:', err);
+                }
+            });
+        } else {
+            console.log(`Error: Message Model is ${this.messageModel}!! Please set up the mongoose connectino properly!`)
+        }
+    }
+
+}
+
+type Status = -1 | 0 | 1 // For status chain effect

+ 456 - 0
services/grpc.service.ts

@@ -0,0 +1,456 @@
+import * as grpc from '@grpc/grpc-js';
+import { Subject, Subscription, take, takeUntil } from 'rxjs';
+import { ColorCode, GrpcConnectionType, MessageLog, ReportStatus } from '../interfaces/general.interface';
+import { Status } from '@grpc/grpc-js/build/src/constants';
+const message_proto = require('./protos/server.proto')
+
+export class GrpcService {
+    private grpcServerConnection: any = {}
+
+    constructor() { }
+
+    public async stopServer(serverUrl: string): Promise<any> {
+        return new Promise((resolve, reject) => {
+            if (this.grpcServerConnection[serverUrl]) {
+                console.log(`Shutting down the gRPC server:${serverUrl} ...`);
+                // this.grpcServerConnection[serverUrl].tryShutdown(() => {
+                //     console.log(`Server ${serverUrl} has been gracefully stopped.`);
+                //     resolve('')
+                // })
+                resolve(this.grpcServerConnection[serverUrl].forceShutdown())
+                console.log(`Server ${serverUrl} is forced to shut down!`)
+                // simply removing the reference to the GrpcService instance associated with the specific serverUrl from the grpcServerConnection object.
+                // However, the gRPC server instance itself continues to run as long as it has not been explicitly shut down using methods like tryShutdown.
+                console.log(`Deleting grpc connection instance:${serverUrl} .....`)
+                delete this.grpcServerConnection[serverUrl];
+            } else {
+                console.log(`Server${serverUrl} is not running.`);
+                reject()
+            }
+        })
+    }
+
+    public getAllGrpcServerConnectionInstance(): any {
+        console.log(this.grpcServerConnection)
+        return this.grpcServerConnection
+    }
+
+    // To be migrated into a service in the immediate future
+    public async createGrpcInstance(serverUrl: string, messageToBePublished: Subject<MessageLog>, reportStatus: Subject<ReportStatus>, connectionType: GrpcConnectionType) {
+        let messageToBeTransmitted: Subject<MessageLog> = messageToBePublished
+        let statusControl: Subject<ReportStatus> = reportStatus
+        let consecutiveResolutions = 0;
+        let lastResolutionTime = Date.now();
+        let alreadyHealthCheck: boolean = false
+        let yellowErrorEmission: boolean = false
+        let redErrorEmission: boolean = false
+
+        while (true) {
+            try {
+                if (connectionType.instanceType == 'client' && connectionType.serviceMethod == 'bidirectional') {
+                    await this.createBidirectionalStreamingClient(serverUrl, alreadyHealthCheck, messageToBeTransmitted, statusControl);
+                }
+                if (connectionType.instanceType == 'client' && connectionType.serviceMethod == 'server streaming') {
+                    await this.createServerStreamingClient(serverUrl, alreadyHealthCheck, messageToBeTransmitted, statusControl);
+                }
+                if (connectionType.instanceType == 'server' && connectionType.serviceMethod == 'bidirectional') {
+                    await this.createGrpcBidirectionalServer(serverUrl, messageToBeTransmitted, statusControl)
+                }
+                if (connectionType.instanceType == 'server' && connectionType.serviceMethod == 'server streaming') {
+                    await this.createServerStreamingServer(serverUrl, alreadyHealthCheck, messageToBePublished, statusControl)
+                }
+                // If connection resolves (indicating failure), increment the count
+                consecutiveResolutions++;
+                // console.log(`Reconnection Attempt: ${consecutiveResolutions}`)
+                alreadyHealthCheck = true
+
+
+                // If there are x consecutive resolutions, log an error and break the loop
+                if (consecutiveResolutions >= parseInt(process.env.ReconnectionAttempt as string) && redErrorEmission == false) {
+                    redErrorEmission = true
+                    console.error(`Connection failed ${consecutiveResolutions} times. Stopping connection attempts.`);
+                    let error: ReportStatus = {
+                        code: ColorCode.RED,
+                        message: 'Initiate Doomsday protocol....'
+                    }
+                    statusControl.next(error)
+                }
+                if (consecutiveResolutions < parseInt(process.env.ReconnectionAttempt as string) && yellowErrorEmission == false) {
+                    yellowErrorEmission = true
+                    let error: ReportStatus = {
+                        code: ColorCode.YELLOW,
+                        // message: `Reconnection Attempt: ${consecutiveResolutions}. Server has yet to respond`
+                        message: `Attempting reconnection... Server has yet to respond`
+                    }
+                    statusControl.next(error);
+                }
+            } catch (error) {
+                // Connection did not resolve, reset the count
+                consecutiveResolutions = 0;
+                console.error('Connection attempt failed:', error);
+            }
+
+            // Check for a pause of more than 3 seconds since the last resolution attempt
+            const currentTime = Date.now();
+            const timeSinceLastResolution = currentTime - lastResolutionTime;
+            if (timeSinceLastResolution > 2000) {
+                consecutiveResolutions = 0;
+                yellowErrorEmission = false
+                redErrorEmission = false
+                alreadyHealthCheck = false
+            }
+
+            // Update the last resolution time
+            lastResolutionTime = currentTime;
+
+            await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for 1 second before the next attempt
+            // timeout generate message to trigger this reconnection
+        }
+    }
+
+    private async createGrpcBidirectionalServer(serverUrl: string, messageToBeStream: Subject<any>, statusControl: Subject<ReportStatus>): Promise<any> { // '0.0.0.0:3001'
+        return new Promise((resolve, reject) => {
+            try {
+                // https://github.com/grpc/proposal/blob/master/L5-node-client-interceptors.md
+                let server: grpc.Server = new grpc.Server();
+                // Add the streamingData function to the gRPC service
+                // Define your message_proto.Message service methods
+
+                server.addService(message_proto.Message.service, {
+                    sendMessageStream: (call) => {
+                        console.log(`Client connected from: ${call.getPeer()}`);
+                        let report: ReportStatus = {
+                            code: ColorCode.GREEN,
+                            message: `Client connected!!`
+                        }
+                        statusControl.next(report)
+
+                        // Right now this is being broadcast.
+                        let subscription: Subscription = messageToBeStream.subscribe({
+                            next: (payload: any) => {
+                                let noConnection = call.cancelled // check connection for each and every message
+                                if (noConnection === true) { // that means there's no connection, beccause the cancel operation is determined to check 
+                                    let report: ReportStatus = {
+                                        code: ColorCode.YELLOW,
+                                        message: `Client is not alive.....`,
+                                        payload: payload
+                                    }
+                                    statusControl.next(report) // no connection. Tell buffer service to stop releasing messages
+                                    subscription.unsubscribe() // i still dont understand why i wrote this here
+                                } else {
+                                    console.log(`Sending ${payload.appData.msgId}`)
+                                    let message: string = JSON.stringify(payload)
+                                    call.write({ message })
+                                }
+                            },
+                            error: err => console.error(err),
+                            complete: () => { } //it will never complete
+                        })
+
+                        call.on('data', (data: any) => {
+                            // console.log(data) // it does return in string format
+                            let payload = JSON.parse(data.message)
+                            console.log(`Received Message from Client: ${payload.appData?.msgId}`);
+                            // Forward the received message to the RxJS subject
+                            // let respmsg: any = {
+                            //     msgId: payload.appData?.msgId,
+                            //     confirmationMessage: `Message ${payload.appData?.msgId} acknowledged!`
+                            // }
+                            // let message: string = JSON.stringify(respmsg)
+                            // console.log(`Responding to client: ${respmsg.msgId}`);
+                            // Note: The parameter here MUST BE STRICTLY be the same letter as defined in proto. Eg: message MessageRequest { string >>'message'<< = 1 }
+                            // call.write({ message });
+                        });
+
+                        call.on('end', () => {
+                            console.log('Client stream ended');
+                            // but the stream never ends. THis is not a reliable way to tell if a client is disconnected
+                        });
+
+                        call.on('error', (err) => {
+                            // Error that may occue during the rpc call. Id there's an error, put a callbacn function there to check the connection for client
+                            // emit a yellow report to halt message release. If the server does not reply to the callback function, then emit a red card
+                            // the call back function will be to write and then the client should response immediately through test
+                        });
+
+                        call.on('close', () => {
+                            console.log('Unknown cause for diconnectivity');
+                            // Handle client closure, which may be due to errors or manual termination
+                        });
+
+                    },
+
+                    Check: (_, callback) => {
+                        // health check logic here
+                        // for now it is just sending the status message over to tell the client it is alive
+                        // For simplicity, always return "SERVING" as status
+                        callback(null, { status: 'SERVING' });
+                    },
+                });
+
+                // Bind and start the server
+                server.bindAsync(serverUrl, grpc.ServerCredentials.createInsecure(), () => {
+                    console.log(`gRPC server is running on ${serverUrl}`);
+                    server.start();
+                });
+                this.grpcServerConnection[serverUrl] = server
+            }
+            catch (error) {
+                resolve(error)
+            }
+
+        })
+    }
+
+
+    private async createBidirectionalStreamingClient(server: string, alreadyHealthCheck: boolean, messageToBeTransmitted: Subject<any>, statusControl: Subject<ReportStatus>): Promise<string> {
+        let subscription: any
+        let unsubscribed: boolean = false
+
+        return new Promise(async (resolve, reject) => {
+            const client = new message_proto.Message(server, grpc.credentials.createInsecure());
+            const call = client.sendMessageStream();
+
+            this.checkConnectionHealth(client, statusControl, alreadyHealthCheck)
+
+            call.on('status', (status: Status) => {
+                // console.log(status) // For more info: https://grpc.github.io/grpc/core/md_doc_statuscodes.html
+                // https://grpc.io/docs/what-is-grpc/core-concepts/#streaming
+                if (status == grpc.status.UNAVAILABLE) { // only returns a status when there's error. Otherwise it just waits
+                    resolve('No connection established. Server is not responding..')
+                }
+            });
+
+            // All the grpc operations are here
+            // Subscribe to the RxJS subject to send data to the server
+            subscription = messageToBeTransmitted.subscribe({
+                next: (payload: any) => {
+                    if (!unsubscribed) {
+                        console.log(`Sending ${payload.appData.msgId}`)
+                        let message: string = JSON.stringify(payload)
+                        call.write({ message })
+                    }
+                },
+                error: err => console.error(err),
+                complete: () => { } //it will never complete
+            });
+
+
+            call.on('data', (data: any) => {
+                let message = JSON.parse(data.message)
+                console.log(`Received acknowledgement from Server: ${message.msgId ?? message.appData?.msgId ?? `Invalid`}`);
+            });
+
+            call.on('error', (err) => {
+                console.log(`Something wrong with RPC call...`)
+                if (!unsubscribed && subscription) { // kill subcription to prevent memory leaks
+                    subscription.unsubscribe();
+                    unsubscribed = true;
+                }
+                resolve('Server Error');
+            });
+
+            call.on('end', () => {
+                if (!unsubscribed && subscription) { // kill subcription to prevent memory leaks
+                    subscription.unsubscribe();
+                    unsubscribed = true;
+                }
+                resolve('Server Error');
+            });
+
+        })
+    }
+
+    private async createServerStreamingServer(serverUrl: string, alreadyHealthCheck: boolean, messageToBeStream: Subject<any>, statusControl: Subject<ReportStatus>): Promise<any> { // '0.0.0.0:3001'
+        return new Promise((resolve, reject) => {
+            try {
+                // https://github.com/grpc/proposal/blob/master/L5-node-client-interceptors.md
+                let server: grpc.Server = new grpc.Server();
+                let onHold: any
+                // Add the streamingData function to the gRPC service
+                // Define your message_proto.Message service methods
+
+                server.addService(message_proto.Message.service, {
+                    HandleMessage: (call) => { // this is for bidirectional streaming. Need to have another one for unary calls for web clients
+                        console.log(`Client connected from: ${call.getPeer()}`);
+                        // let request = call.request // just putting it here to verify unary call request
+                        let report: ReportStatus = {
+                            code: ColorCode.GREEN,
+                            message: `Client connected!!`
+                        }
+                        statusControl.next(report)
+                        let subscription: Subscription = messageToBeStream.subscribe({
+                            next: (payload: any) => {
+                                let noConnection = call.cancelled // check connection for each and every message
+                                if (noConnection === true) { // that means there's no connection, beccause the cancel operation is determined to check 
+                                    let report: ReportStatus = {
+                                        code: ColorCode.YELLOW,
+                                        message: `Client is not alive.....`,
+                                        payload: payload
+                                    }
+                                    statusControl.next(report)
+                                    subscription.unsubscribe()
+                                } else {
+                                    console.log(`Sending ${payload.appData.msgId}`)
+                                    let message: string = JSON.stringify(payload)
+                                    call.write({ message })
+                                    // onHold = null
+                                }
+                            },
+                            error: err => {
+                                console.error(err)
+                                let report: ReportStatus = {
+                                    code: ColorCode.YELLOW,
+                                    message: `Message streaming error`
+                                }
+                                statusControl.next(report)
+                            },
+                            complete: () => console.log(``)  //it will never complete
+                        })
+
+                        call.on('data', (data: any) => {
+                            // console.log(data) // it does return in string format
+                            let payload = JSON.parse(data.message)
+                            console.log(data)
+                            // console.log(`Received Message from Client: ${payload.appData?.msgId}`);
+                            // Forward the received message to the RxJS subject
+                            let respmsg: any = {
+                                msgId: payload.appData?.msgId,
+                                confirmationMessage: `Message ${payload.appData?.msgId} acknowledged!`
+                            }
+                            let message: string = JSON.stringify(respmsg)
+                            console.log(`Responding to client: ${respmsg.msgId}`);
+                            // Note: The parameter here MUST BE STRICTLY be the same letter as defined in proto. Eg: message MessageRequest { string >>'message'<< = 1 }
+                            call.write({ message });
+                        });
+
+                        call.on('end', () => {
+                            console.log('Client stream ended');
+                            // but the stream never ends. THis is not a reliable way to tell if a client is disconnected
+                        });
+
+                        call.on('error', (err) => {
+                            // Error that may occue during the rpc call. Id there's an error, put a callbacn function there to check the connection for client
+                            // emit a yellow report to halt message release. If the server does not reply to the callback function, then emit a red card
+                            // the call back function will be to write and then the client should response immediately through test
+                        });
+
+                        call.on('close', () => {
+                            console.log('Unknown cause for diconnectivity');
+                            // Handle client closure, which may be due to errors or manual termination
+                        });
+                    },
+
+                    Check: (_, callback) => {
+                        // health check logic here
+                        // for now it is just sending the status message over to tell the client it is alive
+                        // For simplicity, always return "SERVING" as status
+                        callback(null, { status: 'SERVING' });
+                    },
+                });
+
+                // Bind and start the server
+                server.bindAsync(serverUrl, grpc.ServerCredentials.createInsecure(), () => {
+                    console.log(`gRPC server is running on ${serverUrl}`);
+                    server.start();
+                });
+                this.grpcServerConnection[serverUrl] = server
+            }
+            catch (error) {
+                resolve(error)
+            }
+
+        })
+    }
+
+    // Create a server streaming call. Please note that the structure of the code would not be the same as bidirectional because of it's unary nature
+    private async createServerStreamingClient(server: string, alreadyHealthCheck: boolean, unaryRequestSubject: Subject<any>, statusControl: Subject<ReportStatus>): Promise<string> {
+        return new Promise(async (resolve, reject) => {
+            const client = new message_proto.Message(server, grpc.credentials.createInsecure());
+            this.checkConnectionHealth(client, statusControl, alreadyHealthCheck) // atcually there's no need for this 
+            unaryRequestSubject.subscribe({
+                next: (request: any) => {
+                    let message = {
+                        id: '123',
+                        message: JSON.stringify(request)
+                    }
+
+                    console.log(`Sending request: ${message.id} over to server....`)
+                    const call = client.HandleMessage(message)
+
+                    call.on('status', (status: Status) => {
+                        // console.log(status) // For more info: https://grpc.github.io/grpc/core/md_doc_statuscodes.html
+                        // https://grpc.io/docs/what-is-grpc/core-concepts/#streaming
+                        if (status == grpc.status.OK) { // only returns a status when there's error. Otherwise it just waits
+                            console.log(`Message trasmission operation is successful`)
+                            // RPC completed successfully
+                        } if (status == grpc.status.UNAVAILABLE) {
+                            resolve('No connection established. Server is not responding..')
+                            let report = {
+                                code: ColorCode.YELLOW,
+                                message: `Server doesn't seem to be alive. Error returned.`
+                            }
+                            statusControl.next(report)
+                        }
+                    });
+
+                    call.on('data', (data: any) => {
+                        let message = JSON.parse(data.message)
+                        console.log(`Received data from Server: ${message.appData?.msgId ?? `Invalid`}`);
+                    });
+
+                    call.on('error', (err) => {
+                        let report = {
+                            code: ColorCode.YELLOW,
+                            message: `Server doesn't seem to be alive. Error returned.`
+                        }
+                        statusControl.next(report)
+                        // resolve(err)
+                    });
+
+                    call.on('end', () => { // this is for gracefull || willfull termination from the server
+                        let report = {
+                            code: ColorCode.YELLOW,
+                            message: `Server doesn't seem to be alive. Error returned.`
+                        }
+                        statusControl.next(report)
+                        // subscription.unsubscribe(); // this is not correct i am just destroying the entire operation. i should be terminating the instance to which i think it does by it self
+                        // resolve('Server Error');
+                    });
+                    /* Avoid rsolving at the moment. Because initially it was intended for the bi directional streaming to continue to instantiate the client
+                    should there be any rpc errors or internet connection errors. In this case, we just want to listen to incoming unary call without terminating the session
+                    A separate resolve will be prepared for the subject should it fails in its operation */
+                },
+                error: error => {
+                    console.error(error),
+                        resolve(error)
+                },
+                complete: () => { } // should not complete since this is an indefinite listening process to transmit requests made by relevant client application
+            })
+
+
+        })
+    }
+
+    // Check connection To be Update. This function is destroying my code flow
+    private async checkConnectionHealth(client: any, statusControl: Subject<ReportStatus>, alreadyHealthCheck: boolean): Promise<boolean> {
+        return new Promise((resolve, reject) => {
+            client.Check({}, (error, response) => {
+                if (response) {
+                    console.log(`GRPC Health check status: ${response.status} Server Connected`);
+                    let report: ReportStatus = {
+                        code: ColorCode.GREEN,
+                        message: `Good to go!!!`
+                    }
+                    statusControl.next(report)
+                } else {
+                    if (alreadyHealthCheck == false) console.error(`Health check failed: ${error}`);
+
+                }
+            })
+        })
+    }
+
+}
+
+

+ 45 - 0
services/protos/message.proto

@@ -0,0 +1,45 @@
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "io.grpc.examples.helloworld";
+option java_outer_classname = "HelloWorldProto";
+option objc_class_prefix = "HLW";
+
+package message;
+
+// The greeting service definition.
+service Message {
+  rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
+
+  rpc sendMessage (MessageRequest) returns (MessageResponse) {}
+
+  rpc HandleMessage (Request) returns (stream Response) {}
+
+  rpc streamMessage (stream MessageRequest) returns (MessageResponse) {}
+
+  rpc sendMessageStream (stream MessageRequest) returns (stream MessageResponse) {}
+}
+
+message Request { 
+    string id = 1;
+    string message = 2;
+}
+
+message Response { 
+    string id = 1;
+    string message = 2;
+}
+
+message MessageRequest {
+  string message = 1;
+}
+
+message MessageResponse {
+  string message = 1;
+}
+
+message HealthCheckRequest {}
+
+message HealthCheckResponse {
+  string status = 1;
+}

+ 15 - 0
services/protos/server.proto.ts

@@ -0,0 +1,15 @@
+"use strict";
+import * as path from 'path'
+import * as grpc from '@grpc/grpc-js'
+import * as protoLoader from '@grpc/proto-loader'
+const PROTO_PATH = path.join(__dirname, 'message.proto');
+const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
+  keepCase: true,
+  longs: String,
+  enums: String,
+  defaults: true,
+  oneofs: true,
+});
+const message_proto: any = grpc.loadPackageDefinition(packageDefinition).message;
+module.exports = message_proto;
+//# sourceMappingURL=health.js.map

+ 60 - 0
services/utility/generateData.ts

@@ -0,0 +1,60 @@
+import * as fs from "fs"
+import { faker } from '@faker-js/faker';
+
+let GigaPayload: any[] = []
+let tags = ['free', 'basic', 'business', 'enterprise', 'rich', 'super-rich', 'mega-rich', 'empire'];
+
+export function createMessage(): any {
+  return {
+    appLogLocId: faker.string.uuid(),
+    appData: {
+      msgId: faker.string.uuid(),
+      msgLogDateTime: faker.date.past(),
+      msgDateTime: faker.date.past(),
+      msgTag: faker.helpers.arrayElements(tags, 3),
+      msgPayload: faker.lorem.paragraphs(5)
+      // msgPayload: {
+      //   header: {
+      //     messageType: "Command",
+      //     messageID: faker.string.uuid(),
+      //     messageName: faker.word.adjective(),
+      //     dateCreated: faker.date.recent(),
+      //     isAggregated: faker.datatype.boolean(),
+      //     servicecId: faker.string.uuid(),
+      //     userId: faker.string.uuid(),
+      //     requesterId: faker.string.uuid(),
+      //     messagePreoducerInformation: {
+      //       origin: {
+      //         userApplication: {
+      //           userAppId: faker.finance.accountName(),
+      //           userAppName: faker.person.jobTitle()
+      //         }
+      //       },
+      //       components: faker.word.adverb()
+      //     },
+      //     security: {
+      //       ucpid: faker.string.uuid()
+      //     },
+      //     messageDataLocation: {
+      //       isEmbaded: faker.datatype.boolean()
+      //     },
+      //     messageDataFormat: {
+      //       dataFormate: faker.date.anytime()
+      //     },
+      //     requestExecutiomNode: faker.number.int(),
+      //     requestTimeOut: faker.number.int(),
+      //     command: faker.word.adjective()
+      //   },
+      // }
+    }
+  }
+}
+
+
+
+Array.from({ length: 100 }).forEach(() => {
+  GigaPayload.push(createMessage());
+});
+
+
+fs.writeFileSync('payload2.json', JSON.stringify(GigaPayload))

+ 7 - 0
startgrpc.bat

@@ -0,0 +1,7 @@
+
+@echo off
+start wt -M -d "C:\Users\esenz\dev\Task\Fis-Restransmission" cmd /k "npm run grpc1" ; split-pane -d "C:\Users\esenz\dev\Task\Fis-Restransmission" cmd /k "npm run grpc2" ; split-pane -d "C:\Users\esenz\dev\Task\Fis-Restransmission" cmd /k "npm run grpc2"
+
+
+//wt -p "Command Prompt" ; split-pane -p "Windows PowerShell" ; split-pane -H 
+

+ 7 - 0
startgrpc2.bat

@@ -0,0 +1,7 @@
+
+@echo off
+start wt -M -d "C:\Users\esenz\dev\Task\Fis-Restransmission" cmd /k "npm run grpc1" ; split-pane -d "C:\Users\esenz\dev\Task\Fis-Restransmission" cmd /k "npm run grpc2"
+
+
+//wt -p "Command Prompt" ; split-pane -p "Windows PowerShell" ; split-pane -H 
+

+ 92 - 0
tsconfig.json

@@ -0,0 +1,92 @@
+{
+  "compilerOptions": {
+    /* Visit https://aka.ms/tsconfig.json to read more about this file */
+    /* Projects */
+    // "incremental": true,                              /* Enable incremental compilation */
+    // "composite": true,                                /* Enable constraints that allow a TypeScript project to be used with project references. */
+    // "tsBuildInfoFile": "./",                          /* Specify the folder for .tsbuildinfo incremental compilation files. */
+    // "disableSourceOfProjectReferenceRedirect": true,  /* Disable preferring source files instead of declaration files when referencing composite projects */
+    // "disableSolutionSearching": true,                 /* Opt a project out of multi-project reference checking when editing. */
+    // "disableReferencedProjectLoad": true,             /* Reduce the number of projects loaded automatically by TypeScript. */
+    /* Language and Environment */
+    "target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
+    // "lib": [],                                        /* Specify a set of bundled library declaration files that describe the target runtime environment. */
+    // "jsx": "preserve",                                /* Specify what JSX code is generated. */
+    "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
+    "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
+    // "jsxFactory": "",                                 /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
+    // "jsxFragmentFactory": "",                         /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
+    // "jsxImportSource": "",                            /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
+    // "reactNamespace": "",                             /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
+    // "noLib": true,                                    /* Disable including any library files, including the default lib.d.ts. */
+    // "useDefineForClassFields": true,                  /* Emit ECMAScript-standard-compliant class fields. */
+    /* Modules */
+    "module": "commonjs", /* Specify what module code is generated. */
+    // "rootDir": "./",                                  /* Specify the root folder within your source files. */
+    "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
+    // "baseUrl": "./",                                  /* Specify the base directory to resolve non-relative module names. */
+    // "paths": {},                                      /* Specify a set of entries that re-map imports to additional lookup locations. */
+    // "rootDirs": [],                                   /* Allow multiple folders to be treated as one when resolving modules. */
+    // "typeRoots": [],                                  /* Specify multiple folders that act like `./node_modules/@types`. */
+    // "types": [],                                      /* Specify type package names to be included without being referenced in a source file. */
+    // "allowUmdGlobalAccess": true,                     /* Allow accessing UMD globals from modules. */
+    "resolveJsonModule": true, /* Enable importing .json files */
+    // "noResolve": true,                                /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
+    /* JavaScript Support */
+    // "allowJs": true,                                  /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
+    // "checkJs": true,                                  /* Enable error reporting in type-checked JavaScript files. */
+    // "maxNodeModuleJsDepth": 1,                        /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
+    /* Emit */
+    // "declaration": true,                              /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
+    // "declarationMap": true,                           /* Create sourcemaps for d.ts files. */
+    // "emitDeclarationOnly": true,                      /* Only output d.ts files and not JavaScript files. */
+    "sourceMap": true, /* Create source map files for emitted JavaScript files. */
+    // "outFile": "./",                                  /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
+    // "outDir": "./",                                   /* Specify an output folder for all emitted files. */
+    // "removeComments": true,                           /* Disable emitting comments. */
+    // "noEmit": true,                                   /* Disable emitting files from a compilation. */
+    // "importHelpers": true,                            /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
+    // "importsNotUsedAsValues": "remove",               /* Specify emit/checking behavior for imports that are only used for types */
+    // "downlevelIteration": true,                       /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
+    // "sourceRoot": "",                                 /* Specify the root path for debuggers to find the reference source code. */
+    // "mapRoot": "",                                    /* Specify the location where debugger should locate map files instead of generated locations. */
+    // "inlineSourceMap": true,                          /* Include sourcemap files inside the emitted JavaScript. */
+    // "inlineSources": true,                            /* Include source code in the sourcemaps inside the emitted JavaScript. */
+    // "emitBOM": true,                                  /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
+    // "newLine": "crlf",                                /* Set the newline character for emitting files. */
+    // "stripInternal": true,                            /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
+    // "noEmitHelpers": true,                            /* Disable generating custom helper functions like `__extends` in compiled output. */
+    // "noEmitOnError": true,                            /* Disable emitting files if any type checking errors are reported. */
+    "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
+    // "declarationDir": "./",                           /* Specify the output directory for generated declaration files. */
+    /* Interop Constraints */
+    // "isolatedModules": true,                          /* Ensure that each file can be safely transpiled without relying on other imports. */
+    // "allowSyntheticDefaultImports": true,             /* Allow 'import x from y' when a module doesn't have a default export. */
+    //"esModuleInterop": true,                             /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
+    // "preserveSymlinks": true,                         /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
+    //"forceConsistentCasingInFileNames": true,            /* Ensure that casing is correct in imports. */
+    /* Type Checking */
+    "strict": true, /* Enable all strict type-checking options. */
+    "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
+    // "strictNullChecks": true,                         /* When type checking, take into account `null` and `undefined`. */
+    // "strictFunctionTypes": true,                      /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
+    // "strictBindCallApply": true,                      /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
+    // "strictPropertyInitialization": true,             /* Check for class properties that are declared but not set in the constructor. */
+    // "noImplicitThis": true,                           /* Enable error reporting when `this` is given the type `any`. */
+    // "useUnknownInCatchVariables": true,               /* Type catch clause variables as 'unknown' instead of 'any'. */
+    "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
+    // "noUnusedLocals": true,                           /* Enable error reporting when a local variables aren't read. */
+    // "noUnusedParameters": true,                       /* Raise an error when a function parameter isn't read */
+    // "exactOptionalPropertyTypes": true,               /* Interpret optional property types as written, rather than adding 'undefined'. */
+    // "noImplicitReturns": true,                        /* Enable error reporting for codepaths that do not explicitly return in a function. */
+    // "noFallthroughCasesInSwitch": true,               /* Enable error reporting for fallthrough cases in switch statements. */
+    // "noUncheckedIndexedAccess": true,                 /* Include 'undefined' in index signature results */
+    // "noImplicitOverride": true,                       /* Ensure overriding members in derived classes are marked with an override modifier. */
+    // "noPropertyAccessFromIndexSignature": true,       /* Enforces using indexed accessors for keys declared using an indexed type */
+    // "allowUnusedLabels": true,                        /* Disable error reporting for unused labels. */
+    // "allowUnreachableCode": true,                     /* Disable error reporting for unreachable code. */
+    /* Completeness */
+    // "skipDefaultLibCheck": true,                      /* Skip type checking .d.ts files that are included with TypeScript. */
+    // "skipLibCheck": true                                 /* Skip type checking all .d.ts files. */
+  }
+}