Skip to content

Commit

Permalink
Standardize AddRefSeqAliasesChange
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Aug 20, 2024
1 parent 47907f3 commit 39adadf
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions packages/apollo-shared/src/Changes/AddRefSeqAliasesChange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ChangeOptions,
ClientDataStore,
LocalGFF3DataStore,
SerializedChange,
SerializedAssemblySpecificChange,
ServerDataStore,
} from '@apollo-annotation/common'
import { getSession } from '@jbrowse/core/util'
Expand All @@ -14,20 +14,18 @@ export interface SerializedRefSeqAliases {
aliases: string[]
}

export interface SerializedRefSeqAliasesChange extends SerializedChange {
typeName: string
assembly: string
export interface SerializedRefSeqAliasesChange
extends SerializedAssemblySpecificChange {
typeName: 'AddRefSeqAliasesChange'
refSeqAliases: SerializedRefSeqAliases[]
}

export class AddRefSeqAliasesChange extends AssemblySpecificChange {
typeName = 'AddRefSeqAliasesChange'
assembly: string
typeName = 'AddRefSeqAliasesChange' as const
refSeqAliases: SerializedRefSeqAliases[]

constructor(json: SerializedRefSeqAliasesChange, options?: ChangeOptions) {
super(json, options)
this.assembly = json.assembly
this.refSeqAliases = json.refSeqAliases
}

Expand All @@ -37,12 +35,8 @@ export class AddRefSeqAliasesChange extends AssemblySpecificChange {
if (!assembly) {
throw new Error(`assembly ${this.assembly} not found`)
}
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
const sessionAliases: { [x: string]: string | undefined } | undefined =
assembly.refNameAliases
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
const sessionLCAliases: { [x: string]: string | undefined } | undefined =
assembly.lowerCaseRefNameAliases
const sessionAliases = assembly.refNameAliases
const sessionLCAliases = assembly.lowerCaseRefNameAliases

if (!sessionAliases || !sessionLCAliases) {
throw new Error('Session refNameAliases not found in assembly')
Expand Down

0 comments on commit 39adadf

Please sign in to comment.