forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi-types.ts
More file actions
106 lines (87 loc) · 4.33 KB
/
api-types.ts
File metadata and controls
106 lines (87 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
* This file re-exports the types we want to use from the Galaxy API.
* It serves as a compatibility layer to avoid importing directly from the
* symlinked files, which would require all of Galaxy's dependencies.
*/
// Import types from the symlinked files
import { type components, type GalaxyApiPaths } from "./api/schema";
// We only need the types, not the code that depends on Galaxy's implementation
export type { components, GalaxyApiPaths };
// Re-export specific types
export type HistorySummary = components["schemas"]["HistorySummary"];
export type HistoryDetailed = components["schemas"]["HistoryDetailed"];
export type HDASummary = components["schemas"]["HDASummary"];
export type HDADetailed = components["schemas"]["HDADetailed"];
export type DCESummary = components["schemas"]["DCESummary"];
export type HDCASummary = components["schemas"]["HDCASummary"];
export type HDCADetailed = components["schemas"]["HDCADetailed"];
export type DCObject = components["schemas"]["DCObject"];
export type HDAObject = components["schemas"]["HDAObject"];
export type HDAInaccessible = components["schemas"]["HDAInaccessible"];
export type DatasetTextContentDetails = components["schemas"]["DatasetTextContentDetails"];
export type DatasetStorageDetails = components["schemas"]["DatasetStorageDetails"];
export type DatasetCollectionAttributes = components["schemas"]["DatasetCollectionAttributesResult"];
export type ConcreteObjectStoreModel = components["schemas"]["ConcreteObjectStoreModel"];
export type MessageException = components["schemas"]["MessageExceptionModel"];
export type DatasetHash = components["schemas"]["DatasetHash-Output"];
export type DatasetSource = components["schemas"]["DatasetSource"];
export type DatasetTransform = components["schemas"]["DatasetSourceTransform"];
export type StoreExportPayload = components["schemas"]["StoreExportPayload"];
export type ModelStoreFormat = components["schemas"]["ModelStoreFormat"];
export type ObjectExportTaskResponse = components["schemas"]["ObjectExportTaskResponse"];
export type ExportObjectRequestMetadata = components["schemas"]["ExportObjectRequestMetadata"];
export type ExportObjectResultMetadata = components["schemas"]["ExportObjectResultMetadata"];
export type AsyncTaskResultSummary = components["schemas"]["AsyncTaskResultSummary"];
// Define utility types that may be used in the client
export type HistorySortByLiteral = "create_time" | "name" | "update_time" | "username" | undefined;
export interface HistoryContentsStats {
id: string;
update_time: string;
size: number;
contents_active: components["schemas"]["HistoryActiveContentCounts"];
}
export interface HistorySummaryExtended extends HistorySummary, HistoryContentsStats {
user_id: string | null;
}
export interface SelectableObjectStore extends ConcreteObjectStoreModel {
object_store_id: string;
}
export type DatasetEntry = HDASummary | HDADetailed | HDAInaccessible;
export interface DCECollection extends DCESummary {
element_type: "dataset_collection";
object: DCObject;
}
export interface DCEDataset extends DCESummary {
element_type: "hda";
object: HDAObject;
}
export interface SubCollection extends DCObject {
name: string;
hdca_id: string;
}
export type CollectionEntry = HDCASummary | SubCollection;
export type HistoryItemSummary = HDASummary | HDCASummary;
// Utility functions
export function isHDA(entry?: HistoryItemSummary): entry is HDASummary {
return entry !== undefined && "history_content_type" in entry && entry.history_content_type === "dataset";
}
export function isHDCA(entry?: HistoryItemSummary | CollectionEntry): entry is HDCASummary {
return (
entry !== undefined && "history_content_type" in entry && entry.history_content_type === "dataset_collection"
);
}
export function isDCE(item: object): item is DCESummary {
return item && "element_type" in item;
}
export function isCollectionElement(element: DCESummary): element is DCECollection {
return element.element_type === "dataset_collection";
}
export function isDatasetElement(element: DCESummary): element is DCEDataset {
return element.element_type === "hda";
}
export function hasDetails(entry: DatasetEntry): entry is HDADetailed {
return "peek" in entry;
}
export function isInaccessible(entry: DatasetEntry): entry is HDAInaccessible {
return "accessible" in entry && !entry.accessible;
}