@oneuptime/common 14.0.91 → 14.0.92
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/Models/DatabaseModels/AutoRemediationRule.js +1 -1
- package/Models/DatabaseModels/CodeRepository.d.mts +1 -0
- package/Models/DatabaseModels/CodeRepository.d.ts +1 -0
- package/Models/DatabaseModels/CodeRepository.js +69 -6
- package/Types/AI/CodeTask.d.mts +1 -0
- package/Types/AI/CodeTask.d.ts +1 -0
- package/Types/AI/TelemetryAiActivity.d.mts +1 -0
- package/Types/AI/TelemetryAiActivity.d.ts +1 -0
- package/Types/AI/TelemetryAiActivity.js +4 -0
- package/Types/CodeRepository/CodeRepositorySetting.d.mts +15 -0
- package/Types/CodeRepository/CodeRepositorySetting.d.ts +15 -0
- package/Types/CodeRepository/CodeRepositorySetting.js +49 -0
- package/Types/CodeRepository/CodeRepositorySetting.mjs +3 -0
- package/Types/Date.d.mts +10 -0
- package/Types/Date.d.ts +10 -0
- package/Types/Date.js +385 -98
- package/Types/DateLanguage.d.mts +67 -0
- package/Types/DateLanguage.d.ts +67 -0
- package/Types/DateLanguage.js +478 -0
- package/Types/DateLanguage.mjs +21 -0
- package/Types/Runner/CodeRepositoryRunner.d.mts +7 -0
- package/Types/Runner/CodeRepositoryRunner.d.ts +7 -0
- package/Types/Runner/CodeRepositoryRunner.js +60 -14
- package/Types/Runner/CodeRepositoryRunner.mjs +1 -0
- package/Types/SecurityEvent/OcsfProcessActivity.d.mts +25 -0
- package/Types/SecurityEvent/OcsfProcessActivity.d.ts +25 -0
- package/Types/SecurityEvent/OcsfProcessActivity.js +131 -0
- package/Types/SecurityEvent/OcsfProcessActivity.mjs +8 -0
- package/UI/Utils/TranslateTemplate.d.mts +73 -0
- package/UI/Utils/TranslateTemplate.d.ts +73 -0
- package/Utils/CronTab.d.mts +41 -3
- package/Utils/CronTab.d.ts +41 -3
- package/Utils/CronTab.js +112 -38
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.mts +2 -0
- package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +2 -0
- package/Utils/Monitor/MonitorOverviewTargetUtil.js +13 -2
- package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.mts +5 -0
- package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.ts +5 -0
- package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.js +219 -58
- package/Utils/SecurityEvent/OcsfNormalizer.js +22 -13
- package/Utils/Slo/SloDuration.d.mts +1 -0
- package/Utils/Slo/SloDuration.d.ts +1 -0
- package/Utils/Slo/SloDuration.js +57 -8
- package/Utils/Slo/SloDuration.mjs +1 -0
- package/Utils/Suggestions/CodeFixSuggestion.d.mts +15 -0
- package/Utils/Suggestions/CodeFixSuggestion.d.ts +15 -0
- package/Utils/Suggestions/CodeFixSuggestion.js +62 -1
- package/Utils/Suggestions/CodeFixSuggestion.mjs +4 -0
- package/Utils/Suggestions/ProfileFixSuggestion.js +4 -0
- package/Utils/Suggestions/SuggestionBlocker.d.mts +8 -0
- package/Utils/Suggestions/SuggestionBlocker.d.ts +8 -0
- package/Utils/Suggestions/SuggestionBlocker.js +51 -0
- package/Utils/Suggestions/SuggestionBlocker.mjs +4 -0
- package/Utils/Suggestions/SuggestionOffer.d.mts +2 -1
- package/Utils/Suggestions/SuggestionOffer.d.ts +2 -1
- package/Utils/Suggestions/SuggestionOffer.js +5 -0
- package/Utils/Suggestions/TelemetryAiFixSuggestion.d.mts +2 -7
- package/Utils/Suggestions/TelemetryAiFixSuggestion.d.ts +2 -7
- package/Utils/Suggestions/TelemetryAiFixSuggestion.js +8 -36
- package/Utils/Suggestions/TelemetryImprovementSuggestion.d.mts +1 -0
- package/Utils/Suggestions/TelemetryImprovementSuggestion.d.ts +1 -0
- package/Utils/Suggestions/TelemetryImprovementSuggestion.js +1 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.d.mts +6 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.d.ts +6 -0
- package/Utils/Suggestions/TracePerformanceFixSuggestion.js +46 -5
- package/package.json +8 -1
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +0 -61
- package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +0 -61
- package/Utils/Monitor/MonitorCheckScheduleUtil.js +0 -476
- package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +0 -3
- package/Utils/Monitor/MonitorOverviewFamily.d.mts +0 -39
- package/Utils/Monitor/MonitorOverviewFamily.d.ts +0 -39
- package/Utils/Monitor/MonitorOverviewFamily.js +0 -206
- package/Utils/Monitor/MonitorOverviewFamily.mjs +0 -4
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +0 -189
- package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +0 -189
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +0 -1480
- package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +0 -5
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +0 -112
- package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +0 -112
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +0 -640
- package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +0 -3
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +0 -27
- package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +0 -27
- package/Utils/Monitor/MonitorStatusHistoryUtil.js +0 -132
- package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +0 -2
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +0 -42
- package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +0 -42
- package/Utils/Monitor/MonitorUptimeSummaryUtil.js +0 -468
- package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +0 -2
|
@@ -3,7 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FINISHED_FIX_STATUSES = exports.FinishedFixOutcome = void 0;
|
|
6
7
|
exports.getCodeFixOffer = getCodeFixOffer;
|
|
8
|
+
exports.parseFinishedFixOutcome = parseFinishedFixOutcome;
|
|
9
|
+
exports.getFinishedFixOutcome = getFinishedFixOutcome;
|
|
10
|
+
const AIRunStatus_1 = __importDefault(require("../../Types/AI/AIRunStatus"));
|
|
11
|
+
const CodeTask_1 = require("../../Types/AI/CodeTask");
|
|
7
12
|
const SuggestionOffer_1 = __importDefault(require("./SuggestionOffer"));
|
|
8
13
|
function getCodeFixOffer(input) {
|
|
9
14
|
if (!input.isAiEnabled || !input.applies) {
|
|
@@ -12,10 +17,66 @@ function getCodeFixOffer(input) {
|
|
|
12
17
|
if (input.hasActiveFix) {
|
|
13
18
|
return SuggestionOffer_1.default.InProgress;
|
|
14
19
|
}
|
|
15
|
-
if (
|
|
20
|
+
if (input.hasFinishedFix) {
|
|
21
|
+
return SuggestionOffer_1.default.Done;
|
|
22
|
+
}
|
|
23
|
+
if (!input.hasConnectedRepository || input.isBlocked) {
|
|
16
24
|
return input.isBackedByEvidence
|
|
17
25
|
? SuggestionOffer_1.default.SetUp
|
|
18
26
|
: SuggestionOffer_1.default.None;
|
|
19
27
|
}
|
|
20
28
|
return SuggestionOffer_1.default.Act;
|
|
21
29
|
}
|
|
30
|
+
/*
|
|
31
|
+
* How a fix that did its work came out (a Done offer), in the words its
|
|
32
|
+
* task says it in, in Code: its pull request is open for review, the AI
|
|
33
|
+
* read the code and found nothing to change, or it stopped with a question
|
|
34
|
+
* for the person.
|
|
35
|
+
*/
|
|
36
|
+
var FinishedFixOutcome;
|
|
37
|
+
(function (FinishedFixOutcome) {
|
|
38
|
+
FinishedFixOutcome["Fixed"] = "Fixed";
|
|
39
|
+
FinishedFixOutcome["NothingToChange"] = "NothingToChange";
|
|
40
|
+
FinishedFixOutcome["WaitingForYou"] = "WaitingForYou";
|
|
41
|
+
})(FinishedFixOutcome || (exports.FinishedFixOutcome = FinishedFixOutcome = {}));
|
|
42
|
+
const ALL_FINISHED_FIX_OUTCOMES = Object.values(FinishedFixOutcome);
|
|
43
|
+
// Reads an outcome off the wire; anything this build does not know is null.
|
|
44
|
+
function parseFinishedFixOutcome(value) {
|
|
45
|
+
if (typeof value === "string" && ALL_FINISHED_FIX_OUTCOMES.includes(value)) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
// The run statuses of a fix that did its work.
|
|
51
|
+
exports.FINISHED_FIX_STATUSES = [
|
|
52
|
+
AIRunStatus_1.default.Completed,
|
|
53
|
+
AIRunStatus_1.default.NoFixFound,
|
|
54
|
+
];
|
|
55
|
+
/*
|
|
56
|
+
* How a fix that did its work stands now, from the fix itself (its task's
|
|
57
|
+
* first turn) and the task's latest turn - a reply someone sent in Code, or
|
|
58
|
+
* the fix again when nobody has replied - as Code reads the task
|
|
59
|
+
* (CodeTaskStateUtil):
|
|
60
|
+
*
|
|
61
|
+
* - null while the task is working again (a reply is under way): the
|
|
62
|
+
* page links to it as work in progress;
|
|
63
|
+
* - WaitingForYou while the task waits for an answer;
|
|
64
|
+
* - otherwise how the fix came out: nothing to change when it found
|
|
65
|
+
* nothing, its pull request when it made one. A reply that failed or
|
|
66
|
+
* was stopped leaves the fix as it came out.
|
|
67
|
+
*
|
|
68
|
+
* A fix that did not do its work (it failed, or was stopped) is no
|
|
69
|
+
* finished fix: the caller offers it again.
|
|
70
|
+
*/
|
|
71
|
+
function getFinishedFixOutcome(data) {
|
|
72
|
+
const state = CodeTask_1.CodeTaskStateUtil.fromRun(data.latestTurn);
|
|
73
|
+
if (state === CodeTask_1.CodeTaskState.Working) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
if (state === CodeTask_1.CodeTaskState.WaitingForYou) {
|
|
77
|
+
return FinishedFixOutcome.WaitingForYou;
|
|
78
|
+
}
|
|
79
|
+
return data.fix.status === AIRunStatus_1.default.NoFixFound
|
|
80
|
+
? FinishedFixOutcome.NothingToChange
|
|
81
|
+
: FinishedFixOutcome.Fixed;
|
|
82
|
+
}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import commonJsModule from "./CodeFixSuggestion.js";
|
|
2
|
+
export const FINISHED_FIX_STATUSES = commonJsModule.FINISHED_FIX_STATUSES;
|
|
3
|
+
export const FinishedFixOutcome = commonJsModule.FinishedFixOutcome;
|
|
2
4
|
export const getCodeFixOffer = commonJsModule.getCodeFixOffer;
|
|
5
|
+
export const getFinishedFixOutcome = commonJsModule.getFinishedFixOutcome;
|
|
6
|
+
export const parseFinishedFixOutcome = commonJsModule.parseFinishedFixOutcome;
|
|
@@ -292,6 +292,10 @@ function parseProfileFixSuggestion(value) {
|
|
|
292
292
|
blocker,
|
|
293
293
|
repository });
|
|
294
294
|
}
|
|
295
|
+
// A finished fix is something this suggestion never says (it says None).
|
|
296
|
+
if (offer !== SuggestionOffer_1.default.Act) {
|
|
297
|
+
return exports.NO_PROFILE_FIX_SUGGESTION;
|
|
298
|
+
}
|
|
295
299
|
// Act: somewhere to ask it.
|
|
296
300
|
if (!repository && repositories.length === 0) {
|
|
297
301
|
return exports.NO_PROFILE_FIX_SUGGESTION;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CodeTaskBlocker } from "../../Types/AI/CodeTask.mjs";
|
|
2
|
+
import { JSONObject } from "../../Types/JSON.mjs";
|
|
3
|
+
export interface SuggestionBlocker extends CodeTaskBlocker {
|
|
4
|
+
repositoryId?: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function toSuggestionBlocker(blocker: CodeTaskBlocker, repositoryId?: string | null | undefined): SuggestionBlocker;
|
|
7
|
+
export declare function parseSuggestionBlocker(value: unknown): SuggestionBlocker | null;
|
|
8
|
+
export declare function suggestionBlockerToJSON(blocker: SuggestionBlocker): JSONObject;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CodeTaskBlocker } from "../../Types/AI/CodeTask";
|
|
2
|
+
import { JSONObject } from "../../Types/JSON";
|
|
3
|
+
export interface SuggestionBlocker extends CodeTaskBlocker {
|
|
4
|
+
repositoryId?: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function toSuggestionBlocker(blocker: CodeTaskBlocker, repositoryId?: string | null | undefined): SuggestionBlocker;
|
|
7
|
+
export declare function parseSuggestionBlocker(value: unknown): SuggestionBlocker | null;
|
|
8
|
+
export declare function suggestionBlockerToJSON(blocker: SuggestionBlocker): JSONObject;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toSuggestionBlocker = toSuggestionBlocker;
|
|
4
|
+
exports.parseSuggestionBlocker = parseSuggestionBlocker;
|
|
5
|
+
exports.suggestionBlockerToJSON = suggestionBlockerToJSON;
|
|
6
|
+
const CodeTask_1 = require("../../Types/AI/CodeTask");
|
|
7
|
+
// Code's gate's answer as a suggestion carries it.
|
|
8
|
+
function toSuggestionBlocker(blocker, repositoryId) {
|
|
9
|
+
return Object.assign(Object.assign({ type: blocker.type, message: blocker.message }, (blocker.runnerName ? { runnerName: blocker.runnerName } : {})), (repositoryId ? { repositoryId } : {}));
|
|
10
|
+
}
|
|
11
|
+
function isBlockerType(value) {
|
|
12
|
+
return (typeof value === "string" &&
|
|
13
|
+
Object.values(CodeTask_1.CodeTaskBlockerType).includes(value));
|
|
14
|
+
}
|
|
15
|
+
function readText(value) {
|
|
16
|
+
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
17
|
+
}
|
|
18
|
+
/*
|
|
19
|
+
* Reads a blocker off the wire, or null when it is not one this build can
|
|
20
|
+
* draw: a type it does not know, or no sentence to fall back on.
|
|
21
|
+
*/
|
|
22
|
+
function parseSuggestionBlocker(value) {
|
|
23
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const record = value;
|
|
27
|
+
if (!isBlockerType(record["type"])) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const message = readText(record["message"]);
|
|
31
|
+
if (!message) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const blocker = {
|
|
35
|
+
type: record["type"],
|
|
36
|
+
message,
|
|
37
|
+
};
|
|
38
|
+
const runnerName = readText(record["runnerName"]);
|
|
39
|
+
if (runnerName) {
|
|
40
|
+
blocker.runnerName = runnerName;
|
|
41
|
+
}
|
|
42
|
+
const repositoryId = readText(record["repositoryId"]);
|
|
43
|
+
if (repositoryId) {
|
|
44
|
+
blocker.repositoryId = repositoryId;
|
|
45
|
+
}
|
|
46
|
+
return blocker;
|
|
47
|
+
}
|
|
48
|
+
// A blocker as JSON (the server's side of the reader above).
|
|
49
|
+
function suggestionBlockerToJSON(blocker) {
|
|
50
|
+
return Object.assign(Object.assign({ type: blocker.type, message: blocker.message }, (blocker.runnerName ? { runnerName: blocker.runnerName } : {})), (blocker.repositoryId ? { repositoryId: blocker.repositoryId } : {}));
|
|
51
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import commonJsModule from "./SuggestionBlocker.js";
|
|
2
|
+
export const parseSuggestionBlocker = commonJsModule.parseSuggestionBlocker;
|
|
3
|
+
export const suggestionBlockerToJSON = commonJsModule.suggestionBlockerToJSON;
|
|
4
|
+
export const toSuggestionBlocker = commonJsModule.toSuggestionBlocker;
|
|
@@ -2,7 +2,8 @@ declare enum SuggestionOffer {
|
|
|
2
2
|
None = "None",
|
|
3
3
|
Act = "Act",
|
|
4
4
|
SetUp = "SetUp",
|
|
5
|
-
InProgress = "InProgress"
|
|
5
|
+
InProgress = "InProgress",
|
|
6
|
+
Done = "Done"
|
|
6
7
|
}
|
|
7
8
|
export default SuggestionOffer;
|
|
8
9
|
export declare function parseSuggestionOffer(value: unknown): SuggestionOffer;
|
|
@@ -2,7 +2,8 @@ declare enum SuggestionOffer {
|
|
|
2
2
|
None = "None",
|
|
3
3
|
Act = "Act",
|
|
4
4
|
SetUp = "SetUp",
|
|
5
|
-
InProgress = "InProgress"
|
|
5
|
+
InProgress = "InProgress",
|
|
6
|
+
Done = "Done"
|
|
6
7
|
}
|
|
7
8
|
export default SuggestionOffer;
|
|
8
9
|
export declare function parseSuggestionOffer(value: unknown): SuggestionOffer;
|
|
@@ -37,6 +37,11 @@ var SuggestionOffer;
|
|
|
37
37
|
* links to that work instead of offering it a second time.
|
|
38
38
|
*/
|
|
39
39
|
SuggestionOffer["InProgress"] = "InProgress";
|
|
40
|
+
/*
|
|
41
|
+
* Somebody already acted on it and the work is done: the page says how
|
|
42
|
+
* it came out and links to it, instead of offering it a second time.
|
|
43
|
+
*/
|
|
44
|
+
SuggestionOffer["Done"] = "Done";
|
|
40
45
|
})(SuggestionOffer || (SuggestionOffer = {}));
|
|
41
46
|
exports.default = SuggestionOffer;
|
|
42
47
|
const ALL_OFFERS = Object.values(SuggestionOffer);
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { CodeTaskBlockerType } from "../../Types/AI/CodeTask.mjs";
|
|
2
1
|
import { JSONObject } from "../../Types/JSON.mjs";
|
|
2
|
+
import { SuggestionBlocker } from "./SuggestionBlocker.mjs";
|
|
3
3
|
import SuggestionOffer from "./SuggestionOffer.mjs";
|
|
4
4
|
export interface TelemetryAiFixRepository {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
type: CodeTaskBlockerType;
|
|
10
|
-
message: string;
|
|
11
|
-
runnerName?: string | undefined;
|
|
12
|
-
repositoryId?: string | undefined;
|
|
13
|
-
}
|
|
8
|
+
export type TelemetryAiFixBlocker = SuggestionBlocker;
|
|
14
9
|
export interface TelemetryAiFixSuggestion {
|
|
15
10
|
offer: SuggestionOffer;
|
|
16
11
|
blocker: TelemetryAiFixBlocker | null;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { CodeTaskBlockerType } from "../../Types/AI/CodeTask";
|
|
2
1
|
import { JSONObject } from "../../Types/JSON";
|
|
2
|
+
import { SuggestionBlocker } from "./SuggestionBlocker";
|
|
3
3
|
import SuggestionOffer from "./SuggestionOffer";
|
|
4
4
|
export interface TelemetryAiFixRepository {
|
|
5
5
|
id: string;
|
|
6
6
|
name: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
type: CodeTaskBlockerType;
|
|
10
|
-
message: string;
|
|
11
|
-
runnerName?: string | undefined;
|
|
12
|
-
repositoryId?: string | undefined;
|
|
13
|
-
}
|
|
8
|
+
export type TelemetryAiFixBlocker = SuggestionBlocker;
|
|
14
9
|
export interface TelemetryAiFixSuggestion {
|
|
15
10
|
offer: SuggestionOffer;
|
|
16
11
|
blocker: TelemetryAiFixBlocker | null;
|
|
@@ -40,6 +40,7 @@ exports.telemetryAiFixSuggestionToJSON = telemetryAiFixSuggestionToJSON;
|
|
|
40
40
|
const CodeTask_1 = require("../../Types/AI/CodeTask");
|
|
41
41
|
const CodeFixTaskType_1 = require("../../Types/AI/CodeFixTaskType");
|
|
42
42
|
const CodeFixSuggestion_1 = require("./CodeFixSuggestion");
|
|
43
|
+
const SuggestionBlocker_1 = require("./SuggestionBlocker");
|
|
43
44
|
const SuggestionOffer_1 = __importStar(require("./SuggestionOffer"));
|
|
44
45
|
exports.NO_TELEMETRY_AI_FIX_SUGGESTION = {
|
|
45
46
|
offer: SuggestionOffer_1.default.None,
|
|
@@ -79,10 +80,6 @@ function getTelemetryAiFixOffer(input) {
|
|
|
79
80
|
}
|
|
80
81
|
return { offer, blocker: null };
|
|
81
82
|
}
|
|
82
|
-
function isBlockerType(value) {
|
|
83
|
-
return (typeof value === "string" &&
|
|
84
|
-
Object.values(CodeTask_1.CodeTaskBlockerType).includes(value));
|
|
85
|
-
}
|
|
86
83
|
function readText(value) {
|
|
87
84
|
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
88
85
|
}
|
|
@@ -95,32 +92,6 @@ function parseRepository(value) {
|
|
|
95
92
|
const name = readText(record["name"]);
|
|
96
93
|
return id && name ? { id, name } : null;
|
|
97
94
|
}
|
|
98
|
-
function parseBlocker(value) {
|
|
99
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
const record = value;
|
|
103
|
-
if (!isBlockerType(record["type"])) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
const message = readText(record["message"]);
|
|
107
|
-
if (!message) {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
const blocker = {
|
|
111
|
-
type: record["type"],
|
|
112
|
-
message,
|
|
113
|
-
};
|
|
114
|
-
const runnerName = readText(record["runnerName"]);
|
|
115
|
-
if (runnerName) {
|
|
116
|
-
blocker.runnerName = runnerName;
|
|
117
|
-
}
|
|
118
|
-
const repositoryId = readText(record["repositoryId"]);
|
|
119
|
-
if (repositoryId) {
|
|
120
|
-
blocker.repositoryId = repositoryId;
|
|
121
|
-
}
|
|
122
|
-
return blocker;
|
|
123
|
-
}
|
|
124
95
|
/*
|
|
125
96
|
* Reads the suggestion route's answer. Whatever does not hold together - an
|
|
126
97
|
* in-progress offer with no task, a set-up step with no blocker, an action
|
|
@@ -141,11 +112,15 @@ function parseTelemetryAiFixSuggestion(value) {
|
|
|
141
112
|
return taskId
|
|
142
113
|
? Object.assign(Object.assign({}, exports.NO_TELEMETRY_AI_FIX_SUGGESTION), { offer, taskId }) : exports.NO_TELEMETRY_AI_FIX_SUGGESTION;
|
|
143
114
|
}
|
|
144
|
-
const blocker =
|
|
115
|
+
const blocker = (0, SuggestionBlocker_1.parseSuggestionBlocker)(record["blocker"]);
|
|
145
116
|
if (offer === SuggestionOffer_1.default.SetUp) {
|
|
146
117
|
return blocker
|
|
147
118
|
? Object.assign(Object.assign({}, exports.NO_TELEMETRY_AI_FIX_SUGGESTION), { offer, blocker }) : exports.NO_TELEMETRY_AI_FIX_SUGGESTION;
|
|
148
119
|
}
|
|
120
|
+
// A finished fix is something this suggestion never says (it says None).
|
|
121
|
+
if (offer !== SuggestionOffer_1.default.Act) {
|
|
122
|
+
return exports.NO_TELEMETRY_AI_FIX_SUGGESTION;
|
|
123
|
+
}
|
|
149
124
|
const repository = parseRepository(record["repository"]);
|
|
150
125
|
const repositories = (Array.isArray(record["repositories"])
|
|
151
126
|
? record["repositories"]
|
|
@@ -166,11 +141,8 @@ function parseTelemetryAiFixSuggestion(value) {
|
|
|
166
141
|
// The route's answer as JSON (the server's side of the parser above).
|
|
167
142
|
function telemetryAiFixSuggestionToJSON(suggestion) {
|
|
168
143
|
const blocker = suggestion.blocker
|
|
169
|
-
?
|
|
170
|
-
|
|
171
|
-
: {})), (suggestion.blocker.repositoryId
|
|
172
|
-
? { repositoryId: suggestion.blocker.repositoryId }
|
|
173
|
-
: {})) : null;
|
|
144
|
+
? (0, SuggestionBlocker_1.suggestionBlockerToJSON)(suggestion.blocker)
|
|
145
|
+
: null;
|
|
174
146
|
return Object.assign({ offer: suggestion.offer, blocker, repository: suggestion.repository
|
|
175
147
|
? { id: suggestion.repository.id, name: suggestion.repository.name }
|
|
176
148
|
: null, repositories: suggestion.repositories.map((repository) => {
|
|
@@ -4,6 +4,7 @@ export interface TelemetryImprovementOfferInput {
|
|
|
4
4
|
isAiEnabled: boolean;
|
|
5
5
|
hasActiveFix: boolean;
|
|
6
6
|
hasConnectedRepository: boolean;
|
|
7
|
+
isBlocked?: boolean | undefined;
|
|
7
8
|
}
|
|
8
9
|
export declare function getTelemetryImprovementOffer(input: TelemetryImprovementOfferInput): SuggestionOffer;
|
|
9
10
|
export interface TelemetryImprovementSuggestion {
|
|
@@ -4,6 +4,7 @@ export interface TelemetryImprovementOfferInput {
|
|
|
4
4
|
isAiEnabled: boolean;
|
|
5
5
|
hasActiveFix: boolean;
|
|
6
6
|
hasConnectedRepository: boolean;
|
|
7
|
+
isBlocked?: boolean | undefined;
|
|
7
8
|
}
|
|
8
9
|
export declare function getTelemetryImprovementOffer(input: TelemetryImprovementOfferInput): SuggestionOffer;
|
|
9
10
|
export interface TelemetryImprovementSuggestion {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PerformanceFinding, PerformanceFindingType } from "../../Types/AI/CodeFixTaskContext.mjs";
|
|
2
2
|
import { JSONObject } from "../../Types/JSON.mjs";
|
|
3
|
+
import { FinishedFixOutcome } from "./CodeFixSuggestion.mjs";
|
|
4
|
+
import { SuggestionBlocker } from "./SuggestionBlocker.mjs";
|
|
3
5
|
import SuggestionOffer from "./SuggestionOffer.mjs";
|
|
4
6
|
export declare const WORTH_FIXING_MIN_MS: Readonly<Record<PerformanceFindingType, number>>;
|
|
5
7
|
export declare const WORTH_FIXING_MIN_PERCENT_OF_TRACE: number;
|
|
@@ -10,12 +12,16 @@ export interface TracePerformanceFixOfferInput {
|
|
|
10
12
|
findings: ReadonlyArray<PerformanceFinding>;
|
|
11
13
|
isAiEnabled: boolean;
|
|
12
14
|
hasActiveFix: boolean;
|
|
15
|
+
finishedFix?: FinishedFixOutcome | null | undefined;
|
|
13
16
|
hasConnectedRepository: boolean;
|
|
17
|
+
blocker?: SuggestionBlocker | null | undefined;
|
|
14
18
|
}
|
|
15
19
|
export interface TracePerformanceFixOffer {
|
|
16
20
|
offer: SuggestionOffer;
|
|
17
21
|
finding: PerformanceFinding | null;
|
|
18
22
|
findingCount: number;
|
|
23
|
+
fixOutcome: FinishedFixOutcome | null;
|
|
24
|
+
blocker: SuggestionBlocker | null;
|
|
19
25
|
}
|
|
20
26
|
export declare function getTracePerformanceFixOffer(input: TracePerformanceFixOfferInput): TracePerformanceFixOffer;
|
|
21
27
|
export declare function isDatabaseFinding(finding: PerformanceFinding): boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PerformanceFinding, PerformanceFindingType } from "../../Types/AI/CodeFixTaskContext";
|
|
2
2
|
import { JSONObject } from "../../Types/JSON";
|
|
3
|
+
import { FinishedFixOutcome } from "./CodeFixSuggestion";
|
|
4
|
+
import { SuggestionBlocker } from "./SuggestionBlocker";
|
|
3
5
|
import SuggestionOffer from "./SuggestionOffer";
|
|
4
6
|
export declare const WORTH_FIXING_MIN_MS: Readonly<Record<PerformanceFindingType, number>>;
|
|
5
7
|
export declare const WORTH_FIXING_MIN_PERCENT_OF_TRACE: number;
|
|
@@ -10,12 +12,16 @@ export interface TracePerformanceFixOfferInput {
|
|
|
10
12
|
findings: ReadonlyArray<PerformanceFinding>;
|
|
11
13
|
isAiEnabled: boolean;
|
|
12
14
|
hasActiveFix: boolean;
|
|
15
|
+
finishedFix?: FinishedFixOutcome | null | undefined;
|
|
13
16
|
hasConnectedRepository: boolean;
|
|
17
|
+
blocker?: SuggestionBlocker | null | undefined;
|
|
14
18
|
}
|
|
15
19
|
export interface TracePerformanceFixOffer {
|
|
16
20
|
offer: SuggestionOffer;
|
|
17
21
|
finding: PerformanceFinding | null;
|
|
18
22
|
findingCount: number;
|
|
23
|
+
fixOutcome: FinishedFixOutcome | null;
|
|
24
|
+
blocker: SuggestionBlocker | null;
|
|
19
25
|
}
|
|
20
26
|
export declare function getTracePerformanceFixOffer(input: TracePerformanceFixOfferInput): TracePerformanceFixOffer;
|
|
21
27
|
export declare function isDatabaseFinding(finding: PerformanceFinding): boolean;
|
|
@@ -44,6 +44,7 @@ exports.parseTracePerformanceFixSuggestion = parseTracePerformanceFixSuggestion;
|
|
|
44
44
|
exports.tracePerformanceFixSuggestionToJSON = tracePerformanceFixSuggestionToJSON;
|
|
45
45
|
const CodeFixTaskContext_1 = require("../../Types/AI/CodeFixTaskContext");
|
|
46
46
|
const CodeFixSuggestion_1 = require("./CodeFixSuggestion");
|
|
47
|
+
const SuggestionBlocker_1 = require("./SuggestionBlocker");
|
|
47
48
|
const SuggestionOffer_1 = __importStar(require("./SuggestionOffer"));
|
|
48
49
|
/*
|
|
49
50
|
* IS THIS TRACE WORTH "FIX PERFORMANCE WITH AI"?
|
|
@@ -122,17 +123,30 @@ function getTracePerformanceFixOffer(input) {
|
|
|
122
123
|
isAiEnabled: input.isAiEnabled,
|
|
123
124
|
applies: worthFixing.length > 0,
|
|
124
125
|
hasActiveFix: input.hasActiveFix,
|
|
126
|
+
hasFinishedFix: Boolean(input.finishedFix),
|
|
125
127
|
hasConnectedRepository: input.hasConnectedRepository,
|
|
128
|
+
isBlocked: Boolean(input.blocker),
|
|
126
129
|
// The finding is on screen: worth a quiet "connect a repository" link.
|
|
127
130
|
isBackedByEvidence: true,
|
|
128
131
|
});
|
|
129
132
|
if (offer === SuggestionOffer_1.default.None) {
|
|
130
|
-
return {
|
|
133
|
+
return {
|
|
134
|
+
offer,
|
|
135
|
+
finding: null,
|
|
136
|
+
findingCount: 0,
|
|
137
|
+
fixOutcome: null,
|
|
138
|
+
blocker: null,
|
|
139
|
+
};
|
|
131
140
|
}
|
|
132
141
|
return {
|
|
133
142
|
offer,
|
|
134
143
|
finding: worthFixing[0] || null,
|
|
135
144
|
findingCount: worthFixing.length,
|
|
145
|
+
fixOutcome: offer === SuggestionOffer_1.default.Done ? input.finishedFix || null : null,
|
|
146
|
+
// A repository to connect comes first: Code's gate needs one to ask.
|
|
147
|
+
blocker: offer === SuggestionOffer_1.default.SetUp && input.hasConnectedRepository
|
|
148
|
+
? input.blocker || null
|
|
149
|
+
: null,
|
|
136
150
|
};
|
|
137
151
|
}
|
|
138
152
|
/*
|
|
@@ -169,6 +183,8 @@ exports.NO_TRACE_PERFORMANCE_FIX_SUGGESTION = {
|
|
|
169
183
|
offer: SuggestionOffer_1.default.None,
|
|
170
184
|
finding: null,
|
|
171
185
|
findingCount: 0,
|
|
186
|
+
fixOutcome: null,
|
|
187
|
+
blocker: null,
|
|
172
188
|
aiRunId: null,
|
|
173
189
|
};
|
|
174
190
|
function isFiniteNumber(value) {
|
|
@@ -254,8 +270,11 @@ function parsePerformanceFinding(value) {
|
|
|
254
270
|
/*
|
|
255
271
|
* Reads the suggestion route's answer. Whatever does not hold together - an
|
|
256
272
|
* offer that names no finding, a finding the rule would not offer, an
|
|
257
|
-
* in-progress offer with no run
|
|
258
|
-
*
|
|
273
|
+
* in-progress or done offer with no run, a done offer that does not say how
|
|
274
|
+
* it came out, a set-up step whose blocker this build cannot draw - reads as
|
|
275
|
+
* no suggestion, so the page never draws an action the answer does not
|
|
276
|
+
* fully back. A set-up step with no blocker at all is a repository to
|
|
277
|
+
* connect, as it was before blockers were sent.
|
|
259
278
|
*/
|
|
260
279
|
function parseTracePerformanceFixSuggestion(value) {
|
|
261
280
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -273,16 +292,34 @@ function parseTracePerformanceFixSuggestion(value) {
|
|
|
273
292
|
const aiRunId = typeof record["aiRunId"] === "string" && record["aiRunId"].length > 0
|
|
274
293
|
? record["aiRunId"]
|
|
275
294
|
: null;
|
|
276
|
-
|
|
295
|
+
const linksRun = offer === SuggestionOffer_1.default.InProgress || offer === SuggestionOffer_1.default.Done;
|
|
296
|
+
if (linksRun && !aiRunId) {
|
|
277
297
|
return exports.NO_TRACE_PERFORMANCE_FIX_SUGGESTION;
|
|
278
298
|
}
|
|
299
|
+
const fixOutcome = offer === SuggestionOffer_1.default.Done
|
|
300
|
+
? (0, CodeFixSuggestion_1.parseFinishedFixOutcome)(record["fixOutcome"])
|
|
301
|
+
: null;
|
|
302
|
+
if (offer === SuggestionOffer_1.default.Done && !fixOutcome) {
|
|
303
|
+
return exports.NO_TRACE_PERFORMANCE_FIX_SUGGESTION;
|
|
304
|
+
}
|
|
305
|
+
let blocker = null;
|
|
306
|
+
if (offer === SuggestionOffer_1.default.SetUp &&
|
|
307
|
+
record["blocker"] !== undefined &&
|
|
308
|
+
record["blocker"] !== null) {
|
|
309
|
+
blocker = (0, SuggestionBlocker_1.parseSuggestionBlocker)(record["blocker"]);
|
|
310
|
+
if (!blocker) {
|
|
311
|
+
return exports.NO_TRACE_PERFORMANCE_FIX_SUGGESTION;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
279
314
|
return {
|
|
280
315
|
offer,
|
|
281
316
|
finding,
|
|
282
317
|
findingCount: isFiniteNumber(record["findingCount"])
|
|
283
318
|
? Math.max(1, Math.floor(record["findingCount"]))
|
|
284
319
|
: 1,
|
|
285
|
-
|
|
320
|
+
fixOutcome,
|
|
321
|
+
blocker,
|
|
322
|
+
aiRunId: linksRun ? aiRunId : null,
|
|
286
323
|
};
|
|
287
324
|
}
|
|
288
325
|
// The route's answer as JSON (the server's side of the parser above).
|
|
@@ -293,6 +330,10 @@ function tracePerformanceFixSuggestionToJSON(suggestion) {
|
|
|
293
330
|
? JSON.parse(JSON.stringify(suggestion.finding))
|
|
294
331
|
: null,
|
|
295
332
|
findingCount: suggestion.findingCount,
|
|
333
|
+
fixOutcome: suggestion.fixOutcome,
|
|
334
|
+
blocker: suggestion.blocker
|
|
335
|
+
? (0, SuggestionBlocker_1.suggestionBlockerToJSON)(suggestion.blocker)
|
|
336
|
+
: null,
|
|
296
337
|
aiRunId: suggestion.aiRunId,
|
|
297
338
|
};
|
|
298
339
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneuptime/common",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.92",
|
|
4
4
|
"description": "OneUptime's shared types, utilities and data models, for Node.js and TypeScript.",
|
|
5
5
|
"homepage": "https://oneuptime.com",
|
|
6
6
|
"repository": {
|
|
@@ -72,8 +72,15 @@
|
|
|
72
72
|
"./Types/Workspace/NotificationRules/NotificationRuleCondition": null,
|
|
73
73
|
"./Types/Workspace/NotificationRules/NotificationRuleUtil": null,
|
|
74
74
|
"./Utils/Analytics": null,
|
|
75
|
+
"./Utils/CronScheduleText": null,
|
|
75
76
|
"./Utils/Dashboard/Components/DashboardClockComponent": null,
|
|
76
77
|
"./Utils/Dashboard/Components/Index": null,
|
|
78
|
+
"./Utils/Monitor/MonitorCheckScheduleUtil": null,
|
|
79
|
+
"./Utils/Monitor/MonitorOverviewFamily": null,
|
|
80
|
+
"./Utils/Monitor/MonitorOverviewPresentationUtil": null,
|
|
81
|
+
"./Utils/Monitor/MonitorOverviewProbeUtil": null,
|
|
82
|
+
"./Utils/Monitor/MonitorStatusHistoryUtil": null,
|
|
83
|
+
"./Utils/Monitor/MonitorUptimeSummaryUtil": null,
|
|
77
84
|
"./Utils/Schema/AnalyticsModelSchema": null,
|
|
78
85
|
"./Utils/Schema/BaseSchema": null,
|
|
79
86
|
"./Utils/Schema/ModelSchema": null,
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import Monitor from "../../Models/DatabaseModels/Monitor.mjs";
|
|
2
|
-
export declare enum MonitorCheckFreshness {
|
|
3
|
-
Fresh = "Fresh",
|
|
4
|
-
Stale = "Stale",
|
|
5
|
-
AwaitingFirstResult = "AwaitingFirstResult",
|
|
6
|
-
NotScheduled = "NotScheduled",
|
|
7
|
-
Unknown = "Unknown"
|
|
8
|
-
}
|
|
9
|
-
export interface MonitorCheckFreshnessResult {
|
|
10
|
-
freshness: MonitorCheckFreshness;
|
|
11
|
-
overdueSeconds: number | null;
|
|
12
|
-
resultAgeSeconds: number | null;
|
|
13
|
-
}
|
|
14
|
-
export interface MonitorScheduledRun {
|
|
15
|
-
runAt: Date;
|
|
16
|
-
spacingSeconds: number;
|
|
17
|
-
}
|
|
18
|
-
export interface MonitorResultLateness {
|
|
19
|
-
lateSeconds: number;
|
|
20
|
-
graceSeconds: number;
|
|
21
|
-
}
|
|
22
|
-
export default class MonitorCheckScheduleUtil {
|
|
23
|
-
static readonly DEFAULT_CADENCE_SECONDS: number;
|
|
24
|
-
static getCadenceSeconds(data: {
|
|
25
|
-
monitoringInterval: string | null | undefined;
|
|
26
|
-
from: Date;
|
|
27
|
-
}): number | null;
|
|
28
|
-
static resolveCadenceSeconds(data: {
|
|
29
|
-
monitoringInterval: string | null | undefined;
|
|
30
|
-
from: Date;
|
|
31
|
-
}): number;
|
|
32
|
-
static getNextRunAfter(data: {
|
|
33
|
-
monitoringInterval: string | null | undefined;
|
|
34
|
-
after: Date;
|
|
35
|
-
}): MonitorScheduledRun | null;
|
|
36
|
-
private static getNextTwoRuns;
|
|
37
|
-
private static isScheduleWithoutRuns;
|
|
38
|
-
static getResultLateness(data: {
|
|
39
|
-
lastResultAt: Date;
|
|
40
|
-
monitoringInterval?: string | null | undefined;
|
|
41
|
-
cadenceSeconds: number;
|
|
42
|
-
now: Date;
|
|
43
|
-
}): MonitorResultLateness;
|
|
44
|
-
static describeInterval(monitoringInterval: string | null | undefined): string;
|
|
45
|
-
static getGraceSeconds(cadenceSeconds: number): number;
|
|
46
|
-
static getCheckFreshness(data: {
|
|
47
|
-
isScheduled: boolean;
|
|
48
|
-
isKnown: boolean;
|
|
49
|
-
lastResultAt: Date | undefined;
|
|
50
|
-
nextCheckAt: Date | undefined;
|
|
51
|
-
cadenceSeconds: number;
|
|
52
|
-
createdAt: Date | undefined;
|
|
53
|
-
now: Date;
|
|
54
|
-
monitoringInterval?: string | null | undefined;
|
|
55
|
-
}): MonitorCheckFreshnessResult;
|
|
56
|
-
static getLatestSignalAt(data: {
|
|
57
|
-
monitor: Monitor;
|
|
58
|
-
probeLastResultAt: Date | undefined;
|
|
59
|
-
}): Date | undefined;
|
|
60
|
-
static parseDate(value: unknown): Date | undefined;
|
|
61
|
-
}
|