-
Notifications
You must be signed in to change notification settings - Fork 0
/
bearclaw.capnp
312 lines (255 loc) · 7.73 KB
/
bearclaw.capnp
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
# WARNING: This file is undergoing active design and development and will change in breaking,
# incompatible ways.
@0xfd91532fe1094bdd;
# This signature must be unique to this file
interface Bearclaw {
searchHistory @2 ()
-> (historySearch :HistorySearch);
# Returns a list of all messages in the proxy history that match your search query (you can't
# specify the query yet). You can subscribe to receive notifications when new history items are
# created that match your query.
getHistoryItem @3 (historyId :HistoryId)
-> (result :Result(HttpMessage, GetHistoryItemError));
createScenario @4 (info :NewScenarioInfo)
-> (result :Fallible(CreateScenarioError));
getScenario @5 (scenarioId :Text)
-> (result :Result(Scenario, GetScenarioError));
listScenarios @6 ()
-> (list :List(ScenarioTreeNode));
subscribeMethodology @7 (subscriber :MethodologySubscriber)
-> (subscription :Subscription);
exit @1 ();
# Shuts down the bearclaw proxy application
getBuildInfo @0 ()
-> (buildInfo :BuildInfo);
}
struct Option(T) {
# An optional value of type T.
union {
some @0 :T;
none @1 :Void;
}
}
struct Result(T, E) {
# A value of type T or an error of type E.
union {
ok @0 :T;
err @1 :E;
}
}
interface HistorySearch {
# Retrieves existing and future proxy history messages that match the search query specified when
# creating this object. You cannot change the search query on an existing object.
getCount @0 () -> (count :UInt32);
# Returns the number of proxy history items in the search results. This includes items added to
# the proxy history after this object was created.
getItems @1 (startIndex :UInt32, count :UInt32) -> (items :List(HistoryId));
# Returns up to `count` items starting at `startIndex` in the search results. This includes items
# added to the proxy history after this object was created. May return less than `count` items if
# the range is at the end of the search results or if `count` is larger than the maximum allowed
# value.
subscribe @2 (subscriber :HistorySubscriber) -> (subscription :Subscription);
# Receive a notification on `subscriber` when a new proxy history message becomes available that
# matches the search query. You can obtain the new item from `getItems`. Note that it is possible
# to receive notifications for items you have already accessed and there may be multiple new items
# available by the time you receive a notification.
}
struct HistoryId {
id @0 :Int64;
}
interface HistorySubscriber {
# A client implements this interface on an object that they want to receive new item notification
# callbacks.
notifyNewItem @0 ();
}
interface Subscription {}
# A handle to a subscription for a callback. When this is deleted the subscription will be cancelled
# and no more callbacks will be received.
interface HttpMessage {
connectionInfo @0 () -> (connectionInfo :ConnectionInfo);
requestTimestamp @1 () -> (requestTimestamp :Time);
requestBytes @2 () -> (requestBytes :Data);
responseTimestamp @3 () -> (responseTimestamp :Time);
responseBytes @4 () -> (responseBytes :HttpResponse);
}
struct ConnectionInfo {
host @0 :Text;
port @1 :UInt16;
isHttps @2 :Bool;
}
struct Time {
secs @0 :Int64;
# Number of non-leap seconds since January 1, 1970 (unix timestamp)
nsecs @1 :UInt32;
# Number of nanoseconds since the last second boundary
}
struct HttpResponse {
union {
ok @0 :Data;
err @1 :HttpError;
}
}
enum HttpError {
dns @0;
couldNotConnect @1;
connectionClosed @2;
responseTimeout @3;
responseTooLarge @4;
}
struct GetHistoryItemError {
notFound @0 :Void;
}
struct ScenarioTreeNode {
info @0 :ScenarioInfo;
children @1 :List(ScenarioTreeNode);
}
struct ScenarioInfo {
id @0 :Text;
description @1 :Text;
type @2 :ScenarioType;
createdTimestamp @3 :Time;
modifiedTimestamp @4 :Time;
}
enum ScenarioType {
container @0;
generic @1;
location @2;
endpoint @3;
authorization @4;
businessLogic @5;
}
struct NewScenarioInfo {
id @0 :Text;
description @1 :Text;
type @2 :ScenarioType;
}
struct CreateScenarioError {
union {
idAlreadyExists @0 :Void;
scenarioLimitExceeded @1 :Void;
}
}
struct GetScenarioError {
notFound @0 :Void;
}
interface MethodologySubscriber {
notifyScenarioTreeChanged @0 ();
# A scenario was created, updated, moved, or deleted
}
interface Scenario {
getInfo @0 ()
-> (result :Result(ScenarioInfo, ScenarioGetInfoError));
updateInfo @1 (info: UpdateScenarioInfo)
-> (result :Fallible(ScenarioUpdateInfoError));
# Updates the scenario with `info`. `info` must have been returned by a previous call to
# `getInfo`. An error is returned if the scenario has been updated by another script. This is
# determined by comparing the modification timestamp in `info` to the modification timestamp of
# the scenario.
subscribeScenario @2 (subscriber :ScenarioSubscriber)
-> (subscription :Subscription);
createChildScenario @3 (info :NewScenarioInfo)
-> (result :Fallible(ScenarioCreateChildScenarioError));
moveBefore @4 (before :Scenario)
-> (result :Fallible(ScenarioMoveError));
moveAfter @5 (after :Scenario)
-> (result :Fallible(ScenarioMoveError));
moveInside @6 (parent :Scenario)
-> (result :Fallible(ScenarioMoveError));
delete @7 ()
-> (result :Fallible(ScenarioDeleteError));
# Delete the scenario and all of its child scenarios. Scenarios with testing data cannot be
# deleted. Instead, you can create a container scenario for unwanted scenarios and move this
# scenario inside of it. No scenarios are deleted if an error occurs, even if some child scenarios
# could have been successfully deleted.
}
struct ScenarioGetInfoError {
scenarioDeleted @0 :Void;
}
struct Fallible(E) {
# A potential error of type E.
union {
success @0 :Void;
fail @1 :E;
}
}
struct UpdateScenarioInfo {
id @0 :Text;
description @1 :Text;
previousModifiedTimestamp @2 :Time;
# The modified timestamp from the existing scenario info. This is used to detect if another script
# has updated the scenario since you last downloaded the scenario info.
}
struct ScenarioUpdateInfoError {
union {
scenarioDeleted @0 :Void;
scenarioUpdatedBySomeoneElse @1 :Void;
# The scenario has been updated by another script since you downloaded the scenario info. To force
# the update, get the scenario info again (with the updated modification timestamp) and resubmit
# your changes.
idAlreadyExists @2 :Void;
}
}
interface ScenarioSubscriber {
notifyScenarioUpdated @0 ();
}
struct ScenarioSubscribeScenarioError {
scenarioDeleted @0 :Void;
}
struct ScenarioCreateChildScenarioError {
union {
scenarioDeleted @0 :Void;
idAlreadyExists @1 :Void;
maxScenarioTreeDepthExceeded @2 :Void;
scenarioLimitExceeded @3 :Void;
}
}
struct ScenarioMoveError {
union {
thisScenarioDeleted @0 :Void;
targetScenarioDeleted @1 :Void;
targetScenarioIsChildOfThisScenario @2 :Void;
# You cannot move a scenario inside of itself
maxScenarioTreeDepthExceeded @3 :Void;
}
}
struct ScenarioDeleteError {
union {
scenarioAlreadyDeleted @0 :Void;
scenarioHasTestingData :group {
scenarioId @1 :Text;
}
# You cannot delete a scenario that has been used for testing. Instead, you can create a scenario
# container for unwanted, used scenarios.
}
}
struct BuildInfo {
version @0 :Text;
isDirty @1 :Bool;
buildTimestamp @2 :Text;
gitInfo @3 :Option(GitInfo);
rustCompilerInfo @4 :RustCompilerInfo;
cargoInfo @5 :CargoInfo;
libraryInfo @6 :LibraryInfo;
}
struct GitInfo {
branch @0 :Text;
commitCount @1 :Text;
commitTimestamp @2 :Text;
sha @3 :Text;
}
struct RustCompilerInfo {
channel @0 :Text;
commitDate @1 :Text;
commitHash @2 :Text;
hostTriple @3 :Text;
semver @4 :Text;
}
struct CargoInfo {
features @0 :Text;
profile @1 :Text;
targetTriple @2 :Text;
}
struct LibraryInfo {
dbEngine @0 :Text;
compressionEngine @1 :Text;
}