@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.node.cjs.js
CHANGED
|
@@ -1891,172 +1891,6 @@ function getModularInstance(service) {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
}
|
|
1893
1893
|
|
|
1894
|
-
/**
|
|
1895
|
-
* @license
|
|
1896
|
-
* Copyright 2022 Google LLC
|
|
1897
|
-
*
|
|
1898
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1899
|
-
* you may not use this file except in compliance with the License.
|
|
1900
|
-
* You may obtain a copy of the License at
|
|
1901
|
-
*
|
|
1902
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1903
|
-
*
|
|
1904
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1905
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1906
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1907
|
-
* See the License for the specific language governing permissions and
|
|
1908
|
-
* limitations under the License.
|
|
1909
|
-
*/
|
|
1910
|
-
/**
|
|
1911
|
-
* @internal
|
|
1912
|
-
*/
|
|
1913
|
-
function promisifyRequest(request, errorMessage) {
|
|
1914
|
-
return new Promise(function (resolve, reject) {
|
|
1915
|
-
request.onsuccess = function (event) {
|
|
1916
|
-
resolve(event.target.result);
|
|
1917
|
-
};
|
|
1918
|
-
request.onerror = function (event) {
|
|
1919
|
-
var _a;
|
|
1920
|
-
reject(errorMessage + ": " + ((_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message));
|
|
1921
|
-
};
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
/**
|
|
1925
|
-
* @internal
|
|
1926
|
-
*/
|
|
1927
|
-
var DBWrapper = /** @class */ (function () {
|
|
1928
|
-
function DBWrapper(_db) {
|
|
1929
|
-
this._db = _db;
|
|
1930
|
-
this.objectStoreNames = this._db.objectStoreNames;
|
|
1931
|
-
}
|
|
1932
|
-
DBWrapper.prototype.transaction = function (storeNames, mode) {
|
|
1933
|
-
if (mode === void 0) { mode = 'readonly'; }
|
|
1934
|
-
return new TransactionWrapper(this._db.transaction.call(this._db, storeNames, mode));
|
|
1935
|
-
};
|
|
1936
|
-
DBWrapper.prototype.createObjectStore = function (storeName, options) {
|
|
1937
|
-
return new ObjectStoreWrapper(this._db.createObjectStore(storeName, options));
|
|
1938
|
-
};
|
|
1939
|
-
DBWrapper.prototype.close = function () {
|
|
1940
|
-
this._db.close();
|
|
1941
|
-
};
|
|
1942
|
-
return DBWrapper;
|
|
1943
|
-
}());
|
|
1944
|
-
/**
|
|
1945
|
-
* @internal
|
|
1946
|
-
*/
|
|
1947
|
-
var TransactionWrapper = /** @class */ (function () {
|
|
1948
|
-
function TransactionWrapper(_transaction) {
|
|
1949
|
-
var _this = this;
|
|
1950
|
-
this._transaction = _transaction;
|
|
1951
|
-
this.complete = new Promise(function (resolve, reject) {
|
|
1952
|
-
_this._transaction.oncomplete = function () {
|
|
1953
|
-
resolve();
|
|
1954
|
-
};
|
|
1955
|
-
_this._transaction.onerror = function () {
|
|
1956
|
-
reject(_this._transaction.error);
|
|
1957
|
-
};
|
|
1958
|
-
_this._transaction.onabort = function () {
|
|
1959
|
-
reject(_this._transaction.error);
|
|
1960
|
-
};
|
|
1961
|
-
});
|
|
1962
|
-
}
|
|
1963
|
-
TransactionWrapper.prototype.objectStore = function (storeName) {
|
|
1964
|
-
return new ObjectStoreWrapper(this._transaction.objectStore(storeName));
|
|
1965
|
-
};
|
|
1966
|
-
return TransactionWrapper;
|
|
1967
|
-
}());
|
|
1968
|
-
/**
|
|
1969
|
-
* @internal
|
|
1970
|
-
*/
|
|
1971
|
-
var ObjectStoreWrapper = /** @class */ (function () {
|
|
1972
|
-
function ObjectStoreWrapper(_store) {
|
|
1973
|
-
this._store = _store;
|
|
1974
|
-
}
|
|
1975
|
-
ObjectStoreWrapper.prototype.index = function (name) {
|
|
1976
|
-
return new IndexWrapper(this._store.index(name));
|
|
1977
|
-
};
|
|
1978
|
-
ObjectStoreWrapper.prototype.createIndex = function (name, keypath, options) {
|
|
1979
|
-
return new IndexWrapper(this._store.createIndex(name, keypath, options));
|
|
1980
|
-
};
|
|
1981
|
-
ObjectStoreWrapper.prototype.get = function (key) {
|
|
1982
|
-
var request = this._store.get(key);
|
|
1983
|
-
return promisifyRequest(request, 'Error reading from IndexedDB');
|
|
1984
|
-
};
|
|
1985
|
-
ObjectStoreWrapper.prototype.put = function (value, key) {
|
|
1986
|
-
var request = this._store.put(value, key);
|
|
1987
|
-
return promisifyRequest(request, 'Error writing to IndexedDB');
|
|
1988
|
-
};
|
|
1989
|
-
ObjectStoreWrapper.prototype.delete = function (key) {
|
|
1990
|
-
var request = this._store.delete(key);
|
|
1991
|
-
return promisifyRequest(request, 'Error deleting from IndexedDB');
|
|
1992
|
-
};
|
|
1993
|
-
ObjectStoreWrapper.prototype.clear = function () {
|
|
1994
|
-
var request = this._store.clear();
|
|
1995
|
-
return promisifyRequest(request, 'Error clearing IndexedDB object store');
|
|
1996
|
-
};
|
|
1997
|
-
return ObjectStoreWrapper;
|
|
1998
|
-
}());
|
|
1999
|
-
/**
|
|
2000
|
-
* @internal
|
|
2001
|
-
*/
|
|
2002
|
-
var IndexWrapper = /** @class */ (function () {
|
|
2003
|
-
function IndexWrapper(_index) {
|
|
2004
|
-
this._index = _index;
|
|
2005
|
-
}
|
|
2006
|
-
IndexWrapper.prototype.get = function (key) {
|
|
2007
|
-
var request = this._index.get(key);
|
|
2008
|
-
return promisifyRequest(request, 'Error reading from IndexedDB');
|
|
2009
|
-
};
|
|
2010
|
-
return IndexWrapper;
|
|
2011
|
-
}());
|
|
2012
|
-
/**
|
|
2013
|
-
* @internal
|
|
2014
|
-
*/
|
|
2015
|
-
function openDB(dbName, dbVersion, upgradeCallback) {
|
|
2016
|
-
return new Promise(function (resolve, reject) {
|
|
2017
|
-
try {
|
|
2018
|
-
var request_1 = indexedDB.open(dbName, dbVersion);
|
|
2019
|
-
request_1.onsuccess = function (event) {
|
|
2020
|
-
resolve(new DBWrapper(event.target.result));
|
|
2021
|
-
};
|
|
2022
|
-
request_1.onerror = function (event) {
|
|
2023
|
-
var _a;
|
|
2024
|
-
reject("Error opening indexedDB: " + ((_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message));
|
|
2025
|
-
};
|
|
2026
|
-
request_1.onupgradeneeded = function (event) {
|
|
2027
|
-
upgradeCallback(new DBWrapper(request_1.result), event.oldVersion, event.newVersion, new TransactionWrapper(request_1.transaction));
|
|
2028
|
-
};
|
|
2029
|
-
}
|
|
2030
|
-
catch (e) {
|
|
2031
|
-
reject("Error opening indexedDB: " + e.message);
|
|
2032
|
-
}
|
|
2033
|
-
});
|
|
2034
|
-
}
|
|
2035
|
-
/**
|
|
2036
|
-
* @internal
|
|
2037
|
-
*/
|
|
2038
|
-
function deleteDB(dbName) {
|
|
2039
|
-
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
2040
|
-
return tslib.__generator(this, function (_a) {
|
|
2041
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
2042
|
-
try {
|
|
2043
|
-
var request = indexedDB.deleteDatabase(dbName);
|
|
2044
|
-
request.onsuccess = function () {
|
|
2045
|
-
resolve();
|
|
2046
|
-
};
|
|
2047
|
-
request.onerror = function (event) {
|
|
2048
|
-
var _a;
|
|
2049
|
-
reject("Error deleting indexedDB database \"" + dbName + "\": " + ((_a = event.target.error) === null || _a === void 0 ? void 0 : _a.message));
|
|
2050
|
-
};
|
|
2051
|
-
}
|
|
2052
|
-
catch (e) {
|
|
2053
|
-
reject("Error deleting indexedDB database \"" + dbName + "\": " + e.message);
|
|
2054
|
-
}
|
|
2055
|
-
})];
|
|
2056
|
-
});
|
|
2057
|
-
});
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
1894
|
/**
|
|
2061
1895
|
* @license
|
|
2062
1896
|
* Copyright 2017 Google LLC
|
|
@@ -2077,7 +1911,6 @@ function deleteDB(dbName) {
|
|
|
2077
1911
|
CONSTANTS.NODE_CLIENT = true;
|
|
2078
1912
|
|
|
2079
1913
|
exports.CONSTANTS = CONSTANTS;
|
|
2080
|
-
exports.DBWrapper = DBWrapper;
|
|
2081
1914
|
exports.Deferred = Deferred;
|
|
2082
1915
|
exports.ErrorFactory = ErrorFactory;
|
|
2083
1916
|
exports.FirebaseError = FirebaseError;
|
|
@@ -2100,7 +1933,6 @@ exports.decode = decode;
|
|
|
2100
1933
|
exports.deepCopy = deepCopy;
|
|
2101
1934
|
exports.deepEqual = deepEqual;
|
|
2102
1935
|
exports.deepExtend = deepExtend;
|
|
2103
|
-
exports.deleteDB = deleteDB;
|
|
2104
1936
|
exports.errorPrefix = errorPrefix;
|
|
2105
1937
|
exports.extractQuerystring = extractQuerystring;
|
|
2106
1938
|
exports.getGlobal = getGlobal;
|
|
@@ -2124,7 +1956,6 @@ exports.isValidTimestamp = isValidTimestamp;
|
|
|
2124
1956
|
exports.issuedAtTime = issuedAtTime;
|
|
2125
1957
|
exports.jsonEval = jsonEval;
|
|
2126
1958
|
exports.map = map;
|
|
2127
|
-
exports.openDB = openDB;
|
|
2128
1959
|
exports.ordinal = ordinal;
|
|
2129
1960
|
exports.querystring = querystring;
|
|
2130
1961
|
exports.querystringDecode = querystringDecode;
|