mayo-firebase-config 1.0.13 → 1.2.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.
package/README.md CHANGED
@@ -19,7 +19,7 @@ Use the extractFirebaseConfig function in your React Native code as follows:
19
19
 
20
20
  import { extractFirebaseConfig } from 'mayo-firebase-config';
21
21
 
22
- const firebaseConfig = extractFirebaseConfig();
22
+ const firebaseConfig = await extractFirebaseConfig();
23
23
  console.log(firebaseConfig);
24
24
 
25
25
  ```
@@ -1,10 +1,19 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.extractFirebaseConfig = void 0;
4
13
  const react_native_1 = require("react-native");
5
14
  const mayo_logger_1 = require("mayo-logger");
6
15
  const { FirebaseConfigExtractor } = react_native_1.NativeModules;
7
- const extractFirebaseConfig = () => {
16
+ const extractFirebaseConfig = () => __awaiter(void 0, void 0, void 0, function* () {
8
17
  mayo_logger_1.Logger.info('Starting Firebase config extraction...', null, { tag: 'mayo-firebase-config-extractor' });
9
18
  const config = FirebaseConfigExtractor.extractConfig();
10
19
  if (config && typeof config === 'object' && Object.keys(config).length > 0) {
@@ -16,5 +25,5 @@ const extractFirebaseConfig = () => {
16
25
  // This log may expose sensitive information, so be cautious about using it in a production environment
17
26
  mayo_logger_1.Logger.info('Extracted Firebase config:', { config }, { tag: 'mayo-firebase-config-extractor' });
18
27
  return config;
19
- };
28
+ });
20
29
  exports.extractFirebaseConfig = extractFirebaseConfig;
package/index.d.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  declare module 'mayo-firebase-config' {
2
- export function extractFirebaseConfig(): {
2
+ export interface FirebaseConfig {
3
3
  apiKey: string;
4
4
  authDomain: string;
5
5
  projectId: string;
6
6
  storageBucket: string;
7
7
  messagingSenderId: string;
8
8
  appId: string;
9
- measurementId: string;
10
- databaseURL: string;
9
+ measurementId?: string;
10
+ databaseURL?: string;
11
11
  webClientId?: string;
12
- };
12
+ [key: string]: string | undefined;
13
+ }
14
+
15
+ export function extractFirebaseConfig(): Promise<FirebaseConfig>;
13
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mayo-firebase-config",
3
- "version": "1.0.13",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "author": "Mohamed Bennekrouf",
6
6
  "main": "dist/index.js",
@@ -19,13 +19,12 @@
19
19
  "devDependencies": {
20
20
  "@types/react": "^18.2.21",
21
21
  "@types/react-native": "^0.72.2",
22
- "react": "18.2.0",
23
- "react-native": "^0.72.5",
24
22
  "typescript": "^5.2.2"
25
23
  },
26
24
  "peerDependencies": {
27
- "react-native": ">=0.59.0",
28
- "react-native-device-info": "^10.11.0"
25
+ "react-native-device-info": "^10.11.0",
26
+ "react-native": "^0.60.0 || ^0.72.0 || ^1000.0.0",
27
+ "react": "^18.2.0"
29
28
  },
30
29
  "resolutions": {
31
30
  "react": "18.2.0"
@@ -1,22 +1,10 @@
1
1
  import { NativeModules } from 'react-native';
2
2
  import { Logger } from 'mayo-logger';
3
-
4
- interface FirebaseConfig {
5
- apiKey: string;
6
- authDomain: string;
7
- projectId: string;
8
- storageBucket: string;
9
- messagingSenderId: string;
10
- appId: string;
11
- measurementId?: string;
12
- databaseURL?: string;
13
- webClientId?: string;
14
- [key: string]: string | undefined;
15
- }
3
+ import { FirebaseConfig } from 'mayo-firebase-config'; // import the type from the module
16
4
 
17
5
  const { FirebaseConfigExtractor } = NativeModules;
18
6
 
19
- export const extractFirebaseConfig = (): FirebaseConfig => {
7
+ export const extractFirebaseConfig = async (): Promise<FirebaseConfig> => {
20
8
  Logger.info('Starting Firebase config extraction...', null, { tag: 'mayo-firebase-config-extractor' });
21
9
 
22
10
  const config: FirebaseConfig = FirebaseConfigExtractor.extractConfig();