@hot-updater/azure 1.2.0-rc.20 → 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/dist/functions/index.mjs +36 -29
- package/package.json +6 -6
package/dist/functions/index.mjs
CHANGED
|
@@ -6105,12 +6105,16 @@ const nativeBuilds = defineTable({
|
|
|
6105
6105
|
maxLength: 255,
|
|
6106
6106
|
required: false
|
|
6107
6107
|
},
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
required: false
|
|
6111
|
-
}
|
|
6108
|
+
is_store_build: { type: "boolean" },
|
|
6109
|
+
is_sandbox: { type: "boolean" }
|
|
6112
6110
|
}, {
|
|
6113
6111
|
key: ["id"],
|
|
6112
|
+
derived: { store_build_scope_key: {
|
|
6113
|
+
type: "string",
|
|
6114
|
+
maxLength: 2048,
|
|
6115
|
+
ascii: true,
|
|
6116
|
+
compute: (row) => row.is_store_build ? row.scope_key : null
|
|
6117
|
+
} },
|
|
6114
6118
|
indexes: {
|
|
6115
6119
|
byScope: {
|
|
6116
6120
|
eq: ["scope_key"],
|
|
@@ -6121,7 +6125,7 @@ const nativeBuilds = defineTable({
|
|
|
6121
6125
|
sort: ["id"]
|
|
6122
6126
|
},
|
|
6123
6127
|
byStoreBuild: {
|
|
6124
|
-
eq: ["
|
|
6128
|
+
eq: ["store_build_scope_key"],
|
|
6125
6129
|
sort: [],
|
|
6126
6130
|
unique: true
|
|
6127
6131
|
},
|
|
@@ -6872,7 +6876,8 @@ const fieldProblems = (definition, add) => {
|
|
|
6872
6876
|
else if (field.required === false) add(`key field "${name}" is nullable`);
|
|
6873
6877
|
else if (field.type === "json") add(`key field "${name}" is json`);
|
|
6874
6878
|
}
|
|
6875
|
-
|
|
6879
|
+
const bounded = [...Object.entries(definition.fields), ...definition.kind === "table" ? Object.entries(definition.derived) : []];
|
|
6880
|
+
for (const [name, { type, maxLength, ascii }] of bounded) {
|
|
6876
6881
|
if (maxLength !== void 0 && (type !== "string" || !Number.isSafeInteger(maxLength) || maxLength < 1)) add(`field "${name}" has an invalid maxLength`);
|
|
6877
6882
|
if (ascii && type !== "string") add(`field "${name}" is ascii but not a string`);
|
|
6878
6883
|
}
|
|
@@ -6984,11 +6989,13 @@ const resolveSchema = (modules) => {
|
|
|
6984
6989
|
...maxLength === void 0 ? {} : { maxLength },
|
|
6985
6990
|
...ascii ? { ascii } : {}
|
|
6986
6991
|
}));
|
|
6987
|
-
if (definition.kind === "table") for (const [field, { type, multi }] of Object.entries(definition.derived)) columns.push({
|
|
6992
|
+
if (definition.kind === "table") for (const [field, { type, multi, maxLength, ascii }] of Object.entries(definition.derived)) columns.push({
|
|
6988
6993
|
name: field,
|
|
6989
6994
|
type,
|
|
6990
6995
|
nullable: true,
|
|
6991
|
-
...multi ? { multi } : {}
|
|
6996
|
+
...multi ? { multi } : {},
|
|
6997
|
+
...maxLength === void 0 ? {} : { maxLength },
|
|
6998
|
+
...ascii ? { ascii } : {}
|
|
6992
6999
|
});
|
|
6993
7000
|
else columns.push(integer(SHARD_COLUMN), ...[...definition.counters, ...definition.gauges].map((metric) => integer(metric)), ...definition.distinct.map((metric) => ({
|
|
6994
7001
|
name: metric,
|
|
@@ -8045,7 +8052,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
8045
8052
|
};
|
|
8046
8053
|
//#endregion
|
|
8047
8054
|
//#region ../../packages/server/dist/version.mjs
|
|
8048
|
-
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.
|
|
8055
|
+
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.22";
|
|
8049
8056
|
//#endregion
|
|
8050
8057
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
8051
8058
|
const createVersionRouteHandlers = (plugins = []) => {
|
|
@@ -9154,7 +9161,8 @@ const pick = (row) => ({
|
|
|
9154
9161
|
submitted_to: row.submitted_to ?? null,
|
|
9155
9162
|
submitted_at_ms: row.submitted_at_ms ?? null,
|
|
9156
9163
|
submitted_version: row.submitted_version ?? null,
|
|
9157
|
-
|
|
9164
|
+
is_store_build: row.is_store_build === true,
|
|
9165
|
+
is_sandbox: row.is_sandbox === true
|
|
9158
9166
|
});
|
|
9159
9167
|
const SANDBOX_CHANNEL_PREFIX = "sandbox-";
|
|
9160
9168
|
const OLDER_BUILDS_PAGE = 20;
|
|
@@ -9186,11 +9194,15 @@ const nativeBuildScopeKey = (scope) => {
|
|
|
9186
9194
|
return scopeKey;
|
|
9187
9195
|
};
|
|
9188
9196
|
const isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
|
|
9189
|
-
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, artifact }) => {
|
|
9197
|
+
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, artifact }) => {
|
|
9190
9198
|
if (!isUUIDv7(id)) return "id must be a UUIDv7";
|
|
9191
9199
|
if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
|
|
9192
9200
|
if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
|
|
9193
9201
|
if (channel.trim().length === 0) return "channel is required";
|
|
9202
|
+
if (isSandbox !== void 0 && typeof isSandbox !== "boolean") return "isSandbox must be true or false";
|
|
9203
|
+
const reserved = channel.startsWith(SANDBOX_CHANNEL_PREFIX);
|
|
9204
|
+
if (isSandbox === true && !reserved) return `a sandbox build registers on a ${SANDBOX_CHANNEL_PREFIX}* channel, not ${channel}`;
|
|
9205
|
+
if (isSandbox !== true && reserved) return `channel ${channel} is reserved for sandbox builds`;
|
|
9194
9206
|
if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
|
|
9195
9207
|
if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
|
|
9196
9208
|
if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
|
|
@@ -9225,7 +9237,8 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
9225
9237
|
submitted_to: null,
|
|
9226
9238
|
submitted_at_ms: null,
|
|
9227
9239
|
submitted_version: null,
|
|
9228
|
-
|
|
9240
|
+
is_store_build: false,
|
|
9241
|
+
is_sandbox: registration.isSandbox === true
|
|
9229
9242
|
};
|
|
9230
9243
|
for (let attempt = 1;; attempt += 1) {
|
|
9231
9244
|
await insertChannel(db, {
|
|
@@ -9264,10 +9277,7 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
9264
9277
|
const buildKey = options?.buildKey;
|
|
9265
9278
|
if (buildKey !== void 0 && !BUILD_KEY.test(buildKey)) throw new NativeBuildInputError("Invalid native build key: it must be nbk1: and a SHA-256.");
|
|
9266
9279
|
if (options?.storeBuild) {
|
|
9267
|
-
const marked = await db.findOne("native_builds", {
|
|
9268
|
-
scope_key: scopeKey,
|
|
9269
|
-
store_build: true
|
|
9270
|
-
});
|
|
9280
|
+
const marked = await db.findOne("native_builds", { store_build_scope_key: scopeKey });
|
|
9271
9281
|
return marked === null ? null : pick(marked);
|
|
9272
9282
|
}
|
|
9273
9283
|
const read = (limit, before) => {
|
|
@@ -9329,34 +9339,31 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
9329
9339
|
if (row === null) return null;
|
|
9330
9340
|
const build = pick(row);
|
|
9331
9341
|
if (!storeBuild) {
|
|
9332
|
-
if (build.
|
|
9342
|
+
if (build.is_store_build) tx.update("native_builds", row, { is_store_build: false });
|
|
9333
9343
|
return {
|
|
9334
9344
|
nativeBuild: {
|
|
9335
9345
|
...build,
|
|
9336
|
-
|
|
9346
|
+
is_store_build: false
|
|
9337
9347
|
},
|
|
9338
9348
|
previous: null
|
|
9339
9349
|
};
|
|
9340
9350
|
}
|
|
9341
|
-
if (
|
|
9342
|
-
if (build.
|
|
9351
|
+
if (build.is_sandbox) throw new NativeBuildInputError("A sandbox build can't be the store build.");
|
|
9352
|
+
if (build.is_store_build) return {
|
|
9343
9353
|
nativeBuild: build,
|
|
9344
9354
|
previous: null
|
|
9345
9355
|
};
|
|
9346
|
-
const holder = await tx.findOne("native_builds", {
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
});
|
|
9350
|
-
if (holder !== null) tx.update("native_builds", holder, { store_build: null });
|
|
9351
|
-
tx.update("native_builds", row, { store_build: true });
|
|
9356
|
+
const holder = await tx.findOne("native_builds", { store_build_scope_key: build.scope_key });
|
|
9357
|
+
if (holder !== null) tx.update("native_builds", holder, { is_store_build: false });
|
|
9358
|
+
tx.update("native_builds", row, { is_store_build: true });
|
|
9352
9359
|
return {
|
|
9353
9360
|
nativeBuild: {
|
|
9354
9361
|
...build,
|
|
9355
|
-
|
|
9362
|
+
is_store_build: true
|
|
9356
9363
|
},
|
|
9357
9364
|
previous: holder === null ? null : {
|
|
9358
9365
|
...pick(holder),
|
|
9359
|
-
|
|
9366
|
+
is_store_build: false
|
|
9360
9367
|
}
|
|
9361
9368
|
};
|
|
9362
9369
|
});
|
|
@@ -10267,7 +10274,7 @@ const refusingInvalid = async (operation) => {
|
|
|
10267
10274
|
throw error;
|
|
10268
10275
|
}
|
|
10269
10276
|
};
|
|
10270
|
-
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));
|
|
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));
|
|
10271
10278
|
const scopeKeyOf = (params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "";
|
|
10272
10279
|
const createAdminRouteHandlers = () => ({
|
|
10273
10280
|
listBundles: onCore(async (core, request) => {
|
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.22",
|
|
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/plugin-core": "1.2.0-rc.
|
|
49
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
50
|
-
"@hot-updater/server": "1.2.0-rc.
|
|
47
|
+
"@hot-updater/cli-tools": "1.2.0-rc.22",
|
|
48
|
+
"@hot-updater/plugin-core": "1.2.0-rc.22",
|
|
49
|
+
"@hot-updater/protocol": "1.2.0-rc.22",
|
|
50
|
+
"@hot-updater/server": "1.2.0-rc.22"
|
|
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.22"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|