@firebase/util 1.8.0 → 1.9.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.
@@ -34,11 +34,24 @@ export interface FirebaseDefaults {
34
34
  emulatorHosts?: Record<string, string>;
35
35
  _authTokenSyncURL?: string;
36
36
  _authIdTokenMaxAge?: number;
37
+ /**
38
+ * Override Firebase's runtime environment detection and
39
+ * force the SDK to act as if it were in the specified environment.
40
+ */
41
+ forceEnvironment?: 'browser' | 'node';
37
42
  [key: string]: unknown;
38
43
  }
39
44
  declare global {
40
45
  var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined;
41
46
  }
47
+ /**
48
+ * Get the __FIREBASE_DEFAULTS__ object. It checks in order:
49
+ * (1) if such an object exists as a property of `globalThis`
50
+ * (2) if such an object was provided on a shell environment variable
51
+ * (3) if such an object exists in a cookie
52
+ * @public
53
+ */
54
+ export declare const getDefaults: () => FirebaseDefaults | undefined;
42
55
  /**
43
56
  * Returns emulator host stored in the __FIREBASE_DEFAULTS__ object
44
57
  * for the given product.
@@ -30,7 +30,7 @@ export declare function isMobileCordova(): boolean;
30
30
  /**
31
31
  * Detect Node.js.
32
32
  *
33
- * @return true if Node.js environment is detected.
33
+ * @return true if Node.js environment is detected or specified.
34
34
  */
35
35
  export declare function isNode(): boolean;
36
36
  /**
@@ -77,8 +77,3 @@ export declare function validateIndexedDBOpenable(): Promise<boolean>;
77
77
  * @return true if cookie is enabled within current browser
78
78
  */
79
79
  export declare function areCookiesEnabled(): boolean;
80
- /**
81
- * Polyfill for `globalThis` object.
82
- * @returns the `globalThis` object for the given environment.
83
- */
84
- export declare function getGlobal(): typeof globalThis;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Polyfill for `globalThis` object.
19
+ * @returns the `globalThis` object for the given environment.
20
+ * @public
21
+ */
22
+ export declare function getGlobal(): typeof globalThis;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
@@ -34,11 +34,24 @@ export interface FirebaseDefaults {
34
34
  emulatorHosts?: Record<string, string>;
35
35
  _authTokenSyncURL?: string;
36
36
  _authIdTokenMaxAge?: number;
37
+ /**
38
+ * Override Firebase's runtime environment detection and
39
+ * force the SDK to act as if it were in the specified environment.
40
+ */
41
+ forceEnvironment?: 'browser' | 'node';
37
42
  [key: string]: unknown;
38
43
  }
39
44
  declare global {
40
45
  var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined;
41
46
  }
47
+ /**
48
+ * Get the __FIREBASE_DEFAULTS__ object. It checks in order:
49
+ * (1) if such an object exists as a property of `globalThis`
50
+ * (2) if such an object was provided on a shell environment variable
51
+ * (3) if such an object exists in a cookie
52
+ * @public
53
+ */
54
+ export declare const getDefaults: () => FirebaseDefaults | undefined;
42
55
  /**
43
56
  * Returns emulator host stored in the __FIREBASE_DEFAULTS__ object
44
57
  * for the given product.
@@ -30,7 +30,7 @@ export declare function isMobileCordova(): boolean;
30
30
  /**
31
31
  * Detect Node.js.
32
32
  *
33
- * @return true if Node.js environment is detected.
33
+ * @return true if Node.js environment is detected or specified.
34
34
  */
35
35
  export declare function isNode(): boolean;
36
36
  /**
@@ -77,8 +77,3 @@ export declare function validateIndexedDBOpenable(): Promise<boolean>;
77
77
  * @return true if cookie is enabled within current browser
78
78
  */
79
79
  export declare function areCookiesEnabled(): boolean;
80
- /**
81
- * Polyfill for `globalThis` object.
82
- * @returns the `globalThis` object for the given environment.
83
- */
84
- export declare function getGlobal(): typeof globalThis;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Polyfill for `globalThis` object.
19
+ * @returns the `globalThis` object for the given environment.
20
+ * @public
21
+ */
22
+ export declare function getGlobal(): typeof globalThis;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export {};
@@ -409,6 +409,11 @@ export declare interface FirebaseDefaults {
409
409
  emulatorHosts?: Record<string, string>;
410
410
  _authTokenSyncURL?: string;
411
411
  _authIdTokenMaxAge?: number;
412
+ /**
413
+ * Override Firebase's runtime environment detection and
414
+ * force the SDK to act as if it were in the specified environment.
415
+ */
416
+ forceEnvironment?: 'browser' | 'node';
412
417
  [key: string]: unknown;
413
418
  }
414
419
 
