chore: extract schema types (#2375)

* chore: extract schema types

* address comments
This commit is contained in:
Timmy Huang
2021-08-12 03:12:21 +00:00
committed by GitHub
parent fc60b2acef
commit 59c475b821
7 changed files with 68 additions and 67 deletions
@@ -3,7 +3,7 @@ Helper functions for user-editable annotations state management.
See also reducers/annotations.js
*/
import { Schema } from "../../common/types/entities";
import { Schema } from "../../common/types/schema";
/*
There are a number of state constraints assumed throughout the
@@ -11,9 +11,9 @@ import catLabelSort from "../catLabelSort";
import {
RawSchema,
Schema,
LayoutColumn,
AnnotationColumn,
} from "../../common/types/entities";
EmbeddingSchema,
AnnotationColumnSchema,
} from "../../common/types/schema";
/*
System wide schema assumptions:
@@ -86,7 +86,7 @@ export function removeObsAnnoColumn(schema: Schema, name: string): Schema {
export function addObsAnnoColumn(
schema: Schema,
_: string,
defn: AnnotationColumn
defn: AnnotationColumnSchema
): Schema {
const newSchema = _copyObsAnno(schema);
@@ -142,7 +142,7 @@ export function addObsAnnoCategory(schema: any, name: any, category: any) {
return newSchema;
}
export function addObsLayout(schema: Schema, layout: LayoutColumn): Schema {
export function addObsLayout(schema: Schema, layout: EmbeddingSchema): Schema {
/* add or replace a layout */
const newSchema = _copyObsLayout(schema);
newSchema.layout.obs.push(layout);