-
Notifications
You must be signed in to change notification settings - Fork 18
/
api_flow_types.ts
1077 lines (1042 loc) · 28.4 KB
/
api_flow_types.ts
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import type {
BoundingBoxObject,
Edge,
CommentType,
TreeGroup,
RecommendedConfiguration,
SegmentGroup,
} from "oxalis/store";
import type { ServerUpdateAction } from "oxalis/model/sagas/update_actions";
import type { SkeletonTracingStats } from "oxalis/model/accessors/skeletontracing_accessor";
import type {
Vector3,
Vector6,
Point3,
ColorObject,
LOG_LEVELS,
Vector4,
TreeType,
} from "oxalis/constants";
import { PricingPlanEnum } from "admin/organization/pricing_plan_utils";
export type AdditionalCoordinate = { name: string; value: number };
export type APIMessage = { [key in "info" | "warning" | "error"]?: string };
export type ElementClass =
| "uint8"
| "uint16"
| "uint24"
| "uint32"
| "uint64"
| "float"
| "double"
| "int8"
| "int16"
| "int32"
| "int64";
export type APIMapping = {
readonly parent?: string;
readonly name: string;
readonly classes?: Array<Array<number>>;
readonly colors?: Array<number>;
readonly hideUnmappedIds?: boolean;
};
export type AdditionalAxis = {
bounds: [number, number];
index: number;
name: string;
};
export type ServerAdditionalAxis = {
bounds: { x: number; y: number };
index: number;
name: string;
};
export type CoordinateTransformation =
| {
type: "affine";
matrix: [Vector4, Vector4, Vector4, Vector4];
}
| {
type: "thin_plate_spline";
correspondences: { source: Vector3[]; target: Vector3[] };
};
type APIDataLayerBase = {
readonly name: string;
readonly boundingBox: BoundingBoxObject;
readonly resolutions: Array<Vector3>;
readonly elementClass: ElementClass;
readonly dataFormat?: "wkw" | "zarr";
readonly additionalAxes: Array<AdditionalAxis> | null;
readonly coordinateTransformations?: CoordinateTransformation[] | null;
};
type APIColorLayer = APIDataLayerBase & {
readonly category: "color";
};
export type APISegmentationLayer = APIDataLayerBase & {
readonly category: "segmentation";
readonly largestSegmentId: number | undefined;
readonly mappings?: Array<string>;
readonly agglomerates?: Array<string>;
readonly fallbackLayer?: string | null | undefined;
readonly fallbackLayerInfo?: APIDataLayer | null;
readonly tracingId?: string;
};
export type APIDataLayer = APIColorLayer | APISegmentationLayer;
export type APIHistogramData = HistogramDatum[];
export type HistogramDatum = {
numberOfElements: number;
elementCounts: Array<number>;
min: number;
max: number;
};
type MutableAPIDataSourceBase = {
id: {
name: string;
team: string;
};
status?: string;
};
type APIDataSourceBase = Readonly<MutableAPIDataSourceBase>;
export type APIUnimportedDatasource = APIDataSourceBase;
export type MutableAPIDataSource = MutableAPIDataSourceBase & {
dataLayers: Array<APIDataLayer>;
scale: Vector3;
};
export type APIDataSource = Readonly<MutableAPIDataSource>;
export type APIDataStore = {
readonly name: string;
readonly url: string;
readonly isScratch: boolean;
readonly allowsUpload: boolean;
};
export type APITracingStore = {
readonly name: string;
readonly url: string;
};
export type APITeam = {
readonly id: string;
readonly name: string;
readonly organization: string;
};
export type APIPublicationAnnotation = {
readonly id: string;
readonly name: string;
readonly description: string;
readonly tracingStore: APITracingStore;
readonly dataSet: APIDataset;
};
export type APIPublication = {
readonly id: string;
readonly publicationDate: number;
readonly imageUrl: string;
readonly title: string;
readonly description: string;
readonly created: number;
readonly datasets: Array<APIDataset>;
readonly annotations: Array<APIPublicationAnnotation>;
};
export type MutableAPIDatasetId = {
owningOrganization: string;
name: string;
};
export type APIDatasetId = Readonly<MutableAPIDatasetId>;
export type APIDatasetDetails = {
readonly species?: string;
readonly brainRegion?: string;
readonly acquisition?: string;
};
type MutableAPIDatasetBase = MutableAPIDatasetId & {
isUnreported: boolean;
folderId: string;
allowedTeams: Array<APITeam>;
allowedTeamsCumulative: Array<APITeam>;
created: number;
dataStore: APIDataStore;
description: string | null | undefined;
details: APIDatasetDetails | null | undefined;
isEditable: boolean;
isPublic: boolean;
displayName: string | null | undefined;
logoUrl: string | null | undefined;
lastUsedByUser: number;
jobsEnabled: boolean;
sortingKey: number;
owningOrganization: string;
publication: null | undefined;
tags: Array<string>;
};
type APIDatasetBase = Readonly<MutableAPIDatasetBase>;
export type MutableAPIDataset = MutableAPIDatasetBase & {
dataSource: MutableAPIDataSource;
isActive: true;
};
export type APIDataset = APIDatasetBase & {
readonly dataSource: APIDataSource;
readonly isActive: true;
};
export type MaintenanceInfo = {
startTime: number;
endTime: number;
id: string;
message: string;
};
// Should be a strict subset of APIMaybeUnimportedDataset which makes
// typing easier in some places.
export type APIDatasetCompactWithoutStatus = Pick<
APIMaybeUnimportedDataset,
| "owningOrganization"
| "name"
| "folderId"
| "isActive"
| "displayName"
| "created"
| "isEditable"
| "lastUsedByUser"
| "tags"
| "isUnreported"
>;
export type APIDatasetCompact = APIDatasetCompactWithoutStatus & {
id?: string;
status: MutableAPIDataSourceBase["status"];
};
export function convertDatasetToCompact(dataset: APIDataset): APIDatasetCompact {
return {
owningOrganization: dataset.owningOrganization,
name: dataset.name,
folderId: dataset.folderId,
isActive: dataset.isActive,
displayName: dataset.displayName,
created: dataset.created,
isEditable: dataset.isEditable,
lastUsedByUser: dataset.lastUsedByUser,
status: dataset.dataSource.status,
tags: dataset.tags,
isUnreported: dataset.isUnreported,
};
}
type APIUnimportedDataset = APIDatasetBase & {
readonly dataSource: APIUnimportedDatasource;
readonly isActive: false;
};
export type APIMaybeUnimportedDataset = APIUnimportedDataset | APIDataset;
export type APIDataSourceWithMessages = {
readonly dataSource?: APIDataSource;
readonly previousDataSource?: APIDataSource | APIUnimportedDatasource;
readonly messages: Array<APIMessage>;
};
export type APITeamMembership = {
readonly id: string;
readonly name: string;
readonly isTeamManager: boolean;
};
export type ExperienceMap = Readonly<Record<string, number>>;
export type ExperienceDomainList = Array<string>;
export type APIUserCompact = {
readonly firstName: string;
readonly lastName: string;
readonly id: string;
};
export type APIUserBase = APIUserCompact & {
readonly email: string;
readonly isAnonymous: boolean;
readonly teams: Array<APITeamMembership>;
readonly isAdmin: boolean;
readonly isDatasetManager: boolean;
};
export type NovelUserExperienceInfoType = {
hasSeenDashboardWelcomeBanner?: boolean;
shouldSeeModernControlsModal?: boolean;
lastViewedWhatsNewTimestamp?: number;
hasDiscardedHelpButton?: boolean;
latestAcknowledgedMaintenanceInfo?: string;
};
export type APIUserTheme = "auto" | "light" | "dark";
export type APIUser = APIUserBase & {
readonly isOrganizationOwner: boolean;
readonly created: number;
readonly experiences: ExperienceMap;
readonly isSuperUser: boolean;
readonly isActive: boolean;
readonly isEditable: boolean;
readonly lastActivity: number;
readonly lastTaskTypeId: string | null | undefined;
readonly organization: string;
readonly novelUserExperienceInfos: NovelUserExperienceInfoType;
readonly selectedTheme: APIUserTheme;
readonly isEmailVerified: boolean;
};
export type APITimeInterval = {
paymentInterval: {
month: number;
year: number;
};
durationInSeconds: number;
};
export type APIUserLoggedTime = {
loggedTime: Array<APITimeInterval>;
};
export type APIActiveUser = {
email: string;
firstName: string;
lastName: string;
activeTasks: number;
};
export type APIRestrictions = {
readonly allowAccess: boolean;
readonly allowUpdate: boolean;
readonly allowFinish: boolean;
readonly allowDownload: boolean;
// allowSave might be false even though allowUpdate is true (e.g., see sandbox annotations)
readonly allowSave?: boolean;
};
export type APIAllowedMode = "orthogonal" | "oblique" | "flight";
export type APIResolutionRestrictions = {
min?: number;
max?: number;
};
export type APISettings = {
readonly allowedModes: Array<APIAllowedMode>;
readonly preferredMode?: APIAllowedMode;
readonly branchPointsAllowed: boolean;
readonly somaClickingAllowed: boolean;
readonly volumeInterpolationAllowed: boolean;
readonly mergerMode: boolean;
readonly resolutionRestrictions: APIResolutionRestrictions;
};
export enum APIAnnotationTypeEnum {
Explorational = "Explorational",
Task = "Task",
View = "View",
CompoundTask = "CompoundTask",
CompoundProject = "CompoundProject",
CompoundTaskType = "CompoundTaskType",
}
export enum APICompoundTypeEnum {
CompoundTask = "CompoundTask",
CompoundProject = "CompoundProject",
CompoundTaskType = "CompoundTaskType",
}
export type APIAnnotationType = keyof typeof APIAnnotationTypeEnum;
export type APICompoundType = keyof typeof APICompoundTypeEnum;
export type APIAnnotationVisibility = "Private" | "Internal" | "Public";
export enum TracingTypeEnum {
skeleton = "skeleton",
volume = "volume",
hybrid = "hybrid",
}
export type TracingType = keyof typeof TracingTypeEnum;
export type APITaskType = {
readonly id: string;
readonly summary: string;
readonly description: string;
readonly teamId: string;
readonly teamName: string;
readonly settings: APISettings;
readonly recommendedConfiguration: RecommendedConfiguration | null | undefined;
readonly tracingType: TracingType;
};
export type TaskStatus = {
readonly pending: number;
readonly active: number;
readonly finished: number;
};
type APIScriptTypeBase = {
readonly name: string;
readonly gist: string;
};
export type APIScript = APIScriptTypeBase & {
readonly id: string;
readonly owner: APIUserBase;
};
export type APIScriptUpdater = APIScriptTypeBase & {
readonly id: string;
readonly owner: string;
};
export type APIScriptCreator = APIScriptTypeBase & {
readonly owner: string;
};
type APIProjectTypeBase = {
readonly name: string;
readonly team: string; // id
readonly teamName: string;
readonly priority: number;
readonly paused: boolean;
readonly expectedTime: number; // Also known as "time limit"
readonly isBlacklistedFromReport: boolean;
};
export type APIProject = APIProjectTypeBase & {
readonly id: string;
readonly owner: APIUserBase;
readonly created: number;
};
export type APIProjectUpdater = APIProjectTypeBase & {
readonly id: string;
readonly owner: string;
readonly created: number;
};
export type APIProjectCreator = APIProjectTypeBase & {
readonly owner: string;
};
export type APIProjectWithStatus = APIProject & {
readonly pendingInstances: number;
readonly tracingTime: number;
};
export type APITask = {
readonly boundingBox: BoundingBoxObject | null | undefined;
readonly boundingBoxVec6?: Vector6;
readonly created: number;
readonly creationInfo: string | null | undefined;
readonly dataSet: string;
readonly editPosition: Vector3;
readonly editRotation: Vector3;
readonly formattedHash: string;
readonly id: string;
readonly neededExperience: {
readonly domain: string;
readonly value: number;
};
readonly projectName: string;
readonly projectId: string;
readonly script: APIScript | null | undefined;
readonly status: TaskStatus;
readonly team: string;
readonly tracingTime: number | null | undefined;
readonly type: APITaskType;
readonly directLinks?: Array<string>;
};
export type AnnotationLayerDescriptor = {
name?: string | null | undefined;
tracingId: string;
typ: "Skeleton" | "Volume";
};
export type EditableLayerProperties = Partial<{
name: string | null | undefined;
}>;
export type APIAnnotationCompact = {
readonly annotationLayers: Array<AnnotationLayerDescriptor>;
readonly dataSetName: string;
readonly organization: string;
readonly description: string;
readonly formattedHash: string;
readonly modified: number;
readonly id: string;
readonly visibility: APIAnnotationVisibility;
readonly name: string;
readonly state: string;
readonly stats: SkeletonTracingStats | {};
readonly tags: Array<string>;
readonly tracingTime: number | null | undefined;
readonly typ: APIAnnotationType;
// The owner can be null (e.g., for a sandbox annotation
// or due to missing permissions).
readonly owner?: APIUserCompact;
readonly teams: APITeam[];
readonly othersMayEdit: boolean;
};
export function annotationToCompact(annotation: APIAnnotation): APIAnnotationCompact {
const {
annotationLayers,
dataSetName,
organization,
description,
formattedHash,
modified,
id,
visibility,
name,
state,
stats,
tags,
tracingTime,
typ,
owner,
teams,
othersMayEdit,
} = annotation;
return {
annotationLayers,
dataSetName,
organization,
description,
formattedHash,
modified,
id,
visibility,
name,
state,
stats,
tags,
tracingTime,
typ,
owner,
teams,
othersMayEdit,
};
}
export type AnnotationViewConfiguration = {
layers: Record<
string,
{
isDisabled: boolean;
}
>;
};
type APIAnnotationBase = APIAnnotationCompact & {
readonly dataStore: APIDataStore;
readonly tracingStore: APITracingStore;
readonly restrictions: APIRestrictions;
readonly viewConfiguration?: AnnotationViewConfiguration | null | undefined;
readonly settings: APISettings;
readonly owner?: APIUserBase;
// This `user` attribute is deprecated and should not be used, anymore. It only exists to satisfy e2e type checks
readonly user?: APIUserBase;
readonly contributors: APIUserBase[];
readonly othersMayEdit: boolean;
};
export type APIAnnotation = APIAnnotationBase & {
readonly task: APITask | null | undefined;
};
export type APIAnnotationWithTask = APIAnnotationBase & {
readonly task: APITask;
};
export type APITaskWithAnnotation = APITask & {
readonly annotation: APIAnnotation;
};
export type APITimeTracking = {
time: string;
timestamp: number;
annotation: string;
_id: string;
task_id: string;
project_name: string;
tasktype_id: string;
tasktype_summary: string;
};
export type APIProjectProgressReport = {
readonly projectName: string;
readonly paused: boolean;
readonly totalTasks: number;
readonly totalInstances: number;
readonly pendingInstances: number;
readonly activeInstances: number;
readonly finishedInstances: number;
readonly priority: number;
readonly billedMilliseconds: number;
};
export type APIAvailableTasksReport = {
readonly id: string;
readonly user: string;
readonly totalAvailableTasks: number;
readonly availableTasksByProjects: Record<string, number>;
};
export type APIOrganization = {
readonly id: string;
readonly name: string;
readonly additionalInformation: string;
readonly displayName: string;
readonly pricingPlan: PricingPlanEnum;
readonly enableAutoVerify: boolean;
readonly newUserMailingList: string;
readonly paidUntil: number;
readonly includedUsers: number;
readonly includedStorageBytes: number;
readonly usedStorageBytes: number;
readonly ownerName?: string;
};
export type APIPricingPlanStatus = {
readonly pricingPlan: PricingPlanEnum;
readonly isExceeded: boolean;
readonly isAlmostExceeded: boolean; // stays true when isExceeded is true)
};
export type APIBuildInfo = {
webknossos: {
name: string;
commitHash: string;
scalaVersion: string;
version: string;
sbtVersion: string;
commitDate: string;
ciTag: string;
ciBuild: string;
gitTag?: string;
datastoreApiVersion: string;
};
"webknossos-wrap": {
builtAtMillis: string;
name: string;
commitHash: string;
scalaVersion: string;
version: string;
sbtVersion: string;
builtAtString: string;
};
webknossosDatastore?: {
name: string;
commitHash: string;
scalaVersion: string;
version: string;
sbtVersion: string;
commitDate: string;
ciTag: string;
ciBuild: string;
gitTag: string;
datastoreApiVersion: string;
};
schemaVersion: number;
localDataStoreEnabled: boolean;
localTracingStoreEnabled: boolean;
};
export type APIFeatureToggles = {
readonly discussionBoard: string | false;
readonly discussionBoardRequiresAdmin: boolean;
readonly hideNavbarLogin: boolean;
readonly isWkorgInstance: boolean;
readonly taskReopenAllowedInSeconds: number;
readonly allowDeleteDatasets: boolean;
readonly jobsEnabled: boolean;
readonly voxelyticsEnabled: boolean;
readonly publicDemoDatasetUrl: string;
readonly exportTiffMaxVolumeMVx: number;
readonly exportTiffMaxEdgeLengthVx: number;
readonly defaultToLegacyBindings: boolean;
readonly optInTabs?: Array<string>;
readonly openIdConnectEnabled?: boolean;
readonly segmentAnythingEnabled?: boolean;
};
export type APIJobCeleryState = "SUCCESS" | "PENDING" | "STARTED" | "FAILURE" | null;
export type APIJobManualState = "SUCCESS" | "FAILURE" | null;
export type APIJobState = "UNKNOWN" | "SUCCESS" | "PENDING" | "STARTED" | "FAILURE" | "MANUAL";
export enum APIJobType {
"CONVERT_TO_WKW" = "convert_to_wkw",
"EXPORT_TIFF" = "export_tiff",
"RENDER_ANIMATION" = "render_animation",
"COMPUTE_MESH_FILE" = "compute_mesh_file",
"FIND_LARGEST_SEGMENT_ID" = "find_largest_segment_id",
"INFER_NUCLEI" = "infer_nuclei",
"INFER_NEURONS" = "infer_neurons",
"MATERIALIZE_VOLUME_ANNOTATION" = "materialize_volume_annotation",
}
export type APIJob = {
readonly id: string;
readonly datasetName: string | null | undefined;
readonly exportFileName: string | null | undefined;
readonly layerName: string | null | undefined;
readonly annotationLayerName: string | null | undefined;
readonly tracingId: string | null | undefined;
readonly annotationId: string | null | undefined;
readonly annotationType: string | null | undefined;
readonly organizationName: string | null | undefined;
readonly boundingBox: string | null | undefined;
readonly mergeSegments: boolean | null | undefined;
readonly type: APIJobType;
readonly state: APIJobState;
readonly manualState: string;
readonly result: string | null | undefined;
readonly resultLink: string | null | undefined;
readonly createdAt: number;
};
// Tracing related datatypes
export type APIUpdateActionBatch = {
version: number;
value: Array<ServerUpdateAction>;
};
export type ServerNode = {
id: number;
position: Point3;
additionalCoordinates: AdditionalCoordinate[];
rotation: Point3;
bitDepth: number;
viewport: number;
resolution: number;
radius: number;
createdTimestamp: number;
interpolation: boolean;
};
export type ServerBranchPoint = {
createdTimestamp: number;
nodeId: number;
};
export type ServerBoundingBox = {
topLeft: Point3;
width: number;
height: number;
depth: number;
};
export type UserBoundingBoxFromServer = {
boundingBox: ServerBoundingBox;
id: number;
name?: string;
color?: ColorObject;
isVisible?: boolean;
};
export type ServerBoundingBoxTypeTuple = {
topLeft: Vector3;
width: number;
height: number;
depth: number;
};
export type ServerSkeletonTracingTree = {
branchPoints: Array<ServerBranchPoint>;
color: ColorObject | null | undefined;
comments: Array<CommentType>;
edges: Array<Edge>;
name: string;
nodes: Array<ServerNode>;
treeId: number;
createdTimestamp: number;
groupId?: number | null | undefined;
isVisible?: boolean;
type?: TreeType;
edgesAreVisible?: boolean;
};
type ServerSegment = {
segmentId: number;
name: string | null | undefined;
anchorPosition: Point3 | null | undefined;
additionalCoordinates: AdditionalCoordinate[] | null;
creationTime: number | null | undefined;
color: ColorObject | null;
groupId: number | null | undefined;
};
export type ServerTracingBase = {
id: string;
userBoundingBoxes: Array<UserBoundingBoxFromServer>;
userBoundingBox?: ServerBoundingBox;
createdTimestamp: number;
editPosition: Point3;
editPositionAdditionalCoordinates: AdditionalCoordinate[] | null;
editRotation: Point3;
error?: string;
version: number;
zoomLevel: number;
additionalAxes: ServerAdditionalAxis[];
};
export type ServerSkeletonTracing = ServerTracingBase & {
// The following property is added when fetching the
// tracing from the back-end (by `getTracingForAnnotationType`)
// This is done to simplify the selection for the type.
typ: "Skeleton";
activeNodeId?: number;
boundingBox?: ServerBoundingBox;
trees: Array<ServerSkeletonTracingTree>;
treeGroups: Array<TreeGroup> | null | undefined;
};
export type ServerVolumeTracing = ServerTracingBase & {
// The following property is added when fetching the
// tracing from the back-end (by `getTracingForAnnotationType`)
// This is done to simplify the selection for the type.
typ: "Volume";
activeSegmentId?: number;
boundingBox: ServerBoundingBox;
elementClass: ElementClass;
fallbackLayer?: string;
segments: Array<ServerSegment>;
segmentGroups: Array<SegmentGroup> | null | undefined;
largestSegmentId: number;
// `resolutions` will be undefined for legacy annotations
// which were created before the multi-resolution capabilities
// were added to volume tracings. Also see:
// https://github.com/scalableminds/webknossos/pull/4755
resolutions?: Array<Point3>;
mappingName?: string | null | undefined;
mappingIsEditable?: boolean;
hasSegmentIndex?: boolean;
};
export type ServerTracing = ServerSkeletonTracing | ServerVolumeTracing;
export type ServerEditableMapping = {
createdTimestamp: number;
version: number;
mappingName: string;
baseMappingName: string;
// The id of the volume tracing the editable mapping belongs to
tracingId: string;
};
export type APIMeshFile = {
meshFileName: string;
mappingName?: string | null | undefined;
// 0 - is the first mesh file version
// 1-2 - the format should behave as v0 (refer to voxelytics for actual differences)
// 3 - is the newer version with draco encoding.
formatVersion: number;
};
export type APIConnectomeFile = {
connectomeFileName: string;
mappingName: string;
};
export type ZarrPrivateLink = {
id: string;
annotation: string;
accessToken: string;
expirationDateTime: number | null;
};
export type ShortLink = {
longLink: string;
key: string;
_id: string;
};
export enum VoxelyticsRunState {
SKIPPED = "SKIPPED",
PENDING = "PENDING",
RUNNING = "RUNNING",
COMPLETE = "COMPLETE",
FAILED = "FAILED",
CANCELLED = "CANCELLED",
STALE = "STALE",
}
type DistributionConfig = {
strategy: string;
resources?: Record<string, string>;
processes?: number;
};
export type VoxelyticsTaskConfig = {
isMetaTask: undefined;
config: { name: string };
inputs: Record<string, string | Record<string, string>>;
description: string | null;
distribution: DistributionConfig | null;
output_paths: Record<string, string> | null;
task: string;
};
export type VoxelyticsTaskConfigWithName = VoxelyticsTaskConfig & { taskName: string };
export type VoxelyticsTaskConfigWithHierarchy =
| VoxelyticsTaskConfigWithName
| {
isMetaTask: true;
key: string;
subtasks: Array<VoxelyticsTaskConfigWithHierarchy>;
};
export type VoxelyticsArtifactConfig = {
fileSize: number;
inodeCount: number;
createdAt: number;
path: string;
version: string;
metadata: {
attributes: any;
iframes: Record<string, string>;
links: Record<string, string>;
};
};
export type VoxelyticsRunInfo = (
| {
state: VoxelyticsRunState.RUNNING;
beginTime: Date;
endTime: null;
}
| {
state:
| VoxelyticsRunState.COMPLETE
| VoxelyticsRunState.FAILED
| VoxelyticsRunState.CANCELLED
| VoxelyticsRunState.STALE;
beginTime: Date;
endTime: Date;
}
) & {
id: string;
name: string;
username: string;
hostname: string;
voxelyticsVersion: string;
};
export type VoxelyticsWorkflowDagEdge = { source: string; target: string; label: string };
export type VoxelyticsWorkflowDagNode = {
id: string;
label: string;
state: VoxelyticsRunState;
isMetaTask?: boolean;
};
export type VoxelyticsWorkflowDag = {
edges: Array<VoxelyticsWorkflowDagEdge>;
nodes: Array<VoxelyticsWorkflowDagNode>;
};
type StatePartial =
| {
state: VoxelyticsRunState.PENDING | VoxelyticsRunState.SKIPPED;
beginTime: null;
endTime: null;
}
| {
state: VoxelyticsRunState.RUNNING;
beginTime: Date;
endTime: null;
}
| {
state:
| VoxelyticsRunState.COMPLETE
| VoxelyticsRunState.FAILED
| VoxelyticsRunState.CANCELLED
| VoxelyticsRunState.STALE;
beginTime: Date;
endTime: Date;
};
export type VoxelyticsTaskInfo = {
taskName: string;
currentExecutionId: string | null;
chunkCounts: ChunkCounts;
runs: Array<
{
runId: string;
currentExecutionId: string | null;
chunkCounts: ChunkCounts;
} & StatePartial
>;
} & StatePartial;
export type VoxelyticsWorkflowReport = {
config: {
config: {} | null;
git_hash: string | null;
global_parameters:
| {
env_vars: Record<string, string>;
distribution: DistributionConfig | null;
artifacts_path: string | null;
skip_checksums: boolean;
}
| {};
paths: Array<string>;
schema_version: number;
tasks: Record<string, VoxelyticsTaskConfig>;
};
dag: VoxelyticsWorkflowDag;
artifacts: Record<string, Record<string, VoxelyticsArtifactConfig>>;
runs: Array<VoxelyticsRunInfo>;
tasks: Array<VoxelyticsTaskInfo>;
workflow: {
name: string;
hash: string;
yamlContent: string;
};
};
export type VoxelyticsWorkflowListingRun = (
| {
state: VoxelyticsRunState.RUNNING;
beginTime: Date;
endTime: null;
}
| {
state:
| VoxelyticsRunState.COMPLETE
| VoxelyticsRunState.FAILED
| VoxelyticsRunState.CANCELLED
| VoxelyticsRunState.STALE;
beginTime: Date;
endTime: Date;
}
) & {
id: string;
name: string;
username: string;
hostname: string;
voxelyticsVersion: string;
taskCounts: TaskCounts;
};
export type VoxelyticsWorkflowListing = {
name: string;
hash: string;
beginTime: number;
endTime: number | null;
state: VoxelyticsRunState;
taskCounts: TaskCounts;
runs: Array<VoxelyticsWorkflowListingRun>;
};
type Statistics = {
max: number | null;
median: number | null;
stddev: number | null;
sum?: number;
};
type ChunkCounts = {
total: number;
failed: number;
skipped: number;
complete: number;
cancelled: number;
};
type TaskCounts = ChunkCounts & {
fileSize: number;
inodeCount: number;
};
export type VoxelyticsChunkStatistics = {
executionId: string;
chunkCounts: ChunkCounts;
beginTime: number | null;
endTime: number | null;
wallTime: number | null;
memory: Statistics | null;
cpuUser: Statistics | null;
cpuSystem: Statistics | null;
duration: Statistics | null;
};
export type VoxelyticsLogLine = {
func_name: string;
host: string;
level: LOG_LEVELS;