@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.
- package/dist/index.cjs +7 -9
- package/dist/index.d.cts +323 -35
- package/dist/index.d.mts +323 -35
- package/dist/index.mjs +2 -4
- package/dist/init/index.cjs +11768 -0
- package/dist/init/index.d.cts +5 -1
- package/dist/init/index.d.mts +5 -1
- package/dist/init/index.mjs +11761 -1
- package/dist/worker/index.cjs +4 -5
- package/dist/worker/index.d.cts +323 -35
- package/dist/worker/index.d.mts +323 -35
- package/dist/worker/index.mjs +2 -3
- package/package.json +8 -11
- package/src/d1Database.ts +5 -2
- package/src/d1Executor.ts +2 -2
- package/src/d1Schema.ts +3 -2
- package/src/r2S3Storage.ts +4 -4
- package/src/r2Storage.ts +2 -2
- package/src/r2WorkerStorage.ts +4 -4
- package/worker/dist/README.md +1 -1
- package/worker/dist/index.js +4804 -4720
- package/worker/dist/index.js.map +4 -4
- package/dist/iac/index.cjs +0 -11838
- package/dist/iac/index.d.cts +0 -5
- package/dist/iac/index.d.mts +0 -5
- package/dist/iac/index.mjs +0 -11830
- package/src/d1Database.spec.ts +0 -190
- package/src/d1Schema.spec.ts +0 -89
- package/src/d1TestDatabase.ts +0 -38
- package/src/r2Storage.spec.ts +0 -346
- package/src/r2WorkerStorage.spec.ts +0 -184
- package/src/utils/createWrangler.spec.ts +0 -75
- package/src/worker/d1Database.spec.ts +0 -59
- package/worker/src/d1.conformance.integration.spec.ts +0 -53
- package/worker/src/d1.readBudgets.integration.spec.ts +0 -85
- package/worker/src/databaseMigration.integration.spec.ts +0 -101
- package/worker/src/databasePlugins.integration.spec.ts +0 -318
- package/worker/src/index.integration.spec.ts +0 -182
- package/worker/src/readPlans.integration.spec.ts +0 -89
- package/worker/src/storagePlugin.integration.spec.ts +0 -59
- package/worker/src/testWorker.ts +0 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import "@hot-updater/
|
|
2
|
-
import { ToolingDatabase } from "@hot-updater/server/db";
|
|
1
|
+
import { DatabaseJsonObject, Platform, StorageAdapterWith, ToolingDatabase } from "@hot-updater/plugin-core";
|
|
3
2
|
import { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
4
|
-
import { StoragePluginWith } from "@hot-updater/plugin-core";
|
|
5
3
|
//#region src/d1Executor.d.ts
|
|
6
4
|
declare class D1ExecutionError extends Error {
|
|
7
5
|
readonly name = "D1ExecutionError";
|
|
@@ -35,15 +33,305 @@ interface R2S3StorageConfig extends S3ClientConfig {
|
|
|
35
33
|
//#endregion
|
|
36
34
|
//#region src/r2Storage.d.ts
|
|
37
35
|
type R2StorageConfig = R2S3StorageConfig;
|
|
38
|
-
declare const r2Storage: (config: R2S3StorageConfig) =>
|
|
36
|
+
declare const r2Storage: (config: R2S3StorageConfig) => StorageAdapterWith<"put" | "get" | "exists" | "delete">;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region ../insights/dist/server/eventRow.d.mts
|
|
39
|
+
//#region src/server/eventRow.d.ts
|
|
40
|
+
/** Where an update failed, and what failed; open sets, `unknown` for any other value. */
|
|
41
|
+
type BundleEventFailureStage = "check" | "download" | "install" | "unknown";
|
|
42
|
+
type BundleEventFailureReason = "network" | "http" | "invalid_response" | "hash_mismatch" | "signature" | "patch" | "extract" | "storage" | "unknown";
|
|
43
|
+
/** An `UPDATE_FAILED` report's failure, as stored. */
|
|
44
|
+
type BundleEventFailure = DatabaseJsonObject & {
|
|
45
|
+
readonly stage: BundleEventFailureStage;
|
|
46
|
+
readonly reason: BundleEventFailureReason;
|
|
47
|
+
/** What the client was fetching or writing. */
|
|
48
|
+
readonly resource?: "catalog" | "artifact" | "manifest" | "file" | "patch" | "archive" | "unknown";
|
|
49
|
+
readonly http_status?: number;
|
|
50
|
+
/** How the connection failed, when it did. */
|
|
51
|
+
readonly transport?: "timeout" | "dns" | "tls" | "connection" | "offline" | "cancelled" | "unknown";
|
|
52
|
+
/** The storage origin's error code, such as `ExpiredToken`. */
|
|
53
|
+
readonly origin_code?: string;
|
|
54
|
+
/** Android's `ApplicationExitInfo` reason for the process before this one. */
|
|
55
|
+
readonly previous_process_exit?: string;
|
|
56
|
+
};
|
|
57
|
+
/** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
|
|
58
|
+
type DatabaseBundleEventMetadata = DatabaseJsonObject & {
|
|
59
|
+
readonly cohort: string;
|
|
60
|
+
readonly update_strategy: "fingerprint" | "appVersion" | null;
|
|
61
|
+
readonly fingerprint_hash: string | null;
|
|
62
|
+
readonly sdk_version: string | null;
|
|
63
|
+
/** `UPDATE_FAILED`: what failed. */
|
|
64
|
+
readonly failure?: BundleEventFailure;
|
|
65
|
+
/** `UPDATE_DOWNLOADED`: how the bundle arrived. */
|
|
66
|
+
readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
|
|
67
|
+
/** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
|
|
68
|
+
readonly patch_fallback?: boolean;
|
|
69
|
+
/** `RECOVERED`: Android's `ApplicationExitInfo` reason for the crashed process. */
|
|
70
|
+
readonly previous_process_exit?: string;
|
|
71
|
+
};
|
|
72
|
+
type BundleEventRowBase = {
|
|
73
|
+
readonly id: string;
|
|
74
|
+
readonly install_id: string;
|
|
75
|
+
readonly user_id: string | null;
|
|
76
|
+
readonly from_release_id: string | null;
|
|
77
|
+
readonly to_release_id: string | null;
|
|
78
|
+
readonly to_bundle_id: string;
|
|
79
|
+
readonly platform: Platform;
|
|
80
|
+
readonly app_version: string;
|
|
81
|
+
readonly channel: string;
|
|
82
|
+
readonly metadata: DatabaseBundleEventMetadata;
|
|
83
|
+
readonly received_at_ms: number;
|
|
84
|
+
};
|
|
85
|
+
type BundleEventRow = BundleEventRowBase & ({
|
|
86
|
+
readonly type: "UPDATE_DOWNLOADED";
|
|
87
|
+
readonly from_bundle_id: string;
|
|
88
|
+
} | {
|
|
89
|
+
readonly type: "UPDATE_APPLIED" | "RECOVERED";
|
|
90
|
+
readonly from_bundle_id: string;
|
|
91
|
+
} |
|
|
92
|
+
/** An update that failed: `from` is the running bundle, `to` the target (for a check, the running bundle). */
|
|
93
|
+
{
|
|
94
|
+
readonly type: "UPDATE_FAILED";
|
|
95
|
+
readonly from_bundle_id: string;
|
|
96
|
+
} | {
|
|
97
|
+
readonly type: "UNCHANGED";
|
|
98
|
+
readonly from_bundle_id: null;
|
|
99
|
+
});
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region ../insights/dist/server/modelTypes.d.mts
|
|
102
|
+
//#region src/server/modelTypes.d.ts
|
|
103
|
+
interface InsightsEventCursor {
|
|
104
|
+
readonly receivedAtMs: number;
|
|
105
|
+
readonly id: string;
|
|
106
|
+
}
|
|
107
|
+
interface InsightsScope {
|
|
108
|
+
readonly platform: "ios" | "android";
|
|
109
|
+
readonly channel: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Raw event predicates; recovery is attributed to the source bundle. An
|
|
113
|
+
* UNCHANGED report is kept as no event, so no filter names it.
|
|
114
|
+
*/
|
|
115
|
+
type InsightsBundleEventFilter = InsightsScope & ({
|
|
116
|
+
readonly type: "RECOVERED";
|
|
117
|
+
readonly fromBundleId: string;
|
|
118
|
+
} | {
|
|
119
|
+
readonly type: "UPDATE_DOWNLOADED" | "UPDATE_APPLIED" | "UPDATE_FAILED";
|
|
120
|
+
readonly toBundleId: string;
|
|
121
|
+
});
|
|
122
|
+
type InsightsEventFilter = {
|
|
123
|
+
readonly kind: "all";
|
|
124
|
+
} | {
|
|
125
|
+
readonly kind: "installationMovement";
|
|
126
|
+
readonly installId: string;
|
|
127
|
+
} | ({
|
|
128
|
+
readonly kind: "bundle";
|
|
129
|
+
} & InsightsBundleEventFilter);
|
|
130
|
+
interface InsightsListEventsInput {
|
|
131
|
+
readonly filter: InsightsEventFilter;
|
|
132
|
+
readonly sinceMs?: number;
|
|
133
|
+
readonly beforeReceivedAtMs: number;
|
|
134
|
+
readonly after?: InsightsEventCursor;
|
|
135
|
+
readonly limit: number;
|
|
136
|
+
}
|
|
137
|
+
type InsightsFindLatestEventsInput = {
|
|
138
|
+
readonly installId: string;
|
|
139
|
+
} | {
|
|
140
|
+
readonly userId: string;
|
|
141
|
+
readonly afterInstallId?: string;
|
|
142
|
+
readonly limit: number;
|
|
143
|
+
};
|
|
144
|
+
interface InsightsCountLatestEventsInput extends InsightsScope {
|
|
145
|
+
/** A UTC day's start: latest events are counted by the day they fall in. */
|
|
146
|
+
readonly sinceMs: number;
|
|
147
|
+
/** Optional OR of one or two fixed predicates; count a matching event once. */
|
|
148
|
+
readonly bundle?: readonly {
|
|
149
|
+
readonly field: "from_bundle_id" | "to_bundle_id";
|
|
150
|
+
readonly value: string;
|
|
151
|
+
readonly types: readonly BundleEventRow["type"][];
|
|
152
|
+
}[];
|
|
153
|
+
}
|
|
154
|
+
interface InsightsCountEventsInput {
|
|
155
|
+
readonly filter: InsightsBundleEventFilter;
|
|
156
|
+
readonly sinceMs: number;
|
|
157
|
+
readonly beforeReceivedAtMs: number;
|
|
158
|
+
}
|
|
159
|
+
interface ReleaseReference {
|
|
160
|
+
readonly releaseId: string;
|
|
161
|
+
readonly platform: "ios" | "android";
|
|
162
|
+
readonly channel: string;
|
|
163
|
+
}
|
|
164
|
+
interface InsightsTimeRange {
|
|
165
|
+
/** Inclusive UTC Unix timestamp in milliseconds. */
|
|
166
|
+
readonly start: number;
|
|
167
|
+
/** Exclusive UTC Unix timestamp in milliseconds. */
|
|
168
|
+
readonly end: number;
|
|
169
|
+
}
|
|
170
|
+
type InsightsCoverage = {
|
|
171
|
+
readonly kind: "complete";
|
|
172
|
+
readonly sinceMs: number;
|
|
173
|
+
} | {
|
|
174
|
+
readonly kind: "partial";
|
|
175
|
+
readonly sinceMs: number | null;
|
|
176
|
+
};
|
|
177
|
+
interface ReleaseActivityMetrics {
|
|
178
|
+
readonly downloads: number;
|
|
179
|
+
readonly launches: number;
|
|
180
|
+
readonly failedLaunches: number;
|
|
181
|
+
/** Omitted for lifetime-only bundle-row reads. */
|
|
182
|
+
readonly uniqueUsers?: number;
|
|
183
|
+
/** Daily points, present only for period reads. */
|
|
184
|
+
readonly series?: readonly {
|
|
185
|
+
readonly startMs: number;
|
|
186
|
+
readonly launches: number;
|
|
187
|
+
readonly failedLaunches: number;
|
|
188
|
+
}[];
|
|
189
|
+
}
|
|
190
|
+
type InsightsGetReleaseActivityInput = {
|
|
191
|
+
readonly releases: readonly ReleaseReference[];
|
|
192
|
+
readonly timeRange?: InsightsTimeRange;
|
|
193
|
+
readonly scope?: never;
|
|
194
|
+
} | {
|
|
195
|
+
readonly scope: InsightsScope;
|
|
196
|
+
readonly timeRange: InsightsTimeRange;
|
|
197
|
+
readonly releases?: never;
|
|
198
|
+
};
|
|
199
|
+
interface InsightsGetReleaseActivityResult {
|
|
200
|
+
readonly coverage: InsightsCoverage;
|
|
201
|
+
readonly data: readonly {
|
|
202
|
+
readonly release?: ReleaseReference;
|
|
203
|
+
readonly scope?: InsightsScope;
|
|
204
|
+
readonly metrics: ReleaseActivityMetrics;
|
|
205
|
+
}[];
|
|
206
|
+
readonly measuredAtMs: number;
|
|
207
|
+
}
|
|
208
|
+
interface InsightsGetAppUsageInput {
|
|
209
|
+
readonly channel: string;
|
|
210
|
+
readonly platform: "all" | "ios" | "android";
|
|
211
|
+
readonly appVersion?: string;
|
|
212
|
+
readonly timeRange: InsightsTimeRange;
|
|
213
|
+
readonly intervalMs: number;
|
|
214
|
+
}
|
|
215
|
+
interface InsightsGetAppUsageResult {
|
|
216
|
+
readonly coverage: InsightsCoverage;
|
|
217
|
+
readonly activeInstallations: number;
|
|
218
|
+
readonly points: readonly {
|
|
219
|
+
readonly startMs: number;
|
|
220
|
+
readonly installations: number;
|
|
221
|
+
}[];
|
|
222
|
+
readonly appVersions: readonly string[];
|
|
223
|
+
readonly versions: readonly {
|
|
224
|
+
readonly name: string;
|
|
225
|
+
readonly installations: number;
|
|
226
|
+
}[];
|
|
227
|
+
readonly platforms: readonly {
|
|
228
|
+
readonly name: string;
|
|
229
|
+
readonly installations: number;
|
|
230
|
+
}[];
|
|
231
|
+
readonly bundleDistribution: readonly {
|
|
232
|
+
readonly appVersion: string;
|
|
233
|
+
readonly platform: "ios" | "android";
|
|
234
|
+
readonly releaseId: string | null;
|
|
235
|
+
readonly installations: number;
|
|
236
|
+
}[];
|
|
237
|
+
readonly measuredAtMs: number;
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region ../insights/dist/server/schema.d.mts
|
|
241
|
+
//#region src/server/schema.d.ts
|
|
242
|
+
/** How long Insights keeps its rows, in whole days. Lifetime counters are kept. */
|
|
243
|
+
interface InsightsRetention {
|
|
244
|
+
/** Raw events and hourly rollups. */
|
|
245
|
+
readonly rawDays: number;
|
|
246
|
+
/** Daily rollups, and each installation's latest event and the gauges that count it. */
|
|
247
|
+
readonly dailyDays: number;
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region ../insights/dist/server/reads.d.mts
|
|
251
|
+
//#region src/server/reads.d.ts
|
|
252
|
+
interface InsightsUpdateFailuresInput {
|
|
253
|
+
readonly platform: "ios" | "android";
|
|
254
|
+
readonly channel: string;
|
|
255
|
+
/** A release's failures; without it, the channel's, which need a time range. */
|
|
256
|
+
readonly releaseId?: string;
|
|
257
|
+
/** Without it, a release's failures since its first report. */
|
|
258
|
+
readonly timeRange?: InsightsTimeRange;
|
|
259
|
+
}
|
|
260
|
+
/** Update failures of one stage and reason, and what else their clients knew. */
|
|
261
|
+
interface InsightsFailureBreakdown {
|
|
262
|
+
readonly stage: string;
|
|
263
|
+
readonly reason: string;
|
|
264
|
+
readonly events: number;
|
|
265
|
+
/** By resource, HTTP status, origin code, and transport, most first. */
|
|
266
|
+
readonly details: readonly {
|
|
267
|
+
readonly resource: string | null;
|
|
268
|
+
readonly httpStatus: number | null;
|
|
269
|
+
readonly originCode: string | null;
|
|
270
|
+
readonly transport: string | null;
|
|
271
|
+
readonly events: number;
|
|
272
|
+
}[];
|
|
273
|
+
}
|
|
274
|
+
interface InsightsUpdateFailures {
|
|
275
|
+
readonly coverage: InsightsCoverage;
|
|
276
|
+
readonly measuredAtMs: number;
|
|
277
|
+
/** Update failures other than failed checks: each client reports one at most once a UTC day. */
|
|
278
|
+
readonly failedUpdates: number;
|
|
279
|
+
/** Installations with such a failure, estimated. */
|
|
280
|
+
readonly failedInstallations: number;
|
|
281
|
+
/** Download reports: each installation reports a bundle's download once. */
|
|
282
|
+
readonly downloads: number;
|
|
283
|
+
/** Downloads a patch delivered, and those that fell back from a patch to files or the archive. */
|
|
284
|
+
readonly patchDownloads: number;
|
|
285
|
+
readonly patchFallbacks: number;
|
|
286
|
+
/** A channel's failed update checks, installations with one, and its active installations, estimated. */
|
|
287
|
+
readonly checks?: {
|
|
288
|
+
readonly failures: number;
|
|
289
|
+
readonly failedInstallations: number;
|
|
290
|
+
readonly activeInstallations: number;
|
|
291
|
+
};
|
|
292
|
+
/** Over a time range: failures by stage and reason, most first. */
|
|
293
|
+
readonly breakdown?: readonly InsightsFailureBreakdown[];
|
|
294
|
+
/**
|
|
295
|
+
* Over a time range: failed launches, and the recoveries whose crashed
|
|
296
|
+
* process exited for a reason Android 11+ reported, by reason, most first.
|
|
297
|
+
*/
|
|
298
|
+
readonly recoveries?: {
|
|
299
|
+
readonly failedLaunches: number;
|
|
300
|
+
readonly byExitReason: readonly {
|
|
301
|
+
readonly exitReason: string;
|
|
302
|
+
readonly events: number;
|
|
303
|
+
}[];
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region ../api-keys/dist/server/model.d.mts
|
|
308
|
+
//#region src/server/model.d.ts
|
|
309
|
+
interface ApiKeyRow {
|
|
310
|
+
readonly id: string;
|
|
311
|
+
readonly hash: string;
|
|
312
|
+
readonly name: string;
|
|
313
|
+
readonly prefix: string;
|
|
314
|
+
readonly role: "client";
|
|
315
|
+
readonly created_at_ms: number;
|
|
316
|
+
readonly revoked_at_ms: number | null;
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region ../api-keys/dist/server/apiKeys.d.mts
|
|
320
|
+
type ApiKeyMetadata = Omit<ApiKeyRow, "hash">;
|
|
321
|
+
interface CreatedApiKey {
|
|
322
|
+
/** Plaintext credential. It cannot be recovered after this call returns. */
|
|
323
|
+
readonly apiKey: string;
|
|
324
|
+
/** Non-secret metadata. The persisted SHA-256 hash is never exposed. */
|
|
325
|
+
readonly record: ApiKeyMetadata;
|
|
326
|
+
}
|
|
39
327
|
//#endregion
|
|
40
328
|
//#region src/plugins.d.ts
|
|
41
329
|
/**
|
|
42
330
|
* The plugins the managed Cloudflare server runs: Insights, and API keys on every
|
|
43
331
|
* client route. Its Worker imports this list.
|
|
44
332
|
*/
|
|
45
|
-
declare const plugins: readonly [import("@hot-updater/
|
|
46
|
-
readonly bundle_events: import("@hot-updater/
|
|
333
|
+
declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPlugin<"insights", {
|
|
334
|
+
readonly bundle_events: import("@hot-updater/plugin-core").TableDefinition<{
|
|
47
335
|
readonly id: {
|
|
48
336
|
readonly type: "string";
|
|
49
337
|
readonly maxLength: 36;
|
|
@@ -118,7 +406,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
118
406
|
readonly sort: readonly ["received_at_ms"];
|
|
119
407
|
};
|
|
120
408
|
}, readonly ["id"]>;
|
|
121
|
-
readonly bundle_event_heads: import("@hot-updater/
|
|
409
|
+
readonly bundle_event_heads: import("@hot-updater/plugin-core").TableDefinition<{
|
|
122
410
|
readonly install_id: {
|
|
123
411
|
readonly type: "string";
|
|
124
412
|
readonly maxLength: 255;
|
|
@@ -171,13 +459,13 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
171
459
|
readonly received_at_ms: {
|
|
172
460
|
readonly type: "integer";
|
|
173
461
|
};
|
|
174
|
-
}, Readonly<Record<string, import("@hot-updater/
|
|
462
|
+
}, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {
|
|
175
463
|
readonly byUser: {
|
|
176
464
|
readonly eq: readonly ["user_id"];
|
|
177
465
|
readonly sort: readonly ["install_id"];
|
|
178
466
|
};
|
|
179
467
|
}, readonly ["install_id"]>;
|
|
180
|
-
readonly insights_overview: import("@hot-updater/
|
|
468
|
+
readonly insights_overview: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
181
469
|
readonly identity: {
|
|
182
470
|
readonly type: "string";
|
|
183
471
|
readonly maxLength: 32;
|
|
@@ -191,7 +479,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
191
479
|
readonly sort: readonly ["bucket_start_ms"];
|
|
192
480
|
};
|
|
193
481
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
194
|
-
readonly insights_sketches: import("@hot-updater/
|
|
482
|
+
readonly insights_sketches: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
195
483
|
readonly identity: {
|
|
196
484
|
readonly type: "string";
|
|
197
485
|
readonly maxLength: 32;
|
|
@@ -205,7 +493,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
205
493
|
readonly sort: readonly ["bucket_start_ms"];
|
|
206
494
|
};
|
|
207
495
|
}, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
208
|
-
readonly insights_overview_daily: import("@hot-updater/
|
|
496
|
+
readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
209
497
|
readonly identity: {
|
|
210
498
|
readonly type: "string";
|
|
211
499
|
readonly maxLength: 32;
|
|
@@ -219,7 +507,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
219
507
|
readonly sort: readonly ["bucket_start_ms"];
|
|
220
508
|
};
|
|
221
509
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
222
|
-
readonly insights_sketches_daily: import("@hot-updater/
|
|
510
|
+
readonly insights_sketches_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
223
511
|
readonly identity: {
|
|
224
512
|
readonly type: "string";
|
|
225
513
|
readonly maxLength: 32;
|
|
@@ -233,7 +521,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
233
521
|
readonly sort: readonly ["bucket_start_ms"];
|
|
234
522
|
};
|
|
235
523
|
}, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
236
|
-
readonly insights_overview_lifetime: import("@hot-updater/
|
|
524
|
+
readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
237
525
|
readonly identity: {
|
|
238
526
|
readonly type: "string";
|
|
239
527
|
readonly maxLength: 32;
|
|
@@ -247,7 +535,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
247
535
|
readonly sort: readonly ["bucket_start_ms"];
|
|
248
536
|
};
|
|
249
537
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
250
|
-
readonly insights_sketches_lifetime: import("@hot-updater/
|
|
538
|
+
readonly insights_sketches_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
251
539
|
readonly identity: {
|
|
252
540
|
readonly type: "string";
|
|
253
541
|
readonly maxLength: 32;
|
|
@@ -261,7 +549,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
261
549
|
readonly sort: readonly ["bucket_start_ms"];
|
|
262
550
|
};
|
|
263
551
|
}, "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
264
|
-
readonly insights_distribution: import("@hot-updater/
|
|
552
|
+
readonly insights_distribution: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
265
553
|
readonly channel: {
|
|
266
554
|
readonly type: "string";
|
|
267
555
|
};
|
|
@@ -289,7 +577,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
289
577
|
readonly sort: readonly ["bucket_start_ms"];
|
|
290
578
|
};
|
|
291
579
|
}, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
|
|
292
|
-
readonly insights_latest_by_bundle: import("@hot-updater/
|
|
580
|
+
readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
293
581
|
readonly platform: {
|
|
294
582
|
readonly type: "string";
|
|
295
583
|
readonly maxLength: 16;
|
|
@@ -318,7 +606,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
318
606
|
readonly sort: readonly ["bucket_start_ms"];
|
|
319
607
|
};
|
|
320
608
|
}, never, readonly ["platform", "channel", "bundle_field", "bundle_id", "type", "bucket_start_ms"]>;
|
|
321
|
-
readonly insights_outcomes: import("@hot-updater/
|
|
609
|
+
readonly insights_outcomes: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
322
610
|
readonly platform: {
|
|
323
611
|
readonly type: "string";
|
|
324
612
|
readonly maxLength: 16;
|
|
@@ -343,7 +631,7 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
343
631
|
readonly sort: readonly ["bucket_start_ms"];
|
|
344
632
|
};
|
|
345
633
|
}, never, readonly ["platform", "channel", "type", "bundle_ref", "bucket_start_ms"]>;
|
|
346
|
-
readonly insights_failures: import("@hot-updater/
|
|
634
|
+
readonly insights_failures: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
347
635
|
readonly platform: {
|
|
348
636
|
readonly type: "string";
|
|
349
637
|
readonly maxLength: 16;
|
|
@@ -378,19 +666,19 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
378
666
|
}, never, readonly ["platform", "channel", "bucket_start_ms", "release_id", "stage", "reason", "detail"]>;
|
|
379
667
|
}, {
|
|
380
668
|
api: {
|
|
381
|
-
retention:
|
|
382
|
-
recordEvent: (event:
|
|
383
|
-
listEvents: (input:
|
|
384
|
-
findLatestEvents: (input:
|
|
385
|
-
countLatestEvents: (input:
|
|
386
|
-
countEvents: (input:
|
|
387
|
-
getReleaseActivity: (input:
|
|
388
|
-
getAppUsage: (input:
|
|
389
|
-
getUpdateFailures: (input:
|
|
669
|
+
retention: InsightsRetention;
|
|
670
|
+
recordEvent: (event: BundleEventRow) => Promise<void>;
|
|
671
|
+
listEvents: (input: InsightsListEventsInput) => Promise<readonly BundleEventRow[]>;
|
|
672
|
+
findLatestEvents: (input: InsightsFindLatestEventsInput) => Promise<readonly BundleEventRow[]>;
|
|
673
|
+
countLatestEvents: (input: InsightsCountLatestEventsInput) => Promise<number>;
|
|
674
|
+
countEvents: (input: InsightsCountEventsInput) => Promise<number>;
|
|
675
|
+
getReleaseActivity: (input: InsightsGetReleaseActivityInput) => Promise<InsightsGetReleaseActivityResult>;
|
|
676
|
+
getAppUsage: (input: InsightsGetAppUsageInput) => Promise<InsightsGetAppUsageResult>;
|
|
677
|
+
getUpdateFailures: (input: InsightsUpdateFailuresInput) => Promise<InsightsUpdateFailures>;
|
|
390
678
|
};
|
|
391
|
-
endpoints: import("@hot-updater/
|
|
392
|
-
}, {}>, import("@hot-updater/
|
|
393
|
-
readonly api_keys: import("@hot-updater/
|
|
679
|
+
endpoints: import("@hot-updater/plugin-core").PluginEndpoint[];
|
|
680
|
+
}, {}>, import("@hot-updater/plugin-core").HotUpdaterPlugin<"apiKeys", {
|
|
681
|
+
readonly api_keys: import("@hot-updater/plugin-core").TableDefinition<{
|
|
394
682
|
readonly id: {
|
|
395
683
|
readonly type: "string";
|
|
396
684
|
readonly maxLength: 255;
|
|
@@ -431,21 +719,21 @@ declare const plugins: readonly [import("@hot-updater/server/plugins").HotUpdate
|
|
|
431
719
|
readonly apiKey: string;
|
|
432
720
|
readonly name: string;
|
|
433
721
|
readonly createdAtMs?: number;
|
|
434
|
-
}) => Promise<
|
|
722
|
+
}) => Promise<CreatedApiKey>;
|
|
435
723
|
provision: (input: {
|
|
436
724
|
readonly existingApiKey?: string;
|
|
437
725
|
readonly name: string;
|
|
438
|
-
}) => Promise<
|
|
726
|
+
}) => Promise<CreatedApiKey>;
|
|
439
727
|
create(input: {
|
|
440
728
|
readonly name: string;
|
|
441
729
|
}): Promise<{
|
|
442
730
|
readonly apiKey: string;
|
|
443
|
-
readonly record:
|
|
731
|
+
readonly record: ApiKeyMetadata;
|
|
444
732
|
}>;
|
|
445
|
-
list(): Promise<readonly
|
|
733
|
+
list(): Promise<readonly ApiKeyMetadata[]>;
|
|
446
734
|
revoke(input: {
|
|
447
735
|
readonly id: string;
|
|
448
|
-
}): Promise<
|
|
736
|
+
}): Promise<ApiKeyMetadata | null>;
|
|
449
737
|
};
|
|
450
738
|
clientAuth: {
|
|
451
739
|
varyHeaders: string[];
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { WRITE_GUARD_TABLE, coreSettings, coreTarget, createEngineDatabase, createSqlAdapter, createTableStatements } from "@hot-updater/
|
|
1
|
+
import { WRITE_GUARD_TABLE, coreSettings, coreTarget, createEngineDatabase, createSqlAdapter, createStorageAdapter, createStorageDownloadUrl, createStorageKeyBuilder, createStorageUri, createTableStatements, generateEngineSql, parseStorageUri } from "@hot-updater/plugin-core";
|
|
2
2
|
import Cloudflare from "cloudflare";
|
|
3
|
-
import { generateEngineSql } from "@hot-updater/server/db";
|
|
4
3
|
import { DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
|
5
4
|
import { Upload } from "@aws-sdk/lib-storage";
|
|
6
|
-
import { createStorageDownloadUrl, createStorageKeyBuilder, createStoragePlugin, createStorageUri, parseStorageUri } from "@hot-updater/plugin-core";
|
|
7
5
|
import { apiKeys } from "@hot-updater/server/plugins/api-keys";
|
|
8
6
|
import { insights } from "@hot-updater/server/plugins/insights";
|
|
9
7
|
//#region src/d1Executor.ts
|
|
@@ -130,7 +128,7 @@ const createR2S3Storage = (config) => {
|
|
|
130
128
|
if (parsed.bucket !== bucketName) throw new Error(`Bucket name mismatch: expected "${bucketName}", but found "${parsed.bucket}".`);
|
|
131
129
|
return parsed;
|
|
132
130
|
};
|
|
133
|
-
return
|
|
131
|
+
return createStorageAdapter({
|
|
134
132
|
name: "r2Storage",
|
|
135
133
|
protocol: "r2",
|
|
136
134
|
async put({ key, body, contentLength, contentType }) {
|