@hot-updater/firebase 1.0.0-rc.2 → 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.
package/dist/index.d.cts CHANGED
@@ -1,8 +1,26 @@
1
+ import { DatabaseJsonObject, EngineDatabase, Platform, PluginTables, StorageAdapterWith } from "@hot-updater/plugin-core";
1
2
  import { AppOptions } from "firebase-admin/app";
2
- import { StoragePluginWith } from "@hot-updater/plugin-core";
3
3
  //#region src/firebaseDatabase.d.ts
4
- type FirebaseDatabaseConfig = AppOptions;
5
- declare const firebaseDatabase: (config: FirebaseDatabaseConfig) => import("@hot-updater/plugin-core").DatabasePlugin;
4
+ type FirebaseDatabaseConfig = AppOptions & {
5
+ /** The one collection the database keeps its items in. */
6
+ readonly collection?: string;
7
+ /**
8
+ * Firestore bills each document write, so Insights' aggregates are
9
+ * batched: through log rows a compaction merges (the default), or
10
+ * `{ mode: "memory" }` on a long-lived server. `false` commits them with
11
+ * each event.
12
+ */
13
+ readonly aggregateBatching?: EngineDatabase["aggregateBatching"] | false;
14
+ };
15
+ /**
16
+ * Writes the schema settings of core and `plugins`, the plugins the server
17
+ * runs, which the database checks before its first read. Firestore needs no
18
+ * other setup beyond `firestore.indexes.json`; `hot-updater init` runs it
19
+ * after deploying the indexes.
20
+ */
21
+ declare const migrateFirebaseDatabase: (config: FirebaseDatabaseConfig, plugins?: readonly PluginTables[]) => Promise<void>;
22
+ /** Hot Updater's database in one Firestore collection, through the storage engine. */
23
+ declare const firebaseDatabase: (config: FirebaseDatabaseConfig) => EngineDatabase;
6
24
  //#endregion
7
25
  //#region src/firebaseStorage.d.ts
