@hot-updater/aws 1.0.0-rc.32 → 1.0.0-rc.33

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 CHANGED
@@ -236,8 +236,11 @@ type InsightsCoverage = {
236
236
  * which are kept.
237
237
  */
238
238
  interface ReleaseActivityMetrics {
239
+ /** Download reports of the release. */
239
240
  readonly downloads: number;
240
- readonly launches: number;
241
+ /** Apply reports of the release: installations that started running it. */
242
+ readonly applies: number;
243
+ /** Launches that crashed on the release and recovered to the one before. */
241
244
  readonly failedLaunches: number;
242
245
  }
243
246
  interface InsightsGetReleaseActivityInput {
@@ -515,7 +518,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
515
518
  readonly bucket_start_ms: {
516
519
  readonly type: "integer";
517
520
  };
518
- }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
521
+ }, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks", {
519
522
  readonly window: {
520
523
  readonly eq: readonly ["identity"];
521
524
  readonly sort: readonly ["bucket_start_ms"];
@@ -543,7 +546,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
543
546
  readonly bucket_start_ms: {
544
547
  readonly type: "integer";
545
548
  };
546
- }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
549
+ }, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks", {
547
550
  readonly window: {
548
551
  readonly eq: readonly ["identity"];
549
552
  readonly sort: readonly ["bucket_start_ms"];
@@ -571,7 +574,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
571
574
  readonly bucket_start_ms: {
572
575
  readonly type: "integer";
573
576
  };
574
- }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
577
+ }, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks" | "applies" | "failed_updates", {
575
578
  readonly window: {
576
579
  readonly eq: readonly ["identity"];
577
580
  readonly sort: readonly ["bucket_start_ms"];
package/dist/index.d.mts CHANGED
@@ -236,8 +236,11 @@ type InsightsCoverage = {
236
236
  * which are kept.
237
237
  */
238
238
  interface ReleaseActivityMetrics {
239
+ /** Download reports of the release. */
239
240
  readonly downloads: number;
240
- readonly launches: number;
241
+ /** Apply reports of the release: installations that started running it. */
242
+ readonly applies: number;
243
+ /** Launches that crashed on the release and recovered to the one before. */
241
244
  readonly failedLaunches: number;
242
245
  }
243
246
  interface InsightsGetReleaseActivityInput {
@@ -515,7 +518,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
515
518
  readonly bucket_start_ms: {
516
519
  readonly type: "integer";
517
520
  };
518
- }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
521
+ }, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks", {
519
522
  readonly window: {
520
523
  readonly eq: readonly ["identity"];
521
524
  readonly sort: readonly ["bucket_start_ms"];
@@ -543,7 +546,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
543
546
  readonly bucket_start_ms: {
544
547
  readonly type: "integer";
545
548
  };
546
- }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
549
+ }, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks", {
547
550
  readonly window: {
548
551
  readonly eq: readonly ["identity"];
549
552
  readonly sort: readonly ["bucket_start_ms"];
@@ -571,7 +574,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
571
574
  readonly bucket_start_ms: {
572
575
  readonly type: "integer";
573
576
  };
574
- }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
577
+ }, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks" | "applies" | "failed_updates", {
575
578
  readonly window: {
576
579
  readonly eq: readonly ["identity"];
577
580
  readonly sort: readonly ["bucket_start_ms"];
@@ -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.32";
4573
+ const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.33";
4574
4574
  //#endregion
4575
4575
  //#region ../../packages/server/dist/handlerVersionRoutes.mjs
4576
4576
  /**
@@ -9998,7 +9998,7 @@ const createValidatedInsightsModel = (model) => ({
9998
9998
  async getReleaseActivity(input) {
9999
9999
  if (!isRecord$2(input) || !hasOnlyKeys(input, ["releases"]) || !Array.isArray(input.releases) || input.releases.length < 1 || input.releases.length > 100 || !input.releases.every(isReleaseReference)) invalidQuery();
10000
10000
  const result = await model.getReleaseActivity(input);
10001
- if (!isRecord$2(result) || !isTimestamp(result.measuredAtMs) || !Array.isArray(result.data) || result.data.some((item) => !isRecord$2(item) || !isReleaseReference(item.release) || !isRecord$2(item.metrics) || !isTimestamp(item.metrics.downloads) || !isTimestamp(item.metrics.launches) || !isTimestamp(item.metrics.failedLaunches))) invalidResult();
10001
+ if (!isRecord$2(result) || !isTimestamp(result.measuredAtMs) || !Array.isArray(result.data) || result.data.some((item) => !isRecord$2(item) || !isReleaseReference(item.release) || !isRecord$2(item.metrics) || !isTimestamp(item.metrics.downloads) || !isTimestamp(item.metrics.applies) || !isTimestamp(item.metrics.failedLaunches))) invalidResult();
10002
10002
  return result;
10003
10003
  },
10004
10004
  async getAppUsage(input) {
@@ -10967,29 +10967,42 @@ const window = {
10967
10967
  eq: ["identity"],
10968
10968
  sort: ["bucket_start_ms"]
10969
10969
  };
10970
+ /** What a release or channel row counts in every period kind. */
10971
+ const WINDOW_COUNTERS = [
10972
+ "downloads",
10973
+ "failed_launches",
10974
+ "patch_downloads",
10975
+ "patch_fallbacks"
10976
+ ];
10970
10977
  /**
10971
- * Counters of one period kind: hourly, daily, or lifetime at bucket 0. A
10972
- * release or channel row counts downloads and failed launches, and downloads
10973
- * a patch delivered and those that fell back from one. Only a release's
10974
- * lifetime row counts launches, which the bundle list reads and no windowed
10975
- * read sums. It also counts the release's failed updates (`failed_updates`),
10976
- * since no breakdown row outlives the raw period; windowed reads sum
10977
- * `insights_failures` instead.
10978
+ * Hourly or daily counters: a release or channel row counts downloads,
10979
+ * launches that crashed and recovered (`failed_launches`), and downloads a
10980
+ * patch delivered and those that fell back from one.
10978
10981
  */
10979
10982
  const counters = (retention) => defineAggregate(identityFields, {
10983
+ key: ["identity", "bucket_start_ms"],
10984
+ counters: WINDOW_COUNTERS,
10985
+ shards: COUNTER_SHARDS,
10986
+ batched: true,
10987
+ indexes: { window },
10988
+ retention
10989
+ });
10990
+ /**
10991
+ * A release's counters since its first report, at bucket 0: the windowed
10992
+ * counters, its applies, which the bundle list reads, and its failed updates
10993
+ * (`failed_updates`), since no breakdown row outlives the raw period; windowed
10994
+ * reads sum `insights_failures` instead.
10995
+ */
10996
+ const lifetimeCounters = () => defineAggregate(identityFields, {
10980
10997
  key: ["identity", "bucket_start_ms"],
10981
10998
  counters: [
10982
- "downloads",
10983
- "launches",
10984
- "failed_launches",
10985
- "failed_updates",
10986
- "patch_downloads",
10987
- "patch_fallbacks"
10999
+ ...WINDOW_COUNTERS,
11000
+ "applies",
11001
+ "failed_updates"
10988
11002
  ],
10989
11003
  shards: COUNTER_SHARDS,
10990
11004
  batched: true,
10991
- indexes: { window },
10992
- ...retention === void 0 ? {} : { retention }
11005
+ indexes: { window }
10993
11006
  });
10994
11007
  /**
10995
11008
  * Unique-installation sketches of one period kind: a usage row's active
@@ -11220,7 +11233,7 @@ const createInsightsSchema = ({ rawDays, dailyDays } = DEFAULT_INSIGHTS_RETENTIO
11220
11233
  insights_overview_daily: counters(daily),
11221
11234
  insights_sketches_daily: sketches(daily),
11222
11235
  /** A release's counters since its first event, and its failed installations: kept. */
11223
- insights_overview_lifetime: counters(),
11236
+ insights_overview_lifetime: lifetimeCounters(),
11224
11237
  insights_sketches_lifetime: lifetimeSketches(),
11225
11238
  insights_distribution: insightsDistribution(daily),
11226
11239
  insights_latest_by_bundle: insightsLatestByBundle(daily),
@@ -11263,7 +11276,7 @@ const insightsOverviewDeltas = (event) => {
11263
11276
  counters.set(key, {
11264
11277
  identity,
11265
11278
  downloads: (previous?.downloads ?? 0) + values.downloads,
11266
- launches: (previous?.launches ?? 0) + values.launches,
11279
+ applies: (previous?.applies ?? 0) + values.applies,
11267
11280
  failedLaunches: (previous?.failedLaunches ?? 0) + values.failedLaunches,
11268
11281
  activityIdentity: previous?.activityIdentity ?? values.activityIdentity
11269
11282
  });
@@ -11271,7 +11284,7 @@ const insightsOverviewDeltas = (event) => {
11271
11284
  const metric = (releaseId, values) => {
11272
11285
  const windowed = {
11273
11286
  ...values,
11274
- launches: 0
11287
+ applies: 0
11275
11288
  };
11276
11289
  if (releaseId !== null) for (const [periodKind, start] of [["lifetime", 0], ["hour", bucketStartMs]]) append({
11277
11290
  scopeKind: "release",
@@ -11298,21 +11311,19 @@ const insightsOverviewDeltas = (event) => {
11298
11311
  };
11299
11312
  if (event.type === "UPDATE_DOWNLOADED") metric(event.to_release_id, {
11300
11313
  downloads: 1,
11301
- launches: 0,
11314
+ applies: 0,
11302
11315
  failedLaunches: 0
11303
11316
  });
11304
- else if (event.type !== "UPDATE_FAILED") {
11305
- metric(event.to_release_id, {
11306
- downloads: 0,
11307
- launches: 1,
11308
- failedLaunches: 0
11309
- });
11310
- if (event.type === "RECOVERED") metric(event.from_release_id, {
11311
- downloads: 0,
11312
- launches: 0,
11313
- failedLaunches: 1
11314
- });
11315
- }
11317
+ else if (event.type === "UPDATE_APPLIED") metric(event.to_release_id, {
11318
+ downloads: 0,
11319
+ applies: 1,
11320
+ failedLaunches: 0
11321
+ });
11322
+ else if (event.type === "RECOVERED") metric(event.from_release_id, {
11323
+ downloads: 0,
11324
+ applies: 0,
11325
+ failedLaunches: 1
11326
+ });
11316
11327
  for (const platform of [event.platform, "all"]) for (const appVersionKind of ["specific", "all"]) append({
11317
11328
  scopeKind: "usage",
11318
11329
  releaseKind: "all",
@@ -11325,7 +11336,7 @@ const insightsOverviewDeltas = (event) => {
11325
11336
  bucketStartMs
11326
11337
  }, {
11327
11338
  downloads: 0,
11328
- launches: 0,
11339
+ applies: 0,
11329
11340
  failedLaunches: 0,
11330
11341
  activityIdentity: event.install_id
11331
11342
  });
@@ -11442,7 +11453,7 @@ const countEvent = (tx, event) => {
11442
11453
  const counters = {
11443
11454
  ...Object.fromEntries([
11444
11455
  ["downloads", delta.downloads],
11445
- ["launches", delta.launches],
11456
+ ["applies", delta.applies],
11446
11457
  ["failed_launches", delta.failedLaunches]
11447
11458
  ].filter(([, value]) => value !== 0)),
11448
11459
  ...delta.downloads === 0 ? {} : patchCounters(event)
@@ -12001,7 +12012,7 @@ const lifetimeMetrics = async (db, release) => {
12001
12012
  })).rows;
12002
12013
  return {
12003
12014
  downloads: lifetime?.downloads ?? 0,
12004
- launches: lifetime?.launches ?? 0,
12015
+ applies: lifetime?.applies ?? 0,
12005
12016
  failedLaunches: lifetime?.failed_launches ?? 0
12006
12017
  };
12007
12018
  };
@@ -12543,7 +12554,7 @@ const insights = (options = {}) => {
12543
12554
  const plugin = definePlugin({
12544
12555
  id: "insights",
12545
12556
  namespace: false,
12546
- schemaVersion: "1.2.0",
12557
+ schemaVersion: "1.4.0",
12547
12558
  schema: createInsightsSchema(retention),
12548
12559
  init: ({ db, now }) => {
12549
12560
  const api = createInsightsApi(db, now, retention);
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.32",
4
+ "version": "1.0.0-rc.33",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -47,7 +47,7 @@
47
47
  "mime": "^4.0.4",
48
48
  "@hot-updater/protocol": "1.0.0-rc.29",
49
49
  "@hot-updater/mock": "1.0.0-rc.29",
50
- "@hot-updater/test-utils": "1.0.0-rc.30"
50
+ "@hot-updater/test-utils": "1.0.0-rc.31"
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.32",
66
65
  "@hot-updater/plugin-core": "1.0.0-rc.29",
67
- "@hot-updater/server": "1.0.0-rc.32"
66
+ "@hot-updater/server": "1.0.0-rc.33",
67
+ "@hot-updater/cli-tools": "1.0.0-rc.33"
68
68
  },
69
69
  "scripts": {
70
70
  "build": "tsdown",