@hot-updater/azure 1.2.0-rc.23 → 1.2.0-rc.25
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/functions/index.mjs +34 -12
- package/package.json +6 -6
package/dist/functions/index.mjs
CHANGED
|
@@ -6106,7 +6106,13 @@ const nativeBuilds = defineTable({
|
|
|
6106
6106
|
required: false
|
|
6107
6107
|
},
|
|
6108
6108
|
is_store_build: { type: "boolean" },
|
|
6109
|
-
is_sandbox: { type: "boolean" }
|
|
6109
|
+
is_sandbox: { type: "boolean" },
|
|
6110
|
+
sandbox_url_scheme: {
|
|
6111
|
+
type: "string",
|
|
6112
|
+
maxLength: 255,
|
|
6113
|
+
ascii: true,
|
|
6114
|
+
required: false
|
|
6115
|
+
}
|
|
6110
6116
|
}, {
|
|
6111
6117
|
key: ["id"],
|
|
6112
6118
|
derived: { store_build_scope_key: {
|
|
@@ -8052,7 +8058,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
8052
8058
|
};
|
|
8053
8059
|
//#endregion
|
|
8054
8060
|
//#region ../../packages/server/dist/version.mjs
|
|
8055
|
-
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.
|
|
8061
|
+
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.25";
|
|
8056
8062
|
//#endregion
|
|
8057
8063
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
8058
8064
|
const createVersionRouteHandlers = (plugins = []) => {
|
|
@@ -9043,6 +9049,17 @@ const createCoreReads = (db, storage) => {
|
|
|
9043
9049
|
};
|
|
9044
9050
|
};
|
|
9045
9051
|
//#endregion
|
|
9052
|
+
//#region ../../packages/server/dist/core/nativeBuildDestinations.mjs
|
|
9053
|
+
const NATIVE_BUILD_SUBMISSION_DESTINATIONS = {
|
|
9054
|
+
android: [
|
|
9055
|
+
"play-internal",
|
|
9056
|
+
"play-closed",
|
|
9057
|
+
"play-open",
|
|
9058
|
+
"play-production"
|
|
9059
|
+
],
|
|
9060
|
+
ios: ["testflight"]
|
|
9061
|
+
};
|
|
9062
|
+
//#endregion
|
|
9046
9063
|
//#region ../../packages/server/dist/core/writes.mjs
|
|
9047
9064
|
const PAGE$2 = 500;
|
|
9048
9065
|
const countBundle = (tx, platform, delta) => {
|
|
@@ -9140,6 +9157,8 @@ const ARTIFACT_KINDS = {
|
|
|
9140
9157
|
const SCOPE_KEY_MAX_LENGTH = 2048;
|
|
9141
9158
|
const GIT_COMMIT_HASH_MAX_LENGTH = 255;
|
|
9142
9159
|
const BUILD_KEY = /^nbk1:[0-9a-f]{64}$/;
|
|
9160
|
+
const SANDBOX_URL_SCHEME_MAX_LENGTH = 255;
|
|
9161
|
+
const URL_SCHEME = new RegExp(`^[a-z][a-z0-9+.-]{0,254}$`);
|
|
9143
9162
|
var NativeBuildInputError = class extends TypeError {
|
|
9144
9163
|
name = "NativeBuildInputError";
|
|
9145
9164
|
};
|
|
@@ -9162,15 +9181,12 @@ const pick = (row) => ({
|
|
|
9162
9181
|
submitted_at_ms: row.submitted_at_ms ?? null,
|
|
9163
9182
|
submitted_version: row.submitted_version ?? null,
|
|
9164
9183
|
is_store_build: row.is_store_build === true,
|
|
9165
|
-
is_sandbox: row.is_sandbox === true
|
|
9184
|
+
is_sandbox: row.is_sandbox === true,
|
|
9185
|
+
sandbox_url_scheme: row.sandbox_url_scheme ?? null
|
|
9166
9186
|
});
|
|
9167
9187
|
const SANDBOX_CHANNEL_PREFIX = "sandbox-";
|
|
9168
9188
|
const OLDER_BUILDS_PAGE = 20;
|
|
9169
9189
|
const MARK_ATTEMPTS = 8;
|
|
9170
|
-
const SUBMISSION_DESTINATIONS = {
|
|
9171
|
-
android: "play-internal",
|
|
9172
|
-
ios: "testflight"
|
|
9173
|
-
};
|
|
9174
9190
|
const BUILD_NUMBER_MAX_LENGTH = 64;
|
|
9175
9191
|
const SUBMITTED_VERSION_MAX_LENGTH = 255;
|
|
9176
9192
|
const nativeBuildScopeKey = (scope) => {
|
|
@@ -9194,7 +9210,7 @@ const nativeBuildScopeKey = (scope) => {
|
|
|
9194
9210
|
return scopeKey;
|
|
9195
9211
|
};
|
|
9196
9212
|
const isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
|
|
9197
|
-
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, artifact }) => {
|
|
9213
|
+
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, sandboxUrlScheme, artifact }) => {
|
|
9198
9214
|
if (!isUUIDv7(id)) return "id must be a UUIDv7";
|
|
9199
9215
|
if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
|
|
9200
9216
|
if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
|
|
@@ -9203,6 +9219,10 @@ const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVer
|
|
|
9203
9219
|
const reserved = channel.startsWith(SANDBOX_CHANNEL_PREFIX);
|
|
9204
9220
|
if (isSandbox === true && !reserved) return `a sandbox build registers on a ${SANDBOX_CHANNEL_PREFIX}* channel, not ${channel}`;
|
|
9205
9221
|
if (isSandbox !== true && reserved) return `channel ${channel} is reserved for sandbox builds`;
|
|
9222
|
+
if (sandboxUrlScheme !== void 0 && sandboxUrlScheme !== null) {
|
|
9223
|
+
if (isSandbox !== true) return "sandboxUrlScheme is a sandbox build's, and this isn't one";
|
|
9224
|
+
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`;
|
|
9225
|
+
}
|
|
9206
9226
|
if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
|
|
9207
9227
|
if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
|
|
9208
9228
|
if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
|
|
@@ -9238,7 +9258,8 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
9238
9258
|
submitted_at_ms: null,
|
|
9239
9259
|
submitted_version: null,
|
|
9240
9260
|
is_store_build: false,
|
|
9241
|
-
is_sandbox: registration.isSandbox === true
|
|
9261
|
+
is_sandbox: registration.isSandbox === true,
|
|
9262
|
+
sandbox_url_scheme: registration.sandboxUrlScheme ?? null
|
|
9242
9263
|
};
|
|
9243
9264
|
for (let attempt = 1;; attempt += 1) {
|
|
9244
9265
|
await insertChannel(db, {
|
|
@@ -9319,7 +9340,8 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
9319
9340
|
const row = await tx.findOne("native_builds", { id });
|
|
9320
9341
|
if (row === null) return null;
|
|
9321
9342
|
const build = pick(row);
|
|
9322
|
-
if (
|
|
9343
|
+
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}.`);
|
|
9344
|
+
if (build.is_sandbox && destination !== "testflight" && destination !== "play-internal") throw new NativeBuildInputError("A sandbox build can submit only to TestFlight or Play internal testing.");
|
|
9323
9345
|
const set = {
|
|
9324
9346
|
submitted_to: destination,
|
|
9325
9347
|
submitted_at_ms: now(),
|
|
@@ -10274,7 +10296,7 @@ const refusingInvalid = async (operation) => {
|
|
|
10274
10296
|
throw error;
|
|
10275
10297
|
}
|
|
10276
10298
|
};
|
|
10277
|
-
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));
|
|
10299
|
+
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));
|
|
10278
10300
|
const scopeKeyOf = (params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "";
|
|
10279
10301
|
const createAdminRouteHandlers = () => ({
|
|
10280
10302
|
listBundles: onCore(async (core, request) => {
|
|
@@ -10418,7 +10440,7 @@ const createAdminRouteHandlers = () => ({
|
|
|
10418
10440
|
}),
|
|
10419
10441
|
recordNativeBuildSubmission: onCore(async (core, request, params) => {
|
|
10420
10442
|
const input = await body$1(request);
|
|
10421
|
-
if (!isRecord$5(input) ||
|
|
10443
|
+
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.");
|
|
10422
10444
|
const submission = {
|
|
10423
10445
|
destination: input.destination,
|
|
10424
10446
|
version: input.version
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/azure",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.0-rc.
|
|
4
|
+
"version": "1.2.0-rc.25",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@azure/identity": "4.14.0",
|
|
45
45
|
"@azure/keyvault-secrets": "4.11.2",
|
|
46
46
|
"@azure/storage-blob": "12.34.0",
|
|
47
|
-
"@hot-updater/cli-tools": "1.2.0-rc.
|
|
48
|
-
"@hot-updater/
|
|
49
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
50
|
-
"@hot-updater/
|
|
47
|
+
"@hot-updater/cli-tools": "1.2.0-rc.25",
|
|
48
|
+
"@hot-updater/plugin-core": "1.2.0-rc.25",
|
|
49
|
+
"@hot-updater/protocol": "1.2.0-rc.25",
|
|
50
|
+
"@hot-updater/server": "1.2.0-rc.25"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@azure/functions": "4.16.5",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"execa": "9.5.2",
|
|
56
56
|
"jszip": "^3.10.1",
|
|
57
57
|
"vitest": "4.1.4",
|
|
58
|
-
"@hot-updater/test-utils": "1.2.0-rc.
|
|
58
|
+
"@hot-updater/test-utils": "1.2.0-rc.25"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|