@firebase/installations
Advanced tools
Comparing version
@@ -12,3 +12,3 @@ 'use strict'; | ||
var version = "0.1.3-canary.2e6c4aa"; | ||
var version = "0.1.3-canary.6045a08"; | ||
@@ -15,0 +15,0 @@ /** |
@@ -7,3 +7,3 @@ import firebase from '@firebase/app'; | ||
var version = "0.1.3-canary.2e6c4aa"; | ||
var version = "0.1.3-canary.6045a08"; | ||
@@ -10,0 +10,0 @@ /** |
@@ -5,3 +5,3 @@ import firebase from '@firebase/app'; | ||
const version = "0.1.3-canary.2e6c4aa"; | ||
const version = "0.1.3-canary.6045a08"; | ||
@@ -8,0 +8,0 @@ /** |
@@ -19,3 +19,3 @@ /** | ||
/** Gets record(s) from the objectStore that match the given key. */ | ||
export declare function get<ReturnType>(appConfig: AppConfig): Promise<ReturnType | undefined>; | ||
export declare function get(appConfig: AppConfig): Promise<unknown>; | ||
/** Assigns or overwrites the record for the given key with the given value. */ | ||
@@ -22,0 +22,0 @@ export declare function set<ValueType>(appConfig: AppConfig, value: ValueType): Promise<ValueType>; |
{ | ||
"name": "@firebase/installations", | ||
"version": "0.1.3-canary.2e6c4aa", | ||
"version": "0.1.3-canary.6045a08", | ||
"main": "dist/index.cjs.js", | ||
@@ -48,8 +48,8 @@ "module": "dist/index.esm.js", | ||
"peerDependencies": { | ||
"@firebase/app": "0.4.3-canary.2e6c4aa", | ||
"@firebase/app-types": "0.4.0-canary.2e6c4aa" | ||
"@firebase/app": "0.4.3-canary.6045a08", | ||
"@firebase/app-types": "0.4.0-canary.6045a08" | ||
}, | ||
"dependencies": { | ||
"@firebase/installations-types": "0.1.1-canary.2e6c4aa", | ||
"@firebase/util": "0.2.17-canary.2e6c4aa", | ||
"@firebase/installations-types": "0.1.1-canary.6045a08", | ||
"@firebase/util": "0.2.17-canary.6045a08", | ||
"idb": "3.0.2", | ||
@@ -56,0 +56,0 @@ "tslib": "1.9.3" |
@@ -232,14 +232,14 @@ /** | ||
const token = await getToken(app); | ||
const installationEntry = await get<RegisteredInstallationEntry>( | ||
const installationEntry = (await get( | ||
appConfig | ||
); | ||
)) as RegisteredInstallationEntry; | ||
expect(installationEntry).not.to.be.undefined; | ||
expect(installationEntry!.registrationStatus).to.equal( | ||
expect(installationEntry.registrationStatus).to.equal( | ||
RequestStatus.COMPLETED | ||
); | ||
expect(installationEntry!.authToken.requestStatus).to.equal( | ||
expect(installationEntry.authToken.requestStatus).to.equal( | ||
RequestStatus.COMPLETED | ||
); | ||
expect( | ||
(installationEntry!.authToken as CompletedAuthToken).token | ||
(installationEntry.authToken as CompletedAuthToken).token | ||
).to.equal(token); | ||
@@ -246,0 +246,0 @@ }); |
@@ -24,3 +24,2 @@ /** | ||
InProgressInstallationEntry, | ||
InstallationEntry, | ||
RegisteredInstallationEntry, | ||
@@ -74,3 +73,3 @@ RequestStatus, | ||
it('saves the InstallationEntry in the database before returning it', async () => { | ||
const oldDbEntry = await get<InstallationEntry>(appConfig); | ||
const oldDbEntry = await get(appConfig); | ||
expect(oldDbEntry).to.be.undefined; | ||
@@ -80,3 +79,3 @@ | ||
const newDbEntry = await get<InstallationEntry>(appConfig); | ||
const newDbEntry = await get(appConfig); | ||
expect(newDbEntry).to.deep.equal(installationEntry); | ||
@@ -88,3 +87,3 @@ }); | ||
const oldDbEntry = await get<InstallationEntry>(appConfig); | ||
const oldDbEntry = await get(appConfig); | ||
expect(oldDbEntry).to.be.undefined; | ||
@@ -94,3 +93,3 @@ | ||
const newDbEntry = await get<InstallationEntry>(appConfig); | ||
const newDbEntry = await get(appConfig); | ||
expect(newDbEntry).to.deep.equal(installationEntry); | ||
@@ -109,3 +108,3 @@ }); | ||
const oldDbEntry = await get<InstallationEntry>(appConfig); | ||
const oldDbEntry = await get(appConfig); | ||
expect(oldDbEntry).to.deep.equal(installationEntry); | ||
@@ -116,6 +115,4 @@ | ||
const newDbEntry = await get<InstallationEntry>(appConfig); | ||
expect(newDbEntry!.registrationStatus).to.deep.equal( | ||
RequestStatus.COMPLETED | ||
); | ||
const newDbEntry = (await get(appConfig)) as RegisteredInstallationEntry; | ||
expect(newDbEntry.registrationStatus).to.equal(RequestStatus.COMPLETED); | ||
}); | ||
@@ -143,3 +140,3 @@ | ||
const oldDbEntry = await get<InstallationEntry>(appConfig); | ||
const oldDbEntry = await get(appConfig); | ||
expect(oldDbEntry).to.deep.equal(installationEntry); | ||
@@ -150,6 +147,4 @@ | ||
const newDbEntry = await get<InstallationEntry>(appConfig); | ||
expect(newDbEntry!.registrationStatus).to.deep.equal( | ||
RequestStatus.NOT_STARTED | ||
); | ||
const newDbEntry = (await get(appConfig)) as UnregisteredInstallationEntry; | ||
expect(newDbEntry.registrationStatus).to.equal(RequestStatus.NOT_STARTED); | ||
}); | ||
@@ -176,3 +171,3 @@ | ||
const oldDbEntry = await get<InstallationEntry>(appConfig); | ||
const oldDbEntry = await get(appConfig); | ||
expect(oldDbEntry).to.deep.equal(installationEntry); | ||
@@ -183,3 +178,3 @@ | ||
const newDbEntry = await get<InstallationEntry>(appConfig); | ||
const newDbEntry = await get(appConfig); | ||
expect(newDbEntry).to.be.undefined; | ||
@@ -186,0 +181,0 @@ }); |
@@ -36,3 +36,3 @@ /** | ||
await set(appConfig1, 'value'); | ||
const value = await get<string>(appConfig1); | ||
const value = await get(appConfig1); | ||
expect(value).to.equal('value'); | ||
@@ -42,3 +42,3 @@ }); | ||
it('gets undefined for a key that does not exist', async () => { | ||
const value = await get<string>(appConfig1); | ||
const value = await get(appConfig1); | ||
expect(value).to.be.undefined; | ||
@@ -50,4 +50,4 @@ }); | ||
await set(appConfig2, 'value2'); | ||
expect(await get<string>(appConfig1)).to.equal('value'); | ||
expect(await get<string>(appConfig2)).to.equal('value2'); | ||
expect(await get(appConfig1)).to.equal('value'); | ||
expect(await get(appConfig2)).to.equal('value2'); | ||
}); | ||
@@ -58,3 +58,3 @@ | ||
await set(appConfig1, 'newValue'); | ||
expect(await get<string>(appConfig1)).to.equal('newValue'); | ||
expect(await get(appConfig1)).to.equal('newValue'); | ||
}); | ||
@@ -67,3 +67,3 @@ }); | ||
await remove(appConfig1); | ||
expect(await get<string>(appConfig1)).to.be.undefined; | ||
expect(await get(appConfig1)).to.be.undefined; | ||
}); | ||
@@ -73,3 +73,3 @@ | ||
await remove(appConfig1); | ||
expect(await get<string>(appConfig1)).to.be.undefined; | ||
expect(await get(appConfig1)).to.be.undefined; | ||
}); | ||
@@ -105,3 +105,3 @@ }); | ||
// Called immediately after update, but before update completed. | ||
const getPromise = get<string>(appConfig1); | ||
const getPromise = get(appConfig1); | ||
isGetCalled = true; | ||
@@ -132,3 +132,3 @@ | ||
// Called immediately after update, but before update completed. | ||
const getPromise = get<number>(appConfig1); | ||
const getPromise = get(appConfig1); | ||
isGetCalled = true; | ||
@@ -135,0 +135,0 @@ |
@@ -41,5 +41,3 @@ /** | ||
/** Gets record(s) from the objectStore that match the given key. */ | ||
export async function get<ReturnType>( | ||
appConfig: AppConfig | ||
): Promise<ReturnType | undefined> { | ||
export async function get(appConfig: AppConfig): Promise<unknown> { | ||
const key = getKey(appConfig); | ||
@@ -46,0 +44,0 @@ const db = await dbPromise; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
625497
-0.07%6896
-0.1%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed