@firebase/util 1.5.2 → 1.6.0
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.esm2017.js +1 -157
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2 -168
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +0 -169
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.d.ts +0 -1
- package/dist/node-esm/index.d.ts +0 -1
- package/dist/node-esm/index.node.d.ts +0 -1
- package/dist/node-esm/index.node.esm.js +1 -157
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/util-public.d.ts +0 -12
- package/dist/util.d.ts +0 -71
- package/package.json +1 -1
- package/dist/node-esm/src/indexeddb.d.ts +0 -66
- package/dist/src/indexeddb.d.ts +0 -66
package/dist/index.esm5.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __extends
|
|
1
|
+
import { __assign, __extends } from 'tslib';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -1887,171 +1887,5 @@ function getModularInstance(service) {
|
|
|
1887
1887
|
}
|
|
1888
1888
|
}
|
|
1889
1889
|
|
|
1890
|
-
|
|
1891
|
-
* @license
|
|
1892
|
-
* Copyright 2022 Google LLC
|
|
1893
|
-
*
|
|
1894
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1895
|
-
* you may not use this file except in compliance with the License.
|
|
1896
|
-
* You may obtain a copy of the License at
|
|
1897
|
-
*
|
|
1898
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1899
|
-
*
|
|
1900
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1901
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1902
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1903
|
-
* See the License for the specific language governing permissions and
|
|
1904
|
-
* limitations under the License.
|
|
1905
|
-
*/
|
|
1906
|
-
/**
|
|
1907
|
-
* @internal
|
|
1908
|
-
*/
|
|
1909
|
-
function promisifyRequest(request, errorMessage) {
|
|
1910
|
-
return new Promise(function (resolve, reject) {
|
|
1911
|
-
request.onsuccess = function (event) {
|
|
1912
|
-
resolve(event.target.result);
|
|
1913
|
-
};
|
|
1914
|
-
request.onerror = function (event) {
|
|
1915
|
-
var _a;
|
|
1916
|
-
reject(errorMessage + ": " + ((_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message));
|
|
1917
|
-
};
|
|
1918
|
-
});
|
|
1919
|
-
}
|
|
1920
|
-
/**
|
|
1921
|
-
* @internal
|
|
1922
|
-
*/
|
|
1923
|
-
var DBWrapper = /** @class */ (function () {
|
|
1924
|
-
function DBWrapper(_db) {
|
|
1925
|
-
this._db = _db;
|
|
1926
|
-
this.objectStoreNames = this._db.objectStoreNames;
|
|
1927
|
-
}
|
|
1928
|
-
DBWrapper.prototype.transaction = function (storeNames, mode) {
|
|
1929
|
-
if (mode === void 0) { mode = 'readonly'; }
|
|
1930
|
-
return new TransactionWrapper(this._db.transaction.call(this._db, storeNames, mode));
|
|
1931
|
-
};
|
|
1932
|
-
DBWrapper.prototype.createObjectStore = function (storeName, options) {
|
|
1933
|
-
return new ObjectStoreWrapper(this._db.createObjectStore(storeName, options));
|
|
1934
|
-
};
|
|
1935
|
-
DBWrapper.prototype.close = function () {
|
|
1936
|
-
this._db.close();
|
|
1937
|
-
};
|
|
1938
|
-
return DBWrapper;
|
|
1939
|
-
}());
|
|
1940
|
-
/**
|
|
1941
|
-
* @internal
|
|
1942
|
-
*/
|
|
1943
|
-
var TransactionWrapper = /** @class */ (function () {
|
|
1944
|
-
function TransactionWrapper(_transaction) {
|
|
1945
|
-
var _this = this;
|
|
1946
|
-
this._transaction = _transaction;
|
|
1947
|
-
this.complete = new Promise(function (resolve, reject) {
|
|
1948
|
-
_this._transaction.oncomplete = function () {
|
|
1949
|
-
resolve();
|
|
1950
|
-
};
|
|
1951
|
-
_this._transaction.onerror = function () {
|
|
1952
|
-
reject(_this._transaction.error);
|
|
1953
|
-
};
|
|
1954
|
-
_this._transaction.onabort = function () {
|
|
1955
|
-
reject(_this._transaction.error);
|
|
1956
|
-
};
|
|
1957
|
-
});
|
|
1958
|
-
}
|
|
1959
|
-
TransactionWrapper.prototype.objectStore = function (storeName) {
|
|
1960
|
-
return new ObjectStoreWrapper(this._transaction.objectStore(storeName));
|
|
1961
|
-
};
|
|
1962
|
-
return TransactionWrapper;
|
|
1963
|
-
}());
|
|
1964
|
-
/**
|
|
1965
|
-
* @internal
|
|
1966
|
-
*/
|
|
1967
|
-
var ObjectStoreWrapper = /** @class */ (function () {
|
|
1968
|
-
function ObjectStoreWrapper(_store) {
|
|
1969
|
-
this._store = _store;
|
|
1970
|
-
}
|
|
1971
|
-
ObjectStoreWrapper.prototype.index = function (name) {
|
|
1972
|
-
return new IndexWrapper(this._store.index(name));
|
|
1973
|
-
};
|
|
1974
|
-
ObjectStoreWrapper.prototype.createIndex = function (name, keypath, options) {
|
|
1975
|
-
return new IndexWrapper(this._store.createIndex(name, keypath, options));
|
|
1976
|
-
};
|
|
1977
|
-
ObjectStoreWrapper.prototype.get = function (key) {
|
|
1978
|
-
var request = this._store.get(key);
|
|
1979
|
-
return promisifyRequest(request, 'Error reading from IndexedDB');
|
|
1980
|
-
};
|
|
1981
|
-
ObjectStoreWrapper.prototype.put = function (value, key) {
|
|
1982
|
-
var request = this._store.put(value, key);
|
|
1983
|
-
return promisifyRequest(request, 'Error writing to IndexedDB');
|
|
1984
|
-
};
|
|
1985
|
-
ObjectStoreWrapper.prototype.delete = function (key) {
|
|
1986
|
-
var request = this._store.delete(key);
|
|
1987
|
-
return promisifyRequest(request, 'Error deleting from IndexedDB');
|
|
1988
|
-
};
|
|
1989
|
-
ObjectStoreWrapper.prototype.clear = function () {
|
|
1990
|
-
var request = this._store.clear();
|
|
1991
|
-
return promisifyRequest(request, 'Error clearing IndexedDB object store');
|
|
1992
|
-
};
|
|
1993
|
-
return ObjectStoreWrapper;
|
|
1994
|
-
}());
|
|
1995
|
-
/**
|
|
1996
|
-
* @internal
|
|
1997
|
-
*/
|
|
1998
|
-
var IndexWrapper = /** @class */ (function () {
|
|
1999
|
-
function IndexWrapper(_index) {
|
|
2000
|
-
this._index = _index;
|
|
2001
|
-
}
|
|
2002
|
-
IndexWrapper.prototype.get = function (key) {
|
|
2003
|
-
var request = this._index.get(key);
|
|
2004
|
-
return promisifyRequest(request, 'Error reading from IndexedDB');
|
|
2005
|
-
};
|
|
2006
|
-
return IndexWrapper;
|
|
2007
|
-
}());
|
|
2008
|
-
/**
|
|
2009
|
-
* @internal
|
|
2010
|
-
*/
|
|
2011
|
-
function openDB(dbName, dbVersion, upgradeCallback) {
|
|
2012
|
-
return new Promise(function (resolve, reject) {
|
|
2013
|
-
try {
|
|
2014
|
-
var request_1 = indexedDB.open(dbName, dbVersion);
|
|
2015
|
-
request_1.onsuccess = function (event) {
|
|
2016
|
-
resolve(new DBWrapper(event.target.result));
|
|
2017
|
-
};
|
|
2018
|
-
request_1.onerror = function (event) {
|
|
2019
|
-
var _a;
|
|
2020
|
-
reject("Error opening indexedDB: " + ((_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message));
|
|
2021
|
-
};
|
|
2022
|
-
request_1.onupgradeneeded = function (event) {
|
|
2023
|
-
upgradeCallback(new DBWrapper(request_1.result), event.oldVersion, event.newVersion, new TransactionWrapper(request_1.transaction));
|
|
2024
|
-
};
|
|
2025
|
-
}
|
|
2026
|
-
catch (e) {
|
|
2027
|
-
reject("Error opening indexedDB: " + e.message);
|
|
2028
|
-
}
|
|
2029
|
-
});
|
|
2030
|
-
}
|
|
2031
|
-
/**
|
|
2032
|
-
* @internal
|
|
2033
|
-
*/
|
|
2034
|
-
function deleteDB(dbName) {
|
|
2035
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2036
|
-
return __generator(this, function (_a) {
|
|
2037
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
2038
|
-
try {
|
|
2039
|
-
var request = indexedDB.deleteDatabase(dbName);
|
|
2040
|
-
request.onsuccess = function () {
|
|
2041
|
-
resolve();
|
|
2042
|
-
};
|
|
2043
|
-
request.onerror = function (event) {
|
|
2044
|
-
var _a;
|
|
2045
|
-
reject("Error deleting indexedDB database \"" + dbName + "\": " + ((_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message));
|
|
2046
|
-
};
|
|
2047
|
-
}
|
|
2048
|
-
catch (e) {
|
|
2049
|
-
reject("Error deleting indexedDB database \"" + dbName + "\": " + e.message);
|
|
2050
|
-
}
|
|
2051
|
-
})];
|
|
2052
|
-
});
|
|
2053
|
-
});
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
export { CONSTANTS, DBWrapper, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, deleteDB, errorPrefix, extractQuerystring, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, issuedAtTime, jsonEval, map, openDB, ordinal, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
|
|
1890
|
+
export { CONSTANTS, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, issuedAtTime, jsonEval, map, ordinal, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
|
|
2057
1891
|
//# sourceMappingURL=index.esm5.js.map
|