@hot-updater/cloudflare 1.0.0-rc.30 → 1.0.0-rc.32

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.
@@ -156,6 +156,19 @@ interface InsightsCountEventsInput {
156
156
  readonly sinceMs: number;
157
157
  readonly beforeReceivedAtMs: number;
158
158
  }
159
+ /** One bundle filter's stored events in each interval of a time range. */
160
+ interface InsightsCountEventSeriesInput {
161
+ readonly filter: InsightsBundleEventFilter;
162
+ /** Whole UTC hours, at most 90 days, that a whole number of intervals fill. */
163
+ readonly timeRange: InsightsTimeRange;
164
+ /** Whole hours each point spans, from `timeRange.start`. */
165
+ readonly intervalMs: number;
166
+ }
167
+ /** Stored events in [startMs, startMs + intervalMs). */
168
+ interface InsightsEventSeriesPoint {
169
+ readonly startMs: number;
170
+ readonly events: number;
171
+ }
159
172
  interface ReleaseReference {
160
173
  readonly releaseId: string;
161
174
  readonly platform: "ios" | "android";
@@ -174,44 +187,22 @@ type InsightsCoverage = {
174
187
  readonly kind: "partial";
175
188
  readonly sinceMs: number | null;
176
189
  };
190
+ /**
191
+ * A release's counts since its first report, from its lifetime counters,
192
+ * which are kept.
193
+ */
177
194
  interface ReleaseActivityMetrics {
178
195
  readonly downloads: number;
179
196
  readonly launches: number;
180
197
  readonly failedLaunches: number;
181
- /** Omitted for lifetime-only bundle-row reads. */
182
- readonly uniqueUsers?: number;
183
- /**
184
- * Points of each UTC day, or of each `intervalMs` from the period's start
185
- * on a release read that asks for one; present only for period reads.
186
- */
187
- readonly series?: readonly {
188
- readonly startMs: number;
189
- readonly downloads: number;
190
- readonly launches: number;
191
- readonly failedLaunches: number;
192
- }[];
193
198
  }
194
- type InsightsGetReleaseActivityInput = {
199
+ interface InsightsGetReleaseActivityInput {
200
+ /** 1 to 100 releases. */
195
201
  readonly releases: readonly ReleaseReference[];
196
- readonly timeRange?: InsightsTimeRange;
197
- /**
198
- * Whole hours each series point spans, from `timeRange.start`, with
199
- * every point present; omitted, the series has a point per UTC day
200
- * with reports. Only with a `timeRange`.
201
- */
202
- readonly intervalMs?: number;
203
- readonly scope?: never;
204
- } | {
205
- readonly scope: InsightsScope;
206
- readonly timeRange: InsightsTimeRange;
207
- readonly intervalMs?: never;
208
- readonly releases?: never;
209
- };
202
+ }
210
203
  interface InsightsGetReleaseActivityResult {
211
- readonly coverage: InsightsCoverage;
212
204
  readonly data: readonly {
213
- readonly release?: ReleaseReference;
214
- readonly scope?: InsightsScope;
205
+ readonly release: ReleaseReference;
215
206
  readonly metrics: ReleaseActivityMetrics;
216
207
  }[];
217
208
  readonly measuredAtMs: number;
@@ -247,23 +238,6 @@ interface InsightsGetAppUsageResult {
247
238
  }[];
248
239
  readonly measuredAtMs: number;
249
240
  }
250
- /** Whole UTC days, at most 31, including the current unfinished day. */
251
- interface InsightsGetDistributionHistoryInput extends InsightsScope {
252
- readonly timeRange: InsightsTimeRange;
253
- }
254
- interface InsightsGetDistributionHistoryResult {
255
- readonly coverage: InsightsCoverage;
256
- readonly measuredAtMs: number;
257
- readonly points: readonly {
258
- readonly startMs: number;
259
- readonly bundles: readonly {
260
- readonly appVersion: string;
261
- readonly releaseId: string | null;
262
- readonly bundleKind: "release" | "builtin" | "unknown";
263
- readonly installations: number;
264
- }[];
265
- }[];
266
- }
267
241
  //#endregion
268
242
  //#region ../insights/dist/server/schema.d.mts
269
243
  //#region src/server/schema.d.ts
@@ -417,10 +391,6 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
417
391
  movement_install_id: "string";
418
392
  bundle_ref: "string";
419
393
  }, {
420
- readonly recent: {
421
- readonly eq: readonly ["channel", "platform", "day"];
422
- readonly sort: readonly ["received_at_ms"];
423
- };
424
394
  readonly movementsByInstall: {
425
395
  readonly eq: readonly ["movement_install_id"];
426
396
  readonly sort: readonly ["received_at_ms"];
@@ -520,7 +490,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
520
490
  readonly eq: readonly ["identity"];
521
491
  readonly sort: readonly ["bucket_start_ms"];
522
492
  };
523
- }, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
493
+ }, "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
524
494
  readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
