deepbase-indexeddb 3.6.5 → 3.6.7
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.
- package/package.json +2 -2
- package/src/IndexedDBDriver.js +39 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepbase-indexeddb",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.7",
|
|
4
4
|
"description": "⚡ DeepBase IndexedDB - browser storage driver",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.cjs",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"deepbase": "^3.6.
|
|
18
|
+
"deepbase": "^3.6.7"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"test": "echo \"IndexedDB tests require browser environment. See test/test.html\""
|
package/src/IndexedDBDriver.js
CHANGED
|
@@ -206,6 +206,45 @@ export class IndexedDBDriver extends DeepBaseDriver {
|
|
|
206
206
|
return shiftedValue;
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
|
+
|
|
210
|
+
async first(...args) {
|
|
211
|
+
if (!this._connected) {
|
|
212
|
+
throw new Error('Database not connected. Call connect() first.');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const value = await this.get(...args);
|
|
216
|
+
if (value === null || typeof value !== 'object') {
|
|
217
|
+
return undefined;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
for (const key in value) {
|
|
221
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
222
|
+
return key;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async last(...args) {
|
|
230
|
+
if (!this._connected) {
|
|
231
|
+
throw new Error('Database not connected. Call connect() first.');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const value = await this.get(...args);
|
|
235
|
+
if (value === null || typeof value !== 'object') {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
let last;
|
|
240
|
+
for (const key in value) {
|
|
241
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
242
|
+
last = key;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return last;
|
|
247
|
+
}
|
|
209
248
|
|
|
210
249
|
// Internal method to set without queuing
|
|
211
250
|
async _setInternal(...args) {
|