@hot-updater/firebase 1.2.0-rc.21 → 1.2.0-rc.22
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.
|
@@ -2369,10 +2369,15 @@ const channels = defineTable({
|
|
|
2369
2369
|
* or `versionCode`. `submitted_to`, `submitted_at_ms` and
|
|
2370
2370
|
* `submitted_version` record the store track a build went to, when, and
|
|
2371
2371
|
* the store's label of the build; they stay null for a build no store took.
|
|
2372
|
-
* `
|
|
2373
|
-
* and
|
|
2374
|
-
*
|
|
2375
|
-
*
|
|
2372
|
+
* `is_store_build` is true on the build a person or a job says the store
|
|
2373
|
+
* sells, and false on every other: deploys patch from it over the scope's
|
|
2374
|
+
* newest build. The engine copies the scope key into `store_build_scope_key`
|
|
2375
|
+
* for that build alone, so `byStoreBuild` holds one entry per scope at most,
|
|
2376
|
+
* on every store, while any number of a scope's builds hold none.
|
|
2377
|
+
* `is_sandbox` is true on a sandbox build, set when it registers and never
|
|
2378
|
+
* changed. Boolean columns follow one rule: `is_*` for a fact about the row or
|
|
2379
|
+
* `should_*` for an instruction to the client, never null; a unique index over
|
|
2380
|
+
* the rows where one is true keys a derived slot, not the boolean.
|
|
2376
2381
|
*/
|
|
2377
2382
|
const nativeBuilds = defineTable({
|
|
2378
2383
|
id: {
|
|
@@ -2450,12 +2455,18 @@ const nativeBuilds = defineTable({
|
|
|
2450
2455
|
maxLength: 255,
|
|
2451
2456
|
required: false
|
|
2452
2457
|
},
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
required: false
|
|
2456
|
-
}
|
|
2458
|
+
is_store_build: { type: "boolean" },
|
|
2459
|
+
is_sandbox: { type: "boolean" }
|
|
2457
2460
|
}, {
|
|
2458
2461
|
key: ["id"],
|
|
2462
|
+
derived: {
|
|
2463
|
+
/** The scope this build is the store build of; null on every other. */
|
|
2464
|
+
store_build_scope_key: {
|
|
2465
|
+
type: "string",
|
|
2466
|
+
maxLength: 2048,
|
|
2467
|
+
ascii: true,
|
|
2468
|
+
compute: (row) => row.is_store_build ? row.scope_key : null
|
|
2469
|
+
} },
|
|
2459
2470
|
indexes: {
|
|
2460
2471
|
byScope: {
|
|
2461
2472
|
eq: ["scope_key"],
|
|
@@ -2466,7 +2477,7 @@ const nativeBuilds = defineTable({
|
|
|
2466
2477
|
sort: ["id"]
|
|
2467
2478
|
},
|
|
2468
2479
|
byStoreBuild: {
|
|
2469
|
-
eq: ["
|
|
2480
|
+
eq: ["store_build_scope_key"],
|
|
2470
2481
|
sort: [],
|
|
2471
2482
|
unique: true
|
|
2472
2483
|
},
|
|
@@ -3339,7 +3350,8 @@ const fieldProblems = (definition, add) => {
|
|
|
3339
3350
|
else if (field.required === false) add(`key field "${name}" is nullable`);
|
|
3340
3351
|
else if (field.type === "json") add(`key field "${name}" is json`);
|
|
3341
3352
|
}
|
|
3342
|
-
|
|
3353
|
+
const bounded = [...Object.entries(definition.fields), ...definition.kind === "table" ? Object.entries(definition.derived) : []];
|
|
3354
|
+
for (const [name, { type, maxLength, ascii }] of bounded) {
|
|
3343
3355
|
if (maxLength !== void 0 && (type !== "string" || !Number.isSafeInteger(maxLength) || maxLength < 1)) add(`field "${name}" has an invalid maxLength`);
|
|
3344
3356
|
if (ascii && type !== "string") add(`field "${name}" is ascii but not a string`);
|
|
3345
3357
|
}
|
|
@@ -3456,11 +3468,13 @@ const resolveSchema = (modules) => {
|
|
|
3456
3468
|
...maxLength === void 0 ? {} : { maxLength },
|
|
3457
3469
|
...ascii ? { ascii } : {}
|
|
3458
3470
|
}));
|
|
3459
|
-
if (definition.kind === "table") for (const [field, { type, multi }] of Object.entries(definition.derived)) columns.push({
|
|
3471
|
+
if (definition.kind === "table") for (const [field, { type, multi, maxLength, ascii }] of Object.entries(definition.derived)) columns.push({
|
|
3460
3472
|
name: field,
|
|
3461
3473
|
type,
|
|
3462
3474
|
nullable: true,
|
|
3463
|
-
...multi ? { multi } : {}
|
|
3475
|
+
...multi ? { multi } : {},
|
|
3476
|
+
...maxLength === void 0 ? {} : { maxLength },
|
|
3477
|
+
...ascii ? { ascii } : {}
|
|
3464
3478
|
});
|
|
3465
3479
|
else columns.push(integer(SHARD_COLUMN), ...[...definition.counters, ...definition.gauges].map((metric) => integer(metric)), ...definition.distinct.map((metric) => ({
|
|
3466
3480
|
name: metric,
|
|
@@ -4603,7 +4617,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
4603
4617
|
};
|
|
4604
4618
|
//#endregion
|
|
4605
4619
|
//#region ../../packages/server/dist/version.mjs
|
|
4606
|
-
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.
|
|
4620
|
+
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.22";
|
|
4607
4621
|
//#endregion
|
|
4608
4622
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
4609
4623
|
/**
|
|
@@ -5809,12 +5823,13 @@ const pick = (row) => ({
|
|
|
5809
5823
|
submitted_to: row.submitted_to ?? null,
|
|
5810
5824
|
submitted_at_ms: row.submitted_at_ms ?? null,
|
|
5811
5825
|
submitted_version: row.submitted_version ?? null,
|
|
5812
|
-
|
|
5826
|
+
is_store_build: row.is_store_build === true,
|
|
5827
|
+
is_sandbox: row.is_sandbox === true
|
|
5813
5828
|
});
|
|
5814
5829
|
/**
|
|
5815
|
-
* The channels only sandbox builds register on
|
|
5816
|
-
* registry's convention, as
|
|
5817
|
-
* for a build's artifact.
|
|
5830
|
+
* The channels only sandbox builds register on: a registration's `sandbox`
|
|
5831
|
+
* must agree with it. The registry's convention, as
|
|
5832
|
+
* `@hot-updater/protocol/native-artifact` checks it for a build's artifact.
|
|
5818
5833
|
*/
|
|
5819
5834
|
const SANDBOX_CHANNEL_PREFIX = "sandbox-";
|
|
5820
5835
|
/**
|
|
@@ -5861,11 +5876,15 @@ const nativeBuildScopeKey = (scope) => {
|
|
|
5861
5876
|
};
|
|
5862
5877
|
/** Whether `bundleId` is a native build's built-in bundle: one unique read. */
|
|
5863
5878
|
const isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
|
|
5864
|
-
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, artifact }) => {
|
|
5879
|
+
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, artifact }) => {
|
|
5865
5880
|
if (!isUUIDv7(id)) return "id must be a UUIDv7";
|
|
5866
5881
|
if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
|
|
5867
5882
|
if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
|
|
5868
5883
|
if (channel.trim().length === 0) return "channel is required";
|
|
5884
|
+
if (isSandbox !== void 0 && typeof isSandbox !== "boolean") return "isSandbox must be true or false";
|
|
5885
|
+
const reserved = channel.startsWith(SANDBOX_CHANNEL_PREFIX);
|
|
5886
|
+
if (isSandbox === true && !reserved) return `a sandbox build registers on a ${SANDBOX_CHANNEL_PREFIX}* channel, not ${channel}`;
|
|
5887
|
+
if (isSandbox !== true && reserved) return `channel ${channel} is reserved for sandbox builds`;
|
|
5869
5888
|
if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
|
|
5870
5889
|
if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
|
|
5871
5890
|
if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
|
|
@@ -5901,7 +5920,8 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
5901
5920
|
submitted_to: null,
|
|
5902
5921
|
submitted_at_ms: null,
|
|
5903
5922
|
submitted_version: null,
|
|
5904
|
-
|
|
5923
|
+
is_store_build: false,
|
|
5924
|
+
is_sandbox: registration.isSandbox === true
|
|
5905
5925
|
};
|
|
5906
5926
|
for (let attempt = 1;; attempt += 1) {
|
|
5907
5927
|
await insertChannel(db, {
|
|
@@ -5940,10 +5960,7 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
5940
5960
|
const buildKey = options?.buildKey;
|
|
5941
5961
|
if (buildKey !== void 0 && !BUILD_KEY.test(buildKey)) throw new NativeBuildInputError("Invalid native build key: it must be nbk1: and a SHA-256.");
|
|
5942
5962
|
if (options?.storeBuild) {
|
|
5943
|
-
const marked = await db.findOne("native_builds", {
|
|
5944
|
-
scope_key: scopeKey,
|
|
5945
|
-
store_build: true
|
|
5946
|
-
});
|
|
5963
|
+
const marked = await db.findOne("native_builds", { store_build_scope_key: scopeKey });
|
|
5947
5964
|
return marked === null ? null : pick(marked);
|
|
5948
5965
|
}
|
|
5949
5966
|
const read = (limit, before) => {
|
|
@@ -6005,34 +6022,31 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
6005
6022
|
if (row === null) return null;
|
|
6006
6023
|
const build = pick(row);
|
|
6007
6024
|
if (!storeBuild) {
|
|
6008
|
-
if (build.
|
|
6025
|
+
if (build.is_store_build) tx.update("native_builds", row, { is_store_build: false });
|
|
6009
6026
|
return {
|
|
6010
6027
|
nativeBuild: {
|
|
6011
6028
|
...build,
|
|
6012
|
-
|
|
6029
|
+
is_store_build: false
|
|
6013
6030
|
},
|
|
6014
6031
|
previous: null
|
|
6015
6032
|
};
|
|
6016
6033
|
}
|
|
6017
|
-
if (
|
|
6018
|
-
if (build.
|
|
6034
|
+
if (build.is_sandbox) throw new NativeBuildInputError("A sandbox build can't be the store build.");
|
|
6035
|
+
if (build.is_store_build) return {
|
|
6019
6036
|
nativeBuild: build,
|
|
6020
6037
|
previous: null
|
|
6021
6038
|
};
|
|
6022
|
-
const holder = await tx.findOne("native_builds", {
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
});
|
|
6026
|
-
if (holder !== null) tx.update("native_builds", holder, { store_build: null });
|
|
6027
|
-
tx.update("native_builds", row, { store_build: true });
|
|
6039
|
+
const holder = await tx.findOne("native_builds", { store_build_scope_key: build.scope_key });
|
|
6040
|
+
if (holder !== null) tx.update("native_builds", holder, { is_store_build: false });
|
|
6041
|
+
tx.update("native_builds", row, { is_store_build: true });
|
|
6028
6042
|
return {
|
|
6029
6043
|
nativeBuild: {
|
|
6030
6044
|
...build,
|
|
6031
|
-
|
|
6045
|
+
is_store_build: true
|
|
6032
6046
|
},
|
|
6033
6047
|
previous: holder === null ? null : {
|
|
6034
6048
|
...pick(holder),
|
|
6035
|
-
|
|
6049
|
+
is_store_build: false
|
|
6036
6050
|
}
|
|
6037
6051
|
};
|
|
6038
6052
|
});
|
|
@@ -6994,7 +7008,7 @@ const refusingInvalid = async (operation) => {
|
|
|
6994
7008
|
throw error;
|
|
6995
7009
|
}
|
|
6996
7010
|
};
|
|
6997
|
-
const isNativeBuildRegistration = (value) => isRecord$5(value) && isText$2(value.id) && isText$2(value.minBundleId) && typeof value.platform === "string" && isPlatform(value.platform) && isText$2(value.channel) && isTextOrNull$1(value.fingerprintHash) && isTextOrNull$1(value.appVersion) && value.fingerprintHash === null !== (value.appVersion === null) && isTextOrNull$1(value.gitCommitHash) && isTextOrNull$1(value.buildKey) && (value.buildNumber === void 0 || isTextOrNull$1(value.buildNumber)) && isRecord$5(value.artifact) && typeof value.artifact.kind === "string" && NATIVE_BUILD_ARTIFACT_KINDS.has(value.artifact.kind) && isText$2(value.artifact.storageUri) && Number.isSafeInteger(value.artifact.byteSize) && value.artifact.byteSize >= 0 && isRecord$5(value.embeddedBundle) && isText$2(value.embeddedBundle.manifestStorageUri) && isText$2(value.embeddedBundle.manifestFileHash) && isText$2(value.embeddedBundle.assetBaseStorageUri) && (value.embeddedBundle.metadata === void 0 || isRecord$5(value.embeddedBundle.metadata));
|
|
7011
|
+
const isNativeBuildRegistration = (value) => isRecord$5(value) && isText$2(value.id) && isText$2(value.minBundleId) && typeof value.platform === "string" && isPlatform(value.platform) && isText$2(value.channel) && isTextOrNull$1(value.fingerprintHash) && isTextOrNull$1(value.appVersion) && value.fingerprintHash === null !== (value.appVersion === null) && isTextOrNull$1(value.gitCommitHash) && isTextOrNull$1(value.buildKey) && (value.buildNumber === void 0 || isTextOrNull$1(value.buildNumber)) && (value.isSandbox === void 0 || typeof value.isSandbox === "boolean") && isRecord$5(value.artifact) && typeof value.artifact.kind === "string" && NATIVE_BUILD_ARTIFACT_KINDS.has(value.artifact.kind) && isText$2(value.artifact.storageUri) && Number.isSafeInteger(value.artifact.byteSize) && value.artifact.byteSize >= 0 && isRecord$5(value.embeddedBundle) && isText$2(value.embeddedBundle.manifestStorageUri) && isText$2(value.embeddedBundle.manifestFileHash) && isText$2(value.embeddedBundle.assetBaseStorageUri) && (value.embeddedBundle.metadata === void 0 || isRecord$5(value.embeddedBundle.metadata));
|
|
6998
7012
|
const scopeKeyOf = (params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "";
|
|
6999
7013
|
/** Every admin route's handler, by the name `ADMIN_ROUTES` mounts it under. */
|
|
7000
7014
|
const createAdminRouteHandlers = () => ({
|
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.22",
|
|
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/plugin-core": "1.2.0-rc.
|
|
43
|
-
"@hot-updater/server": "1.2.0-rc.
|
|
44
|
-
"@hot-updater/
|
|
41
|
+
"@hot-updater/protocol": "1.2.0-rc.22",
|
|
42
|
+
"@hot-updater/plugin-core": "1.2.0-rc.22",
|
|
43
|
+
"@hot-updater/server": "1.2.0-rc.22",
|
|
44
|
+
"@hot-updater/cli-tools": "1.2.0-rc.22"
|
|
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.22",
|
|
60
|
+
"@hot-updater/test-utils": "1.2.0-rc.22"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"firebase-admin": ">=11.10.0",
|