8
26
  interface FirebaseStorageConfig extends AppOptions {
@@ -14,6 +32,714 @@ interface FirebaseStorageConfig extends AppOptions {
14
32
  /** Firebase signed URL lifetime in seconds. @default 3600 */
15
33
  signedUrlExpiresIn?: number;
16
34
  }
17
- declare const firebaseStorage: (config: FirebaseStorageConfig) => StoragePluginWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
35
+ declare const firebaseStorage: (config: FirebaseStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
18
36
  //#endregion
19
- export { FirebaseDatabaseConfig, FirebaseStorageConfig, firebaseDatabase, firebaseStorage };
37
+ //#region ../insights/dist/server/eventRow.d.mts
38
+ //#region src/server/eventRow.d.ts
39
+ /** Where an update failed, and what failed; open sets, `unknown` for any other value. */
40
+ type BundleEventFailureStage = "check" | "download" | "install" | "unknown";
41
+ type BundleEventFailureReason = "network" | "http" | "invalid_response" | "hash_mismatch" | "signature" | "patch" | "extract" | "storage" | "unknown";
42
+ /** An `UPDATE_FAILED` report's failure, as stored. */
43
+ type BundleEventFailure = DatabaseJsonObject & {
44
+ readonly stage: BundleEventFailureStage;
45
+ readonly reason: BundleEventFailureReason;
46
+ /** What the client was fetching or writing. */
47
+ readonly resource?: "catalog" | "artifact" | "manifest" | "file" | "patch" | "archive" | "unknown";
48
+ readonly http_status?: number;
49
+ /** How the connection failed, when it did. */
50
+ readonly transport?: "timeout" | "dns" | "tls" | "connection" | "offline" | "cancelled" | "unknown";
51
+ /** The storage origin's error code, such as `ExpiredToken`. */
52
+ readonly origin_code?: string;
53
+ /** Android's `ApplicationExitInfo` reason for the process before this one. */
54
+ readonly previous_process_exit?: string;
55
+ };
56
+ /** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
57
+ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
58
+ readonly cohort: string;
59
+ readonly update_strategy: "fingerprint" | "appVersion" | null;
60
+ readonly fingerprint_hash: string | null;
61
+ readonly sdk_version: string | null;
62
+ /** `UPDATE_FAILED`: what failed. */
63
+ readonly failure?: BundleEventFailure;
64
+ /** `UPDATE_DOWNLOADED`: how the bundle arrived. */
65
+ readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
66
+ /** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
67
+ readonly patch_fallback?: boolean;
68
+ /** `RECOVERED`: Android's `ApplicationExitInfo` reason for the crashed process. */
69
+ readonly previous_process_exit?: string;
70
+ };
71
+ type BundleEventRowBase = {
72
+ readonly id: string;
73
+ readonly install_id: string;
74
+ readonly user_id: string | null;
75
+ readonly from_release_id: string | null;
76
+ readonly to_release_id: string | null;
77
+ readonly to_bundle_id: string;
78
+ readonly platform: Platform;
79
+ readonly app_version: string;
80
+ readonly channel: string;
81
+ readonly metadata: DatabaseBundleEventMetadata;
82
+ readonly received_at_ms: number;
83
+ };
84
+ type BundleEventRow = BundleEventRowBase & ({
85
+ readonly type: "UPDATE_DOWNLOADED";
86
+ readonly from_bundle_id: string;
87
+ } | {
88
+ readonly type: "UPDATE_APPLIED" | "RECOVERED";
89
+ readonly from_bundle_id: string;
90
+ } |
91
+ /** An update that failed: `from` is the running bundle, `to` the target (for a check, the running bundle). */
92
+ {
93
+ readonly type: "UPDATE_FAILED";
94
+ readonly from_bundle_id: string;
95
+ } | {
96
+ readonly type: "UNCHANGED";
97
+ readonly from_bundle_id: null;
98
+ });
99
+ //#endregion
100
+ //#region ../insights/dist/server/modelTypes.d.mts
101
+ //#region src/server/modelTypes.d.ts
102
+ interface InsightsEventCursor {
103
+ readonly receivedAtMs: number;
104
+ readonly id: string;
105
+ }
106
+ interface InsightsScope {
107
+ readonly platform: "ios" | "android";
108
+ readonly channel: string;
109
+ }
110
+ /**
111
+ * Raw event predicates; recovery is attributed to the source bundle. An
112
+ * UNCHANGED report is kept as no event, so no filter names it.
113
+ */
114
+ type InsightsBundleEventFilter = InsightsScope & ({
115
+ readonly type: "RECOVERED";
116
+ readonly fromBundleId: string;
117
+ } | {
118
+ readonly type: "UPDATE_DOWNLOADED" | "UPDATE_APPLIED" | "UPDATE_FAILED";
119
+ readonly toBundleId: string;
120
+ });
121
+ type InsightsEventFilter = {
122
+ readonly kind: "all";
123
+ } | {
124
+ readonly kind: "installationMovement";
125
+ readonly installId: string;
126
+ } | ({
127
+ readonly kind: "bundle";
128
+ } & InsightsBundleEventFilter);
129
+ interface InsightsListEventsInput {
130
+ readonly filter: InsightsEventFilter;
131
+ readonly sinceMs?: number;
132
+ readonly beforeReceivedAtMs: number;
133
+ readonly after?: InsightsEventCursor;
134
+ readonly limit: number;
135
+ }
136
+ type InsightsFindLatestEventsInput = {
137
+ readonly installId: string;
138
+ } | {
139
+ readonly userId: string;
140
+ readonly afterInstallId?: string;
141
+ readonly limit: number;
142
+ };
143
+ interface InsightsCountLatestEventsInput extends InsightsScope {
144
+ /** A UTC day's start: latest events are counted by the day they fall in. */
145
+ readonly sinceMs: number;
146
+ /** Optional OR of one or two fixed predicates; count a matching event once. */
147
+ readonly bundle?: readonly {
148
+ readonly field: "from_bundle_id" | "to_bundle_id";
149
+ readonly value: string;
150
+ readonly types: readonly BundleEventRow["type"][];
151
+ }[];
152
+ }
153
+ interface InsightsCountEventsInput {
154
+ readonly filter: InsightsBundleEventFilter;
155
+ readonly sinceMs: number;
156
+ readonly beforeReceivedAtMs: number;
157
+ }
158
+ interface ReleaseReference {
159
+ readonly releaseId: string;
160
+ readonly platform: "ios" | "android";
161
+ readonly channel: string;
162
+ }
163
+ interface InsightsTimeRange {
164
+ /** Inclusive UTC Unix timestamp in milliseconds. */
165
+ readonly start: number;
166
+ /** Exclusive UTC Unix timestamp in milliseconds. */
167
+ readonly end: number;
168
+ }
169
+ type InsightsCoverage = {
170
+ readonly kind: "complete";
171
+ readonly sinceMs: number;
172
+ } | {
173
+ readonly kind: "partial";
174
+ readonly sinceMs: number | null;
175
+ };
176
+ interface ReleaseActivityMetrics {
177
+ readonly downloads: number;
178
+ readonly launches: number;
179
+ readonly failedLaunches: number;
180
+ /** Omitted for lifetime-only bundle-row reads. */
181
+ readonly uniqueUsers?: number;
182
+ /** Daily points, present only for period reads. */
183
+ readonly series?: readonly {
184
+ readonly startMs: number;
185
+ readonly launches: number;
186
+ readonly failedLaunches: number;
187
+ }[];
188
+ }
189
+ type InsightsGetReleaseActivityInput = {
190
+ readonly releases: readonly ReleaseReference[];
191
+ readonly timeRange?: InsightsTimeRange;
192
+ readonly scope?: never;
193
+ } | {
194
+ readonly scope: InsightsScope;
195
+ readonly timeRange: InsightsTimeRange;
196
+ readonly releases?: never;
197
+ };
198
+ interface InsightsGetReleaseActivityResult {
199
+ readonly coverage: InsightsCoverage;
200
+ readonly data: readonly {
201
+ readonly release?: ReleaseReference;
202
+ readonly scope?: InsightsScope;
203
+ readonly metrics: ReleaseActivityMetrics;
204
+ }[];
205
+ readonly measuredAtMs: number;
206
+ }
207
+ interface InsightsGetAppUsageInput {
208
+ readonly channel: string;
209
+ readonly platform: "all" | "ios" | "android";
210
+ readonly appVersion?: string;
211
+ readonly timeRange: InsightsTimeRange;
212
+ readonly intervalMs: number;
213
+ }
214
+ interface InsightsGetAppUsageResult {
215
+ readonly coverage: InsightsCoverage;
216
+ readonly activeInstallations: number;
217
+ readonly points: readonly {
218
+ readonly startMs: number;
219
+ readonly installations: number;
220
+ }[];
221
+ readonly appVersions: readonly string[];
222
+ readonly versions: readonly {
223
+ readonly name: string;
224
+ readonly installations: number;
225
+ }[];
226
+ readonly platforms: readonly {
227
+ readonly name: string;
228
+ readonly installations: number;
229
+ }[];
230
+ readonly bundleDistribution: readonly {
231
+ readonly appVersion: string;
232
+ readonly platform: "ios" | "android";
233
+ readonly releaseId: string | null;
234
+ readonly installations: number;
235
+ }[];
236
+ readonly measuredAtMs: number;
237
+ }
238
+ //#endregion
239
+ //#region ../insights/dist/server/schema.d.mts
240
+ //#region src/server/schema.d.ts
241
+ /** How long Insights keeps its rows, in whole days. Lifetime counters are kept. */
242
+ interface InsightsRetention {
243
+ /** Raw events and hourly rollups. */
244
+ readonly rawDays: number;
245
+ /** Daily rollups, and each installation's latest event and the gauges that count it. */
246
+ readonly dailyDays: number;
247
+ }
248
+ //#endregion
249
+ //#region ../insights/dist/server/reads.d.mts
250
+ //#region src/server/reads.d.ts
251
+ interface InsightsUpdateFailuresInput {
252
+ readonly platform: "ios" | "android";
253
+ readonly channel: string;
254
+ /** A release's failures; without it, the channel's, which need a time range. */
255
+ readonly releaseId?: string;
256
+ /** Without it, a release's failures since its first report. */
257
+ readonly timeRange?: InsightsTimeRange;
258
+ }
259
+ /** Update failures of one stage and reason, and what else their clients knew. */
260
+ interface InsightsFailureBreakdown {
261
+ readonly stage: string;
262
+ readonly reason: string;
263
+ readonly events: number;
264
+ /** By resource, HTTP status, origin code, and transport, most first. */
265
+ readonly details: readonly {
266
+ readonly resource: string | null;
267
+ readonly httpStatus: number | null;
268
+ readonly originCode: string | null;
269
+ readonly transport: string | null;
270
+ readonly events: number;
271
+ }[];
272
+ }
273
+ interface InsightsUpdateFailures {
274
+ readonly coverage: InsightsCoverage;
275
+ readonly measuredAtMs: number;
276
+ /** Update failures other than failed checks: each client reports one at most once a UTC day. */
277
+ readonly failedUpdates: number;
278
+ /** Installations with such a failure, estimated. */
279
+ readonly failedInstallations: number;
280
+ /** Download reports: each installation reports a bundle's download once. */
281
+ readonly downloads: number;
282
+ /** Downloads a patch delivered, and those that fell back from a patch to files or the archive. */
283
+ readonly patchDownloads: number;
284
+ readonly patchFallbacks: number;
285
+ /** A channel's failed update checks, installations with one, and its active installations, estimated. */
286
+ readonly checks?: {
287
+ readonly failures: number;
288
+ readonly failedInstallations: number;
289
+ readonly activeInstallations: number;
290
+ };
291
+ /** Over a time range: failures by stage and reason, most first. */
292
+ readonly breakdown?: readonly InsightsFailureBreakdown[];
293
+ /**
294
+ * Over a time range: failed launches, and the recoveries whose crashed
295
+ * process exited for a reason Android 11+ reported, by reason, most first.
296
+ */
297
+ readonly recoveries?: {
298
+ readonly failedLaunches: number;
299
+ readonly byExitReason: readonly {
300
+ readonly exitReason: string;
301
+ readonly events: number;
302
+ }[];
303
+ };
304
+ }
305
+ //#endregion
306
+ //#region ../api-keys/dist/server/model.d.mts
307
+ //#region src/server/model.d.ts
308
+ interface ApiKeyRow {
309
+ readonly id: string;
310
+ readonly hash: string;
311
+ readonly name: string;
312
+ readonly prefix: string;
313
+ readonly role: "client";
314
+ readonly created_at_ms: number;
315
+ readonly revoked_at_ms: number | null;
316
+ }
317
+ //#endregion
318
+ //#region ../api-keys/dist/server/apiKeys.d.mts
319
+ type ApiKeyMetadata = Omit<ApiKeyRow, "hash">;
320
+ interface CreatedApiKey {
321
+ /** Plaintext credential. It cannot be recovered after this call returns. */
322
+ readonly apiKey: string;
323
+ /** Non-secret metadata. The persisted SHA-256 hash is never exposed. */
324
+ readonly record: ApiKeyMetadata;
325
+ }
326
+ //#endregion
327
+ //#region src/plugins.d.ts
328
+ /**
329
+ * The plugins the managed Firebase server runs: Insights, and API keys on every
330
+ * client route. Its Cloud Function imports this list.
331
+ */
332
+ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPlugin<"insights", {
333
+ readonly bundle_events: import("@hot-updater/plugin-core").TableDefinition<{
334
+ readonly id: {
335
+ readonly type: "string";
336
+ readonly maxLength: 36;
337
+ };
338
+ readonly type: {
339
+ readonly type: "string";
340
+ readonly maxLength: 32;
341
+ };
342
+ readonly install_id: {
343
+ readonly type: "string";
344
+ readonly maxLength: 255;
345
+ };
346
+ readonly user_id: {
347
+ readonly type: "string";
348
+ readonly maxLength: 255;
349
+ readonly required: false;
350
+ };
351
+ readonly from_release_id: {
352
+ readonly type: "string";
353
+ readonly maxLength: 36;
354
+ readonly required: false;
355
+ };
356
+ readonly from_bundle_id: {
357
+ readonly type: "string";
358
+ readonly maxLength: 36;
359
+ readonly required: false;
360
+ };
361
+ readonly to_release_id: {
362
+ readonly type: "string";
363
+ readonly maxLength: 36;
364
+ readonly required: false;
365
+ };
366
+ readonly to_bundle_id: {
367
+ readonly type: "string";
368
+ readonly maxLength: 36;
369
+ };
370
+ readonly platform: {
371
+ readonly type: "string";
372
+ readonly maxLength: 16;
373
+ };
374
+ readonly app_version: {
375
+ readonly type: "string";
376
+ };
377
+ readonly channel: {
378
+ readonly type: "string";
379
+ };
380
+ readonly metadata: {
381
+ readonly type: "json";
382
+ };
383
+ readonly received_at_ms: {
384
+ readonly type: "integer";
385
+ };
386
+ }, {
387
+ day: "integer";
388
+ movement_install_id: "string";
389
+ bundle_ref: "string";
390
+ }, {
391
+ readonly recent: {
392
+ readonly eq: readonly ["channel", "platform", "day"];
393
+ readonly sort: readonly ["received_at_ms"];
394
+ };
395
+ readonly movementsByInstall: {
396
+ readonly eq: readonly ["movement_install_id"];
397
+ readonly sort: readonly ["received_at_ms"];
398
+ };
399
+ readonly byBundle: {
400
+ readonly eq: readonly ["platform", "channel", "type", "bundle_ref", "day"];
401
+ readonly sort: readonly ["received_at_ms"];
402
+ };
403
+ readonly byDay: {
404
+ readonly eq: readonly ["day"];
405
+ readonly sort: readonly ["received_at_ms"];
406
+ };
407
+ }, readonly ["id"]>;
408
+ readonly bundle_event_heads: import("@hot-updater/plugin-core").TableDefinition<{
409
+ readonly install_id: {
410
+ readonly type: "string";
411
+ readonly maxLength: 255;
412
+ };
413
+ readonly id: {
414
+ readonly type: "string";
415
+ readonly maxLength: 36;
416
+ };
417
+ readonly type: {
418
+ readonly type: "string";
419
+ readonly maxLength: 32;
420
+ };
421
+ readonly user_id: {
422
+ readonly type: "string";
423
+ readonly maxLength: 255;
424
+ readonly required: false;
425
+ };
426
+ readonly from_release_id: {
427
+ readonly type: "string";
428
+ readonly maxLength: 36;
429
+ readonly required: false;
430
+ };
431
+ readonly from_bundle_id: {
432
+ readonly type: "string";
433
+ readonly maxLength: 36;
434
+ readonly required: false;
435
+ };
436
+ readonly to_release_id: {
437
+ readonly type: "string";
438
+ readonly maxLength: 36;
439
+ readonly required: false;
440
+ };
441
+ readonly to_bundle_id: {
442
+ readonly type: "string";
443
+ readonly maxLength: 36;
444
+ };
445
+ readonly platform: {
446
+ readonly type: "string";
447
+ readonly maxLength: 16;
448
+ };
449
+ readonly app_version: {
450
+ readonly type: "string";
451
+ };
452
+ readonly channel: {
453
+ readonly type: "string";
454
+ };
455
+ readonly metadata: {
456
+ readonly type: "json";
457
+ };
458
+ readonly received_at_ms: {
459
+ readonly type: "integer";
460
+ };
461
+ }, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {
462
+ readonly byUser: {
463
+ readonly eq: readonly ["user_id"];
464
+ readonly sort: readonly ["install_id"];
465
+ };
466
+ }, readonly ["install_id"]>;
467
+ readonly insights_overview: import("@hot-updater/plugin-core").AggregateDefinition<{
468
+ readonly identity: {
469
+ readonly type: "string";
470
+ readonly maxLength: 32;
471
+ };
472
+ readonly bucket_start_ms: {
473
+ readonly type: "integer";
474
+ };
475
+ }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
476
+ readonly window: {
477
+ readonly eq: readonly ["identity"];
478
+ readonly sort: readonly ["bucket_start_ms"];
479
+ };
480
+ }, never, readonly ["identity", "bucket_start_ms"]>;
481
+ readonly insights_sketches: import("@hot-updater/plugin-core").AggregateDefinition<{
482
+ readonly identity: {
483
+ readonly type: "string";
484
+ readonly maxLength: 32;
485
+ };
486
+ readonly bucket_start_ms: {
487
+ readonly type: "integer";
488
+ };
489
+ }, never, {
490
+ readonly window: {
491
+ readonly eq: readonly ["identity"];
492
+ readonly sort: readonly ["bucket_start_ms"];
493
+ };
494
+ }, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
495
+ readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
496
+ readonly identity: {
497
+ readonly type: "string";
498
+ readonly maxLength: 32;
499
+ };
500
+ readonly bucket_start_ms: {
501
+ readonly type: "integer";
502
+ };
503
+ }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
504
+ readonly window: {
505
+ readonly eq: readonly ["identity"];
506
+ readonly sort: readonly ["bucket_start_ms"];
507
+ };
508
+ }, never, readonly ["identity", "bucket_start_ms"]>;
509
+ readonly insights_sketches_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
510
+ readonly identity: {
511
+ readonly type: "string";
512
+ readonly maxLength: 32;
513
+ };
514
+ readonly bucket_start_ms: {
515
+ readonly type: "integer";
516
+ };
517
+ }, never, {
518
+ readonly window: {
519
+ readonly eq: readonly ["identity"];
520
+ readonly sort: readonly ["bucket_start_ms"];
521
+ };
522
+ }, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
523
+ readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
524
+ readonly identity: {
525
+ readonly type: "string";
526
+ readonly maxLength: 32;
527
+ };
528
+ readonly bucket_start_ms: {
529
+ readonly type: "integer";
530
+ };
531
+ }, "downloads" | "launches" | "failed_launches" | "failed_updates" | "patch_downloads" | "patch_fallbacks", {
532
+ readonly window: {
533
+ readonly eq: readonly ["identity"];
534
+ readonly sort: readonly ["bucket_start_ms"];
535
+ };
536
+ }, never, readonly ["identity", "bucket_start_ms"]>;
537
+ readonly insights_sketches_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
538
+ readonly identity: {
539
+ readonly type: "string";
540
+ readonly maxLength: 32;
541
+ };
542
+ readonly bucket_start_ms: {
543
+ readonly type: "integer";
544
+ };
545
+ }, never, {
546
+ readonly window: {
547
+ readonly eq: readonly ["identity"];
548
+ readonly sort: readonly ["bucket_start_ms"];
549
+ };
550
+ }, "failed_users", readonly ["identity", "bucket_start_ms"]>;
551
+ readonly insights_distribution: import("@hot-updater/plugin-core").AggregateDefinition<{
552
+ readonly channel: {
553
+ readonly type: "string";
554
+ };
555
+ readonly platform: {
556
+ readonly type: "string";
557
+ readonly maxLength: 16;
558
+ };
559
+ readonly app_version: {
560
+ readonly type: "string";
561
+ };
562
+ readonly release_id: {
563
+ readonly type: "string";
564
+ readonly maxLength: 36;
565
+ };
566
+ readonly bucket_start_ms: {
567
+ readonly type: "integer";
568
+ };
569
+ }, "latest_installations", {
570
+ readonly byScope: {
571
+ readonly eq: readonly ["channel", "platform"];
572
+ readonly sort: readonly ["bucket_start_ms"];
573
+ };
574
+ readonly byVersion: {
575
+ readonly eq: readonly ["channel", "platform", "app_version"];
576
+ readonly sort: readonly ["bucket_start_ms"];
577
+ };
578
+ }, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
579
+ readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
580
+ readonly platform: {
581
+ readonly type: "string";
582
+ readonly maxLength: 16;
583
+ };
584
+ readonly channel: {
585
+ readonly type: "string";
586
+ };
587
+ readonly bundle_field: {
588
+ readonly type: "string";
589
+ readonly maxLength: 16;
590
+ };
591
+ readonly bundle_id: {
592
+ readonly type: "string";
593
+ readonly maxLength: 36;
594
+ };
595
+ readonly type: {
596
+ readonly type: "string";
597
+ readonly maxLength: 32;
598
+ };
599
+ readonly bucket_start_ms: {
600
+ readonly type: "integer";
601
+ };
602
+ }, "installations", {
603
+ readonly byBundle: {
604
+ readonly eq: readonly ["platform", "channel", "bundle_field", "bundle_id", "type"];
605
+ readonly sort: readonly ["bucket_start_ms"];
606
+ };
607
+ }, never, readonly ["platform", "channel", "bundle_field", "bundle_id", "type", "bucket_start_ms"]>;
608
+ readonly insights_outcomes: import("@hot-updater/plugin-core").AggregateDefinition<{
609
+ readonly platform: {
610
+ readonly type: "string";
611
+ readonly maxLength: 16;
612
+ };
613
+ readonly channel: {
614
+ readonly type: "string";
615
+ };
616
+ readonly type: {
617
+ readonly type: "string";
618
+ readonly maxLength: 32;
619
+ };
620
+ readonly bundle_ref: {
621
+ readonly type: "string";
622
+ readonly maxLength: 41;
623
+ };
624
+ readonly bucket_start_ms: {
625
+ readonly type: "integer";
626
+ };
627
+ }, "events", {
628
+ readonly byRef: {
629
+ readonly eq: readonly ["platform", "channel", "type", "bundle_ref"];
630
+ readonly sort: readonly ["bucket_start_ms"];
631
+ };
632
+ }, never, readonly ["platform", "channel", "type", "bundle_ref", "bucket_start_ms"]>;
633
+ readonly insights_failures: import("@hot-updater/plugin-core").AggregateDefinition<{
634
+ readonly platform: {
635
+ readonly type: "string";
636
+ readonly maxLength: 16;
637
+ };
638
+ readonly channel: {
639
+ readonly type: "string";
640
+ };
641
+ readonly bucket_start_ms: {
642
+ readonly type: "integer";
643
+ };
644
+ readonly release_id: {
645
+ readonly type: "string";
646
+ readonly maxLength: 36;
647
+ };
648
+ readonly stage: {
649
+ readonly type: "string";
650
+ readonly maxLength: 16;
651
+ };
652
+ readonly reason: {
653
+ readonly type: "string";
654
+ readonly maxLength: 64;
655
+ };
656
+ readonly detail: {
657
+ readonly type: "string";
658
+ readonly maxLength: 160;
659
+ };
660
+ }, "events", {
661
+ readonly byScope: {
662
+ readonly eq: readonly ["platform", "channel"];
663
+ readonly sort: readonly ["bucket_start_ms"];
664
+ };
665
+ }, never, readonly ["platform", "channel", "bucket_start_ms", "release_id", "stage", "reason", "detail"]>;
666
+ }, {
667
+ api: {
668
+ retention: InsightsRetention;
669
+ recordEvent: (event: BundleEventRow) => Promise<void>;
670
+ listEvents: (input: InsightsListEventsInput) => Promise<readonly BundleEventRow[]>;
671
+ findLatestEvents: (input: InsightsFindLatestEventsInput) => Promise<readonly BundleEventRow[]>;
672
+ countLatestEvents: (input: InsightsCountLatestEventsInput) => Promise<number>;
673
+ countEvents: (input: InsightsCountEventsInput) => Promise<number>;
674
+ getReleaseActivity: (input: InsightsGetReleaseActivityInput) => Promise<InsightsGetReleaseActivityResult>;
675
+ getAppUsage: (input: InsightsGetAppUsageInput) => Promise<InsightsGetAppUsageResult>;
676
+ getUpdateFailures: (input: InsightsUpdateFailuresInput) => Promise<InsightsUpdateFailures>;
677
+ };
678
+ endpoints: import("@hot-updater/plugin-core").PluginEndpoint[];
679
+ }, {}>, import("@hot-updater/plugin-core").HotUpdaterPlugin<"apiKeys", {
680
+ readonly api_keys: import("@hot-updater/plugin-core").TableDefinition<{
681
+ readonly id: {
682
+ readonly type: "string";
683
+ readonly maxLength: 255;
684
+ };
685
+ readonly hash: {
686
+ readonly type: "string";
687
+ readonly maxLength: 64;
688
+ readonly unique: true;
689
+ };
690
+ readonly name: {
691
+ readonly type: "string";
692
+ readonly maxLength: 64;
693
+ };
694
+ readonly prefix: {
695
+ readonly type: "string";
696
+ readonly maxLength: 16;
697
+ };
698
+ readonly role: {
699
+ readonly type: "string";
700
+ readonly maxLength: 16;
701
+ };
702
+ readonly created_at_ms: {
703
+ readonly type: "integer";
704
+ };
705
+ readonly revoked_at_ms: {
706
+ readonly type: "integer";
707
+ readonly required: false;
708
+ };
709
+ }, {}, {
710
+ readonly byCreated: {
711
+ readonly eq: readonly [];
712
+ readonly sort: readonly ["created_at_ms"];
713
+ };
714
+ }, readonly ["id"]>;
715
+ }, {
716
+ api: {
717
+ register: (input: {
718
+ readonly apiKey: string;
719
+ readonly name: string;
720
+ readonly createdAtMs?: number;
721
+ }) => Promise<CreatedApiKey>;
722
+ provision: (input: {
723
+ readonly existingApiKey?: string;
724
+ readonly name: string;
725
+ }) => Promise<CreatedApiKey>;
726
+ create(input: {
727
+ readonly name: string;
728
+ }): Promise<{
729
+ readonly apiKey: string;
730
+ readonly record: ApiKeyMetadata;
731
+ }>;
732
+ list(): Promise<readonly ApiKeyMetadata[]>;
733
+ revoke(input: {
734
+ readonly id: string;
735
+ }): Promise<ApiKeyMetadata | null>;
736
+ };
737
+ clientAuth: {
738
+ varyHeaders: string[];
739
+ authenticate: (headers: Headers) => Promise<boolean>;
740
+ };
741
+ }, {
742
+ readonly clientAuth: true;
743
+ }>];
744
+ //#endregion
745
+ export { FirebaseDatabaseConfig, FirebaseStorageConfig, firebaseDatabase, firebaseStorage, migrateFirebaseDatabase, plugins };