@firebase/messaging
Advanced tools
Comparing version 0.2.0-canary.b6b4e2f to 0.2.0-canary.dbe5fff
@@ -28,3 +28,3 @@ import { ErrorFactory } from '@firebase/util'; | ||
*/ | ||
onDBUpgrade(db: any): void; | ||
onDBUpgrade(db: IDBDatabase, event: IDBVersionChangeEvent): void; | ||
} |
@@ -53,3 +53,3 @@ /** | ||
var db = event.target.result; | ||
_this.onDBUpgrade(db); | ||
_this.onDBUpgrade(db, event); | ||
} | ||
@@ -84,3 +84,3 @@ catch (err) { | ||
*/ | ||
DBInterface.prototype.onDBUpgrade = function (db) { | ||
DBInterface.prototype.onDBUpgrade = function (db, event) { | ||
throw this.errorFactory_.create(errors_1.default.codes.SHOULD_BE_INHERITED); | ||
@@ -87,0 +87,0 @@ }; |
import DBInterface from './db-interface'; | ||
export default class TokenDetailsModel extends DBInterface { | ||
constructor(); | ||
static readonly DB_NAME: string; | ||
onDBUpgrade(db: IDBDatabase, evt: IDBVersionChangeEvent): void; | ||
/** | ||
* @override | ||
*/ | ||
onDBUpgrade(db: any): void; | ||
/** | ||
* This method takes an object and will check for known arguments and | ||
@@ -11,0 +7,0 @@ * validate the input. |
@@ -31,4 +31,6 @@ /** | ||
var array_buffer_to_base64_1 = require("../helpers/array-buffer-to-base64"); | ||
var clean_v1_undefined_1 = require("./clean-v1-undefined"); | ||
var FCM_TOKEN_OBJ_STORE = 'fcm_token_object_Store'; | ||
var DB_VERSION = 1; | ||
var DB_NAME = 'fcm_token_details_db'; | ||
var DB_VERSION = 2; | ||
/** @record */ | ||
@@ -51,25 +53,24 @@ function ValidateInput() { } | ||
function TokenDetailsModel() { | ||
return _super.call(this, TokenDetailsModel.DB_NAME, DB_VERSION) || this; | ||
return _super.call(this, DB_NAME, DB_VERSION) || this; | ||
} | ||
Object.defineProperty(TokenDetailsModel, "DB_NAME", { | ||
get: function () { | ||
return 'fcm_token_details_db'; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* @override | ||
*/ | ||
TokenDetailsModel.prototype.onDBUpgrade = function (db) { | ||
var objectStore = db.createObjectStore(FCM_TOKEN_OBJ_STORE, { | ||
keyPath: 'swScope' | ||
}); | ||
// Make sure the sender ID can be searched | ||
objectStore.createIndex('fcmSenderId', 'fcmSenderId', { | ||
unique: false | ||
}); | ||
objectStore.createIndex('fcmToken', 'fcmToken', { | ||
unique: true | ||
}); | ||
TokenDetailsModel.prototype.onDBUpgrade = function (db, evt) { | ||
if (evt.oldVersion < 1) { | ||
// New IDB instance | ||
var objectStore = db.createObjectStore(FCM_TOKEN_OBJ_STORE, { | ||
keyPath: 'swScope' | ||
}); | ||
// Make sure the sender ID can be searched | ||
objectStore.createIndex('fcmSenderId', 'fcmSenderId', { | ||
unique: false | ||
}); | ||
objectStore.createIndex('fcmToken', 'fcmToken', { | ||
unique: true | ||
}); | ||
} | ||
if (evt.oldVersion < 2) { | ||
// Prior to version 2, we were using either 'fcm_token_details_db' | ||
// or 'undefined' as the database name due to bug in the SDK | ||
// So remove the old tokens and databases. | ||
clean_v1_undefined_1.cleanV1(); | ||
} | ||
}; | ||
@@ -76,0 +77,0 @@ /** |
import DBInterface from './db-interface'; | ||
export default class VapidDetailsModel extends DBInterface { | ||
constructor(); | ||
static readonly DB_NAME: string; | ||
/** | ||
@@ -6,0 +5,0 @@ * @override |
@@ -31,2 +31,3 @@ /** | ||
var FCM_VAPID_OBJ_STORE = 'fcm_vapid_object_Store'; | ||
var DB_NAME = 'fcm_vapid_details_db'; | ||
var DB_VERSION = 1; | ||
@@ -37,11 +38,4 @@ var UNCOMPRESSED_PUBLIC_KEY_SIZE = 65; | ||
function VapidDetailsModel() { | ||
return _super.call(this, VapidDetailsModel.DB_NAME, DB_VERSION) || this; | ||
return _super.call(this, DB_NAME, DB_VERSION) || this; | ||
} | ||
Object.defineProperty(VapidDetailsModel, "DB_NAME", { | ||
get: function () { | ||
return 'fcm_vapid_details_db'; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -48,0 +42,0 @@ * @override |
@@ -28,3 +28,3 @@ import { ErrorFactory } from '@firebase/util'; | ||
*/ | ||
onDBUpgrade(db: any): void; | ||
onDBUpgrade(db: IDBDatabase, event: IDBVersionChangeEvent): void; | ||
} |
@@ -52,3 +52,3 @@ /** | ||
var db = event.target.result; | ||
_this.onDBUpgrade(db); | ||
_this.onDBUpgrade(db, event); | ||
} | ||
@@ -83,3 +83,3 @@ catch (err) { | ||
*/ | ||
DBInterface.prototype.onDBUpgrade = function (db) { | ||
DBInterface.prototype.onDBUpgrade = function (db, event) { | ||
throw this.errorFactory_.create(Errors.codes.SHOULD_BE_INHERITED); | ||
@@ -86,0 +86,0 @@ }; |
import DBInterface from './db-interface'; | ||
export default class TokenDetailsModel extends DBInterface { | ||
constructor(); | ||
static readonly DB_NAME: string; | ||
onDBUpgrade(db: IDBDatabase, evt: IDBVersionChangeEvent): void; | ||
/** | ||
* @override | ||
*/ | ||
onDBUpgrade(db: any): void; | ||
/** | ||
* This method takes an object and will check for known arguments and | ||
@@ -11,0 +7,0 @@ * validate the input. |
@@ -30,4 +30,6 @@ /** | ||
import arrayBufferToBase64 from '../helpers/array-buffer-to-base64'; | ||
import { cleanV1 } from './clean-v1-undefined'; | ||
var FCM_TOKEN_OBJ_STORE = 'fcm_token_object_Store'; | ||
var DB_VERSION = 1; | ||
var DB_NAME = 'fcm_token_details_db'; | ||
var DB_VERSION = 2; | ||
/** @record */ | ||
@@ -50,25 +52,24 @@ function ValidateInput() { } | ||
function TokenDetailsModel() { | ||
return _super.call(this, TokenDetailsModel.DB_NAME, DB_VERSION) || this; | ||
return _super.call(this, DB_NAME, DB_VERSION) || this; | ||
} | ||
Object.defineProperty(TokenDetailsModel, "DB_NAME", { | ||
get: function () { | ||
return 'fcm_token_details_db'; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* @override | ||
*/ | ||
TokenDetailsModel.prototype.onDBUpgrade = function (db) { | ||
var objectStore = db.createObjectStore(FCM_TOKEN_OBJ_STORE, { | ||
keyPath: 'swScope' | ||
}); | ||
// Make sure the sender ID can be searched | ||
objectStore.createIndex('fcmSenderId', 'fcmSenderId', { | ||
unique: false | ||
}); | ||
objectStore.createIndex('fcmToken', 'fcmToken', { | ||
unique: true | ||
}); | ||
TokenDetailsModel.prototype.onDBUpgrade = function (db, evt) { | ||
if (evt.oldVersion < 1) { | ||
// New IDB instance | ||
var objectStore = db.createObjectStore(FCM_TOKEN_OBJ_STORE, { | ||
keyPath: 'swScope' | ||
}); | ||
// Make sure the sender ID can be searched | ||
objectStore.createIndex('fcmSenderId', 'fcmSenderId', { | ||
unique: false | ||
}); | ||
objectStore.createIndex('fcmToken', 'fcmToken', { | ||
unique: true | ||
}); | ||
} | ||
if (evt.oldVersion < 2) { | ||
// Prior to version 2, we were using either 'fcm_token_details_db' | ||
// or 'undefined' as the database name due to bug in the SDK | ||
// So remove the old tokens and databases. | ||
cleanV1(); | ||
} | ||
}; | ||
@@ -75,0 +76,0 @@ /** |
import DBInterface from './db-interface'; | ||
export default class VapidDetailsModel extends DBInterface { | ||
constructor(); | ||
static readonly DB_NAME: string; | ||
/** | ||
@@ -6,0 +5,0 @@ * @override |
@@ -30,2 +30,3 @@ /** | ||
var FCM_VAPID_OBJ_STORE = 'fcm_vapid_object_Store'; | ||
var DB_NAME = 'fcm_vapid_details_db'; | ||
var DB_VERSION = 1; | ||
@@ -36,11 +37,4 @@ var UNCOMPRESSED_PUBLIC_KEY_SIZE = 65; | ||
function VapidDetailsModel() { | ||
return _super.call(this, VapidDetailsModel.DB_NAME, DB_VERSION) || this; | ||
return _super.call(this, DB_NAME, DB_VERSION) || this; | ||
} | ||
Object.defineProperty(VapidDetailsModel, "DB_NAME", { | ||
get: function () { | ||
return 'fcm_vapid_details_db'; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -47,0 +41,0 @@ * @override |
{ | ||
"name": "@firebase/messaging", | ||
"version": "0.2.0-canary.b6b4e2f", | ||
"version": "0.2.0-canary.dbe5fff", | ||
"description": "", | ||
@@ -16,7 +16,7 @@ "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)", | ||
"peerDependencies": { | ||
"@firebase/app": "0.1.9-canary.b6b4e2f" | ||
"@firebase/app": "0.1.9-canary.dbe5fff" | ||
}, | ||
"dependencies": { | ||
"@firebase/messaging-types": "0.1.1-canary.b6b4e2f", | ||
"@firebase/util": "0.1.9-canary.b6b4e2f", | ||
"@firebase/messaging-types": "0.1.1-canary.dbe5fff", | ||
"@firebase/util": "0.1.9-canary.dbe5fff", | ||
"lcov-result-merger": "^1.2.0" | ||
@@ -23,0 +23,0 @@ }, |
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
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
483178
98
5448
+ Added@firebase/app@0.1.9-canary.dbe5fff(transitive)
+ Added@firebase/app-types@0.1.1-canary.dbe5fff(transitive)
+ Added@firebase/messaging-types@0.1.1-canary.dbe5fff(transitive)
+ Added@firebase/util@0.1.9-canary.dbe5fff(transitive)
- Removed@firebase/app@0.1.9-canary.b6b4e2f(transitive)
- Removed@firebase/app-types@0.1.1-canary.b6b4e2f(transitive)
- Removed@firebase/messaging-types@0.1.1-canary.b6b4e2f(transitive)
- Removed@firebase/util@0.1.9-canary.b6b4e2f(transitive)