@firebase/util 1.6.3 → 1.7.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.
@@ -0,0 +1,58 @@
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
+ * Keys for experimental properties on the `FirebaseDefaults` object.
19
+ * @public
20
+ */
21
+ export declare type ExperimentalKey = 'authTokenSyncURL' | 'authIdTokenMaxAge';
22
+ /**
23
+ * An object that can be injected into the environment as __FIREBASE_DEFAULTS__,
24
+ * either as a property of globalThis, a shell environment variable, or a
25
+ * cookie.
26
+ *
27
+ * This object can be used to automatically configure and initialize
28
+ * a Firebase app as well as any emulators.
29
+ *
30
+ * @public
31
+ */
32
+ export interface FirebaseDefaults {
33
+ config?: Record<string, string>;
34
+ emulatorHosts?: Record<string, string>;
35
+ _authTokenSyncURL?: string;
36
+ _authIdTokenMaxAge?: number;
37
+ [key: string]: unknown;
38
+ }
39
+ declare global {
40
+ var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined;
41
+ }
42
+ /**
43
+ * Returns emulator host stored in the __FIREBASE_DEFAULTS__ object
44
+ * for the given product.
45
+ * @public
46
+ */
47
+ export declare const getDefaultEmulatorHost: (productName: string) => string | undefined;
48
+ /**
49
+ * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
50
+ * @public
51
+ */
52
+ export declare const getDefaultAppConfig: () => Record<string, string> | undefined;
53
+ /**
54
+ * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
55
+ * prefixed by "_")
56
+ * @public
57
+ */
58
+ export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
@@ -0,0 +1,58 @@
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
+ * Keys for experimental properties on the `FirebaseDefaults` object.
19
+ * @public
20
+ */
21
+ export declare type ExperimentalKey = 'authTokenSyncURL' | 'authIdTokenMaxAge';
22
+ /**
23
+ * An object that can be injected into the environment as __FIREBASE_DEFAULTS__,
24
+ * either as a property of globalThis, a shell environment variable, or a
25
+ * cookie.
26
+ *
27
+ * This object can be used to automatically configure and initialize
28
+ * a Firebase app as well as any emulators.
29
+ *
30
+ * @public
31
+ */
32
+ export interface FirebaseDefaults {
33
+ config?: Record<string, string>;
34
+ emulatorHosts?: Record<string, string>;
35
+ _authTokenSyncURL?: string;
36
+ _authIdTokenMaxAge?: number;
37
+ [key: string]: unknown;
38
+ }
39
+ declare global {
40
+ var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined;
41
+ }
42
+ /**
43
+ * Returns emulator host stored in the __FIREBASE_DEFAULTS__ object
44
+ * for the given product.
45
+ * @public
46
+ */
47
+ export declare const getDefaultEmulatorHost: (productName: string) => string | undefined;
48
+ /**
49
+ * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
50
+ * @public
51
+ */
52
+ export declare const getDefaultAppConfig: () => Record<string, string> | undefined;
53
+ /**
54
+ * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
55
+ * prefixed by "_")
56
+ * @public
57
+ */
58
+ export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
@@ -367,11 +367,51 @@ export declare function errorPrefix(fnName: string, argName: string): string;
367
367
 
368
368
  export declare type Executor<T> = (observer: Observer<T>) => void;
369
369
 
370
+ /**
371
+ * @license
372
+ * Copyright 2022 Google LLC
373
+ *
374
+ * Licensed under the Apache License, Version 2.0 (the "License");
375
+ * you may not use this file except in compliance with the License.
376
+ * You may obtain a copy of the License at
377
+ *
378
+ * http://www.apache.org/licenses/LICENSE-2.0
379
+ *
380
+ * Unless required by applicable law or agreed to in writing, software
381
+ * distributed under the License is distributed on an "AS IS" BASIS,
382
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
383
+ * See the License for the specific language governing permissions and
384
+ * limitations under the License.
385
+ */
386
+ /**
387
+ * Keys for experimental properties on the `FirebaseDefaults` object.
388
+ * @public
389
+ */
390
+ export declare type ExperimentalKey = 'authTokenSyncURL' | 'authIdTokenMaxAge';
391
+
370
392
  /**
371
393
  * Extract the query string part of a URL, including the leading question mark (if present).
372
394
  */
373
395
  export declare function extractQuerystring(url: string): string;
374
396
 
