@hot-updater/firebase 0.35.11 → 0.35.12

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.
@@ -6983,11 +6983,11 @@ const getConfigScaffold = (build) => {
6983
6983
  // Check your .env file and add the credentials
6984
6984
  // Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to your credentials file path
6985
6985
  // Example: GOOGLE_APPLICATION_CREDENTIALS=./firebase-adminsdk-credentials.json
6986
- const credential = admin.credential.applicationDefault();`.trim()
6986
+ const credential = applicationDefault();`.trim()
6987
6987
  }];
6988
6988
  return (0, _hot_updater_cli_tools.createHotUpdaterConfigScaffoldFromBuilder)(new _hot_updater_cli_tools.ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).addImport({
6989
- pkg: "firebase-admin",
6990
- defaultOrNamespace: "admin"
6989
+ pkg: "firebase-admin/app",
6990
+ named: ["applicationDefault"]
6991
6991
  }).setIntermediateCode(helperStatements.map((statement) => statement.code.trim()).join("\n\n")), { helperStatements });
6992
6992
  };
6993
6993
  const setEnv = async ({ applicationCredentials, projectId, storageBucket, build, region }) => {
@@ -6977,11 +6977,11 @@ const getConfigScaffold = (build) => {
6977
6977
  // Check your .env file and add the credentials
6978
6978
  // Set the GOOGLE_APPLICATION_CREDENTIALS environment variable to your credentials file path
6979
6979
  // Example: GOOGLE_APPLICATION_CREDENTIALS=./firebase-adminsdk-credentials.json
6980
- const credential = admin.credential.applicationDefault();`.trim()
6980
+ const credential = applicationDefault();`.trim()
6981
6981
  }];
6982
6982
  return createHotUpdaterConfigScaffoldFromBuilder(new ConfigBuilder().setBuildType(build).setStorage(storageConfig).setDatabase(databaseConfig).addImport({
6983
- pkg: "firebase-admin",
6984
- defaultOrNamespace: "admin"
6983
+ pkg: "firebase-admin/app",
6984
+ named: ["applicationDefault"]
6985
6985
  }).setIntermediateCode(helperStatements.map((statement) => statement.code.trim()).join("\n\n")), { helperStatements });
6986
6986
  };
