dfindexeddb 20251109__tar.gz → 20260205__tar.gz
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.
- {dfindexeddb-20251109 → dfindexeddb-20260205}/PKG-INFO +35 -86
- {dfindexeddb-20251109 → dfindexeddb-20260205}/README.md +34 -85
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/chromium/definitions.py +92 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/chromium/record.py +266 -63
- dfindexeddb-20260205/dfindexeddb/indexeddb/chromium/sqlite.py +362 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/cli.py +169 -12
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/firefox/record.py +12 -2
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/safari/record.py +20 -4
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/utils.py +84 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/version.py +1 -1
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb.egg-info/PKG-INFO +35 -86
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb.egg-info/SOURCES.txt +1 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/pyproject.toml +18 -5
- {dfindexeddb-20251109 → dfindexeddb-20260205}/setup.py +1 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/LICENSE +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/__init__.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/errors.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/__init__.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/chromium/__init__.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/chromium/blink.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/chromium/v8.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/firefox/__init__.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/firefox/definitions.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/firefox/gecko.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/safari/__init__.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/safari/definitions.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/safari/webkit.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/types.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/indexeddb/utils.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/__init__.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/cli.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/definitions.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/descriptor.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/ldb.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/log.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/plugins/__init__.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/plugins/chrome_notifications.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/plugins/interface.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/plugins/manager.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/plugins/notification_database_data_pb2.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/leveldb/record.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb/utils.py +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb.egg-info/dependency_links.txt +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb.egg-info/entry_points.txt +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb.egg-info/requires.txt +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/dfindexeddb.egg-info/top_level.txt +0 -0
- {dfindexeddb-20251109 → dfindexeddb-20260205}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dfindexeddb
|
|
3
|
-
Version:
|
|
3
|
+
Version: 20260205
|
|
4
4
|
Summary: dfindexeddb is an experimental Python tool for performing digital forensic analysis of IndexedDB and leveldb files.
|
|
5
5
|
Author-email: Syd Pleno <sydp@google.com>
|
|
6
6
|
Maintainer-email: dfIndexeddb Developers <dfindexeddb-dev@googlegroups.com>
|
|
@@ -55,6 +55,8 @@ include:
|
|
|
55
55
|
$ pip install dfindexeddb
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
### Optional plugins
|
|
59
|
+
|
|
58
60
|
To also install the dependencies for leveldb/indexeddb plugins, run
|
|
59
61
|
```
|
|
60
62
|
$ pip install 'dfindexeddb[plugins]'
|
|
@@ -79,6 +81,8 @@ To also install the dependencies for leveldb/indexeddb plugins, run
|
|
|
79
81
|
$ pip install .
|
|
80
82
|
```
|
|
81
83
|
|
|
84
|
+
### Optional plugins
|
|
85
|
+
|
|
82
86
|
To also install the dependencies for leveldb/indexeddb plugins, run
|
|
83
87
|
```
|
|
84
88
|
$ pip install '.[plugins]'
|
|
@@ -94,15 +98,17 @@ installation:
|
|
|
94
98
|
|
|
95
99
|
```
|
|
96
100
|
$ dfindexeddb -h
|
|
97
|
-
usage: dfindexeddb [-h] {db,ldb,log} ...
|
|
101
|
+
usage: dfindexeddb [-h] {blink,gecko,db,ldb,log} ...
|
|
98
102
|
|
|
99
|
-
A cli tool for parsing
|
|
103
|
+
A cli tool for parsing IndexedDB files
|
|
100
104
|
|
|
101
105
|
positional arguments:
|
|
102
|
-
{db,ldb,log}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
{blink,gecko,db,ldb,log}
|
|
107
|
+
blink Parse a file as a blink-encoded value.
|
|
108
|
+
gecko Parse a file as a gecko-encoded value.
|
|
109
|
+
db Parse a directory/file as IndexedDB.
|
|
110
|
+
ldb Parse a ldb file as IndexedDB.
|
|
111
|
+
log Parse a log file as IndexedDB.
|
|
106
112
|
|
|
107
113
|
options:
|
|
108
114
|
-h, --help show this help message and exit
|
|
@@ -110,48 +116,17 @@ options:
|
|
|
110
116
|
|
|
111
117
|
#### Examples:
|
|
112
118
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
dfindexeddb db -s SOURCE --format
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
dfindexeddb db -s SOURCE --format safari -o jsonl
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
To parse IndexedDB records from a LevelDB folder for Chrome/Chromium, using the
|
|
128
|
-
manifest file to determine recovered records and output as JSON, use the
|
|
129
|
-
following command:
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
dfindexeddb db -s SOURCE --format chrome --use_manifest
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
To parse IndexedDB records from a LevelDB ldb (.ldb) file and output the
|
|
136
|
-
results as JSON-L, use the following command:
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
dfindexeddb ldb -s SOURCE -o jsonl
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
To parse IndexedDB records from a LevelDB log (.log) file and output the
|
|
143
|
-
results as the Python printable representation, use the following command:
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
dfindexeddb log -s SOURCE -o repr
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
To parse a file as a Chrome/Chromium IndexedDB blink value and output the
|
|
150
|
-
results as JSON:
|
|
119
|
+
| Platform / Source | Format | Command |
|
|
120
|
+
| :--- | :--- | :--- |
|
|
121
|
+
| **Firefox** (sqlite) | JSON | `dfindexeddb db -s SOURCE --format firefox -o json` |
|
|
122
|
+
| **Safari** (sqlite) | JSON-L | `dfindexeddb db -s SOURCE --format safari -o jsonl` |
|
|
123
|
+
| **Chrome** (LevelDB/sqlite) | JSON | `dfindexeddb db -s SOURCE --format chrome` |
|
|
124
|
+
| **Chrome** (.ldb) | JSON-L | `dfindexeddb ldb -s SOURCE -o jsonl` |
|
|
125
|
+
| **Chrome** (.log) | Python repr | `dfindexeddb log -s SOURCE -o repr` |
|
|
126
|
+
| **Chrome** (Blink) | JSON | `dfindexeddb blink -s SOURCE` |
|
|
127
|
+
| **Filter Records by key** | JSON | `dfindexeddb db -s SOURCE --format chrome --filter_key search_term` |
|
|
128
|
+
| **Filter Records by value** | JSON | `dfindexeddb db -s SOURCE --format chrome --filter_value "search_term"` |
|
|
151
129
|
|
|
152
|
-
```
|
|
153
|
-
dfindexeddb blink -s SOURCE
|
|
154
|
-
```
|
|
155
130
|
|
|
156
131
|
### LevelDB
|
|
157
132
|
|
|
@@ -174,44 +149,18 @@ options:
|
|
|
174
149
|
|
|
175
150
|
#### Examples
|
|
176
151
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
dfleveldb
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
To parse blocks / physical records/ write batches / internal key records from a
|
|
192
|
-
LevelDB log (.log) file, use the following command, specifying the type (block,
|
|
193
|
-
physical_records, etc) via the `-t` option. By default, internal key records are parsed:
|
|
194
|
-
|
|
195
|
-
```
|
|
196
|
-
$ dfleveldb log -s SOURCE [-t {blocks,physical_records,write_batches,parsed_internal_key}]
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
To parse blocks / records from a LevelDB table (.ldb) file, use the following
|
|
200
|
-
command, specifying the type (blocks, records) via the `-t` option. By
|
|
201
|
-
default, records are parsed:
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
$ dfleveldb ldb -s SOURCE [-t {blocks,records}]
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
To parse version edit records from a Descriptor (MANIFEST) file, use the
|
|
208
|
-
following command:
|
|
209
|
-
|
|
210
|
-
```
|
|
211
|
-
$ dfleveldb descriptor -s SOURCE [-o {json,jsonl,repr}] [-t {blocks,physical_records,versionedit} | -v]
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
#### Plugins
|
|
152
|
+
| Source | Type | Command |
|
|
153
|
+
| :--- | :--- | :--- |
|
|
154
|
+
| **LevelDB Folder** | Records | `dfleveldb db -s SOURCE` |
|
|
155
|
+
| **Log file** (.log) | Physical Records | `dfleveldb log -s SOURCE -t physical_records` |
|
|
156
|
+
| **Log file** (.log) | Blocks | `dfleveldb log -s SOURCE -t blocks` |
|
|
157
|
+
| **Log file** (.log) | Write Batches | `dfleveldb log -s SOURCE -t write_batches` |
|
|
158
|
+
| **Log file** (.log) | Internal Key Records | `dfleveldb log -s SOURCE -t parsed_internal_key` |
|
|
159
|
+
| **Table file** (.ldb) | Records | `dfleveldb ldb -s SOURCE -t record` |
|
|
160
|
+
| **Table file** (.ldb) | Blocks | `dfleveldb ldb -s SOURCE -t blocks` |
|
|
161
|
+
| **Descriptor** (MANIFEST) | Version Edits | `dfleveldb descriptor -s SOURCE -t versionedit` |
|
|
162
|
+
|
|
163
|
+
#### Optional Plugins
|
|
215
164
|
|
|
216
165
|
To apply a plugin parser for a leveldb file/folder, add the
|
|
217
166
|
`--plugin [Plugin Name]` argument. Currently, there is support for the
|
|
@@ -32,6 +32,8 @@ include:
|
|
|
32
32
|
$ pip install dfindexeddb
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
### Optional plugins
|
|
36
|
+
|
|
35
37
|
To also install the dependencies for leveldb/indexeddb plugins, run
|
|
36
38
|
```
|
|
37
39
|
$ pip install 'dfindexeddb[plugins]'
|
|
@@ -56,6 +58,8 @@ To also install the dependencies for leveldb/indexeddb plugins, run
|
|
|
56
58
|
$ pip install .
|
|
57
59
|
```
|
|
58
60
|
|
|
61
|
+
### Optional plugins
|
|
62
|
+
|
|
59
63
|
To also install the dependencies for leveldb/indexeddb plugins, run
|
|
60
64
|
```
|
|
61
65
|
$ pip install '.[plugins]'
|
|
@@ -71,15 +75,17 @@ installation:
|
|
|
71
75
|
|
|
72
76
|
```
|
|
73
77
|
$ dfindexeddb -h
|
|
74
|
-
usage: dfindexeddb [-h] {db,ldb,log} ...
|
|
78
|
+
usage: dfindexeddb [-h] {blink,gecko,db,ldb,log} ...
|
|
75
79
|
|
|
76
|
-
A cli tool for parsing
|
|
80
|
+
A cli tool for parsing IndexedDB files
|
|
77
81
|
|
|
78
82
|
positional arguments:
|
|
79
|
-
{db,ldb,log}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
{blink,gecko,db,ldb,log}
|
|
84
|
+
blink Parse a file as a blink-encoded value.
|
|
85
|
+
gecko Parse a file as a gecko-encoded value.
|
|
86
|
+
db Parse a directory/file as IndexedDB.
|
|
87
|
+
ldb Parse a ldb file as IndexedDB.
|
|
88
|
+
log Parse a log file as IndexedDB.
|
|
83
89
|
|
|
84
90
|
options:
|
|
85
91
|
-h, --help show this help message and exit
|
|
@@ -87,48 +93,17 @@ options:
|
|
|
87
93
|
|
|
88
94
|
#### Examples:
|
|
89
95
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
dfindexeddb db -s SOURCE --format
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
dfindexeddb db -s SOURCE --format safari -o jsonl
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
To parse IndexedDB records from a LevelDB folder for Chrome/Chromium, using the
|
|
105
|
-
manifest file to determine recovered records and output as JSON, use the
|
|
106
|
-
following command:
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
dfindexeddb db -s SOURCE --format chrome --use_manifest
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
To parse IndexedDB records from a LevelDB ldb (.ldb) file and output the
|
|
113
|
-
results as JSON-L, use the following command:
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
dfindexeddb ldb -s SOURCE -o jsonl
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
To parse IndexedDB records from a LevelDB log (.log) file and output the
|
|
120
|
-
results as the Python printable representation, use the following command:
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
dfindexeddb log -s SOURCE -o repr
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
To parse a file as a Chrome/Chromium IndexedDB blink value and output the
|
|
127
|
-
results as JSON:
|
|
96
|
+
| Platform / Source | Format | Command |
|
|
97
|
+
| :--- | :--- | :--- |
|
|
98
|
+
| **Firefox** (sqlite) | JSON | `dfindexeddb db -s SOURCE --format firefox -o json` |
|
|
99
|
+
| **Safari** (sqlite) | JSON-L | `dfindexeddb db -s SOURCE --format safari -o jsonl` |
|
|
100
|
+
| **Chrome** (LevelDB/sqlite) | JSON | `dfindexeddb db -s SOURCE --format chrome` |
|
|
101
|
+
| **Chrome** (.ldb) | JSON-L | `dfindexeddb ldb -s SOURCE -o jsonl` |
|
|
102
|
+
| **Chrome** (.log) | Python repr | `dfindexeddb log -s SOURCE -o repr` |
|
|
103
|
+
| **Chrome** (Blink) | JSON | `dfindexeddb blink -s SOURCE` |
|
|
104
|
+
| **Filter Records by key** | JSON | `dfindexeddb db -s SOURCE --format chrome --filter_key search_term` |
|
|
105
|
+
| **Filter Records by value** | JSON | `dfindexeddb db -s SOURCE --format chrome --filter_value "search_term"` |
|
|
128
106
|
|
|
129
|
-
```
|
|
130
|
-
dfindexeddb blink -s SOURCE
|
|
131
|
-
```
|
|
132
107
|
|
|
133
108
|
### LevelDB
|
|
134
109
|
|
|
@@ -151,44 +126,18 @@ options:
|
|
|
151
126
|
|
|
152
127
|
#### Examples
|
|
153
128
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
dfleveldb
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
To parse blocks / physical records/ write batches / internal key records from a
|
|
169
|
-
LevelDB log (.log) file, use the following command, specifying the type (block,
|
|
170
|
-
physical_records, etc) via the `-t` option. By default, internal key records are parsed:
|
|
171
|
-
|
|
172
|
-
```
|
|
173
|
-
$ dfleveldb log -s SOURCE [-t {blocks,physical_records,write_batches,parsed_internal_key}]
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
To parse blocks / records from a LevelDB table (.ldb) file, use the following
|
|
177
|
-
command, specifying the type (blocks, records) via the `-t` option. By
|
|
178
|
-
default, records are parsed:
|
|
179
|
-
|
|
180
|
-
```
|
|
181
|
-
$ dfleveldb ldb -s SOURCE [-t {blocks,records}]
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
To parse version edit records from a Descriptor (MANIFEST) file, use the
|
|
185
|
-
following command:
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
$ dfleveldb descriptor -s SOURCE [-o {json,jsonl,repr}] [-t {blocks,physical_records,versionedit} | -v]
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
#### Plugins
|
|
129
|
+
| Source | Type | Command |
|
|
130
|
+
| :--- | :--- | :--- |
|
|
131
|
+
| **LevelDB Folder** | Records | `dfleveldb db -s SOURCE` |
|
|
132
|
+
| **Log file** (.log) | Physical Records | `dfleveldb log -s SOURCE -t physical_records` |
|
|
133
|
+
| **Log file** (.log) | Blocks | `dfleveldb log -s SOURCE -t blocks` |
|
|
134
|
+
| **Log file** (.log) | Write Batches | `dfleveldb log -s SOURCE -t write_batches` |
|
|
135
|
+
| **Log file** (.log) | Internal Key Records | `dfleveldb log -s SOURCE -t parsed_internal_key` |
|
|
136
|
+
| **Table file** (.ldb) | Records | `dfleveldb ldb -s SOURCE -t record` |
|
|
137
|
+
| **Table file** (.ldb) | Blocks | `dfleveldb ldb -s SOURCE -t blocks` |
|
|
138
|
+
| **Descriptor** (MANIFEST) | Version Edits | `dfleveldb descriptor -s SOURCE -t versionedit` |
|
|
139
|
+
|
|
140
|
+
#### Optional Plugins
|
|
192
141
|
|
|
193
142
|
To apply a plugin parser for a leveldb file/folder, add the
|
|
194
143
|
`--plugin [Plugin Name]` argument. Currently, there is support for the
|
|
@@ -14,11 +14,14 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
"""Definitions for IndexedDB."""
|
|
16
16
|
from enum import Enum, IntEnum, IntFlag
|
|
17
|
+
import textwrap
|
|
17
18
|
|
|
18
19
|
REQUIRES_PROCESSING_SSV_PSEUDO_VERSION = 0x11
|
|
19
20
|
REPLACE_WITH_BLOB = 0x01
|
|
20
21
|
COMPRESSED_WITH_SNAPPY = 0x02
|
|
21
22
|
|
|
23
|
+
SENTINEL = 0x00
|
|
24
|
+
|
|
22
25
|
|
|
23
26
|
class DatabaseMetaDataKeyType(IntEnum):
|
|
24
27
|
"""Database Metadata key types."""
|
|
@@ -72,6 +75,16 @@ class IDBKeyType(IntEnum):
|
|
|
72
75
|
BINARY = 6
|
|
73
76
|
|
|
74
77
|
|
|
78
|
+
class OrderedIDBKeyType(IntEnum):
|
|
79
|
+
"""Ordered IndexedDB key types."""
|
|
80
|
+
|
|
81
|
+
NUMBER = 0x10
|
|
82
|
+
DATE = 0x20
|
|
83
|
+
STRING = 0x30
|
|
84
|
+
BINARY = 0x40
|
|
85
|
+
ARRAY = 0x50
|
|
86
|
+
|
|
87
|
+
|
|
75
88
|
class IndexMetaDataKeyType(IntEnum):
|
|
76
89
|
"""IndexedDB metadata key types."""
|
|
77
90
|
|
|
@@ -398,3 +411,82 @@ class SerializedImageOrientation(IntEnum):
|
|
|
398
411
|
RIGHT_BOTTOM = 6
|
|
399
412
|
LEFT_BOTTOM = 7
|
|
400
413
|
LAST = LEFT_BOTTOM
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
class DatabaseCompressionType(IntEnum):
|
|
417
|
+
"""Database Compression Types."""
|
|
418
|
+
|
|
419
|
+
UNCOMPRESSED = 0
|
|
420
|
+
ZSTD = 1
|
|
421
|
+
SNAPPY = 2
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
SQL_RECORDS_QUERY_BASE = textwrap.dedent(
|
|
425
|
+
"""
|
|
426
|
+
SELECT
|
|
427
|
+
row_id,
|
|
428
|
+
object_store_id,
|
|
429
|
+
compression_type,
|
|
430
|
+
key,
|
|
431
|
+
value,
|
|
432
|
+
EXISTS (
|
|
433
|
+
SELECT 1
|
|
434
|
+
FROM blob_references
|
|
435
|
+
WHERE record_row_id = records.row_id
|
|
436
|
+
) AS has_blobs
|
|
437
|
+
FROM records"""
|
|
438
|
+
).strip()
|
|
439
|
+
|
|
440
|
+
SQL_RECORDS_QUERY = SQL_RECORDS_QUERY_BASE
|
|
441
|
+
|
|
442
|
+
SQL_RECORDS_BY_ID_QUERY = f"{SQL_RECORDS_QUERY_BASE} WHERE object_store_id = ?"
|
|
443
|
+
|
|
444
|
+
SQL_RECORDS_BY_NAME_QUERY = textwrap.dedent(
|
|
445
|
+
f"""
|
|
446
|
+
{SQL_RECORDS_QUERY_BASE}
|
|
447
|
+
JOIN object_stores ON records.object_store_id = object_stores.id
|
|
448
|
+
WHERE object_stores.name = ?"""
|
|
449
|
+
).strip()
|
|
450
|
+
|
|
451
|
+
SQL_OBJECT_STORES_QUERY = textwrap.dedent(
|
|
452
|
+
"""
|
|
453
|
+
SELECT
|
|
454
|
+
id,
|
|
455
|
+
name,
|
|
456
|
+
key_path,
|
|
457
|
+
auto_increment,
|
|
458
|
+
key_generator_current_number
|
|
459
|
+
FROM object_stores"""
|
|
460
|
+
).strip()
|
|
461
|
+
|
|
462
|
+
SQL_BLOB_DATA_QUERY = textwrap.dedent(
|
|
463
|
+
"""
|
|
464
|
+
SELECT
|
|
465
|
+
b.row_id,
|
|
466
|
+
b.object_type,
|
|
467
|
+
b.mime_type,
|
|
468
|
+
b.size_bytes,
|
|
469
|
+
b.file_name,
|
|
470
|
+
0 AS chunk_index,
|
|
471
|
+
b.bytes
|
|
472
|
+
FROM blobs b
|
|
473
|
+
JOIN blob_references r ON b.row_id = r.blob_row_id
|
|
474
|
+
WHERE r.record_row_id = ?
|
|
475
|
+
|
|
476
|
+
UNION ALL
|
|
477
|
+
|
|
478
|
+
SELECT
|
|
479
|
+
c.blob_row_id AS row_id,
|
|
480
|
+
b.object_type,
|
|
481
|
+
b.mime_type,
|
|
482
|
+
b.size_bytes,
|
|
483
|
+
b.file_name,
|
|
484
|
+
c.chunk_index,
|
|
485
|
+
c.bytes
|
|
486
|
+
FROM overflow_blob_chunks c
|
|
487
|
+
JOIN blobs b ON c.blob_row_id = b.row_id
|
|
488
|
+
JOIN blob_references r ON b.row_id = r.blob_row_id
|
|
489
|
+
WHERE r.record_row_id = ?
|
|
490
|
+
|
|
491
|
+
ORDER BY row_id, chunk_index"""
|
|
492
|
+
).strip()
|