-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e766b7e
commit 34f14ad
Showing
9 changed files
with
326 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { z } from "zod"; | ||
import { GenomeSchema, StatsSchema } from "./BaktaResults"; | ||
import { QualitySchema } from "./CheckmResults"; | ||
import { ClassfificationSchema } from "./GtdbtkResult"; | ||
|
||
const SimpleFeatureSchema = z.object({ | ||
gene: z.optional(z.nullable(z.string())), | ||
product: z.optional(z.nullable(z.string())), | ||
}); | ||
|
||
const SimpleGtdbtkSchema = z.object({ | ||
classification: ClassfificationSchema, | ||
}); | ||
const SimpleMlstEntrySchema = z.object({ | ||
sequence_type: z.string(), | ||
}); | ||
const SimpleCheckm2Schema = z.object({ | ||
quality: QualitySchema, | ||
}); | ||
|
||
const BakrepSearchEntrySchema = z.object({ | ||
id: z.string(), | ||
bakta: z.optional( | ||
z.object({ | ||
genome: GenomeSchema, | ||
stats: StatsSchema, | ||
features: z.optional(z.array(SimpleFeatureSchema)), | ||
}), | ||
), | ||
gtdbtk: z.optional(SimpleGtdbtkSchema), | ||
mlst: z.optional(SimpleMlstEntrySchema), | ||
checkm2: z.optional(SimpleCheckm2Schema), | ||
}); | ||
|
||
const BakrepSearchResultSchema = z.object({ | ||
offset: z.number(), | ||
total: z.number(), | ||
results: z.array(BakrepSearchEntrySchema), | ||
}); | ||
|
||
export type BakrepSearchResultEntry = z.infer<typeof BakrepSearchEntrySchema>; | ||
export type BakrepSearchResult = z.infer<typeof BakrepSearchResultSchema>; | ||
|
||
export { BakrepSearchEntrySchema, BakrepSearchResultSchema }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
export type EmptyQuery = {}; | ||
export type NumberQuery = { | ||
field: string; | ||
op: "==" | "!=" | "<" | "<=" | ">" | ">=" | "[]"; | ||
value: number; | ||
}; | ||
export type RangeQuery = { | ||
field: string; | ||
op: "[]"; | ||
value: { | ||
from: number; | ||
to: number; | ||
}; | ||
}; | ||
export type StringQuery = { | ||
field: string; | ||
op: "==" | "~"; | ||
value: string; | ||
}; | ||
export type CompoundQuery = { | ||
op: "or" | "and"; | ||
value: Query[]; | ||
}; | ||
export type NotQuery = { | ||
op: "not"; | ||
value: Query; | ||
}; | ||
export type NestedQuery = { | ||
op: "nested"; | ||
field: string; | ||
value: Query; | ||
}; | ||
|
||
export type Query = | ||
| EmptyQuery | ||
| CompoundQuery | ||
| NotQuery | ||
| NumberQuery | ||
| StringQuery | ||
| NestedQuery | ||
| RangeQuery; | ||
|
||
export type SortOption = { | ||
field: string; | ||
ord: "asc" | "desc"; | ||
}; | ||
|
||
export type SearchRequest = { | ||
offset: number; | ||
limit: number; | ||
query: Query; | ||
sort: SortOption[]; | ||
}; | ||
|
||
export type SearchResult<T> = { | ||
offset: number; | ||
total: number; | ||
results: T[]; | ||
}; | ||
|
||
export type SearchInfoLeaf = { | ||
field: string; | ||
ops: string[]; | ||
type: "text" | "number"; | ||
}; | ||
export type SearchInfoNested = { | ||
field: string; | ||
fields: SearchInfoField[]; | ||
ops: string[]; | ||
type: "nested"; | ||
}; | ||
export type SearchInfoField = SearchInfoLeaf | SearchInfoNested; | ||
|
||
export type SearchInfo = { | ||
fields: SearchInfoField[]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.