@hot-updater/aws 1.0.0-rc.28 → 1.0.0-rc.29
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/index.d.cts +9 -0
- package/dist/index.d.mts +9 -0
- package/dist/lambda/index.cjs +44 -5
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -89,6 +89,14 @@ type BundleEventFailure = DatabaseJsonObject & {
|
|
|
89
89
|
/** Android's `ApplicationExitInfo` reason for the process before this one. */
|
|
90
90
|
readonly previous_process_exit?: string;
|
|
91
91
|
};
|
|
92
|
+
type DatabaseHttpResponse = DatabaseJsonObject & {
|
|
93
|
+
readonly resource: "catalog" | "artifact";
|
|
94
|
+
readonly path: string;
|
|
95
|
+
readonly status: number;
|
|
96
|
+
readonly body: string | null;
|
|
97
|
+
readonly body_truncated: boolean;
|
|
98
|
+
readonly received_at_ms: number;
|
|
99
|
+
};
|
|
92
100
|
/** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
|
|
93
101
|
type DatabaseBundleEventMetadata = DatabaseJsonObject & {
|
|
94
102
|
readonly cohort: string;
|
|
@@ -97,6 +105,7 @@ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
|
|
|
97
105
|
readonly sdk_version: string | null;
|
|
98
106
|
/** `UPDATE_FAILED`: what failed. */
|
|
99
107
|
readonly failure?: BundleEventFailure;
|
|
108
|
+
readonly http_response?: DatabaseHttpResponse;
|
|
100
109
|
/** `UPDATE_DOWNLOADED`: how the bundle arrived. */
|
|
101
110
|
readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
|
|
102
111
|
/** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
|
package/dist/index.d.mts
CHANGED
|
@@ -89,6 +89,14 @@ type BundleEventFailure = DatabaseJsonObject & {
|
|
|
89
89
|
/** Android's `ApplicationExitInfo` reason for the process before this one. */
|
|
90
90
|
readonly previous_process_exit?: string;
|
|
91
91
|
};
|
|
92
|
+
type DatabaseHttpResponse = DatabaseJsonObject & {
|
|
93
|
+
readonly resource: "catalog" | "artifact";
|
|
94
|
+
readonly path: string;
|
|
95
|
+
readonly status: number;
|
|
96
|
+
readonly body: string | null;
|
|
97
|
+
readonly body_truncated: boolean;
|
|
98
|
+
readonly received_at_ms: number;
|
|
99
|
+
};
|
|
92
100
|
/** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
|
|
93
101
|
type DatabaseBundleEventMetadata = DatabaseJsonObject & {
|
|
94
102
|
readonly cohort: string;
|
|
@@ -97,6 +105,7 @@ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
|
|
|
97
105
|
readonly sdk_version: string | null;
|
|
98
106
|
/** `UPDATE_FAILED`: what failed. */
|
|
99
107
|
readonly failure?: BundleEventFailure;
|
|
108
|
+
readonly http_response?: DatabaseHttpResponse;
|
|
100
109
|
/** `UPDATE_DOWNLOADED`: how the bundle arrived. */
|
|
101
110
|
readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
|
|
102
111
|
/** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
|
package/dist/lambda/index.cjs
CHANGED
|
@@ -4570,7 +4570,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
4570
4570
|
};
|
|
4571
4571
|
//#endregion
|
|
4572
4572
|
//#region ../../packages/server/dist/version.mjs
|
|
4573
|
-
const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.
|
|
4573
|
+
const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.29";
|
|
4574
4574
|
//#endregion
|
|
4575
4575
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
4576
4576
|
/**
|
|
@@ -9790,9 +9790,10 @@ const apiKeys = (options = {}) => {
|
|
|
9790
9790
|
//#region ../insights/dist/server/eventRow.mjs
|
|
9791
9791
|
const isOptional = (value, key, valid) => !Object.hasOwn(value, key) || valid(value[key]);
|
|
9792
9792
|
const isString = (value) => typeof value === "string";
|
|
9793
|
+
const isDatabaseHttpResponse = (value) => isDatabaseJsonObject(value) && (value.resource === "catalog" || value.resource === "artifact") && isString(value.path) && Number.isSafeInteger(value.status) && (value.body === null || isString(value.body)) && typeof value.body_truncated === "boolean" && Number.isSafeInteger(value.received_at_ms);
|
|
9793
9794
|
/** An `UPDATE_FAILED` report's stored failure: a stage and a reason, and what else the client knew. */
|
|
9794
9795
|
const isDatabaseBundleEventFailure = (value) => isDatabaseJsonObject(value) && isString(value.stage) && isString(value.reason) && isOptional(value, "resource", isString) && isOptional(value, "http_status", (status) => Number.isSafeInteger(status)) && isOptional(value, "transport", isString) && isOptional(value, "origin_code", isString) && isOptional(value, "error_message", isString) && isOptional(value, "error_stack", isString) && isOptional(value, "previous_process_exit", isString);
|
|
9795
|
-
const isDatabaseBundleEventMetadata = (value) => isDatabaseJsonObject(value) && typeof value.cohort === "string" && (value.update_strategy === null || value.update_strategy === "fingerprint" || value.update_strategy === "appVersion") && (value.fingerprint_hash === null || typeof value.fingerprint_hash === "string") && (value.sdk_version === null || typeof value.sdk_version === "string") && isOptional(value, "failure", isDatabaseBundleEventFailure) && isOptional(value, "delivery", isString) && isOptional(value, "patch_fallback", (flag) => typeof flag === "boolean") && isOptional(value, "previous_process_exit", isString);
|
|
9796
|
+
const isDatabaseBundleEventMetadata = (value) => isDatabaseJsonObject(value) && typeof value.cohort === "string" && (value.update_strategy === null || value.update_strategy === "fingerprint" || value.update_strategy === "appVersion") && (value.fingerprint_hash === null || typeof value.fingerprint_hash === "string") && (value.sdk_version === null || typeof value.sdk_version === "string") && isOptional(value, "failure", isDatabaseBundleEventFailure) && isOptional(value, "http_response", isDatabaseHttpResponse) && isOptional(value, "delivery", isString) && isOptional(value, "patch_fallback", (flag) => typeof flag === "boolean") && isOptional(value, "previous_process_exit", isString);
|
|
9796
9797
|
const isRecord$2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9797
9798
|
const isIdentity$1 = (value) => typeof value === "string" && value.length > 0 && value.length <= 255;
|
|
9798
9799
|
const isTextOrNull = (value) => value === null || typeof value === "string";
|
|
@@ -10158,6 +10159,17 @@ function readFailure(value) {
|
|
|
10158
10159
|
...previousProcessExit === void 0 ? {} : { previousProcessExit }
|
|
10159
10160
|
};
|
|
10160
10161
|
}
|
|
10162
|
+
function readHttpResponse(value) {
|
|
10163
|
+
if (!isRecord$1(value) || value.resource !== "catalog" && value.resource !== "artifact" || typeof value.path !== "string" || value.path.length > 1024 || !Number.isSafeInteger(value.status) || value.status < 100 || value.status > 599 || value.body !== null && (typeof value.body !== "string" || new TextEncoder().encode(JSON.stringify(value.body)).byteLength > 4096) || typeof value.bodyTruncated !== "boolean" || !Number.isSafeInteger(value.receivedAtMs) || value.receivedAtMs < 0) throw new InsightsBadRequestError("Invalid HTTP response details");
|
|
10164
|
+
return {
|
|
10165
|
+
resource: value.resource,
|
|
10166
|
+
path: value.path,
|
|
10167
|
+
status: value.status,
|
|
10168
|
+
body: value.body,
|
|
10169
|
+
bodyTruncated: value.bodyTruncated,
|
|
10170
|
+
receivedAtMs: value.receivedAtMs
|
|
10171
|
+
};
|
|
10172
|
+
}
|
|
10161
10173
|
async function readBoundedText(request) {
|
|
10162
10174
|
const contentLength = request.headers.get("content-length");
|
|
10163
10175
|
const declaredByteLength = Number(contentLength);
|
|
@@ -10193,7 +10205,10 @@ function requireEvent(payload) {
|
|
|
10193
10205
|
const platform = requireStringField(payload, "platform");
|
|
10194
10206
|
if (platform !== "ios" && platform !== "android") throw new InsightsBadRequestError("Invalid event field: platform");
|
|
10195
10207
|
const eventId = readEventId(payload);
|
|
10208
|
+
const metadata = readMetadata(payload);
|
|
10209
|
+
const httpMetadata = metadata.httpResponse === void 0 ? {} : { httpResponse: readHttpResponse(metadata.httpResponse) };
|
|
10196
10210
|
const base = {
|
|
10211
|
+
...metadata.httpResponse === void 0 ? {} : { metadata: httpMetadata },
|
|
10197
10212
|
...eventId === void 0 ? {} : { eventId },
|
|
10198
10213
|
installId: requireIdentityField(payload, "installId"),
|
|
10199
10214
|
toBundleId: requireStringField(payload, "toBundleId"),
|
|
@@ -10217,11 +10232,11 @@ function requireEvent(payload) {
|
|
|
10217
10232
|
updateStrategy
|
|
10218
10233
|
};
|
|
10219
10234
|
};
|
|
10220
|
-
const metadata = readMetadata(payload);
|
|
10221
10235
|
switch (type) {
|
|
10222
10236
|
case "UPDATE_DOWNLOADED": {
|
|
10223
10237
|
const delivery = metadata.delivery;
|
|
10224
10238
|
const read = {
|
|
10239
|
+
...httpMetadata,
|
|
10225
10240
|
...delivery == null ? {} : { delivery: oneOf(DELIVERIES, delivery) },
|
|
10226
10241
|
...metadata.patchFallback === true ? { patchFallback: true } : {}
|
|
10227
10242
|
};
|
|
@@ -10240,13 +10255,19 @@ function requireEvent(payload) {
|
|
|
10240
10255
|
return {
|
|
10241
10256
|
...movement(),
|
|
10242
10257
|
type,
|
|
10243
|
-
...previousProcessExit === void 0 ? {} : { metadata: {
|
|
10258
|
+
...previousProcessExit === void 0 ? {} : { metadata: {
|
|
10259
|
+
...httpMetadata,
|
|
10260
|
+
previousProcessExit
|
|
10261
|
+
} }
|
|
10244
10262
|
};
|
|
10245
10263
|
}
|
|
10246
10264
|
case "UPDATE_FAILED": return {
|
|
10247
10265
|
...movement(),
|
|
10248
10266
|
type,
|
|
10249
|
-
metadata: {
|
|
10267
|
+
metadata: {
|
|
10268
|
+
...httpMetadata,
|
|
10269
|
+
failure: readFailure(metadata.failure)
|
|
10270
|
+
}
|
|
10250
10271
|
};
|
|
10251
10272
|
case "UNCHANGED":
|
|
10252
10273
|
if (payload.fromBundleId !== null || payload.updateStrategy !== null) throw new InsightsBadRequestError("Invalid unchanged event shape");
|
|
@@ -10276,7 +10297,16 @@ function createBundleEventRow(input) {
|
|
|
10276
10297
|
to_release_id: input.toReleaseId,
|
|
10277
10298
|
user_id: input.userId ?? null
|
|
10278
10299
|
};
|
|
10300
|
+
const response = input.metadata?.httpResponse;
|
|
10279
10301
|
const metadata = {
|
|
10302
|
+
...response ? { http_response: {
|
|
10303
|
+
resource: response.resource,
|
|
10304
|
+
path: response.path,
|
|
10305
|
+
status: response.status,
|
|
10306
|
+
body: response.body,
|
|
10307
|
+
body_truncated: response.bodyTruncated,
|
|
10308
|
+
received_at_ms: response.receivedAtMs
|
|
10309
|
+
} } : {},
|
|
10280
10310
|
cohort: input.cohort,
|
|
10281
10311
|
fingerprint_hash: input.fingerprintHash,
|
|
10282
10312
|
sdk_version: input.sdkVersion ?? null,
|
|
@@ -10500,6 +10530,14 @@ const toFailure = (failure) => ({
|
|
|
10500
10530
|
});
|
|
10501
10531
|
/** What a row's metadata adds for its type: a failure, a delivery, an exit reason. */
|
|
10502
10532
|
const eventDetails = ({ type, metadata }) => ({
|
|
10533
|
+
...metadata.http_response !== void 0 ? { httpResponse: {
|
|
10534
|
+
resource: metadata.http_response.resource,
|
|
10535
|
+
path: metadata.http_response.path,
|
|
10536
|
+
status: metadata.http_response.status,
|
|
10537
|
+
body: metadata.http_response.body,
|
|
10538
|
+
bodyTruncated: metadata.http_response.body_truncated,
|
|
10539
|
+
receivedAtMs: metadata.http_response.received_at_ms
|
|
10540
|
+
} } : {},
|
|
10503
10541
|
...type === "UPDATE_FAILED" && metadata.failure !== void 0 ? { failure: toFailure(metadata.failure) } : {},
|
|
10504
10542
|
...type === "UPDATE_DOWNLOADED" && metadata.delivery !== void 0 ? { delivery: metadata.delivery } : {},
|
|
10505
10543
|
...type === "UPDATE_DOWNLOADED" && metadata.patch_fallback === true ? { patchFallback: true } : {},
|
|
@@ -10522,6 +10560,7 @@ const toEventHistoryRow = (row) => ({
|
|
|
10522
10560
|
...eventDetails(row)
|
|
10523
10561
|
});
|
|
10524
10562
|
const toInstallationRow = (row) => ({
|
|
10563
|
+
...eventDetails(row).httpResponse ? { httpResponse: eventDetails(row).httpResponse } : {},
|
|
10525
10564
|
appVersion: row.app_version,
|
|
10526
10565
|
channel: row.channel,
|
|
10527
10566
|
cohort: row.metadata.cohort,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/aws",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.29",
|
|
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.0.0-rc.
|
|
49
|
-
"@hot-updater/mock": "1.0.0-rc.
|
|
50
|
-
"@hot-updater/test-utils": "1.0.0-rc.
|
|
48
|
+
"@hot-updater/protocol": "1.0.0-rc.28",
|
|
49
|
+
"@hot-updater/mock": "1.0.0-rc.28",
|
|
50
|
+
"@hot-updater/test-utils": "1.0.0-rc.28"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@aws-sdk/client-cloudfront": "3.1066.0",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"@aws-sdk/lib-storage": "3.1066.0",
|
|
63
63
|
"@aws-sdk/lib-dynamodb": "3.1066.0",
|
|
64
64
|
"hono": "4.12.34",
|
|
65
|
-
"@hot-updater/cli-tools": "1.0.0-rc.
|
|
66
|
-
"@hot-updater/
|
|
67
|
-
"@hot-updater/
|
|
65
|
+
"@hot-updater/cli-tools": "1.0.0-rc.29",
|
|
66
|
+
"@hot-updater/plugin-core": "1.0.0-rc.28",
|
|
67
|
+
"@hot-updater/server": "1.0.0-rc.29"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "tsdown",
|