@hot-updater/plugin-insights 1.0.0-rc.37 → 1.0.0-rc.38
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/server/domain.d.cts
CHANGED
|
@@ -123,7 +123,7 @@ type EventHistoryRow = {
|
|
|
123
123
|
readonly patchFallback?: true;
|
|
124
124
|
/** `UNCHANGED`: what the report changed, the reason it was kept. */
|
|
125
125
|
readonly change?: EventHistoryChange;
|
|
126
|
-
/** A download or apply
|
|
126
|
+
/** A download or apply of a target already run or already downloaded: it counted nothing. */
|
|
127
127
|
readonly late?: true;
|
|
128
128
|
/** A launch or crash whose download report never arrived, counted with it. */
|
|
129
129
|
readonly impliedDownload?: true;
|
package/dist/server/domain.d.mts
CHANGED
|
@@ -123,7 +123,7 @@ type EventHistoryRow = {
|
|
|
123
123
|
readonly patchFallback?: true;
|
|
124
124
|
/** `UNCHANGED`: what the report changed, the reason it was kept. */
|
|
125
125
|
readonly change?: EventHistoryChange;
|
|
126
|
-
/** A download or apply
|
|
126
|
+
/** A download or apply of a target already run or already downloaded: it counted nothing. */
|
|
127
127
|
readonly late?: true;
|
|
128
128
|
/** A launch or crash whose download report never arrived, counted with it. */
|
|
129
129
|
readonly impliedDownload?: true;
|
|
@@ -62,9 +62,10 @@ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
|
|
|
62
62
|
/** A kept `UNCHANGED` row: what it changed, which the server sets. */
|
|
63
63
|
readonly change?: BundleEventChange;
|
|
64
64
|
/**
|
|
65
|
-
* A download or apply
|
|
66
|
-
*
|
|
67
|
-
* server keeps it in history, but it moves
|
|
65
|
+
* A download or apply of a target its installation already ran, as when
|
|
66
|
+
* a reload cut the first runtime's report short, or a download that
|
|
67
|
+
* repeats the pending one: the server keeps it in history, but it moves
|
|
68
|
+
* and counts nothing.
|
|
68
69
|
*/
|
|
69
70
|
readonly late?: true;
|
|
70
71
|
/**
|
|
@@ -62,9 +62,10 @@ type DatabaseBundleEventMetadata = DatabaseJsonObject & {
|
|
|
62
62
|
/** A kept `UNCHANGED` row: what it changed, which the server sets. */
|
|
63
63
|
readonly change?: BundleEventChange;
|
|
64
64
|
/**
|
|
65
|
-
* A download or apply
|
|
66
|
-
*
|
|
67
|
-
* server keeps it in history, but it moves
|
|
65
|
+
* A download or apply of a target its installation already ran, as when
|
|
66
|
+
* a reload cut the first runtime's report short, or a download that
|
|
67
|
+
* repeats the pending one: the server keeps it in history, but it moves
|
|
68
|
+
* and counts nothing.
|
|
68
69
|
*/
|
|
69
70
|
readonly late?: true;
|
|
70
71
|
/**
|
|
@@ -262,19 +262,25 @@ const minBundleIdOf = (row) => row.metadata?.min_bundle_id;
|
|
|
262
262
|
/** When the client made a report, from the UUIDv7 it gave it. */
|
|
263
263
|
const madeAt = (id) => (0, _hot_updater_plugin_core.isUUIDv7)(id) ? (0, _hot_updater_plugin_core.extractTimestampFromUUIDv7)(id) : null;
|
|
264
264
|
/**
|
|
265
|
-
* A report
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
265
|
+
* A report its installation already moved past, which stays in history but
|
|
266
|
+
* moves and counts nothing:
|
|
267
|
+
* - a download or an apply of the bundle the head already runs, or a
|
|
268
|
+
* download that repeats the head's pending one, from the same bundle to
|
|
269
|
+
* the same bundle: the installation's download or launch already counted;
|
|
270
|
+
* - an UNCHANGED report made, by its UUIDv7, before the head's report, even
|
|
271
|
+
* after a later report replaced the apply it preceded: a reload can cut
|
|
272
|
+
* one runtime's report short and deliver it after the next runtime's.
|
|
273
|
+
*
|
|
274
|
+
* Report IDs are made on the device, so a device whose clock jumps back has
|
|
275
|
+
* its launch reports judged late until its clock passes its latest report.
|
|
270
276
|
*/
|
|
271
277
|
const isLate = (event, head) => {
|
|
272
278
|
if (head === null) return false;
|
|
273
|
-
if (event.type === "UPDATE_DOWNLOADED" || event.type === "UPDATE_APPLIED") return event.to_bundle_id === runningOf(head).bundle_id;
|
|
274
|
-
if (event.type === "UNCHANGED"
|
|
279
|
+
if (event.type === "UPDATE_DOWNLOADED" || event.type === "UPDATE_APPLIED") return event.to_bundle_id === runningOf(head).bundle_id || event.type === "UPDATE_DOWNLOADED" && head.type === "UPDATE_DOWNLOADED" && event.from_bundle_id === head.from_bundle_id && event.to_bundle_id === head.to_bundle_id;
|
|
280
|
+
if (event.type === "UNCHANGED") {
|
|
275
281
|
const made = madeAt(event.id);
|
|
276
|
-
const
|
|
277
|
-
return made !== null &&
|
|
282
|
+
const latest = madeAt(head.id);
|
|
283
|
+
return made !== null && latest !== null && made < latest;
|
|
278
284
|
}
|
|
279
285
|
return false;
|
|
280
286
|
};
|
|
@@ -262,19 +262,25 @@ const minBundleIdOf = (row) => row.metadata?.min_bundle_id;
|
|
|
262
262
|
/** When the client made a report, from the UUIDv7 it gave it. */
|
|
263
263
|
const madeAt = (id) => isUUIDv7(id) ? extractTimestampFromUUIDv7(id) : null;
|
|
264
264
|
/**
|
|
265
|
-
* A report
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
265
|
+
* A report its installation already moved past, which stays in history but
|
|
266
|
+
* moves and counts nothing:
|
|
267
|
+
* - a download or an apply of the bundle the head already runs, or a
|
|
268
|
+
* download that repeats the head's pending one, from the same bundle to
|
|
269
|
+
* the same bundle: the installation's download or launch already counted;
|
|
270
|
+
* - an UNCHANGED report made, by its UUIDv7, before the head's report, even
|
|
271
|
+
* after a later report replaced the apply it preceded: a reload can cut
|
|
272
|
+
* one runtime's report short and deliver it after the next runtime's.
|
|
273
|
+
*
|
|
274
|
+
* Report IDs are made on the device, so a device whose clock jumps back has
|
|
275
|
+
* its launch reports judged late until its clock passes its latest report.
|
|
270
276
|
*/
|
|
271
277
|
const isLate = (event, head) => {
|
|
272
278
|
if (head === null) return false;
|
|
273
|
-
if (event.type === "UPDATE_DOWNLOADED" || event.type === "UPDATE_APPLIED") return event.to_bundle_id === runningOf(head).bundle_id;
|
|
274
|
-
if (event.type === "UNCHANGED"
|
|
279
|
+
if (event.type === "UPDATE_DOWNLOADED" || event.type === "UPDATE_APPLIED") return event.to_bundle_id === runningOf(head).bundle_id || event.type === "UPDATE_DOWNLOADED" && head.type === "UPDATE_DOWNLOADED" && event.from_bundle_id === head.from_bundle_id && event.to_bundle_id === head.to_bundle_id;
|
|
280
|
+
if (event.type === "UNCHANGED") {
|
|
275
281
|
const made = madeAt(event.id);
|
|
276
|
-
const
|
|
277
|
-
return made !== null &&
|
|
282
|
+
const latest = madeAt(head.id);
|
|
283
|
+
return made !== null && latest !== null && made < latest;
|
|
278
284
|
}
|
|
279
285
|
return false;
|
|
280
286
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/plugin-insights",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.38",
|
|
5
5
|
"description": "Hot Updater's Insights plugin: launch, download, and update failure events, for the server and the React Native app",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./client": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"package.json"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@hot-updater/protocol": "1.0.0-rc.
|
|
36
|
+
"@hot-updater/protocol": "1.0.0-rc.38"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@hot-updater/plugin-core": "^1.0.0-rc.
|
|
39
|
+
"@hot-updater/plugin-core": "^1.0.0-rc.38"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@hot-updater/plugin-core": {
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/node": "^20",
|
|
48
48
|
"vitest": "4.1.4",
|
|
49
|
-
"@hot-updater/
|
|
50
|
-
"@hot-updater/
|
|
49
|
+
"@hot-updater/plugin-core": "1.0.0-rc.38",
|
|
50
|
+
"@hot-updater/test-utils": "1.0.0-rc.38"
|
|
51
51
|
},
|
|
52
52
|
"nx": {
|
|
53
53
|
"implicitDependencies": [
|