@progressive-development/pd-provider-firebase-functions 0.2.0 → 0.3.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.
@@ -1,6 +1,8 @@
1
1
  import { Firestore } from 'firebase-admin/firestore';
2
2
  /**
3
3
  * Get Firestore instance (cached)
4
+ *
5
+ * Uses the default Firebase app - consumer must call initializeApp() first.
4
6
  * @param databaseId Optional named database
5
7
  */
6
8
  export declare function getDb(databaseId?: string): Firestore;
@@ -1 +1 @@
1
- {"version":3,"file":"firestore.d.ts","sourceRoot":"","sources":["../src/firestore.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAKnE;;;GAGG;AACH,wBAAgB,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAepD"}
1
+ {"version":3,"file":"firestore.d.ts","sourceRoot":"","sources":["../src/firestore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAInE;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAWpD"}
package/dist/firestore.js CHANGED
@@ -1,15 +1,10 @@
1
- import { initializeApp } from 'firebase-admin/app';
2
1
  import { getFirestore } from 'firebase-admin/firestore';
3
2
 
4
- let app;
5
3
  const dbCache = /* @__PURE__ */ new Map();
6
4
  function getDb(databaseId) {
7
5
  const cacheKey = databaseId ?? "default";
8
6
  if (!dbCache.has(cacheKey)) {
9
- if (!app) {
10
- app = initializeApp();
11
- }
12
- const db = databaseId ? getFirestore(app, databaseId) : getFirestore(app);
7
+ const db = databaseId ? getFirestore(databaseId) : getFirestore();
13
8
  db.settings({ ignoreUndefinedProperties: true });
14
9
  dbCache.set(cacheKey, db);
15
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progressive-development/pd-provider-firebase-functions",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Firebase Functions v2 utilities for pd-spa-helper backend",
5
5
  "author": "PD Progressive Development",
6
6
  "license": "SEE LICENSE IN LICENSE",