525
495
  readonly identity: {
526
496
  readonly type: "string";
@@ -548,7 +518,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
548
518
  readonly eq: readonly ["identity"];
549
519
  readonly sort: readonly ["bucket_start_ms"];
550
520
  };
551
- }, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
521
+ }, "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
552
522
  readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
553
523
  readonly identity: {
554
524
  readonly type: "string";
@@ -605,68 +575,6 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
605
575
  readonly sort: readonly ["bucket_start_ms"];
606
576
  };
607
577
  }, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
608
- readonly bundle_daily_heads: import("@hot-updater/plugin-core").TableDefinition<{
609
- readonly install_id: {
610
- readonly type: "string";
611
- readonly maxLength: 255;
612
- };
613
- readonly bucket_start_ms: {
614
- readonly type: "integer";
615
- };
616
- readonly id: {
617
- readonly type: "string";
618
- readonly maxLength: 36;
619
- };
620
- readonly received_at_ms: {
621
- readonly type: "integer";
622
- };
623
- readonly channel: {
624
- readonly type: "string";
625
- };
626
- readonly platform: {
627
- readonly type: "string";
628
- readonly maxLength: 16;
629
- };
630
- readonly app_version: {
631
- readonly type: "string";
632
- };
633
- readonly release_id: {
634
- readonly type: "string";
635
- readonly maxLength: 36;
636
- };
637
- readonly bundle_kind: {
638
- readonly type: "string";
639
- readonly maxLength: 16;
640
- };
641
- }, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {}, readonly ["install_id", "bucket_start_ms"]>;
642
- readonly insights_distribution_history: import("@hot-updater/plugin-core").AggregateDefinition<{
643
- readonly channel: {
644
- readonly type: "string";
645
- };
646
- readonly platform: {
647
- readonly type: "string";
648
- readonly maxLength: 16;
649
- };
650
- readonly app_version: {
651
- readonly type: "string";
652
- };
653
- readonly release_id: {
654
- readonly type: "string";
655
- readonly maxLength: 36;
656
- };
657
- readonly bundle_kind: {
658
- readonly type: "string";
659
- readonly maxLength: 16;
660
- };
661
- readonly bucket_start_ms: {
662
- readonly type: "integer";
663
- };
664
- }, "installations", {
665
- readonly byScope: {
666
- readonly eq: readonly ["channel", "platform"];
667
- readonly sort: readonly ["bucket_start_ms"];
668
- };
669
- }, never, readonly ["channel", "platform", "app_version", "release_id", "bundle_kind", "bucket_start_ms"]>;
670
578
  readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
