@hot-updater/firebase 1.0.0-rc.31 → 1.0.0-rc.33
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 +48 -37
- package/dist/index.d.cts +7 -4
- package/dist/index.d.mts +7 -4
- package/package.json +7 -7
|
@@ -4524,7 +4524,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
4524
4524
|
};
|
|
4525
4525
|
//#endregion
|
|
4526
4526
|
//#region ../../packages/server/dist/version.mjs
|
|
4527
|
-
const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.
|
|
4527
|
+
const HOT_UPDATER_SERVER_VERSION = "1.0.0-rc.33";
|
|
4528
4528
|
//#endregion
|
|
4529
4529
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
4530
4530
|
/**
|
|
@@ -7892,7 +7892,7 @@ const createValidatedInsightsModel = (model) => ({
|
|
|
7892
7892
|
async getReleaseActivity(input) {
|
|
7893
7893
|
if (!isRecord$2(input) || !hasOnlyKeys(input, ["releases"]) || !Array.isArray(input.releases) || input.releases.length < 1 || input.releases.length > 100 || !input.releases.every(isReleaseReference)) invalidQuery();
|
|
7894
7894
|
const result = await model.getReleaseActivity(input);
|
|
7895
|
-
if (!isRecord$2(result) || !isTimestamp(result.measuredAtMs) || !Array.isArray(result.data) || result.data.some((item) => !isRecord$2(item) || !isReleaseReference(item.release) || !isRecord$2(item.metrics) || !isTimestamp(item.metrics.downloads) || !isTimestamp(item.metrics.
|
|
7895
|
+
if (!isRecord$2(result) || !isTimestamp(result.measuredAtMs) || !Array.isArray(result.data) || result.data.some((item) => !isRecord$2(item) || !isReleaseReference(item.release) || !isRecord$2(item.metrics) || !isTimestamp(item.metrics.downloads) || !isTimestamp(item.metrics.applies) || !isTimestamp(item.metrics.failedLaunches))) invalidResult();
|
|
7896
7896
|
return result;
|
|
7897
7897
|
},
|
|
7898
7898
|
async getAppUsage(input) {
|
|
@@ -8861,29 +8861,42 @@ const window = {
|
|
|
8861
8861
|
eq: ["identity"],
|
|
8862
8862
|
sort: ["bucket_start_ms"]
|
|
8863
8863
|
};
|
|
8864
|
+
/** What a release or channel row counts in every period kind. */
|
|
8865
|
+
const WINDOW_COUNTERS = [
|
|
8866
|
+
"downloads",
|
|
8867
|
+
"failed_launches",
|
|
8868
|
+
"patch_downloads",
|
|
8869
|
+
"patch_fallbacks"
|
|
8870
|
+
];
|
|
8864
8871
|
/**
|
|
8865
|
-
*
|
|
8866
|
-
*
|
|
8867
|
-
*
|
|
8868
|
-
* lifetime row counts launches, which the bundle list reads and no windowed
|
|
8869
|
-
* read sums. It also counts the release's failed updates (`failed_updates`),
|
|
8870
|
-
* since no breakdown row outlives the raw period; windowed reads sum
|
|
8871
|
-
* `insights_failures` instead.
|
|
8872
|
+
* Hourly or daily counters: a release or channel row counts downloads,
|
|
8873
|
+
* launches that crashed and recovered (`failed_launches`), and downloads a
|
|
8874
|
+
* patch delivered and those that fell back from one.
|
|
8872
8875
|
*/
|
|
8873
8876
|
const counters = (retention) => defineAggregate(identityFields, {
|
|
8877
|
+
key: ["identity", "bucket_start_ms"],
|
|
8878
|
+
counters: WINDOW_COUNTERS,
|
|
8879
|
+
shards: COUNTER_SHARDS,
|
|
8880
|
+
batched: true,
|
|
8881
|
+
indexes: { window },
|
|
8882
|
+
retention
|
|
8883
|
+
});
|
|
8884
|
+
/**
|
|
8885
|
+
* A release's counters since its first report, at bucket 0: the windowed
|
|
8886
|
+
* counters, its applies, which the bundle list reads, and its failed updates
|
|
8887
|
+
* (`failed_updates`), since no breakdown row outlives the raw period; windowed
|
|
8888
|
+
* reads sum `insights_failures` instead.
|
|
8889
|
+
*/
|
|
8890
|
+
const lifetimeCounters = () => defineAggregate(identityFields, {
|
|
8874
8891
|
key: ["identity", "bucket_start_ms"],
|
|
8875
8892
|
counters: [
|
|
8876
|
-
|
|
8877
|
-
"
|
|
8878
|
-
"
|
|
8879
|
-
"failed_updates",
|
|
8880
|
-
"patch_downloads",
|
|
8881
|
-
"patch_fallbacks"
|
|
8893
|
+
...WINDOW_COUNTERS,
|
|
8894
|
+
"applies",
|
|
8895
|
+
"failed_updates"
|
|
8882
8896
|
],
|
|
8883
8897
|
shards: COUNTER_SHARDS,
|
|
8884
8898
|
batched: true,
|
|
8885
|
-
indexes: { window }
|
|
8886
|
-
...retention === void 0 ? {} : { retention }
|
|
8899
|
+
indexes: { window }
|
|
8887
8900
|
});
|
|
8888
8901
|
/**
|
|
8889
8902
|
* Unique-installation sketches of one period kind: a usage row's active
|
|
@@ -9114,7 +9127,7 @@ const createInsightsSchema = ({ rawDays, dailyDays } = DEFAULT_INSIGHTS_RETENTIO
|
|
|
9114
9127
|
insights_overview_daily: counters(daily),
|
|
9115
9128
|
insights_sketches_daily: sketches(daily),
|
|
9116
9129
|
/** A release's counters since its first event, and its failed installations: kept. */
|
|
9117
|
-
insights_overview_lifetime:
|
|
9130
|
+
insights_overview_lifetime: lifetimeCounters(),
|
|
9118
9131
|
insights_sketches_lifetime: lifetimeSketches(),
|
|
9119
9132
|
insights_distribution: insightsDistribution(daily),
|
|
9120
9133
|
insights_latest_by_bundle: insightsLatestByBundle(daily),
|
|
@@ -9157,7 +9170,7 @@ const insightsOverviewDeltas = (event) => {
|
|
|
9157
9170
|
counters.set(key, {
|
|
9158
9171
|
identity,
|
|
9159
9172
|
downloads: (previous?.downloads ?? 0) + values.downloads,
|
|
9160
|
-
|
|
9173
|
+
applies: (previous?.applies ?? 0) + values.applies,
|
|
9161
9174
|
failedLaunches: (previous?.failedLaunches ?? 0) + values.failedLaunches,
|
|
9162
9175
|
activityIdentity: previous?.activityIdentity ?? values.activityIdentity
|
|
9163
9176
|
});
|
|
@@ -9165,7 +9178,7 @@ const insightsOverviewDeltas = (event) => {
|
|
|
9165
9178
|
const metric = (releaseId, values) => {
|
|
9166
9179
|
const windowed = {
|
|
9167
9180
|
...values,
|
|
9168
|
-
|
|
9181
|
+
applies: 0
|
|
9169
9182
|
};
|
|
9170
9183
|
if (releaseId !== null) for (const [periodKind, start] of [["lifetime", 0], ["hour", bucketStartMs]]) append({
|
|
9171
9184
|
scopeKind: "release",
|
|
@@ -9192,21 +9205,19 @@ const insightsOverviewDeltas = (event) => {
|
|
|
9192
9205
|
};
|
|
9193
9206
|
if (event.type === "UPDATE_DOWNLOADED") metric(event.to_release_id, {
|
|
9194
9207
|
downloads: 1,
|
|
9195
|
-
|
|
9208
|
+
applies: 0,
|
|
9196
9209
|
failedLaunches: 0
|
|
9197
9210
|
});
|
|
9198
|
-
else if (event.type
|
|
9199
|
-
|
|
9200
|
-
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
});
|
|
9209
|
-
}
|
|
9211
|
+
else if (event.type === "UPDATE_APPLIED") metric(event.to_release_id, {
|
|
9212
|
+
downloads: 0,
|
|
9213
|
+
applies: 1,
|
|
9214
|
+
failedLaunches: 0
|
|
9215
|
+
});
|
|
9216
|
+
else if (event.type === "RECOVERED") metric(event.from_release_id, {
|
|
9217
|
+
downloads: 0,
|
|
9218
|
+
applies: 0,
|
|
9219
|
+
failedLaunches: 1
|
|
9220
|
+
});
|
|
9210
9221
|
for (const platform of [event.platform, "all"]) for (const appVersionKind of ["specific", "all"]) append({
|
|
9211
9222
|
scopeKind: "usage",
|
|
9212
9223
|
releaseKind: "all",
|
|
@@ -9219,7 +9230,7 @@ const insightsOverviewDeltas = (event) => {
|
|
|
9219
9230
|
bucketStartMs
|
|
9220
9231
|
}, {
|
|
9221
9232
|
downloads: 0,
|
|
9222
|
-
|
|
9233
|
+
applies: 0,
|
|
9223
9234
|
failedLaunches: 0,
|
|
9224
9235
|
activityIdentity: event.install_id
|
|
9225
9236
|
});
|
|
@@ -9336,7 +9347,7 @@ const countEvent = (tx, event) => {
|
|
|
9336
9347
|
const counters = {
|
|
9337
9348
|
...Object.fromEntries([
|
|
9338
9349
|
["downloads", delta.downloads],
|
|
9339
|
-
["
|
|
9350
|
+
["applies", delta.applies],
|
|
9340
9351
|
["failed_launches", delta.failedLaunches]
|
|
9341
9352
|
].filter(([, value]) => value !== 0)),
|
|
9342
9353
|
...delta.downloads === 0 ? {} : patchCounters(event)
|
|
@@ -9895,7 +9906,7 @@ const lifetimeMetrics = async (db, release) => {
|
|
|
9895
9906
|
})).rows;
|
|
9896
9907
|
return {
|
|
9897
9908
|
downloads: lifetime?.downloads ?? 0,
|
|
9898
|
-
|
|
9909
|
+
applies: lifetime?.applies ?? 0,
|
|
9899
9910
|
failedLaunches: lifetime?.failed_launches ?? 0
|
|
9900
9911
|
};
|
|
9901
9912
|
};
|
|
@@ -10437,7 +10448,7 @@ const insights = (options = {}) => {
|
|
|
10437
10448
|
const plugin = definePlugin({
|
|
10438
10449
|
id: "insights",
|
|
10439
10450
|
namespace: false,
|
|
10440
|
-
schemaVersion: "1.
|
|
10451
|
+
schemaVersion: "1.4.0",
|
|
10441
10452
|
schema: createInsightsSchema(retention),
|
|
10442
10453
|
init: ({ db, now }) => {
|
|
10443
10454
|
const api = createInsightsApi(db, now, retention);
|
package/dist/index.d.cts
CHANGED
|
@@ -203,8 +203,11 @@ type InsightsCoverage = {
|
|
|
203
203
|
* which are kept.
|
|
204
204
|
*/
|
|
205
205
|
interface ReleaseActivityMetrics {
|
|
206
|
+
/** Download reports of the release. */
|
|
206
207
|
readonly downloads: number;
|
|
207
|
-
|
|
208
|
+
/** Apply reports of the release: installations that started running it. */
|
|
209
|
+
readonly applies: number;
|
|
210
|
+
/** Launches that crashed on the release and recovered to the one before. */
|
|
208
211
|
readonly failedLaunches: number;
|
|
209
212
|
}
|
|
210
213
|
interface InsightsGetReleaseActivityInput {
|
|
@@ -482,7 +485,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
482
485
|
readonly bucket_start_ms: {
|
|
483
486
|
readonly type: "integer";
|
|
484
487
|
};
|
|
485
|
-
}, "downloads" | "
|
|
488
|
+
}, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks", {
|
|
486
489
|
readonly window: {
|
|
487
490
|
readonly eq: readonly ["identity"];
|
|
488
491
|
readonly sort: readonly ["bucket_start_ms"];
|
|
@@ -510,7 +513,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
510
513
|
readonly bucket_start_ms: {
|
|
511
514
|
readonly type: "integer";
|
|
512
515
|
};
|
|
513
|
-
}, "downloads" | "
|
|
516
|
+
}, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks", {
|
|
514
517
|
readonly window: {
|
|
515
518
|
readonly eq: readonly ["identity"];
|
|
516
519
|
readonly sort: readonly ["bucket_start_ms"];
|
|
@@ -538,7 +541,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
538
541
|
readonly bucket_start_ms: {
|
|
539
542
|
readonly type: "integer";
|
|
540
543
|
};
|
|
541
|
-
}, "downloads" | "
|
|
544
|
+
}, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks" | "applies" | "failed_updates", {
|
|
542
545
|
readonly window: {
|
|
543
546
|
readonly eq: readonly ["identity"];
|
|
544
547
|
readonly sort: readonly ["bucket_start_ms"];
|
package/dist/index.d.mts
CHANGED
|
@@ -203,8 +203,11 @@ type InsightsCoverage = {
|
|
|
203
203
|
* which are kept.
|
|
204
204
|
*/
|
|
205
205
|
interface ReleaseActivityMetrics {
|
|
206
|
+
/** Download reports of the release. */
|
|
206
207
|
readonly downloads: number;
|
|
207
|
-
|
|
208
|
+
/** Apply reports of the release: installations that started running it. */
|
|
209
|
+
readonly applies: number;
|
|
210
|
+
/** Launches that crashed on the release and recovered to the one before. */
|
|
208
211
|
readonly failedLaunches: number;
|
|
209
212
|
}
|
|
210
213
|
interface InsightsGetReleaseActivityInput {
|
|
@@ -482,7 +485,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
482
485
|
readonly bucket_start_ms: {
|
|
483
486
|
readonly type: "integer";
|
|
484
487
|
};
|
|
485
|
-
}, "downloads" | "
|
|
488
|
+
}, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks", {
|
|
486
489
|
readonly window: {
|
|
487
490
|
readonly eq: readonly ["identity"];
|
|
488
491
|
readonly sort: readonly ["bucket_start_ms"];
|
|
@@ -510,7 +513,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
510
513
|
readonly bucket_start_ms: {
|
|
511
514
|
readonly type: "integer";
|
|
512
515
|
};
|
|
513
|
-
}, "downloads" | "
|
|
516
|
+
}, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks", {
|
|
514
517
|
readonly window: {
|
|
515
518
|
readonly eq: readonly ["identity"];
|
|
516
519
|
readonly sort: readonly ["bucket_start_ms"];
|
|
@@ -538,7 +541,7 @@ declare const plugins: readonly [import("@hot-updater/plugin-core").HotUpdaterPl
|
|
|
538
541
|
readonly bucket_start_ms: {
|
|
539
542
|
readonly type: "integer";
|
|
540
543
|
};
|
|
541
|
-
}, "downloads" | "
|
|
544
|
+
}, "downloads" | "failed_launches" | "patch_downloads" | "patch_fallbacks" | "applies" | "failed_updates", {
|
|
542
545
|
readonly window: {
|
|
543
546
|
readonly eq: readonly ["identity"];
|
|
544
547
|
readonly sort: readonly ["bucket_start_ms"];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.33",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"types": "dist/index.d.cts",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"hono": "4.12.34",
|
|
40
|
-
"@hot-updater/cli-tools": "1.0.0-rc.
|
|
41
|
-
"@hot-updater/
|
|
42
|
-
"@hot-updater/
|
|
43
|
-
"@hot-updater/
|
|
40
|
+
"@hot-updater/cli-tools": "1.0.0-rc.33",
|
|
41
|
+
"@hot-updater/protocol": "1.0.0-rc.29",
|
|
42
|
+
"@hot-updater/plugin-core": "1.0.0-rc.29",
|
|
43
|
+
"@hot-updater/server": "1.0.0-rc.33"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"firebase-tools": "15.29.0",
|
|
56
56
|
"fkill": "^9.0.0",
|
|
57
57
|
"mime": "^4.0.4",
|
|
58
|
-
"@hot-updater/mock": "1.0.0-rc.
|
|
59
|
-
"@hot-updater/test-utils": "1.0.0-rc.
|
|
58
|
+
"@hot-updater/mock": "1.0.0-rc.29",
|
|
59
|
+
"@hot-updater/test-utils": "1.0.0-rc.31"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
62
|
"firebase-admin": "*",
|