@@ -490,6 +495,15 @@ export declare const getDefaultEmulatorHost: (productName: string) => string | u
490
495
  */
491
496
  export declare const getDefaultEmulatorHostnameAndPort: (productName: string) => [hostname: string, port: number] | undefined;
492
497
 
498
+ /**
499
+ * Get the __FIREBASE_DEFAULTS__ object. It checks in order:
500
+ * (1) if such an object exists as a property of `globalThis`
501
+ * (2) if such an object was provided on a shell environment variable
502
+ * (3) if such an object exists in a cookie
503
+ * @public
504
+ */
505
+ export declare const getDefaults: () => FirebaseDefaults | undefined;
506
+
493
507
  /**
494
508
  * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
495
509
  * prefixed by "_")
@@ -497,9 +511,26 @@ export declare const getDefaultEmulatorHostnameAndPort: (productName: string) =>
497
511
  */
498
512
  export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
499
513
 
514
+ /**
515
+ * @license
516
+ * Copyright 2022 Google LLC
517
+ *
518
+ * Licensed under the Apache License, Version 2.0 (the "License");
519
+ * you may not use this file except in compliance with the License.
520
+ * You may obtain a copy of the License at
521
+ *
522
+ * http://www.apache.org/licenses/LICENSE-2.0
523
+ *
524
+ * Unless required by applicable law or agreed to in writing, software
525
+ * distributed under the License is distributed on an "AS IS" BASIS,
526
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
527
+ * See the License for the specific language governing permissions and
528
+ * limitations under the License.
529
+ */
500
530
  /**
501
531
  * Polyfill for `globalThis` object.
502
532
  * @returns the `globalThis` object for the given environment.
533
+ * @public
503
534
  */
504
535
  export declare function getGlobal(): typeof globalThis;
505
536
 
@@ -569,7 +600,7 @@ export declare function isMobileCordova(): boolean;
569
600
  /**
570
601
  * Detect Node.js.
571
602
  *
572
- * @return true if Node.js environment is detected.
603
+ * @return true if Node.js environment is detected or specified.
573
604
  */
574
605
  export declare function isNode(): boolean;
575
606
 
package/dist/util.d.ts CHANGED
@@ -409,6 +409,11 @@ export declare interface FirebaseDefaults {
409
409
  emulatorHosts?: Record<string, string>;
410
410
  _authTokenSyncURL?: string;
411
411
  _authIdTokenMaxAge?: number;
412
+ /**
413
+ * Override Firebase's runtime environment detection and
414
+ * force the SDK to act as if it were in the specified environment.
415
+ */
416
+ forceEnvironment?: 'browser' | 'node';
412
417
  [key: string]: unknown;
413
418
  }
414
419
 
@@ -490,6 +495,15 @@ export declare const getDefaultEmulatorHost: (productName: string) => string | u
490
495
  */
491
496
  export declare const getDefaultEmulatorHostnameAndPort: (productName: string) => [hostname: string, port: number] | undefined;
492
497
 
498
+ /**
499
+ * Get the __FIREBASE_DEFAULTS__ object. It checks in order:
500
+ * (1) if such an object exists as a property of `globalThis`
501
+ * (2) if such an object was provided on a shell environment variable
502
+ * (3) if such an object exists in a cookie
503
+ * @public
504
+ */
505
+ export declare const getDefaults: () => FirebaseDefaults | undefined;
506
+
493
507
  /**
494
508
  * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
495
509
  * prefixed by "_")
@@ -497,9 +511,26 @@ export declare const getDefaultEmulatorHostnameAndPort: (productName: string) =>
497
511
  */
498
512
  export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
499
513
 
514
+ /**
515
+ * @license
516
+ * Copyright 2022 Google LLC
517
+ *
518
+ * Licensed under the Apache License, Version 2.0 (the "License");
519
+ * you may not use this file except in compliance with the License.
520
+ * You may obtain a copy of the License at
521
+ *
522
+ * http://www.apache.org/licenses/LICENSE-2.0
523
+ *
524
+ * Unless required by applicable law or agreed to in writing, software
525
+ * distributed under the License is distributed on an "AS IS" BASIS,
526
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
527
+ * See the License for the specific language governing permissions and
528
+ * limitations under the License.
529
+ */
500
530
  /**
501
531
  * Polyfill for `globalThis` object.
502
532
  * @returns the `globalThis` object for the given environment.
533
+ * @public
503
534
  */
504
535
  export declare function getGlobal(): typeof globalThis;
505
536
 
@@ -569,7 +600,7 @@ export declare function isMobileCordova(): boolean;
569
600
  /**
570
601
  * Detect Node.js.
571
602
  *
572
- * @return true if Node.js environment is detected.
603
+ * @return true if Node.js environment is detected or specified.
573
604
  */
574
605
  export declare function isNode(): boolean;
575
606
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/util",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.node.cjs.js",