@hot-updater/firebase 0.33.2 → 0.34.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 +27 -42
- package/dist/index.cjs +27 -11
- package/dist/index.mjs +29 -13
- package/package.json +8 -8
|
@@ -5085,37 +5085,6 @@ const resolveUpdateInfoFromBundles = async ({ args, bundles, context }) => {
|
|
|
5085
5085
|
return info;
|
|
5086
5086
|
};
|
|
5087
5087
|
//#endregion
|
|
5088
|
-
//#region ../plugin-core/dist/createDatabasePluginGetUpdateInfo.mjs
|
|
5089
|
-
const normalizeAppVersionArgs = (args) => ({
|
|
5090
|
-
...args,
|
|
5091
|
-
channel: args.channel ?? "production",
|
|
5092
|
-
minBundleId: args.minBundleId ?? "00000000-0000-0000-0000-000000000000"
|
|
5093
|
-
});
|
|
5094
|
-
const normalizeFingerprintArgs = (args) => ({
|
|
5095
|
-
...args,
|
|
5096
|
-
channel: args.channel ?? "production",
|
|
5097
|
-
minBundleId: args.minBundleId ?? "00000000-0000-0000-0000-000000000000"
|
|
5098
|
-
});
|
|
5099
|
-
const createDatabasePluginGetUpdateInfo = ({ getBundlesByFingerprint, getBundlesByTargetAppVersions, listTargetAppVersions }) => {
|
|
5100
|
-
return async (args, context) => {
|
|
5101
|
-
if (args._updateStrategy === "appVersion") {
|
|
5102
|
-
const normalizedArgs = normalizeAppVersionArgs(args);
|
|
5103
|
-
const compatibleAppVersions = filterCompatibleAppVersions(await listTargetAppVersions(normalizedArgs, context), normalizedArgs.appVersion);
|
|
5104
|
-
return resolveUpdateInfoFromBundles({
|
|
5105
|
-
args: normalizedArgs,
|
|
5106
|
-
bundles: compatibleAppVersions.length > 0 ? await getBundlesByTargetAppVersions(normalizedArgs, compatibleAppVersions, context) : [],
|
|
5107
|
-
context
|
|
5108
|
-
});
|
|
5109
|
-
}
|
|
5110
|
-
const normalizedArgs = normalizeFingerprintArgs(args);
|
|
5111
|
-
return resolveUpdateInfoFromBundles({
|
|
5112
|
-
args: normalizedArgs,
|
|
5113
|
-
bundles: await getBundlesByFingerprint(normalizedArgs, context),
|
|
5114
|
-
context
|
|
5115
|
-
});
|
|
5116
|
-
};
|
|
5117
|
-
};
|
|
5118
|
-
//#endregion
|
|
5119
5088
|
//#region ../plugin-core/dist/createStorageKeyBuilder.mjs
|
|
5120
5089
|
const createStorageKeyBuilder = (basePath) => (...args) => {
|
|
5121
5090
|
return [basePath || "", ...args].filter(Boolean).join("/");
|
|
@@ -5359,18 +5328,34 @@ const firebaseDatabase = createDatabasePlugin({
|
|
|
5359
5328
|
const bundlesCollection = db.collection("bundles");
|
|
5360
5329
|
const targetAppVersionsCollection = db.collection("target_app_versions");
|
|
5361
5330
|
return {
|
|
5362
|
-
getUpdateInfo
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5331
|
+
async getUpdateInfo(args, context) {
|
|
5332
|
+
const channel = args.channel ?? "production";
|
|
5333
|
+
const minBundleId = args.minBundleId ?? "00000000-0000-0000-0000-000000000000";
|
|
5334
|
+
if (args._updateStrategy === "appVersion") {
|
|
5335
|
+
const querySnapshot = await targetAppVersionsCollection.where("platform", "==", args.platform).where("channel", "==", channel).select("target_app_version").get();
|
|
5336
|
+
const compatibleAppVersions = filterCompatibleAppVersions(Array.from(new Set(querySnapshot.docs.map((doc) => doc.data().target_app_version).filter((version) => Boolean(version)))), args.appVersion);
|
|
5337
|
+
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())));
|
|
5338
|
+
return resolveUpdateInfoFromBundles({
|
|
5339
|
+
args: {
|
|
5340
|
+
...args,
|
|
5341
|
+
channel,
|
|
5342
|
+
minBundleId
|
|
5343
|
+
},
|
|
5344
|
+
bundles,
|
|
5345
|
+
context
|
|
5346
|
+
});
|
|
5372
5347
|
}
|
|
5373
|
-
|
|
5348
|
+
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()));
|
|
5349
|
+
return resolveUpdateInfoFromBundles({
|
|
5350
|
+
args: {
|
|
5351
|
+
...args,
|
|
5352
|
+
channel,
|
|
5353
|
+
minBundleId
|
|
5354
|
+
},
|
|
5355
|
+
bundles,
|
|
5356
|
+
context
|
|
5357
|
+
});
|
|
5358
|
+
},
|
|
5374
5359
|
async getBundleById(bundleId) {
|
|
5375
5360
|
const bundleSnap = await bundlesCollection.doc(bundleId).get();
|
|
5376
5361
|
if (!bundleSnap.exists) return null;
|
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.34.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/
|
|
44
|
-
"@hot-updater/
|
|
41
|
+
"@hot-updater/cli-tools": "0.34.0",
|
|
42
|
+
"@hot-updater/core": "0.34.0",
|
|
43
|
+
"@hot-updater/plugin-core": "0.34.0",
|
|
44
|
+
"@hot-updater/server": "0.34.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.34.0",
|
|
60
|
+
"@hot-updater/mock": "0.34.0",
|
|
61
|
+
"@hot-updater/test-utils": "0.34.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"firebase-admin": "*",
|