@hot-updater/cloudflare 1.0.0-rc.18 → 1.0.0-rc.21

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.
Files changed (41) hide show
  1. package/dist/index.cjs +7 -9
  2. package/dist/index.d.cts +323 -35
  3. package/dist/index.d.mts +323 -35
  4. package/dist/index.mjs +2 -4
  5. package/dist/init/index.cjs +11768 -0
  6. package/dist/init/index.d.cts +5 -1
  7. package/dist/init/index.d.mts +5 -1
  8. package/dist/init/index.mjs +11761 -1
  9. package/dist/worker/index.cjs +4 -5
  10. package/dist/worker/index.d.cts +323 -35
  11. package/dist/worker/index.d.mts +323 -35
  12. package/dist/worker/index.mjs +2 -3
  13. package/package.json +8 -11
  14. package/src/d1Database.ts +5 -2
  15. package/src/d1Executor.ts +2 -2
  16. package/src/d1Schema.ts +3 -2
  17. package/src/r2S3Storage.ts +4 -4
  18. package/src/r2Storage.ts +2 -2
  19. package/src/r2WorkerStorage.ts +4 -4
  20. package/worker/dist/README.md +1 -1
  21. package/worker/dist/index.js +4804 -4720
  22. package/worker/dist/index.js.map +4 -4
  23. package/dist/iac/index.cjs +0 -11838
  24. package/dist/iac/index.d.cts +0 -5
  25. package/dist/iac/index.d.mts +0 -5
  26. package/dist/iac/index.mjs +0 -11830
  27. package/src/d1Database.spec.ts +0 -190
  28. package/src/d1Schema.spec.ts +0 -89
  29. package/src/d1TestDatabase.ts +0 -38
  30. package/src/r2Storage.spec.ts +0 -346
  31. package/src/r2WorkerStorage.spec.ts +0 -184
  32. package/src/utils/createWrangler.spec.ts +0 -75
  33. package/src/worker/d1Database.spec.ts +0 -59
  34. package/worker/src/d1.conformance.integration.spec.ts +0 -53
  35. package/worker/src/d1.readBudgets.integration.spec.ts +0 -85
  36. package/worker/src/databaseMigration.integration.spec.ts +0 -101
  37. package/worker/src/databasePlugins.integration.spec.ts +0 -318
  38. package/worker/src/index.integration.spec.ts +0 -182
  39. package/worker/src/readPlans.integration.spec.ts +0 -89
  40. package/worker/src/storagePlugin.integration.spec.ts +0 -59
  41. package/worker/src/testWorker.ts +0 -5
@@ -1,8 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- let _hot_updater_server_database = require("@hot-updater/server/database");
2
+ let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
3
3
  let _hot_updater_server_plugins_api_keys = require("@hot-updater/server/plugins/api-keys");
4
4
  let _hot_updater_server_plugins_insights = require("@hot-updater/server/plugins/insights");
5
- let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
6
5
  //#region src/d1Executor.ts
