Call establishment improvements.
1. More orderly offer-answer exchange sequence. 2. Cache remote ICE candidates that arrive before call establishment is complete (we use trickle ICE).
This commit is contained in:
@@ -32,22 +32,29 @@ class CallPanel extends React.PureComponent {
|
|||||||
pc: undefined,
|
pc: undefined,
|
||||||
|
|
||||||
previousOnInfo: undefined,
|
previousOnInfo: undefined,
|
||||||
waitingForPeer: false
|
waitingForPeer: false,
|
||||||
|
// If true, the client has received a remote SDP from the peer and has sent a local SDP to the peer.
|
||||||
|
callInitialSetupComplete: false
|
||||||
};
|
};
|
||||||
|
|
||||||
this.localStreamConstraints = {
|
this.localStreamConstraints = {
|
||||||
audio: true,
|
audio: true,
|
||||||
video: true
|
video: true
|
||||||
};
|
};
|
||||||
|
this.isOutgoingCall = props.callState == CALL_STATE_OUTGOING_INITATED;
|
||||||
|
|
||||||
this.localRef = React.createRef();
|
this.localRef = React.createRef();
|
||||||
this.remoteRef = React.createRef();
|
this.remoteRef = React.createRef();
|
||||||
|
// Cache for remote ice candidates until initial setup gets completed.
|
||||||
|
this.remoteIceCandidatesCache = [];
|
||||||
|
|
||||||
this.onInfo = this.onInfo.bind(this);
|
this.onInfo = this.onInfo.bind(this);
|
||||||
this.start = this.start.bind(this);
|
this.start = this.start.bind(this);
|
||||||
this.stop = this.stop.bind(this);
|
this.stop = this.stop.bind(this);
|
||||||
|
|
||||||
this.createPeerConnection = this.createPeerConnection.bind(this);
|
this.createPeerConnection = this.createPeerConnection.bind(this);
|
||||||
|
this.canSendOffer = this.canSendOffer.bind(this);
|
||||||
|
this.drainRemoteIceCandidatesCache = this.drainRemoteIceCandidatesCache.bind(this);
|
||||||
|
|
||||||
this.handleNegotiationNeededEvent = this.handleNegotiationNeededEvent.bind(this);
|
this.handleNegotiationNeededEvent = this.handleNegotiationNeededEvent.bind(this);
|
||||||
this.handleICECandidateEvent = this.handleICECandidateEvent.bind(this);
|
this.handleICECandidateEvent = this.handleICECandidateEvent.bind(this);
|
||||||
@@ -219,14 +226,25 @@ class CallPanel extends React.PureComponent {
|
|||||||
// Configure the remote description, which is the SDP payload
|
// Configure the remote description, which is the SDP payload
|
||||||
// in 'info' message.
|
// in 'info' message.
|
||||||
const desc = new RTCSessionDescription(info.payload);
|
const desc = new RTCSessionDescription(info.payload);
|
||||||
this.state.pc.setRemoteDescription(desc).catch(this.reportError);
|
this.state.pc.setRemoteDescription(desc)
|
||||||
|
.then(_ => {
|
||||||
|
this.setState({ callInitialSetupComplete: true }, () => this.drainRemoteIceCandidatesCache());
|
||||||
|
})
|
||||||
|
.catch(this.reportError);
|
||||||
}
|
}
|
||||||
|
|
||||||
reportError(err) {
|
reportError(err) {
|
||||||
this.props.onError(err.message, 'err');
|
this.props.onError(err.message, 'err');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canSendOffer() {
|
||||||
|
return this.isOutgoingCall || this.state.callInitialSetupComplete;
|
||||||
|
}
|
||||||
|
|
||||||
handleNegotiationNeededEvent() {
|
handleNegotiationNeededEvent() {
|
||||||
|
if (!this.canSendOffer()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.state.pc.createOffer().then(offer => {
|
this.state.pc.createOffer().then(offer => {
|
||||||
return this.state.pc.setLocalDescription(offer);
|
return this.state.pc.setLocalDescription(offer);
|
||||||
})
|
})
|
||||||
@@ -244,8 +262,20 @@ class CallPanel extends React.PureComponent {
|
|||||||
|
|
||||||
handleNewICECandidateMsg(info) {
|
handleNewICECandidateMsg(info) {
|
||||||
const candidate = new RTCIceCandidate(info.payload);
|
const candidate = new RTCIceCandidate(info.payload);
|
||||||
|
if (this.state.callInitialSetupComplete) {
|
||||||
this.state.pc.addIceCandidate(candidate)
|
this.state.pc.addIceCandidate(candidate)
|
||||||
.catch(this.reportError);
|
.catch(this.reportError);
|
||||||
|
} else {
|
||||||
|
this.remoteIceCandidatesCache.push(candidate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drainRemoteIceCandidatesCache() {
|
||||||
|
this.remoteIceCandidatesCache.forEach(candidate => {
|
||||||
|
this.state.pc.addIceCandidate(candidate)
|
||||||
|
.catch(this.reportError);
|
||||||
|
});
|
||||||
|
this.remoteIceCandidatesCache = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
handleICEConnectionStateChangeEvent(event) {
|
handleICEConnectionStateChangeEvent(event) {
|
||||||
@@ -320,6 +350,7 @@ class CallPanel extends React.PureComponent {
|
|||||||
})
|
})
|
||||||
.then(_ => {
|
.then(_ => {
|
||||||
this.props.onSendAnswer(this.props.topic, this.props.seq, pc.localDescription.toJSON());
|
this.props.onSendAnswer(this.props.topic, this.props.seq, pc.localDescription.toJSON());
|
||||||
|
this.setState({ callInitialSetupComplete: true }, () => this.drainRemoteIceCandidatesCache());
|
||||||
})
|
})
|
||||||
.catch(this.handleGetUserMediaError);
|
.catch(this.handleGetUserMediaError);
|
||||||
}
|
}
|
||||||
|
|||||||
+233
-373
@@ -11,6 +11,7 @@
|
|||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "CONSTANTS": () => (/* binding */ CONSTANTS),
|
/* harmony export */ "CONSTANTS": () => (/* binding */ CONSTANTS),
|
||||||
|
/* harmony export */ "DBWrapper": () => (/* binding */ DBWrapper),
|
||||||
/* harmony export */ "Deferred": () => (/* binding */ Deferred),
|
/* harmony export */ "Deferred": () => (/* binding */ Deferred),
|
||||||
/* harmony export */ "ErrorFactory": () => (/* binding */ ErrorFactory),
|
/* harmony export */ "ErrorFactory": () => (/* binding */ ErrorFactory),
|
||||||
/* harmony export */ "FirebaseError": () => (/* binding */ FirebaseError),
|
/* harmony export */ "FirebaseError": () => (/* binding */ FirebaseError),
|
||||||
@@ -33,6 +34,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export */ "deepCopy": () => (/* binding */ deepCopy),
|
/* harmony export */ "deepCopy": () => (/* binding */ deepCopy),
|
||||||
/* harmony export */ "deepEqual": () => (/* binding */ deepEqual),
|
/* harmony export */ "deepEqual": () => (/* binding */ deepEqual),
|
||||||
/* harmony export */ "deepExtend": () => (/* binding */ deepExtend),
|
/* harmony export */ "deepExtend": () => (/* binding */ deepExtend),
|
||||||
|
/* harmony export */ "deleteDB": () => (/* binding */ deleteDB),
|
||||||
/* harmony export */ "errorPrefix": () => (/* binding */ errorPrefix),
|
/* harmony export */ "errorPrefix": () => (/* binding */ errorPrefix),
|
||||||
/* harmony export */ "extractQuerystring": () => (/* binding */ extractQuerystring),
|
/* harmony export */ "extractQuerystring": () => (/* binding */ extractQuerystring),
|
||||||
/* harmony export */ "getGlobal": () => (/* binding */ getGlobal),
|
/* harmony export */ "getGlobal": () => (/* binding */ getGlobal),
|
||||||
@@ -56,6 +58,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export */ "issuedAtTime": () => (/* binding */ issuedAtTime),
|
/* harmony export */ "issuedAtTime": () => (/* binding */ issuedAtTime),
|
||||||
/* harmony export */ "jsonEval": () => (/* binding */ jsonEval),
|
/* harmony export */ "jsonEval": () => (/* binding */ jsonEval),
|
||||||
/* harmony export */ "map": () => (/* binding */ map),
|
/* harmony export */ "map": () => (/* binding */ map),
|
||||||
|
/* harmony export */ "openDB": () => (/* binding */ openDB),
|
||||||
/* harmony export */ "ordinal": () => (/* binding */ ordinal),
|
/* harmony export */ "ordinal": () => (/* binding */ ordinal),
|
||||||
/* harmony export */ "querystring": () => (/* binding */ querystring),
|
/* harmony export */ "querystring": () => (/* binding */ querystring),
|
||||||
/* harmony export */ "querystringDecode": () => (/* binding */ querystringDecode),
|
/* harmony export */ "querystringDecode": () => (/* binding */ querystringDecode),
|
||||||
@@ -1966,6 +1969,162 @@ function getModularInstance(service) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright 2022 Google LLC
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
function promisifyRequest(request, errorMessage) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request.onsuccess = event => {
|
||||||
|
resolve(event.target.result);
|
||||||
|
};
|
||||||
|
request.onerror = event => {
|
||||||
|
var _a;
|
||||||
|
reject(`${errorMessage}: ${(_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message}`);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
class DBWrapper {
|
||||||
|
constructor(_db) {
|
||||||
|
this._db = _db;
|
||||||
|
this.objectStoreNames = this._db.objectStoreNames;
|
||||||
|
}
|
||||||
|
transaction(storeNames, mode = 'readonly') {
|
||||||
|
return new TransactionWrapper(this._db.transaction.call(this._db, storeNames, mode));
|
||||||
|
}
|
||||||
|
createObjectStore(storeName, options) {
|
||||||
|
return new ObjectStoreWrapper(this._db.createObjectStore(storeName, options));
|
||||||
|
}
|
||||||
|
close() {
|
||||||
|
this._db.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
class TransactionWrapper {
|
||||||
|
constructor(_transaction) {
|
||||||
|
this._transaction = _transaction;
|
||||||
|
this.complete = new Promise((resolve, reject) => {
|
||||||
|
this._transaction.oncomplete = function () {
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
this._transaction.onerror = () => {
|
||||||
|
reject(this._transaction.error);
|
||||||
|
};
|
||||||
|
this._transaction.onabort = () => {
|
||||||
|
reject(this._transaction.error);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
objectStore(storeName) {
|
||||||
|
return new ObjectStoreWrapper(this._transaction.objectStore(storeName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
class ObjectStoreWrapper {
|
||||||
|
constructor(_store) {
|
||||||
|
this._store = _store;
|
||||||
|
}
|
||||||
|
index(name) {
|
||||||
|
return new IndexWrapper(this._store.index(name));
|
||||||
|
}
|
||||||
|
createIndex(name, keypath, options) {
|
||||||
|
return new IndexWrapper(this._store.createIndex(name, keypath, options));
|
||||||
|
}
|
||||||
|
get(key) {
|
||||||
|
const request = this._store.get(key);
|
||||||
|
return promisifyRequest(request, 'Error reading from IndexedDB');
|
||||||
|
}
|
||||||
|
put(value, key) {
|
||||||
|
const request = this._store.put(value, key);
|
||||||
|
return promisifyRequest(request, 'Error writing to IndexedDB');
|
||||||
|
}
|
||||||
|
delete(key) {
|
||||||
|
const request = this._store.delete(key);
|
||||||
|
return promisifyRequest(request, 'Error deleting from IndexedDB');
|
||||||
|
}
|
||||||
|
clear() {
|
||||||
|
const request = this._store.clear();
|
||||||
|
return promisifyRequest(request, 'Error clearing IndexedDB object store');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
class IndexWrapper {
|
||||||
|
constructor(_index) {
|
||||||
|
this._index = _index;
|
||||||
|
}
|
||||||
|
get(key) {
|
||||||
|
const request = this._index.get(key);
|
||||||
|
return promisifyRequest(request, 'Error reading from IndexedDB');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
function openDB(dbName, dbVersion, upgradeCallback) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const request = indexedDB.open(dbName, dbVersion);
|
||||||
|
request.onsuccess = event => {
|
||||||
|
resolve(new DBWrapper(event.target.result));
|
||||||
|
};
|
||||||
|
request.onerror = event => {
|
||||||
|
var _a;
|
||||||
|
reject(`Error opening indexedDB: ${(_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message}`);
|
||||||
|
};
|
||||||
|
request.onupgradeneeded = event => {
|
||||||
|
upgradeCallback(new DBWrapper(request.result), event.oldVersion, event.newVersion, new TransactionWrapper(request.transaction));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
reject(`Error opening indexedDB: ${e.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
async function deleteDB(dbName) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
try {
|
||||||
|
const request = indexedDB.deleteDatabase(dbName);
|
||||||
|
request.onsuccess = () => {
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
request.onerror = event => {
|
||||||
|
var _a;
|
||||||
|
reject(`Error deleting indexedDB database "${dbName}": ${(_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message}`);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
reject(`Error deleting indexedDB database "${dbName}": ${e.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//# sourceMappingURL=index.esm2017.js.map
|
//# sourceMappingURL=index.esm2017.js.map
|
||||||
|
|
||||||
@@ -11205,18 +11364,23 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
|||||||
localStream: undefined,
|
localStream: undefined,
|
||||||
pc: undefined,
|
pc: undefined,
|
||||||
previousOnInfo: undefined,
|
previousOnInfo: undefined,
|
||||||
waitingForPeer: false
|
waitingForPeer: false,
|
||||||
|
callInitialSetupComplete: false
|
||||||
};
|
};
|
||||||
this.localStreamConstraints = {
|
this.localStreamConstraints = {
|
||||||
audio: true,
|
audio: true,
|
||||||
video: true
|
video: true
|
||||||
};
|
};
|
||||||
|
this.isOutgoingCall = props.callState == _constants_js__WEBPACK_IMPORTED_MODULE_4__.CALL_STATE_OUTGOING_INITATED;
|
||||||
this.localRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
|
this.localRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
|
||||||
this.remoteRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
|
this.remoteRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
|
||||||
|
this.remoteIceCandidatesCache = [];
|
||||||
this.onInfo = this.onInfo.bind(this);
|
this.onInfo = this.onInfo.bind(this);
|
||||||
this.start = this.start.bind(this);
|
this.start = this.start.bind(this);
|
||||||
this.stop = this.stop.bind(this);
|
this.stop = this.stop.bind(this);
|
||||||
this.createPeerConnection = this.createPeerConnection.bind(this);
|
this.createPeerConnection = this.createPeerConnection.bind(this);
|
||||||
|
this.canSendOffer = this.canSendOffer.bind(this);
|
||||||
|
this.drainRemoteIceCandidatesCache = this.drainRemoteIceCandidatesCache.bind(this);
|
||||||
this.handleNegotiationNeededEvent = this.handleNegotiationNeededEvent.bind(this);
|
this.handleNegotiationNeededEvent = this.handleNegotiationNeededEvent.bind(this);
|
||||||
this.handleICECandidateEvent = this.handleICECandidateEvent.bind(this);
|
this.handleICECandidateEvent = this.handleICECandidateEvent.bind(this);
|
||||||
this.handleNewICECandidateMsg = this.handleNewICECandidateMsg.bind(this);
|
this.handleNewICECandidateMsg = this.handleNewICECandidateMsg.bind(this);
|
||||||
@@ -11391,14 +11555,26 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
|||||||
|
|
||||||
handleVideoAnswerMsg(info) {
|
handleVideoAnswerMsg(info) {
|
||||||
const desc = new RTCSessionDescription(info.payload);
|
const desc = new RTCSessionDescription(info.payload);
|
||||||
this.state.pc.setRemoteDescription(desc).catch(this.reportError);
|
this.state.pc.setRemoteDescription(desc).then(_ => {
|
||||||
|
this.setState({
|
||||||
|
callInitialSetupComplete: true
|
||||||
|
}, () => this.drainRemoteIceCandidatesCache());
|
||||||
|
}).catch(this.reportError);
|
||||||
}
|
}
|
||||||
|
|
||||||
reportError(err) {
|
reportError(err) {
|
||||||
this.props.onError(err.message, 'err');
|
this.props.onError(err.message, 'err');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canSendOffer() {
|
||||||
|
return this.isOutgoingCall || this.state.callInitialSetupComplete;
|
||||||
|
}
|
||||||
|
|
||||||
handleNegotiationNeededEvent() {
|
handleNegotiationNeededEvent() {
|
||||||
|
if (!this.canSendOffer()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.state.pc.createOffer().then(offer => {
|
this.state.pc.createOffer().then(offer => {
|
||||||
return this.state.pc.setLocalDescription(offer);
|
return this.state.pc.setLocalDescription(offer);
|
||||||
}).then(_ => {
|
}).then(_ => {
|
||||||
@@ -11414,7 +11590,19 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
|||||||
|
|
||||||
handleNewICECandidateMsg(info) {
|
handleNewICECandidateMsg(info) {
|
||||||
const candidate = new RTCIceCandidate(info.payload);
|
const candidate = new RTCIceCandidate(info.payload);
|
||||||
|
|
||||||
|
if (this.state.callInitialSetupComplete) {
|
||||||
this.state.pc.addIceCandidate(candidate).catch(this.reportError);
|
this.state.pc.addIceCandidate(candidate).catch(this.reportError);
|
||||||
|
} else {
|
||||||
|
this.remoteIceCandidatesCache.push(candidate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drainRemoteIceCandidatesCache() {
|
||||||
|
this.remoteIceCandidatesCache.forEach(candidate => {
|
||||||
|
this.state.pc.addIceCandidate(candidate).catch(this.reportError);
|
||||||
|
});
|
||||||
|
this.remoteIceCandidatesCache = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
handleICEConnectionStateChangeEvent(event) {
|
handleICEConnectionStateChangeEvent(event) {
|
||||||
@@ -11479,6 +11667,9 @@ class CallPanel extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCompon
|
|||||||
return pc.setLocalDescription(answer);
|
return pc.setLocalDescription(answer);
|
||||||
}).then(_ => {
|
}).then(_ => {
|
||||||
this.props.onSendAnswer(this.props.topic, this.props.seq, pc.localDescription.toJSON());
|
this.props.onSendAnswer(this.props.topic, this.props.seq, pc.localDescription.toJSON());
|
||||||
|
this.setState({
|
||||||
|
callInitialSetupComplete: true
|
||||||
|
}, () => this.drainRemoteIceCandidatesCache());
|
||||||
}).catch(this.handleGetUserMediaError);
|
}).catch(this.handleGetUserMediaError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11676,7 +11867,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _received_marker_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./received-marker.jsx */ "./src/widgets/received-marker.jsx");
|
/* harmony import */ var _received_marker_jsx__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./received-marker.jsx */ "./src/widgets/received-marker.jsx");
|
||||||
/* harmony import */ var _lib_formatters_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib/formatters.js */ "./src/lib/formatters.js");
|
/* harmony import */ var _lib_formatters_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib/formatters.js */ "./src/lib/formatters.js");
|
||||||
/* harmony import */ var _lib_utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../lib/utils.js */ "./src/lib/utils.js");
|
/* harmony import */ var _lib_utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../lib/utils.js */ "./src/lib/utils.js");
|
||||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -17383,7 +17574,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
|
|
||||||
|
|
||||||
var name = "firebase";
|
var name = "firebase";
|
||||||
var version = "9.8.3";
|
var version = "9.6.11";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -18027,8 +18218,6 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js");
|
/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js");
|
||||||
/* harmony import */ var _firebase_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/logger */ "./node_modules/@firebase/logger/dist/esm/index.esm2017.js");
|
/* harmony import */ var _firebase_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/logger */ "./node_modules/@firebase/logger/dist/esm/index.esm2017.js");
|
||||||
/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js");
|
/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js");
|
||||||
/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! idb */ "./node_modules/idb/build/index.js");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -18088,7 +18277,7 @@ function isVersionServiceProvider(provider) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const name$o = "@firebase/app";
|
const name$o = "@firebase/app";
|
||||||
const version$1 = "0.7.26";
|
const version$1 = "0.7.21";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -18155,7 +18344,7 @@ const name$2 = "@firebase/firestore";
|
|||||||
const name$1 = "@firebase/firestore-compat";
|
const name$1 = "@firebase/firestore-compat";
|
||||||
|
|
||||||
const name = "firebase";
|
const name = "firebase";
|
||||||
const version = "9.8.3";
|
const version = "9.6.11";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -18619,8 +18808,7 @@ const STORE_NAME = 'firebase-heartbeat-store';
|
|||||||
let dbPromise = null;
|
let dbPromise = null;
|
||||||
function getDbPromise() {
|
function getDbPromise() {
|
||||||
if (!dbPromise) {
|
if (!dbPromise) {
|
||||||
dbPromise = (0,idb__WEBPACK_IMPORTED_MODULE_3__.openDB)(DB_NAME, DB_VERSION, {
|
dbPromise = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.openDB)(DB_NAME, DB_VERSION, (db, oldVersion) => {
|
||||||
upgrade: (db, oldVersion) => {
|
|
||||||
// We don't use 'break' in this switch statement, the fall-through
|
// We don't use 'break' in this switch statement, the fall-through
|
||||||
// behavior is what we want, because if there are multiple versions between
|
// behavior is what we want, because if there are multiple versions between
|
||||||
// the old version and the current version, we want ALL the migrations
|
// the old version and the current version, we want ALL the migrations
|
||||||
@@ -18630,7 +18818,6 @@ function getDbPromise() {
|
|||||||
case 0:
|
case 0:
|
||||||
db.createObjectStore(STORE_NAME);
|
db.createObjectStore(STORE_NAME);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
throw ERROR_FACTORY.create("storage-open" /* STORAGE_OPEN */, {
|
throw ERROR_FACTORY.create("storage-open" /* STORAGE_OPEN */, {
|
||||||
originalErrorMessage: e.message
|
originalErrorMessage: e.message
|
||||||
@@ -18640,7 +18827,6 @@ function getDbPromise() {
|
|||||||
return dbPromise;
|
return dbPromise;
|
||||||
}
|
}
|
||||||
async function readHeartbeatsFromIndexedDB(app) {
|
async function readHeartbeatsFromIndexedDB(app) {
|
||||||
var _a;
|
|
||||||
try {
|
try {
|
||||||
const db = await getDbPromise();
|
const db = await getDbPromise();
|
||||||
return db
|
return db
|
||||||
@@ -18650,22 +18836,21 @@ async function readHeartbeatsFromIndexedDB(app) {
|
|||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
throw ERROR_FACTORY.create("storage-get" /* STORAGE_GET */, {
|
throw ERROR_FACTORY.create("storage-get" /* STORAGE_GET */, {
|
||||||
originalErrorMessage: (_a = e) === null || _a === void 0 ? void 0 : _a.message
|
originalErrorMessage: e.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
|
async function writeHeartbeatsToIndexedDB(app, heartbeatObject) {
|
||||||
var _a;
|
|
||||||
try {
|
try {
|
||||||
const db = await getDbPromise();
|
const db = await getDbPromise();
|
||||||
const tx = db.transaction(STORE_NAME, 'readwrite');
|
const tx = db.transaction(STORE_NAME, 'readwrite');
|
||||||
const objectStore = tx.objectStore(STORE_NAME);
|
const objectStore = tx.objectStore(STORE_NAME);
|
||||||
await objectStore.put(heartbeatObject, computeKey(app));
|
await objectStore.put(heartbeatObject, computeKey(app));
|
||||||
return tx.done;
|
return tx.complete;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
throw ERROR_FACTORY.create("storage-set" /* STORAGE_WRITE */, {
|
throw ERROR_FACTORY.create("storage-set" /* STORAGE_WRITE */, {
|
||||||
originalErrorMessage: (_a = e) === null || _a === void 0 ? void 0 : _a.message
|
originalErrorMessage: e.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19391,14 +19576,12 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js");
|
/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js");
|
||||||
/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js");
|
/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js");
|
||||||
/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js");
|
/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js");
|
||||||
/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! idb */ "./node_modules/idb/build/index.js");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const name = "@firebase/installations";
|
const name = "@firebase/installations";
|
||||||
const version = "0.5.10";
|
const version = "0.5.8";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -19800,8 +19983,7 @@ const OBJECT_STORE_NAME = 'firebase-installations-store';
|
|||||||
let dbPromise = null;
|
let dbPromise = null;
|
||||||
function getDbPromise() {
|
function getDbPromise() {
|
||||||
if (!dbPromise) {
|
if (!dbPromise) {
|
||||||
dbPromise = (0,idb__WEBPACK_IMPORTED_MODULE_3__.openDB)(DATABASE_NAME, DATABASE_VERSION, {
|
dbPromise = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.openDB)(DATABASE_NAME, DATABASE_VERSION, (db, oldVersion) => {
|
||||||
upgrade: (db, oldVersion) => {
|
|
||||||
// We don't use 'break' in this switch statement, the fall-through
|
// We don't use 'break' in this switch statement, the fall-through
|
||||||
// behavior is what we want, because if there are multiple versions between
|
// behavior is what we want, because if there are multiple versions between
|
||||||
// the old version and the current version, we want ALL the migrations
|
// the old version and the current version, we want ALL the migrations
|
||||||
@@ -19811,7 +19993,6 @@ function getDbPromise() {
|
|||||||
case 0:
|
case 0:
|
||||||
db.createObjectStore(OBJECT_STORE_NAME);
|
db.createObjectStore(OBJECT_STORE_NAME);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return dbPromise;
|
return dbPromise;
|
||||||
@@ -19824,7 +20005,7 @@ async function set(appConfig, value) {
|
|||||||
const objectStore = tx.objectStore(OBJECT_STORE_NAME);
|
const objectStore = tx.objectStore(OBJECT_STORE_NAME);
|
||||||
const oldValue = (await objectStore.get(key));
|
const oldValue = (await objectStore.get(key));
|
||||||
await objectStore.put(value, key);
|
await objectStore.put(value, key);
|
||||||
await tx.done;
|
await tx.complete;
|
||||||
if (!oldValue || oldValue.fid !== value.fid) {
|
if (!oldValue || oldValue.fid !== value.fid) {
|
||||||
fidChanged(appConfig, value.fid);
|
fidChanged(appConfig, value.fid);
|
||||||
}
|
}
|
||||||
@@ -19836,7 +20017,7 @@ async function remove(appConfig) {
|
|||||||
const db = await getDbPromise();
|
const db = await getDbPromise();
|
||||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||||
await tx.objectStore(OBJECT_STORE_NAME).delete(key);
|
await tx.objectStore(OBJECT_STORE_NAME).delete(key);
|
||||||
await tx.done;
|
await tx.complete;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Atomically updates a record with the result of updateFn, which gets
|
* Atomically updates a record with the result of updateFn, which gets
|
||||||
@@ -19857,7 +20038,7 @@ async function update(appConfig, updateFn) {
|
|||||||
else {
|
else {
|
||||||
await store.put(newValue, key);
|
await store.put(newValue, key);
|
||||||
}
|
}
|
||||||
await tx.done;
|
await tx.complete;
|
||||||
if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) {
|
if (newValue && (!oldValue || oldValue.fid !== newValue.fid)) {
|
||||||
fidChanged(appConfig, newValue.fid);
|
fidChanged(appConfig, newValue.fid);
|
||||||
}
|
}
|
||||||
@@ -20804,10 +20985,8 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export */ });
|
/* harmony export */ });
|
||||||
/* harmony import */ var _firebase_installations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/installations */ "./node_modules/@firebase/installations/dist/esm/index.esm2017.js");
|
/* harmony import */ var _firebase_installations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @firebase/installations */ "./node_modules/@firebase/installations/dist/esm/index.esm2017.js");
|
||||||
/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js");
|
/* harmony import */ var _firebase_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @firebase/component */ "./node_modules/@firebase/component/dist/esm/index.esm2017.js");
|
||||||
/* harmony import */ var idb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! idb */ "./node_modules/idb/build/index.js");
|
/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js");
|
||||||
/* harmony import */ var _firebase_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @firebase/util */ "./node_modules/@firebase/util/dist/index.esm2017.js");
|
/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js");
|
||||||
/* harmony import */ var _firebase_app__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @firebase/app */ "./node_modules/@firebase/app/dist/esm/index.esm2017.js");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -20933,8 +21112,7 @@ async function migrateOldDatabase(senderId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let tokenDetails = null;
|
let tokenDetails = null;
|
||||||
const db = await (0,idb__WEBPACK_IMPORTED_MODULE_2__.openDB)(OLD_DB_NAME, OLD_DB_VERSION, {
|
const db = await (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.openDB)(OLD_DB_NAME, OLD_DB_VERSION, async (db, oldVersion, newVersion, upgradeTransaction) => {
|
||||||
upgrade: async (db, oldVersion, newVersion, upgradeTransaction) => {
|
|
||||||
var _a;
|
var _a;
|
||||||
if (oldVersion < 2) {
|
if (oldVersion < 2) {
|
||||||
// Database too old, skip migration.
|
// Database too old, skip migration.
|
||||||
@@ -20998,13 +21176,12 @@ async function migrateOldDatabase(senderId) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
db.close();
|
db.close();
|
||||||
// Delete all old databases.
|
// Delete all old databases.
|
||||||
await (0,idb__WEBPACK_IMPORTED_MODULE_2__.deleteDB)(OLD_DB_NAME);
|
await (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.deleteDB)(OLD_DB_NAME);
|
||||||
await (0,idb__WEBPACK_IMPORTED_MODULE_2__.deleteDB)('fcm_vapid_details_db');
|
await (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.deleteDB)('fcm_vapid_details_db');
|
||||||
await (0,idb__WEBPACK_IMPORTED_MODULE_2__.deleteDB)('undefined');
|
await (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.deleteDB)('undefined');
|
||||||
return checkTokenDetails(tokenDetails) ? tokenDetails : null;
|
return checkTokenDetails(tokenDetails) ? tokenDetails : null;
|
||||||
}
|
}
|
||||||
function checkTokenDetails(tokenDetails) {
|
function checkTokenDetails(tokenDetails) {
|
||||||
@@ -21051,8 +21228,7 @@ const OBJECT_STORE_NAME = 'firebase-messaging-store';
|
|||||||
let dbPromise = null;
|
let dbPromise = null;
|
||||||
function getDbPromise() {
|
function getDbPromise() {
|
||||||
if (!dbPromise) {
|
if (!dbPromise) {
|
||||||
dbPromise = (0,idb__WEBPACK_IMPORTED_MODULE_2__.openDB)(DATABASE_NAME, DATABASE_VERSION, {
|
dbPromise = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.openDB)(DATABASE_NAME, DATABASE_VERSION, (upgradeDb, oldVersion) => {
|
||||||
upgrade: (upgradeDb, oldVersion) => {
|
|
||||||
// We don't use 'break' in this switch statement, the fall-through behavior is what we want,
|
// We don't use 'break' in this switch statement, the fall-through behavior is what we want,
|
||||||
// because if there are multiple versions between the old version and the current version, we
|
// because if there are multiple versions between the old version and the current version, we
|
||||||
// want ALL the migrations that correspond to those versions to run, not only the last one.
|
// want ALL the migrations that correspond to those versions to run, not only the last one.
|
||||||
@@ -21061,7 +21237,6 @@ function getDbPromise() {
|
|||||||
case 0:
|
case 0:
|
||||||
upgradeDb.createObjectStore(OBJECT_STORE_NAME);
|
upgradeDb.createObjectStore(OBJECT_STORE_NAME);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return dbPromise;
|
return dbPromise;
|
||||||
@@ -21092,7 +21267,7 @@ async function dbSet(firebaseDependencies, tokenDetails) {
|
|||||||
const db = await getDbPromise();
|
const db = await getDbPromise();
|
||||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||||
await tx.objectStore(OBJECT_STORE_NAME).put(tokenDetails, key);
|
await tx.objectStore(OBJECT_STORE_NAME).put(tokenDetails, key);
|
||||||
await tx.done;
|
await tx.complete;
|
||||||
return tokenDetails;
|
return tokenDetails;
|
||||||
}
|
}
|
||||||
/** Removes record(s) from the objectStore that match the given key. */
|
/** Removes record(s) from the objectStore that match the given key. */
|
||||||
@@ -21101,7 +21276,7 @@ async function dbRemove(firebaseDependencies) {
|
|||||||
const db = await getDbPromise();
|
const db = await getDbPromise();
|
||||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||||
await tx.objectStore(OBJECT_STORE_NAME).delete(key);
|
await tx.objectStore(OBJECT_STORE_NAME).delete(key);
|
||||||
await tx.done;
|
await tx.complete;
|
||||||
}
|
}
|
||||||
function getKey({ appConfig }) {
|
function getKey({ appConfig }) {
|
||||||
return appConfig.appId;
|
return appConfig.appId;
|
||||||
@@ -21146,7 +21321,7 @@ const ERROR_MAP = {
|
|||||||
["use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */]: 'The usePublicVapidKey() method may only be called once and must be ' +
|
["use-vapid-key-after-get-token" /* USE_VAPID_KEY_AFTER_GET_TOKEN */]: 'The usePublicVapidKey() method may only be called once and must be ' +
|
||||||
'called before calling getToken() to ensure your VAPID key is used.'
|
'called before calling getToken() to ensure your VAPID key is used.'
|
||||||
};
|
};
|
||||||
const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_3__.ErrorFactory('messaging', 'Messaging', ERROR_MAP);
|
const ERROR_FACTORY = new _firebase_util__WEBPACK_IMPORTED_MODULE_2__.ErrorFactory('messaging', 'Messaging', ERROR_MAP);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -21446,19 +21621,16 @@ function propagateDataPayload(payload, messagePayloadInternal) {
|
|||||||
payload.data = messagePayloadInternal.data;
|
payload.data = messagePayloadInternal.data;
|
||||||
}
|
}
|
||||||
function propagateFcmOptions(payload, messagePayloadInternal) {
|
function propagateFcmOptions(payload, messagePayloadInternal) {
|
||||||
var _a, _b, _c, _d, _e;
|
if (!messagePayloadInternal.fcmOptions) {
|
||||||
// fcmOptions.link value is written into notification.click_action. see more in b/232072111
|
|
||||||
if (!messagePayloadInternal.fcmOptions &&
|
|
||||||
!((_a = messagePayloadInternal.notification) === null || _a === void 0 ? void 0 : _a.click_action)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
payload.fcmOptions = {};
|
payload.fcmOptions = {};
|
||||||
const link = (_c = (_b = messagePayloadInternal.fcmOptions) === null || _b === void 0 ? void 0 : _b.link) !== null && _c !== void 0 ? _c : (_d = messagePayloadInternal.notification) === null || _d === void 0 ? void 0 : _d.click_action;
|
const link = messagePayloadInternal.fcmOptions.link;
|
||||||
if (!!link) {
|
if (!!link) {
|
||||||
payload.fcmOptions.link = link;
|
payload.fcmOptions.link = link;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
const analyticsLabel = (_e = messagePayloadInternal.fcmOptions) === null || _e === void 0 ? void 0 : _e.analytics_label;
|
const analyticsLabel = messagePayloadInternal.fcmOptions.analytics_label;
|
||||||
if (!!analyticsLabel) {
|
if (!!analyticsLabel) {
|
||||||
payload.fcmOptions.analyticsLabel = analyticsLabel;
|
payload.fcmOptions.analyticsLabel = analyticsLabel;
|
||||||
}
|
}
|
||||||
@@ -21618,7 +21790,6 @@ class MessagingService {
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
async function registerDefaultSw(messaging) {
|
async function registerDefaultSw(messaging) {
|
||||||
var _a;
|
|
||||||
try {
|
try {
|
||||||
messaging.swRegistration = await navigator.serviceWorker.register(DEFAULT_SW_PATH, {
|
messaging.swRegistration = await navigator.serviceWorker.register(DEFAULT_SW_PATH, {
|
||||||
scope: DEFAULT_SW_SCOPE
|
scope: DEFAULT_SW_SCOPE
|
||||||
@@ -21634,7 +21805,7 @@ async function registerDefaultSw(messaging) {
|
|||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
throw ERROR_FACTORY.create("failed-service-worker-registration" /* FAILED_DEFAULT_REGISTRATION */, {
|
throw ERROR_FACTORY.create("failed-service-worker-registration" /* FAILED_DEFAULT_REGISTRATION */, {
|
||||||
browserErrorMessage: (_a = e) === null || _a === void 0 ? void 0 : _a.message
|
browserErrorMessage: e.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21802,7 +21973,7 @@ async function messageEventListener(messaging, event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const name = "@firebase/messaging";
|
const name = "@firebase/messaging";
|
||||||
const version = "0.9.14";
|
const version = "0.9.12";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @license
|
* @license
|
||||||
@@ -21835,11 +22006,11 @@ const WindowMessagingInternalFactory = (container) => {
|
|||||||
return messagingInternal;
|
return messagingInternal;
|
||||||
};
|
};
|
||||||
function registerMessagingInWindow() {
|
function registerMessagingInWindow() {
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging', WindowMessagingFactory, "PUBLIC" /* PUBLIC */));
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_3__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging', WindowMessagingFactory, "PUBLIC" /* PUBLIC */));
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging-internal', WindowMessagingInternalFactory, "PRIVATE" /* PRIVATE */));
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_3__._registerComponent)(new _firebase_component__WEBPACK_IMPORTED_MODULE_1__.Component('messaging-internal', WindowMessagingInternalFactory, "PRIVATE" /* PRIVATE */));
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version);
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_3__.registerVersion)(name, version);
|
||||||
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
||||||
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.registerVersion)(name, version, 'esm2017');
|
(0,_firebase_app__WEBPACK_IMPORTED_MODULE_3__.registerVersion)(name, version, 'esm2017');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21868,7 +22039,7 @@ async function isWindowSupported() {
|
|||||||
try {
|
try {
|
||||||
// This throws if open() is unsupported, so adding it to the conditional
|
// This throws if open() is unsupported, so adding it to the conditional
|
||||||
// statement below can cause an uncaught error.
|
// statement below can cause an uncaught error.
|
||||||
await (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.validateIndexedDBOpenable)();
|
await (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.validateIndexedDBOpenable)();
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
return false;
|
return false;
|
||||||
@@ -21877,8 +22048,8 @@ async function isWindowSupported() {
|
|||||||
// might be prohibited to run. In these contexts, an error would be thrown during the messaging
|
// might be prohibited to run. In these contexts, an error would be thrown during the messaging
|
||||||
// instantiating phase, informing the developers to import/call isSupported for special handling.
|
// instantiating phase, informing the developers to import/call isSupported for special handling.
|
||||||
return (typeof window !== 'undefined' &&
|
return (typeof window !== 'undefined' &&
|
||||||
(0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.isIndexedDBAvailable)() &&
|
(0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.isIndexedDBAvailable)() &&
|
||||||
(0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.areCookiesEnabled)() &&
|
(0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.areCookiesEnabled)() &&
|
||||||
'serviceWorker' in navigator &&
|
'serviceWorker' in navigator &&
|
||||||
'PushManager' in window &&
|
'PushManager' in window &&
|
||||||
'Notification' in window &&
|
'Notification' in window &&
|
||||||
@@ -21962,7 +22133,7 @@ function onMessage$1(messaging, nextOrObserver) {
|
|||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
function getMessagingInWindow(app = (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__.getApp)()) {
|
function getMessagingInWindow(app = (0,_firebase_app__WEBPACK_IMPORTED_MODULE_3__.getApp)()) {
|
||||||
// Conscious decision to make this async check non-blocking during the messaging instance
|
// Conscious decision to make this async check non-blocking during the messaging instance
|
||||||
// initialization phase for performance consideration. An error would be thrown latter for
|
// initialization phase for performance consideration. An error would be thrown latter for
|
||||||
// developer's information. Developers can then choose to import and call `isSupported` for
|
// developer's information. Developers can then choose to import and call `isSupported` for
|
||||||
@@ -21976,7 +22147,7 @@ function getMessagingInWindow(app = (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4_
|
|||||||
// If `isWindowSupported()` rejected.
|
// If `isWindowSupported()` rejected.
|
||||||
throw ERROR_FACTORY.create("indexed-db-unsupported" /* INDEXED_DB_UNSUPPORTED */);
|
throw ERROR_FACTORY.create("indexed-db-unsupported" /* INDEXED_DB_UNSUPPORTED */);
|
||||||
});
|
});
|
||||||
return (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4__._getProvider)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(app), 'messaging').getImmediate();
|
return (0,_firebase_app__WEBPACK_IMPORTED_MODULE_3__._getProvider)((0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.getModularInstance)(app), 'messaging').getImmediate();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Subscribes the {@link Messaging} instance to push notifications. Returns an Firebase Cloud
|
* Subscribes the {@link Messaging} instance to push notifications. Returns an Firebase Cloud
|
||||||
@@ -21994,7 +22165,7 @@ function getMessagingInWindow(app = (0,_firebase_app__WEBPACK_IMPORTED_MODULE_4_
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
async function getToken(messaging, options) {
|
async function getToken(messaging, options) {
|
||||||
messaging = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(messaging);
|
messaging = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.getModularInstance)(messaging);
|
||||||
return getToken$1(messaging, options);
|
return getToken$1(messaging, options);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -22008,7 +22179,7 @@ async function getToken(messaging, options) {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
function deleteToken(messaging) {
|
function deleteToken(messaging) {
|
||||||
messaging = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(messaging);
|
messaging = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.getModularInstance)(messaging);
|
||||||
return deleteToken$1(messaging);
|
return deleteToken$1(messaging);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -22025,7 +22196,7 @@ function deleteToken(messaging) {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
function onMessage(messaging, nextOrObserver) {
|
function onMessage(messaging, nextOrObserver) {
|
||||||
messaging = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_3__.getModularInstance)(messaging);
|
messaging = (0,_firebase_util__WEBPACK_IMPORTED_MODULE_2__.getModularInstance)(messaging);
|
||||||
return onMessage$1(messaging, nextOrObserver);
|
return onMessage$1(messaging, nextOrObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22040,317 +22211,6 @@ registerMessagingInWindow();
|
|||||||
//# sourceMappingURL=index.esm2017.js.map
|
//# sourceMappingURL=index.esm2017.js.map
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ "./node_modules/idb/build/index.js":
|
|
||||||
/*!*****************************************!*\
|
|
||||||
!*** ./node_modules/idb/build/index.js ***!
|
|
||||||
\*****************************************/
|
|
||||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
||||||
/* harmony export */ "deleteDB": () => (/* binding */ deleteDB),
|
|
||||||
/* harmony export */ "openDB": () => (/* binding */ openDB),
|
|
||||||
/* harmony export */ "unwrap": () => (/* reexport safe */ _wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.u),
|
|
||||||
/* harmony export */ "wrap": () => (/* reexport safe */ _wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)
|
|
||||||
/* harmony export */ });
|
|
||||||
/* harmony import */ var _wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wrap-idb-value.js */ "./node_modules/idb/build/wrap-idb-value.js");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Open a database.
|
|
||||||
*
|
|
||||||
* @param name Name of the database.
|
|
||||||
* @param version Schema version.
|
|
||||||
* @param callbacks Additional callbacks.
|
|
||||||
*/
|
|
||||||
function openDB(name, version, { blocked, upgrade, blocking, terminated } = {}) {
|
|
||||||
const request = indexedDB.open(name, version);
|
|
||||||
const openPromise = (0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)(request);
|
|
||||||
if (upgrade) {
|
|
||||||
request.addEventListener('upgradeneeded', (event) => {
|
|
||||||
upgrade((0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)(request.result), event.oldVersion, event.newVersion, (0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)(request.transaction));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (blocked)
|
|
||||||
request.addEventListener('blocked', () => blocked());
|
|
||||||
openPromise
|
|
||||||
.then((db) => {
|
|
||||||
if (terminated)
|
|
||||||
db.addEventListener('close', () => terminated());
|
|
||||||
if (blocking)
|
|
||||||
db.addEventListener('versionchange', () => blocking());
|
|
||||||
})
|
|
||||||
.catch(() => { });
|
|
||||||
return openPromise;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Delete a database.
|
|
||||||
*
|
|
||||||
* @param name Name of the database.
|
|
||||||
*/
|
|
||||||
function deleteDB(name, { blocked } = {}) {
|
|
||||||
const request = indexedDB.deleteDatabase(name);
|
|
||||||
if (blocked)
|
|
||||||
request.addEventListener('blocked', () => blocked());
|
|
||||||
return (0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.w)(request).then(() => undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
const readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count'];
|
|
||||||
const writeMethods = ['put', 'add', 'delete', 'clear'];
|
|
||||||
const cachedMethods = new Map();
|
|
||||||
function getMethod(target, prop) {
|
|
||||||
if (!(target instanceof IDBDatabase &&
|
|
||||||
!(prop in target) &&
|
|
||||||
typeof prop === 'string')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (cachedMethods.get(prop))
|
|
||||||
return cachedMethods.get(prop);
|
|
||||||
const targetFuncName = prop.replace(/FromIndex$/, '');
|
|
||||||
const useIndex = prop !== targetFuncName;
|
|
||||||
const isWrite = writeMethods.includes(targetFuncName);
|
|
||||||
if (
|
|
||||||
// Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.
|
|
||||||
!(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) ||
|
|
||||||
!(isWrite || readMethods.includes(targetFuncName))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const method = async function (storeName, ...args) {
|
|
||||||
// isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :(
|
|
||||||
const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly');
|
|
||||||
let target = tx.store;
|
|
||||||
if (useIndex)
|
|
||||||
target = target.index(args.shift());
|
|
||||||
// Must reject if op rejects.
|
|
||||||
// If it's a write operation, must reject if tx.done rejects.
|
|
||||||
// Must reject with op rejection first.
|
|
||||||
// Must resolve with op value.
|
|
||||||
// Must handle both promises (no unhandled rejections)
|
|
||||||
return (await Promise.all([
|
|
||||||
target[targetFuncName](...args),
|
|
||||||
isWrite && tx.done,
|
|
||||||
]))[0];
|
|
||||||
};
|
|
||||||
cachedMethods.set(prop, method);
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
(0,_wrap_idb_value_js__WEBPACK_IMPORTED_MODULE_0__.r)((oldTraps) => ({
|
|
||||||
...oldTraps,
|
|
||||||
get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),
|
|
||||||
has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ "./node_modules/idb/build/wrap-idb-value.js":
|
|
||||||
/*!**************************************************!*\
|
|
||||||
!*** ./node_modules/idb/build/wrap-idb-value.js ***!
|
|
||||||
\**************************************************/
|
|
||||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
__webpack_require__.r(__webpack_exports__);
|
|
||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
||||||
/* harmony export */ "a": () => (/* binding */ reverseTransformCache),
|
|
||||||
/* harmony export */ "i": () => (/* binding */ instanceOfAny),
|
|
||||||
/* harmony export */ "r": () => (/* binding */ replaceTraps),
|
|
||||||
/* harmony export */ "u": () => (/* binding */ unwrap),
|
|
||||||
/* harmony export */ "w": () => (/* binding */ wrap)
|
|
||||||
/* harmony export */ });
|
|
||||||
const instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);
|
|
||||||
|
|
||||||
let idbProxyableTypes;
|
|
||||||
let cursorAdvanceMethods;
|
|
||||||
// This is a function to prevent it throwing up in node environments.
|
|
||||||
function getIdbProxyableTypes() {
|
|
||||||
return (idbProxyableTypes ||
|
|
||||||
(idbProxyableTypes = [
|
|
||||||
IDBDatabase,
|
|
||||||
IDBObjectStore,
|
|
||||||
IDBIndex,
|
|
||||||
IDBCursor,
|
|
||||||
IDBTransaction,
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
// This is a function to prevent it throwing up in node environments.
|
|
||||||
function getCursorAdvanceMethods() {
|
|
||||||
return (cursorAdvanceMethods ||
|
|
||||||
(cursorAdvanceMethods = [
|
|
||||||
IDBCursor.prototype.advance,
|
|
||||||
IDBCursor.prototype.continue,
|
|
||||||
IDBCursor.prototype.continuePrimaryKey,
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
const cursorRequestMap = new WeakMap();
|
|
||||||
const transactionDoneMap = new WeakMap();
|
|
||||||
const transactionStoreNamesMap = new WeakMap();
|
|
||||||
const transformCache = new WeakMap();
|
|
||||||
const reverseTransformCache = new WeakMap();
|
|
||||||
function promisifyRequest(request) {
|
|
||||||
const promise = new Promise((resolve, reject) => {
|
|
||||||
const unlisten = () => {
|
|
||||||
request.removeEventListener('success', success);
|
|
||||||
request.removeEventListener('error', error);
|
|
||||||
};
|
|
||||||
const success = () => {
|
|
||||||
resolve(wrap(request.result));
|
|
||||||
unlisten();
|
|
||||||
};
|
|
||||||
const error = () => {
|
|
||||||
reject(request.error);
|
|
||||||
unlisten();
|
|
||||||
};
|
|
||||||
request.addEventListener('success', success);
|
|
||||||
request.addEventListener('error', error);
|
|
||||||
});
|
|
||||||
promise
|
|
||||||
.then((value) => {
|
|
||||||
// Since cursoring reuses the IDBRequest (*sigh*), we cache it for later retrieval
|
|
||||||
// (see wrapFunction).
|
|
||||||
if (value instanceof IDBCursor) {
|
|
||||||
cursorRequestMap.set(value, request);
|
|
||||||
}
|
|
||||||
// Catching to avoid "Uncaught Promise exceptions"
|
|
||||||
})
|
|
||||||
.catch(() => { });
|
|
||||||
// This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This
|
|
||||||
// is because we create many promises from a single IDBRequest.
|
|
||||||
reverseTransformCache.set(promise, request);
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
function cacheDonePromiseForTransaction(tx) {
|
|
||||||
// Early bail if we've already created a done promise for this transaction.
|
|
||||||
if (transactionDoneMap.has(tx))
|
|
||||||
return;
|
|
||||||
const done = new Promise((resolve, reject) => {
|
|
||||||
const unlisten = () => {
|
|
||||||
tx.removeEventListener('complete', complete);
|
|
||||||
tx.removeEventListener('error', error);
|
|
||||||
tx.removeEventListener('abort', error);
|
|
||||||
};
|
|
||||||
const complete = () => {
|
|
||||||
resolve();
|
|
||||||
unlisten();
|
|
||||||
};
|
|
||||||
const error = () => {
|
|
||||||
reject(tx.error || new DOMException('AbortError', 'AbortError'));
|
|
||||||
unlisten();
|
|
||||||
};
|
|
||||||
tx.addEventListener('complete', complete);
|
|
||||||
tx.addEventListener('error', error);
|
|
||||||
tx.addEventListener('abort', error);
|
|
||||||
});
|
|
||||||
// Cache it for later retrieval.
|
|
||||||
transactionDoneMap.set(tx, done);
|
|
||||||
}
|
|
||||||
let idbProxyTraps = {
|
|
||||||
get(target, prop, receiver) {
|
|
||||||
if (target instanceof IDBTransaction) {
|
|
||||||
// Special handling for transaction.done.
|
|
||||||
if (prop === 'done')
|
|
||||||
return transactionDoneMap.get(target);
|
|
||||||
// Polyfill for objectStoreNames because of Edge.
|
|
||||||
if (prop === 'objectStoreNames') {
|
|
||||||
return target.objectStoreNames || transactionStoreNamesMap.get(target);
|
|
||||||
}
|
|
||||||
// Make tx.store return the only store in the transaction, or undefined if there are many.
|
|
||||||
if (prop === 'store') {
|
|
||||||
return receiver.objectStoreNames[1]
|
|
||||||
? undefined
|
|
||||||
: receiver.objectStore(receiver.objectStoreNames[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Else transform whatever we get back.
|
|
||||||
return wrap(target[prop]);
|
|
||||||
},
|
|
||||||
set(target, prop, value) {
|
|
||||||
target[prop] = value;
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
has(target, prop) {
|
|
||||||
if (target instanceof IDBTransaction &&
|
|
||||||
(prop === 'done' || prop === 'store')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return prop in target;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
function replaceTraps(callback) {
|
|
||||||
idbProxyTraps = callback(idbProxyTraps);
|
|
||||||
}
|
|
||||||
function wrapFunction(func) {
|
|
||||||
// Due to expected object equality (which is enforced by the caching in `wrap`), we
|
|
||||||
// only create one new func per func.
|
|
||||||
// Edge doesn't support objectStoreNames (booo), so we polyfill it here.
|
|
||||||
if (func === IDBDatabase.prototype.transaction &&
|
|
||||||
!('objectStoreNames' in IDBTransaction.prototype)) {
|
|
||||||
return function (storeNames, ...args) {
|
|
||||||
const tx = func.call(unwrap(this), storeNames, ...args);
|
|
||||||
transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]);
|
|
||||||
return wrap(tx);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// Cursor methods are special, as the behaviour is a little more different to standard IDB. In
|
|
||||||
// IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the
|
|
||||||
// cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense
|
|
||||||
// with real promises, so each advance methods returns a new promise for the cursor object, or
|
|
||||||
// undefined if the end of the cursor has been reached.
|
|
||||||
if (getCursorAdvanceMethods().includes(func)) {
|
|
||||||
return function (...args) {
|
|
||||||
// Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use
|
|
||||||
// the original object.
|
|
||||||
func.apply(unwrap(this), args);
|
|
||||||
return wrap(cursorRequestMap.get(this));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return function (...args) {
|
|
||||||
// Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use
|
|
||||||
// the original object.
|
|
||||||
return wrap(func.apply(unwrap(this), args));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function transformCachableValue(value) {
|
|
||||||
if (typeof value === 'function')
|
|
||||||
return wrapFunction(value);
|
|
||||||
// This doesn't return, it just creates a 'done' promise for the transaction,
|
|
||||||
// which is later returned for transaction.done (see idbObjectHandler).
|
|
||||||
if (value instanceof IDBTransaction)
|
|
||||||
cacheDonePromiseForTransaction(value);
|
|
||||||
if (instanceOfAny(value, getIdbProxyableTypes()))
|
|
||||||
return new Proxy(value, idbProxyTraps);
|
|
||||||
// Return the same value back if we're not going to transform it.
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
function wrap(value) {
|
|
||||||
// We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because
|
|
||||||
// IDB is weird and a single IDBRequest can yield many responses, so these can't be cached.
|
|
||||||
if (value instanceof IDBRequest)
|
|
||||||
return promisifyRequest(value);
|
|
||||||
// If we've already transformed this value before, reuse the transformed value.
|
|
||||||
// This is faster, but it also provides object equality.
|
|
||||||
if (transformCache.has(value))
|
|
||||||
return transformCache.get(value);
|
|
||||||
const newValue = transformCachableValue(value);
|
|
||||||
// Not all types are transformed.
|
|
||||||
// These may be primitive types, so they can't be WeakMap keys.
|
|
||||||
if (newValue !== value) {
|
|
||||||
transformCache.set(value, newValue);
|
|
||||||
reverseTransformCache.set(newValue, value);
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
const unwrap = (value) => reverseTransformCache.get(value);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ "./src/messages.json":
|
/***/ "./src/messages.json":
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+56
-89
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user