@hot-updater/cloudflare 1.0.0-rc.32 → 1.0.0-rc.34
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 +7 -19
- package/dist/index.d.mts +7 -19
- package/dist/worker/index.d.cts +7 -19
- package/dist/worker/index.d.mts +7 -19
- package/package.json +6 -6
- package/sql/bundles.sql +4 -4
- package/worker/dist/README.md +1 -1
- package/worker/dist/index.js +73 -120
- package/worker/dist/index.js.map +2 -2
- package/worker/migrations/0001_hot-updater_1.0.0.sql +4 -4
package/worker/dist/index.js
CHANGED
|
@@ -4511,7 +4511,7 @@ var createSqlAdapter = /* @__PURE__ */ __name(({ executor, tablePrefix = "", max
|
|
|
4511
4511
|
}, "createSqlAdapter");
|
|
4512
4512
|
|
|
4513
4513
|
// ../../packages/server/dist/package.mjs
|
|
4514
|
-
var version = "1.0.0-rc.
|
|
4514
|
+
var version = "1.0.0-rc.34";
|
|
4515
4515
|
|
|
4516
4516
|
// ../../packages/server/dist/version.mjs
|
|
4517
4517
|
var HOT_UPDATER_SERVER_VERSION = version;
|
|
@@ -9556,8 +9556,8 @@ var apiKeys = /* @__PURE__ */ __name((options = {}) => {
|
|
|
9556
9556
|
var isOptional = /* @__PURE__ */ __name((value, key, valid) => !Object.hasOwn(value, key) || valid(value[key]), "isOptional");
|
|
9557
9557
|
var isString = /* @__PURE__ */ __name((value) => typeof value === "string", "isString");
|
|
9558
9558
|
var isDatabaseHttpResponse = /* @__PURE__ */ __name((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), "isDatabaseHttpResponse");
|
|
9559
|
-
var isDatabaseBundleEventFailure = /* @__PURE__ */ __name((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)
|
|
9560
|
-
var isDatabaseBundleEventMetadata = /* @__PURE__ */ __name((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")
|
|
9559
|
+
var isDatabaseBundleEventFailure = /* @__PURE__ */ __name((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), "isDatabaseBundleEventFailure");
|
|
9560
|
+
var isDatabaseBundleEventMetadata = /* @__PURE__ */ __name((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"), "isDatabaseBundleEventMetadata");
|
|
9561
9561
|
var isRecord5 = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isRecord");
|
|
9562
9562
|
var isIdentity = /* @__PURE__ */ __name((value) => typeof value === "string" && value.length > 0 && value.length <= 255, "isIdentity");
|
|
9563
9563
|
var isTextOrNull2 = /* @__PURE__ */ __name((value) => value === null || typeof value === "string", "isTextOrNull");
|
|
@@ -9747,7 +9747,7 @@ var createValidatedInsightsModel = /* @__PURE__ */ __name((model) => ({
|
|
|
9747
9747
|
async getReleaseActivity(input) {
|
|
9748
9748
|
if (!isRecord5(input) || !hasOnlyKeys(input, ["releases"]) || !Array.isArray(input.releases) || input.releases.length < 1 || input.releases.length > 100 || !input.releases.every(isReleaseReference)) invalidQuery();
|
|
9749
9749
|
const result = await model.getReleaseActivity(input);
|
|
9750
|
-
if (!isRecord5(result) || !isTimestamp(result.measuredAtMs) || !Array.isArray(result.data) || result.data.some((item) => !isRecord5(item) || !isReleaseReference(item.release) || !isRecord5(item.metrics) || !isTimestamp(item.metrics.downloads) || !isTimestamp(item.metrics.
|
|
9750
|
+
if (!isRecord5(result) || !isTimestamp(result.measuredAtMs) || !Array.isArray(result.data) || result.data.some((item) => !isRecord5(item) || !isReleaseReference(item.release) || !isRecord5(item.metrics) || !isTimestamp(item.metrics.downloads) || !isTimestamp(item.metrics.applies) || !isTimestamp(item.metrics.failedLaunches))) invalidResult();
|
|
9751
9751
|
return result;
|
|
9752
9752
|
},
|
|
9753
9753
|
async getAppUsage(input) {
|
|
@@ -9882,7 +9882,6 @@ function readFailure(value) {
|
|
|
9882
9882
|
const originCode = readCode(failure.originCode);
|
|
9883
9883
|
const errorMessage = typeof failure.errorMessage === "string" && failure.errorMessage.length <= 2048 ? failure.errorMessage : void 0;
|
|
9884
9884
|
const errorStack = typeof failure.errorStack === "string" && failure.errorStack.length <= 4096 ? failure.errorStack : void 0;
|
|
9885
|
-
const previousProcessExit = readCode(failure.previousProcessExit);
|
|
9886
9885
|
return {
|
|
9887
9886
|
stage: oneOf(STAGES, failure.stage),
|
|
9888
9887
|
reason: oneOf(REASONS, failure.reason),
|
|
@@ -9891,8 +9890,7 @@ function readFailure(value) {
|
|
|
9891
9890
|
...failure.transport == null ? {} : { transport: oneOf(TRANSPORTS, failure.transport) },
|
|
9892
9891
|
...originCode === void 0 ? {} : { originCode },
|
|
9893
9892
|
...errorMessage === void 0 ? {} : { errorMessage },
|
|
9894
|
-
...errorStack === void 0 ? {} : { errorStack }
|
|
9895
|
-
...previousProcessExit === void 0 ? {} : { previousProcessExit }
|
|
9893
|
+
...errorStack === void 0 ? {} : { errorStack }
|
|
9896
9894
|
};
|
|
9897
9895
|
}
|
|
9898
9896
|
__name(readFailure, "readFailure");
|
|
@@ -9987,21 +9985,11 @@ function requireEvent(payload) {
|
|
|
9987
9985
|
};
|
|
9988
9986
|
}
|
|
9989
9987
|
case "UPDATE_APPLIED":
|
|
9988
|
+
case "RECOVERED":
|
|
9990
9989
|
return {
|
|
9991
9990
|
...movement(),
|
|
9992
9991
|
type
|
|
9993
9992
|
};
|
|
9994
|
-
case "RECOVERED": {
|
|
9995
|
-
const previousProcessExit = readCode(metadata.previousProcessExit);
|
|
9996
|
-
return {
|
|
9997
|
-
...movement(),
|
|
9998
|
-
type,
|
|
9999
|
-
...previousProcessExit === void 0 ? {} : { metadata: {
|
|
10000
|
-
...httpMetadata,
|
|
10001
|
-
previousProcessExit
|
|
10002
|
-
} }
|
|
10003
|
-
};
|
|
10004
|
-
}
|
|
10005
9993
|
case "UPDATE_FAILED":
|
|
10006
9994
|
return {
|
|
10007
9995
|
...movement(),
|
|
@@ -10072,24 +10060,13 @@ function createBundleEventRow(input) {
|
|
|
10072
10060
|
};
|
|
10073
10061
|
}
|
|
10074
10062
|
case "UPDATE_APPLIED":
|
|
10063
|
+
case "RECOVERED":
|
|
10075
10064
|
return {
|
|
10076
10065
|
...base,
|
|
10077
10066
|
from_bundle_id: input.fromBundleId,
|
|
10078
10067
|
type: input.type,
|
|
10079
10068
|
metadata
|
|
10080
10069
|
};
|
|
10081
|
-
case "RECOVERED": {
|
|
10082
|
-
const exit = input.metadata?.previousProcessExit;
|
|
10083
|
-
return {
|
|
10084
|
-
...base,
|
|
10085
|
-
from_bundle_id: input.fromBundleId,
|
|
10086
|
-
type: input.type,
|
|
10087
|
-
metadata: {
|
|
10088
|
-
...metadata,
|
|
10089
|
-
...exit === void 0 ? {} : { previous_process_exit: exit }
|
|
10090
|
-
}
|
|
10091
|
-
};
|
|
10092
|
-
}
|
|
10093
10070
|
case "UPDATE_FAILED": {
|
|
10094
10071
|
const { failure } = input.metadata;
|
|
10095
10072
|
return {
|
|
@@ -10106,8 +10083,7 @@ function createBundleEventRow(input) {
|
|
|
10106
10083
|
...failure.resource === void 0 ? {} : { resource: failure.resource },
|
|
10107
10084
|
...failure.httpStatus === void 0 ? {} : { http_status: failure.httpStatus },
|
|
10108
10085
|
...failure.transport === void 0 ? {} : { transport: failure.transport },
|
|
10109
|
-
...failure.originCode === void 0 ? {} : { origin_code: failure.originCode }
|
|
10110
|
-
...failure.previousProcessExit === void 0 ? {} : { previous_process_exit: failure.previousProcessExit }
|
|
10086
|
+
...failure.originCode === void 0 ? {} : { origin_code: failure.originCode }
|
|
10111
10087
|
}
|
|
10112
10088
|
}
|
|
10113
10089
|
};
|
|
@@ -10273,8 +10249,7 @@ var toFailure = /* @__PURE__ */ __name((failure) => ({
|
|
|
10273
10249
|
...failure.resource === void 0 ? {} : { resource: failure.resource },
|
|
10274
10250
|
...failure.http_status === void 0 ? {} : { httpStatus: failure.http_status },
|
|
10275
10251
|
...failure.transport === void 0 ? {} : { transport: failure.transport },
|
|
10276
|
-
...failure.origin_code === void 0 ? {} : { originCode: failure.origin_code }
|
|
10277
|
-
...failure.previous_process_exit === void 0 ? {} : { previousProcessExit: failure.previous_process_exit }
|
|
10252
|
+
...failure.origin_code === void 0 ? {} : { originCode: failure.origin_code }
|
|
10278
10253
|
}), "toFailure");
|
|
10279
10254
|
var eventDetails = /* @__PURE__ */ __name(({ type, metadata }) => ({
|
|
10280
10255
|
...metadata.http_response !== void 0 ? { httpResponse: {
|
|
@@ -10287,8 +10262,7 @@ var eventDetails = /* @__PURE__ */ __name(({ type, metadata }) => ({
|
|
|
10287
10262
|
} } : {},
|
|
10288
10263
|
...type === "UPDATE_FAILED" && metadata.failure !== void 0 ? { failure: toFailure(metadata.failure) } : {},
|
|
10289
10264
|
...type === "UPDATE_DOWNLOADED" && metadata.delivery !== void 0 ? { delivery: metadata.delivery } : {},
|
|
10290
|
-
...type === "UPDATE_DOWNLOADED" && metadata.patch_fallback === true ? { patchFallback: true } : {}
|
|
10291
|
-
...type === "RECOVERED" && metadata.previous_process_exit !== void 0 ? { previousProcessExit: metadata.previous_process_exit } : {}
|
|
10265
|
+
...type === "UPDATE_DOWNLOADED" && metadata.patch_fallback === true ? { patchFallback: true } : {}
|
|
10292
10266
|
}), "eventDetails");
|
|
10293
10267
|
var toEventHistoryRow = /* @__PURE__ */ __name((row) => ({
|
|
10294
10268
|
...row.to_release_id == null ? {} : { toReleaseId: row.to_release_id },
|
|
@@ -10680,21 +10654,31 @@ var window = {
|
|
|
10680
10654
|
eq: ["identity"],
|
|
10681
10655
|
sort: ["bucket_start_ms"]
|
|
10682
10656
|
};
|
|
10657
|
+
var WINDOW_COUNTERS = [
|
|
10658
|
+
"downloads",
|
|
10659
|
+
"failed_launches",
|
|
10660
|
+
"patch_downloads",
|
|
10661
|
+
"patch_fallbacks"
|
|
10662
|
+
];
|
|
10683
10663
|
var counters = /* @__PURE__ */ __name((retention) => defineAggregate(identityFields, {
|
|
10684
10664
|
key: ["identity", "bucket_start_ms"],
|
|
10685
|
-
counters:
|
|
10686
|
-
"downloads",
|
|
10687
|
-
"launches",
|
|
10688
|
-
"failed_launches",
|
|
10689
|
-
"failed_updates",
|
|
10690
|
-
"patch_downloads",
|
|
10691
|
-
"patch_fallbacks"
|
|
10692
|
-
],
|
|
10665
|
+
counters: WINDOW_COUNTERS,
|
|
10693
10666
|
shards: COUNTER_SHARDS,
|
|
10694
10667
|
batched: true,
|
|
10695
10668
|
indexes: { window },
|
|
10696
|
-
|
|
10669
|
+
retention
|
|
10697
10670
|
}), "counters");
|
|
10671
|
+
var lifetimeCounters = /* @__PURE__ */ __name(() => defineAggregate(identityFields, {
|
|
10672
|
+
key: ["identity", "bucket_start_ms"],
|
|
10673
|
+
counters: [
|
|
10674
|
+
...WINDOW_COUNTERS,
|
|
10675
|
+
"applies",
|
|
10676
|
+
"failed_updates"
|
|
10677
|
+
],
|
|
10678
|
+
shards: COUNTER_SHARDS,
|
|
10679
|
+
batched: true,
|
|
10680
|
+
indexes: { window }
|
|
10681
|
+
}), "lifetimeCounters");
|
|
10698
10682
|
var sketches = /* @__PURE__ */ __name((retention) => defineAggregate(identityFields, {
|
|
10699
10683
|
key: ["identity", "bucket_start_ms"],
|
|
10700
10684
|
distinct: ["activity_users", "failed_users"],
|
|
@@ -10890,7 +10874,7 @@ var createInsightsSchema = /* @__PURE__ */ __name(({ rawDays, dailyDays } = DEFA
|
|
|
10890
10874
|
insights_overview_daily: counters(daily),
|
|
10891
10875
|
insights_sketches_daily: sketches(daily),
|
|
10892
10876
|
/** A release's counters since its first event, and its failed installations: kept. */
|
|
10893
|
-
insights_overview_lifetime:
|
|
10877
|
+
insights_overview_lifetime: lifetimeCounters(),
|
|
10894
10878
|
insights_sketches_lifetime: lifetimeSketches(),
|
|
10895
10879
|
insights_distribution: insightsDistribution(daily),
|
|
10896
10880
|
insights_latest_by_bundle: insightsLatestByBundle(daily),
|
|
@@ -10932,7 +10916,7 @@ var insightsOverviewDeltas = /* @__PURE__ */ __name((event) => {
|
|
|
10932
10916
|
counters2.set(key, {
|
|
10933
10917
|
identity,
|
|
10934
10918
|
downloads: (previous?.downloads ?? 0) + values.downloads,
|
|
10935
|
-
|
|
10919
|
+
applies: (previous?.applies ?? 0) + values.applies,
|
|
10936
10920
|
failedLaunches: (previous?.failedLaunches ?? 0) + values.failedLaunches,
|
|
10937
10921
|
activityIdentity: previous?.activityIdentity ?? values.activityIdentity
|
|
10938
10922
|
});
|
|
@@ -10940,7 +10924,7 @@ var insightsOverviewDeltas = /* @__PURE__ */ __name((event) => {
|
|
|
10940
10924
|
const metric = /* @__PURE__ */ __name((releaseId, values) => {
|
|
10941
10925
|
const windowed = {
|
|
10942
10926
|
...values,
|
|
10943
|
-
|
|
10927
|
+
applies: 0
|
|
10944
10928
|
};
|
|
10945
10929
|
if (releaseId !== null) for (const [periodKind, start] of [["lifetime", 0], ["hour", bucketStartMs]]) append({
|
|
10946
10930
|
scopeKind: "release",
|
|
@@ -10967,21 +10951,19 @@ var insightsOverviewDeltas = /* @__PURE__ */ __name((event) => {
|
|
|
10967
10951
|
}, "metric");
|
|
10968
10952
|
if (event.type === "UPDATE_DOWNLOADED") metric(event.to_release_id, {
|
|
10969
10953
|
downloads: 1,
|
|
10970
|
-
|
|
10954
|
+
applies: 0,
|
|
10971
10955
|
failedLaunches: 0
|
|
10972
10956
|
});
|
|
10973
|
-
else if (event.type
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
});
|
|
10984
|
-
}
|
|
10957
|
+
else if (event.type === "UPDATE_APPLIED") metric(event.to_release_id, {
|
|
10958
|
+
downloads: 0,
|
|
10959
|
+
applies: 1,
|
|
10960
|
+
failedLaunches: 0
|
|
10961
|
+
});
|
|
10962
|
+
else if (event.type === "RECOVERED") metric(event.from_release_id, {
|
|
10963
|
+
downloads: 0,
|
|
10964
|
+
applies: 0,
|
|
10965
|
+
failedLaunches: 1
|
|
10966
|
+
});
|
|
10985
10967
|
for (const platform of [event.platform, "all"]) for (const appVersionKind of ["specific", "all"]) append({
|
|
10986
10968
|
scopeKind: "usage",
|
|
10987
10969
|
releaseKind: "all",
|
|
@@ -10994,7 +10976,7 @@ var insightsOverviewDeltas = /* @__PURE__ */ __name((event) => {
|
|
|
10994
10976
|
bucketStartMs
|
|
10995
10977
|
}, {
|
|
10996
10978
|
downloads: 0,
|
|
10997
|
-
|
|
10979
|
+
applies: 0,
|
|
10998
10980
|
failedLaunches: 0,
|
|
10999
10981
|
activityIdentity: event.install_id
|
|
11000
10982
|
});
|
|
@@ -11083,7 +11065,7 @@ var countEvent = /* @__PURE__ */ __name((tx, event) => {
|
|
|
11083
11065
|
const counters2 = {
|
|
11084
11066
|
...Object.fromEntries([
|
|
11085
11067
|
["downloads", delta.downloads],
|
|
11086
|
-
["
|
|
11068
|
+
["applies", delta.applies],
|
|
11087
11069
|
["failed_launches", delta.failedLaunches]
|
|
11088
11070
|
].filter(([, value]) => value !== 0)),
|
|
11089
11071
|
...delta.downloads === 0 ? {} : patchCounters(event)
|
|
@@ -11190,19 +11172,6 @@ var countFailure = /* @__PURE__ */ __name((tx, event) => {
|
|
|
11190
11172
|
detail: failureDetail(failure)
|
|
11191
11173
|
}, { events: 1 }, { shardBy });
|
|
11192
11174
|
}, "countFailure");
|
|
11193
|
-
var countExit = /* @__PURE__ */ __name((tx, event) => {
|
|
11194
|
-
const exit = event.metadata.previous_process_exit;
|
|
11195
|
-
if (event.type !== "RECOVERED" || exit === void 0) return;
|
|
11196
|
-
tx.aggregate("insights_failures", {
|
|
11197
|
-
platform: event.platform,
|
|
11198
|
-
channel: event.channel,
|
|
11199
|
-
bucket_start_ms: hourOf(event.received_at_ms),
|
|
11200
|
-
release_id: event.from_release_id ?? "",
|
|
11201
|
-
stage: "launch",
|
|
11202
|
-
reason: exit,
|
|
11203
|
-
detail: ""
|
|
11204
|
-
}, { events: 1 }, { shardBy: event.install_id });
|
|
11205
|
-
}, "countExit");
|
|
11206
11175
|
var isNewer = /* @__PURE__ */ __name((event, head) => event.received_at_ms !== head.received_at_ms ? event.received_at_ms > head.received_at_ms : compareUtf8(event.id, head.id) > 0, "isNewer");
|
|
11207
11176
|
var REPEATED_FIELDS = [
|
|
11208
11177
|
"channel",
|
|
@@ -11228,7 +11197,6 @@ var recordEvent = /* @__PURE__ */ __name((db, event) => {
|
|
|
11228
11197
|
return;
|
|
11229
11198
|
}
|
|
11230
11199
|
countEvent(tx, event);
|
|
11231
|
-
countExit(tx, event);
|
|
11232
11200
|
if (previous !== null && !isNewer(event, previous)) return;
|
|
11233
11201
|
if (previous === null) tx.create("bundle_event_heads", event);
|
|
11234
11202
|
else {
|
|
@@ -11560,7 +11528,7 @@ var lifetimeMetrics = /* @__PURE__ */ __name(async (db, release) => {
|
|
|
11560
11528
|
})).rows;
|
|
11561
11529
|
return {
|
|
11562
11530
|
downloads: lifetime?.downloads ?? 0,
|
|
11563
|
-
|
|
11531
|
+
applies: lifetime?.applies ?? 0,
|
|
11564
11532
|
failedLaunches: lifetime?.failed_launches ?? 0
|
|
11565
11533
|
};
|
|
11566
11534
|
}, "lifetimeMetrics");
|
|
@@ -11661,20 +11629,16 @@ var isRange = /* @__PURE__ */ __name((range) => range === void 0 || Number.isSaf
|
|
|
11661
11629
|
var isText3 = /* @__PURE__ */ __name((value, maxLength) => typeof value === "string" && value.length > 0 && value.length <= maxLength, "isText");
|
|
11662
11630
|
var failed = /* @__PURE__ */ __name((...rows) => countDistinct(mergeDistinct(rows.flat().map((row) => row.failed_users))), "failed");
|
|
11663
11631
|
var mostFirst = /* @__PURE__ */ __name((counts) => [...counts].sort(([leftKey, left], [rightKey, right]) => right.events - left.events || compareUtf8(leftKey, rightKey)).map(([, entry]) => entry), "mostFirst");
|
|
11632
|
+
var FAILURE_STAGES = /* @__PURE__ */ new Set([
|
|
11633
|
+
"check",
|
|
11634
|
+
"download",
|
|
11635
|
+
"install",
|
|
11636
|
+
"unknown"
|
|
11637
|
+
]);
|
|
11664
11638
|
var breakdownOf = /* @__PURE__ */ __name((rows) => {
|
|
11665
11639
|
const failures = /* @__PURE__ */ new Map();
|
|
11666
|
-
const exits = /* @__PURE__ */ new Map();
|
|
11667
11640
|
for (const { stage, reason, detail, events } of rows) {
|
|
11668
11641
|
if (events <= 0) continue;
|
|
11669
|
-
if (stage === "launch") {
|
|
11670
|
-
const exit = exits.get(reason) ?? {
|
|
11671
|
-
value: reason,
|
|
11672
|
-
events: 0
|
|
11673
|
-
};
|
|
11674
|
-
exit.events += events;
|
|
11675
|
-
exits.set(reason, exit);
|
|
11676
|
-
continue;
|
|
11677
|
-
}
|
|
11678
11642
|
const key = JSON.stringify([stage, reason]);
|
|
11679
11643
|
const entry = failures.get(key) ?? {
|
|
11680
11644
|
value: {
|
|
@@ -11693,29 +11657,23 @@ var breakdownOf = /* @__PURE__ */ __name((rows) => {
|
|
|
11693
11657
|
entry.details.set(detail, known);
|
|
11694
11658
|
failures.set(key, entry);
|
|
11695
11659
|
}
|
|
11696
|
-
return {
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
|
|
11712
|
-
|
|
11713
|
-
}),
|
|
11714
|
-
byExitReason: mostFirst(exits).map(({ value, events }) => ({
|
|
11715
|
-
exitReason: value,
|
|
11716
|
-
events
|
|
11717
|
-
}))
|
|
11718
|
-
};
|
|
11660
|
+
return mostFirst(failures).map(({ value, events }) => {
|
|
11661
|
+
const { details } = failures.get(JSON.stringify([value.stage, value.reason]));
|
|
11662
|
+
return {
|
|
11663
|
+
...value,
|
|
11664
|
+
events,
|
|
11665
|
+
details: mostFirst(details).map(({ value: detail, events: events2 }) => {
|
|
11666
|
+
const [resource, httpStatus, originCode, transport] = JSON.parse(detail);
|
|
11667
|
+
return {
|
|
11668
|
+
resource,
|
|
11669
|
+
httpStatus,
|
|
11670
|
+
originCode,
|
|
11671
|
+
transport,
|
|
11672
|
+
events: events2
|
|
11673
|
+
};
|
|
11674
|
+
})
|
|
11675
|
+
};
|
|
11676
|
+
});
|
|
11719
11677
|
}, "breakdownOf");
|
|
11720
11678
|
var getUpdateFailures = /* @__PURE__ */ __name(async (db, input, now, retention) => {
|
|
11721
11679
|
const { platform, channel, releaseId, timeRange } = input;
|
|
@@ -11800,13 +11758,12 @@ var getUpdateFailures = /* @__PURE__ */ __name(async (db, input, now, retention)
|
|
|
11800
11758
|
}))
|
|
11801
11759
|
]);
|
|
11802
11760
|
const total = /* @__PURE__ */ __name((field) => counters2.reduce((sum, row) => sum + row[field], 0), "total");
|
|
11803
|
-
const scoped =
|
|
11761
|
+
const scoped = rows.filter((row) => FAILURE_STAGES.has(row.stage) && (releaseId === void 0 || row.release_id === releaseId));
|
|
11804
11762
|
const failuresAt = /* @__PURE__ */ __name((counted) => scoped.reduce((sum, row) => sum + (counted(row.stage) ? Math.max(0, row.events) : 0), 0), "failuresAt");
|
|
11805
|
-
const { breakdown, byExitReason } = breakdownOf(scoped);
|
|
11806
11763
|
return {
|
|
11807
11764
|
coverage: coverageOf(timeRange.start, kept.hour),
|
|
11808
11765
|
measuredAtMs: at,
|
|
11809
|
-
failedUpdates: failuresAt((stage) => stage !== "check"
|
|
11766
|
+
failedUpdates: failuresAt((stage) => stage !== "check"),
|
|
11810
11767
|
failedInstallations: failed(failures),
|
|
11811
11768
|
downloads: total("downloads"),
|
|
11812
11769
|
patchDownloads: total("patch_downloads"),
|
|
@@ -11816,11 +11773,7 @@ var getUpdateFailures = /* @__PURE__ */ __name(async (db, input, now, retention)
|
|
|
11816
11773
|
failedInstallations: failed(checks),
|
|
11817
11774
|
activeInstallations: countDistinct(mergeDistinct(active.map((row) => row.activity_users)))
|
|
11818
11775
|
} } : {},
|
|
11819
|
-
breakdown
|
|
11820
|
-
recoveries: {
|
|
11821
|
-
failedLaunches: total("failed_launches"),
|
|
11822
|
-
byExitReason
|
|
11823
|
-
}
|
|
11776
|
+
breakdown: breakdownOf(scoped)
|
|
11824
11777
|
};
|
|
11825
11778
|
}, "getUpdateFailures");
|
|
11826
11779
|
|
|
@@ -12069,7 +12022,7 @@ var insights = /* @__PURE__ */ __name((options = {}) => {
|
|
|
12069
12022
|
const plugin = definePlugin({
|
|
12070
12023
|
id: "insights",
|
|
12071
12024
|
namespace: false,
|
|
12072
|
-
schemaVersion: "1.
|
|
12025
|
+
schemaVersion: "1.0.0",
|
|
12073
12026
|
schema: createInsightsSchema(retention),
|
|
12074
12027
|
init: /* @__PURE__ */ __name(({ db, now }) => {
|
|
12075
12028
|
const api = createInsightsApi(db, now, retention);
|