Skip to content

Commit 2d3c699

Browse files
committed
Upgrade idb in installations
1 parent c271d16 commit 2d3c699

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

packages/installations-compat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"@firebase/installations-types": "0.4.0",
6262
"@firebase/util": "1.4.3",
6363
"@firebase/component": "0.5.10",
64-
"idb": "3.0.2",
64+
"idb": "7.0.0",
6565
"tslib": "^2.1.0"
6666
}
6767
}

packages/installations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"dependencies": {
6565
"@firebase/util": "1.4.3",
6666
"@firebase/component": "0.5.10",
67-
"idb": "3.0.2",
67+
"idb": "7.0.0",
6868
"tslib": "^2.1.0"
6969
}
7070
}

packages/installations/src/helpers/idb-manager.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { DB, openDb } from 'idb';
18+
import { IDBPDatabase, openDB } from 'idb';
1919
import { AppConfig } from '../interfaces/installation-impl';
2020
import { InstallationEntry } from '../interfaces/installation-entry';
2121
import { getKey } from '../util/get-key';
@@ -25,20 +25,20 @@ const DATABASE_NAME = 'firebase-installations-database';
2525
const DATABASE_VERSION = 1;
2626
const OBJECT_STORE_NAME = 'firebase-installations-store';
2727

28-
let dbPromise: Promise<DB> | null = null;
29-
function getDbPromise(): Promise<DB> {
28+
let dbPromise: Promise<IDBPDatabase> | null = null;
29+
function getDbPromise(): Promise<IDBPDatabase> {
3030
if (!dbPromise) {
31-
dbPromise = openDb(DATABASE_NAME, DATABASE_VERSION, upgradeDB => {
31+
dbPromise = openDB(DATABASE_NAME, DATABASE_VERSION, {upgrade: (db, oldVersion) => {
3232
// We don't use 'break' in this switch statement, the fall-through
3333
// behavior is what we want, because if there are multiple versions between
3434
// the old version and the current version, we want ALL the migrations
3535
// that correspond to those versions to run, not only the last one.
3636
// eslint-disable-next-line default-case
37-
switch (upgradeDB.oldVersion) {
37+
switch (oldVersion) {
3838
case 0:
39-
upgradeDB.createObjectStore(OBJECT_STORE_NAME);
39+
db.createObjectStore(OBJECT_STORE_NAME);
4040
}
41-
});
41+
}});
4242
}
4343
return dbPromise;
4444
}
@@ -66,7 +66,7 @@ export async function set<ValueType extends InstallationEntry>(
6666
const objectStore = tx.objectStore(OBJECT_STORE_NAME);
6767
const oldValue = await objectStore.get(key);
6868
await objectStore.put(value, key);
69-
await tx.complete;
69+
await tx.done;
7070

7171
if (!oldValue || oldValue.fid !== value.fid) {
7272
fidChanged(appConfig, value.fid);
@@ -81,7 +81,7 @@ export async function remove(appConfig: AppConfig): Promise<void> {
8181
const db = await getDbPromise();
8282
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
8383
await tx.objectStore(OBJECT_STORE_NAME).delete(key);
84-
await tx.complete;
84+
await tx.done;
8585
}
8686

8787
/**
@@ -106,7 +106,7 @@ export async function update<ValueType extends InstallationEntry | undefined>(
106106
} else {
107107
await store.put(newValue, key);
108108
}
109-
await tx.complete;
109+
await tx.done;
110110

111111
if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) {
112112
fidChanged(appConfig, newValue.fid);
@@ -119,5 +119,5 @@ export async function clear(): Promise<void> {
119119
const db = await getDbPromise();
120120
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
121121
await tx.objectStore(OBJECT_STORE_NAME).clear();
122-
await tx.complete;
122+
await tx.done;
123123
}

packages/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@firebase/messaging-interop-types": "0.1.0",
5252
"@firebase/util": "1.4.3",
5353
"@firebase/component": "0.5.10",
54-
"idb": "3.0.2",
54+
"idb": "7.0.0",
5555
"tslib": "^2.1.0"
5656
},
5757
"devDependencies": {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8972,10 +8972,10 @@ [email protected], iconv-lite@^0.6.2:
89728972
dependencies:
89738973
safer-buffer ">= 2.1.2 < 3.0.0"
89748974

8975-
idb@3.0.2:
8976-
version "3.0.2"
8977-
resolved "https://registry.npmjs.org/idb/-/idb-3.0.2.tgz#c8e9122d5ddd40f13b60ae665e4862f8b13fa384"
8978-
integrity sha512-+FLa/0sTXqyux0o6C+i2lOR0VoS60LU/jzUo5xjfY6+7sEEgy4Gz1O7yFBXvjd7N0NyIGWIRg8DcQSLEG+VSPw==
8975+
idb@7.0.0:
8976+
version "7.0.0"
8977+
resolved "https://registry.npmjs.org/idb/-/idb-7.0.0.tgz#f349b418c128f625961147a7d6b0e4b526fd34ed"
8978+
integrity sha512-jSx0WOY9Nj+QzP6wX5e7g64jqh8ExtDs/IAuOrOEZCD/h6+0HqyrKsDMfdJc0hqhSvh0LsrwqrkDn+EtjjzSRA==
89798979

89808980
ieee754@^1.1.13, ieee754@^1.1.4:
89818981
version "1.2.1"

0 commit comments

Comments
 (0)