@firebase/util 1.9.7-canary.f58d48cd4 → 1.9.7-dataconnect-preview.d986d4bf2
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/dist/index.cjs.js +64 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm2017.js +64 -6
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +66 -5
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +66 -4
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.d.ts +1 -0
- package/dist/node-esm/index.d.ts +1 -0
- package/dist/node-esm/index.node.d.ts +1 -0
- package/dist/node-esm/index.node.esm.js +64 -6
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/deferred.d.ts +1 -1
- package/dist/node-esm/src/environment.d.ts +3 -0
- package/dist/node-esm/src/errors.d.ts +1 -1
- package/dist/node-esm/src/fetch_provider.d.ts +25 -0
- package/dist/node-esm/src/json.d.ts +1 -1
- package/dist/src/deferred.d.ts +1 -1
- package/dist/src/environment.d.ts +3 -0
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/fetch_provider.d.ts +25 -0
- package/dist/src/json.d.ts +1 -1
- package/dist/util-public.d.ts +32 -3
- package/dist/util.d.ts +32 -3
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -638,7 +638,7 @@ class Deferred {
|
|
|
638
638
|
});
|
|
639
639
|
}
|
|
640
640
|
/**
|
|
641
|
-
* Our API internals are not
|
|
641
|
+
* Our API internals are not promisified and cannot because our callback APIs have subtle expectations around
|
|
642
642
|
* invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback
|
|
643
643
|
* and returns a node-style callback which will resolve or reject the Deferred's promise.
|
|
644
644
|
*/
|
|
@@ -780,6 +780,9 @@ function isNode() {
|
|
|
780
780
|
}
|
|
781
781
|
/**
|
|
782
782
|
* Detect Browser Environment
|
|
783
|
+
* Note: This will return true for certain test frameworks that are incompletely
|
|
784
|
+
* mimicking a browser, and should not lead to assuming all browser APIs are
|
|
785
|
+
* available.
|
|
783
786
|
*/
|
|
784
787
|
function isBrowser() {
|
|
785
788
|
return typeof window !== 'undefined' || isWebWorker();
|
|
@@ -915,7 +918,7 @@ function areCookiesEnabled() {
|
|
|
915
918
|
*
|
|
916
919
|
* Usage:
|
|
917
920
|
*
|
|
918
|
-
* //
|
|
921
|
+
* // TypeScript string literals for type-safe codes
|
|
919
922
|
* type Err =
|
|
920
923
|
* 'unknown' |
|
|
921
924
|
* 'object-not-found'
|
|
@@ -1026,7 +1029,7 @@ function jsonEval(str) {
|
|
|
1026
1029
|
}
|
|
1027
1030
|
/**
|
|
1028
1031
|
* Returns JSON representing a javascript object.
|
|
1029
|
-
* @param {*} data
|
|
1032
|
+
* @param {*} data JavaScript object to be stringified.
|
|
1030
1033
|
* @return {string} The JSON contents of the object.
|
|
1031
1034
|
*/
|
|
1032
1035
|
function stringify(data) {
|
|
@@ -1629,7 +1632,7 @@ class ObserverProxy {
|
|
|
1629
1632
|
/**
|
|
1630
1633
|
* Subscribe function that can be used to add an Observer to the fan-out list.
|
|
1631
1634
|
*
|
|
1632
|
-
* - We require that no event is sent to a subscriber
|
|
1635
|
+
* - We require that no event is sent to a subscriber synchronously to their
|
|
1633
1636
|
* call to subscribe().
|
|
1634
1637
|
*/
|
|
1635
1638
|
subscribe(nextOrObserver, error, complete) {
|
|
@@ -1890,7 +1893,7 @@ function validateContextObject(fnName, argumentName, context, optional) {
|
|
|
1890
1893
|
// so it's been modified.
|
|
1891
1894
|
// Note that not all Unicode characters appear as single characters in JavaScript strings.
|
|
1892
1895
|
// fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters
|
|
1893
|
-
// use 2 characters in
|
|
1896
|
+
// use 2 characters in JavaScript. All 4-byte UTF-8 characters begin with a first
|
|
1894
1897
|
// character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate
|
|
1895
1898
|
// pair).
|
|
1896
1899
|
// See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3
|
|
@@ -2121,10 +2124,66 @@ function getModularInstance(service) {
|
|
|
2121
2124
|
}
|
|
2122
2125
|
}
|
|
2123
2126
|
|
|
2127
|
+
/**
|
|
2128
|
+
* @license
|
|
2129
|
+
* Copyright 2023 Google LLC
|
|
2130
|
+
*
|
|
2131
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2132
|
+
* you may not use this file except in compliance with the License.
|
|
2133
|
+
* You may obtain a copy of the License at
|
|
2134
|
+
*
|
|
2135
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2136
|
+
*
|
|
2137
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2138
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2139
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2140
|
+
* See the License for the specific language governing permissions and
|
|
2141
|
+
* limitations under the License.
|
|
2142
|
+
*/
|
|
2143
|
+
class FetchProvider {
|
|
2144
|
+
static initialize(fetchImpl, headersImpl, responseImpl) {
|
|
2145
|
+
this.fetchImpl = fetchImpl;
|
|
2146
|
+
if (headersImpl) {
|
|
2147
|
+
this.headersImpl = headersImpl;
|
|
2148
|
+
}
|
|
2149
|
+
if (responseImpl) {
|
|
2150
|
+
this.responseImpl = responseImpl;
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
static fetch() {
|
|
2154
|
+
if (this.fetchImpl) {
|
|
2155
|
+
return this.fetchImpl;
|
|
2156
|
+
}
|
|
2157
|
+
if (typeof self !== 'undefined' && 'fetch' in self) {
|
|
2158
|
+
return self.fetch;
|
|
2159
|
+
}
|
|
2160
|
+
throw new Error('Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');
|
|
2161
|
+
}
|
|
2162
|
+
static headers() {
|
|
2163
|
+
if (this.headersImpl) {
|
|
2164
|
+
return this.headersImpl;
|
|
2165
|
+
}
|
|
2166
|
+
if (typeof self !== 'undefined' && 'Headers' in self) {
|
|
2167
|
+
return self.Headers;
|
|
2168
|
+
}
|
|
2169
|
+
throw new Error('Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');
|
|
2170
|
+
}
|
|
2171
|
+
static response() {
|
|
2172
|
+
if (this.responseImpl) {
|
|
2173
|
+
return this.responseImpl;
|
|
2174
|
+
}
|
|
2175
|
+
if (typeof self !== 'undefined' && 'Response' in self) {
|
|
2176
|
+
return self.Response;
|
|
2177
|
+
}
|
|
2178
|
+
throw new Error('Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
|
|
2124
2182
|
exports.CONSTANTS = CONSTANTS;
|
|
2125
2183
|
exports.DecodeBase64StringError = DecodeBase64StringError;
|
|
2126
2184
|
exports.Deferred = Deferred;
|
|
2127
2185
|
exports.ErrorFactory = ErrorFactory;
|
|
2186
|
+
exports.FetchProvider = FetchProvider;
|
|
2128
2187
|
exports.FirebaseError = FirebaseError;
|
|
2129
2188
|
exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS;
|
|
2130
2189
|
exports.RANDOM_FACTOR = RANDOM_FACTOR;
|