webdriver-bidi-protocol 0.2.11 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,286 @@
1
+ import type * as Bidi from './main.ts';
2
+ import type * as BidiPermissions from './permissions.ts';
3
+ import type * as BidiBluetooth from './web-bluetooth.ts';
4
+
5
+ export interface CommandMapping {
6
+ 'bluetooth.disableSimulation': {
7
+ params: BidiBluetooth.Bluetooth.DisableSimulationParameters;
8
+ returnType: BidiBluetooth.Bluetooth.DisableSimulationParameters;
9
+ };
10
+ 'bluetooth.handleRequestDevicePrompt': {
11
+ params: BidiBluetooth.Bluetooth.HandleRequestDevicePromptParameters;
12
+ returnType: BidiBluetooth.Bluetooth.HandleRequestDevicePromptParameters;
13
+ };
14
+ 'bluetooth.simulateAdapter': {
15
+ params: BidiBluetooth.Bluetooth.SimulateAdapterParameters;
16
+ returnType: BidiBluetooth.Bluetooth.SimulateAdapterParameters;
17
+ };
18
+ 'bluetooth.simulateAdvertisement': {
19
+ params: BidiBluetooth.Bluetooth.SimulateAdvertisementParameters;
20
+ returnType: BidiBluetooth.Bluetooth.SimulateAdvertisementParameters;
21
+ };
22
+ 'bluetooth.simulateCharacteristic': {
23
+ params: BidiBluetooth.Bluetooth.SimulateCharacteristicParameters;
24
+ returnType: BidiBluetooth.Bluetooth.SimulateCharacteristicParameters;
25
+ };
26
+ 'bluetooth.simulateCharacteristicResponse': {
27
+ params: BidiBluetooth.Bluetooth.SimulateCharacteristicResponseParameters;
28
+ returnType: BidiBluetooth.Bluetooth.SimulateCharacteristicResponseParameters;
29
+ };
30
+ 'bluetooth.simulateDescriptor': {
31
+ params: BidiBluetooth.Bluetooth.SimulateDescriptorParameters;
32
+ returnType: BidiBluetooth.Bluetooth.SimulateDescriptorParameters;
33
+ };
34
+ 'bluetooth.simulateDescriptorResponse': {
35
+ params: BidiBluetooth.Bluetooth.SimulateDescriptorResponseParameters;
36
+ returnType: BidiBluetooth.Bluetooth.SimulateDescriptorResponseParameters;
37
+ };
38
+ 'bluetooth.simulateGattConnectionResponse': {
39
+ params: BidiBluetooth.Bluetooth.SimulateGattConnectionResponseParameters;
40
+ returnType: BidiBluetooth.Bluetooth.SimulateGattConnectionResponseParameters;
41
+ };
42
+ 'bluetooth.simulateGattDisconnection': {
43
+ params: BidiBluetooth.Bluetooth.SimulateGattDisconnectionParameters;
44
+ returnType: BidiBluetooth.Bluetooth.SimulateGattDisconnectionParameters;
45
+ };
46
+ 'bluetooth.simulatePreconnectedPeripheral': {
47
+ params: BidiBluetooth.Bluetooth.SimulatePreconnectedPeripheralParameters;
48
+ returnType: BidiBluetooth.Bluetooth.SimulatePreconnectedPeripheralParameters;
49
+ };
50
+ 'bluetooth.simulateService': {
51
+ params: BidiBluetooth.Bluetooth.SimulateServiceParameters;
52
+ returnType: BidiBluetooth.Bluetooth.SimulateServiceParameters;
53
+ };
54
+ 'browser.close': {
55
+ params: Bidi.Extensible;
56
+ returnType: Bidi.Extensible;
57
+ };
58
+ 'browser.createUserContext': {
59
+ params: Bidi.Browser.CreateUserContextParameters;
60
+ returnType: Bidi.Browser.CreateUserContextParameters;
61
+ };
62
+ 'browser.getClientWindows': {
63
+ params: Bidi.Extensible;
64
+ returnType: Bidi.Extensible;
65
+ };
66
+ 'browser.getUserContexts': {
67
+ params: Bidi.Extensible;
68
+ returnType: Bidi.Extensible;
69
+ };
70
+ 'browser.removeUserContext': {
71
+ params: Bidi.Browser.RemoveUserContextParameters;
72
+ returnType: Bidi.Browser.RemoveUserContextParameters;
73
+ };
74
+ 'browser.setClientWindowState': {
75
+ params: Bidi.Browser.SetClientWindowStateParameters;
76
+ returnType: Bidi.Browser.SetClientWindowStateParameters;
77
+ };
78
+ 'browsingContext.activate': {
79
+ params: Bidi.BrowsingContext.ActivateParameters;
80
+ returnType: Bidi.BrowsingContext.ActivateParameters;
81
+ };
82
+ 'browsingContext.captureScreenshot': {
83
+ params: Bidi.BrowsingContext.CaptureScreenshotParameters;
84
+ returnType: Bidi.BrowsingContext.CaptureScreenshotParameters;
85
+ };
86
+ 'browsingContext.close': {
87
+ params: Bidi.BrowsingContext.CloseParameters;
88
+ returnType: Bidi.BrowsingContext.CloseParameters;
89
+ };
90
+ 'browsingContext.create': {
91
+ params: Bidi.BrowsingContext.CreateParameters;
92
+ returnType: Bidi.BrowsingContext.CreateParameters;
93
+ };
94
+ 'browsingContext.getTree': {
95
+ params: Bidi.BrowsingContext.GetTreeParameters;
96
+ returnType: Bidi.BrowsingContext.GetTreeParameters;
97
+ };
98
+ 'browsingContext.handleUserPrompt': {
99
+ params: Bidi.BrowsingContext.HandleUserPromptParameters;
100
+ returnType: Bidi.BrowsingContext.HandleUserPromptParameters;
101
+ };
102
+ 'browsingContext.locateNodes': {
103
+ params: Bidi.BrowsingContext.LocateNodesParameters;
104
+ returnType: Bidi.BrowsingContext.LocateNodesParameters;
105
+ };
106
+ 'browsingContext.navigate': {
107
+ params: Bidi.BrowsingContext.NavigateParameters;
108
+ returnType: Bidi.BrowsingContext.NavigateParameters;
109
+ };
110
+ 'browsingContext.print': {
111
+ params: Bidi.BrowsingContext.PrintParameters;
112
+ returnType: Bidi.BrowsingContext.PrintParameters;
113
+ };
114
+ 'browsingContext.reload': {
115
+ params: Bidi.BrowsingContext.ReloadParameters;
116
+ returnType: Bidi.BrowsingContext.ReloadParameters;
117
+ };
118
+ 'browsingContext.setViewport': {
119
+ params: Bidi.BrowsingContext.SetViewportParameters;
120
+ returnType: Bidi.BrowsingContext.SetViewportParameters;
121
+ };
122
+ 'browsingContext.traverseHistory': {
123
+ params: Bidi.BrowsingContext.TraverseHistoryParameters;
124
+ returnType: Bidi.BrowsingContext.TraverseHistoryParameters;
125
+ };
126
+ 'emulation.setForcedColorsModeThemeOverride': {
127
+ params: Bidi.Emulation.SetForcedColorsModeThemeOverrideParameters;
128
+ returnType: Bidi.Emulation.SetForcedColorsModeThemeOverrideParameters;
129
+ };
130
+ 'emulation.setGeolocationOverride': {
131
+ params: Bidi.Emulation.SetGeolocationOverrideParameters;
132
+ returnType: Bidi.Emulation.SetGeolocationOverrideParameters;
133
+ };
134
+ 'emulation.setLocaleOverride': {
135
+ params: Bidi.Emulation.SetLocaleOverrideParameters;
136
+ returnType: Bidi.Emulation.SetLocaleOverrideParameters;
137
+ };
138
+ 'emulation.setScreenOrientationOverride': {
139
+ params: Bidi.Emulation.SetScreenOrientationOverrideParameters;
140
+ returnType: Bidi.Emulation.SetScreenOrientationOverrideParameters;
141
+ };
142
+ 'emulation.setScriptingEnabled': {
143
+ params: Bidi.Emulation.SetScriptingEnabledParameters;
144
+ returnType: Bidi.Emulation.SetScriptingEnabledParameters;
145
+ };
146
+ 'emulation.setTimezoneOverride': {
147
+ params: Bidi.Emulation.SetTimezoneOverrideParameters;
148
+ returnType: Bidi.Emulation.SetTimezoneOverrideParameters;
149
+ };
150
+ 'emulation.setUserAgentOverride': {
151
+ params: Bidi.Emulation.SetUserAgentOverrideParameters;
152
+ returnType: Bidi.Emulation.SetUserAgentOverrideParameters;
153
+ };
154
+ 'input.performActions': {
155
+ params: Bidi.Input.PerformActionsParameters;
156
+ returnType: Bidi.Input.PerformActionsParameters;
157
+ };
158
+ 'input.releaseActions': {
159
+ params: Bidi.Input.ReleaseActionsParameters;
160
+ returnType: Bidi.Input.ReleaseActionsParameters;
161
+ };
162
+ 'input.setFiles': {
163
+ params: Bidi.Input.SetFilesParameters;
164
+ returnType: Bidi.Input.SetFilesParameters;
165
+ };
166
+ 'network.addDataCollector': {
167
+ params: Bidi.Network.AddDataCollectorParameters;
168
+ returnType: Bidi.Network.AddDataCollectorParameters;
169
+ };
170
+ 'network.addIntercept': {
171
+ params: Bidi.Network.AddInterceptParameters;
172
+ returnType: Bidi.Network.AddInterceptParameters;
173
+ };
174
+ 'network.continueRequest': {
175
+ params: Bidi.Network.ContinueRequestParameters;
176
+ returnType: Bidi.Network.ContinueRequestParameters;
177
+ };
178
+ 'network.continueResponse': {
179
+ params: Bidi.Network.ContinueResponseParameters;
180
+ returnType: Bidi.Network.ContinueResponseParameters;
181
+ };
182
+ 'network.continueWithAuth': {
183
+ params: Bidi.Network.ContinueWithAuthParameters;
184
+ returnType: Bidi.Network.ContinueWithAuthParameters;
185
+ };
186
+ 'network.disownData': {
187
+ params: Bidi.Network.DisownDataParameters;
188
+ returnType: Bidi.Network.DisownDataParameters;
189
+ };
190
+ 'network.failRequest': {
191
+ params: Bidi.Network.FailRequestParameters;
192
+ returnType: Bidi.Network.FailRequestParameters;
193
+ };
194
+ 'network.getData': {
195
+ params: Bidi.Network.GetDataParameters;
196
+ returnType: Bidi.Network.GetDataParameters;
197
+ };
198
+ 'network.provideResponse': {
199
+ params: Bidi.Network.ProvideResponseParameters;
200
+ returnType: Bidi.Network.ProvideResponseParameters;
201
+ };
202
+ 'network.removeDataCollector': {
203
+ params: Bidi.Network.RemoveDataCollectorParameters;
204
+ returnType: Bidi.Network.RemoveDataCollectorParameters;
205
+ };
206
+ 'network.removeIntercept': {
207
+ params: Bidi.Network.RemoveInterceptParameters;
208
+ returnType: Bidi.Network.RemoveInterceptParameters;
209
+ };
210
+ 'network.setCacheBehavior': {
211
+ params: Bidi.Network.SetCacheBehaviorParameters;
212
+ returnType: Bidi.Network.SetCacheBehaviorParameters;
213
+ };
214
+ 'network.setExtraHeaders': {
215
+ params: Bidi.Network.SetExtraHeadersParameters;
216
+ returnType: Bidi.Network.SetExtraHeadersParameters;
217
+ };
218
+ 'permissions.setPermission': {
219
+ params: BidiPermissions.Permissions.SetPermissionParameters;
220
+ returnType: BidiPermissions.Permissions.SetPermissionParameters;
221
+ };
222
+ 'script.addPreloadScript': {
223
+ params: Bidi.Script.AddPreloadScriptParameters;
224
+ returnType: Bidi.Script.AddPreloadScriptParameters;
225
+ };
226
+ 'script.callFunction': {
227
+ params: Bidi.Script.CallFunctionParameters;
228
+ returnType: Bidi.Script.CallFunctionParameters;
229
+ };
230
+ 'script.disown': {
231
+ params: Bidi.Script.DisownParameters;
232
+ returnType: Bidi.Script.DisownParameters;
233
+ };
234
+ 'script.evaluate': {
235
+ params: Bidi.Script.EvaluateParameters;
236
+ returnType: Bidi.Script.EvaluateParameters;
237
+ };
238
+ 'script.getRealms': {
239
+ params: Bidi.Script.GetRealmsParameters;
240
+ returnType: Bidi.Script.GetRealmsParameters;
241
+ };
242
+ 'script.removePreloadScript': {
243
+ params: Bidi.Script.RemovePreloadScriptParameters;
244
+ returnType: Bidi.Script.RemovePreloadScriptParameters;
245
+ };
246
+ 'session.end': {
247
+ params: Bidi.Extensible;
248
+ returnType: Bidi.Extensible;
249
+ };
250
+ 'session.new': {
251
+ params: Bidi.Session.NewParameters;
252
+ returnType: Bidi.Session.NewParameters;
253
+ };
254
+ 'session.status': {
255
+ params: Bidi.Extensible;
256
+ returnType: Bidi.Extensible;
257
+ };
258
+ 'session.subscribe': {
259
+ params: Bidi.Session.SubscriptionRequest;
260
+ returnType: Bidi.Session.SubscriptionRequest;
261
+ };
262
+ 'session.unsubscribe': {
263
+ params: Bidi.Session.UnsubscribeParameters;
264
+ returnType: Bidi.Session.UnsubscribeParameters;
265
+ };
266
+ 'storage.deleteCookies': {
267
+ params: Bidi.Storage.DeleteCookiesParameters;
268
+ returnType: Bidi.Storage.DeleteCookiesParameters;
269
+ };
270
+ 'storage.getCookies': {
271
+ params: Bidi.Storage.GetCookiesParameters;
272
+ returnType: Bidi.Storage.GetCookiesParameters;
273
+ };
274
+ 'storage.setCookie': {
275
+ params: Bidi.Storage.SetCookieParameters;
276
+ returnType: Bidi.Storage.SetCookieParameters;
277
+ };
278
+ 'webExtension.install': {
279
+ params: Bidi.WebExtension.InstallParameters;
280
+ returnType: Bidi.WebExtension.InstallParameters;
281
+ };
282
+ 'webExtension.uninstall': {
283
+ params: Bidi.WebExtension.UninstallParameters;
284
+ returnType: Bidi.WebExtension.UninstallParameters;
285
+ };
286
+ }
package/src/index.ts CHANGED
@@ -12,12 +12,21 @@ export * from './gen/main.js';
12
12
  export * from './gen/permissions.js';
