@hot-updater/firebase 0.33.2 → 0.35.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/dist/firebase/functions/index.cjs +4037 -3129
- package/dist/index.cjs +27 -11
- package/dist/index.mjs +29 -13
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -125,18 +125,34 @@ const firebaseDatabase = (0, _hot_updater_plugin_core.createDatabasePlugin)({
|
|
|
125
125
|
const bundlesCollection = db.collection("bundles");
|
|
126
126
|
const targetAppVersionsCollection = db.collection("target_app_versions");
|
|
127
127
|
return {
|
|
128
|
-
getUpdateInfo
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
async getUpdateInfo(args, context) {
|
|
129
|
+
const channel = args.channel ?? "production";
|
|
130
|
+
const minBundleId = args.minBundleId ?? _hot_updater_core.NIL_UUID;
|
|
131
|
+
if (args._updateStrategy === "appVersion") {
|
|
132
|
+
const querySnapshot = await targetAppVersionsCollection.where("platform", "==", args.platform).where("channel", "==", channel).select("target_app_version").get();
|
|
133
|
+
const compatibleAppVersions = (0, _hot_updater_plugin_core.filterCompatibleAppVersions)(Array.from(new Set(querySnapshot.docs.map((doc) => doc.data().target_app_version).filter((version) => Boolean(version)))), args.appVersion);
|
|
134
|
+
const bundles = (compatibleAppVersions.length > 0 ? await Promise.all(chunkValues(compatibleAppVersions, 10).map((versions) => bundlesCollection.where("platform", "==", args.platform).where("channel", "==", channel).where("enabled", "==", true).where("id", ">=", minBundleId).where("target_app_version", "in", versions).get())) : []).flatMap((snapshot) => snapshot.docs.map((doc) => convertToBundle(doc.data())));
|
|
135
|
+
return (0, _hot_updater_plugin_core.resolveUpdateInfoFromBundles)({
|
|
136
|
+
args: {
|
|
137
|
+
...args,
|
|
138
|
+
channel,
|
|
139
|
+
minBundleId
|
|
140
|
+
},
|
|
141
|
+
bundles,
|
|
142
|
+
context
|
|
143
|
+
});
|
|
138
144
|
}
|
|
139
|
-
|
|
145
|
+
const bundles = (await bundlesCollection.where("platform", "==", args.platform).where("channel", "==", channel).where("enabled", "==", true).where("id", ">=", minBundleId).where("fingerprint_hash", "==", args.fingerprintHash).get()).docs.map((doc) => convertToBundle(doc.data()));
|
|
146
|
+
return (0, _hot_updater_plugin_core.resolveUpdateInfoFromBundles)({
|
|
147
|
+
args: {
|
|
148
|
+
...args,
|
|
149
|
+
channel,
|
|
150
|
+
minBundleId
|
|
151
|
+
},
|
|
152
|
+
bundles,
|
|
153
|
+
context
|
|
154
|
+
});
|
|
155
|
+
},
|
|
140
156
|
async getBundleById(bundleId) {
|
|
141
157
|
const bundleSnap = await bundlesCollection.doc(bundleId).get();
|
|
142
158
|
if (!bundleSnap.exists) return null;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_ROLLOUT_COHORT_COUNT, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, stripBundleArtifactMetadata } from "@hot-updater/core";
|
|
2
|
-
import { calculatePagination, createDatabasePlugin,
|
|
1
|
+
import { DEFAULT_ROLLOUT_COHORT_COUNT, NIL_UUID, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, getPatchBaseBundleId, getPatchBaseFileHash, getPatchFileHash, getPatchStorageUri, stripBundleArtifactMetadata } from "@hot-updater/core";
|
|
2
|
+
import { calculatePagination, createDatabasePlugin, createStorageKeyBuilder, createUniversalStoragePlugin, filterCompatibleAppVersions, getContentType, parseStorageUri, resolveUpdateInfoFromBundles } from "@hot-updater/plugin-core";
|
|
3
3
|
import admin from "firebase-admin";
|
|
4
4
|
import fs from "fs/promises";
|
|
5
5
|
import path from "path";
|
|
@@ -99,18 +99,34 @@ const firebaseDatabase = createDatabasePlugin({
|
|
|
99
99
|
const bundlesCollection = db.collection("bundles");
|
|
100
100
|
const targetAppVersionsCollection = db.collection("target_app_versions");
|
|
101
101
|
return {
|
|
102
|
-
getUpdateInfo
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
async getUpdateInfo(args, context) {
|
|
103
|
+
const channel = args.channel ?? "production";
|
|
104
|
+
const minBundleId = args.minBundleId ?? NIL_UUID;
|
|
105
|
+
if (args._updateStrategy === "appVersion") {
|
|
106
|
+
const querySnapshot = await targetAppVersionsCollection.where("platform", "==", args.platform).where("channel", "==", channel).select("target_app_version").get();
|
|
107
|
+
const compatibleAppVersions = filterCompatibleAppVersions(Array.from(new Set(querySnapshot.docs.map((doc) => doc.data().target_app_version).filter((version) => Boolean(version)))), args.appVersion);
|
|
108
|
+
const bundles = (compatibleAppVersions.length > 0 ? await Promise.all(chunkValues(compatibleAppVersions, 10).map((versions) => bundlesCollection.where("platform", "==", args.platform).where("channel", "==", channel).where("enabled", "==", true).where("id", ">=", minBundleId).where("target_app_version", "in", versions).get())) : []).flatMap((snapshot) => snapshot.docs.map((doc) => convertToBundle(doc.data())));
|
|
109
|
+
return resolveUpdateInfoFromBundles({
|
|
110
|
+
args: {
|
|
111
|
+
...args,
|
|
112
|
+
channel,
|
|
113
|
+
minBundleId
|
|
114
|
+
},
|
|
115
|
+
bundles,
|
|
116
|
+
context
|
|
117
|
+
});
|
|
112
118
|
}
|
|
113
|
-
|
|
119
|
+
const bundles = (await bundlesCollection.where("platform", "==", args.platform).where("channel", "==", channel).where("enabled", "==", true).where("id", ">=", minBundleId).where("fingerprint_hash", "==", args.fingerprintHash).get()).docs.map((doc) => convertToBundle(doc.data()));
|
|
120
|
+
return resolveUpdateInfoFromBundles({
|
|
121
|
+
args: {
|
|
122
|
+
...args,
|
|
123
|
+
channel,
|
|
124
|
+
minBundleId
|
|
125
|
+
},
|
|
126
|
+
bundles,
|
|
127
|
+
context
|
|
128
|
+
});
|
|
129
|
+
},
|
|
114
130
|
async getBundleById(bundleId) {
|
|
115
131
|
const bundleSnap = await bundlesCollection.doc(bundleId).get();
|
|
116
132
|
if (!bundleSnap.exists) return null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.35.0",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"types": "dist/index.d.cts",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"hono": "4.12.9",
|
|
41
|
-
"@hot-updater/cli-tools": "0.
|
|
42
|
-
"@hot-updater/
|
|
43
|
-
"@hot-updater/server": "0.
|
|
44
|
-
"@hot-updater/core": "0.
|
|
41
|
+
"@hot-updater/cli-tools": "0.35.0",
|
|
42
|
+
"@hot-updater/core": "0.35.0",
|
|
43
|
+
"@hot-updater/server": "0.35.0",
|
|
44
|
+
"@hot-updater/plugin-core": "0.35.0"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"firebase-tools": "^13.32.0",
|
|
57
57
|
"fkill": "^9.0.0",
|
|
58
58
|
"mime": "^4.0.4",
|
|
59
|
-
"@hot-updater/js": "0.
|
|
60
|
-
"@hot-updater/mock": "0.
|
|
61
|
-
"@hot-updater/test-utils": "0.
|
|
59
|
+
"@hot-updater/js": "0.35.0",
|
|
60
|
+
"@hot-updater/mock": "0.35.0",
|
|
61
|
+
"@hot-updater/test-utils": "0.35.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"firebase-admin": "*",
|