import { MemoryStorageProvider as MSP } from "matrix-bot-sdk" ; import { IBridgeStorageProvider } from "./StorageProvider" ; import { IssuesGetResponseData } from "../Github/Types" ; export class MemoryStorageProvider extends MSP implements IBridgeStorageProvider { private issues : Map < string , IssuesGetResponseData > = new Map ( ) ; private issuesLastComment : Map < string , string > = new Map ( ) ; private reviewData : Map < string , string > = new Map ( ) ; private figmaCommentIds : Map < string , string > = new Map ( ) ; constructor ( ) { super ( ) ; } public async setGithubIssue ( repo , issueNumber , data , scope = "" ) { this . issues . set ( `${ scope }${ repo }/${ issueNumber }` , data ) ; } public async getGithubIssue ( repo , issueNumber , scope = "" ) { return this . issues . get ( `${ scope }${ repo }/${ issueNumber }` ) || null ; } public async setLastNotifCommentUrl ( repo , issueNumber , url , scope = "" ) { this . issuesLastComment . set ( `${ scope }${ repo }/${ issueNumber }` , url ) ; } public async getLastNotifCommentUrl ( repo , issueNumber , scope = "" ) { return this . issuesLastComment . get ( `${ scope }${ repo }/${ issueNumber }` ) || null ; } public async setPRReviewData ( repo , issueNumber , data , scope = "" ) { const key = `${ scope }:${ repo }/${ issueNumber }` ; this . reviewData . set ( key , data ) ; } public async getPRReviewData ( repo , issueNumber , scope = "" ) { const key = `${ scope }:${ repo }/${ issueNumber }` ; return this . reviewData . get ( key ) || null ; } private static figmaCommentKey ( roomId , figmaCommentId ) { return `${ roomId }:${ figmaCommentId }` ; } public async setFigmaCommentEventId ( roomId , figmaCommentId , eventId ) { this . figmaCommentIds . set ( MemoryStorageProvider . figmaCommentKey ( roomId , figmaCommentId ) , eventId ) ; } public async getFigmaCommentEventId ( roomId , figmaCommentId ) { return this . figmaCommentIds . get ( MemoryStorageProvider . figmaCommentKey ( roomId , figmaCommentId ) ) || null ; } }