@firebase/util 1.6.1 → 1.6.2-canary.13550089f
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 +2 -0
- package/dist/index.esm2017.js +57 -2
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +57 -1
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +58 -0
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.d.ts +2 -0
- package/dist/node-esm/index.d.ts +2 -0
- package/dist/node-esm/index.node.d.ts +2 -0
- package/dist/node-esm/index.node.esm.js +57 -2
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/errors.d.ts +1 -1
- package/dist/node-esm/src/promise.d.ts +21 -0
- package/dist/node-esm/src/uuid.d.ts +22 -0
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/promise.d.ts +21 -0
- package/dist/src/uuid.d.ts +22 -0
- package/dist/util-public.d.ts +10 -1
- package/dist/util.d.ts +30 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @firebase/util
|
|
2
2
|
|
|
3
|
+
## 1.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`efe2000fc`](https://github.com/firebase/firebase-js-sdk/commit/efe2000fc499e2c85c4e5e0fef6741ff3bad2eb0) [#6363](https://github.com/firebase/firebase-js-sdk/pull/6363) - Extract uuid function into @firebase/util
|
|
8
|
+
|
|
3
9
|
## 1.6.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -25,11 +25,13 @@ export * from './src/errors';
|
|
|
25
25
|
export * from './src/json';
|
|
26
26
|
export * from './src/jwt';
|
|
27
27
|
export * from './src/obj';
|
|
28
|
+
export * from './src/promise';
|
|
28
29
|
export * from './src/query';
|
|
29
30
|
export * from './src/sha1';
|
|
30
31
|
export * from './src/subscribe';
|
|
31
32
|
export * from './src/validation';
|
|
32
33
|
export * from './src/utf8';
|
|
34
|
+
export * from './src/uuid';
|
|
33
35
|
export * from './src/exponential_backoff';
|
|
34
36
|
export * from './src/formatters';
|
|
35
37
|
export * from './src/compat';
|
package/dist/index.esm2017.js
CHANGED
|
@@ -774,7 +774,7 @@ function getGlobal() {
|
|
|
774
774
|
*
|
|
775
775
|
* catch (e) {
|
|
776
776
|
* assert(e.message === "Could not find file: foo.txt.");
|
|
777
|
-
* if (e
|
|
777
|
+
* if ((e as FirebaseError)?.code === 'service/file-not-found') {
|
|
778
778
|
* console.log("Could not read file: " + e['file']);
|
|
779
779
|
* }
|
|
780
780
|
* }
|
|
@@ -1052,6 +1052,33 @@ function isObject(thing) {
|
|
|
1052
1052
|
return thing !== null && typeof thing === 'object';
|
|
1053
1053
|
}
|
|
1054
1054
|
|
|
1055
|
+
/**
|
|
1056
|
+
* @license
|
|
1057
|
+
* Copyright 2022 Google LLC
|
|
1058
|
+
*
|
|
1059
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1060
|
+
* you may not use this file except in compliance with the License.
|
|
1061
|
+
* You may obtain a copy of the License at
|
|
1062
|
+
*
|
|
1063
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1064
|
+
*
|
|
1065
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1066
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1067
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1068
|
+
* See the License for the specific language governing permissions and
|
|
1069
|
+
* limitations under the License.
|
|
1070
|
+
*/
|
|
1071
|
+
/**
|
|
1072
|
+
* Rejects if the given promise doesn't resolve in timeInMS milliseconds.
|
|
1073
|
+
* @internal
|
|
1074
|
+
*/
|
|
1075
|
+
function promiseWithTimeout(promise, timeInMS = 2000) {
|
|
1076
|
+
const deferredPromise = new Deferred();
|
|
1077
|
+
setTimeout(() => deferredPromise.reject('timeout!'), timeInMS);
|
|
1078
|
+
promise.then(deferredPromise.resolve, deferredPromise.reject);
|
|
1079
|
+
return deferredPromise.promise;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1055
1082
|
/**
|
|
1056
1083
|
* @license
|
|
1057
1084
|
* Copyright 2017 Google LLC
|
|
@@ -1761,6 +1788,34 @@ const stringLength = function (str) {
|
|
|
1761
1788
|
return p;
|
|
1762
1789
|
};
|
|
1763
1790
|
|
|
1791
|
+
/**
|
|
1792
|
+
* @license
|
|
1793
|
+
* Copyright 2022 Google LLC
|
|
1794
|
+
*
|
|
1795
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1796
|
+
* you may not use this file except in compliance with the License.
|
|
1797
|
+
* You may obtain a copy of the License at
|
|
1798
|
+
*
|
|
1799
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1800
|
+
*
|
|
1801
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1802
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1803
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1804
|
+
* See the License for the specific language governing permissions and
|
|
1805
|
+
* limitations under the License.
|
|
1806
|
+
*/
|
|
1807
|
+
/**
|
|
1808
|
+
* Copied from https://stackoverflow.com/a/2117523
|
|
1809
|
+
* Generates a new uuid.
|
|
1810
|
+
* @public
|
|
1811
|
+
*/
|
|
1812
|
+
const uuidv4 = function () {
|
|
1813
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
|
1814
|
+
const r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
1815
|
+
return v.toString(16);
|
|
1816
|
+
});
|
|
1817
|
+
};
|
|
1818
|
+
|
|
1764
1819
|
/**
|
|
1765
1820
|
* @license
|
|
1766
1821
|
* Copyright 2019 Google LLC
|
|
@@ -1895,5 +1950,5 @@ function getModularInstance(service) {
|
|
|
1895
1950
|
}
|
|
1896
1951
|
}
|
|
1897
1952
|
|
|
1898
|
-
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 };
|
|
1953
|
+
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, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, uuidv4, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
|
|
1899
1954
|
//# sourceMappingURL=index.esm2017.js.map
|