-
Notifications
You must be signed in to change notification settings - Fork 6
/
SequenceManagerRes.ts
173 lines (150 loc) · 3.79 KB
/
SequenceManagerRes.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
/*
* Copyright (C) 2023 Thirty Meter Telescope International Observatory
* SPDX-License-Identifier: Apache-2.0
*/
import type { ComponentId, Prefix, Subsystem, Failed, LocationServiceError, Unhandled } from '../../../models'
import type { ObsMode } from './ObsMode'
import type { VariationInfo } from './VariationInfo'
export type SequenceComponentNotAvailable = {
_type: 'SequenceComponentNotAvailable'
variationInfos: VariationInfo[]
msg: string
}
export type FailedResponse = {
_type: 'FailedResponse'
reason: string
}
export type ConfigurationMissing = {
_type: 'ConfigurationMissing'
obsMode: ObsMode
}
export type FailedToStartSequencers = {
_type: 'FailedToStartSequencers'
reasons: string[]
}
export type ConflictingResourcesWithRunningObsMode = {
_type: 'ConflictingResourcesWithRunningObsMode'
runningObsMode: ObsMode[]
}
export type SpawningSequenceComponentsFailed = {
_type: 'SpawningSequenceComponentsFailed'
failureResponses: string[]
}
export type LoadScriptError = {
_type: 'LoadScriptError'
reason: string
}
export type Success = { _type: 'Success' }
// api specific ADT decoders
export type ConfigureSuccess = {
_type: 'Success'
masterSequencerComponentId: ComponentId
}
export type CouldNotFindMachines = {
_type: 'CouldNotFindMachines'
prefix: Prefix[]
}
export type RestartSequencerSuccess = {
_type: 'Success'
componentId: ComponentId
}
export type NonConfigurable = {
_type: 'NonConfigurable'
missingSequenceComponentsFor: VariationInfo[]
}
export type Configurable = {
_type: 'Configurable'
}
export type Configured = {
_type: 'Configured'
}
export type ObsModeStatus = Configurable | Configured | NonConfigurable
export type ObsModeDetails = {
obsMode: ObsMode
status: ObsModeStatus
resources: Subsystem[]
sequencers: VariationInfo[]
}
export type ObsModesDetailsResponseSuccess = {
_type: 'Success'
obsModes: ObsModeDetails[]
}
export type AlreadyRunning = {
_type: 'AlreadyRunning'
componentId: ComponentId
}
export type SequencerStarted = {
_type: 'Started'
componentId: ComponentId
}
export type ResourceStatus = {
_type: 'InUse' | 'Available'
}
export type ResourceStatusResponse = {
resource: Subsystem
status: ResourceStatus
obsMode?: ObsMode
}
export type ResourcesStatusSuccess = {
_type: 'Success'
resourcesStatus: ResourceStatusResponse[]
}
// api specific type's
/**
* @category Sequence Manager Service
*/
export type ConfigureResponse =
| Unhandled
| SequenceComponentNotAvailable
| ConfigurationMissing
| LocationServiceError
| FailedToStartSequencers
| ConflictingResourcesWithRunningObsMode
| ConfigureSuccess
| FailedResponse
/**
* @category Sequence Manager Service
*/
export type ProvisionResponse =
| Unhandled
| Success
| LocationServiceError
| SpawningSequenceComponentsFailed
| CouldNotFindMachines
| FailedResponse
/**
* @category Sequence Manager Service
*/
export type ObsModesDetailsResponse = Failed | ObsModesDetailsResponseSuccess | LocationServiceError
/**
* @category Sequence Manager Service
*/
export type StartSequencerResponse =
| Unhandled
| SequenceComponentNotAvailable
| LoadScriptError
| LocationServiceError
| AlreadyRunning
| SequencerStarted
| FailedResponse
/**
* @category Sequence Manager Service
*/
export type RestartSequencerResponse =
| Unhandled
| LoadScriptError
| LocationServiceError
| RestartSequencerSuccess
| FailedResponse
/**
* @category Sequence Manager Service
*/
export type ShutdownSequencersResponse = Unhandled | LocationServiceError | Success | FailedResponse
/**
* @category Sequence Manager Service
*/
export type ShutdownSequenceComponentResponse = ShutdownSequencersResponse | FailedResponse
/**
* @category Sequence Manager Service
*/
export type ResourcesStatusResponse = ResourcesStatusSuccess | Failed