@hot-updater/firebase 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.
- package/dist/firebase/functions/index.cjs +4776 -4584
- package/dist/index.cjs +5 -6
- package/dist/index.d.cts +323 -34
- package/dist/index.d.mts +323 -34
- package/dist/index.mjs +2 -3
- package/dist/init/index.cjs +7799 -2
- package/dist/init/index.d.cts +42 -3
- package/dist/init/index.d.mts +42 -3
- package/dist/init/index.mjs +7792 -1
- package/package.json +7 -12
- package/dist/iac/index.cjs +0 -7829
- package/dist/iac/index.d.cts +0 -42
- package/dist/iac/index.d.mts +0 -42
- package/dist/iac/index.mjs +0 -7821
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { PluginTables } from "@hot-updater/
|
|
1
|
+
import { DatabaseJsonObject, EngineDatabase, Platform, PluginTables, StorageAdapterWith } from "@hot-updater/plugin-core";
|
|
2
2
|
import { AppOptions } from "firebase-admin/app";
|
|
3
|
-
import { EngineDatabase, StoragePluginWith } from "@hot-updater/plugin-core";
|
|
4
3
|
//#region src/firebaseDatabase.d.ts
|
|
5
4
|
type FirebaseDatabaseConfig = AppOptions & {
|
|
6
5
|
/** The one collection the database keeps its items in. */
|
|
@@ -33,15 +32,305 @@ interface FirebaseStorageConfig extends AppOptions {
|
|
|
33
32
|
/** Firebase signed URL lifetime in seconds. @default 3600 */
|
|
34
33
|
signedUrlExpiresIn?: number;
|
|
35
34
|
}
|
|
36
|
-
declare const firebaseStorage: (config: FirebaseStorageConfig) =>
|
|
35
|
+
declare const firebaseStorage: (config: FirebaseStorageConfig) => StorageAdapterWith<"put" | "get" | "getDownloadUrl" | "exists" | "delete">;
|
|
36
|
+
//#endregion
|
|
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
|
+
}
|
|
37
326
|
//#endregion
|
|
38
327
|
//#region src/plugins.d.ts
|
|
39
328
|
/**
|
|
40
329
|
* The plugins the managed Firebase server runs: Insights, and API keys on every
|
|
41
330
|
* client route. Its Cloud Function imports this list.
|
|
42
331
|
*/
|
|
43
|
-
declare const plugins: readonly [import("@hot-updater/
|
|
44
|
-
readonly bundle_events: import("@hot-updater/
|
|
332
|
+
declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPlugin<"insights", {
|
|
333
|
+
readonly bundle_events: import("@hot-updater/plugin-core").TableDefinition<{
|
|
45
334
|
readonly id: {
|
|
46
335
|
readonly type: "string";
|
|
47
336
|
readonly maxLength: 36;
|
|
@@ -116,7 +405,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
116
405
|
readonly sort: readonly ["received_at_ms"];
|
|
117
406
|
};
|
|
118
407
|
}, readonly ["id"]>;
|
|
119
|
-
readonly bundle_event_heads: import("@hot-updater/
|
|
408
|
+
readonly bundle_event_heads: import("@hot-updater/plugin-core").TableDefinition<{
|
|
120
409
|
readonly install_id: {
|
|
121
410
|
readonly type: "string";
|
|
122
411
|
readonly maxLength: 255;
|
|
@@ -169,13 +458,13 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
169
458
|
readonly received_at_ms: {
|
|
170
459
|
readonly type: "integer";
|
|
171
460
|
};
|
|
172
|
-
}, Readonly<Record<string, import("@hot-updater/
|
|
461
|
+
}, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {
|
|
173
462
|
readonly byUser: {
|
|
174
463
|
readonly eq: readonly ["user_id"];
|
|
175
464
|
readonly sort: readonly ["install_id"];
|
|
176
465
|
};
|
|
177
466
|
}, readonly ["install_id"]>;
|
|
178
|
-
readonly insights_overview: import("@hot-updater/
|
|
467
|
+
readonly insights_overview: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
179
468
|
readonly identity: {
|
|
180
469
|
readonly type: "string";
|
|
181
470
|
readonly maxLength: 32;
|
|
@@ -189,7 +478,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
189
478
|
readonly sort: readonly ["bucket_start_ms"];
|
|
190
479
|
};
|
|
191
480
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
192
|
-
readonly insights_sketches: import("@hot-updater/
|
|
481
|
+
readonly insights_sketches: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
193
482
|
readonly identity: {
|
|
194
483
|
readonly type: "string";
|
|
195
484
|
readonly maxLength: 32;
|
|
@@ -203,7 +492,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
203
492
|
readonly sort: readonly ["bucket_start_ms"];
|
|
204
493
|
};
|
|
205
494
|
}, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
206
|
-
readonly insights_overview_daily: import("@hot-updater/
|
|
495
|
+
readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
207
496
|
readonly identity: {
|
|
208
497
|
readonly type: "string";
|
|
209
498
|
readonly maxLength: 32;
|
|
@@ -217,7 +506,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
217
506
|
readonly sort: readonly ["bucket_start_ms"];
|
|
218
507
|
};
|
|
219
508
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
220
|
-
readonly insights_sketches_daily: import("@hot-updater/
|
|
509
|
+
readonly insights_sketches_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
221
510
|
readonly identity: {
|
|
222
511
|
readonly type: "string";
|
|
223
512
|
readonly maxLength: 32;
|
|
@@ -231,7 +520,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
231
520
|
readonly sort: readonly ["bucket_start_ms"];
|
|
232
521
|
};
|
|
233
522
|
}, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
234
|
-
readonly insights_overview_lifetime: import("@hot-updater/
|
|
523
|
+
readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
235
524
|
readonly identity: {
|
|
236
525
|
readonly type: "string";
|
|
237
526
|
readonly maxLength: 32;
|
|
@@ -245,7 +534,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
245
534
|
readonly sort: readonly ["bucket_start_ms"];
|
|
246
535
|
};
|
|
247
536
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
248
|
-
readonly insights_sketches_lifetime: import("@hot-updater/
|
|
537
|
+
readonly insights_sketches_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
249
538
|
readonly identity: {
|
|
250
539
|
readonly type: "string";
|
|
251
540
|
readonly maxLength: 32;
|
|
@@ -259,7 +548,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
259
548
|
readonly sort: readonly ["bucket_start_ms"];
|
|
260
549
|
};
|
|
261
550
|
}, "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
262
|
-
readonly insights_distribution: import("@hot-updater/
|
|
551
|
+
readonly insights_distribution: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
263
552
|
readonly channel: {
|
|
264
553
|
readonly type: "string";
|
|
265
554
|
};
|
|
@@ -287,7 +576,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
287
576
|
readonly sort: readonly ["bucket_start_ms"];
|
|
288
577
|
};
|
|
289
578
|
}, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
|
|
290
|
-
readonly insights_latest_by_bundle: import("@hot-updater/
|
|
579
|
+
readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
291
580
|
readonly platform: {
|
|
292
581
|
readonly type: "string";
|
|
293
582
|
readonly maxLength: 16;
|
|
@@ -316,7 +605,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
316
605
|
readonly sort: readonly ["bucket_start_ms"];
|
|
317
606
|
};
|
|
318
607
|
}, never, readonly ["platform", "channel", "bundle_field", "bundle_id", "type", "bucket_start_ms"]>;
|
|
319
|
-
readonly insights_outcomes: import("@hot-updater/
|
|
608
|
+
readonly insights_outcomes: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
320
609
|
readonly platform: {
|
|
321
610
|
readonly type: "string";
|
|
322
611
|
readonly maxLength: 16;
|
|
@@ -341,7 +630,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
341
630
|
readonly sort: readonly ["bucket_start_ms"];
|
|
342
631
|
};
|
|
343
632
|
}, never, readonly ["platform", "channel", "type", "bundle_ref", "bucket_start_ms"]>;
|
|
344
|
-
readonly insights_failures: import("@hot-updater/
|
|
633
|
+
readonly insights_failures: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
345
634
|
readonly platform: {
|
|
346
635
|
readonly type: "string";
|
|
347
636
|
readonly maxLength: 16;
|
|
@@ -376,19 +665,19 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
376
665
|
}, never, readonly ["platform", "channel", "bucket_start_ms", "release_id", "stage", "reason", "detail"]>;
|
|
377
666
|
}, {
|
|
378
667
|
api: {
|
|
379
|
-
retention:
|
|
380
|
-
recordEvent: (event:
|
|
381
|
-
listEvents: (input:
|
|
382
|
-
findLatestEvents: (input:
|
|
383
|
-
countLatestEvents: (input:
|
|
384
|
-
countEvents: (input:
|
|
385
|
-
getReleaseActivity: (input:
|
|
386
|
-
getAppUsage: (input:
|
|
387
|
-
getUpdateFailures: (input:
|
|
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>;
|
|
388
677
|
};
|
|
389
|
-
endpoints: import("@hot-updater/
|
|
390
|
-
}, {}>, import("@hot-updater/
|
|
391
|
-
readonly api_keys: import("@hot-updater/
|
|
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<{
|
|
392
681
|
readonly id: {
|
|
393
682
|
readonly type: "string";
|
|
394
683
|
readonly maxLength: 255;
|
|
@@ -429,21 +718,21 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
429
718
|
readonly apiKey: string;
|
|
430
719
|
readonly name: string;
|
|
431
720
|
readonly createdAtMs?: number;
|
|
432
|
-
}) => Promise<
|
|
721
|
+
}) => Promise<CreatedApiKey>;
|
|
433
722
|
provision: (input: {
|
|
434
723
|
readonly existingApiKey?: string;
|
|
435
724
|
readonly name: string;
|
|
436
|
-
}) => Promise<
|
|
725
|
+
}) => Promise<CreatedApiKey>;
|
|
437
726
|
create(input: {
|
|
438
727
|
readonly name: string;
|
|
439
728
|
}): Promise<{
|
|
440
729
|
readonly apiKey: string;
|
|
441
|
-
readonly record:
|
|
730
|
+
readonly record: ApiKeyMetadata;
|
|
442
731
|
}>;
|
|
443
|
-
list(): Promise<readonly
|
|
732
|
+
list(): Promise<readonly ApiKeyMetadata[]>;
|
|
444
733
|
revoke(input: {
|
|
445
734
|
readonly id: string;
|
|
446
|
-
}): Promise<
|
|
735
|
+
}): Promise<ApiKeyMetadata | null>;
|
|
447
736
|
};
|
|
448
737
|
clientAuth: {
|
|
449
738
|
varyHeaders: string[];
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { createEngineDatabase, createKvAdapter, migrateCoreSchema } from "@hot-updater/
|
|
1
|
+
import { createEngineDatabase, createKvAdapter, createStorageAdapter, createStorageKeyBuilder, createStorageUri, migrateCoreSchema, parseStorageUri } from "@hot-updater/plugin-core";
|
|
2
2
|
import { getApp, getApps, initializeApp } from "firebase-admin/app";
|
|
3
3
|
import { FieldPath, FieldValue, Timestamp, getFirestore } from "firebase-admin/firestore";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
-
import { createStorageKeyBuilder, createStoragePlugin, createStorageUri, parseStorageUri } from "@hot-updater/plugin-core";
|
|
6
5
|
import { getStorage } from "firebase-admin/storage";
|
|
7
6
|
import { apiKeys } from "@hot-updater/server/plugins/api-keys";
|
|
8
7
|
import { insights } from "@hot-updater/server/plugins/insights";
|
|
@@ -201,7 +200,7 @@ const firebaseStorage = (config) => {
|
|
|
201
200
|
if (parsed.bucket !== config.storageBucket) throw new Error(`Bucket name mismatch: expected "${config.storageBucket}", but found "${parsed.bucket}".`);
|
|
202
201
|
return parsed;
|
|
203
202
|
};
|
|
204
|
-
return
|
|
203
|
+
return createStorageAdapter({
|
|
205
204
|
name: "firebaseStorage",
|
|
206
205
|
protocol: "gs",
|
|
207
206
|
async put({ key, body, contentType }) {
|