@hot-updater/plugin-insights 1.2.0-rc.57 → 1.2.0-rc.59
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/adminReads.cjs +5 -4
- package/dist/server/adminReads.mjs +5 -4
- package/dist/server/backfill.cjs +117 -0
- package/dist/server/backfill.d.cts +9 -0
- package/dist/server/backfill.d.mts +9 -0
- package/dist/server/backfill.mjs +117 -0
- package/dist/server/contract.cjs +18 -14
- package/dist/server/contract.mjs +18 -14
- package/dist/server/domain.d.cts +20 -2
- package/dist/server/domain.d.mts +20 -2
- package/dist/server/index.cjs +12 -1
- package/dist/server/index.d.cts +24 -2
- package/dist/server/index.d.mts +24 -2
- package/dist/server/index.mjs +13 -3
- package/dist/server/model.cjs +1 -0
- package/dist/server/model.mjs +1 -0
- package/dist/server/modelTypes.d.cts +32 -13
- package/dist/server/modelTypes.d.mts +32 -13
- package/dist/server/provider.cjs +24 -35
- package/dist/server/provider.mjs +24 -35
- package/dist/server/queryInput.cjs +4 -4
- package/dist/server/queryInput.mjs +4 -4
- package/dist/server/reads.cjs +41 -44
- package/dist/server/reads.mjs +42 -46
- package/dist/server/recordEvent.cjs +8 -44
- package/dist/server/recordEvent.mjs +10 -44
- package/dist/server/routes.cjs +2 -1
- package/dist/server/routes.mjs +2 -1
- package/dist/server/schema.cjs +30 -9
- package/dist/server/schema.mjs +30 -10
- package/dist/server/types.d.cts +2 -1
- package/dist/server/types.d.mts +2 -1
- package/dist/server/wire.cjs +34 -0
- package/dist/server/wire.d.cts +13 -0
- package/dist/server/wire.d.mts +13 -0
- package/dist/server/wire.mjs +32 -0
- package/package.json +4 -4
package/dist/server/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BundleEventFailure, BundleEventFailureReason, BundleEventFailureStage, BundleEventRow, BundleEventRowBase, DatabaseBundleEventMetadata } from "./eventRow.mjs";
|
|
2
|
-
import { InsightsBundleEventFilter, InsightsCountEventSeriesInput, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsEventSeriesPoint, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference } from "./modelTypes.mjs";
|
|
2
|
+
import { InsightsBundleEventFilter, InsightsCountEventSeriesInput, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCountReleaseInstallationsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsEventSeriesPoint, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsReleaseInstallations, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference } from "./modelTypes.mjs";
|
|
3
3
|
import { DEFAULT_INSIGHTS_RETENTION, InsightsRetention, InsightsSchema, createInsightsSchema, insightsSchema } from "./schema.mjs";
|
|
4
4
|
import { InsightsFailureBreakdown, InsightsUpdateFailures, InsightsUpdateFailuresInput } from "./reads.mjs";
|
|
5
|
+
import { ReleaseRefBackfill } from "./backfill.mjs";
|
|
5
6
|
import { ActiveInstallationWindow, BundleEventFailureInput, CreateBundleEventRequest, CreateBundleEventRequestBase, CursorPage, EventCursorPage, EventHistoryChange, EventHistoryRow, InsightsBundleSelection, InsightsCountMeasurement, InsightsHttpResponse, InstallationHistoryRow, InstallationRow, ReportingOverview } from "./domain.mjs";
|
|
6
7
|
import { InsightsEventPageInput, InsightsInstallationEventPageInput, InsightsProvider, InsightsUserInstallationPageInput } from "./types.mjs";
|
|
7
8
|
import { InsightsAdminReadsOptions, InsightsReads, createInsightsAdminReads, createInsightsReads } from "./adminReads.mjs";
|
|
@@ -9,6 +10,7 @@ import { InsightsBadRequestError } from "./errors.mjs";
|
|
|
9
10
|
import { createInsightsModel } from "./model.mjs";
|
|
10
11
|
import { createInsightsProvider } from "./provider.mjs";
|
|
11
12
|
import { InsightsIdentityParts, insightsIdentity } from "./recordEvent.mjs";
|
|
13
|
+
import { WireReportingOverview, toWireOverview } from "./wire.mjs";
|
|
12
14
|
import { HotUpdaterDatabase, PluginEndpoint } from "@hot-updater/plugin-core";
|
|
13
15
|
//#region src/server/index.d.ts
|
|
14
16
|
declare const createInsightsApi: (db: HotUpdaterDatabase<InsightsSchema>, now: () => number, retention: InsightsRetention) => {
|
|
@@ -19,12 +21,22 @@ declare const createInsightsApi: (db: HotUpdaterDatabase<InsightsSchema>, now: (
|
|
|
19
21
|
listEvents: (input: InsightsListEventsInput) => Promise<readonly BundleEventRow[]>;
|
|
20
22
|
findLatestEvents: (input: InsightsFindLatestEventsInput) => Promise<readonly BundleEventRow[]>;
|
|
21
23
|
countLatestEvents: (input: InsightsCountLatestEventsInput) => Promise<number>;
|
|
24
|
+
countReleaseInstallations: (input: InsightsCountReleaseInstallationsInput) => Promise<InsightsReleaseInstallations>;
|
|
22
25
|
countEvents: (input: InsightsCountEventsInput) => Promise<number>;
|
|
23
26
|
countEventSeries: (input: InsightsCountEventSeriesInput) => Promise<readonly InsightsEventSeriesPoint[]>;
|
|
24
27
|
getReleaseActivity: (input: InsightsGetReleaseActivityInput) => Promise<InsightsGetReleaseActivityResult>;
|
|
25
28
|
getAppUsage: (input: InsightsGetAppUsageInput) => Promise<InsightsGetAppUsageResult>;
|
|
26
29
|
/** A release's or a channel's update failures, and their breakdown over a time range. */
|
|
27
30
|
getUpdateFailures: (input: InsightsUpdateFailuresInput) => Promise<InsightsUpdateFailures>;
|
|
31
|
+
/**
|
|
32
|
+
* Moves the stored events a 1.1 server keyed by artifact, and their
|
|
33
|
+
* outcome counts, to their release, reading every stored event of the
|
|
34
|
+
* raw period: `hot-updater db migrate` and `hot-updater init` run it once
|
|
35
|
+
* a database, and an interrupted run can run again.
|
|
36
|
+
*/
|
|
37
|
+
backfillReleaseRefs: (options?: {
|
|
38
|
+
readonly dryRun?: boolean;
|
|
39
|
+
}) => Promise<ReleaseRefBackfill>;
|
|
28
40
|
};
|
|
29
41
|
type InsightsApi = ReturnType<typeof createInsightsApi>;
|
|
30
42
|
interface InsightsOptions {
|
|
@@ -413,14 +425,24 @@ declare const insights: (options?: InsightsOptions) => import("@hot-updater/plug
|
|
|
413
425
|
listEvents: (input: InsightsListEventsInput) => Promise<readonly BundleEventRow[]>;
|
|
414
426
|
findLatestEvents: (input: InsightsFindLatestEventsInput) => Promise<readonly BundleEventRow[]>;
|
|
415
427
|
countLatestEvents: (input: InsightsCountLatestEventsInput) => Promise<number>;
|
|
428
|
+
countReleaseInstallations: (input: InsightsCountReleaseInstallationsInput) => Promise<InsightsReleaseInstallations>;
|
|
416
429
|
countEvents: (input: InsightsCountEventsInput) => Promise<number>;
|
|
417
430
|
countEventSeries: (input: InsightsCountEventSeriesInput) => Promise<readonly InsightsEventSeriesPoint[]>;
|
|
418
431
|
getReleaseActivity: (input: InsightsGetReleaseActivityInput) => Promise<InsightsGetReleaseActivityResult>;
|
|
419
432
|
getAppUsage: (input: InsightsGetAppUsageInput) => Promise<InsightsGetAppUsageResult>;
|
|
420
433
|
/** A release's or a channel's update failures, and their breakdown over a time range. */
|
|
421
434
|
getUpdateFailures: (input: InsightsUpdateFailuresInput) => Promise<InsightsUpdateFailures>;
|
|
435
|
+
/**
|
|
436
|
+
* Moves the stored events a 1.1 server keyed by artifact, and their
|
|
437
|
+
* outcome counts, to their release, reading every stored event of the
|
|
438
|
+
* raw period: `hot-updater db migrate` and `hot-updater init` run it once
|
|
439
|
+
* a database, and an interrupted run can run again.
|
|
440
|
+
*/
|
|
441
|
+
backfillReleaseRefs: (options?: {
|
|
442
|
+
readonly dryRun?: boolean;
|
|
443
|
+
}) => Promise<ReleaseRefBackfill>;
|
|
422
444
|
};
|
|
423
445
|
endpoints: PluginEndpoint[];
|
|
424
446
|
}, {}>;
|
|
425
447
|
//#endregion
|
|
426
|
-
export { type ActiveInstallationWindow, type BundleEventFailure, type BundleEventFailureInput, type BundleEventFailureReason, type BundleEventFailureStage, type BundleEventRow, type BundleEventRowBase, type CreateBundleEventRequest, type CreateBundleEventRequestBase, type CursorPage, DEFAULT_INSIGHTS_RETENTION, type DatabaseBundleEventMetadata, type EventCursorPage, type EventHistoryChange, type EventHistoryRow, type InsightsAdminReadsOptions, InsightsApi, InsightsBadRequestError, type InsightsBundleEventFilter, type InsightsBundleSelection, type InsightsCountEventSeriesInput, type InsightsCountEventsInput, type InsightsCountLatestEventsInput, type InsightsCountMeasurement, type InsightsCoverage, type InsightsEventCursor, type InsightsEventFilter, type InsightsEventPageInput, type InsightsEventSeriesPoint, type InsightsFailureBreakdown, type InsightsFindLatestEventsInput, type InsightsGetAppUsageInput, type InsightsGetAppUsageResult, type InsightsGetReleaseActivityInput, type InsightsGetReleaseActivityResult, type InsightsHttpResponse, type InsightsIdentityParts, type InsightsInstallationEventPageInput, type InsightsListEventsInput, type InsightsModel, InsightsOptions, type InsightsProvider, type InsightsReads, type InsightsRecordEventInput, type InsightsRetention, type InsightsSchema, type InsightsScope, type InsightsTimeRange, type InsightsUpdateFailures, type InsightsUpdateFailuresInput, type InsightsUserInstallationPageInput, type InstallationHistoryRow, type InstallationRow, type ReleaseActivityMetrics, type ReleaseReference, type ReportingOverview, createInsightsAdminReads, createInsightsModel, createInsightsProvider, createInsightsReads, createInsightsSchema, insights, insightsIdentity, insightsSchema };
|
|
448
|
+
export { type ActiveInstallationWindow, type BundleEventFailure, type BundleEventFailureInput, type BundleEventFailureReason, type BundleEventFailureStage, type BundleEventRow, type BundleEventRowBase, type CreateBundleEventRequest, type CreateBundleEventRequestBase, type CursorPage, DEFAULT_INSIGHTS_RETENTION, type DatabaseBundleEventMetadata, type EventCursorPage, type EventHistoryChange, type EventHistoryRow, type InsightsAdminReadsOptions, InsightsApi, InsightsBadRequestError, type InsightsBundleEventFilter, type InsightsBundleSelection, type InsightsCountEventSeriesInput, type InsightsCountEventsInput, type InsightsCountLatestEventsInput, type InsightsCountMeasurement, type InsightsCountReleaseInstallationsInput, type InsightsCoverage, type InsightsEventCursor, type InsightsEventFilter, type InsightsEventPageInput, type InsightsEventSeriesPoint, type InsightsFailureBreakdown, type InsightsFindLatestEventsInput, type InsightsGetAppUsageInput, type InsightsGetAppUsageResult, type InsightsGetReleaseActivityInput, type InsightsGetReleaseActivityResult, type InsightsHttpResponse, type InsightsIdentityParts, type InsightsInstallationEventPageInput, type InsightsListEventsInput, type InsightsModel, InsightsOptions, type InsightsProvider, type InsightsReads, type InsightsRecordEventInput, type InsightsReleaseInstallations, type InsightsRetention, type InsightsSchema, type InsightsScope, type InsightsTimeRange, type InsightsUpdateFailures, type InsightsUpdateFailuresInput, type InsightsUserInstallationPageInput, type InstallationHistoryRow, type InstallationRow, type ReleaseActivityMetrics, type ReleaseRefBackfill, type ReleaseReference, type ReportingOverview, type WireReportingOverview, createInsightsAdminReads, createInsightsModel, createInsightsProvider, createInsightsReads, createInsightsSchema, insights, insightsIdentity, insightsSchema, toWireOverview };
|
package/dist/server/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { DEFAULT_INSIGHTS_RETENTION, createInsightsSchema, insightsSchema } from "./schema.mjs";
|
|
2
|
+
import { backfillReleaseRefs } from "./backfill.mjs";
|
|
2
3
|
import { createInsightsModel } from "./model.mjs";
|
|
3
4
|
import { markOfficial } from "./official.mjs";
|
|
4
5
|
import { InsightsBadRequestError } from "./errors.mjs";
|
|
5
6
|
import { createInsightsProvider } from "./provider.mjs";
|
|
6
7
|
import { insightsIdentity, recordEvent } from "./recordEvent.mjs";
|
|
7
|
-
import { countEventSeries, countEvents, countLatestEvents, findLatestEvents, getAppUsage, getReleaseActivity, getUpdateFailures, listEvents } from "./reads.mjs";
|
|
8
|
+
import { countEventSeries, countEvents, countLatestEvents, countReleaseInstallations, findLatestEvents, getAppUsage, getReleaseActivity, getUpdateFailures, listEvents } from "./reads.mjs";
|
|
9
|
+
import { toWireOverview } from "./wire.mjs";
|
|
8
10
|
import { INSIGHTS_ROUTES, createInsightsRouteHandlers } from "./routes.mjs";
|
|
9
11
|
import { createInsightsAdminReads, createInsightsReads } from "./adminReads.mjs";
|
|
10
12
|
import { DatabaseAdapterInputError, HotUpdaterConfigError, definePlugin, isDatabaseBusyError } from "@hot-updater/plugin-core";
|
|
@@ -17,12 +19,20 @@ const createInsightsApi = (db, now, retention) => ({
|
|
|
17
19
|
listEvents: (input) => listEvents(db, input),
|
|
18
20
|
findLatestEvents: (input) => findLatestEvents(db, input),
|
|
19
21
|
countLatestEvents: (input) => countLatestEvents(db, input),
|
|
22
|
+
countReleaseInstallations: (input) => countReleaseInstallations(db, input),
|
|
20
23
|
countEvents: (input) => countEvents(db, input),
|
|
21
24
|
countEventSeries: (input) => countEventSeries(db, input),
|
|
22
25
|
getReleaseActivity: (input) => getReleaseActivity(db, input, now),
|
|
23
26
|
getAppUsage: (input) => getAppUsage(db, input, now, retention),
|
|
24
27
|
/** A release's or a channel's update failures, and their breakdown over a time range. */
|
|
25
|
-
getUpdateFailures: (input) => getUpdateFailures(db, input, now, retention)
|
|
28
|
+
getUpdateFailures: (input) => getUpdateFailures(db, input, now, retention),
|
|
29
|
+
/**
|
|
30
|
+
* Moves the stored events a 1.1 server keyed by artifact, and their
|
|
31
|
+
* outcome counts, to their release, reading every stored event of the
|
|
32
|
+
* raw period: `hot-updater db migrate` and `hot-updater init` run it once
|
|
33
|
+
* a database, and an interrupted run can run again.
|
|
34
|
+
*/
|
|
35
|
+
backfillReleaseRefs: (options) => backfillReleaseRefs(db, now, retention, options)
|
|
26
36
|
});
|
|
27
37
|
/** `GET /failures`'s query: a scope, an optional release, and a time range or none. */
|
|
28
38
|
const readFailuresQuery = (url) => {
|
|
@@ -120,4 +130,4 @@ const insights = (options = {}) => {
|
|
|
120
130
|
return markOfficial(plugin);
|
|
121
131
|
};
|
|
122
132
|
//#endregion
|
|
123
|
-
export { DEFAULT_INSIGHTS_RETENTION, InsightsBadRequestError, createInsightsAdminReads, createInsightsModel, createInsightsProvider, createInsightsReads, createInsightsSchema, insights, insightsIdentity, insightsSchema };
|
|
133
|
+
export { DEFAULT_INSIGHTS_RETENTION, InsightsBadRequestError, createInsightsAdminReads, createInsightsModel, createInsightsProvider, createInsightsReads, createInsightsSchema, insights, insightsIdentity, insightsSchema, toWireOverview };
|
package/dist/server/model.cjs
CHANGED
|
@@ -9,6 +9,7 @@ const createInsightsModel = (api) => require_contract.createValidatedInsightsMod
|
|
|
9
9
|
listEvents: api.listEvents,
|
|
10
10
|
findLatestEvents: api.findLatestEvents,
|
|
11
11
|
countLatestEvents: api.countLatestEvents,
|
|
12
|
+
countReleaseInstallations: api.countReleaseInstallations,
|
|
12
13
|
countEvents: api.countEvents,
|
|
13
14
|
countEventSeries: api.countEventSeries,
|
|
14
15
|
getReleaseActivity: api.getReleaseActivity,
|
package/dist/server/model.mjs
CHANGED
|
@@ -9,6 +9,7 @@ const createInsightsModel = (api) => createValidatedInsightsModel({
|
|
|
9
9
|
listEvents: api.listEvents,
|
|
10
10
|
findLatestEvents: api.findLatestEvents,
|
|
11
11
|
countLatestEvents: api.countLatestEvents,
|
|
12
|
+
countReleaseInstallations: api.countReleaseInstallations,
|
|
12
13
|
countEvents: api.countEvents,
|
|
13
14
|
countEventSeries: api.countEventSeries,
|
|
14
15
|
getReleaseActivity: api.getReleaseActivity,
|
|
@@ -9,16 +9,18 @@ interface InsightsScope {
|
|
|
9
9
|
readonly channel: string;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Raw event predicates; recovery is attributed to the source
|
|
13
|
-
* UNCHANGED filter matches the kept rows that moved an
|
|
14
|
-
*
|
|
12
|
+
* Raw event predicates, by release; recovery is attributed to the source
|
|
13
|
+
* release. An UNCHANGED filter matches the kept rows that moved an
|
|
14
|
+
* installation to the release without an apply report. An event that names
|
|
15
|
+
* no release on that side, such as one from the built-in bundle, matches by
|
|
16
|
+
* the bundle ID it reports instead.
|
|
15
17
|
*/
|
|
16
18
|
type InsightsBundleEventFilter = InsightsScope & ({
|
|
17
19
|
readonly type: "RECOVERED";
|
|
18
|
-
readonly
|
|
20
|
+
readonly fromReleaseId: string;
|
|
19
21
|
} | {
|
|
20
22
|
readonly type: "UPDATE_DOWNLOADED" | "UPDATE_APPLIED" | "UPDATE_FAILED" | "UNCHANGED";
|
|
21
|
-
readonly
|
|
23
|
+
readonly toReleaseId: string;
|
|
22
24
|
});
|
|
23
25
|
type InsightsEventFilter = {
|
|
24
26
|
readonly kind: "all";
|
|
@@ -48,12 +50,24 @@ type InsightsFindLatestEventsInput = {
|
|
|
48
50
|
interface InsightsCountLatestEventsInput extends InsightsScope {
|
|
49
51
|
/** A UTC day's start: latest events are counted by the day they fall in. */
|
|
50
52
|
readonly sinceMs: number;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
}
|
|
54
|
+
interface InsightsCountReleaseInstallationsInput extends InsightsCountLatestEventsInput {
|
|
55
|
+
/**
|
|
56
|
+
* The release whose installations to count: those whose latest event
|
|
57
|
+
* leaves them running it, the source of a download, the target of
|
|
58
|
+
* anything else. An ID that names no release, as a report from the
|
|
59
|
+
* built-in bundle names it, counts the installations running that
|
|
60
|
+
* built-in bundle outside any release, as event filters match the bundle
|
|
61
|
+
* ID such a report names.
|
|
62
|
+
*/
|
|
63
|
+
readonly releaseId: string;
|
|
64
|
+
}
|
|
65
|
+
/** `countReleaseInstallations`' counts, read together. */
|
|
66
|
+
interface InsightsReleaseInstallations {
|
|
67
|
+
/** Installations whose latest event falls in the window, as `countLatestEvents`. */
|
|
68
|
+
readonly installations: number;
|
|
69
|
+
/** Of those, the ones running the release. */
|
|
70
|
+
readonly release: number;
|
|
57
71
|
}
|
|
58
72
|
interface InsightsCountEventsInput {
|
|
59
73
|
readonly filter: InsightsBundleEventFilter;
|
|
@@ -172,8 +186,13 @@ interface InsightsModel {
|
|
|
172
186
|
* canonical state; newly indexed associations may temporarily be absent.
|
|
173
187
|
*/
|
|
174
188
|
findLatestEvents(input: InsightsFindLatestEventsInput): Promise<readonly BundleEventRow[]>;
|
|
175
|
-
/** Count latest events once per installation
|
|
189
|
+
/** Count latest events once per installation. */
|
|
176
190
|
countLatestEvents(input: InsightsCountLatestEventsInput): Promise<number>;
|
|
191
|
+
/**
|
|
192
|
+
* `countLatestEvents`, and of those one release's installations, from
|
|
193
|
+
* one read of the same rows.
|
|
194
|
+
*/
|
|
195
|
+
countReleaseInstallations(input: InsightsCountReleaseInstallationsInput): Promise<InsightsReleaseInstallations>;
|
|
177
196
|
/** Count accepted reports in [sinceMs, beforeReceivedAtMs), across all pages. */
|
|
178
197
|
countEvents(input: InsightsCountEventsInput): Promise<number>;
|
|
179
198
|
/**
|
|
@@ -187,4 +206,4 @@ interface InsightsModel {
|
|
|
187
206
|
getAppUsage(input: InsightsGetAppUsageInput): Promise<InsightsGetAppUsageResult>;
|
|
188
207
|
}
|
|
189
208
|
//#endregion
|
|
190
|
-
export { InsightsBundleEventFilter, InsightsCountEventSeriesInput, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsEventSeriesPoint, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference };
|
|
209
|
+
export { InsightsBundleEventFilter, InsightsCountEventSeriesInput, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCountReleaseInstallationsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsEventSeriesPoint, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsReleaseInstallations, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference };
|
|
@@ -9,16 +9,18 @@ interface InsightsScope {
|
|
|
9
9
|
readonly channel: string;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
* Raw event predicates; recovery is attributed to the source
|
|
13
|
-
* UNCHANGED filter matches the kept rows that moved an
|
|
14
|
-
*
|
|
12
|
+
* Raw event predicates, by release; recovery is attributed to the source
|
|
13
|
+
* release. An UNCHANGED filter matches the kept rows that moved an
|
|
14
|
+
* installation to the release without an apply report. An event that names
|
|
15
|
+
* no release on that side, such as one from the built-in bundle, matches by
|
|
16
|
+
* the bundle ID it reports instead.
|
|
15
17
|
*/
|
|
16
18
|
type InsightsBundleEventFilter = InsightsScope & ({
|
|
17
19
|
readonly type: "RECOVERED";
|
|
18
|
-
readonly
|
|
20
|
+
readonly fromReleaseId: string;
|
|
19
21
|
} | {
|
|
20
22
|
readonly type: "UPDATE_DOWNLOADED" | "UPDATE_APPLIED" | "UPDATE_FAILED" | "UNCHANGED";
|
|
21
|
-
readonly
|
|
23
|
+
readonly toReleaseId: string;
|
|
22
24
|
});
|
|
23
25
|
type InsightsEventFilter = {
|
|
24
26
|
readonly kind: "all";
|
|
@@ -48,12 +50,24 @@ type InsightsFindLatestEventsInput = {
|
|
|
48
50
|
interface InsightsCountLatestEventsInput extends InsightsScope {
|
|
49
51
|
/** A UTC day's start: latest events are counted by the day they fall in. */
|
|
50
52
|
readonly sinceMs: number;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
}
|
|
54
|
+
interface InsightsCountReleaseInstallationsInput extends InsightsCountLatestEventsInput {
|
|
55
|
+
/**
|
|
56
|
+
* The release whose installations to count: those whose latest event
|
|
57
|
+
* leaves them running it, the source of a download, the target of
|
|
58
|
+
* anything else. An ID that names no release, as a report from the
|
|
59
|
+
* built-in bundle names it, counts the installations running that
|
|
60
|
+
* built-in bundle outside any release, as event filters match the bundle
|
|
61
|
+
* ID such a report names.
|
|
62
|
+
*/
|
|
63
|
+
readonly releaseId: string;
|
|
64
|
+
}
|
|
65
|
+
/** `countReleaseInstallations`' counts, read together. */
|
|
66
|
+
interface InsightsReleaseInstallations {
|
|
67
|
+
/** Installations whose latest event falls in the window, as `countLatestEvents`. */
|
|
68
|
+
readonly installations: number;
|
|
69
|
+
/** Of those, the ones running the release. */
|
|
70
|
+
readonly release: number;
|
|
57
71
|
}
|
|
58
72
|
interface InsightsCountEventsInput {
|
|
59
73
|
readonly filter: InsightsBundleEventFilter;
|
|
@@ -172,8 +186,13 @@ interface InsightsModel {
|
|
|
172
186
|
* canonical state; newly indexed associations may temporarily be absent.
|
|
173
187
|
*/
|
|
174
188
|
findLatestEvents(input: InsightsFindLatestEventsInput): Promise<readonly BundleEventRow[]>;
|
|
175
|
-
/** Count latest events once per installation
|
|
189
|
+
/** Count latest events once per installation. */
|
|
176
190
|
countLatestEvents(input: InsightsCountLatestEventsInput): Promise<number>;
|
|
191
|
+
/**
|
|
192
|
+
* `countLatestEvents`, and of those one release's installations, from
|
|
193
|
+
* one read of the same rows.
|
|
194
|
+
*/
|
|
195
|
+
countReleaseInstallations(input: InsightsCountReleaseInstallationsInput): Promise<InsightsReleaseInstallations>;
|
|
177
196
|
/** Count accepted reports in [sinceMs, beforeReceivedAtMs), across all pages. */
|
|
178
197
|
countEvents(input: InsightsCountEventsInput): Promise<number>;
|
|
179
198
|
/**
|
|
@@ -187,4 +206,4 @@ interface InsightsModel {
|
|
|
187
206
|
getAppUsage(input: InsightsGetAppUsageInput): Promise<InsightsGetAppUsageResult>;
|
|
188
207
|
}
|
|
189
208
|
//#endregion
|
|
190
|
-
export { InsightsBundleEventFilter, InsightsCountEventSeriesInput, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsEventSeriesPoint, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference };
|
|
209
|
+
export { InsightsBundleEventFilter, InsightsCountEventSeriesInput, InsightsCountEventsInput, InsightsCountLatestEventsInput, InsightsCountReleaseInstallationsInput, InsightsCoverage, InsightsEventCursor, InsightsEventFilter, InsightsEventSeriesPoint, InsightsFindLatestEventsInput, InsightsGetAppUsageInput, InsightsGetAppUsageResult, InsightsGetReleaseActivityInput, InsightsGetReleaseActivityResult, InsightsListEventsInput, InsightsModel, InsightsRecordEventInput, InsightsReleaseInstallations, InsightsScope, InsightsTimeRange, ReleaseActivityMetrics, ReleaseReference };
|
package/dist/server/provider.cjs
CHANGED
|
@@ -73,27 +73,27 @@ const readScope = (input) => {
|
|
|
73
73
|
};
|
|
74
74
|
const bundleFilter = (input) => {
|
|
75
75
|
const scope = readScope(input);
|
|
76
|
-
const
|
|
76
|
+
const releaseId = requireString(input.releaseId, "bundle ID", MAX_EVENT_ID_LENGTH);
|
|
77
77
|
switch (input.outcome) {
|
|
78
78
|
case "downloaded": return {
|
|
79
79
|
...scope,
|
|
80
80
|
type: "UPDATE_DOWNLOADED",
|
|
81
|
-
|
|
81
|
+
toReleaseId: releaseId
|
|
82
82
|
};
|
|
83
83
|
case "applied": return {
|
|
84
84
|
...scope,
|
|
85
85
|
type: "UPDATE_APPLIED",
|
|
86
|
-
|
|
86
|
+
toReleaseId: releaseId
|
|
87
87
|
};
|
|
88
88
|
case "recovered": return {
|
|
89
89
|
...scope,
|
|
90
90
|
type: "RECOVERED",
|
|
91
|
-
|
|
91
|
+
fromReleaseId: releaseId
|
|
92
92
|
};
|
|
93
93
|
case "failed": return {
|
|
94
94
|
...scope,
|
|
95
95
|
type: "UPDATE_FAILED",
|
|
96
|
-
|
|
96
|
+
toReleaseId: releaseId
|
|
97
97
|
};
|
|
98
98
|
default: throw new require_errors.InsightsBadRequestError("Invalid Insights outcome.");
|
|
99
99
|
}
|
|
@@ -103,7 +103,7 @@ const sameFilter = (left, right) => {
|
|
|
103
103
|
switch (right.kind) {
|
|
104
104
|
case "all": return true;
|
|
105
105
|
case "installationMovement": return left.installId === right.installId;
|
|
106
|
-
case "bundle": return left.platform === right.platform && left.channel === right.channel && left.type === right.type && (right.type === "RECOVERED" ? left.
|
|
106
|
+
case "bundle": return left.platform === right.platform && left.channel === right.channel && left.type === right.type && (right.type === "RECOVERED" ? left.fromReleaseId === right.fromReleaseId : left.toReleaseId === right.toReleaseId);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
const readEventCursor = (value, filter) => {
|
|
@@ -140,7 +140,7 @@ const assertEventRows = (rows, input) => {
|
|
|
140
140
|
for (let index = 0; index < rows.length; index += 1) {
|
|
141
141
|
const row = rows[index];
|
|
142
142
|
const previous = rows[index - 1];
|
|
143
|
-
if (!row || typeof row.id !== "string" || !(0, _hot_updater_plugin_core.isUUIDv7)(row.id) || !Number.isSafeInteger(row.received_at_ms) || row.received_at_ms >= input.beforeReceivedAtMs || row.received_at_ms < input.sinceMs || previous !== void 0 && compareEventNewest(previous, row) >= 0 || input.after !== void 0 && !isAfterEventCursor(row, input.after) || input.filter.kind === "installationMovement" && (row.install_id !== input.filter.installId || !require_contract.isInsightsMovementEvent(row)) || input.filter.kind === "bundle" && (row.platform !== input.filter.platform || row.channel !== input.filter.channel || row.type !== input.filter.type || (input.filter.type === "RECOVERED" ? row.from_bundle_id !== input.filter.
|
|
143
|
+
if (!row || typeof row.id !== "string" || !(0, _hot_updater_plugin_core.isUUIDv7)(row.id) || !Number.isSafeInteger(row.received_at_ms) || row.received_at_ms >= input.beforeReceivedAtMs || row.received_at_ms < input.sinceMs || previous !== void 0 && compareEventNewest(previous, row) >= 0 || input.after !== void 0 && !isAfterEventCursor(row, input.after) || input.filter.kind === "installationMovement" && (row.install_id !== input.filter.installId || !require_contract.isInsightsMovementEvent(row)) || input.filter.kind === "bundle" && (row.platform !== input.filter.platform || row.channel !== input.filter.channel || row.type !== input.filter.type || (input.filter.type === "RECOVERED" ? (row.from_release_id ?? row.from_bundle_id) !== input.filter.fromReleaseId : (row.to_release_id ?? row.to_bundle_id) !== input.filter.toReleaseId))) throw new Error("Insights database returned invalid event rows.");
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
/** An `UPDATE_FAILED` row's failure, as the event lists show it. */
|
|
@@ -181,6 +181,7 @@ const eventDetails = ({ type, metadata }) => ({
|
|
|
181
181
|
...metadata.implied_download === true ? { impliedDownload: true } : {}
|
|
182
182
|
});
|
|
183
183
|
const toEventHistoryRow = (row) => ({
|
|
184
|
+
...row.from_release_id == null ? {} : { fromReleaseId: row.from_release_id },
|
|
184
185
|
...row.to_release_id == null ? {} : { toReleaseId: row.to_release_id },
|
|
185
186
|
...row.metadata.sdk_version == null ? {} : { sdkVersion: row.metadata.sdk_version },
|
|
186
187
|
...row.metadata.min_bundle_id === void 0 ? {} : { minBundleId: row.metadata.min_bundle_id },
|
|
@@ -205,6 +206,7 @@ const toInstallationRow = (row) => ({
|
|
|
205
206
|
cohort: row.metadata.cohort,
|
|
206
207
|
installId: row.install_id,
|
|
207
208
|
lastKnownBundleId: row.type === "UPDATE_DOWNLOADED" ? row.from_bundle_id : row.to_bundle_id,
|
|
209
|
+
lastKnownReleaseId: row.type === "UPDATE_DOWNLOADED" ? row.from_release_id : row.to_release_id,
|
|
208
210
|
pendingBundleId: row.type === "UPDATE_DOWNLOADED" ? row.to_bundle_id : null,
|
|
209
211
|
pendingReleaseId: row.type === "UPDATE_DOWNLOADED" ? row.to_release_id : null,
|
|
210
212
|
latestStatus: row.type,
|
|
@@ -333,46 +335,33 @@ const createInsightsProvider = (model) => Object.freeze({
|
|
|
333
335
|
measuredAtMs: Date.now()
|
|
334
336
|
};
|
|
335
337
|
};
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
...scope,
|
|
339
|
-
sinceMs
|
|
340
|
-
}));
|
|
341
|
-
if (bundleId === void 0) return {
|
|
338
|
+
const releaseId = input.releaseId === void 0 ? void 0 : requireString(input.releaseId, "bundle ID", MAX_EVENT_ID_LENGTH);
|
|
339
|
+
if (releaseId === void 0) return {
|
|
342
340
|
...scope,
|
|
343
341
|
window,
|
|
344
342
|
sinceMs,
|
|
345
343
|
beforeReceivedAtMs,
|
|
346
|
-
reportingInstallations: await
|
|
344
|
+
reportingInstallations: await measure(model.countLatestEvents({
|
|
345
|
+
...scope,
|
|
346
|
+
sinceMs
|
|
347
|
+
}))
|
|
347
348
|
};
|
|
349
|
+
const installations = model.countReleaseInstallations({
|
|
350
|
+
...scope,
|
|
351
|
+
sinceMs,
|
|
352
|
+
releaseId
|
|
353
|
+
}).then(async (counts) => [await measure(Promise.resolve(counts.installations)), await measure(Promise.resolve(counts.release))]);
|
|
348
354
|
const countOutcome = (outcome) => measure(model.countEvents({
|
|
349
355
|
filter: bundleFilter({
|
|
350
356
|
...scope,
|
|
351
|
-
|
|
357
|
+
releaseId,
|
|
352
358
|
outcome
|
|
353
359
|
}),
|
|
354
360
|
sinceMs,
|
|
355
361
|
beforeReceivedAtMs
|
|
356
362
|
}));
|
|
357
|
-
const [reportingInstallations, bundleInstallations, downloadedReports, appliedReports, recoveredReports, failedReports] = await Promise.all([
|
|
358
|
-
|
|
359
|
-
measure(model.countLatestEvents({
|
|
360
|
-
...scope,
|
|
361
|
-
sinceMs,
|
|
362
|
-
bundle: [{
|
|
363
|
-
field: "from_bundle_id",
|
|
364
|
-
value: bundleId,
|
|
365
|
-
types: ["UPDATE_DOWNLOADED"]
|
|
366
|
-
}, {
|
|
367
|
-
field: "to_bundle_id",
|
|
368
|
-
value: bundleId,
|
|
369
|
-
types: [
|
|
370
|
-
"UNCHANGED",
|
|
371
|
-
"UPDATE_APPLIED",
|
|
372
|
-
"RECOVERED"
|
|
373
|
-
]
|
|
374
|
-
}]
|
|
375
|
-
})),
|
|
363
|
+
const [[reportingInstallations, bundleInstallations], downloadedReports, appliedReports, recoveredReports, failedReports] = await Promise.all([
|
|
364
|
+
installations,
|
|
376
365
|
countOutcome("downloaded"),
|
|
377
366
|
countOutcome("applied"),
|
|
378
367
|
countOutcome("recovered"),
|
|
@@ -385,7 +374,7 @@ const createInsightsProvider = (model) => Object.freeze({
|
|
|
385
374
|
beforeReceivedAtMs,
|
|
386
375
|
reportingInstallations,
|
|
387
376
|
bundle: {
|
|
388
|
-
|
|
377
|
+
releaseId,
|
|
389
378
|
reportingInstallations: bundleInstallations,
|
|
390
379
|
downloadedReports,
|
|
391
380
|
appliedReports,
|
package/dist/server/provider.mjs
CHANGED
|
@@ -73,27 +73,27 @@ const readScope = (input) => {
|
|
|
73
73
|
};
|
|
74
74
|
const bundleFilter = (input) => {
|
|
75
75
|
const scope = readScope(input);
|
|
76
|
-
const
|
|
76
|
+
const releaseId = requireString(input.releaseId, "bundle ID", MAX_EVENT_ID_LENGTH);
|
|
77
77
|
switch (input.outcome) {
|
|
78
78
|
case "downloaded": return {
|
|
79
79
|
...scope,
|
|
80
80
|
type: "UPDATE_DOWNLOADED",
|
|
81
|
-
|
|
81
|
+
toReleaseId: releaseId
|
|
82
82
|
};
|
|
83
83
|
case "applied": return {
|
|
84
84
|
...scope,
|
|
85
85
|
type: "UPDATE_APPLIED",
|
|
86
|
-
|
|
86
|
+
toReleaseId: releaseId
|
|
87
87
|
};
|
|
88
88
|
case "recovered": return {
|
|
89
89
|
...scope,
|
|
90
90
|
type: "RECOVERED",
|
|
91
|
-
|
|
91
|
+
fromReleaseId: releaseId
|
|
92
92
|
};
|
|
93
93
|
case "failed": return {
|
|
94
94
|
...scope,
|
|
95
95
|
type: "UPDATE_FAILED",
|
|
96
|
-
|
|
96
|
+
toReleaseId: releaseId
|
|
97
97
|
};
|
|
98
98
|
default: throw new InsightsBadRequestError("Invalid Insights outcome.");
|
|
99
99
|
}
|
|
@@ -103,7 +103,7 @@ const sameFilter = (left, right) => {
|
|
|
103
103
|
switch (right.kind) {
|
|
104
104
|
case "all": return true;
|
|
105
105
|
case "installationMovement": return left.installId === right.installId;
|
|
106
|
-
case "bundle": return left.platform === right.platform && left.channel === right.channel && left.type === right.type && (right.type === "RECOVERED" ? left.
|
|
106
|
+
case "bundle": return left.platform === right.platform && left.channel === right.channel && left.type === right.type && (right.type === "RECOVERED" ? left.fromReleaseId === right.fromReleaseId : left.toReleaseId === right.toReleaseId);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
const readEventCursor = (value, filter) => {
|
|
@@ -140,7 +140,7 @@ const assertEventRows = (rows, input) => {
|
|
|
140
140
|
for (let index = 0; index < rows.length; index += 1) {
|
|
141
141
|
const row = rows[index];
|
|
142
142
|
const previous = rows[index - 1];
|
|
143
|
-
if (!row || typeof row.id !== "string" || !isUUIDv7(row.id) || !Number.isSafeInteger(row.received_at_ms) || row.received_at_ms >= input.beforeReceivedAtMs || row.received_at_ms < input.sinceMs || previous !== void 0 && compareEventNewest(previous, row) >= 0 || input.after !== void 0 && !isAfterEventCursor(row, input.after) || input.filter.kind === "installationMovement" && (row.install_id !== input.filter.installId || !isInsightsMovementEvent(row)) || input.filter.kind === "bundle" && (row.platform !== input.filter.platform || row.channel !== input.filter.channel || row.type !== input.filter.type || (input.filter.type === "RECOVERED" ? row.from_bundle_id !== input.filter.
|
|
143
|
+
if (!row || typeof row.id !== "string" || !isUUIDv7(row.id) || !Number.isSafeInteger(row.received_at_ms) || row.received_at_ms >= input.beforeReceivedAtMs || row.received_at_ms < input.sinceMs || previous !== void 0 && compareEventNewest(previous, row) >= 0 || input.after !== void 0 && !isAfterEventCursor(row, input.after) || input.filter.kind === "installationMovement" && (row.install_id !== input.filter.installId || !isInsightsMovementEvent(row)) || input.filter.kind === "bundle" && (row.platform !== input.filter.platform || row.channel !== input.filter.channel || row.type !== input.filter.type || (input.filter.type === "RECOVERED" ? (row.from_release_id ?? row.from_bundle_id) !== input.filter.fromReleaseId : (row.to_release_id ?? row.to_bundle_id) !== input.filter.toReleaseId))) throw new Error("Insights database returned invalid event rows.");
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
/** An `UPDATE_FAILED` row's failure, as the event lists show it. */
|
|
@@ -181,6 +181,7 @@ const eventDetails = ({ type, metadata }) => ({
|
|
|
181
181
|
...metadata.implied_download === true ? { impliedDownload: true } : {}
|
|
182
182
|
});
|
|
183
183
|
const toEventHistoryRow = (row) => ({
|
|
184
|
+
...row.from_release_id == null ? {} : { fromReleaseId: row.from_release_id },
|
|
184
185
|
...row.to_release_id == null ? {} : { toReleaseId: row.to_release_id },
|
|
185
186
|
...row.metadata.sdk_version == null ? {} : { sdkVersion: row.metadata.sdk_version },
|
|
186
187
|
...row.metadata.min_bundle_id === void 0 ? {} : { minBundleId: row.metadata.min_bundle_id },
|
|
@@ -205,6 +206,7 @@ const toInstallationRow = (row) => ({
|
|
|
205
206
|
cohort: row.metadata.cohort,
|
|
206
207
|
installId: row.install_id,
|
|
207
208
|
lastKnownBundleId: row.type === "UPDATE_DOWNLOADED" ? row.from_bundle_id : row.to_bundle_id,
|
|
209
|
+
lastKnownReleaseId: row.type === "UPDATE_DOWNLOADED" ? row.from_release_id : row.to_release_id,
|
|
208
210
|
pendingBundleId: row.type === "UPDATE_DOWNLOADED" ? row.to_bundle_id : null,
|
|
209
211
|
pendingReleaseId: row.type === "UPDATE_DOWNLOADED" ? row.to_release_id : null,
|
|
210
212
|
latestStatus: row.type,
|
|
@@ -333,46 +335,33 @@ const createInsightsProvider = (model) => Object.freeze({
|
|
|
333
335
|
measuredAtMs: Date.now()
|
|
334
336
|
};
|
|
335
337
|
};
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
...scope,
|
|
339
|
-
sinceMs
|
|
340
|
-
}));
|
|
341
|
-
if (bundleId === void 0) return {
|
|
338
|
+
const releaseId = input.releaseId === void 0 ? void 0 : requireString(input.releaseId, "bundle ID", MAX_EVENT_ID_LENGTH);
|
|
339
|
+
if (releaseId === void 0) return {
|
|
342
340
|
...scope,
|
|
343
341
|
window,
|
|
344
342
|
sinceMs,
|
|
345
343
|
beforeReceivedAtMs,
|
|
346
|
-
reportingInstallations: await
|
|
344
|
+
reportingInstallations: await measure(model.countLatestEvents({
|
|
345
|
+
...scope,
|
|
346
|
+
sinceMs
|
|
347
|
+
}))
|
|
347
348
|
};
|
|
349
|
+
const installations = model.countReleaseInstallations({
|
|
350
|
+
...scope,
|
|
351
|
+
sinceMs,
|
|
352
|
+
releaseId
|
|
353
|
+
}).then(async (counts) => [await measure(Promise.resolve(counts.installations)), await measure(Promise.resolve(counts.release))]);
|
|
348
354
|
const countOutcome = (outcome) => measure(model.countEvents({
|
|
349
355
|
filter: bundleFilter({
|
|
350
356
|
...scope,
|
|
351
|
-
|
|
357
|
+
releaseId,
|
|
352
358
|
outcome
|
|
353
359
|
}),
|
|
354
360
|
sinceMs,
|
|
355
361
|
beforeReceivedAtMs
|
|
356
362
|
}));
|
|
357
|
-
const [reportingInstallations, bundleInstallations, downloadedReports, appliedReports, recoveredReports, failedReports] = await Promise.all([
|
|
358
|
-
|
|
359
|
-
measure(model.countLatestEvents({
|
|
360
|
-
...scope,
|
|
361
|
-
sinceMs,
|
|
362
|
-
bundle: [{
|
|
363
|
-
field: "from_bundle_id",
|
|
364
|
-
value: bundleId,
|
|
365
|
-
types: ["UPDATE_DOWNLOADED"]
|
|
366
|
-
}, {
|
|
367
|
-
field: "to_bundle_id",
|
|
368
|
-
value: bundleId,
|
|
369
|
-
types: [
|
|
370
|
-
"UNCHANGED",
|
|
371
|
-
"UPDATE_APPLIED",
|
|
372
|
-
"RECOVERED"
|
|
373
|
-
]
|
|
374
|
-
}]
|
|
375
|
-
})),
|
|
363
|
+
const [[reportingInstallations, bundleInstallations], downloadedReports, appliedReports, recoveredReports, failedReports] = await Promise.all([
|
|
364
|
+
installations,
|
|
376
365
|
countOutcome("downloaded"),
|
|
377
366
|
countOutcome("applied"),
|
|
378
367
|
countOutcome("recovered"),
|
|
@@ -385,7 +374,7 @@ const createInsightsProvider = (model) => Object.freeze({
|
|
|
385
374
|
beforeReceivedAtMs,
|
|
386
375
|
reportingInstallations,
|
|
387
376
|
bundle: {
|
|
388
|
-
|
|
377
|
+
releaseId,
|
|
389
378
|
reportingInstallations: bundleInstallations,
|
|
390
379
|
downloadedReports,
|
|
391
380
|
appliedReports,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_errors = require("./errors.cjs");
|
|
2
|
+
const require_wire = require("./wire.cjs");
|
|
2
3
|
//#region src/server/queryInput.ts
|
|
3
4
|
const MAX_PAGE_LIMIT = 100;
|
|
4
5
|
const MAX_IDENTITY_LENGTH = 255;
|
|
@@ -43,7 +44,7 @@ const readScope = (url) => {
|
|
|
43
44
|
const parseEventPageInput = (request) => {
|
|
44
45
|
const url = new URL(request.url);
|
|
45
46
|
const bundleFields = [
|
|
46
|
-
|
|
47
|
+
require_wire.RELEASE_ID_PARAM,
|
|
47
48
|
"outcome",
|
|
48
49
|
"platform",
|
|
49
50
|
"channel"
|
|
@@ -54,7 +55,7 @@ const parseEventPageInput = (request) => {
|
|
|
54
55
|
if (outcome !== "downloaded" && outcome !== "applied" && outcome !== "recovered" && outcome !== "failed") throw new require_errors.InsightsBadRequestError("Invalid 'outcome' query parameter.");
|
|
55
56
|
bundle = {
|
|
56
57
|
...readScope(url),
|
|
57
|
-
|
|
58
|
+
releaseId: readId(url, require_wire.RELEASE_ID_PARAM, 1024),
|
|
58
59
|
outcome
|
|
59
60
|
};
|
|
60
61
|
}
|
|
@@ -80,11 +81,10 @@ const parseReportingOverviewInput = (request) => {
|
|
|
80
81
|
const url = new URL(request.url);
|
|
81
82
|
const window = readSingle(url, "window") ?? "30d";
|
|
82
83
|
if (window !== "24h" && window !== "7d" && window !== "30d") throw new require_errors.InsightsBadRequestError("Invalid 'window' query parameter.");
|
|
83
|
-
const bundleId = readSingle(url, "bundleId");
|
|
84
84
|
return {
|
|
85
85
|
...readScope(url),
|
|
86
86
|
window,
|
|
87
|
-
...bundleId === void 0 ? {} : {
|
|
87
|
+
...readSingle(url, "bundleId") === void 0 ? {} : { releaseId: readId(url, require_wire.RELEASE_ID_PARAM, 1024) }
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InsightsBadRequestError } from "./errors.mjs";
|
|
2
|
+
import { RELEASE_ID_PARAM } from "./wire.mjs";
|
|
2
3
|
//#region src/server/queryInput.ts
|
|
3
4
|
const MAX_PAGE_LIMIT = 100;
|
|
4
5
|
const MAX_IDENTITY_LENGTH = 255;
|
|
@@ -43,7 +44,7 @@ const readScope = (url) => {
|
|
|
43
44
|
const parseEventPageInput = (request) => {
|
|
44
45
|
const url = new URL(request.url);
|
|
45
46
|
const bundleFields = [
|
|
46
|
-
|
|
47
|
+
RELEASE_ID_PARAM,
|
|
47
48
|
"outcome",
|
|
48
49
|
"platform",
|
|
49
50
|
"channel"
|
|
@@ -54,7 +55,7 @@ const parseEventPageInput = (request) => {
|
|
|
54
55
|
if (outcome !== "downloaded" && outcome !== "applied" && outcome !== "recovered" && outcome !== "failed") throw new InsightsBadRequestError("Invalid 'outcome' query parameter.");
|
|
55
56
|
bundle = {
|
|
56
57
|
...readScope(url),
|
|
57
|
-
|
|
58
|
+
releaseId: readId(url, RELEASE_ID_PARAM, 1024),
|
|
58
59
|
outcome
|
|
59
60
|
};
|
|
60
61
|
}
|
|
@@ -80,11 +81,10 @@ const parseReportingOverviewInput = (request) => {
|
|
|
80
81
|
const url = new URL(request.url);
|
|
81
82
|
const window = readSingle(url, "window") ?? "30d";
|
|
82
83
|
if (window !== "24h" && window !== "7d" && window !== "30d") throw new InsightsBadRequestError("Invalid 'window' query parameter.");
|
|
83
|
-
const bundleId = readSingle(url, "bundleId");
|
|
84
84
|
return {
|
|
85
85
|
...readScope(url),
|
|
86
86
|
window,
|
|
87
|
-
...bundleId === void 0 ? {} : {
|
|
87
|
+
...readSingle(url, "bundleId") === void 0 ? {} : { releaseId: readId(url, RELEASE_ID_PARAM, 1024) }
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
//#endregion
|