@firebase/util 1.9.7-dataconnect-preview.d986d4bf2 → 1.10.0-20240916151535

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 CHANGED
@@ -779,7 +779,7 @@ function isNode() {
779
779
  }
780
780
  }
781
781
  /**
782
- * Detect Browser Environment
782
+ * Detect Browser Environment.
783
783
  * Note: This will return true for certain test frameworks that are incompletely
784
784
  * mimicking a browser, and should not lead to assuming all browser APIs are
785
785
  * available.
@@ -788,13 +788,20 @@ function isBrowser() {
788
788
  return typeof window !== 'undefined' || isWebWorker();
789
789
  }
790
790
  /**
791
- * Detect Web Worker context
791
+ * Detect Web Worker context.
792
792
  */
793
793
  function isWebWorker() {
794
794
  return (typeof WorkerGlobalScope !== 'undefined' &&
795
795
  typeof self !== 'undefined' &&
796
796
  self instanceof WorkerGlobalScope);
797
797
  }
798
+ /**
799
+ * Detect Cloudflare Worker context.
800
+ */
801
+ function isCloudflareWorker() {
802
+ return (typeof navigator !== 'undefined' &&
803
+ navigator.userAgent === 'Cloudflare-Workers');
804
+ }
798
805
  function isBrowserExtension() {
799
806
  const runtime = typeof chrome === 'object'
800
807
  ? chrome.runtime
@@ -2124,66 +2131,10 @@ function getModularInstance(service) {
2124
2131
  }
2125
2132
  }
2126
2133
 
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
-
2182
2134
  exports.CONSTANTS = CONSTANTS;
2183
2135
  exports.DecodeBase64StringError = DecodeBase64StringError;
2184
2136
  exports.Deferred = Deferred;
2185
2137
  exports.ErrorFactory = ErrorFactory;
2186
- exports.FetchProvider = FetchProvider;
2187
2138
  exports.FirebaseError = FirebaseError;
2188
2139
  exports.MAX_VALUE_MILLIS = MAX_VALUE_MILLIS;
2189
2140
  exports.RANDOM_FACTOR = RANDOM_FACTOR;
@@ -2217,6 +2168,7 @@ exports.getUA = getUA;
2217
2168
  exports.isAdmin = isAdmin;
2218
2169
  exports.isBrowser = isBrowser;
2219
2170
  exports.isBrowserExtension = isBrowserExtension;
2171
+ exports.isCloudflareWorker = isCloudflareWorker;
2220
2172
  exports.isElectron = isElectron;
2221
2173
  exports.isEmpty = isEmpty;
2222
2174
  exports.isIE = isIE;