@hot-updater/cloudflare 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.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/cloudflare",
|
|
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
|
"module": "dist/index.mjs",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"cloudflare": "4.2.0",
|
|
53
53
|
"hono": "4.12.34",
|
|
54
54
|
"uuidv7": "^1.0.2",
|
|
55
|
-
"@hot-updater/cli-tools": "1.2.0-rc.
|
|
56
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
57
|
-
"@hot-updater/plugin-core": "1.2.0-rc.
|
|
58
|
-
"@hot-updater/server": "1.2.0-rc.
|
|
59
|
-
"@hot-updater/storage-s3": "1.2.0-rc.
|
|
55
|
+
"@hot-updater/cli-tools": "1.2.0-rc.22",
|
|
56
|
+
"@hot-updater/protocol": "1.2.0-rc.22",
|
|
57
|
+
"@hot-updater/plugin-core": "1.2.0-rc.22",
|
|
58
|
+
"@hot-updater/server": "1.2.0-rc.22",
|
|
59
|
+
"@hot-updater/storage-s3": "1.2.0-rc.22"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@aws-sdk/client-s3": "3.1066.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"vitest": "4.1.4",
|
|
76
76
|
"wrangler": "^4.69.0",
|
|
77
77
|
"xdg-app-paths": "^8.3.0",
|
|
78
|
-
"@hot-updater/test-utils": "1.2.0-rc.
|
|
78
|
+
"@hot-updater/test-utils": "1.2.0-rc.22"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"build": "tsdown && pnpm build:worker",
|
package/sql/bundles.sql
CHANGED
|
@@ -36,13 +36,13 @@ CREATE UNIQUE INDEX IF NOT EXISTS "channels_name" ON "channels" ("name");
|
|
|
36
36
|
|
|
37
37
|
CREATE TABLE IF NOT EXISTS "bundle_totals" ("platform_key" TEXT NOT NULL, "_shard" INTEGER NOT NULL, "bundles" INTEGER NOT NULL, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("platform_key", "_shard"));
|
|
38
38
|
|
|
39
|
-
CREATE TABLE IF NOT EXISTS "native_builds" ("id" TEXT NOT NULL, "scope_key" TEXT NOT NULL, "platform" TEXT NOT NULL, "channel_id" TEXT NOT NULL, "fingerprint_hash" TEXT, "app_version" TEXT, "min_bundle_id" TEXT NOT NULL, "artifact_kind" TEXT NOT NULL, "artifact_storage_uri" TEXT NOT NULL, "byte_size" INTEGER NOT NULL, "git_commit_hash" TEXT, "created_at_ms" INTEGER NOT NULL, "build_key" TEXT, "build_number" TEXT, "submitted_to" TEXT, "submitted_at_ms" INTEGER, "submitted_version" TEXT, "
|
|
39
|
+
CREATE TABLE IF NOT EXISTS "native_builds" ("id" TEXT NOT NULL, "scope_key" TEXT NOT NULL, "platform" TEXT NOT NULL, "channel_id" TEXT NOT NULL, "fingerprint_hash" TEXT, "app_version" TEXT, "min_bundle_id" TEXT NOT NULL, "artifact_kind" TEXT NOT NULL, "artifact_storage_uri" TEXT NOT NULL, "byte_size" INTEGER NOT NULL, "git_commit_hash" TEXT, "created_at_ms" INTEGER NOT NULL, "build_key" TEXT, "build_number" TEXT, "submitted_to" TEXT, "submitted_at_ms" INTEGER, "submitted_version" TEXT, "is_store_build" INTEGER NOT NULL, "is_sandbox" INTEGER NOT NULL, "store_build_scope_key" TEXT, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
|
|
40
40
|
|
|
41
41
|
CREATE INDEX IF NOT EXISTS "native_builds_byScope" ON "native_builds" ("scope_key", "id");
|
|
42
42
|
|
|
43
43
|
CREATE INDEX IF NOT EXISTS "native_builds_byBuildKey" ON "native_builds" ("scope_key", "build_key", "id");
|
|
44
44
|
|
|
45
|
-
CREATE UNIQUE INDEX IF NOT EXISTS "native_builds_byStoreBuild" ON "native_builds" ("
|
|
45
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "native_builds_byStoreBuild" ON "native_builds" ("store_build_scope_key");
|
|
46
46
|
|
|
47
47
|
CREATE INDEX IF NOT EXISTS "native_builds_byChannel" ON "native_builds" ("channel_id", "id");
|
|
48
48
|
|
package/worker/dist/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This folder contains the built output assets for the worker "hot-updater" generated at 2026-11-
|
|
1
|
+
This folder contains the built output assets for the worker "hot-updater" generated at 2026-11-05T07:32:26.026Z.
|
package/worker/dist/index.js
CHANGED
|
@@ -2601,12 +2601,19 @@ var nativeBuilds = defineTable({
|
|
|
2601
2601
|
maxLength: 255,
|
|
2602
2602
|
required: false
|
|
2603
2603
|
},
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
required: false
|
|
2607
|
-
}
|
|
2604
|
+
is_store_build: { type: "boolean" },
|
|
2605
|
+
is_sandbox: { type: "boolean" }
|
|
2608
2606
|
}, {
|
|
2609
2607
|
key: ["id"],
|
|
2608
|
+
derived: {
|
|
2609
|
+
/** The scope this build is the store build of; null on every other. */
|
|
2610
|
+
store_build_scope_key: {
|
|
2611
|
+
type: "string",
|
|
2612
|
+
maxLength: 2048,
|
|
2613
|
+
ascii: true,
|
|
2614
|
+
compute: /* @__PURE__ */ __name((row) => row.is_store_build ? row.scope_key : null, "compute")
|
|
2615
|
+
}
|
|
2616
|
+
},
|
|
2610
2617
|
indexes: {
|
|
2611
2618
|
byScope: {
|
|
2612
2619
|
eq: ["scope_key"],
|
|
@@ -2617,7 +2624,7 @@ var nativeBuilds = defineTable({
|
|
|
2617
2624
|
sort: ["id"]
|
|
2618
2625
|
},
|
|
2619
2626
|
byStoreBuild: {
|
|
2620
|
-
eq: ["
|
|
2627
|
+
eq: ["store_build_scope_key"],
|
|
2621
2628
|
sort: [],
|
|
2622
2629
|
unique: true
|
|
2623
2630
|
},
|
|
@@ -3375,7 +3382,8 @@ var fieldProblems = /* @__PURE__ */ __name((definition, add) => {
|
|
|
3375
3382
|
else if (field.required === false) add(`key field "${name}" is nullable`);
|
|
3376
3383
|
else if (field.type === "json") add(`key field "${name}" is json`);
|
|
3377
3384
|
}
|
|
3378
|
-
|
|
3385
|
+
const bounded = [...Object.entries(definition.fields), ...definition.kind === "table" ? Object.entries(definition.derived) : []];
|
|
3386
|
+
for (const [name, { type, maxLength, ascii }] of bounded) {
|
|
3379
3387
|
if (maxLength !== void 0 && (type !== "string" || !Number.isSafeInteger(maxLength) || maxLength < 1)) add(`field "${name}" has an invalid maxLength`);
|
|
3380
3388
|
if (ascii && type !== "string") add(`field "${name}" is ascii but not a string`);
|
|
3381
3389
|
}
|
|
@@ -3488,11 +3496,13 @@ var resolveSchema = /* @__PURE__ */ __name((modules) => {
|
|
|
3488
3496
|
...maxLength === void 0 ? {} : { maxLength },
|
|
3489
3497
|
...ascii ? { ascii } : {}
|
|
3490
3498
|
}));
|
|
3491
|
-
if (definition.kind === "table") for (const [field, { type, multi }] of Object.entries(definition.derived)) columns.push({
|
|
3499
|
+
if (definition.kind === "table") for (const [field, { type, multi, maxLength, ascii }] of Object.entries(definition.derived)) columns.push({
|
|
3492
3500
|
name: field,
|
|
3493
3501
|
type,
|
|
3494
3502
|
nullable: true,
|
|
3495
|
-
...multi ? { multi } : {}
|
|
3503
|
+
...multi ? { multi } : {},
|
|
3504
|
+
...maxLength === void 0 ? {} : { maxLength },
|
|
3505
|
+
...ascii ? { ascii } : {}
|
|
3496
3506
|
});
|
|
3497
3507
|
else columns.push(integer(SHARD_COLUMN), ...[...definition.counters, ...definition.gauges].map((metric) => integer(metric)), ...definition.distinct.map((metric) => ({
|
|
3498
3508
|
name: metric,
|
|
@@ -4559,7 +4569,7 @@ var createSqlAdapter = /* @__PURE__ */ __name(({ executor, tablePrefix = "", max
|
|
|
4559
4569
|
}, "createSqlAdapter");
|
|
4560
4570
|
|
|
4561
4571
|
// ../../packages/server/dist/package.mjs
|
|
4562
|
-
var version = "1.2.0-rc.
|
|
4572
|
+
var version = "1.2.0-rc.22";
|
|
4563
4573
|
|
|
4564
4574
|
// ../../packages/server/dist/version.mjs
|
|
4565
4575
|
var HOT_UPDATER_SERVER_VERSION = version;
|
|
@@ -5735,7 +5745,8 @@ var pick2 = /* @__PURE__ */ __name((row) => ({
|
|
|
5735
5745
|
submitted_to: row.submitted_to ?? null,
|
|
5736
5746
|
submitted_at_ms: row.submitted_at_ms ?? null,
|
|
5737
5747
|
submitted_version: row.submitted_version ?? null,
|
|
5738
|
-
|
|
5748
|
+
is_store_build: row.is_store_build === true,
|
|
5749
|
+
is_sandbox: row.is_sandbox === true
|
|
5739
5750
|
}), "pick");
|
|
5740
5751
|
var SANDBOX_CHANNEL_PREFIX = "sandbox-";
|
|
5741
5752
|
var OLDER_BUILDS_PAGE = 20;
|
|
@@ -5767,11 +5778,15 @@ var nativeBuildScopeKey = /* @__PURE__ */ __name((scope) => {
|
|
|
5767
5778
|
return scopeKey;
|
|
5768
5779
|
}, "nativeBuildScopeKey");
|
|
5769
5780
|
var isBuiltInBundle = /* @__PURE__ */ __name(async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null, "isBuiltInBundle");
|
|
5770
|
-
var problemOf = /* @__PURE__ */ __name(({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, artifact }) => {
|
|
5781
|
+
var problemOf = /* @__PURE__ */ __name(({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, artifact }) => {
|
|
5771
5782
|
if (!isUUIDv7(id)) return "id must be a UUIDv7";
|
|
5772
5783
|
if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
|
|
5773
5784
|
if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
|
|
5774
5785
|
if (channel.trim().length === 0) return "channel is required";
|
|
5786
|
+
if (isSandbox !== void 0 && typeof isSandbox !== "boolean") return "isSandbox must be true or false";
|
|
5787
|
+
const reserved = channel.startsWith(SANDBOX_CHANNEL_PREFIX);
|
|
5788
|
+
if (isSandbox === true && !reserved) return `a sandbox build registers on a ${SANDBOX_CHANNEL_PREFIX}* channel, not ${channel}`;
|
|
5789
|
+
if (isSandbox !== true && reserved) return `channel ${channel} is reserved for sandbox builds`;
|
|
5775
5790
|
if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
|
|
5776
5791
|
if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
|
|
5777
5792
|
if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
|
|
@@ -5806,7 +5821,8 @@ var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {})
|
|
|
5806
5821
|
submitted_to: null,
|
|
5807
5822
|
submitted_at_ms: null,
|
|
5808
5823
|
submitted_version: null,
|
|
5809
|
-
|
|
5824
|
+
is_store_build: false,
|
|
5825
|
+
is_sandbox: registration.isSandbox === true
|
|
5810
5826
|
};
|
|
5811
5827
|
for (let attempt = 1; ; attempt += 1) {
|
|
5812
5828
|
await insertChannel(db, {
|
|
@@ -5845,10 +5861,7 @@ var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {})
|
|
|
5845
5861
|
const buildKey = options?.buildKey;
|
|
5846
5862
|
if (buildKey !== void 0 && !BUILD_KEY.test(buildKey)) throw new NativeBuildInputError("Invalid native build key: it must be nbk1: and a SHA-256.");
|
|
5847
5863
|
if (options?.storeBuild) {
|
|
5848
|
-
const marked = await db.findOne("native_builds", {
|
|
5849
|
-
scope_key: scopeKey,
|
|
5850
|
-
store_build: true
|
|
5851
|
-
});
|
|
5864
|
+
const marked = await db.findOne("native_builds", { store_build_scope_key: scopeKey });
|
|
5852
5865
|
return marked === null ? null : pick2(marked);
|
|
5853
5866
|
}
|
|
5854
5867
|
const read = /* @__PURE__ */ __name((limit, before) => {
|
|
@@ -5910,34 +5923,31 @@ var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {})
|
|
|
5910
5923
|
if (row === null) return null;
|
|
5911
5924
|
const build = pick2(row);
|
|
5912
5925
|
if (!storeBuild) {
|
|
5913
|
-
if (build.
|
|
5926
|
+
if (build.is_store_build) tx.update("native_builds", row, { is_store_build: false });
|
|
5914
5927
|
return {
|
|
5915
5928
|
nativeBuild: {
|
|
5916
5929
|
...build,
|
|
5917
|
-
|
|
5930
|
+
is_store_build: false
|
|
5918
5931
|
},
|
|
5919
5932
|
previous: null
|
|
5920
5933
|
};
|
|
5921
5934
|
}
|
|
5922
|
-
if (
|
|
5923
|
-
if (build.
|
|
5935
|
+
if (build.is_sandbox) throw new NativeBuildInputError("A sandbox build can't be the store build.");
|
|
5936
|
+
if (build.is_store_build) return {
|
|
5924
5937
|
nativeBuild: build,
|
|
5925
5938
|
previous: null
|
|
5926
5939
|
};
|
|
5927
|
-
const holder = await tx.findOne("native_builds", {
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
});
|
|
5931
|
-
if (holder !== null) tx.update("native_builds", holder, { store_build: null });
|
|
5932
|
-
tx.update("native_builds", row, { store_build: true });
|
|
5940
|
+
const holder = await tx.findOne("native_builds", { store_build_scope_key: build.scope_key });
|
|
5941
|
+
if (holder !== null) tx.update("native_builds", holder, { is_store_build: false });
|
|
5942
|
+
tx.update("native_builds", row, { is_store_build: true });
|
|
5933
5943
|
return {
|
|
5934
5944
|
nativeBuild: {
|
|
5935
5945
|
...build,
|
|
5936
|
-
|
|
5946
|
+
is_store_build: true
|
|
5937
5947
|
},
|
|
5938
5948
|
previous: holder === null ? null : {
|
|
5939
5949
|
...pick2(holder),
|
|
5940
|
-
|
|
5950
|
+
is_store_build: false
|
|
5941
5951
|
}
|
|
5942
5952
|
};
|
|
5943
5953
|
});
|
|
@@ -6855,7 +6865,7 @@ var refusingInvalid = /* @__PURE__ */ __name(async (operation) => {
|
|
|
6855
6865
|
throw error;
|
|
6856
6866
|
}
|
|
6857
6867
|
}, "refusingInvalid");
|
|
6858
|
-
var isNativeBuildRegistration = /* @__PURE__ */ __name((value) => isRecord3(value) && isText(value.id) && isText(value.minBundleId) && typeof value.platform === "string" && isPlatform(value.platform) && isText(value.channel) && isTextOrNull(value.fingerprintHash) && isTextOrNull(value.appVersion) && value.fingerprintHash === null !== (value.appVersion === null) && isTextOrNull(value.gitCommitHash) && isTextOrNull(value.buildKey) && (value.buildNumber === void 0 || isTextOrNull(value.buildNumber)) && isRecord3(value.artifact) && typeof value.artifact.kind === "string" && NATIVE_BUILD_ARTIFACT_KINDS.has(value.artifact.kind) && isText(value.artifact.storageUri) && Number.isSafeInteger(value.artifact.byteSize) && value.artifact.byteSize >= 0 && isRecord3(value.embeddedBundle) && isText(value.embeddedBundle.manifestStorageUri) && isText(value.embeddedBundle.manifestFileHash) && isText(value.embeddedBundle.assetBaseStorageUri) && (value.embeddedBundle.metadata === void 0 || isRecord3(value.embeddedBundle.metadata)), "isNativeBuildRegistration");
|
|
6868
|
+
var isNativeBuildRegistration = /* @__PURE__ */ __name((value) => isRecord3(value) && isText(value.id) && isText(value.minBundleId) && typeof value.platform === "string" && isPlatform(value.platform) && isText(value.channel) && isTextOrNull(value.fingerprintHash) && isTextOrNull(value.appVersion) && value.fingerprintHash === null !== (value.appVersion === null) && isTextOrNull(value.gitCommitHash) && isTextOrNull(value.buildKey) && (value.buildNumber === void 0 || isTextOrNull(value.buildNumber)) && (value.isSandbox === void 0 || typeof value.isSandbox === "boolean") && isRecord3(value.artifact) && typeof value.artifact.kind === "string" && NATIVE_BUILD_ARTIFACT_KINDS.has(value.artifact.kind) && isText(value.artifact.storageUri) && Number.isSafeInteger(value.artifact.byteSize) && value.artifact.byteSize >= 0 && isRecord3(value.embeddedBundle) && isText(value.embeddedBundle.manifestStorageUri) && isText(value.embeddedBundle.manifestFileHash) && isText(value.embeddedBundle.assetBaseStorageUri) && (value.embeddedBundle.metadata === void 0 || isRecord3(value.embeddedBundle.metadata)), "isNativeBuildRegistration");
|
|
6859
6869
|
var scopeKeyOf = /* @__PURE__ */ __name((params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "", "scopeKeyOf");
|
|
6860
6870
|
var createAdminRouteHandlers = /* @__PURE__ */ __name(() => ({
|
|
6861
6871
|
listBundles: onCore(async (core, request) => {
|