7
6
  var D1ExecutionError = class extends Error {
8
7
  name = "D1ExecutionError";
@@ -30,9 +29,9 @@ const withSqliteCode = (error) => {
30
29
  * (`_hu_write`).
31
30
  */
32
31
  const createD1Database = (runner) => {
33
- return (0, _hot_updater_server_database.createEngineDatabase)({
32
+ return (0, _hot_updater_plugin_core.createEngineDatabase)({
34
33
  name: "d1Database",
35
- adapter: (0, _hot_updater_server_database.createSqlAdapter)({
34
+ adapter: (0, _hot_updater_plugin_core.createSqlAdapter)({
36
35
  executor: {
37
36
  dialect: "sqlite",
38
37
  execute: (statement) => runner.query(statement).catch((error) => {
@@ -78,7 +77,7 @@ const r2WorkerStorage = (config) => {
78
77
  if (parsed.bucket !== config.bucketName) throw new Error(`Bucket name mismatch: expected "${config.bucketName}", but found "${parsed.bucket}".`);
79
78
  return parsed;
80
79
  };
81
- return (0, _hot_updater_plugin_core.createStoragePlugin)({
80
+ return (0, _hot_updater_plugin_core.createStorageAdapter)({
82
81
  name: "r2Storage",
83
82
  protocol: "r2",
84
83
  async put({ key, body, contentLength, contentType }) {
@@ -1,6 +1,4 @@
1
- import { EngineDatabase, StoragePluginWith } from "@hot-updater/plugin-core";
2
- import "@hot-updater/server/database";
3
- import "@hot-updater/server/db";
1
+ import { DatabaseJsonObject, EngineDatabase, Platform, StorageAdapterWith } from "@hot-updater/plugin-core";
4
2
  //#region src/d1Executor.d.ts
5
3
  /** A D1 result, from the binding or the REST API. */
6
4
  interface D1ResultLike {
@@ -25,13 +23,303 @@ type D1Like = {
25
23
  /** Hot Updater's database on a D1 binding, inside a Worker. */
26
24
  declare const d1Database: (database: D1Like) => EngineDatabase;
27
25
  //#endregion
26
+ //#region ../insights/dist/server/eventRow.d.mts
27
+ //#region src/server/eventRow.d.ts
28
+ /** Where an update failed, and what failed; open sets, `unknown` for any other value. */
29
+ type BundleEventFailureStage = "check" | "download" | "install" | "unknown";
30
+ type BundleEventFailureReason = "network" | "http" | "invalid_response" | "hash_mismatch" | "signature" | "patch" | "extract" | "storage" | "unknown";
31
+ /** An `UPDATE_FAILED` report's failure, as stored. */
32
+ type BundleEventFailure = DatabaseJsonObject & {
33
+ readonly stage: BundleEventFailureStage;
34
+ readonly reason: BundleEventFailureReason;
35
+ /** What the client was fetching or writing. */
36
+ readonly resource?: "catalog" | "artifact" | "manifest" | "file" | "patch" | "archive" | "unknown";
37
+ readonly http_status?: number;
38
+ /** How the connection failed, when it did. */
39
+ readonly transport?: "timeout" | "dns" | "tls" | "connection" | "offline" | "cancelled" | "unknown";
40
+ /** The storage origin's error code, such as `ExpiredToken`. */
41
+ readonly origin_code?: string;
42
+ /** Android's `ApplicationExitInfo` reason for the process before this one. */
43
+ readonly previous_process_exit?: string;
44
+ };
45
+ /** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
46
+ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
47
+ readonly cohort: string;
48
+ readonly update_strategy: "fingerprint" | "appVersion" | null;
49
+ readonly fingerprint_hash: string | null;
50
+ readonly sdk_version: string | null;
51
+ /** `UPDATE_FAILED`: what failed. */
52
+ readonly failure?: BundleEventFailure;
53
+ /** `UPDATE_DOWNLOADED`: how the bundle arrived. */
54
+ readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
55
+ /** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
56
+ readonly patch_fallback?: boolean;
57
+ /** `RECOVERED`: Android's `ApplicationExitInfo` reason for the crashed process. */
58
+ readonly previous_process_exit?: string;
59
+ };
60
+ type BundleEventRowBase = {
61
+ readonly id: string;
62
+ readonly install_id: string;
63
+ readonly user_id: string | null;
64
+ readonly from_release_id: string | null;
65
+ readonly to_release_id: string | null;
66
+ readonly to_bundle_id: string;
67
+ readonly platform: Platform;
68
+ readonly app_version: string;
69
+ readonly channel: string;
70
+ readonly metadata: DatabaseBundleEventMetadata;
71
+ readonly received_at_ms: number;
72
+ };
73
+ type BundleEventRow = BundleEventRowBase & ({
74
+ readonly type: "UPDATE_DOWNLOADED";
75
+ readonly from_bundle_id: string;
76
+ } | {
77
+ readonly type: "UPDATE_APPLIED" | "RECOVERED";
78
+ readonly from_bundle_id: string;
79
+ } |
80
+ /** An update that failed: `from` is the running bundle, `to` the target (for a check, the running bundle). */
81
+ {
82
+ readonly type: "UPDATE_FAILED";
83
+ readonly from_bundle_id: string;
84
+ } | {
85
+ readonly type: "UNCHANGED";
86
+ readonly from_bundle_id: null;
87
+ });
88
+ //#endregion
89
+ //#region ../insights/dist/server/modelTypes.d.mts
90
+ //#region src/server/modelTypes.d.ts
91
+ interface InsightsEventCursor {
92
+ readonly receivedAtMs: number;
93
+ readonly id: string;
94
+ }
95
+ interface InsightsScope {
96
+ readonly platform: "ios" | "android";
97
+ readonly channel: string;
98
+ }
99
+ /**
100
+ * Raw event predicates; recovery is attributed to the source bundle. An
101
+ * UNCHANGED report is kept as no event, so no filter names it.
102
+ */
103
+ type InsightsBundleEventFilter = InsightsScope & ({
104
+ readonly type: "RECOVERED";
105
+ readonly fromBundleId: string;
106
+ } | {
107
+ readonly type: "UPDATE_DOWNLOADED" | "UPDATE_APPLIED" | "UPDATE_FAILED";
108
+ readonly toBundleId: string;
109
+ });
110
+ type InsightsEventFilter = {
111
+ readonly kind: "all";
112
+ } | {
113
+ readonly kind: "installationMovement";
114
+ readonly installId: string;
115
+ } | ({
116
+ readonly kind: "bundle";
117
+ } & InsightsBundleEventFilter);
118
+ interface InsightsListEventsInput {
119
+ readonly filter: InsightsEventFilter;
120
+ readonly sinceMs?: number;
121
+ readonly beforeReceivedAtMs: number;
122
+ readonly after?: InsightsEventCursor;
123
+ readonly limit: number;
124
+ }
125
+ type InsightsFindLatestEventsInput = {
126
+ readonly installId: string;
127
+ } | {
128
+ readonly userId: string;
129
+ readonly afterInstallId?: string;
130
+ readonly limit: number;
131
+ };
132
+ interface InsightsCountLatestEventsInput extends InsightsScope {
133
+ /** A UTC day's start: latest events are counted by the day they fall in. */
134
+ readonly sinceMs: number;
135
+ /** Optional OR of one or two fixed predicates; count a matching event once. */
136
+ readonly bundle?: readonly {
137
+ readonly field: "from_bundle_id" | "to_bundle_id";
138
+ readonly value: string;
139
+ readonly types: readonly BundleEventRow["type"][];
140
+ }[];
141
+ }
142
+ interface InsightsCountEventsInput {
143
+ readonly filter: InsightsBundleEventFilter;
144
+ readonly sinceMs: number;
145
+ readonly beforeReceivedAtMs: number;
146
+ }
147
+ interface ReleaseReference {
148
+ readonly releaseId: string;
149
+ readonly platform: "ios" | "android";
150
+ readonly channel: string;
151
+ }
152
+ interface InsightsTimeRange {
153
+ /** Inclusive UTC Unix timestamp in milliseconds. */
154
+ readonly start: number;
155
+ /** Exclusive UTC Unix timestamp in milliseconds. */
156
+ readonly end: number;
157
+ }
158
+ type InsightsCoverage = {
159
+ readonly kind: "complete";
160
+ readonly sinceMs: number;
161
+ } | {
162
+ readonly kind: "partial";
163
+ readonly sinceMs: number | null;
164
+ };
165
+ interface ReleaseActivityMetrics {
166
+ readonly downloads: number;
167
+ readonly launches: number;
168
+ readonly failedLaunches: number;
169
+ /** Omitted for lifetime-only bundle-row reads. */
170
+ readonly uniqueUsers?: number;
171
+ /** Daily points, present only for period reads. */
172
+ readonly series?: readonly {
173
+ readonly startMs: number;
174
+ readonly launches: number;
175
+ readonly failedLaunches: number;
176
+ }[];
177
+ }
178
+ type InsightsGetReleaseActivityInput = {
179
+ readonly releases: readonly ReleaseReference[];
180
+ readonly timeRange?: InsightsTimeRange;
181
+ readonly scope?: never;
182
+ } | {
183
+ readonly scope: InsightsScope;
184
+ readonly timeRange: InsightsTimeRange;
185
+ readonly releases?: never;
186
+ };
187
+ interface InsightsGetReleaseActivityResult {
188
+ readonly coverage: InsightsCoverage;
189
+ readonly data: readonly {
190
+ readonly release?: ReleaseReference;
191
+ readonly scope?: InsightsScope;
192
+ readonly metrics: ReleaseActivityMetrics;
193
+ }[];
194
+ readonly measuredAtMs: number;
195
+ }
196
+ interface InsightsGetAppUsageInput {
197
+ readonly channel: string;
198
+ readonly platform: "all" | "ios" | "android";
199
+ readonly appVersion?: string;
200
+ readonly timeRange: InsightsTimeRange;
201
+ readonly intervalMs: number;
202
+ }
203
+ interface InsightsGetAppUsageResult {
204
+ readonly coverage: InsightsCoverage;
205
+ readonly activeInstallations: number;
206
+ readonly points: readonly {
207
+ readonly startMs: number;
208
+ readonly installations: number;
209
+ }[];
210
+ readonly appVersions: readonly string[];
211
+ readonly versions: readonly {
212
+ readonly name: string;
213
+ readonly installations: number;
214
+ }[];
215
+ readonly platforms: readonly {
216
+ readonly name: string;
217
+ readonly installations: number;
218
+ }[];
219
+ readonly bundleDistribution: readonly {
220
+ readonly appVersion: string;
221
+ readonly platform: "ios" | "android";
222
+ readonly releaseId: string | null;
223
+ readonly installations: number;
224
+ }[];
225
+ readonly measuredAtMs: number;
226
+ }
227
+ //#endregion
228
+ //#region ../insights/dist/server/schema.d.mts
229
+ //#region src/server/schema.d.ts
230
+ /** How long Insights keeps its rows, in whole days. Lifetime counters are kept. */
231
+ interface InsightsRetention {
232
+ /** Raw events and hourly rollups. */
233
+ readonly rawDays: number;
234
+ /** Daily rollups, and each installation's latest event and the gauges that count it. */
235
+ readonly dailyDays: number;
236
+ }
237
+ //#endregion
238
+ //#region ../insights/dist/server/reads.d.mts
239
+ //#region src/server/reads.d.ts
240
+ interface InsightsUpdateFailuresInput {
241
+ readonly platform: "ios" | "android";
242
+ readonly channel: string;
243
+ /** A release's failures; without it, the channel's, which need a time range. */
244
+ readonly releaseId?: string;
245
+ /** Without it, a release's failures since its first report. */
246
+ readonly timeRange?: InsightsTimeRange;
247
+ }
248
+ /** Update failures of one stage and reason, and what else their clients knew. */
249
+ interface InsightsFailureBreakdown {
250
+ readonly stage: string;
251
+ readonly reason: string;
252
+ readonly events: number;
253
+ /** By resource, HTTP status, origin code, and transport, most first. */
254
+ readonly details: readonly {
255
+ readonly resource: string | null;
256
+ readonly httpStatus: number | null;
257
+ readonly originCode: string | null;
258
+ readonly transport: string | null;
259
+ readonly events: number;
260
+ }[];
261
+ }
262
+ interface InsightsUpdateFailures {
263
+ readonly coverage: InsightsCoverage;
264
+ readonly measuredAtMs: number;
265
+ /** Update failures other than failed checks: each client reports one at most once a UTC day. */
266
+ readonly failedUpdates: number;
267
+ /** Installations with such a failure, estimated. */
268
+ readonly failedInstallations: number;
269
+ /** Download reports: each installation reports a bundle's download once. */
270
+ readonly downloads: number;
271
+ /** Downloads a patch delivered, and those that fell back from a patch to files or the archive. */
272
+ readonly patchDownloads: number;
273
+ readonly patchFallbacks: number;
274
+ /** A channel's failed update checks, installations with one, and its active installations, estimated. */
275
+ readonly checks?: {
276
+ readonly failures: number;
277
+ readonly failedInstallations: number;
278
+ readonly activeInstallations: number;
279
+ };
280
+ /** Over a time range: failures by stage and reason, most first. */
281
+ readonly breakdown?: readonly InsightsFailureBreakdown[];
282
+ /**
283
+ * Over a time range: failed launches, and the recoveries whose crashed
284
+ * process exited for a reason Android 11+ reported, by reason, most first.
285
+ */
286
+ readonly recoveries?: {
287
+ readonly failedLaunches: number;
288
+ readonly byExitReason: readonly {
289
+ readonly exitReason: string;
290
+ readonly events: number;
291
+ }[];
292
+ };
293
+ }
294
+ //#endregion
295
+ //#region ../api-keys/dist/server/model.d.mts
296
+ //#region src/server/model.d.ts
297
+ interface ApiKeyRow {
298
+ readonly id: string;
299
+ readonly hash: string;
300
+ readonly name: string;
301
+ readonly prefix: string;
302
+ readonly role: "client";
303
+ readonly created_at_ms: number;
304
+ readonly revoked_at_ms: number | null;
305
+ }
306
+ //#endregion
307
+ //#region ../api-keys/dist/server/apiKeys.d.mts
308
+ type ApiKeyMetadata = Omit<ApiKeyRow, "hash">;
309
+ interface CreatedApiKey {
310
+ /** Plaintext credential. It cannot be recovered after this call returns. */
311
+ readonly apiKey: string;
312
+ /** Non-secret metadata. The persisted SHA-256 hash is never exposed. */
313
+ readonly record: ApiKeyMetadata;
314
+ }
315
+ //#endregion
28
316
  //#region src/plugins.d.ts
29
317
  /**
30
318
  * The plugins the managed Cloudflare server runs: Insights, and API keys on every
31
319
  * client route. Its Worker imports this list.
32
320
  */
33
- declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdaterPlugin<"insights", {
34
- readonly bundle_events: import("@hot-updater/server/database").TableDefinition<{
321
+ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPlugin<"insights", {
322
+ readonly bundle_events: import("@hot-updater/plugin-core").TableDefinition<{
35
323
  readonly id: {
36
324
  readonly type: "string";
37
325
  readonly maxLength: 36;
@@ -106,7 +394,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
106
394
  readonly sort: readonly ["received_at_ms"];
107
395
  };
108
396
  }, readonly ["id"]>;
109
- readonly bundle_event_heads: import("@hot-updater/server/database").TableDefinition<{
397
+ readonly bundle_event_heads: import("@hot-updater/plugin-core").TableDefinition<{
110
398
  readonly install_id: {
111
399
  readonly type: "string";
112
400
  readonly maxLength: 255;
@@ -159,13 +447,13 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
159
447
  readonly received_at_ms: {
160
448
  readonly type: "integer";
161
449
  };
162
- }, Readonly<Record<string, import("@hot-updater/server/database").FieldType>>, {
450
+ }, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {
163
451
  readonly byUser: {
164
452
  readonly eq: readonly ["user_id"];
165
453
  readonly sort: readonly ["install_id"];
166
454
  };
167
455
  }, readonly ["install_id"]>;
168
- readonly insights_overview: import("@hot-updater/server/database").AggregateDefinition<{
456
+ readonly insights_overview: import("@hot-updater/plugin-core").AggregateDefinition<{
169
457
  readonly identity: {
170
458
  readonly type: "string";
171
459
  readonly maxLength: 32;
@@ -179,7 +467,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
179
467
  readonly sort: readonly ["bucket_start_ms"];
180
468
  };
181
469
  }, never, readonly ["identity", "bucket_start_ms"]>;
182
- readonly insights_sketches: import("@hot-updater/server/database").AggregateDefinition<{
470
+ readonly insights_sketches: import("@hot-updater/plugin-core").AggregateDefinition<{
183
471
  readonly identity: {
184
472
  readonly type: "string";
185
473
  readonly maxLength: 32;
@@ -193,7 +481,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
193
481
  readonly sort: readonly ["bucket_start_ms"];
194
482
  };
195
483
  }, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
196
- readonly insights_overview_daily: import("@hot-updater/server/database").AggregateDefinition<{
484
+ readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
197
485
  readonly identity: {
198
486
  readonly type: "string";
199
487
  readonly maxLength: 32;
@@ -207,7 +495,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
207
495
  readonly sort: readonly ["bucket_start_ms"];
208
496
  };
209
497
  }, never, readonly ["identity", "bucket_start_ms"]>;
210
- readonly insights_sketches_daily: import("@hot-updater/server/database").AggregateDefinition<{
498
+ readonly insights_sketches_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
211
499
  readonly identity: {
212
500
  readonly type: "string";
213
501
  readonly maxLength: 32;
@@ -221,7 +509,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
221
509
  readonly sort: readonly ["bucket_start_ms"];
222
510
  };
223
511
  }, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
224
- readonly insights_overview_lifetime: import("@hot-updater/server/database").AggregateDefinition<{
512
+ readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
225
513
  readonly identity: {
226
514
  readonly type: "string";
227
515
  readonly maxLength: 32;
@@ -235,7 +523,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
235
523
  readonly sort: readonly ["bucket_start_ms"];
236
524
  };
237
525
  }, never, readonly ["identity", "bucket_start_ms"]>;
238
- readonly insights_sketches_lifetime: import("@hot-updater/server/database").AggregateDefinition<{
526
+ readonly insights_sketches_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
239
527
  readonly identity: {
240
528
  readonly type: "string";
241
529
  readonly maxLength: 32;
@@ -249,7 +537,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
249
537
  readonly sort: readonly ["bucket_start_ms"];
250
538
  };
251
539
  }, "failed_users", readonly ["identity", "bucket_start_ms"]>;
252
- readonly insights_distribution: import("@hot-updater/server/database").AggregateDefinition<{
540
+ readonly insights_distribution: import("@hot-updater/plugin-core").AggregateDefinition<{
253
541
  readonly channel: {
254
542
  readonly type: "string";
255
543
  };
@@ -277,7 +565,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
277
565
  readonly sort: readonly ["bucket_start_ms"];
278
566
  };
279
567
  }, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
280
- readonly insights_latest_by_bundle: import("@hot-updater/server/database").AggregateDefinition<{
568
+ readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
281
569
  readonly platform: {
282
570
  readonly type: "string";
283
571
  readonly maxLength: 16;
@@ -306,7 +594,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
306
594
  readonly sort: readonly ["bucket_start_ms"];
307
595
  };
308
596
  }, never, readonly ["platform", "channel", "bundle_field", "bundle_id", "type", "bucket_start_ms"]>;
309
- readonly insights_outcomes: import("@hot-updater/server/database").AggregateDefinition<{
597
+ readonly insights_outcomes: import("@hot-updater/plugin-core").AggregateDefinition<{
310
598
  readonly platform: {
311
599
  readonly type: "string";
312
600
  readonly maxLength: 16;
@@ -331,7 +619,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
331
619
  readonly sort: readonly ["bucket_start_ms"];
332
620
  };
333
621
  }, never, readonly ["platform", "channel", "type", "bundle_ref", "bucket_start_ms"]>;
334
- readonly insights_failures: import("@hot-updater/server/database").AggregateDefinition<{
622
+ readonly insights_failures: import("@hot-updater/plugin-core").AggregateDefinition<{
335
623
  readonly platform: {
336
624
  readonly type: "string";
337
625
  readonly maxLength: 16;
@@ -366,19 +654,19 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
366
654
  }, never, readonly ["platform", "channel", "bucket_start_ms", "release_id", "stage", "reason", "detail"]>;
367
655
  }, {
368
656
  api: {
369
- retention: import("@hot-updater/server/plugins/insights").InsightsRetention;
370
- recordEvent: (event: import("@hot-updater/server/plugins/insights").BundleEventRow) => Promise<void>;
371
- listEvents: (input: import("@hot-updater/server/plugins/insights").InsightsListEventsInput) => Promise<readonly import("@hot-updater/server/plugins/insights").BundleEventRow[]>;
372
- findLatestEvents: (input: import("@hot-updater/server/plugins/insights").InsightsFindLatestEventsInput) => Promise<readonly import("@hot-updater/server/plugins/insights").BundleEventRow[]>;
373
- countLatestEvents: (input: import("@hot-updater/server/plugins/insights").InsightsCountLatestEventsInput) => Promise<number>;
374
- countEvents: (input: import("@hot-updater/server/plugins/insights").InsightsCountEventsInput) => Promise<number>;
375
- getReleaseActivity: (input: import("@hot-updater/server/plugins/insights").InsightsGetReleaseActivityInput) => Promise<import("@hot-updater/server/plugins/insights").InsightsGetReleaseActivityResult>;
376
- getAppUsage: (input: import("@hot-updater/server/plugins/insights").InsightsGetAppUsageInput) => Promise<import("@hot-updater/server/plugins/insights").InsightsGetAppUsageResult>;
377
- getUpdateFailures: (input: import("@hot-updater/server/plugins/insights").InsightsUpdateFailuresInput) => Promise<import("@hot-updater/server/plugins/insights").InsightsUpdateFailures>;
657
+ retention: InsightsRetention;
658
+ recordEvent: (event: BundleEventRow) => Promise<void>;
659
+ listEvents: (input: InsightsListEventsInput) => Promise<readonly BundleEventRow[]>;
660
+ findLatestEvents: (input: InsightsFindLatestEventsInput) => Promise<readonly BundleEventRow[]>;
661
+ countLatestEvents: (input: InsightsCountLatestEventsInput) => Promise<number>;
662
+ countEvents: (input: InsightsCountEventsInput) => Promise<number>;
663
+ getReleaseActivity: (input: InsightsGetReleaseActivityInput) => Promise<InsightsGetReleaseActivityResult>;
664
+ getAppUsage: (input: InsightsGetAppUsageInput) => Promise<InsightsGetAppUsageResult>;
665
+ getUpdateFailures: (input: InsightsUpdateFailuresInput) => Promise<InsightsUpdateFailures>;
378
666
  };
379
- endpoints: import("@hot-updater/server/plugins").PluginEndpoint[];
380
- }, {}>, import("@hot-updater/server/plugins").HotUpdaterPlugin<"apiKeys", {
381
- readonly api_keys: import("@hot-updater/server/database").TableDefinition<{
667
+ endpoints: import("@hot-updater/plugin-core").PluginEndpoint[];
668
+ }, {}>, import("@hot-updater/plugin-core").HotUpdaterPlugin<"apiKeys", {
669
+ readonly api_keys: import("@hot-updater/plugin-core").TableDefinition<{
382
670
  readonly id: {
383
671
  readonly type: "string";
384
672
  readonly maxLength: 255;
@@ -419,21 +707,21 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
419
707
  readonly apiKey: string;
420
708
  readonly name: string;
421
709
  readonly createdAtMs?: number;
422
- }) => Promise<import("@hot-updater/server/plugins/api-keys").CreatedApiKey>;
710
+ }) => Promise<CreatedApiKey>;
423
711
  provision: (input: {
424
712
  readonly existingApiKey?: string;
425
713
  readonly name: string;
426
- }) => Promise<import("@hot-updater/server/plugins/api-keys").CreatedApiKey>;
714
+ }) => Promise<CreatedApiKey>;
427
715
  create(input: {
428
716
  readonly name: string;
429
717
  }): Promise<{
430
718
  readonly apiKey: string;
431
- readonly record: import("@hot-updater/server/plugins/api-keys").ApiKeyMetadata;
719
+ readonly record: ApiKeyMetadata;
432
720
  }>;
433
- list(): Promise<readonly import("@hot-updater/server/plugins/api-keys").ApiKeyMetadata[]>;
721
+ list(): Promise<readonly ApiKeyMetadata[]>;
434
722
  revoke(input: {
435
723
  readonly id: string;
436
- }): Promise<import("@hot-updater/server/plugins/api-keys").ApiKeyMetadata | null>;
724
+ }): Promise<ApiKeyMetadata | null>;
437
725
  };
438
726
  clientAuth: {
439
727
  varyHeaders: string[];
@@ -450,6 +738,6 @@ interface CloudflareWorkerStorageConfig {
450
738
  readonly basePath?: string;
451
739
  readonly downloadUrlSigningKey: string;
452
740
  }
453
- declare const r2WorkerStorage: (config: CloudflareWorkerStorageConfig) => StoragePluginWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
741
+ declare const r2WorkerStorage: (config: CloudflareWorkerStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
454
742
  //#endregion
455
743
  export { type CloudflareWorkerStorageConfig, type D1Like, d1Database, plugins, r2WorkerStorage as r2Storage };