@firebase/util 1.6.3 → 1.7.0-canary.03d1fabcb

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,66 @@
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
+ * @returns a URL host formatted like `127.0.0.1:9999` or `[::1]:4000` if available
46
+ * @public
47
+ */
48
+ export declare const getDefaultEmulatorHost: (productName: string) => string | undefined;
49
+ /**
50
+ * Returns emulator hostname and port stored in the __FIREBASE_DEFAULTS__ object
51
+ * for the given product.
52
+ * @returns a pair of hostname and port like `["::1", 4000]` if available
53
+ * @public
54
+ */
55
+ export declare const getDefaultEmulatorHostnameAndPort: (productName: string) => [hostname: string, port: number] | undefined;
56
+ /**
57
+ * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
58
+ * @public
59
+ */
60
+ export declare const getDefaultAppConfig: () => Record<string, string> | undefined;
61
+ /**
62
+ * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
63
+ * prefixed by "_")
64
+ * @public
65
+ */
66
+ export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,66 @@
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
+ * @returns a URL host formatted like `127.0.0.1:9999` or `[::1]:4000` if available
46
+ * @public
47
+ */
48
+ export declare const getDefaultEmulatorHost: (productName: string) => string | undefined;
49
+ /**
50
+ * Returns emulator hostname and port stored in the __FIREBASE_DEFAULTS__ object
51
+ * for the given product.
52
+ * @returns a pair of hostname and port like `["::1", 4000]` if available
53
+ * @public
54
+ */
55
+ export declare const getDefaultEmulatorHostnameAndPort: (productName: string) => [hostname: string, port: number] | undefined;
56
+ /**
57
+ * Returns Firebase app config stored in the __FIREBASE_DEFAULTS__ object.
58
+ * @public
59
+ */
60
+ export declare const getDefaultAppConfig: () => Record<string, string> | undefined;
61
+ /**
62
+ * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
63
+ * prefixed by "_")
64
+ * @public
65
+ */
66
+ export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
@@ -0,0 +1 @@
1
+ export {};
@@ -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,35 @@ 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
+ * @returns a URL host formatted like `127.0.0.1:9999` or `[::1]:4000` if available
481
+ * @public
482
+ */
483
+ export declare const getDefaultEmulatorHost: (productName: string) => string | undefined;
484
+
485
+ /**
486
+ * Returns emulator hostname and port stored in the __FIREBASE_DEFAULTS__ object
487
+ * for the given product.
488
+ * @returns a pair of hostname and port like `["::1", 4000]` if available
489
+ * @public
490
+ */
491
+ export declare const getDefaultEmulatorHostnameAndPort: (productName: string) => [hostname: string, port: number] | undefined;
492
+
493
+ /**
494
+ * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
495
+ * prefixed by "_")
496
+ * @public
497
+ */
498
+ export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
499
+
431
500
  /**
432
501
  * Polyfill for `globalThis` object.
433
502
  * @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,35 @@ 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
+ * @returns a URL host formatted like `127.0.0.1:9999` or `[::1]:4000` if available
481
+ * @public
482
+ */
483
+ export declare const getDefaultEmulatorHost: (productName: string) => string | undefined;
484
+
485
+ /**
486
+ * Returns emulator hostname and port stored in the __FIREBASE_DEFAULTS__ object
487
+ * for the given product.
488
+ * @returns a pair of hostname and port like `["::1", 4000]` if available
489
+ * @public
490
+ */
491
+ export declare const getDefaultEmulatorHostnameAndPort: (productName: string) => [hostname: string, port: number] | undefined;
492
+
493
+ /**
494
+ * Returns an experimental setting on the __FIREBASE_DEFAULTS__ object (properties
495
+ * prefixed by "_")
496
+ * @public
497
+ */
498
+ export declare const getExperimentalSetting: <T extends ExperimentalKey>(name: T) => FirebaseDefaults[`_${T}`];
499
+
431
500
  /**
432
501
  * Polyfill for `globalThis` object.
433
502
  * @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-canary.03d1fabcb",
4
4
  "description": "",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.node.cjs.js",