6987
6987
  const setEnv = async ({ applicationCredentials, projectId, storageBucket, build, region }) => {
package/dist/index.cjs CHANGED
@@ -23,12 +23,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  let _hot_updater_core = require("@hot-updater/core");
25
25
  let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
26
- let firebase_admin = require("firebase-admin");
27
- firebase_admin = __toESM(firebase_admin);
26
+ let firebase_admin_app = require("firebase-admin/app");
27
+ let firebase_admin_firestore = require("firebase-admin/firestore");
28
28
  let fs_promises = require("fs/promises");
29
29
  fs_promises = __toESM(fs_promises);
30
30
  let path = require("path");
31
31
  path = __toESM(path);
32
+ let firebase_admin_storage = require("firebase-admin/storage");
32
33
  //#region src/firebaseDatabase.ts
33
34
  const bundleMatchesQueryWhere = (bundle, where) => {
34
35
  if (!where) return true;
@@ -115,13 +116,7 @@ const convertToBundle = (firestoreData) => {
115
116
  const firebaseDatabase = (0, _hot_updater_plugin_core.createDatabasePlugin)({
116
117
  name: "firebaseDatabase",
117
118
  factory: (config) => {
118
- let app;
119
- try {
120
- app = firebase_admin.default.app();
121
- } catch {
122
- app = firebase_admin.default.initializeApp(config);
123
- }
124
- const db = firebase_admin.default.firestore(app);
119
+ const db = (0, firebase_admin_firestore.getFirestore)((0, firebase_admin_app.getApps)().length ? (0, firebase_admin_app.getApp)() : (0, firebase_admin_app.initializeApp)(config));
125
120
  const bundlesCollection = db.collection("bundles");
126
121
  const targetAppVersionsCollection = db.collection("target_app_versions");
127
122
  return {
@@ -301,13 +296,7 @@ const firebaseStorage = (0, _hot_updater_plugin_core.createUniversalStoragePlugi
301
296
  name: "firebaseStorage",
302
297
  supportedProtocol: "gs",
303
298
  factory: (config) => {
304
- let app;
305
- try {
306
- app = firebase_admin.default.app();
307
- } catch {
308
- app = firebase_admin.default.initializeApp(config);
309
- }
310
- const bucket = app.storage().bucket(config.storageBucket);
299
+ const bucket = (0, firebase_admin_storage.getStorage)((0, firebase_admin_app.getApps)().length ? (0, firebase_admin_app.getApp)() : (0, firebase_admin_app.initializeApp)(config)).bucket(config.storageBucket);
311
300
  const getStorageKey = (0, _hot_updater_plugin_core.createStorageKeyBuilder)(config.basePath);
312
301
  return {
313
302
  node: {
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
2
- import admin from "firebase-admin";
2
+ import { AppOptions } from "firebase-admin/app";
3
3
 
4
4
  //#region src/firebaseDatabase.d.ts
5
- declare const firebaseDatabase: (config: admin.AppOptions, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
5
+ declare const firebaseDatabase: (config: AppOptions, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
6
6
  //#endregion
7
7
  //#region src/firebaseStorage.d.ts
8
- interface FirebaseStorageConfig extends admin.AppOptions {
8
+ interface FirebaseStorageConfig extends AppOptions {
9
9
  storageBucket: string;
10
10
  /**
11
11
  * Base path where bundles will be stored in the bucket
package/dist/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as _$_hot_updater_plugin_core0 from "@hot-updater/plugin-core";
2
- import admin from "firebase-admin";
2
+ import { AppOptions } from "firebase-admin/app";
3
3
 
4
4
  //#region src/firebaseDatabase.d.ts
5
- declare const firebaseDatabase: (config: admin.AppOptions, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
5
+ declare const firebaseDatabase: (config: AppOptions, hooks?: _$_hot_updater_plugin_core0.DatabasePluginHooks) => () => _$_hot_updater_plugin_core0.DatabasePlugin<unknown>;
6
6
  //#endregion
7
7
  //#region src/firebaseStorage.d.ts
8
- interface FirebaseStorageConfig extends admin.AppOptions {
8
+ interface FirebaseStorageConfig extends AppOptions {
9
9
  storageBucket: string;
10
10
  /**
11
11
  * Base path where bundles will be stored in the bucket
package/dist/index.mjs CHANGED
@@ -1,8 +1,10 @@
1
1
  import { DEFAULT_ROLLOUT_COHORT_COUNT, NIL_UUID, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, stripBundleArtifactMetadata } from "@hot-updater/core";
2
2
  import { calculatePagination, createDatabasePlugin, createStorageKeyBuilder, createUniversalStoragePlugin, filterCompatibleAppVersions, getContentType, parseStorageUri, resolveUpdateInfoFromBundles } from "@hot-updater/plugin-core";
3
- import admin from "firebase-admin";
3
+ import { getApp, getApps, initializeApp } from "firebase-admin/app";
4
+ import { getFirestore } from "firebase-admin/firestore";
4
5
  import fs from "fs/promises";
5
6
  import path from "path";
7
+ import { getStorage } from "firebase-admin/storage";
6
8
  //#region src/firebaseDatabase.ts
7
9
  const bundleMatchesQueryWhere = (bundle, where) => {
8
10
  if (!where) return true;
@@ -89,13 +91,7 @@ const convertToBundle = (firestoreData) => {
89
91
  const firebaseDatabase = createDatabasePlugin({
90
92
  name: "firebaseDatabase",
91
93
  factory: (config) => {
92
- let app;
93
- try {
94
- app = admin.app();
95
- } catch {
96
- app = admin.initializeApp(config);
97
- }
98
- const db = admin.firestore(app);
94
+ const db = getFirestore(getApps().length ? getApp() : initializeApp(config));
99
95
  const bundlesCollection = db.collection("bundles");
100
96
  const targetAppVersionsCollection = db.collection("target_app_versions");
101
97
  return {
@@ -275,13 +271,7 @@ const firebaseStorage = createUniversalStoragePlugin({
275
271
  name: "firebaseStorage",
276
272
  supportedProtocol: "gs",
277
273
  factory: (config) => {
278
- let app;
279
- try {
280
- app = admin.app();
281
- } catch {
282
- app = admin.initializeApp(config);
283
- }
284
- const bucket = app.storage().bucket(config.storageBucket);
274
+ const bucket = getStorage(getApps().length ? getApp() : initializeApp(config)).bucket(config.storageBucket);
285
275
  const getStorageKey = createStorageKeyBuilder(config.basePath);
286
276
  return {
287
277
  node: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/firebase",
3
3
  "type": "module",
4
- "version": "0.35.11",
4
+ "version": "0.35.12",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "types": "dist/index.d.cts",
@@ -43,10 +43,10 @@
43
43
  ],
44
44
  "dependencies": {
45
45
  "hono": "4.12.9",
46
- "@hot-updater/cli-tools": "0.35.11",
47
- "@hot-updater/core": "0.35.11",
48
- "@hot-updater/plugin-core": "0.35.11",
49
- "@hot-updater/server": "0.35.11"
46
+ "@hot-updater/core": "0.35.12",
47
+ "@hot-updater/cli-tools": "0.35.12",
48
+ "@hot-updater/plugin-core": "0.35.12",
49
+ "@hot-updater/server": "0.35.12"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"
@@ -55,15 +55,15 @@
55
55
  "@types/node": "^20",
56
56
  "es-toolkit": "^1.32.0",
57
57
  "execa": "9.5.2",
58
- "firebase-admin": "13.6.0",
58
+ "firebase-admin": "14.2.0",
59
59
  "firebase-functions": "6.3.2",
60
60
  "firebase-functions-test": "^3.5.0",
61
61
  "firebase-tools": "^13.32.0",
62
62
  "fkill": "^9.0.0",
63
63
  "mime": "^4.0.4",
64
- "@hot-updater/js": "0.35.11",
65
- "@hot-updater/mock": "0.35.11",
66
- "@hot-updater/test-utils": "0.35.11"
64
+ "@hot-updater/test-utils": "0.35.12",
65
+ "@hot-updater/js": "0.35.12",
66
+ "@hot-updater/mock": "0.35.12"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "firebase-admin": "*",