@hot-updater/vercel 1.2.0-rc.24 → 1.2.0-rc.26
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/function/index.mjs +34 -12
- package/package.json +7 -7
package/dist/function/index.mjs
CHANGED
|
@@ -2472,7 +2472,13 @@ const nativeBuilds = defineTable({
|
|
|
2472
2472
|
required: false
|
|
2473
2473
|
},
|
|
2474
2474
|
is_store_build: { type: "boolean" },
|
|
2475
|
-
is_sandbox: { type: "boolean" }
|
|
2475
|
+
is_sandbox: { type: "boolean" },
|
|
2476
|
+
sandbox_url_scheme: {
|
|
2477
|
+
type: "string",
|
|
2478
|
+
maxLength: 255,
|
|
2479
|
+
ascii: true,
|
|
2480
|
+
required: false
|
|
2481
|
+
}
|
|
2476
2482
|
}, {
|
|
2477
2483
|
key: ["id"],
|
|
2478
2484
|
derived: { store_build_scope_key: {
|
|
@@ -17632,7 +17638,7 @@ const postgres = (config) => {
|
|
|
17632
17638
|
};
|
|
17633
17639
|
//#endregion
|
|
17634
17640
|
//#region ../../packages/server/dist/version.mjs
|
|
17635
|
-
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.
|
|
17641
|
+
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.26";
|
|
17636
17642
|
//#endregion
|
|
17637
17643
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
17638
17644
|
const createVersionRouteHandlers = (plugins = []) => {
|
|
@@ -18623,6 +18629,17 @@ const createCoreReads = (db, storage) => {
|
|
|
18623
18629
|
};
|
|
18624
18630
|
};
|
|
18625
18631
|
//#endregion
|
|
18632
|
+
//#region ../../packages/server/dist/core/nativeBuildDestinations.mjs
|
|
18633
|
+
const NATIVE_BUILD_SUBMISSION_DESTINATIONS = {
|
|
18634
|
+
android: [
|
|
18635
|
+
"play-internal",
|
|
18636
|
+
"play-closed",
|
|
18637
|
+
"play-open",
|
|
18638
|
+
"play-production"
|
|
18639
|
+
],
|
|
18640
|
+
ios: ["testflight"]
|
|
18641
|
+
};
|
|
18642
|
+
//#endregion
|
|
18626
18643
|
//#region ../../packages/server/dist/core/writes.mjs
|
|
18627
18644
|
const PAGE$2 = 500;
|
|
18628
18645
|
const countBundle = (tx, platform, delta) => {
|
|
@@ -18720,6 +18737,8 @@ const ARTIFACT_KINDS = {
|
|
|
18720
18737
|
const SCOPE_KEY_MAX_LENGTH = 2048;
|
|
18721
18738
|
const GIT_COMMIT_HASH_MAX_LENGTH = 255;
|
|
18722
18739
|
const BUILD_KEY = /^nbk1:[0-9a-f]{64}$/;
|
|
18740
|
+
const SANDBOX_URL_SCHEME_MAX_LENGTH = 255;
|
|
18741
|
+
const URL_SCHEME = new RegExp(`^[a-z][a-z0-9+.-]{0,254}$`);
|
|
18723
18742
|
var NativeBuildInputError = class extends TypeError {
|
|
18724
18743
|
name = "NativeBuildInputError";
|
|
18725
18744
|
};
|
|
@@ -18742,15 +18761,12 @@ const pick = (row) => ({
|
|
|
18742
18761
|
submitted_at_ms: row.submitted_at_ms ?? null,
|
|
18743
18762
|
submitted_version: row.submitted_version ?? null,
|
|
18744
18763
|
is_store_build: row.is_store_build === true,
|
|
18745
|
-
is_sandbox: row.is_sandbox === true
|
|
18764
|
+
is_sandbox: row.is_sandbox === true,
|
|
18765
|
+
sandbox_url_scheme: row.sandbox_url_scheme ?? null
|
|
18746
18766
|
});
|
|
18747
18767
|
const SANDBOX_CHANNEL_PREFIX = "sandbox-";
|
|
18748
18768
|
const OLDER_BUILDS_PAGE = 20;
|
|
18749
18769
|
const MARK_ATTEMPTS = 8;
|
|
18750
|
-
const SUBMISSION_DESTINATIONS = {
|
|
18751
|
-
android: "play-internal",
|
|
18752
|
-
ios: "testflight"
|
|
18753
|
-
};
|
|
18754
18770
|
const BUILD_NUMBER_MAX_LENGTH = 64;
|
|
18755
18771
|
const SUBMITTED_VERSION_MAX_LENGTH = 255;
|
|
18756
18772
|
const nativeBuildScopeKey = (scope) => {
|
|
@@ -18774,7 +18790,7 @@ const nativeBuildScopeKey = (scope) => {
|
|
|
18774
18790
|
return scopeKey;
|
|
18775
18791
|
};
|
|
18776
18792
|
const isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
|
|
18777
|
-
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, artifact }) => {
|
|
18793
|
+
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, artifact }) => {
|
|
18778
18794
|
if (!isUUIDv7(id)) return "id must be a UUIDv7";
|
|
18779
18795
|
if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
|
|
18780
18796
|
if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
|
|
@@ -18783,6 +18799,10 @@ const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVer
|
|
|
18783
18799
|
const reserved = channel.startsWith(SANDBOX_CHANNEL_PREFIX);
|
|
18784
18800
|
if (isSandbox === true && !reserved) return `a sandbox build registers on a ${SANDBOX_CHANNEL_PREFIX}* channel, not ${channel}`;
|
|
18785
18801
|
if (isSandbox !== true && reserved) return `channel ${channel} is reserved for sandbox builds`;
|
|
18802
|
+
if (sandboxUrlScheme !== void 0 && sandboxUrlScheme !== null) {
|
|
18803
|
+
if (isSandbox !== true) return "sandboxUrlScheme is a sandbox build's, and this isn't one";
|
|
18804
|
+
if (typeof sandboxUrlScheme !== "string" || !URL_SCHEME.test(sandboxUrlScheme)) return `sandboxUrlScheme must be a URL scheme in lower case, up to ${SANDBOX_URL_SCHEME_MAX_LENGTH} characters, or null`;
|
|
18805
|
+
}
|
|
18786
18806
|
if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
|
|
18787
18807
|
if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
|
|
18788
18808
|
if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
|
|
@@ -18818,7 +18838,8 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
18818
18838
|
submitted_at_ms: null,
|
|
18819
18839
|
submitted_version: null,
|
|
18820
18840
|
is_store_build: false,
|
|
18821
|
-
is_sandbox: registration.isSandbox === true
|
|
18841
|
+
is_sandbox: registration.isSandbox === true,
|
|
18842
|
+
sandbox_url_scheme: registration.sandboxUrlScheme ?? null
|
|
18822
18843
|
};
|
|
18823
18844
|
for (let attempt = 1;; attempt += 1) {
|
|
18824
18845
|
await insertChannel(db, {
|
|
@@ -18899,7 +18920,8 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
18899
18920
|
const row = await tx.findOne("native_builds", { id });
|
|
18900
18921
|
if (row === null) return null;
|
|
18901
18922
|
const build = pick(row);
|
|
18902
|
-
if (
|
|
18923
|
+
if (!NATIVE_BUILD_SUBMISSION_DESTINATIONS[build.platform].includes(destination)) throw new NativeBuildInputError(`Invalid native build submission: an ${build.platform} build is submitted to ${NATIVE_BUILD_SUBMISSION_DESTINATIONS[build.platform].join(" or ")}, not ${destination}.`);
|
|
18924
|
+
if (build.is_sandbox && destination !== "testflight" && destination !== "play-internal") throw new NativeBuildInputError("A sandbox build can submit only to TestFlight or Play internal testing.");
|
|
18903
18925
|
const set = {
|
|
18904
18926
|
submitted_to: destination,
|
|
18905
18927
|
submitted_at_ms: now(),
|
|
@@ -19854,7 +19876,7 @@ const refusingInvalid = async (operation) => {
|
|
|
19854
19876
|
throw error;
|
|
19855
19877
|
}
|
|
19856
19878
|
};
|
|
19857
|
-
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));
|
|
19879
|
+
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") && (value.sandboxUrlScheme === void 0 || isTextOrNull$1(value.sandboxUrlScheme)) && 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));
|
|
19858
19880
|
const scopeKeyOf = (params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "";
|
|
19859
19881
|
const createAdminRouteHandlers = () => ({
|
|
19860
19882
|
listBundles: onCore(async (core, request) => {
|
|
@@ -19998,7 +20020,7 @@ const createAdminRouteHandlers = () => ({
|
|
|
19998
20020
|
}),
|
|
19999
20021
|
recordNativeBuildSubmission: onCore(async (core, request, params) => {
|
|
20000
20022
|
const input = await body(request);
|
|
20001
|
-
if (!isRecord$5(input) ||
|
|
20023
|
+
if (!isRecord$5(input) || !Object.values(NATIVE_BUILD_SUBMISSION_DESTINATIONS).flat().includes(input.destination) || !isText$2(input.version)) throw new HandlerBadRequestError("A native build submission needs a valid store destination and version.");
|
|
20002
20024
|
const submission = {
|
|
20003
20025
|
destination: input.destination,
|
|
20004
20026
|
version: input.version
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/vercel",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.0-rc.
|
|
4
|
+
"version": "1.2.0-rc.26",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@vercel/cli-auth": "0.3.10",
|
|
42
42
|
"@vercel/cli-config": "0.3.1",
|
|
43
43
|
"pg": "8.13.1",
|
|
44
|
-
"@hot-updater/
|
|
45
|
-
"@hot-updater/
|
|
46
|
-
"@hot-updater/postgres": "1.2.0-rc.
|
|
47
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
48
|
-
"@hot-updater/server": "1.2.0-rc.
|
|
44
|
+
"@hot-updater/plugin-core": "1.2.0-rc.26",
|
|
45
|
+
"@hot-updater/cli-tools": "1.2.0-rc.26",
|
|
46
|
+
"@hot-updater/postgres": "1.2.0-rc.26",
|
|
47
|
+
"@hot-updater/protocol": "1.2.0-rc.26",
|
|
48
|
+
"@hot-updater/server": "1.2.0-rc.26"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^20",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"execa": "9.5.2",
|
|
55
55
|
"kysely": "0.28.17",
|
|
56
56
|
"vitest": "4.1.4",
|
|
57
|
-
"@hot-updater/test-utils": "1.2.0-rc.
|
|
57
|
+
"@hot-updater/test-utils": "1.2.0-rc.26"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "tsdown",
|