browser_protocol/indexeddb/
mod.rs1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3
4#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7#[serde(rename_all = "camelCase")]
8pub struct DatabaseWithObjectStores {
9 pub name: String,
12 pub version: f64,
16 pub objectStores: Vec<ObjectStore>,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize, Default)]
24#[serde(rename_all = "camelCase")]
25pub struct ObjectStore {
26 pub name: String,
29 pub keyPath: KeyPath,
32 pub autoIncrement: bool,
35 pub indexes: Vec<ObjectStoreIndex>,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize, Default)]
43#[serde(rename_all = "camelCase")]
44pub struct ObjectStoreIndex {
45 pub name: String,
48 pub keyPath: KeyPath,
51 pub unique: bool,
54 pub multiEntry: bool,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize, Default)]
62#[serde(rename_all = "camelCase")]
63pub struct Key {
64 #[serde(rename = "type")]
67 pub type_: String,
68 #[serde(skip_serializing_if = "Option::is_none")]
71 pub number: Option<f64>,
72 #[serde(skip_serializing_if = "Option::is_none")]
75 pub string: Option<String>,
76 #[serde(skip_serializing_if = "Option::is_none")]
79 pub date: Option<f64>,
80 #[serde(skip_serializing_if = "Option::is_none")]
83 pub array: Option<Vec<Key>>,
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize, Default)]
89#[serde(rename_all = "camelCase")]
90pub struct KeyRange {
91 #[serde(skip_serializing_if = "Option::is_none")]
94 pub lower: Option<Key>,
95 #[serde(skip_serializing_if = "Option::is_none")]
98 pub upper: Option<Key>,
99 pub lowerOpen: bool,
102 pub upperOpen: bool,
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize, Default)]
110#[serde(rename_all = "camelCase")]
111pub struct DataEntry {
112 pub key: crate::runtime::RemoteObject,
115 pub primaryKey: crate::runtime::RemoteObject,
118 pub value: crate::runtime::RemoteObject,
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize, Default)]
126#[serde(rename_all = "camelCase")]
127pub struct KeyPath {
128 #[serde(rename = "type")]
131 pub type_: String,
132 #[serde(skip_serializing_if = "Option::is_none")]
135 pub string: Option<String>,
136 #[serde(skip_serializing_if = "Option::is_none")]
139 pub array: Option<Vec<String>>,
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize, Default)]
145#[serde(rename_all = "camelCase")]
146pub struct ClearObjectStoreParams {
147 #[serde(skip_serializing_if = "Option::is_none")]
151 pub securityOrigin: Option<String>,
152 #[serde(skip_serializing_if = "Option::is_none")]
155 pub storageKey: Option<String>,
156 #[serde(skip_serializing_if = "Option::is_none")]
159 pub storageBucket: Option<crate::storage::StorageBucket>,
160 pub databaseName: String,
163 pub objectStoreName: String,
166}
167
168impl ClearObjectStoreParams { pub const METHOD: &'static str = "IndexedDB.clearObjectStore"; }
169
170impl crate::CdpCommand for ClearObjectStoreParams {
171 const METHOD: &'static str = "IndexedDB.clearObjectStore";
172 type Response = crate::EmptyReturns;
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize, Default)]
178#[serde(rename_all = "camelCase")]
179pub struct DeleteDatabaseParams {
180 #[serde(skip_serializing_if = "Option::is_none")]
184 pub securityOrigin: Option<String>,
185 #[serde(skip_serializing_if = "Option::is_none")]
188 pub storageKey: Option<String>,
189 #[serde(skip_serializing_if = "Option::is_none")]
192 pub storageBucket: Option<crate::storage::StorageBucket>,
193 pub databaseName: String,
196}
197
198impl DeleteDatabaseParams { pub const METHOD: &'static str = "IndexedDB.deleteDatabase"; }
199
200impl crate::CdpCommand for DeleteDatabaseParams {
201 const METHOD: &'static str = "IndexedDB.deleteDatabase";
202 type Response = crate::EmptyReturns;
203}
204
205#[derive(Debug, Clone, Serialize, Deserialize, Default)]
208#[serde(rename_all = "camelCase")]
209pub struct DeleteObjectStoreEntriesParams {
210 #[serde(skip_serializing_if = "Option::is_none")]
214 pub securityOrigin: Option<String>,
215 #[serde(skip_serializing_if = "Option::is_none")]
218 pub storageKey: Option<String>,
219 #[serde(skip_serializing_if = "Option::is_none")]
222 pub storageBucket: Option<crate::storage::StorageBucket>,
223
224 pub databaseName: String,
225
226 pub objectStoreName: String,
227 pub keyRange: KeyRange,
230}
231
232impl DeleteObjectStoreEntriesParams { pub const METHOD: &'static str = "IndexedDB.deleteObjectStoreEntries"; }
233
234impl crate::CdpCommand for DeleteObjectStoreEntriesParams {
235 const METHOD: &'static str = "IndexedDB.deleteObjectStoreEntries";
236 type Response = crate::EmptyReturns;
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize, Default)]
240pub struct DisableParams {}
241
242impl DisableParams { pub const METHOD: &'static str = "IndexedDB.disable"; }
243
244impl crate::CdpCommand for DisableParams {
245 const METHOD: &'static str = "IndexedDB.disable";
246 type Response = crate::EmptyReturns;
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize, Default)]
250pub struct EnableParams {}
251
252impl EnableParams { pub const METHOD: &'static str = "IndexedDB.enable"; }
253
254impl crate::CdpCommand for EnableParams {
255 const METHOD: &'static str = "IndexedDB.enable";
256 type Response = crate::EmptyReturns;
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize, Default)]
262#[serde(rename_all = "camelCase")]
263pub struct RequestDataParams {
264 #[serde(skip_serializing_if = "Option::is_none")]
268 pub securityOrigin: Option<String>,
269 #[serde(skip_serializing_if = "Option::is_none")]
272 pub storageKey: Option<String>,
273 #[serde(skip_serializing_if = "Option::is_none")]
276 pub storageBucket: Option<crate::storage::StorageBucket>,
277 pub databaseName: String,
280 pub objectStoreName: String,
283 #[serde(skip_serializing_if = "Option::is_none")]
286 pub indexName: Option<String>,
287 pub skipCount: u64,
290 pub pageSize: u64,
293 #[serde(skip_serializing_if = "Option::is_none")]
296 pub keyRange: Option<KeyRange>,
297}
298
299#[derive(Debug, Clone, Serialize, Deserialize, Default)]
302#[serde(rename_all = "camelCase")]
303pub struct RequestDataReturns {
304 pub objectStoreDataEntries: Vec<DataEntry>,
307 pub hasMore: bool,
310}
311
312impl RequestDataParams { pub const METHOD: &'static str = "IndexedDB.requestData"; }
313
314impl crate::CdpCommand for RequestDataParams {
315 const METHOD: &'static str = "IndexedDB.requestData";
316 type Response = RequestDataReturns;
317}
318
319#[derive(Debug, Clone, Serialize, Deserialize, Default)]
322#[serde(rename_all = "camelCase")]
323pub struct GetMetadataParams {
324 #[serde(skip_serializing_if = "Option::is_none")]
328 pub securityOrigin: Option<String>,
329 #[serde(skip_serializing_if = "Option::is_none")]
332 pub storageKey: Option<String>,
333 #[serde(skip_serializing_if = "Option::is_none")]
336 pub storageBucket: Option<crate::storage::StorageBucket>,
337 pub databaseName: String,
340 pub objectStoreName: String,
343}
344
345#[derive(Debug, Clone, Serialize, Deserialize, Default)]
348#[serde(rename_all = "camelCase")]
349pub struct GetMetadataReturns {
350 pub entriesCount: f64,
353 pub keyGeneratorValue: f64,
358}
359
360impl GetMetadataParams { pub const METHOD: &'static str = "IndexedDB.getMetadata"; }
361
362impl crate::CdpCommand for GetMetadataParams {
363 const METHOD: &'static str = "IndexedDB.getMetadata";
364 type Response = GetMetadataReturns;
365}
366
367#[derive(Debug, Clone, Serialize, Deserialize, Default)]
370#[serde(rename_all = "camelCase")]
371pub struct RequestDatabaseParams {
372 #[serde(skip_serializing_if = "Option::is_none")]
376 pub securityOrigin: Option<String>,
377 #[serde(skip_serializing_if = "Option::is_none")]
380 pub storageKey: Option<String>,
381 #[serde(skip_serializing_if = "Option::is_none")]
384 pub storageBucket: Option<crate::storage::StorageBucket>,
385 pub databaseName: String,
388}
389
390#[derive(Debug, Clone, Serialize, Deserialize, Default)]
393#[serde(rename_all = "camelCase")]
394pub struct RequestDatabaseReturns {
395 pub databaseWithObjectStores: DatabaseWithObjectStores,
398}
399
400impl RequestDatabaseParams { pub const METHOD: &'static str = "IndexedDB.requestDatabase"; }
401
402impl crate::CdpCommand for RequestDatabaseParams {
403 const METHOD: &'static str = "IndexedDB.requestDatabase";
404 type Response = RequestDatabaseReturns;
405}
406
407#[derive(Debug, Clone, Serialize, Deserialize, Default)]
410#[serde(rename_all = "camelCase")]
411pub struct RequestDatabaseNamesParams {
412 #[serde(skip_serializing_if = "Option::is_none")]
416 pub securityOrigin: Option<String>,
417 #[serde(skip_serializing_if = "Option::is_none")]
420 pub storageKey: Option<String>,
421 #[serde(skip_serializing_if = "Option::is_none")]
424 pub storageBucket: Option<crate::storage::StorageBucket>,
425}
426
427#[derive(Debug, Clone, Serialize, Deserialize, Default)]
430#[serde(rename_all = "camelCase")]
431pub struct RequestDatabaseNamesReturns {
432 pub databaseNames: Vec<String>,
435}
436
437impl RequestDatabaseNamesParams { pub const METHOD: &'static str = "IndexedDB.requestDatabaseNames"; }
438
439impl crate::CdpCommand for RequestDatabaseNamesParams {
440 const METHOD: &'static str = "IndexedDB.requestDatabaseNames";
441 type Response = RequestDatabaseNamesReturns;
442}