13
13
  export * from './gen/web-bluetooth.js';
14
14
 
15
+ export type {CommandMapping} from './gen/mapping.d.ts';
16
+
15
17
  type ExternalSpecCommand<T> = {
16
18
  // id is defined by the main WebDriver BiDi spec and extension specs do
17
19
  // not re-define it. Therefore, it's not part of generated types.
18
20
  id: Bidi.JsUint;
19
21
  } & T;
20
22
 
23
+ export type Result = Bidi.ResultData;
24
+
25
+ export type Command =
26
+ | Bidi.Command
27
+ | ExternalSpecCommand<BidiPermissions.PermissionsCommand>
28
+ | ExternalSpecCommand<BidiBluetooth.BluetoothCommand>;
29
+
21
30
  type ExternalSpecEvent<T> = {
22
31
  // type is defined by the main WebDriver BiDi spec and extension specs do
23
32
  // not re-define it. Therefore, it's not part of generated types.
@@ -25,279 +34,6 @@ type ExternalSpecEvent<T> = {
25
34
  } & T &
26
35
  Bidi.Extensible;
27
36
 
28
- export type Command =
29
- | Bidi.Command
30
- | ExternalSpecCommand<BidiPermissions.PermissionsCommand>
31
- | ExternalSpecCommand<BidiBluetooth.BluetoothCommand>;
32
-
33
37
  export type Event =
34
38
  | Bidi.Event
35
39
  | ExternalSpecEvent<BidiBluetooth.BluetoothEvent>;
36
-
37
- // TODO: is there a way to generate this mapping?
38
- export interface Commands {
39
- 'bluetooth.handleRequestDevicePrompt': {
40
- params: BidiBluetooth.Bluetooth.HandleRequestDevicePromptParameters;
41
- returnType: Bidi.EmptyResult;
42
- };
43
- 'bluetooth.disableSimulation': {
44
- params: BidiBluetooth.Bluetooth.DisableSimulationParameters;
45
- returnType: Bidi.EmptyResult;
46
- };
47
- 'bluetooth.simulateAdapter': {
48
- params: BidiBluetooth.Bluetooth.SimulateAdapterParameters;
49
- returnType: Bidi.EmptyResult;
50
- };
51
- 'bluetooth.simulateAdvertisement': {
52
- params: BidiBluetooth.Bluetooth.SimulateAdvertisementParameters;
53
- returnType: Bidi.EmptyResult;
54
- };
55
- 'bluetooth.simulatePreconnectedPeripheral': {
56
- params: BidiBluetooth.Bluetooth.SimulatePreconnectedPeripheralParameters;
57
- returnType: Bidi.EmptyResult;
58
- };
59
- 'bluetooth.simulateGattDisconnection': {
60
- params: BidiBluetooth.Bluetooth.SimulateGattDisconnectionParameters;
61
- returnType: Bidi.EmptyResult;
62
- };
63
- 'bluetooth.simulateDescriptor': {
64
- params: BidiBluetooth.Bluetooth.SimulateDescriptorParameters;
65
- returnType: Bidi.EmptyResult;
66
- };
67
- 'bluetooth.simulateDescriptorResponse': {
68
- params: BidiBluetooth.Bluetooth.SimulateDescriptorResponseParameters;
69
- returnType: Bidi.EmptyResult;
70
- };
71
-
72
- 'browser.close': {
73
- params: Bidi.EmptyParams;
74
- returnType: Bidi.EmptyResult;
75
- };
76
- 'browser.getgetClientWindows': {
77
- params: Bidi.EmptyParams;
78
- returnType: Bidi.Browser.GetClientWindowsResult;
79
- };
80
- 'browser.createUserContext': {
81
- params: Bidi.EmptyParams;
82
- returnType: Bidi.Browser.CreateUserContextResult;
83
- };
84
- 'browser.getUserContexts': {
85
- params: Bidi.EmptyParams;
86
- returnType: Bidi.Browser.GetUserContextsResult;
87
- };
88
- 'browser.removeUserContext': {
89
- params: {
90
- userContext: Bidi.Browser.UserContext;
91
- };
92
- returnType: Bidi.Browser.RemoveUserContext;
93
- };
94
- 'browser.setClientWindowState': {
95
- params: Bidi.Browser.SetClientWindowStateParameters;
96
- returnType: Bidi.Browser.ClientWindowInfo;
97
- };
98
-
99
- 'browsingContext.activate': {
100
- params: Bidi.BrowsingContext.ActivateParameters;
101
- returnType: Bidi.EmptyResult;
102
- };
103
- 'browsingContext.create': {
104
- params: Bidi.BrowsingContext.CreateParameters;
105
- returnType: Bidi.BrowsingContext.CreateResult;
106
- };
107
- 'browsingContext.close': {
108
- params: Bidi.BrowsingContext.CloseParameters;
109
- returnType: Bidi.EmptyResult;
110
- };
111
- 'browsingContext.getTree': {
112
- params: Bidi.BrowsingContext.GetTreeParameters;
113
- returnType: Bidi.BrowsingContext.GetTreeResult;
114
- };
115
- 'browsingContext.locateNodes': {
116
- params: Bidi.BrowsingContext.LocateNodesParameters;
117
- returnType: Bidi.BrowsingContext.LocateNodesResult;
118
- };
119
- 'browsingContext.navigate': {
120
- params: Bidi.BrowsingContext.NavigateParameters;
121
- returnType: Bidi.BrowsingContext.NavigateResult;
122
- };
123
- 'browsingContext.reload': {
124
- params: Bidi.BrowsingContext.ReloadParameters;
125
- returnType: Bidi.BrowsingContext.NavigateResult;
126
- };
127
- 'browsingContext.print': {
128
- params: Bidi.BrowsingContext.PrintParameters;
129
- returnType: Bidi.BrowsingContext.PrintResult;
130
- };
131
- 'browsingContext.captureScreenshot': {
132
- params: Bidi.BrowsingContext.CaptureScreenshotParameters;
133
- returnType: Bidi.BrowsingContext.CaptureScreenshotResult;
134
- };
135
- 'browsingContext.handleUserPrompt': {
136
- params: Bidi.BrowsingContext.HandleUserPromptParameters;
137
- returnType: Bidi.EmptyResult;
138
- };
139
- 'browsingContext.setViewport': {
140
- params: Bidi.BrowsingContext.SetViewportParameters;
141
- returnType: Bidi.EmptyResult;
142
- };
143
- 'browsingContext.traverseHistory': {
144
- params: Bidi.BrowsingContext.TraverseHistoryParameters;
145
- returnType: Bidi.EmptyResult;
146
- };
147
-
148
- 'emulation.setForcedColorsModeThemeOverride': {
149
- params: Bidi.Emulation.SetForcedColorsModeThemeOverrideParameters;
150
- returnType: Bidi.EmptyResult;
151
- };
152
- 'emulation.setGeolocationOverride': {
153
- params: Bidi.Emulation.SetGeolocationOverrideParameters;
154
- returnType: Bidi.EmptyResult;
155
- };
156
- 'emulation.setLocaleOverride': {
157
- params: Bidi.Emulation.SetLocaleOverrideParameters;
158
- returnType: Bidi.EmptyResult;
159
- };
160
- 'emulation.setScreenOrientationOverride': {
161
- params: Bidi.Emulation.SetScreenOrientationOverrideParameters;
162
- returnType: Bidi.EmptyResult;
163
- };
164
- 'emulation.setTimezoneOverride': {
165
- params: Bidi.Emulation.SetTimezoneOverrideParameters;
166
- returnType: Bidi.EmptyResult;
167
- };
168
- 'emulation.setScriptingEnabled': {
169
- params: Bidi.Emulation.SetScriptingEnabledParameters;
170
- returnType: Bidi.EmptyResult;
171
- };
172
- 'emulation.setUserAgentOverride': {
173
- params: Bidi.Emulation.SetUserAgentOverrideParameters;
174
- returnType: Bidi.EmptyResult;
175
- };
176
-
177
- 'input.performActions': {
178
- params: Bidi.Input.PerformActionsParameters;
179
- returnType: Bidi.EmptyResult;
180
- };
181
- 'input.releaseActions': {
182
- params: Bidi.Input.ReleaseActionsParameters;
183
- returnType: Bidi.EmptyResult;
184
- };
185
- 'input.setFiles': {
186
- params: Bidi.Input.SetFilesParameters;
187
- returnType: Bidi.EmptyResult;
188
- };
189
-
190
- 'permissions.setPermission': {
191
- params: BidiPermissions.Permissions.SetPermissionParameters;
192
- returnType: Bidi.EmptyResult;
193
- };
194
-
195
- 'script.evaluate': {
196
- params: Bidi.Script.EvaluateParameters;
197
- returnType: Bidi.Script.EvaluateResult;
198
- };
199
- 'script.callFunction': {
200
- params: Bidi.Script.CallFunctionParameters;
201
- returnType: Bidi.Script.EvaluateResult;
202
- };
203
- 'script.disown': {
204
- params: Bidi.Script.DisownParameters;
205
- returnType: Bidi.EmptyResult;
206
- };
207
- 'script.addPreloadScript': {
208
- params: Bidi.Script.AddPreloadScriptParameters;
209
- returnType: Bidi.Script.AddPreloadScriptResult;
210
- };
211
- 'script.removePreloadScript': {
212
- params: Bidi.Script.RemovePreloadScriptParameters;
213
- returnType: Bidi.EmptyResult;
214
- };
215
-
216
- 'session.end': {
217
- params: Bidi.EmptyParams;
218
- returnType: Bidi.EmptyResult;
219
- };
220
- 'session.new': {
221
- params: Bidi.Session.NewParameters;
222
- returnType: Bidi.Session.NewResult;
223
- };
224
- 'session.status': {
225
- params: object;
226
- returnType: Bidi.Session.StatusResult;
227
- };
228
- 'session.subscribe': {
229
- params: Bidi.Session.SubscriptionRequest;
230
- returnType: Bidi.EmptyResult;
231
- };
232
- 'session.unsubscribe': {
233
- params: Bidi.Session.SubscriptionRequest;
234
- returnType: Bidi.EmptyResult;
235
- };
236
-
237
- 'storage.deleteCookies': {
238
- params: Bidi.Storage.DeleteCookiesParameters;
239
- returnType: Bidi.Storage.DeleteCookiesResult;
240
- };
241
- 'storage.getCookies': {
242
- params: Bidi.Storage.GetCookiesParameters;
243
- returnType: Bidi.Storage.GetCookiesResult;
244
- };
245
- 'storage.setCookie': {
246
- params: Bidi.Storage.SetCookieParameters;
247
- returnType: Bidi.Storage.SetCookieParameters;
248
- };
249
-
250
- 'network.addDataCollector': {
251
- params: Bidi.Network.AddDataCollectorParameters;
252
- returnType: Bidi.Network.AddDataCollectorResult;
253
- };
254
- 'network.addIntercept': {
255
- params: Bidi.Network.AddInterceptParameters;
256
- returnType: Bidi.Network.AddInterceptResult;
257
- };
258
- 'network.removeIntercept': {
259
- params: Bidi.Network.RemoveInterceptParameters;
260
- returnType: Bidi.EmptyResult;
261
- };
262
- 'network.continueRequest': {
263
- params: Bidi.Network.ContinueRequestParameters;
264
- returnType: Bidi.EmptyResult;
265
- };
266
- 'network.continueWithAuth': {
267
- params: Bidi.Network.ContinueWithAuthParameters;
268
- returnType: Bidi.EmptyResult;
269
- };
270
- 'network.failRequest': {
271
- params: Bidi.Network.FailRequestParameters;
272
- returnType: Bidi.EmptyResult;
273
- };
274
- 'network.provideResponse': {
275
- params: Bidi.Network.ProvideResponseParameters;
276
- returnType: Bidi.EmptyResult;
277
- };
278
- 'network.disownData': {
279
- params: Bidi.Network.DisownDataParameters;
280
- returnType: Bidi.EmptyResult;
281
- };
282
- 'network.getData': {
283
- params: Bidi.Network.GetDataParameters;
284
- returnType: Bidi.Network.GetDataResult;
285
- };
286
- 'network.setCacheBehavior': {
287
- params: Bidi.Network.SetCacheBehaviorParameters;
288
- returnType: Bidi.EmptyResult;
289
- };
290
- 'network.setExtraHeaders': {
291
- params: Bidi.Network.SetExtraHeadersParameters;
292
- returnType: Bidi.EmptyResult;
293
- };
294
-
295
- 'webExtension.install': {
296
- params: Bidi.WebExtension.InstallParameters;
297
- returnType: Bidi.WebExtension.InstallResult;
298
- };
299
- 'webExtension.uninstall': {
300
- params: Bidi.WebExtension.UninstallParameters;
301
- returnType: Bidi.EmptyResult;
302
- };
303
- }
@@ -4,14 +4,14 @@
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
6
 
7
- import {Event, Command, Commands} from '..';
7
+ import {Event, Command, CommandMapping} from '..';
8
8
 
9
9
  function sendCommand(command: Command) {}
10
10
  function handleEvent(event: Event) {}
11
- function sendCommandMultipleArgs<T extends keyof Commands>(
11
+ function sendCommandMultipleArgs<T extends keyof CommandMapping>(
12
12
  method: T,
13
- params: Commands[T]['params'],
14
- ): {result: Commands[T]['returnType']} {
13
+ params: CommandMapping[T]['params'],
14
+ ): {result: CommandMapping[T]['returnType']} {
15
15
  throw new Error('Not implemented');
16
16
  }
17
17
 
package/tools/build.sh CHANGED
@@ -4,6 +4,8 @@
4
4
  # Copyright 2024 Google Inc.
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
+ set -e
8
+
7
9
  rm -rf src/gen && mkdir src/gen
8
10
  rm -rf out
9
11
 
@@ -23,6 +25,7 @@ cddlconv specs/web-bluetooth/all.cddl > src/gen/web-bluetooth.ts
23
25
 
24
26
  git submodule deinit --all
25
27
 
28
+ node ./tools/generateCommandMap.ts
26
29
  npx tsc -p tsconfig.json
27
30
  npx tsd
28
- npm run format
31
+ npm run format