@hot-updater/aws 1.2.0-rc.21 → 1.2.0-rc.23
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/lambda/index.cjs +50 -36
- package/package.json +8 -8
package/dist/lambda/index.cjs
CHANGED
|
@@ -2398,10 +2398,15 @@ const channels = defineTable({
|
|
|
2398
2398
|
* or `versionCode`. `submitted_to`, `submitted_at_ms` and
|
|
2399
2399
|
* `submitted_version` record the store track a build went to, when, and
|
|
2400
2400
|
* the store's label of the build; they stay null for a build no store took.
|
|
2401
|
-
* `
|
|
2402
|
-
* and
|
|
2403
|
-
*
|
|
2404
|
-
*
|
|
2401
|
+
* `is_store_build` is true on the build a person or a job says the store
|
|
2402
|
+
* sells, and false on every other: deploys patch from it over the scope's
|
|
2403
|
+
* newest build. The engine copies the scope key into `store_build_scope_key`
|
|
2404
|
+
* for that build alone, so `byStoreBuild` holds one entry per scope at most,
|
|
2405
|
+
* on every store, while any number of a scope's builds hold none.
|
|
2406
|
+
* `is_sandbox` is true on a sandbox build, set when it registers and never
|
|
2407
|
+
* changed. Boolean columns follow one rule: `is_*` for a fact about the row or
|
|
2408
|
+
* `should_*` for an instruction to the client, never null; a unique index over
|
|
2409
|
+
* the rows where one is true keys a derived slot, not the boolean.
|
|
2405
2410
|
*/
|
|
2406
2411
|
const nativeBuilds = defineTable({
|
|
2407
2412
|
id: {
|
|
@@ -2479,12 +2484,18 @@ const nativeBuilds = defineTable({
|
|
|
2479
2484
|
maxLength: 255,
|
|
2480
2485
|
required: false
|
|
2481
2486
|
},
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
required: false
|
|
2485
|
-
}
|
|
2487
|
+
is_store_build: { type: "boolean" },
|
|
2488
|
+
is_sandbox: { type: "boolean" }
|
|
2486
2489
|
}, {
|
|
2487
2490
|
key: ["id"],
|
|
2491
|
+
derived: {
|
|
2492
|
+
/** The scope this build is the store build of; null on every other. */
|
|
2493
|
+
store_build_scope_key: {
|
|
2494
|
+
type: "string",
|
|
2495
|
+
maxLength: 2048,
|
|
2496
|
+
ascii: true,
|
|
2497
|
+
compute: (row) => row.is_store_build ? row.scope_key : null
|
|
2498
|
+
} },
|
|
2488
2499
|
indexes: {
|
|
2489
2500
|
byScope: {
|
|
2490
2501
|
eq: ["scope_key"],
|
|
@@ -2495,7 +2506,7 @@ const nativeBuilds = defineTable({
|
|
|
2495
2506
|
sort: ["id"]
|
|
2496
2507
|
},
|
|
2497
2508
|
byStoreBuild: {
|
|
2498
|
-
eq: ["
|
|
2509
|
+
eq: ["store_build_scope_key"],
|
|
2499
2510
|
sort: [],
|
|
2500
2511
|
unique: true
|
|
2501
2512
|
},
|
|
@@ -3368,7 +3379,8 @@ const fieldProblems = (definition, add) => {
|
|
|
3368
3379
|
else if (field.required === false) add(`key field "${name}" is nullable`);
|
|
3369
3380
|
else if (field.type === "json") add(`key field "${name}" is json`);
|
|
3370
3381
|
}
|
|
3371
|
-
|
|
3382
|
+
const bounded = [...Object.entries(definition.fields), ...definition.kind === "table" ? Object.entries(definition.derived) : []];
|
|
3383
|
+
for (const [name, { type, maxLength, ascii }] of bounded) {
|
|
3372
3384
|
if (maxLength !== void 0 && (type !== "string" || !Number.isSafeInteger(maxLength) || maxLength < 1)) add(`field "${name}" has an invalid maxLength`);
|
|
3373
3385
|
if (ascii && type !== "string") add(`field "${name}" is ascii but not a string`);
|
|
3374
3386
|
}
|
|
@@ -3485,11 +3497,13 @@ const resolveSchema = (modules) => {
|
|
|
3485
3497
|
...maxLength === void 0 ? {} : { maxLength },
|
|
3486
3498
|
...ascii ? { ascii } : {}
|
|
3487
3499
|
}));
|
|
3488
|
-
if (definition.kind === "table") for (const [field, { type, multi }] of Object.entries(definition.derived)) columns.push({
|
|
3500
|
+
if (definition.kind === "table") for (const [field, { type, multi, maxLength, ascii }] of Object.entries(definition.derived)) columns.push({
|
|
3489
3501
|
name: field,
|
|
3490
3502
|
type,
|
|
3491
3503
|
nullable: true,
|
|
3492
|
-
...multi ? { multi } : {}
|
|
3504
|
+
...multi ? { multi } : {},
|
|
3505
|
+
...maxLength === void 0 ? {} : { maxLength },
|
|
3506
|
+
...ascii ? { ascii } : {}
|
|
3493
3507
|
});
|
|
3494
3508
|
else columns.push(integer(SHARD_COLUMN), ...[...definition.counters, ...definition.gauges].map((metric) => integer(metric)), ...definition.distinct.map((metric) => ({
|
|
3495
3509
|
name: metric,
|
|
@@ -4632,7 +4646,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
4632
4646
|
};
|
|
4633
4647
|
//#endregion
|
|
4634
4648
|
//#region ../../packages/server/dist/version.mjs
|
|
4635
|
-
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.
|
|
4649
|
+
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.23";
|
|
4636
4650
|
//#endregion
|
|
4637
4651
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
4638
4652
|
/**
|
|
@@ -5838,12 +5852,13 @@ const pick = (row) => ({
|
|
|
5838
5852
|
submitted_to: row.submitted_to ?? null,
|
|
5839
5853
|
submitted_at_ms: row.submitted_at_ms ?? null,
|
|
5840
5854
|
submitted_version: row.submitted_version ?? null,
|
|
5841
|
-
|
|
5855
|
+
is_store_build: row.is_store_build === true,
|
|
5856
|
+
is_sandbox: row.is_sandbox === true
|
|
5842
5857
|
});
|
|
5843
5858
|
/**
|
|
5844
|
-
* The channels only sandbox builds register on
|
|
5845
|
-
* registry's convention, as
|
|
5846
|
-
* for a build's artifact.
|
|
5859
|
+
* The channels only sandbox builds register on: a registration's `sandbox`
|
|
5860
|
+
* must agree with it. The registry's convention, as
|
|
5861
|
+
* `@hot-updater/protocol/native-artifact` checks it for a build's artifact.
|
|
5847
5862
|
*/
|
|
5848
5863
|
const SANDBOX_CHANNEL_PREFIX = "sandbox-";
|
|
5849
5864
|
/**
|
|
@@ -5890,11 +5905,15 @@ const nativeBuildScopeKey = (scope) => {
|
|
|
5890
5905
|
};
|
|
5891
5906
|
/** Whether `bundleId` is a native build's built-in bundle: one unique read. */
|
|
5892
5907
|
const isBuiltInBundle = async (db, bundleId) => await db.findOne("native_builds", { min_bundle_id: bundleId }) !== null;
|
|
5893
|
-
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, artifact }) => {
|
|
5908
|
+
const problemOf = ({ id, minBundleId, platform, channel, fingerprintHash, appVersion, gitCommitHash, buildKey, buildNumber, isSandbox, artifact }) => {
|
|
5894
5909
|
if (!isUUIDv7(id)) return "id must be a UUIDv7";
|
|
5895
5910
|
if (!isUUIDv7(minBundleId)) return "minBundleId must be the UUIDv7 a release build compiles in";
|
|
5896
5911
|
if (platform !== "ios" && platform !== "android") return "platform must be ios or android";
|
|
5897
5912
|
if (channel.trim().length === 0) return "channel is required";
|
|
5913
|
+
if (isSandbox !== void 0 && typeof isSandbox !== "boolean") return "isSandbox must be true or false";
|
|
5914
|
+
const reserved = channel.startsWith(SANDBOX_CHANNEL_PREFIX);
|
|
5915
|
+
if (isSandbox === true && !reserved) return `a sandbox build registers on a ${SANDBOX_CHANNEL_PREFIX}* channel, not ${channel}`;
|
|
5916
|
+
if (isSandbox !== true && reserved) return `channel ${channel} is reserved for sandbox builds`;
|
|
5898
5917
|
if (gitCommitHash !== null && gitCommitHash.length > GIT_COMMIT_HASH_MAX_LENGTH) return `gitCommitHash must be at most ${GIT_COMMIT_HASH_MAX_LENGTH} characters`;
|
|
5899
5918
|
if (fingerprintHash === null === (appVersion === null)) return "exactly one of fingerprintHash and appVersion is required";
|
|
5900
5919
|
if (buildKey !== null && !BUILD_KEY.test(buildKey)) return "buildKey must be nbk1: and a SHA-256, or null";
|
|
@@ -5930,7 +5949,8 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
5930
5949
|
submitted_to: null,
|
|
5931
5950
|
submitted_at_ms: null,
|
|
5932
5951
|
submitted_version: null,
|
|
5933
|
-
|
|
5952
|
+
is_store_build: false,
|
|
5953
|
+
is_sandbox: registration.isSandbox === true
|
|
5934
5954
|
};
|
|
5935
5955
|
for (let attempt = 1;; attempt += 1) {
|
|
5936
5956
|
await insertChannel(db, {
|
|
@@ -5969,10 +5989,7 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
5969
5989
|
const buildKey = options?.buildKey;
|
|
5970
5990
|
if (buildKey !== void 0 && !BUILD_KEY.test(buildKey)) throw new NativeBuildInputError("Invalid native build key: it must be nbk1: and a SHA-256.");
|
|
5971
5991
|
if (options?.storeBuild) {
|
|
5972
|
-
const marked = await db.findOne("native_builds", {
|
|
5973
|
-
scope_key: scopeKey,
|
|
5974
|
-
store_build: true
|
|
5975
|
-
});
|
|
5992
|
+
const marked = await db.findOne("native_builds", { store_build_scope_key: scopeKey });
|
|
5976
5993
|
return marked === null ? null : pick(marked);
|
|
5977
5994
|
}
|
|
5978
5995
|
const read = (limit, before) => {
|
|
@@ -6034,34 +6051,31 @@ const createNativeBuildApi = (db, { now = Date.now } = {}) => ({
|
|
|
6034
6051
|
if (row === null) return null;
|
|
6035
6052
|
const build = pick(row);
|
|
6036
6053
|
if (!storeBuild) {
|
|
6037
|
-
if (build.
|
|
6054
|
+
if (build.is_store_build) tx.update("native_builds", row, { is_store_build: false });
|
|
6038
6055
|
return {
|
|
6039
6056
|
nativeBuild: {
|
|
6040
6057
|
...build,
|
|
6041
|
-
|
|
6058
|
+
is_store_build: false
|
|
6042
6059
|
},
|
|
6043
6060
|
previous: null
|
|
6044
6061
|
};
|
|
6045
6062
|
}
|
|
6046
|
-
if (
|
|
6047
|
-
if (build.
|
|
6063
|
+
if (build.is_sandbox) throw new NativeBuildInputError("A sandbox build can't be the store build.");
|
|
6064
|
+
if (build.is_store_build) return {
|
|
6048
6065
|
nativeBuild: build,
|
|
6049
6066
|
previous: null
|
|
6050
6067
|
};
|
|
6051
|
-
const holder = await tx.findOne("native_builds", {
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
});
|
|
6055
|
-
if (holder !== null) tx.update("native_builds", holder, { store_build: null });
|
|
6056
|
-
tx.update("native_builds", row, { store_build: true });
|
|
6068
|
+
const holder = await tx.findOne("native_builds", { store_build_scope_key: build.scope_key });
|
|
6069
|
+
if (holder !== null) tx.update("native_builds", holder, { is_store_build: false });
|
|
6070
|
+
tx.update("native_builds", row, { is_store_build: true });
|
|
6057
6071
|
return {
|
|
6058
6072
|
nativeBuild: {
|
|
6059
6073
|
...build,
|
|
6060
|
-
|
|
6074
|
+
is_store_build: true
|
|
6061
6075
|
},
|
|
6062
6076
|
previous: holder === null ? null : {
|
|
6063
6077
|
...pick(holder),
|
|
6064
|
-
|
|
6078
|
+
is_store_build: false
|
|
6065
6079
|
}
|
|
6066
6080
|
};
|
|
6067
6081
|
});
|
|
@@ -7023,7 +7037,7 @@ const refusingInvalid = async (operation) => {
|
|
|
7023
7037
|
throw error;
|
|
7024
7038
|
}
|
|
7025
7039
|
};
|
|
7026
|
-
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));
|
|
7040
|
+
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));
|
|
7027
7041
|
const scopeKeyOf = (params) => decodeMaybe(requireRouteParam(params, "scopeKey")) ?? "";
|
|
7028
7042
|
/** Every admin route's handler, by the name `ADMIN_ROUTES` mounts it under. */
|
|
7029
7043
|
const createAdminRouteHandlers = () => ({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/aws",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.0-rc.
|
|
4
|
+
"version": "1.2.0-rc.23",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"es-toolkit": "^1.32.0",
|
|
46
46
|
"execa": "9.5.2",
|
|
47
47
|
"mime": "^4.0.4",
|
|
48
|
-
"@hot-updater/protocol": "1.2.0-rc.
|
|
49
|
-
"@hot-updater/mock": "1.2.0-rc.
|
|
50
|
-
"@hot-updater/test-utils": "1.2.0-rc.
|
|
48
|
+
"@hot-updater/protocol": "1.2.0-rc.23",
|
|
49
|
+
"@hot-updater/mock": "1.2.0-rc.23",
|
|
50
|
+
"@hot-updater/test-utils": "1.2.0-rc.23"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@aws-sdk/client-cloudfront": "3.1066.0",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"@aws-sdk/lib-dynamodb": "3.1066.0",
|
|
65
65
|
"@aws-sdk/s3-request-presigner": "3.1066.0",
|
|
66
66
|
"hono": "4.12.34",
|
|
67
|
-
"@hot-updater/plugin-core": "1.2.0-rc.
|
|
68
|
-
"@hot-updater/
|
|
69
|
-
"@hot-updater/
|
|
70
|
-
"@hot-updater/storage-s3": "1.2.0-rc.
|
|
67
|
+
"@hot-updater/plugin-core": "1.2.0-rc.23",
|
|
68
|
+
"@hot-updater/server": "1.2.0-rc.23",
|
|
69
|
+
"@hot-updater/cli-tools": "1.2.0-rc.23",
|
|
70
|
+
"@hot-updater/storage-s3": "1.2.0-rc.23"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "tsdown",
|