@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/reads.cjs
CHANGED
|
@@ -2,7 +2,6 @@ require("./provider.cjs");
|
|
|
2
2
|
const require_schema = require("./schema.cjs");
|
|
3
3
|
const require_recordEvent = require("./recordEvent.cjs");
|
|
4
4
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
5
|
-
let _hot_updater_plugin_core_internal = require("@hot-updater/plugin-core/internal");
|
|
6
5
|
//#region src/server/reads.ts
|
|
7
6
|
const PAGE = 500;
|
|
8
7
|
const hourFloor = (ms) => ms - ms % require_schema.HOUR_MS;
|
|
@@ -365,7 +364,7 @@ const rangedMetrics = async (db, parts, users, range, days, hour) => {
|
|
|
365
364
|
downloads: total("downloads"),
|
|
366
365
|
launches: total("launches"),
|
|
367
366
|
failedLaunches: total("failed_launches"),
|
|
368
|
-
uniqueUsers: (0,
|
|
367
|
+
uniqueUsers: (0, _hot_updater_plugin_core.countDistinct)((0, _hot_updater_plugin_core.mergeDistinct)(sketches.map((row) => row[users.field]))),
|
|
369
368
|
series: [...series].sort(([left], [right]) => left - right).map(([startMs, point]) => ({
|
|
370
369
|
startMs,
|
|
371
370
|
...point
|
|
@@ -456,7 +455,7 @@ const getAppUsage = async (db, input, now, retention) => {
|
|
|
456
455
|
const points = [];
|
|
457
456
|
for (let start = timeRange.start; start < timeRange.end; start += intervalMs) points.push({
|
|
458
457
|
startMs: start,
|
|
459
|
-
installations: (0,
|
|
458
|
+
installations: (0, _hot_updater_plugin_core.countDistinct)((0, _hot_updater_plugin_core.mergeDistinct)(usage.filter((row) => row.bucket_start_ms >= start && row.bucket_start_ms < start + intervalMs).map((row) => row.activity_users)))
|
|
460
459
|
});
|
|
461
460
|
const versions = /* @__PURE__ */ new Map();
|
|
462
461
|
const platforms = /* @__PURE__ */ new Map();
|
|
@@ -481,7 +480,7 @@ const getAppUsage = async (db, input, now, retention) => {
|
|
|
481
480
|
const sortedVersions = byInstallations(versions);
|
|
482
481
|
return {
|
|
483
482
|
coverage: coverageOf(timeRange.start, kept[days ? "day" : "hour"]),
|
|
484
|
-
activeInstallations: (0,
|
|
483
|
+
activeInstallations: (0, _hot_updater_plugin_core.countDistinct)((0, _hot_updater_plugin_core.mergeDistinct)(usage.map((row) => row.activity_users))),
|
|
485
484
|
points,
|
|
486
485
|
appVersions: sortedVersions.map(({ name }) => name),
|
|
487
486
|
versions: sortedVersions,
|
|
@@ -494,9 +493,9 @@ const getAppUsage = async (db, input, now, retention) => {
|
|
|
494
493
|
const UPDATE_FAILURES_RANGE_MS = 30 * require_schema.DAY_MS;
|
|
495
494
|
const isRange = (range) => range === void 0 || Number.isSafeInteger(range.start) && Number.isSafeInteger(range.end) && range.start >= 0 && range.start < range.end && range.end - range.start <= UPDATE_FAILURES_RANGE_MS;
|
|
496
495
|
const isText = (value, maxLength) => typeof value === "string" && value.length > 0 && value.length <= maxLength;
|
|
497
|
-
const failed = (...rows) => (0,
|
|
496
|
+
const failed = (...rows) => (0, _hot_updater_plugin_core.countDistinct)((0, _hot_updater_plugin_core.mergeDistinct)(rows.flat().map((row) => row.failed_users)));
|
|
498
497
|
/** Entries of a count map, most first, then in key order. */
|
|
499
|
-
const mostFirst = (counts) => [...counts].sort(([leftKey, left], [rightKey, right]) => right.events - left.events || (0,
|
|
498
|
+
const mostFirst = (counts) => [...counts].sort(([leftKey, left], [rightKey, right]) => right.events - left.events || (0, _hot_updater_plugin_core.compareUtf8)(leftKey, rightKey)).map(([, entry]) => entry);
|
|
500
499
|
/** Failure rows as their breakdown, and recovery rows as exit reasons. */
|
|
501
500
|
const breakdownOf = (rows) => {
|
|
502
501
|
const failures = /* @__PURE__ */ new Map();
|
|
@@ -612,7 +611,7 @@ const getUpdateFailures = async (db, input, now, retention) => {
|
|
|
612
611
|
},
|
|
613
612
|
measuredAtMs: at,
|
|
614
613
|
failedUpdates: lifetime?.failed_updates ?? 0,
|
|
615
|
-
failedInstallations: (0,
|
|
614
|
+
failedInstallations: (0, _hot_updater_plugin_core.countDistinct)((0, _hot_updater_plugin_core.mergeDistinct)(sketches.rows.map((row) => row.failed_users))),
|
|
616
615
|
downloads: lifetime?.downloads ?? 0,
|
|
617
616
|
patchDownloads: lifetime?.patch_downloads ?? 0,
|
|
618
617
|
patchFallbacks: lifetime?.patch_fallbacks ?? 0
|
|
@@ -661,7 +660,7 @@ const getUpdateFailures = async (db, input, now, retention) => {
|
|
|
661
660
|
...days ? { checks: {
|
|
662
661
|
failures: failuresAt((stage) => stage === "check"),
|
|
663
662
|
failedInstallations: failed(checks),
|
|
664
|
-
activeInstallations: (0,
|
|
663
|
+
activeInstallations: (0, _hot_updater_plugin_core.countDistinct)((0, _hot_updater_plugin_core.mergeDistinct)(active.map((row) => row.activity_users)))
|
|
665
664
|
} } : {},
|
|
666
665
|
breakdown,
|
|
667
666
|
recoveries: {
|
package/dist/server/reads.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./eventRow.cjs";
|
|
2
2
|
import { InsightsCoverage, InsightsTimeRange } from "./modelTypes.cjs";
|
|
3
|
-
import { HotUpdaterDatabase } from "@hot-updater/plugin-core
|
|
3
|
+
import { HotUpdaterDatabase } from "@hot-updater/plugin-core";
|
|
4
4
|
//#region src/server/reads.d.ts
|
|
5
5
|
interface InsightsUpdateFailuresInput {
|
|
6
6
|
readonly platform: "ios" | "android";
|
package/dist/server/reads.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./eventRow.mjs";
|
|
2
2
|
import { InsightsCoverage, InsightsTimeRange } from "./modelTypes.mjs";
|
|
3
|
-
import { HotUpdaterDatabase } from "@hot-updater/plugin-core
|
|
3
|
+
import { HotUpdaterDatabase } from "@hot-updater/plugin-core";
|
|
4
4
|
//#region src/server/reads.d.ts
|
|
5
5
|
interface InsightsUpdateFailuresInput {
|
|
6
6
|
readonly platform: "ios" | "android";
|
package/dist/server/reads.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import "./provider.mjs";
|
|
2
2
|
import { DAILY_EVENTS, DAY_MS, HOUR_MS } from "./schema.mjs";
|
|
3
3
|
import { PAIR_FIELD, bundlePairKey, insightsIdentity } from "./recordEvent.mjs";
|
|
4
|
-
import { DatabaseAdapterInputError } from "@hot-updater/plugin-core";
|
|
5
|
-
import { compareUtf8, countDistinct, mergeDistinct } from "@hot-updater/plugin-core/internal";
|
|
4
|
+
import { DatabaseAdapterInputError, compareUtf8, countDistinct, mergeDistinct } from "@hot-updater/plugin-core";
|
|
6
5
|
//#region src/server/reads.ts
|
|
7
6
|
const PAGE = 500;
|
|
8
7
|
const hourFloor = (ms) => ms - ms % HOUR_MS;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_contract = require("./contract.cjs");
|
|
2
2
|
const require_overview = require("./overview.cjs");
|
|
3
3
|
const require_schema = require("./schema.cjs");
|
|
4
|
-
let
|
|
4
|
+
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
5
5
|
//#region src/server/recordEvent.ts
|
|
6
6
|
const hourOf = (ms) => ms - ms % require_schema.HOUR_MS;
|
|
7
7
|
const dayOf = (ms) => ms - ms % require_schema.DAY_MS;
|
|
@@ -120,8 +120,8 @@ const countEvent = (tx, event) => {
|
|
|
120
120
|
};
|
|
121
121
|
if (Object.keys(counters).length > 0) tx.aggregate(models.counters, key, counters, { shardBy });
|
|
122
122
|
const sketches = {
|
|
123
|
-
...delta.launchIdentity === void 0 || parts.scopeKind === "channel" ? {} : { launch_users: (0,
|
|
124
|
-
...delta.activityIdentity === void 0 ? {} : { activity_users: (0,
|
|
123
|
+
...delta.launchIdentity === void 0 || parts.scopeKind === "channel" ? {} : { launch_users: (0, _hot_updater_plugin_core.addDistinct)(null, delta.launchIdentity) },
|
|
124
|
+
...delta.activityIdentity === void 0 ? {} : { activity_users: (0, _hot_updater_plugin_core.addDistinct)(null, delta.activityIdentity) }
|
|
125
125
|
};
|
|
126
126
|
if (models.sketches !== void 0 && Object.keys(sketches).length > 0) tx.aggregate(models.sketches, key, sketches, { shardBy });
|
|
127
127
|
}
|
|
@@ -183,7 +183,7 @@ const countFailure = (tx, event) => {
|
|
|
183
183
|
releaseKind: "all",
|
|
184
184
|
releaseId: ""
|
|
185
185
|
};
|
|
186
|
-
const users = { failed_users: (0,
|
|
186
|
+
const users = { failed_users: (0, _hot_updater_plugin_core.addDistinct)(null, event.install_id) };
|
|
187
187
|
for (const [periodKind, bucket] of [["hour", hour], ["day", dayOf(event.received_at_ms)]]) {
|
|
188
188
|
const identity = insightsIdentity({
|
|
189
189
|
...channel,
|
|
@@ -257,7 +257,7 @@ const countExit = (tx, event) => {
|
|
|
257
257
|
detail: ""
|
|
258
258
|
}, { events: 1 }, { shardBy: event.install_id });
|
|
259
259
|
};
|
|
260
|
-
const isNewer = (event, head) => event.received_at_ms !== head.received_at_ms ? event.received_at_ms > head.received_at_ms : (0,
|
|
260
|
+
const isNewer = (event, head) => event.received_at_ms !== head.received_at_ms ? event.received_at_ms > head.received_at_ms : (0, _hot_updater_plugin_core.compareUtf8)(event.id, head.id) > 0;
|
|
261
261
|
/** What an UNCHANGED report must share with its installation's head to repeat it. */
|
|
262
262
|
const REPEATED_FIELDS = [
|
|
263
263
|
"channel",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./eventRow.cjs";
|
|
2
2
|
import { InsightsOverviewIdentity } from "./overview.cjs";
|
|
3
|
-
import { HotUpdaterDatabase } from "@hot-updater/plugin-core
|
|
3
|
+
import { HotUpdaterDatabase } from "@hot-updater/plugin-core";
|
|
4
4
|
//#region src/server/recordEvent.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* An overview or sketch row's scope and period; day periods roll up channel
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./eventRow.mjs";
|
|
2
2
|
import { InsightsOverviewIdentity } from "./overview.mjs";
|
|
3
|
-
import { HotUpdaterDatabase } from "@hot-updater/plugin-core
|
|
3
|
+
import { HotUpdaterDatabase } from "@hot-updater/plugin-core";
|
|
4
4
|
//#region src/server/recordEvent.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* An overview or sketch row's scope and period; day periods roll up channel
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertBundleEventRow } from "./contract.mjs";
|
|
2
2
|
import { insightsKey, insightsOverviewDeltas, insightsOverviewId } from "./overview.mjs";
|
|
3
3
|
import { DAILY_EVENTS, DAY_MS, HOUR_MS, isFailedCheck } from "./schema.mjs";
|
|
4
|
-
import { addDistinct, compareUtf8 } from "@hot-updater/plugin-core
|
|
4
|
+
import { addDistinct, compareUtf8 } from "@hot-updater/plugin-core";
|
|
5
5
|
//#region src/server/recordEvent.ts
|
|
6
6
|
const hourOf = (ms) => ms - ms % HOUR_MS;
|
|
7
7
|
const dayOf = (ms) => ms - ms % DAY_MS;
|
package/dist/server/routes.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_errors = require("./errors.cjs");
|
|
2
2
|
const require_eventInput = require("./eventInput.cjs");
|
|
3
3
|
const require_queryInput = require("./queryInput.cjs");
|
|
4
|
-
let
|
|
4
|
+
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
5
5
|
//#region src/server/routes.ts
|
|
6
6
|
/** Seconds a client waits before it resends a request the busy database refused. */
|
|
7
7
|
const RETRY_AFTER_SECONDS = 5;
|
|
@@ -27,7 +27,7 @@ const run = async (operation) => {
|
|
|
27
27
|
} catch (error) {
|
|
28
28
|
if (error instanceof require_errors.InsightsBadRequestError) return json({ error: error.message }, 400);
|
|
29
29
|
if (error instanceof require_errors.InsightsPayloadTooLargeError) return json({ error: error.message }, 413);
|
|
30
|
-
if ((0,
|
|
30
|
+
if ((0, _hot_updater_plugin_core.isDatabaseBusyError)(error)) {
|
|
31
31
|
console.warn("[hot-updater] Insights answered 503: the database is busy.", error);
|
|
32
32
|
return json({ error: "Service unavailable" }, 503, { "retry-after": String(RETRY_AFTER_SECONDS) });
|
|
33
33
|
}
|
package/dist/server/routes.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InsightsBadRequestError, InsightsPayloadTooLargeError } from "./errors.mjs";
|
|
2
2
|
import { parseBundleEventRequest } from "./eventInput.mjs";
|
|
3
3
|
import { parseEventPageInput, parseReportingOverviewInput, parseUserInstallationPageInput } from "./queryInput.mjs";
|
|
4
|
-
import { isDatabaseBusyError } from "@hot-updater/plugin-core
|
|
4
|
+
import { isDatabaseBusyError } from "@hot-updater/plugin-core";
|
|
5
5
|
//#region src/server/routes.ts
|
|
6
6
|
/** Seconds a client waits before it resends a request the busy database refused. */
|
|
7
7
|
const RETRY_AFTER_SECONDS = 5;
|
package/dist/server/schema.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let
|
|
1
|
+
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
2
2
|
//#region src/server/schema.ts
|
|
3
3
|
const HOUR_MS = 36e5;
|
|
4
4
|
const DAY_MS = 864e5;
|
|
@@ -23,7 +23,7 @@ const isFailedCheck = (row) => row.type === "UPDATE_FAILED" && row.metadata?.fai
|
|
|
23
23
|
* report counts as a launch and moves its installation's head, but no list
|
|
24
24
|
* shows it, so no row keeps it.
|
|
25
25
|
*/
|
|
26
|
-
const bundleEvents = (days) => (0,
|
|
26
|
+
const bundleEvents = (days) => (0, _hot_updater_plugin_core.defineTable)({
|
|
27
27
|
id: {
|
|
28
28
|
type: "string",
|
|
29
29
|
maxLength: 36
|
|
@@ -130,7 +130,7 @@ const bundleEvents = (days) => (0, _hot_updater_plugin_core_server_plugin.define
|
|
|
130
130
|
* Its gauges count it in the UTC day of that event. An update failure moves
|
|
131
131
|
* nothing, so no head holds one.
|
|
132
132
|
*/
|
|
133
|
-
const bundleEventHeads = (days) => (0,
|
|
133
|
+
const bundleEventHeads = (days) => (0, _hot_updater_plugin_core.defineTable)({
|
|
134
134
|
install_id: {
|
|
135
135
|
type: "string",
|
|
136
136
|
maxLength: 255
|
|
@@ -222,7 +222,7 @@ const window = {
|
|
|
222
222
|
* no breakdown row outlives the raw period; windowed reads sum
|
|
223
223
|
* `insights_failures` instead.
|
|
224
224
|
*/
|
|
225
|
-
const counters = (retention) => (0,
|
|
225
|
+
const counters = (retention) => (0, _hot_updater_plugin_core.defineAggregate)(identityFields, {
|
|
226
226
|
key: ["identity", "bucket_start_ms"],
|
|
227
227
|
counters: [
|
|
228
228
|
"downloads",
|
|
@@ -242,7 +242,7 @@ const counters = (retention) => (0, _hot_updater_plugin_core_server_plugin.defin
|
|
|
242
242
|
* identity (`failure` and `check` scopes) keep only `failed_users`, so a
|
|
243
243
|
* release's launch rows never grow by a failure's registers.
|
|
244
244
|
*/
|
|
245
|
-
const sketches = (retention) => (0,
|
|
245
|
+
const sketches = (retention) => (0, _hot_updater_plugin_core.defineAggregate)(identityFields, {
|
|
246
246
|
key: ["identity", "bucket_start_ms"],
|
|
247
247
|
distinct: [
|
|
248
248
|
"launch_users",
|
|
@@ -255,7 +255,7 @@ const sketches = (retention) => (0, _hot_updater_plugin_core_server_plugin.defin
|
|
|
255
255
|
retention
|
|
256
256
|
});
|
|
257
257
|
/** Installations whose update to a release failed, since its first failure: kept, at bucket 0. */
|
|
258
|
-
const lifetimeSketches = () => (0,
|
|
258
|
+
const lifetimeSketches = () => (0, _hot_updater_plugin_core.defineAggregate)(identityFields, {
|
|
259
259
|
key: ["identity", "bucket_start_ms"],
|
|
260
260
|
distinct: ["failed_users"],
|
|
261
261
|
shards: SKETCH_SHARDS,
|
|
@@ -272,7 +272,7 @@ const lifetimeSketches = () => (0, _hot_updater_plugin_core_server_plugin.define
|
|
|
272
272
|
* `launch` and its reason the exit reason, with an empty detail. Every index
|
|
273
273
|
* is in key order, so its counters stay blind increments.
|
|
274
274
|
*/
|
|
275
|
-
const insightsFailures = (retention) => (0,
|
|
275
|
+
const insightsFailures = (retention) => (0, _hot_updater_plugin_core.defineAggregate)({
|
|
276
276
|
platform: {
|
|
277
277
|
type: "string",
|
|
278
278
|
maxLength: 16
|
|
@@ -315,7 +315,7 @@ const insightsFailures = (retention) => (0, _hot_updater_plugin_core_server_plug
|
|
|
315
315
|
retention
|
|
316
316
|
});
|
|
317
317
|
/** Installations counted in the UTC day of their latest event, so reads sum whole UTC days. */
|
|
318
|
-
const insightsDistribution = (retention) => (0,
|
|
318
|
+
const insightsDistribution = (retention) => (0, _hot_updater_plugin_core.defineAggregate)({
|
|
319
319
|
channel: { type: "string" },
|
|
320
320
|
platform: {
|
|
321
321
|
type: "string",
|
|
@@ -355,7 +355,7 @@ const insightsDistribution = (retention) => (0, _hot_updater_plugin_core_server_
|
|
|
355
355
|
retention
|
|
356
356
|
});
|
|
357
357
|
/** Latest events by the bundle they came from or went to, bucketed like the distribution. */
|
|
358
|
-
const insightsLatestByBundle = (retention) => (0,
|
|
358
|
+
const insightsLatestByBundle = (retention) => (0, _hot_updater_plugin_core.defineAggregate)({
|
|
359
359
|
platform: {
|
|
360
360
|
type: "string",
|
|
361
361
|
maxLength: 16
|
|
@@ -404,7 +404,7 @@ const insightsLatestByBundle = (retention) => (0, _hot_updater_plugin_core_serve
|
|
|
404
404
|
* day (`DAILY_EVENTS`). Bundle counts sum the hourly rows, and event lists
|
|
405
405
|
* read either to skip days without events.
|
|
406
406
|
*/
|
|
407
|
-
const insightsOutcomes = (retention) => (0,
|
|
407
|
+
const insightsOutcomes = (retention) => (0, _hot_updater_plugin_core.defineAggregate)({
|
|
408
408
|
platform: {
|
|
409
409
|
type: "string",
|
|
410
410
|
maxLength: 16
|
package/dist/server/schema.d.cts
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 };
|