@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.
@@ -37,3 +37,4 @@ export * from './src/exponential_backoff';
37
37
  export * from './src/formatters';
38
38
  export * from './src/compat';
39
39
  export * from './src/global';
40
+ export * from './src/fetch_provider';
@@ -37,3 +37,4 @@ export * from './src/exponential_backoff';
37
37
  export * from './src/formatters';
38
38
  export * from './src/compat';
39
39
  export * from './src/global';
40
+ export * from './src/fetch_provider';
@@ -37,3 +37,4 @@ export * from './src/exponential_backoff';
37
37
  export * from './src/formatters';
38
38
  export * from './src/compat';
39
39
  export * from './src/global';
40
+ export * from './src/fetch_provider';
@@ -634,7 +634,7 @@ class Deferred {
634
634
  });
635
635
  }
636
636
  /**
637
- * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around
637
+ * Our API internals are not promisified and cannot because our callback APIs have subtle expectations around
638
638
  * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback
639
639
  * and returns a node-style callback which will resolve or reject the Deferred's promise.
640
640
  */
@@ -776,6 +776,9 @@ function isNode() {
776
776
  }
777
777
  /**
778
778
  * Detect Browser Environment
779
+ * Note: This will return true for certain test frameworks that are incompletely
780
+ * mimicking a browser, and should not lead to assuming all browser APIs are
781
+ * available.
779
782
  */
780
783
  function isBrowser() {
781
784
  return typeof window !== 'undefined' || isWebWorker();
@@ -911,7 +914,7 @@ function areCookiesEnabled() {
911
914
  *
912
915
  * Usage:
913
916
  *
914
- * // Typescript string literals for type-safe codes
917
+ * // TypeScript string literals for type-safe codes
915
918
  * type Err =
916
919
  * 'unknown' |
917
920
  * 'object-not-found'
@@ -1022,7 +1025,7 @@ function jsonEval(str) {
1022
1025
  }
1023
1026
  /**
1024
1027
  * Returns JSON representing a javascript object.
1025
- * @param {*} data Javascript object to be stringified.
1028
+ * @param {*} data JavaScript object to be stringified.
1026
1029
  * @return {string} The JSON contents of the object.
1027
1030
  */
1028
1031
  function stringify(data) {
@@ -1625,7 +1628,7 @@ class ObserverProxy {
1625
1628
  /**
1626
1629
  * Subscribe function that can be used to add an Observer to the fan-out list.
1627
1630
  *
1628
- * - We require that no event is sent to a subscriber sychronously to their
1631
+ * - We require that no event is sent to a subscriber synchronously to their
1629
1632
  * call to subscribe().
1630
1633
  */
1631
1634
  subscribe(nextOrObserver, error, complete) {
@@ -1886,7 +1889,7 @@ function validateContextObject(fnName, argumentName, context, optional) {
1886
1889
  // so it's been modified.
1887
1890
  // Note that not all Unicode characters appear as single characters in JavaScript strings.
1888
1891
  // fromCharCode returns the UTF-16 encoding of a character - so some Unicode characters
1889
- // use 2 characters in Javascript. All 4-byte UTF-8 characters begin with a first
1892
+ // use 2 characters in JavaScript. All 4-byte UTF-8 characters begin with a first
1890
1893
  // character in the range 0xD800 - 0xDBFF (the first character of a so-called surrogate
1891
1894
  // pair).
1892
1895
  // See http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3
@@ -2117,6 +2120,61 @@ function getModularInstance(service) {
2117
2120
  }
2118
2121
  }
2119
2122
 
2123
+ /**
2124
+ * @license
2125
+ * Copyright 2023 Google LLC
2126
+ *
2127
+ * Licensed under the Apache License, Version 2.0 (the "License");
2128
+ * you may not use this file except in compliance with the License.
2129
+ * You may obtain a copy of the License at
2130
+ *
2131
+ * http://www.apache.org/licenses/LICENSE-2.0
2132
+ *
2133
+ * Unless required by applicable law or agreed to in writing, software
2134
+ * distributed under the License is distributed on an "AS IS" BASIS,
2135
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2136
+ * See the License for the specific language governing permissions and
2137
+ * limitations under the License.
2138
+ */
2139
+ class FetchProvider {
2140
+ static initialize(fetchImpl, headersImpl, responseImpl) {
2141
+ this.fetchImpl = fetchImpl;
2142
+ if (headersImpl) {
2143
+ this.headersImpl = headersImpl;
2144
+ }
2145
+ if (responseImpl) {
2146
+ this.responseImpl = responseImpl;
2147
+ }
2148
+ }
2149
+ static fetch() {
2150
+ if (this.fetchImpl) {
2151
+ return this.fetchImpl;
2152
+ }
2153
+ if (typeof self !== 'undefined' && 'fetch' in self) {
2154
+ return self.fetch;
2155
+ }
2156
+ throw new Error('Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');
2157
+ }
2158
+ static headers() {
2159
+ if (this.headersImpl) {
2160
+ return this.headersImpl;
2161
+ }
2162
+ if (typeof self !== 'undefined' && 'Headers' in self) {
2163
+ return self.Headers;
2164
+ }
2165
+ throw new Error('Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');
2166
+ }
2167
+ static response() {
2168
+ if (this.responseImpl) {
2169
+ return this.responseImpl;
2170
+ }
2171
+ if (typeof self !== 'undefined' && 'Response' in self) {
2172
+ return self.Response;
2173
+ }
2174
+ throw new Error('Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill');
2175
+ }
2176
+ }
2177
+
2120
2178
  /**
2121
2179
  * @license
2122
2180
  * Copyright 2017 Google LLC
@@ -2136,5 +2194,5 @@ function getModularInstance(service) {
2136
2194
  // Overriding the constant (we should be the only ones doing this)
2137
2195
  CONSTANTS.NODE_CLIENT = true;
2138
2196
 
2139
- export { CONSTANTS, DecodeBase64StringError, 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, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getDefaults, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, isWebWorker, issuedAtTime, jsonEval, map, ordinal, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, uuidv4, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
2197
+ export { CONSTANTS, DecodeBase64StringError, Deferred, ErrorFactory, FetchProvider, 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, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getDefaults, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, isWebWorker, issuedAtTime, jsonEval, map, ordinal, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, uuidv4, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
2140
2198
  //# sourceMappingURL=index.node.esm.js.map