@hot-updater/plugin-insights 1.0.0-rc.20 → 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/README.md +7 -6
- package/dist/client/index.cjs +3 -4
- package/dist/client/index.d.cts +2 -3
- package/dist/client/index.d.mts +2 -3
- package/dist/client/index.mjs +2 -3
- package/dist/server/errors.cjs +4 -0
- package/dist/server/errors.d.cts +4 -0
- package/dist/server/errors.d.mts +4 -0
- package/dist/server/errors.mjs +4 -0
- package/dist/server/eventRow.cjs +2 -3
- package/dist/server/eventRow.mjs +1 -2
- package/dist/server/index.cjs +8 -7
- package/dist/server/index.d.cts +19 -18
- package/dist/server/index.d.mts +19 -18
- package/dist/server/index.mjs +5 -5
- package/dist/server/official.cjs +12 -0
- package/dist/server/official.mjs +12 -0
- package/dist/server/reads.cjs +7 -8
- package/dist/server/reads.d.cts +1 -1
- package/dist/server/reads.d.mts +1 -1
- package/dist/server/reads.mjs +1 -2
- package/dist/server/recordEvent.cjs +5 -5
- package/dist/server/recordEvent.d.cts +1 -1
- package/dist/server/recordEvent.d.mts +1 -1
- package/dist/server/recordEvent.mjs +1 -1
- package/dist/server/routes.cjs +2 -2
- package/dist/server/routes.mjs +1 -1
- package/dist/server/schema.cjs +10 -10
- package/dist/server/schema.d.cts +27 -38
- package/dist/server/schema.d.mts +27 -38
- package/dist/server/schema.mjs +1 -1
- package/package.json +7 -14
- package/dist/internal.cjs +0 -9
- package/dist/internal.d.cts +0 -5
- package/dist/internal.d.mts +0 -5
- package/dist/internal.mjs +0 -5
- package/dist/server/eventInput.d.cts +0 -6
- package/dist/server/eventInput.d.mts +0 -6
- package/dist/server/routes.d.cts +0 -36
- package/dist/server/routes.d.mts +0 -36
- package/dist/server/testing/eventRow.d.mts +0 -64
- package/dist/server/testing/expectInsightsIndex.mjs +0 -18
- package/dist/server/testing/fixtures.d.mts +0 -8
- package/dist/server/testing/fixtures.mjs +0 -25
- package/dist/server/testing/index.d.mts +0 -24
- package/dist/server/testing/index.mjs +0 -25
- package/dist/server/testing/insightsModelTests.mjs +0 -714
- package/dist/server/testing/modelTypes.d.mts +0 -176
- package/dist/server/testing/setupInsightsHttpTestSuite.d.mts +0 -11
- package/dist/server/testing/setupInsightsHttpTestSuite.mjs +0 -107
- package/dist/server/testing/setupInsightsModelTestSuite.d.mts +0 -11
- package/dist/server/testing/setupInsightsModelTestSuite.mjs +0 -31
- package/dist/server/testing/types.d.mts +0 -26
package/dist/server/schema.d.mts
CHANGED
|
@@ -7,24 +7,13 @@ interface InsightsRetention {
|
|
|
7
7
|
readonly dailyDays: number;
|
|
8
8
|
}
|
|
9
9
|
declare const DEFAULT_INSIGHTS_RETENTION: InsightsRetention;
|
|
10
|
-
/**
|
|
11
|
-
* The `insights_outcomes` identity that counts every stored event, for the
|
|
12
|
-
* global event list. Its bucket is a UTC day, not an hour. Every event's
|
|
13
|
-
* platform is ios or android, so no outcome row of a bundle filter shares it.
|
|
14
|
-
*/
|
|
15
|
-
declare const DAILY_EVENTS: {
|
|
16
|
-
readonly platform: "*";
|
|
17
|
-
readonly channel: "";
|
|
18
|
-
readonly type: "";
|
|
19
|
-
readonly bundle_ref: "";
|
|
20
|
-
};
|
|
21
10
|
/**
|
|
22
11
|
* Insights' tables, each expiring after its period. The periods are values
|
|
23
12
|
* the engine applies at runtime; the tables and indexes are the same for
|
|
24
13
|
* any periods.
|
|
25
14
|
*/
|
|
26
15
|
declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention) => {
|
|
27
|
-
readonly bundle_events: import("@hot-updater/plugin-core
|
|
16
|
+
readonly bundle_events: import("@hot-updater/plugin-core").TableDefinition<{
|
|
28
17
|
readonly id: {
|
|
29
18
|
readonly type: "string";
|
|
30
19
|
readonly maxLength: 36;
|
|
@@ -100,7 +89,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
100
89
|
readonly sort: readonly ["received_at_ms"];
|
|
101
90
|
};
|
|
102
91
|
}, readonly ["id"]>;
|
|
103
|
-
readonly bundle_event_heads: import("@hot-updater/plugin-core
|
|
92
|
+
readonly bundle_event_heads: import("@hot-updater/plugin-core").TableDefinition<{
|
|
104
93
|
readonly install_id: {
|
|
105
94
|
readonly type: "string";
|
|
106
95
|
readonly maxLength: 255;
|
|
@@ -153,14 +142,14 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
153
142
|
readonly received_at_ms: {
|
|
154
143
|
readonly type: "integer";
|
|
155
144
|
};
|
|
156
|
-
}, Readonly<Record<string, import("@hot-updater/plugin-core
|
|
145
|
+
}, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {
|
|
157
146
|
readonly byUser: {
|
|
158
147
|
readonly eq: readonly ["user_id"];
|
|
159
148
|
readonly sort: readonly ["install_id"];
|
|
160
149
|
};
|
|
161
150
|
}, readonly ["install_id"]>;
|
|
162
151
|
/** Hourly counters and sketches: the raw period. */
|
|
163
|
-
readonly insights_overview: import("@hot-updater/plugin-core
|
|
152
|
+
readonly insights_overview: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
164
153
|
readonly identity: {
|
|
165
154
|
readonly type: "string";
|
|
166
155
|
readonly maxLength: 32;
|
|
@@ -174,7 +163,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
174
163
|
readonly sort: readonly ["bucket_start_ms"];
|
|
175
164
|
};
|
|
176
165
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
177
|
-
readonly insights_sketches: import("@hot-updater/plugin-core
|
|
166
|
+
readonly insights_sketches: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
178
167
|
readonly identity: {
|
|
179
168
|
readonly type: "string";
|
|
180
169
|
readonly maxLength: 32;
|
|
@@ -189,7 +178,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
189
178
|
};
|
|
190
179
|
}, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
191
180
|
/** Daily counters and sketches: the daily period. */
|
|
192
|
-
readonly insights_overview_daily: import("@hot-updater/plugin-core
|
|
181
|
+
readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
193
182
|
readonly identity: {
|
|
194
183
|
readonly type: "string";
|
|
195
184
|
readonly maxLength: 32;
|
|
@@ -203,7 +192,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
203
192
|
readonly sort: readonly ["bucket_start_ms"];
|
|
204
193
|
};
|
|
205
194
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
206
|
-
readonly insights_sketches_daily: import("@hot-updater/plugin-core
|
|
195
|
+
readonly insights_sketches_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
207
196
|
readonly identity: {
|
|
208
197
|
readonly type: "string";
|
|
209
198
|
readonly maxLength: 32;
|
|
@@ -218,7 +207,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
218
207
|
};
|
|
219
208
|
}, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
220
209
|
/** A release's counters since its first event, and its failed installations: kept. */
|
|
221
|
-
readonly insights_overview_lifetime: import("@hot-updater/plugin-core
|
|
210
|
+
readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
222
211
|
readonly identity: {
|
|
223
212
|
readonly type: "string";
|
|
224
213
|
readonly maxLength: 32;
|
|
@@ -232,7 +221,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
232
221
|
readonly sort: readonly ["bucket_start_ms"];
|
|
233
222
|
};
|
|
234
223
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
235
|
-
readonly insights_sketches_lifetime: import("@hot-updater/plugin-core
|
|
224
|
+
readonly insights_sketches_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
236
225
|
readonly identity: {
|
|
237
226
|
readonly type: "string";
|
|
238
227
|
readonly maxLength: 32;
|
|
@@ -246,7 +235,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
246
235
|
readonly sort: readonly ["bucket_start_ms"];
|
|
247
236
|
};
|
|
248
237
|
}, "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
249
|
-
readonly insights_distribution: import("@hot-updater/plugin-core
|
|
238
|
+
readonly insights_distribution: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
250
239
|
readonly channel: {
|
|
251
240
|
readonly type: "string";
|
|
252
241
|
};
|
|
@@ -274,7 +263,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
274
263
|
readonly sort: readonly ["bucket_start_ms"];
|
|
275
264
|
};
|
|
276
265
|
}, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
|
|
277
|
-
readonly insights_latest_by_bundle: import("@hot-updater/plugin-core
|
|
266
|
+
readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
278
267
|
readonly platform: {
|
|
279
268
|
readonly type: "string";
|
|
280
269
|
readonly maxLength: 16;
|
|
@@ -303,7 +292,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
303
292
|
readonly sort: readonly ["bucket_start_ms"];
|
|
304
293
|
};
|
|
305
294
|
}, never, readonly ["platform", "channel", "bundle_field", "bundle_id", "type", "bucket_start_ms"]>;
|
|
306
|
-
readonly insights_outcomes: import("@hot-updater/plugin-core
|
|
295
|
+
readonly insights_outcomes: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
307
296
|
readonly platform: {
|
|
308
297
|
readonly type: "string";
|
|
309
298
|
readonly maxLength: 16;
|
|
@@ -328,7 +317,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
328
317
|
readonly sort: readonly ["bucket_start_ms"];
|
|
329
318
|
};
|
|
330
319
|
}, never, readonly ["platform", "channel", "type", "bundle_ref", "bucket_start_ms"]>;
|
|
331
|
-
readonly insights_failures: import("@hot-updater/plugin-core
|
|
320
|
+
readonly insights_failures: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
332
321
|
readonly platform: {
|
|
333
322
|
readonly type: "string";
|
|
334
323
|
readonly maxLength: 16;
|
|
@@ -363,7 +352,7 @@ declare const createInsightsSchema: ({ rawDays, dailyDays }?: InsightsRetention)
|
|
|
363
352
|
}, never, readonly ["platform", "channel", "bucket_start_ms", "release_id", "stage", "reason", "detail"]>;
|
|
364
353
|
};
|
|
365
354
|
declare const insightsSchema: {
|
|
366
|
-
readonly bundle_events: import("@hot-updater/plugin-core
|
|
355
|
+
readonly bundle_events: import("@hot-updater/plugin-core").TableDefinition<{
|
|
367
356
|
readonly id: {
|
|
368
357
|
readonly type: "string";
|
|
369
358
|
readonly maxLength: 36;
|
|
@@ -439,7 +428,7 @@ declare const insightsSchema: {
|
|
|
439
428
|
readonly sort: readonly ["received_at_ms"];
|
|
440
429
|
};
|
|
441
430
|
}, readonly ["id"]>;
|
|
442
|
-
readonly bundle_event_heads: import("@hot-updater/plugin-core
|
|
431
|
+
readonly bundle_event_heads: import("@hot-updater/plugin-core").TableDefinition<{
|
|
443
432
|
readonly install_id: {
|
|
444
433
|
readonly type: "string";
|
|
445
434
|
readonly maxLength: 255;
|
|
@@ -492,14 +481,14 @@ declare const insightsSchema: {
|
|
|
492
481
|
readonly received_at_ms: {
|
|
493
482
|
readonly type: "integer";
|
|
494
483
|
};
|
|
495
|
-
}, Readonly<Record<string, import("@hot-updater/plugin-core
|
|
484
|
+
}, Readonly<Record<string, import("@hot-updater/plugin-core").FieldType>>, {
|
|
496
485
|
readonly byUser: {
|
|
497
486
|
readonly eq: readonly ["user_id"];
|
|
498
487
|
readonly sort: readonly ["install_id"];
|
|
499
488
|
};
|
|
500
489
|
}, readonly ["install_id"]>;
|
|
501
490
|
/** Hourly counters and sketches: the raw period. */
|
|
502
|
-
readonly insights_overview: import("@hot-updater/plugin-core
|
|
491
|
+
readonly insights_overview: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
503
492
|
readonly identity: {
|
|
504
493
|
readonly type: "string";
|
|
505
494
|
readonly maxLength: 32;
|
|
@@ -513,7 +502,7 @@ declare const insightsSchema: {
|
|
|
513
502
|
readonly sort: readonly ["bucket_start_ms"];
|
|
514
503
|
};
|
|
515
504
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
516
|
-
readonly insights_sketches: import("@hot-updater/plugin-core
|
|
505
|
+
readonly insights_sketches: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
517
506
|
readonly identity: {
|
|
518
507
|
readonly type: "string";
|
|
519
508
|
readonly maxLength: 32;
|
|
@@ -528,7 +517,7 @@ declare const insightsSchema: {
|
|
|
528
517
|
};
|
|
529
518
|
}, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
530
519
|
/** Daily counters and sketches: the daily period. */
|
|
531
|
-
readonly insights_overview_daily: import("@hot-updater/plugin-core
|
|
520
|
+
readonly insights_overview_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
532
521
|
readonly identity: {
|
|
533
522
|
readonly type: "string";
|
|
534
523
|
readonly maxLength: 32;
|
|
@@ -542,7 +531,7 @@ declare const insightsSchema: {
|
|
|
542
531
|
readonly sort: readonly ["bucket_start_ms"];
|
|
543
532
|
};
|
|
544
533
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
545
|
-
readonly insights_sketches_daily: import("@hot-updater/plugin-core
|
|
534
|
+
readonly insights_sketches_daily: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
546
535
|
readonly identity: {
|
|
547
536
|
readonly type: "string";
|
|
548
537
|
readonly maxLength: 32;
|
|
@@ -557,7 +546,7 @@ declare const insightsSchema: {
|
|
|
557
546
|
};
|
|
558
547
|
}, "launch_users" | "activity_users" | "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
559
548
|
/** A release's counters since its first event, and its failed installations: kept. */
|
|
560
|
-
readonly insights_overview_lifetime: import("@hot-updater/plugin-core
|
|
549
|
+
readonly insights_overview_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
561
550
|
readonly identity: {
|
|
562
551
|
readonly type: "string";
|
|
563
552
|
readonly maxLength: 32;
|
|
@@ -571,7 +560,7 @@ declare const insightsSchema: {
|
|
|
571
560
|
readonly sort: readonly ["bucket_start_ms"];
|
|
572
561
|
};
|
|
573
562
|
}, never, readonly ["identity", "bucket_start_ms"]>;
|
|
574
|
-
readonly insights_sketches_lifetime: import("@hot-updater/plugin-core
|
|
563
|
+
readonly insights_sketches_lifetime: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
575
564
|
readonly identity: {
|
|
576
565
|
readonly type: "string";
|
|
577
566
|
readonly maxLength: 32;
|
|
@@ -585,7 +574,7 @@ declare const insightsSchema: {
|
|
|
585
574
|
readonly sort: readonly ["bucket_start_ms"];
|
|
586
575
|
};
|
|
587
576
|
}, "failed_users", readonly ["identity", "bucket_start_ms"]>;
|
|
588
|
-
readonly insights_distribution: import("@hot-updater/plugin-core
|
|
577
|
+
readonly insights_distribution: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
589
578
|
readonly channel: {
|
|
590
579
|
readonly type: "string";
|
|
591
580
|
};
|
|
@@ -613,7 +602,7 @@ declare const insightsSchema: {
|
|
|
613
602
|
readonly sort: readonly ["bucket_start_ms"];
|
|
614
603
|
};
|
|
615
604
|
}, never, readonly ["channel", "platform", "app_version", "release_id", "bucket_start_ms"]>;
|
|
616
|
-
readonly insights_latest_by_bundle: import("@hot-updater/plugin-core
|
|
605
|
+
readonly insights_latest_by_bundle: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
617
606
|
readonly platform: {
|
|
618
607
|
readonly type: "string";
|
|
619
608
|
readonly maxLength: 16;
|
|
@@ -642,7 +631,7 @@ declare const insightsSchema: {
|
|
|
642
631
|
readonly sort: readonly ["bucket_start_ms"];
|
|
643
632
|
};
|
|
644
633
|
}, never, readonly ["platform", "channel", "bundle_field", "bundle_id", "type", "bucket_start_ms"]>;
|
|
645
|
-
readonly insights_outcomes: import("@hot-updater/plugin-core
|
|
634
|
+
readonly insights_outcomes: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
646
635
|
readonly platform: {
|
|
647
636
|
readonly type: "string";
|
|
648
637
|
readonly maxLength: 16;
|
|
@@ -667,7 +656,7 @@ declare const insightsSchema: {
|
|
|
667
656
|
readonly sort: readonly ["bucket_start_ms"];
|
|
668
657
|
};
|
|
669
658
|
}, never, readonly ["platform", "channel", "type", "bundle_ref", "bucket_start_ms"]>;
|
|
670
|
-
readonly insights_failures: import("@hot-updater/plugin-core
|
|
659
|
+
readonly insights_failures: import("@hot-updater/plugin-core").AggregateDefinition<{
|
|
671
660
|
readonly platform: {
|
|
672
661
|
readonly type: "string";
|
|
673
662
|
readonly maxLength: 16;
|
|
@@ -703,4 +692,4 @@ declare const insightsSchema: {
|
|
|
703
692
|
};
|
|
704
693
|
type InsightsSchema = typeof insightsSchema;
|
|
705
694
|
//#endregion
|
|
706
|
-
export {
|
|
695
|
+
export { DEFAULT_INSIGHTS_RETENTION, InsightsRetention, InsightsSchema, createInsightsSchema, insightsSchema };
|
package/dist/server/schema.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,25 +1,18 @@
|
|
|
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.21",
|
|
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": {
|
|
8
8
|
"import": "./dist/client/index.mjs",
|
|
9
9
|
"require": "./dist/client/index.cjs"
|
|
10
10
|
},
|
|
11
|
-
"./internal": {
|
|
12
|
-
"import": "./dist/internal.mjs",
|
|
13
|
-
"require": "./dist/internal.cjs"
|
|
14
|
-
},
|
|
15
11
|
"./server": {
|
|
16
12
|
"import": "./dist/server/index.mjs",
|
|
17
13
|
"require": "./dist/server/index.cjs"
|
|
18
14
|
},
|
|
19
|
-
"./package.json": "./package.json"
|
|
20
|
-
"./testing": {
|
|
21
|
-
"import": "./dist/server/testing/index.mjs"
|
|
22
|
-
}
|
|
15
|
+
"./package.json": "./package.json"
|
|
23
16
|
},
|
|
24
17
|
"license": "MIT",
|
|
25
18
|
"repository": {
|
|
@@ -40,21 +33,21 @@
|
|
|
40
33
|
"package.json"
|
|
41
34
|
],
|
|
42
35
|
"dependencies": {
|
|
43
|
-
"@hot-updater/
|
|
44
|
-
"@hot-updater/plugin-core": "1.0.0-rc.20"
|
|
36
|
+
"@hot-updater/protocol": "1.0.0-rc.21"
|
|
45
37
|
},
|
|
46
38
|
"peerDependencies": {
|
|
47
|
-
"
|
|
39
|
+
"@hot-updater/plugin-core": "^1.0.0-rc.21"
|
|
48
40
|
},
|
|
49
41
|
"peerDependenciesMeta": {
|
|
50
|
-
"
|
|
42
|
+
"@hot-updater/plugin-core": {
|
|
51
43
|
"optional": true
|
|
52
44
|
}
|
|
53
45
|
},
|
|
54
46
|
"devDependencies": {
|
|
55
47
|
"@types/node": "^20",
|
|
56
48
|
"vitest": "4.1.4",
|
|
57
|
-
"@hot-updater/
|
|
49
|
+
"@hot-updater/plugin-core": "1.0.0-rc.21",
|
|
50
|
+
"@hot-updater/test-utils": "1.0.0-rc.21"
|
|
58
51
|
},
|
|
59
52
|
"nx": {
|
|
60
53
|
"implicitDependencies": [
|
package/dist/internal.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_errors = require("./server/errors.cjs");
|
|
3
|
-
const require_eventInput = require("./server/eventInput.cjs");
|
|
4
|
-
const require_schema = require("./server/schema.cjs");
|
|
5
|
-
const require_routes = require("./server/routes.cjs");
|
|
6
|
-
exports.DAILY_EVENTS = require_schema.DAILY_EVENTS;
|
|
7
|
-
exports.EVENT_BODY_MAX_BYTES = require_eventInput.EVENT_BODY_MAX_BYTES;
|
|
8
|
-
exports.INSIGHTS_ROUTES = require_routes.INSIGHTS_ROUTES;
|
|
9
|
-
exports.InsightsBadRequestError = require_errors.InsightsBadRequestError;
|
package/dist/internal.d.cts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InsightsBadRequestError } from "./server/errors.cjs";
|
|
2
|
-
import { EVENT_BODY_MAX_BYTES } from "./server/eventInput.cjs";
|
|
3
|
-
import { INSIGHTS_ROUTES } from "./server/routes.cjs";
|
|
4
|
-
import { DAILY_EVENTS } from "./server/schema.cjs";
|
|
5
|
-
export { DAILY_EVENTS, EVENT_BODY_MAX_BYTES, INSIGHTS_ROUTES, InsightsBadRequestError };
|
package/dist/internal.d.mts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InsightsBadRequestError } from "./server/errors.mjs";
|
|
2
|
-
import { EVENT_BODY_MAX_BYTES } from "./server/eventInput.mjs";
|
|
3
|
-
import { INSIGHTS_ROUTES } from "./server/routes.mjs";
|
|
4
|
-
import { DAILY_EVENTS } from "./server/schema.mjs";
|
|
5
|
-
export { DAILY_EVENTS, EVENT_BODY_MAX_BYTES, INSIGHTS_ROUTES, InsightsBadRequestError };
|
package/dist/internal.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InsightsBadRequestError } from "./server/errors.mjs";
|
|
2
|
-
import { EVENT_BODY_MAX_BYTES } from "./server/eventInput.mjs";
|
|
3
|
-
import { DAILY_EVENTS } from "./server/schema.mjs";
|
|
4
|
-
import { INSIGHTS_ROUTES } from "./server/routes.mjs";
|
|
5
|
-
export { DAILY_EVENTS, EVENT_BODY_MAX_BYTES, INSIGHTS_ROUTES, InsightsBadRequestError };
|
package/dist/server/routes.d.cts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "./types.cjs";
|
|
2
|
-
//#region src/server/routes.d.ts
|
|
3
|
-
/** Every Insights route: where it mounts, and the handler it runs. */
|
|
4
|
-
declare const INSIGHTS_ROUTES: readonly [{
|
|
5
|
-
readonly access: "client";
|
|
6
|
-
readonly method: "POST";
|
|
7
|
-
readonly path: "/events";
|
|
8
|
-
readonly handler: "appendBundleEvent";
|
|
9
|
-
}, {
|
|
10
|
-
readonly access: "admin";
|
|
11
|
-
readonly method: "GET";
|
|
12
|
-
readonly path: "/events";
|
|
13
|
-
readonly handler: "listEvents";
|
|
14
|
-
}, {
|
|
15
|
-
readonly access: "admin";
|
|
16
|
-
readonly method: "GET";
|
|
17
|
-
readonly path: "/overview";
|
|
18
|
-
readonly handler: "getReportingOverview";
|
|
19
|
-
}, {
|
|
20
|
-
readonly access: "admin";
|
|
21
|
-
readonly method: "GET";
|
|
22
|
-
readonly path: "/installations";
|
|
23
|
-
readonly handler: "pageInstallationsByCurrentUserId";
|
|
24
|
-
}, {
|
|
25
|
-
readonly access: "admin";
|
|
26
|
-
readonly method: "GET";
|
|
27
|
-
readonly path: "/installations/:installId/events";
|
|
28
|
-
readonly handler: "listInstallationEvents";
|
|
29
|
-
}, {
|
|
30
|
-
readonly access: "admin";
|
|
31
|
-
readonly method: "GET";
|
|
32
|
-
readonly path: "/installations/:installId";
|
|
33
|
-
readonly handler: "getInstallation";
|
|
34
|
-
}];
|
|
35
|
-
//#endregion
|
|
36
|
-
export { INSIGHTS_ROUTES };
|
package/dist/server/routes.d.mts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import "./types.mjs";
|
|
2
|
-
//#region src/server/routes.d.ts
|
|
3
|
-
/** Every Insights route: where it mounts, and the handler it runs. */
|
|
4
|
-
declare const INSIGHTS_ROUTES: readonly [{
|
|
5
|
-
readonly access: "client";
|
|
6
|
-
readonly method: "POST";
|
|
7
|
-
readonly path: "/events";
|
|
8
|
-
readonly handler: "appendBundleEvent";
|
|
9
|
-
}, {
|
|
10
|
-
readonly access: "admin";
|
|
11
|
-
readonly method: "GET";
|
|
12
|
-
readonly path: "/events";
|
|
13
|
-
readonly handler: "listEvents";
|
|
14
|
-
}, {
|
|
15
|
-
readonly access: "admin";
|
|
16
|
-
readonly method: "GET";
|
|
17
|
-
readonly path: "/overview";
|
|
18
|
-
readonly handler: "getReportingOverview";
|
|
19
|
-
}, {
|
|
20
|
-
readonly access: "admin";
|
|
21
|
-
readonly method: "GET";
|
|
22
|
-
readonly path: "/installations";
|
|
23
|
-
readonly handler: "pageInstallationsByCurrentUserId";
|
|
24
|
-
}, {
|
|
25
|
-
readonly access: "admin";
|
|
26
|
-
readonly method: "GET";
|
|
27
|
-
readonly path: "/installations/:installId/events";
|
|
28
|
-
readonly handler: "listInstallationEvents";
|
|
29
|
-
}, {
|
|
30
|
-
readonly access: "admin";
|
|
31
|
-
readonly method: "GET";
|
|
32
|
-
readonly path: "/installations/:installId";
|
|
33
|
-
readonly handler: "getInstallation";
|
|
34
|
-
}];
|
|
35
|
-
//#endregion
|
|
36
|
-
export { INSIGHTS_ROUTES };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { DatabaseJsonObject, Platform } from "@hot-updater/plugin-core";
|
|
2
|
-
//#region src/server/eventRow.d.ts
|
|
3
|
-
/** Where an update failed, and what failed; open sets, `unknown` for any other value. */
|
|
4
|
-
type BundleEventFailureStage = "check" | "download" | "install" | "unknown";
|
|
5
|
-
type BundleEventFailureReason = "network" | "http" | "invalid_response" | "hash_mismatch" | "signature" | "patch" | "extract" | "storage" | "unknown";
|
|
6
|
-
/** An `UPDATE_FAILED` report's failure, as stored. */
|
|
7
|
-
type BundleEventFailure = DatabaseJsonObject & {
|
|
8
|
-
readonly stage: BundleEventFailureStage;
|
|
9
|
-
readonly reason: BundleEventFailureReason;
|
|
10
|
-
/** What the client was fetching or writing. */
|
|
11
|
-
readonly resource?: "catalog" | "artifact" | "manifest" | "file" | "patch" | "archive" | "unknown";
|
|
12
|
-
readonly http_status?: number;
|
|
13
|
-
/** How the connection failed, when it did. */
|
|
14
|
-
readonly transport?: "timeout" | "dns" | "tls" | "connection" | "offline" | "cancelled" | "unknown";
|
|
15
|
-
/** The storage origin's error code, such as `ExpiredToken`. */
|
|
16
|
-
readonly origin_code?: string;
|
|
17
|
-
/** Android's `ApplicationExitInfo` reason for the process before this one. */
|
|
18
|
-
readonly previous_process_exit?: string;
|
|
19
|
-
};
|
|
20
|
-
/** Ancillary report data; queryable identity and lifecycle fields stay on the row. */
|
|
21
|
-
type DatabaseBundleEventMetadata = DatabaseJsonObject & {
|
|
22
|
-
readonly cohort: string;
|
|
23
|
-
readonly update_strategy: "fingerprint" | "appVersion" | null;
|
|
24
|
-
readonly fingerprint_hash: string | null;
|
|
25
|
-
readonly sdk_version: string | null;
|
|
26
|
-
/** `UPDATE_FAILED`: what failed. */
|
|
27
|
-
readonly failure?: BundleEventFailure;
|
|
28
|
-
/** `UPDATE_DOWNLOADED`: how the bundle arrived. */
|
|
29
|
-
readonly delivery?: "patch" | "manifest" | "archive" | "unknown";
|
|
30
|
-
/** `UPDATE_DOWNLOADED`: a patch failed and the full files came instead. */
|
|
31
|
-
readonly patch_fallback?: boolean;
|
|
32
|
-
/** `RECOVERED`: Android's `ApplicationExitInfo` reason for the crashed process. */
|
|
33
|
-
readonly previous_process_exit?: string;
|
|
34
|
-
};
|
|
35
|
-
type BundleEventRowBase = {
|
|
36
|
-
readonly id: string;
|
|
37
|
-
readonly install_id: string;
|
|
38
|
-
readonly user_id: string | null;
|
|
39
|
-
readonly from_release_id: string | null;
|
|
40
|
-
readonly to_release_id: string | null;
|
|
41
|
-
readonly to_bundle_id: string;
|
|
42
|
-
readonly platform: Platform;
|
|
43
|
-
readonly app_version: string;
|
|
44
|
-
readonly channel: string;
|
|
45
|
-
readonly metadata: DatabaseBundleEventMetadata;
|
|
46
|
-
readonly received_at_ms: number;
|
|
47
|
-
};
|
|
48
|
-
type BundleEventRow = BundleEventRowBase & ({
|
|
49
|
-
readonly type: "UPDATE_DOWNLOADED";
|
|
50
|
-
readonly from_bundle_id: string;
|
|
51
|
-
} | {
|
|
52
|
-
readonly type: "UPDATE_APPLIED" | "RECOVERED";
|
|
53
|
-
readonly from_bundle_id: string;
|
|
54
|
-
} |
|
|
55
|
-
/** An update that failed: `from` is the running bundle, `to` the target (for a check, the running bundle). */
|
|
56
|
-
{
|
|
57
|
-
readonly type: "UPDATE_FAILED";
|
|
58
|
-
readonly from_bundle_id: string;
|
|
59
|
-
} | {
|
|
60
|
-
readonly type: "UNCHANGED";
|
|
61
|
-
readonly from_bundle_id: null;
|
|
62
|
-
});
|
|
63
|
-
//#endregion
|
|
64
|
-
export { BundleEventFailure, BundleEventFailureReason, BundleEventFailureStage, BundleEventRow, BundleEventRowBase, DatabaseBundleEventMetadata };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { expect } from "vitest";
|
|
2
|
-
//#region src/server/testing/expectInsightsIndex.ts
|
|
3
|
-
/** Allow committed secondary indexes to catch up; query failures still fail. */
|
|
4
|
-
const expectInsightsIndex = async (query, expected) => {
|
|
5
|
-
const deadline = Date.now() + 5e3;
|
|
6
|
-
for (;;) {
|
|
7
|
-
const actual = await query();
|
|
8
|
-
try {
|
|
9
|
-
expect(actual).toEqual(expected);
|
|
10
|
-
return;
|
|
11
|
-
} catch (error) {
|
|
12
|
-
if (Date.now() >= deadline) throw error;
|
|
13
|
-
}
|
|
14
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { expectInsightsIndex };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BundleEventRow } from "./eventRow.mjs";
|
|
2
|
-
//#region src/server/testing/fixtures.d.ts
|
|
3
|
-
/** An applied update from install `suffix`, received at `receivedAtMs`. */
|
|
4
|
-
declare const createBundleEventRowFixture: (suffix: string, receivedAtMs: number) => Extract<BundleEventRow, {
|
|
5
|
-
type: "UPDATE_APPLIED" | "RECOVERED";
|
|
6
|
-
}>;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { createBundleEventRowFixture };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//#region src/server/testing/fixtures.ts
|
|
2
|
-
const fixtureId = (suffix) => `00000000-0000-7000-8000-${suffix.padStart(12, "0")}`;
|
|
3
|
-
/** An applied update from install `suffix`, received at `receivedAtMs`. */
|
|
4
|
-
const createBundleEventRowFixture = (suffix, receivedAtMs) => ({
|
|
5
|
-
id: fixtureId(suffix),
|
|
6
|
-
type: "UPDATE_APPLIED",
|
|
7
|
-
install_id: `install-${suffix}`,
|
|
8
|
-
user_id: null,
|
|
9
|
-
metadata: {
|
|
10
|
-
cohort: "0",
|
|
11
|
-
update_strategy: "appVersion",
|
|
12
|
-
fingerprint_hash: null,
|
|
13
|
-
sdk_version: null
|
|
14
|
-
},
|
|
15
|
-
from_bundle_id: fixtureId(`${Number(suffix) + 1e3}`),
|
|
16
|
-
from_release_id: null,
|
|
17
|
-
to_bundle_id: fixtureId(`${Number(suffix) + 2e3}`),
|
|
18
|
-
to_release_id: null,
|
|
19
|
-
platform: "ios",
|
|
20
|
-
app_version: "1.0.0",
|
|
21
|
-
channel: "production",
|
|
22
|
-
received_at_ms: receivedAtMs
|
|
23
|
-
});
|
|
24
|
-
//#endregion
|
|
25
|
-
export { createBundleEventRowFixture };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { InsightsModel } from "./modelTypes.mjs";
|
|
2
|
-
import { DatabaseTestLifecycle, DatabaseTestState, HttpTestClient, HttpTestRequest } from "./types.mjs";
|
|
3
|
-
import { createBundleEventRowFixture } from "./fixtures.mjs";
|
|
4
|
-
import { setupInsightsHttpTestSuite } from "./setupInsightsHttpTestSuite.mjs";
|
|
5
|
-
import { setupInsightsModelTestSuite } from "./setupInsightsModelTestSuite.mjs";
|
|
6
|
-
//#region src/server/testing/index.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* The Insights plugin's tests, for `setupDatabaseTestSuite`'s `plugins`: its
|
|
9
|
-
* HTTP routes on the provider's server, which must run `insights()`, and
|
|
10
|
-
* with `createModel` its report contract on the provider's database, such as
|
|
11
|
-
* `(database) => createInsightsModel(createDatabasePluginApis(database,
|
|
12
|
-
* [insights()]).insights)`.
|
|
13
|
-
*/
|
|
14
|
-
declare const insightsTestSuite: <TDatabase = unknown>(options?: {
|
|
15
|
-
readonly createModel?: (database: TDatabase) => InsightsModel;
|
|
16
|
-
}) => {
|
|
17
|
-
name: string;
|
|
18
|
-
register: (context: {
|
|
19
|
-
readonly getClient: () => HttpTestClient;
|
|
20
|
-
readonly getDatabase: () => TDatabase;
|
|
21
|
-
}) => void;
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { type DatabaseTestLifecycle, type DatabaseTestState, type HttpTestClient, type HttpTestRequest, createBundleEventRowFixture, insightsTestSuite, setupInsightsHttpTestSuite, setupInsightsModelTestSuite };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createBundleEventRowFixture } from "./fixtures.mjs";
|
|
2
|
-
import { registerInsightsModelTests } from "./insightsModelTests.mjs";
|
|
3
|
-
import { setupInsightsHttpTestSuite } from "./setupInsightsHttpTestSuite.mjs";
|
|
4
|
-
import { setupInsightsModelTestSuite } from "./setupInsightsModelTestSuite.mjs";
|
|
5
|
-
import { describe } from "vitest";
|
|
6
|
-
//#region src/server/testing/index.ts
|
|
7
|
-
/**
|
|
8
|
-
* The Insights plugin's tests, for `setupDatabaseTestSuite`'s `plugins`: its
|
|
9
|
-
* HTTP routes on the provider's server, which must run `insights()`, and
|
|
10
|
-
* with `createModel` its report contract on the provider's database, such as
|
|
11
|
-
* `(database) => createInsightsModel(createDatabasePluginApis(database,
|
|
12
|
-
* [insights()]).insights)`.
|
|
13
|
-
*/
|
|
14
|
-
const insightsTestSuite = (options = {}) => ({
|
|
15
|
-
name: "Insights plugin",
|
|
16
|
-
register: (context) => {
|
|
17
|
-
setupInsightsHttpTestSuite({ getClient: context.getClient });
|
|
18
|
-
const { createModel } = options;
|
|
19
|
-
if (createModel !== void 0) describe("Insights model", () => {
|
|
20
|
-
registerInsightsModelTests({ getDatabase: () => createModel(context.getDatabase()) });
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
//#endregion
|
|
25
|
-
export { createBundleEventRowFixture, insightsTestSuite, setupInsightsHttpTestSuite, setupInsightsModelTestSuite };
|