397
+ /**
398
+ * An object that can be injected into the environment as __FIREBASE_DEFAULTS__,
399
+ * either as a property of globalThis, a shell environment variable, or a
400
+ * cookie.
401
+ *
402
+ * This object can be used to automatically configure and initialize
403
+ * a Firebase app as well as any emulators.
404
+ *
405
+ * @public
406
+ */
407
+ export declare interface FirebaseDefaults {
408
+ config?: Record<string, string>;
409
+ emulatorHosts?: Record<string, string>;
410
+ _authTokenSyncURL?: string;
411
+ _authIdTokenMaxAge?: number;
412
+ [key: string]: unknown;
413
+ }
414
+
375
415
  export declare class FirebaseError extends Error {
376
416
  /** The error code for this error. */
377
417
  readonly code: string;
@@ -428,6 +468,26 @@ declare interface FirebaseIdToken {
428
468
  */
429
469
  export declare type FirebaseSignInProvider = 'custom' | 'email' | 'password' | 'phone' | 'anonymous' | 'google.com' | 'facebook.com' | 'github.com' | 'twitter.com' | 'microsoft.com' | 'apple.com';
430
470
 
471
+ /**
472
+ * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
473
+ * @public
474
+ */
475
+ export declare const getDefaultAppConfig: () => Record<string, string> | undefined;
476
+
477
+ /**
478
+ * Returns emulator host stored in the __FIREBASE_DEFAULTS__ object
479
+ * for the given product.
480
+ * @public
481
+ */
482
+ export declare const getDefaultEmulatorHost: (productName: string) => string | undefined;
483
+
484
+ /**
485
+ * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
486
+ * prefixed by "_")
487
+ * @public
488
+ */
489
+ export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
490
+
431
491
  /**
432
492
  * Polyfill for `globalThis` object.
433
493
  * @returns the `globalThis` object for the given environment.
package/dist/util.d.ts CHANGED
@@ -367,11 +367,51 @@ export declare function errorPrefix(fnName: string, argName: string): string;
367
367
 
368
368
  export declare type Executor<T> = (observer: Observer<T>) => void;
369
369
 
370
+ /**
371
+ * @license
372
+ * Copyright 2022 Google LLC
373
+ *
374
+ * Licensed under the Apache License, Version 2.0 (the "License");
375
+ * you may not use this file except in compliance with the License.
376
+ * You may obtain a copy of the License at
377
+ *
378
+ * http://www.apache.org/licenses/LICENSE-2.0
379
+ *
380
+ * Unless required by applicable law or agreed to in writing, software
381
+ * distributed under the License is distributed on an "AS IS" BASIS,
382
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
383
+ * See the License for the specific language governing permissions and
384
+ * limitations under the License.
385
+ */
386
+ /**
387
+ * Keys for experimental properties on the `FirebaseDefaults` object.
388
+ * @public
389
+ */
390
+ export declare type ExperimentalKey = 'authTokenSyncURL' | 'authIdTokenMaxAge';
391
+
370
392
  /**
371
393
  * Extract the query string part of a URL, including the leading question mark (if present).
372
394
  */
373
395
  export declare function extractQuerystring(url: string): string;
374
396
 
397
+ /**
398
+ * An object that can be injected into the environment as __FIREBASE_DEFAULTS__,
399
+ * either as a property of globalThis, a shell environment variable, or a
400
+ * cookie.
401
+ *
402
+ * This object can be used to automatically configure and initialize
403
+ * a Firebase app as well as any emulators.
404
+ *
405
+ * @public
406
+ */
407
+ export declare interface FirebaseDefaults {
408
+ config?: Record<string, string>;
409
+ emulatorHosts?: Record<string, string>;
410
+ _authTokenSyncURL?: string;
411
+ _authIdTokenMaxAge?: number;
412
+ [key: string]: unknown;
413
+ }
414
+
375
415
  export declare class FirebaseError extends Error {
376
416
  /** The error code for this error. */
377
417
  readonly code: string;
@@ -428,6 +468,26 @@ declare interface FirebaseIdToken {
428
468
  */
429
469
  export declare type FirebaseSignInProvider = 'custom' | 'email' | 'password' | 'phone' | 'anonymous' | 'google.com' | 'facebook.com' | 'github.com' | 'twitter.com' | 'microsoft.com' | 'apple.com';
430
470
 
471
+ /**
472
+ * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
473
+ * @public
474
+ */
475
+ export declare const getDefaultAppConfig: () => Record<string, string> | undefined;
476
+
477
+ /**
478
+ * Returns emulator host stored in the __FIREBASE_DEFAULTS__ object
479
+ * for the given product.
480
+ * @public
481
+ */
482
+ export declare const getDefaultEmulatorHost: (productName: string) => string | undefined;
483
+
484
+ /**
485
+ * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
486
+ * prefixed by "_")
487
+ * @public
488
+ */
489
+ export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
490
+
431
491
  /**
432
492
  * Polyfill for `globalThis` object.
433
493
  * @returns the `globalThis` object for the given environment.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/util",
3
- "version": "1.6.3",
3
+ "version": "1.7.0",
4
4
  "description": "",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.node.cjs.js",