@hot-updater/cloudflare 1.2.0-rc.41 → 1.2.0-rc.43
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.43",
|
|
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/
|
|
56
|
-
"@hot-updater/
|
|
57
|
-
"@hot-updater/
|
|
58
|
-
"@hot-updater/
|
|
59
|
-
"@hot-updater/
|
|
55
|
+
"@hot-updater/protocol": "1.2.0-rc.43",
|
|
56
|
+
"@hot-updater/plugin-core": "1.2.0-rc.43",
|
|
57
|
+
"@hot-updater/storage-s3": "1.2.0-rc.43",
|
|
58
|
+
"@hot-updater/server": "1.2.0-rc.43",
|
|
59
|
+
"@hot-updater/cli-tools": "1.2.0-rc.43"
|
|
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.43"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"build": "tsdown && pnpm build:worker",
|
package/sql/bundles.sql
CHANGED
|
@@ -42,6 +42,8 @@ CREATE INDEX IF NOT EXISTS "native_builds_byScope" ON "native_builds" ("scope_ke
|
|
|
42
42
|
|
|
43
43
|
CREATE INDEX IF NOT EXISTS "native_builds_byBuildKey" ON "native_builds" ("scope_key", "build_key", "id");
|
|
44
44
|
|
|
45
|
+
CREATE INDEX IF NOT EXISTS "native_builds_byScopeKind" ON "native_builds" ("scope_key", "artifact_kind", "id");
|
|
46
|
+
|
|
45
47
|
CREATE UNIQUE INDEX IF NOT EXISTS "native_builds_byStoreBuild" ON "native_builds" ("store_build_scope_key");
|
|
46
48
|
|
|
47
49
|
CREATE INDEX IF NOT EXISTS "native_builds_byChannel" ON "native_builds" ("channel_id", "id");
|
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-13T16:53:15.829Z.
|
package/worker/dist/index.js
CHANGED
|
@@ -2638,6 +2638,10 @@ var nativeBuilds = defineTable({
|
|
|
2638
2638
|
eq: ["scope_key", "build_key"],
|
|
2639
2639
|
sort: ["id"]
|
|
2640
2640
|
},
|
|
2641
|
+
byScopeKind: {
|
|
2642
|
+
eq: ["scope_key", "artifact_kind"],
|
|
2643
|
+
sort: ["id"]
|
|
2644
|
+
},
|
|
2641
2645
|
byStoreBuild: {
|
|
2642
2646
|
eq: ["store_build_scope_key"],
|
|
2643
2647
|
sort: [],
|
|
@@ -4672,7 +4676,7 @@ var createSqlAdapter = /* @__PURE__ */ __name(({ executor, tablePrefix = "", max
|
|
|
4672
4676
|
}, "createSqlAdapter");
|
|
4673
4677
|
|
|
4674
4678
|
// ../../packages/server/dist/package.mjs
|
|
4675
|
-
var version = "1.2.0-rc.
|
|
4679
|
+
var version = "1.2.0-rc.43";
|
|
4676
4680
|
|
|
4677
4681
|
// ../../packages/server/dist/version.mjs
|
|
4678
4682
|
var HOT_UPDATER_SERVER_VERSION = version;
|
|
@@ -6268,6 +6272,39 @@ var problemOf = /* @__PURE__ */ __name(({ id, minBundleId, platform, channel, fi
|
|
|
6268
6272
|
if (!Number.isSafeInteger(artifact.byteSize) || artifact.byteSize < 0) return "artifact.byteSize must be a byte count";
|
|
6269
6273
|
return null;
|
|
6270
6274
|
}, "problemOf");
|
|
6275
|
+
var SIBLING_KINDS = {
|
|
6276
|
+
app: "ipa",
|
|
6277
|
+
ipa: "app"
|
|
6278
|
+
};
|
|
6279
|
+
var isInstallTarget = /* @__PURE__ */ __name((build) => !build.is_store_build && build.submitted_to === null && (build.artifact_kind === "app" || build.artifact_kind === "ipa" && build.export_method !== null && build.export_method !== "app-store"), "isInstallTarget");
|
|
6280
|
+
var siblingSandboxScopeKey = /* @__PURE__ */ __name((build, artifactKind) => {
|
|
6281
|
+
const [version2, sandbox, platform, appId, urlScheme] = build.scope_key.split(":");
|
|
6282
|
+
if (version2 !== "v1" || sandbox !== "sandbox" || platform !== build.platform || appId === void 0 || urlScheme === void 0) return null;
|
|
6283
|
+
const target = build.fingerprint_hash === null ? {
|
|
6284
|
+
platform: build.platform,
|
|
6285
|
+
fingerprintHash: null,
|
|
6286
|
+
appVersion: build.app_version ?? ""
|
|
6287
|
+
} : {
|
|
6288
|
+
platform: build.platform,
|
|
6289
|
+
fingerprintHash: build.fingerprint_hash,
|
|
6290
|
+
appVersion: null
|
|
6291
|
+
};
|
|
6292
|
+
try {
|
|
6293
|
+
return sandboxScopeKey(target, {
|
|
6294
|
+
appId,
|
|
6295
|
+
urlScheme,
|
|
6296
|
+
artifactKind: build.artifact_kind,
|
|
6297
|
+
distribution: registeredDistribution(build.artifact_kind, build.export_method)
|
|
6298
|
+
}) === build.scope_key ? sandboxScopeKey(target, {
|
|
6299
|
+
appId,
|
|
6300
|
+
urlScheme,
|
|
6301
|
+
artifactKind,
|
|
6302
|
+
distribution: "direct"
|
|
6303
|
+
}) : null;
|
|
6304
|
+
} catch {
|
|
6305
|
+
return null;
|
|
6306
|
+
}
|
|
6307
|
+
}, "siblingSandboxScopeKey");
|
|
6271
6308
|
var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {}) => ({
|
|
6272
6309
|
async registerNativeBuild(registration) {
|
|
6273
6310
|
const problem = problemOf(registration);
|
|
@@ -6335,9 +6372,12 @@ var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {})
|
|
|
6335
6372
|
const scopeKey = nativeBuildScopeKey(scope);
|
|
6336
6373
|
const buildKey = options?.buildKey;
|
|
6337
6374
|
if (buildKey !== void 0 && !BUILD_KEY.test(buildKey)) throw new NativeBuildInputError("Invalid native build key: it must be nbk1: and a SHA-256.");
|
|
6375
|
+
const artifactKind = options?.artifactKind;
|
|
6376
|
+
if (artifactKind !== void 0 && !ARTIFACT_KINDS[scope.platform].includes(artifactKind)) throw new NativeBuildInputError(`Invalid native build kind: an ${scope.platform} build is ${ARTIFACT_KINDS[scope.platform].join(" or ")}.`);
|
|
6377
|
+
const ofKind = /* @__PURE__ */ __name((row) => artifactKind === void 0 || row.artifact_kind === artifactKind, "ofKind");
|
|
6338
6378
|
if (options?.storeBuild) {
|
|
6339
6379
|
const marked = await db.findOne("native_builds", { store_build_scope_key: scopeKey });
|
|
6340
|
-
return marked === null ? null : pick3(marked);
|
|
6380
|
+
return marked === null || !ofKind(marked) ? null : pick3(marked);
|
|
6341
6381
|
}
|
|
6342
6382
|
const read = /* @__PURE__ */ __name((limit, before) => {
|
|
6343
6383
|
const page2 = {
|
|
@@ -6345,34 +6385,60 @@ var createNativeBuildApi = /* @__PURE__ */ __name((db, { now = Date.now } = {})
|
|
|
6345
6385
|
limit,
|
|
6346
6386
|
...before === void 0 ? {} : { range: { lt: before } }
|
|
6347
6387
|
};
|
|
6348
|
-
return buildKey
|
|
6349
|
-
index: "byScope",
|
|
6350
|
-
where: { scope_key: scopeKey },
|
|
6351
|
-
...page2
|
|
6352
|
-
}) : db.findMany("native_builds", {
|
|
6388
|
+
return buildKey !== void 0 ? db.findMany("native_builds", {
|
|
6353
6389
|
index: "byBuildKey",
|
|
6354
6390
|
where: {
|
|
6355
6391
|
scope_key: scopeKey,
|
|
6356
6392
|
build_key: buildKey
|
|
6357
6393
|
},
|
|
6358
6394
|
...page2
|
|
6395
|
+
}) : artifactKind !== void 0 ? db.findMany("native_builds", {
|
|
6396
|
+
index: "byScopeKind",
|
|
6397
|
+
where: {
|
|
6398
|
+
scope_key: scopeKey,
|
|
6399
|
+
artifact_kind: artifactKind
|
|
6400
|
+
},
|
|
6401
|
+
...page2
|
|
6402
|
+
}) : db.findMany("native_builds", {
|
|
6403
|
+
index: "byScope",
|
|
6404
|
+
where: { scope_key: scopeKey },
|
|
6405
|
+
...page2
|
|
6359
6406
|
});
|
|
6360
6407
|
}, "read");
|
|
6361
6408
|
const bundleId = options?.builtInOlderThan;
|
|
6362
6409
|
if (bundleId !== void 0 && scope.sandbox !== void 0 && scope.sandbox !== null) return null;
|
|
6363
6410
|
const { rows } = await read(1);
|
|
6364
|
-
const newest = rows[0]
|
|
6365
|
-
|
|
6366
|
-
|
|
6411
|
+
const newest = (rows[0] === void 0 ? void 0 : pick3(rows[0])) ?? (artifactKind !== void 0 && buildKey === void 0 ? await db.findMany("native_builds", {
|
|
6412
|
+
index: "byScope",
|
|
6413
|
+
where: { scope_key: scopeKey },
|
|
6414
|
+
order: "desc",
|
|
6415
|
+
limit: 1
|
|
6416
|
+
}).then(({ rows: [row] }) => row?.artifact_kind === artifactKind ? pick3(row) : void 0) : void 0);
|
|
6417
|
+
if (newest === void 0 || !ofKind(newest)) return null;
|
|
6418
|
+
if (bundleId === void 0 || newest.min_bundle_id < bundleId) return newest;
|
|
6367
6419
|
for (let before = newest.id; ; ) {
|
|
6368
6420
|
const { rows: older } = await read(OLDER_BUILDS_PAGE, before);
|
|
6369
6421
|
const usable = older.find(({ min_bundle_id }) => min_bundle_id < bundleId);
|
|
6370
|
-
if (usable !== void 0) return pick3(usable);
|
|
6422
|
+
if (usable !== void 0) return ofKind(usable) ? pick3(usable) : null;
|
|
6371
6423
|
const last = older.at(-1);
|
|
6372
6424
|
if (older.length < OLDER_BUILDS_PAGE || last === void 0) return null;
|
|
6373
6425
|
before = last.id;
|
|
6374
6426
|
}
|
|
6375
6427
|
},
|
|
6428
|
+
async findNativeBuildSibling(build) {
|
|
6429
|
+
const artifactKind = SIBLING_KINDS[build.artifact_kind];
|
|
6430
|
+
if (build.platform !== "ios" || !build.is_sandbox || artifactKind === void 0 || !isInstallTarget(build)) return null;
|
|
6431
|
+
const scopeKey = siblingSandboxScopeKey(build, artifactKind);
|
|
6432
|
+
if (scopeKey === null) return null;
|
|
6433
|
+
const { rows } = await db.findMany("native_builds", {
|
|
6434
|
+
index: "byScope",
|
|
6435
|
+
where: { scope_key: scopeKey },
|
|
6436
|
+
order: "desc",
|
|
6437
|
+
limit: 1
|
|
6438
|
+
});
|
|
6439
|
+
const sibling = rows[0] === void 0 ? null : pick3(rows[0]);
|
|
6440
|
+
return sibling !== null && isInstallTarget(sibling) ? sibling : null;
|
|
6441
|
+
},
|
|
6376
6442
|
async recordNativeBuildSubmission(id, { destination, version: version2 }) {
|
|
6377
6443
|
if (version2.trim().length === 0 || version2.length > SUBMITTED_VERSION_MAX_LENGTH) throw new NativeBuildInputError(`Invalid native build submission: version must be the store's label of the build, up to ${SUBMITTED_VERSION_MAX_LENGTH} characters.`);
|
|
6378
6444
|
return db.transaction(async (tx) => {
|
|
@@ -7507,13 +7573,19 @@ var createAdminRouteHandlers = /* @__PURE__ */ __name(() => ({
|
|
|
7507
7573
|
const scope = nativeBuildScopeOf(url);
|
|
7508
7574
|
const buildKey = url.searchParams.get("buildKey");
|
|
7509
7575
|
const builtInOlderThan = url.searchParams.get("builtInOlderThan");
|
|
7576
|
+
const kind = url.searchParams.get("kind");
|
|
7510
7577
|
const options = {
|
|
7511
7578
|
...buildKey === null ? {} : { buildKey },
|
|
7512
7579
|
...url.searchParams.get("storeBuild") === "true" ? { storeBuild: true } : {},
|
|
7513
|
-
...builtInOlderThan === null ? {} : { builtInOlderThan }
|
|
7580
|
+
...builtInOlderThan === null ? {} : { builtInOlderThan },
|
|
7581
|
+
...kind === null ? {} : { artifactKind: kind }
|
|
7514
7582
|
};
|
|
7515
7583
|
return json({ data: await refusingInvalid(() => Object.keys(options).length === 0 ? core.findNativeBuild(scope) : core.findNativeBuild(scope, options)) });
|
|
7516
7584
|
}),
|
|
7585
|
+
findNativeBuildSibling: onCore(async (core, _request, params) => {
|
|
7586
|
+
const build = await core.getNativeBuild(requireRouteParam(params, "id"));
|
|
7587
|
+
return json({ data: build === null ? null : await core.findNativeBuildSibling(build) });
|
|
7588
|
+
}),
|
|
7517
7589
|
getNativeBuild: onCore(async (core, _request, params) => json({ data: await core.getNativeBuild(requireRouteParam(params, "id")) })),
|
|
7518
7590
|
listNativeBuilds: onCore(async (core, request) => {
|
|
7519
7591
|
const url = new URL(request.url);
|
|
@@ -7744,6 +7816,11 @@ var ADMIN_ROUTES = [
|
|
|
7744
7816
|
path: "/native-builds/latest",
|
|
7745
7817
|
handler: "findNativeBuild"
|
|
7746
7818
|
},
|
|
7819
|
+
{
|
|
7820
|
+
method: "GET",
|
|
7821
|
+
path: "/native-builds/:id/sibling",
|
|
7822
|
+
handler: "findNativeBuildSibling"
|
|
7823
|
+
},
|
|
7747
7824
|
{
|
|
7748
7825
|
method: "GET",
|
|
7749
7826
|
path: "/native-builds/:id",
|