@hot-updater/firebase 1.2.0-rc.33 → 1.2.0-rc.35
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.
|
@@ -4755,7 +4755,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
4755
4755
|
};
|
|
4756
4756
|
//#endregion
|
|
4757
4757
|
//#region ../../packages/server/dist/version.mjs
|
|
4758
|
-
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.
|
|
4758
|
+
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.35";
|
|
4759
4759
|
//#endregion
|
|
4760
4760
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
4761
4761
|
/**
|
|
@@ -6174,8 +6174,10 @@ const deleteBundle = async (tx, current) => {
|
|
|
6174
6174
|
/**
|
|
6175
6175
|
* Replaces a bundle's patches with `rows`: kept patches are updated where
|
|
6176
6176
|
* they changed, others deleted or created, so no key is written twice.
|
|
6177
|
+
* `checkNew` sees each patch it is about to create, and refuses one by
|
|
6178
|
+
* throwing, which leaves the transaction's writes undone.
|
|
6177
6179
|
*/
|
|
6178
|
-
const replaceBundlePatches = async (tx, bundle, rows) => {
|
|
6180
|
+
const replaceBundlePatches = async (tx, bundle, rows, checkNew) => {
|
|
6179
6181
|
const wanted = new Map(rows.map((row) => [row.id, row]));
|
|
6180
6182
|
const count = bundle._refs_bundle_patches_bundle_id ?? 0;
|
|
6181
6183
|
let cursor;
|
|
@@ -6200,6 +6202,7 @@ const replaceBundlePatches = async (tx, bundle, rows) => {
|
|
|
6200
6202
|
if (page.next === void 0) break;
|
|
6201
6203
|
cursor = page.next;
|
|
6202
6204
|
}
|
|
6205
|
+
if (checkNew !== void 0) for (const row of wanted.values()) await checkNew(row);
|
|
6203
6206
|
for (const row of wanted.values()) tx.create("bundle_patches", row);
|
|
6204
6207
|
};
|
|
6205
6208
|
/** A channel by name, created when missing; a concurrent creator's row is returned instead. */
|
|
@@ -6347,6 +6350,14 @@ const nativeBuildScopeKey = (scope) => {
|
|
|
6347
6350
|
if (scopeKey.length > SCOPE_KEY_MAX_LENGTH) throw new NativeBuildInputError(`Invalid native build scope: its key is longer than ${SCOPE_KEY_MAX_LENGTH} characters; shorten the channel or app version.`);
|
|
6348
6351
|
return scopeKey;
|
|
6349
6352
|
};
|
|
6353
|
+
/**
|
|
6354
|
+
* Refuses a patch from a sandbox build's built-in bundle: no deploy patches
|
|
6355
|
+
* from one, so no store or test install of the app gets a patch made for a
|
|
6356
|
+
* sandbox build. One unique read of the base.
|
|
6357
|
+
*/
|
|
6358
|
+
const refuseSandboxPatchBase = async (db, baseBundleId) => {
|
|
6359
|
+
if ((await db.findOne("native_builds", { min_bundle_id: baseBundleId }))?.is_sandbox === true) throw new NativeBuildInputError("A sandbox build's built-in bundle is no patch base.");
|
|
6360
|
+
};
|
|
6350
6361
|
/** Whether `bundleId` is a native build's built-in bundle: one unique read. */
|
|
6351
6362
|
const isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
|
|
6352
6363
|
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, exportMethod, nativeAppVersion, artifact }) => {
|
|
@@ -6467,10 +6478,11 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
6467
6478
|
...page
|
|
6468
6479
|
});
|
|
6469
6480
|
};
|
|
6481
|
+
const bundleId = options?.builtInOlderThan;
|
|
6482
|
+
if (bundleId !== void 0 && scope.channel.startsWith(SANDBOX_CHANNEL_PREFIX)) return null;
|
|
6470
6483
|
const { rows } = await read(1);
|
|
6471
6484
|
const newest = rows[0];
|
|
6472
6485
|
if (newest === void 0) return null;
|
|
6473
|
-
const bundleId = options?.builtInOlderThan;
|
|
6474
6486
|
if (bundleId === void 0 || newest.min_bundle_id < bundleId) return pick(newest);
|
|
6475
6487
|
for (let before = newest.id;;) {
|
|
6476
6488
|
const { rows: older } = await read(OLDER_BUILDS_PAGE, before);
|
|
@@ -6887,7 +6899,11 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
|
|
|
6887
6899
|
for (const { release } of deployments) if (!channels.has(release.channel)) channels.set(release.channel, await ensureChannel(release.channel));
|
|
6888
6900
|
const platforms = /* @__PURE__ */ new Map();
|
|
6889
6901
|
for (const deployment of deployments) {
|
|
6890
|
-
if (!("bundleId" in deployment)
|
|
6902
|
+
if (!("bundleId" in deployment)) {
|
|
6903
|
+
for (const { baseBundleId } of deployment.bundle.patches ?? []) await refuseSandboxPatchBase(db, baseBundleId);
|
|
6904
|
+
continue;
|
|
6905
|
+
}
|
|
6906
|
+
if (platforms.has(deployment.bundleId)) continue;
|
|
6891
6907
|
const row = await db.findOne("bundles", { id: deployment.bundleId });
|
|
6892
6908
|
if (row === null) throw new DatabaseBundleNotFoundError(deployment.bundleId);
|
|
6893
6909
|
if (await isBuiltInBundle(db, deployment.bundleId)) throw new ReleaseManagementError("TARGET_RELEASE_INVALID", `Bundle "${deployment.bundleId}" is a native build's built-in bundle, which no release publishes.`);
|
|
@@ -7091,7 +7107,7 @@ const createCoreOperations = (db, { now = Date.now } = {}) => {
|
|
|
7091
7107
|
if (patches !== void 0) await replaceBundlePatches(tx, current, bundleToPatchRows({
|
|
7092
7108
|
...next,
|
|
7093
7109
|
patches
|
|
7094
|
-
}));
|
|
7110
|
+
}), (row) => refuseSandboxPatchBase(tx, row.base_bundle_id));
|
|
7095
7111
|
}),
|
|
7096
7112
|
deleteBundles: async (ids) => {
|
|
7097
7113
|
try {
|
|
@@ -7579,7 +7595,8 @@ const createAdminRouteHandlers = () => ({
|
|
|
7579
7595
|
rebuildReleaseCatalog: onCore(async (core, _request, params) => json$2({ data: await core.rebuildReleaseCatalog(scopeKeyOf(params)) })),
|
|
7580
7596
|
updateBundle: onCore(async (core, request, params) => {
|
|
7581
7597
|
const bundleId = requireRouteParam(params, "id");
|
|
7582
|
-
|
|
7598
|
+
const update = bundleUpdateOf(await request.json(), bundleId);
|
|
7599
|
+
await refusingInvalid(() => core.updateBundle(bundleId, update));
|
|
7583
7600
|
return noContent();
|
|
7584
7601
|
}),
|
|
7585
7602
|
countBundles: onCore(async (core, request) => json$2({ data: await core.countBundles(platformOf(new URL(request.url))) })),
|
|
@@ -7603,7 +7620,7 @@ const createAdminRouteHandlers = () => ({
|
|
|
7603
7620
|
deployReleases: onCore(async (core, request) => {
|
|
7604
7621
|
const { deployments } = await body(request);
|
|
7605
7622
|
if (!Array.isArray(deployments) || deployments.length === 0 || !deployments.every(isDeployment)) throw new HandlerBadRequestError("Deploy needs deployments, each a bundle and its release policy.");
|
|
7606
|
-
return json$2({ data: await core.deploy(deployments) }, 201);
|
|
7623
|
+
return json$2({ data: await refusingInvalid(() => core.deploy(deployments)) }, 201);
|
|
7607
7624
|
}),
|
|
7608
7625
|
promoteRelease: onCore(async (core, request, params) => {
|
|
7609
7626
|
const input = await body(request);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.0-rc.
|
|
4
|
+
"version": "1.2.0-rc.35",
|
|
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
|
"dependencies": {
|
|
39
39
|
"hono": "4.12.34",
|
|
40
40
|
"google-auth-library": "10.7.0",
|
|
41
|
-
"@hot-updater/
|
|
42
|
-
"@hot-updater/
|
|
43
|
-
"@hot-updater/
|
|
44
|
-
"@hot-updater/
|
|
41
|
+
"@hot-updater/cli-tools": "1.2.0-rc.35",
|
|
42
|
+
"@hot-updater/protocol": "1.2.0-rc.35",
|
|
43
|
+
"@hot-updater/plugin-core": "1.2.0-rc.35",
|
|
44
|
+
"@hot-updater/server": "1.2.0-rc.35"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"firebase-tools": "15.29.0",
|
|
57
57
|
"fkill": "^9.0.0",
|
|
58
58
|
"mime": "^4.0.4",
|
|
59
|
-
"@hot-updater/mock": "1.2.0-rc.
|
|
60
|
-
"@hot-updater/test-utils": "1.2.0-rc.
|
|
59
|
+
"@hot-updater/mock": "1.2.0-rc.35",
|
|
60
|
+
"@hot-updater/test-utils": "1.2.0-rc.35"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"firebase-admin": ">=11.10.0",
|