671
579
  readonly platform: {
672
580
  readonly type: "string";
@@ -762,8 +670,8 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
762
670
  findLatestEvents: (input: InsightsFindLatestEventsInput) => Promise<readonly BundleEventRow[]>;
763
671
  countLatestEvents: (input: InsightsCountLatestEventsInput) => Promise<number>;
764
672
  countEvents: (input: InsightsCountEventsInput) => Promise<number>;
673
+ countEventSeries: (input: InsightsCountEventSeriesInput) => Promise<readonly InsightsEventSeriesPoint[]>;
765
674
  getReleaseActivity: (input: InsightsGetReleaseActivityInput) => Promise<InsightsGetReleaseActivityResult>;
766
- getDistributionHistory: (input: InsightsGetDistributionHistoryInput) => Promise<InsightsGetDistributionHistoryResult>;
767
675
  getAppUsage: (input: InsightsGetAppUsageInput) => Promise<InsightsGetAppUsageResult>;
768
676
  getUpdateFailures: (input: InsightsUpdateFailuresInput) => Promise<InsightsUpdateFailures>;
769
677
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/cloudflare",
3
3
  "type": "module",
4
- "version": "1.0.0-rc.30",
4
+ "version": "1.0.0-rc.32",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.mjs",
@@ -56,10 +56,10 @@
56
56
  "cloudflare": "4.2.0",
57
57
  "hono": "4.12.34",
58
58
  "uuidv7": "^1.0.2",
59
- "@hot-updater/cli-tools": "1.0.0-rc.30",
60
- "@hot-updater/plugin-core": "1.0.0-rc.28",
61
- "@hot-updater/server": "1.0.0-rc.30",
62
- "@hot-updater/protocol": "1.0.0-rc.28"
59
+ "@hot-updater/cli-tools": "1.0.0-rc.32",
60
+ "@hot-updater/plugin-core": "1.0.0-rc.29",
61
+ "@hot-updater/protocol": "1.0.0-rc.29",
62
+ "@hot-updater/server": "1.0.0-rc.32"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@cloudflare/vitest-pool-workers": "0.13.0",
@@ -75,7 +75,7 @@
75
75
  "vitest": "4.1.4",
76
76
  "wrangler": "^4.69.0",
77
77
  "xdg-app-paths": "^8.3.0",
78
- "@hot-updater/test-utils": "1.0.0-rc.29"
78
+ "@hot-updater/test-utils": "1.0.0-rc.30"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "tsdown && pnpm build:worker",
package/sql/bundles.sql CHANGED
@@ -38,8 +38,6 @@ CREATE TABLE IF NOT EXISTS "bundle_totals" ("platform_key" TEXT NOT NULL, "_shar
38
38
 
39
39
  CREATE TABLE IF NOT EXISTS "bundle_events" ("id" TEXT NOT NULL, "type" TEXT NOT NULL, "install_id" TEXT NOT NULL, "user_id" TEXT, "from_release_id" TEXT, "from_bundle_id" TEXT, "to_release_id" TEXT, "to_bundle_id" TEXT NOT NULL, "platform" TEXT NOT NULL, "app_version" TEXT NOT NULL, "channel" TEXT NOT NULL, "metadata" TEXT NOT NULL, "received_at_ms" INTEGER NOT NULL, "day" INTEGER, "movement_install_id" TEXT, "bundle_ref" TEXT, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("id"));
40
40
 
41
- CREATE INDEX IF NOT EXISTS "bundle_events_recent" ON "bundle_events" ("channel", "platform", "day", "received_at_ms", "id");
42
-
43
41
  CREATE INDEX IF NOT EXISTS "bundle_events_movementsByInstall" ON "bundle_events" ("movement_install_id", "received_at_ms", "id");
44
42
 
45
43
  CREATE TABLE IF NOT EXISTS "bundle_events__byBundle" ("platform" TEXT NOT NULL, "channel" TEXT NOT NULL, "type" TEXT NOT NULL, "bundle_ref" TEXT NOT NULL, "day" INTEGER NOT NULL, "received_at_ms" INTEGER NOT NULL, "id" TEXT NOT NULL, PRIMARY KEY ("platform", "channel", "type", "bundle_ref", "day", "received_at_ms", "id"));
@@ -56,7 +54,7 @@ CREATE TABLE IF NOT EXISTS "insights_overview" ("identity" TEXT NOT NULL, "bucke
56
54
 
57
55
  CREATE INDEX IF NOT EXISTS "insights_overview__retention" ON "insights_overview" ("bucket_start_ms", "identity", "_shard");
58
56
 
59
- CREATE TABLE IF NOT EXISTS "insights_sketches" ("identity" TEXT NOT NULL, "bucket_start_ms" INTEGER NOT NULL, "_shard" INTEGER NOT NULL, "launch_users" TEXT, "activity_users" TEXT, "failed_users" TEXT, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
57
+ CREATE TABLE IF NOT EXISTS "insights_sketches" ("identity" TEXT NOT NULL, "bucket_start_ms" INTEGER NOT NULL, "_shard" INTEGER NOT NULL, "activity_users" TEXT, "failed_users" TEXT, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
60
58
 
61
59
  CREATE INDEX IF NOT EXISTS "insights_sketches__retention" ON "insights_sketches" ("bucket_start_ms", "identity", "_shard");
62
60
 
@@ -64,7 +62,7 @@ CREATE TABLE IF NOT EXISTS "insights_overview_daily" ("identity" TEXT NOT NULL,
64
62
 
65
63
  CREATE INDEX IF NOT EXISTS "insights_overview_daily__retention" ON "insights_overview_daily" ("bucket_start_ms", "identity", "_shard");
66
64
 
67
- CREATE TABLE IF NOT EXISTS "insights_sketches_daily" ("identity" TEXT NOT NULL, "bucket_start_ms" INTEGER NOT NULL, "_shard" INTEGER NOT NULL, "launch_users" TEXT, "activity_users" TEXT, "failed_users" TEXT, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
65
+ CREATE TABLE IF NOT EXISTS "insights_sketches_daily" ("identity" TEXT NOT NULL, "bucket_start_ms" INTEGER NOT NULL, "_shard" INTEGER NOT NULL, "activity_users" TEXT, "failed_users" TEXT, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("identity", "bucket_start_ms", "_shard"));
68
66
 
69
67
  CREATE INDEX IF NOT EXISTS "insights_sketches_daily__retention" ON "insights_sketches_daily" ("bucket_start_ms", "identity", "_shard");
70
68
 
@@ -80,16 +78,6 @@ CREATE INDEX IF NOT EXISTS "insights_distribution_byVersion" ON "insights_distri
80
78
 
81
79
  CREATE INDEX IF NOT EXISTS "insights_distribution__retention" ON "insights_distribution" ("bucket_start_ms", "channel", "platform", "app_version", "release_id", "_shard");
82
80
 
83
- CREATE TABLE IF NOT EXISTS "bundle_daily_heads" ("install_id" TEXT NOT NULL, "bucket_start_ms" INTEGER NOT NULL, "id" TEXT NOT NULL, "received_at_ms" INTEGER NOT NULL, "channel" TEXT NOT NULL, "platform" TEXT NOT NULL, "app_version" TEXT NOT NULL, "release_id" TEXT NOT NULL, "bundle_kind" TEXT NOT NULL, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("install_id", "bucket_start_ms"));
84
-
85
- CREATE INDEX IF NOT EXISTS "bundle_daily_heads__retention" ON "bundle_daily_heads" ("bucket_start_ms", "install_id");
86
-
87
- CREATE TABLE IF NOT EXISTS "insights_distribution_history" ("channel" TEXT NOT NULL, "platform" TEXT NOT NULL, "app_version" TEXT NOT NULL, "release_id" TEXT NOT NULL, "bundle_kind" TEXT NOT NULL, "bucket_start_ms" INTEGER NOT NULL, "_shard" INTEGER NOT NULL, "installations" INTEGER NOT NULL, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("channel", "platform", "app_version", "release_id", "bundle_kind", "bucket_start_ms", "_shard"));
88
-
89
- CREATE INDEX IF NOT EXISTS "insights_distribution_history_byScope" ON "insights_distribution_history" ("channel", "platform", "bucket_start_ms", "app_version", "release_id", "bundle_kind", "_shard");
90
-
91
- CREATE INDEX IF NOT EXISTS "insights_distribution_history__retention" ON "insights_distribution_history" ("bucket_start_ms", "channel", "platform", "app_version", "release_id", "bundle_kind", "_shard");
92
-
93
81
  CREATE TABLE IF NOT EXISTS "insights_latest_by_bundle" ("platform" TEXT NOT NULL, "channel" TEXT NOT NULL, "bundle_field" TEXT NOT NULL, "bundle_id" TEXT NOT NULL, "type" TEXT NOT NULL, "bucket_start_ms" INTEGER NOT NULL, "_shard" INTEGER NOT NULL, "installations" INTEGER NOT NULL, "_v" INTEGER NOT NULL DEFAULT 0, PRIMARY KEY ("platform", "channel", "bundle_field", "bundle_id", "type", "bucket_start_ms", "_shard"));
94
82
 
95
83
  CREATE INDEX IF NOT EXISTS "insights_latest_by_bundle__retention" ON "insights_latest_by_bundle" ("bucket_start_ms", "platform", "channel", "bundle_field", "bundle_id", "type", "_shard");
@@ -114,6 +102,6 @@ INSERT INTO "private_hot_updater_settings" ("key", "value", "_v") VALUES ('schem
114
102
 
115
103
  INSERT INTO "private_hot_updater_settings" ("key", "value", "_v") VALUES ('schema.core', '1.0.0', 0) ON CONFLICT ("key") DO UPDATE SET "value" = excluded."value";
116
104
 
117
- INSERT INTO "private_hot_updater_settings" ("key", "value", "_v") VALUES ('schema.insights', '1.3.0', 0) ON CONFLICT ("key") DO UPDATE SET "value" = excluded."value";
105
+ INSERT INTO "private_hot_updater_settings" ("key", "value", "_v") VALUES ('schema.insights', '1.2.0', 0) ON CONFLICT ("key") DO UPDATE SET "value" = excluded."value";
118
106
 
119
107
  INSERT INTO "private_hot_updater_settings" ("key", "value", "_v") VALUES ('schema.apiKeys', '1.0.0', 0) ON CONFLICT ("key") DO UPDATE SET "value" = excluded."value";
@@ -1 +1 @@
1
- This folder contains the built output assets for the worker "hot-updater" generated at 2026-10-03T16:41:41.572Z.
1
+ This folder contains the built output assets for the worker "hot-updater" generated at 2026-10-05T13:29:29.173Z.