@oneuptime/common 14.0.96 → 14.0.97
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/AnalyticsModels/NetworkFlow.d.mts +4 -0
- package/Models/AnalyticsModels/NetworkFlow.d.ts +4 -0
- package/Models/AnalyticsModels/NetworkFlow.js +50 -0
- package/Models/DatabaseModels/Alert.d.mts +2 -0
- package/Models/DatabaseModels/Alert.d.ts +2 -0
- package/Models/DatabaseModels/Alert.js +63 -0
- package/Models/DatabaseModels/Incident.d.mts +2 -0
- package/Models/DatabaseModels/Incident.d.ts +2 -0
- package/Models/DatabaseModels/Incident.js +63 -0
- package/Models/DatabaseModels/Index.js +10 -0
- package/Models/DatabaseModels/NetworkAddressName.d.mts +14 -0
- package/Models/DatabaseModels/NetworkAddressName.d.ts +14 -0
- package/Models/DatabaseModels/NetworkAddressName.js +300 -0
- package/Models/DatabaseModels/NetworkAddressName.mjs +2 -0
- package/Models/DatabaseModels/NetworkDevice.d.mts +1 -0
- package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
- package/Models/DatabaseModels/NetworkDevice.js +38 -0
- package/Models/DatabaseModels/SecurityCase.d.mts +8 -0
- package/Models/DatabaseModels/SecurityCase.d.ts +8 -0
- package/Models/DatabaseModels/SecurityCase.js +145 -0
- package/Models/DatabaseModels/SecurityCaseEvidence.d.mts +28 -0
- package/Models/DatabaseModels/SecurityCaseEvidence.d.ts +28 -0
- package/Models/DatabaseModels/SecurityCaseEvidence.js +489 -0
- package/Models/DatabaseModels/SecurityCaseEvidence.mjs +2 -0
- package/Models/DatabaseModels/SecurityCaseFeed.d.mts +4 -1
- package/Models/DatabaseModels/SecurityCaseFeed.d.ts +4 -1
- package/Models/DatabaseModels/SecurityCaseFeed.js +6 -0
- package/Models/DatabaseModels/SecurityCasePriority.d.mts +2 -0
- package/Models/DatabaseModels/SecurityCasePriority.d.ts +2 -0
- package/Models/DatabaseModels/SecurityCasePriority.js +44 -0
- package/Models/DatabaseModels/SecurityCaseTask.d.mts +22 -0
- package/Models/DatabaseModels/SecurityCaseTask.d.ts +22 -0
- package/Models/DatabaseModels/SecurityCaseTask.js +467 -0
- package/Models/DatabaseModels/SecurityCaseTask.mjs +2 -0
- package/Models/DatabaseModels/SecurityWatchlist.d.mts +22 -0
- package/Models/DatabaseModels/SecurityWatchlist.d.ts +22 -0
- package/Models/DatabaseModels/SecurityWatchlist.js +411 -0
- package/Models/DatabaseModels/SecurityWatchlist.mjs +2 -0
- package/Models/DatabaseModels/SecurityWatchlistItem.d.mts +17 -0
- package/Models/DatabaseModels/SecurityWatchlistItem.d.ts +17 -0
- package/Models/DatabaseModels/SecurityWatchlistItem.js +321 -0
- package/Models/DatabaseModels/SecurityWatchlistItem.mjs +2 -0
- package/Types/AI/AiAffectedResources.d.mts +2 -1
- package/Types/AI/AiAffectedResources.d.ts +2 -1
- package/Types/AI/AiAffectedResources.js +12 -1
- package/Types/AffectedResources/AffectedResourceSearch.d.mts +53 -0
- package/Types/AffectedResources/AffectedResourceSearch.d.ts +53 -0
- package/Types/AffectedResources/AffectedResourceSearch.js +224 -0
- package/Types/AffectedResources/AffectedResourceSearch.mjs +11 -0
- package/Types/ArchivableValue/ArchivableValueUsage.d.mts +21 -2
- package/Types/ArchivableValue/ArchivableValueUsage.d.ts +21 -2
- package/Types/ArchivableValue/ArchivableValueUsage.js +91 -12
- package/Types/ArchivableValue/ArchivableValueUsage.mjs +1 -0
- package/Types/Color.d.mts +0 -2
- package/Types/Color.d.ts +0 -2
- package/Types/Color.js +0 -14
- package/Types/Database/DatabaseProperty.d.mts +0 -2
- package/Types/Database/DatabaseProperty.d.ts +0 -2
- package/Types/Database/DatabaseProperty.js +0 -3
- package/Types/Date.d.mts +0 -2
- package/Types/Date.d.ts +0 -2
- package/Types/Date.js +0 -23
- package/Types/Domain.d.mts +0 -2
- package/Types/Domain.d.ts +0 -2
- package/Types/Domain.js +0 -14
- package/Types/Email/EmailTemplateType.d.mts +2 -0
- package/Types/Email/EmailTemplateType.d.ts +2 -0
- package/Types/Email/EmailTemplateType.js +2 -0
- package/Types/Email.d.mts +0 -2
- package/Types/Email.d.ts +0 -2
- package/Types/Email.js +0 -15
- package/Types/IP/IP.d.mts +0 -2
- package/Types/IP/IP.d.ts +0 -2
- package/Types/IP/IP.js +0 -14
- package/Types/Monitor/CriteriaAlert.d.mts +0 -2
- package/Types/Monitor/CriteriaAlert.d.ts +0 -2
- package/Types/Monitor/CriteriaAlert.js +0 -18
- package/Types/Monitor/CriteriaAlert.mjs +1 -2
- package/Types/Monitor/CriteriaFilter.d.mts +0 -2
- package/Types/Monitor/CriteriaFilter.d.ts +0 -2
- package/Types/Monitor/CriteriaFilter.js +1 -42
- package/Types/Monitor/CriteriaFilter.mjs +0 -1
- package/Types/Monitor/CriteriaIncident.d.mts +0 -2
- package/Types/Monitor/CriteriaIncident.d.ts +0 -2
- package/Types/Monitor/CriteriaIncident.js +0 -23
- package/Types/Monitor/CriteriaIncident.mjs +1 -2
- package/Types/Monitor/IncomingMonitor/IncidentGroupingConfig.d.mts +0 -2
- package/Types/Monitor/IncomingMonitor/IncidentGroupingConfig.d.ts +0 -2
- package/Types/Monitor/IncomingMonitor/IncidentGroupingConfig.js +0 -11
- package/Types/Monitor/IncomingMonitor/IncidentGroupingConfig.mjs +1 -2
- package/Types/Monitor/MonitorCriteria.d.mts +0 -2
- package/Types/Monitor/MonitorCriteria.d.ts +0 -2
- package/Types/Monitor/MonitorCriteria.js +0 -21
- package/Types/Monitor/MonitorCriteriaInstance.d.mts +0 -2
- package/Types/Monitor/MonitorCriteriaInstance.d.ts +0 -2
- package/Types/Monitor/MonitorCriteriaInstance.js +0 -54
- package/Types/Monitor/MonitorStep.d.mts +0 -2
- package/Types/Monitor/MonitorStep.d.ts +0 -2
- package/Types/Monitor/MonitorStep.js +0 -80
- package/Types/Monitor/MonitorSteps.d.mts +0 -2
- package/Types/Monitor/MonitorSteps.d.ts +0 -2
- package/Types/Monitor/MonitorSteps.js +0 -31
- package/Types/Name.d.mts +0 -2
- package/Types/Name.d.ts +0 -2
- package/Types/Name.js +0 -14
- package/Types/NetFlow/NetworkAddressName.d.mts +30 -0
- package/Types/NetFlow/NetworkAddressName.d.ts +30 -0
- package/Types/NetFlow/NetworkAddressName.js +149 -0
- package/Types/NetFlow/NetworkAddressName.mjs +6 -0
- package/Types/NetFlow/NetworkTraffic.d.mts +20 -0
- package/Types/NetFlow/NetworkTraffic.d.ts +20 -0
- package/Types/NetFlow/NetworkTraffic.js +5 -1
- package/Types/NetFlow/NetworkTraffic.mjs +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.d.mts +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.d.ts +2 -0
- package/Types/NetworkController/NetworkControllerReadSummary.js +7 -1
- package/Types/NetworkDevice/NetworkDeviceDiscoveredDetails.d.mts +47 -1
- package/Types/NetworkDevice/NetworkDeviceDiscoveredDetails.d.ts +47 -1
- package/Types/NetworkDevice/NetworkDeviceDiscoveredDetails.js +173 -8
- package/Types/NetworkDevice/NetworkDeviceDiscoveredDetails.mjs +7 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.js +3 -0
- package/Types/NotificationSetting/NotificationEmailRollupPolicy.js +6 -0
- package/Types/NotificationSetting/NotificationSettingEventType.d.mts +2 -0
- package/Types/NotificationSetting/NotificationSettingEventType.d.ts +2 -0
- package/Types/NotificationSetting/NotificationSettingEventType.js +9 -0
- package/Types/ObjectID.d.mts +0 -1
- package/Types/ObjectID.d.ts +0 -1
- package/Types/ObjectID.js +0 -9
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunEnding.d.mts +4 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunEnding.d.ts +4 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunEnding.js +25 -1
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunEnding.mjs +4 -0
- package/Types/OnCallDutyPolicy/OnCallEmptyLevel.d.mts +15 -0
- package/Types/OnCallDutyPolicy/OnCallEmptyLevel.d.ts +15 -0
- package/Types/OnCallDutyPolicy/OnCallEmptyLevel.js +118 -0
- package/Types/OnCallDutyPolicy/OnCallEmptyLevel.mjs +9 -0
- package/Types/Permission.d.mts +8 -0
- package/Types/Permission.d.ts +8 -0
- package/Types/Permission.js +87 -3
- package/Types/Phone.d.mts +0 -2
- package/Types/Phone.d.ts +0 -2
- package/Types/Phone.js +0 -14
- package/Types/Port.d.mts +0 -2
- package/Types/Port.d.ts +0 -2
- package/Types/Port.js +0 -14
- package/Types/ProviderLogo/ProviderLogo.d.mts +8 -1
- package/Types/ProviderLogo/ProviderLogo.d.ts +8 -1
- package/Types/ProviderLogo/ProviderLogo.js +14 -0
- package/Types/SecurityCase/SecurityCaseEvidenceKind.d.mts +7 -0
- package/Types/SecurityCase/SecurityCaseEvidenceKind.d.ts +7 -0
- package/Types/SecurityCase/SecurityCaseEvidenceKind.js +24 -0
- package/Types/SecurityCase/SecurityCaseEvidenceKind.mjs +4 -0
- package/Types/SecurityEvent/SecurityWatchlist.d.mts +167 -0
- package/Types/SecurityEvent/SecurityWatchlist.d.ts +167 -0
- package/Types/SecurityEvent/SecurityWatchlist.js +648 -0
- package/Types/SecurityEvent/SecurityWatchlist.mjs +51 -0
- package/Types/SecurityEvent/SigmaRule.d.mts +2 -0
- package/Types/SecurityEvent/SigmaRule.d.ts +2 -0
- package/Types/SecurityEvent/SigmaRule.js +5 -0
- package/Types/Telemetry/OpenTelemetryGuides.js +177 -5
- package/Types/Version.d.mts +0 -2
- package/Types/Version.d.ts +0 -2
- package/Types/Version.js +0 -14
- package/Types/Workflow/AffectedResourcesSetting.d.mts +13 -0
- package/Types/Workflow/AffectedResourcesSetting.d.ts +13 -0
- package/Types/Workflow/AffectedResourcesSetting.js +120 -0
- package/Types/Workflow/AffectedResourcesSetting.mjs +8 -0
- package/Types/Workflow/Components/BaseModel.js +15 -3
- package/Types/Workflow/Documentation/DatabaseDocumentation.js +36 -0
- package/Utils/Inventory/AssetFactSource.d.mts +6 -2
- package/Utils/Inventory/AssetFactSource.d.ts +6 -2
- package/Utils/Inventory/AssetFactSource.js +18 -1
- package/Utils/Inventory/AssetFactSource.mjs +1 -0
- package/Utils/Markdown/FeedLead.d.mts +10 -0
- package/Utils/Markdown/FeedLead.d.ts +10 -0
- package/Utils/Markdown/FeedLead.js +198 -0
- package/Utils/Markdown/FeedLead.mjs +8 -0
- package/Utils/NetworkDevice/NetworkDeviceAssetFacts.d.mts +9 -1
- package/Utils/NetworkDevice/NetworkDeviceAssetFacts.d.ts +9 -1
- package/Utils/NetworkDevice/NetworkDeviceAssetFacts.js +139 -18
- package/Utils/NetworkDevice/NetworkDeviceAssetFacts.mjs +1 -0
- package/Utils/NetworkDevice/NetworkDeviceRefresh.d.mts +88 -0
- package/Utils/NetworkDevice/NetworkDeviceRefresh.d.ts +88 -0
- package/Utils/NetworkDevice/NetworkDeviceRefresh.js +232 -0
- package/Utils/NetworkDevice/NetworkDeviceRefresh.mjs +16 -0
- package/Utils/NetworkTraffic/NetworkAddressBlock.d.mts +20 -0
- package/Utils/NetworkTraffic/NetworkAddressBlock.d.ts +20 -0
- package/Utils/NetworkTraffic/NetworkAddressBlock.js +264 -0
- package/Utils/NetworkTraffic/NetworkAddressBlock.mjs +3 -0
- package/Utils/Schema/MonitorSchemas.d.mts +9 -0
- package/Utils/Schema/MonitorSchemas.d.ts +9 -0
- package/Utils/Schema/MonitorSchemas.js +291 -0
- package/Utils/Schema/MonitorSchemas.mjs +9 -0
- package/Utils/Schema/TypeSchemas.d.mts +12 -0
- package/Utils/Schema/TypeSchemas.d.ts +12 -0
- package/Utils/Schema/TypeSchemas.js +176 -0
- package/Utils/Schema/TypeSchemas.mjs +11 -0
- package/Utils/Schema/Zod.js +17 -17
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.mts +34 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.d.ts +34 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.js +69 -0
- package/Utils/SecurityCase/SecurityCaseMarkdown.mjs +9 -0
- package/Utils/SecurityCase/SecurityCasePriorities.d.mts +2 -0
- package/Utils/SecurityCase/SecurityCasePriorities.d.ts +2 -0
- package/Utils/SecurityCase/SecurityCasePriorities.js +15 -1
- package/Utils/SecurityCase/SecurityCaseTargets.d.mts +128 -0
- package/Utils/SecurityCase/SecurityCaseTargets.d.ts +128 -0
- package/Utils/SecurityCase/SecurityCaseTargets.js +482 -0
- package/Utils/SecurityCase/SecurityCaseTargets.mjs +28 -0
- package/Utils/SecurityEvent/Sigma/SigmaRuleParser.js +22 -0
- package/Utils/SecurityEvent/Sigma/SigmaWatchlists.d.mts +24 -0
- package/Utils/SecurityEvent/Sigma/SigmaWatchlists.d.ts +24 -0
- package/Utils/SecurityEvent/Sigma/SigmaWatchlists.js +183 -0
- package/Utils/SecurityEvent/Sigma/SigmaWatchlists.mjs +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AFFECTED_RESOURCE_SEARCH_MAX_TEXT_LENGTH = exports.AFFECTED_RESOURCE_SEARCH_MAX_LIMIT = exports.AFFECTED_RESOURCE_SEARCH_DEFAULT_LIMIT = exports.AFFECTED_RESOURCE_SEARCH_ROUTE = exports.AFFECTED_RESOURCE_KINDS = exports.AffectedResourceKind = void 0;
|
|
7
|
+
exports.isAffectedResourceKind = isAffectedResourceKind;
|
|
8
|
+
exports.readAffectedResourceSearchRequest = readAffectedResourceSearchRequest;
|
|
9
|
+
exports.readAffectedResourceSearchResult = readAffectedResourceSearchResult;
|
|
10
|
+
exports.toAffectedResourceSearchResultJSON = toAffectedResourceSearchResultJSON;
|
|
11
|
+
const BadDataException_1 = __importDefault(require("../Exception/BadDataException"));
|
|
12
|
+
const ObjectID_1 = __importDefault(require("../ObjectID"));
|
|
13
|
+
/*
|
|
14
|
+
* ONE SEARCH ACROSS EVERY KIND OF RESOURCE AN INCIDENT, AN ALERT OR A
|
|
15
|
+
* MAINTENANCE EVENT CAN AFFECT.
|
|
16
|
+
*
|
|
17
|
+
* Issue #5341: a customer read the Affected Resources picker as "a lookup
|
|
18
|
+
* against Hosts" - a project with hosts and network devices found its
|
|
19
|
+
* hosts, and nothing else, because routers and switches could not be
|
|
20
|
+
* linked at all, and every kind the picker did search was asked for twice
|
|
21
|
+
* per keystroke (its name, then its description), about thirty requests a
|
|
22
|
+
* letter. The picker now asks once (POST /affected-resources/search), and
|
|
23
|
+
* the server reads each kind with the person's own rights: a kind they may
|
|
24
|
+
* not read is named, never listed, and labels and owned scope narrow the
|
|
25
|
+
* rest as a list of that kind would.
|
|
26
|
+
*
|
|
27
|
+
* This module is the request and the answer, read the same way on both
|
|
28
|
+
* sides: the kinds (the picker's AffectedResourceType values), the limits,
|
|
29
|
+
* and the parsers that keep a malformed request out of the server and a
|
|
30
|
+
* malformed answer out of the picker. React-free and server-free.
|
|
31
|
+
*/
|
|
32
|
+
var AffectedResourceKind;
|
|
33
|
+
(function (AffectedResourceKind) {
|
|
34
|
+
AffectedResourceKind["Monitor"] = "Monitor";
|
|
35
|
+
AffectedResourceKind["Host"] = "Host";
|
|
36
|
+
AffectedResourceKind["NetworkDevice"] = "NetworkDevice";
|
|
37
|
+
AffectedResourceKind["KubernetesCluster"] = "KubernetesCluster";
|
|
38
|
+
AffectedResourceKind["DockerHost"] = "DockerHost";
|
|
39
|
+
AffectedResourceKind["PodmanHost"] = "PodmanHost";
|
|
40
|
+
AffectedResourceKind["ProxmoxCluster"] = "ProxmoxCluster";
|
|
41
|
+
AffectedResourceKind["VMwareVCenter"] = "VMwareVCenter";
|
|
42
|
+
AffectedResourceKind["CephCluster"] = "CephCluster";
|
|
43
|
+
AffectedResourceKind["StorageArray"] = "StorageArray";
|
|
44
|
+
AffectedResourceKind["DockerSwarmCluster"] = "DockerSwarmCluster";
|
|
45
|
+
AffectedResourceKind["IoTFleet"] = "IoTFleet";
|
|
46
|
+
AffectedResourceKind["DatabaseServer"] = "DatabaseServer";
|
|
47
|
+
AffectedResourceKind["CloudResource"] = "CloudResource";
|
|
48
|
+
AffectedResourceKind["NetworkSite"] = "NetworkSite";
|
|
49
|
+
AffectedResourceKind["Service"] = "Service";
|
|
50
|
+
})(AffectedResourceKind || (exports.AffectedResourceKind = AffectedResourceKind = {}));
|
|
51
|
+
// Every kind, in the order the enum lists them.
|
|
52
|
+
exports.AFFECTED_RESOURCE_KINDS = Object.values(AffectedResourceKind);
|
|
53
|
+
// The route the picker, the API and an API key ask.
|
|
54
|
+
exports.AFFECTED_RESOURCE_SEARCH_ROUTE = "/affected-resources/search";
|
|
55
|
+
/*
|
|
56
|
+
* How many of each kind one answer lists: a page of suggestions per kind
|
|
57
|
+
* while every kind is shown, more once the person narrows to one.
|
|
58
|
+
*/
|
|
59
|
+
exports.AFFECTED_RESOURCE_SEARCH_DEFAULT_LIMIT = 15;
|
|
60
|
+
exports.AFFECTED_RESOURCE_SEARCH_MAX_LIMIT = 50;
|
|
61
|
+
/*
|
|
62
|
+
* The longest text searched for. A name is at most a few hundred
|
|
63
|
+
* characters; anything longer is cut rather than refused, so a pasted line
|
|
64
|
+
* still finds the resource it starts with.
|
|
65
|
+
*/
|
|
66
|
+
exports.AFFECTED_RESOURCE_SEARCH_MAX_TEXT_LENGTH = 200;
|
|
67
|
+
function isAffectedResourceKind(value) {
|
|
68
|
+
return (typeof value === "string" &&
|
|
69
|
+
exports.AFFECTED_RESOURCE_KINDS.includes(value));
|
|
70
|
+
}
|
|
71
|
+
// Each kind once, in the order first given.
|
|
72
|
+
function readKinds(value, name) {
|
|
73
|
+
var _a;
|
|
74
|
+
if (value === undefined || value === null) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
if (!Array.isArray(value)) {
|
|
78
|
+
throw new BadDataException_1.default(`${name} must be a list of resource kinds.`);
|
|
79
|
+
}
|
|
80
|
+
const kinds = [];
|
|
81
|
+
for (const item of value) {
|
|
82
|
+
if (!isAffectedResourceKind(item)) {
|
|
83
|
+
throw new BadDataException_1.default(`${name} lists ${((_a = JSON.stringify(item)) === null || _a === void 0 ? void 0 : _a.substring(0, 60)) || "nothing"}, which is not a kind of resource. Use one of: ${exports.AFFECTED_RESOURCE_KINDS.join(", ")}.`);
|
|
84
|
+
}
|
|
85
|
+
if (!kinds.includes(item)) {
|
|
86
|
+
kinds.push(item);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return kinds;
|
|
90
|
+
}
|
|
91
|
+
/*
|
|
92
|
+
* A request as the server takes it: the kinds checked (an unknown one is
|
|
93
|
+
* refused, naming the ones there are), each kind once, the text trimmed and
|
|
94
|
+
* cut to its limit, the limit held between 1 and the maximum, and a kind
|
|
95
|
+
* both listed and counted listed only.
|
|
96
|
+
*/
|
|
97
|
+
function readAffectedResourceSearchRequest(body) {
|
|
98
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) {
|
|
99
|
+
throw new BadDataException_1.default("The search must be a JSON object with search and kinds.");
|
|
100
|
+
}
|
|
101
|
+
const json = body;
|
|
102
|
+
const rawSearch = json["search"];
|
|
103
|
+
if (rawSearch !== undefined &&
|
|
104
|
+
rawSearch !== null &&
|
|
105
|
+
typeof rawSearch !== "string") {
|
|
106
|
+
throw new BadDataException_1.default("search must be text.");
|
|
107
|
+
}
|
|
108
|
+
const search = (typeof rawSearch === "string" ? rawSearch : "")
|
|
109
|
+
.trim()
|
|
110
|
+
.substring(0, exports.AFFECTED_RESOURCE_SEARCH_MAX_TEXT_LENGTH)
|
|
111
|
+
.trim();
|
|
112
|
+
const kinds = readKinds(json["kinds"], "kinds");
|
|
113
|
+
if (kinds.length === 0) {
|
|
114
|
+
throw new BadDataException_1.default("kinds must name at least one kind of resource to search.");
|
|
115
|
+
}
|
|
116
|
+
const countKinds = readKinds(json["countKinds"], "countKinds").filter((kind) => {
|
|
117
|
+
return !kinds.includes(kind);
|
|
118
|
+
});
|
|
119
|
+
const rawLimit = json["limitPerKind"];
|
|
120
|
+
let limitPerKind = exports.AFFECTED_RESOURCE_SEARCH_DEFAULT_LIMIT;
|
|
121
|
+
if (rawLimit !== undefined && rawLimit !== null) {
|
|
122
|
+
const parsed = typeof rawLimit === "number" ? rawLimit : Number(rawLimit);
|
|
123
|
+
if (!Number.isFinite(parsed)) {
|
|
124
|
+
throw new BadDataException_1.default("limitPerKind must be a number.");
|
|
125
|
+
}
|
|
126
|
+
limitPerKind = Math.min(exports.AFFECTED_RESOURCE_SEARCH_MAX_LIMIT, Math.max(1, Math.floor(parsed)));
|
|
127
|
+
}
|
|
128
|
+
return { search, kinds, limitPerKind, countKinds };
|
|
129
|
+
}
|
|
130
|
+
function readCount(value) {
|
|
131
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0
|
|
132
|
+
? Math.floor(value)
|
|
133
|
+
: 0;
|
|
134
|
+
}
|
|
135
|
+
/*
|
|
136
|
+
* An answer as the picker reads it: an entry it cannot read (no kind, no
|
|
137
|
+
* id) is dropped rather than shown half, and a count is never below the
|
|
138
|
+
* matches listed.
|
|
139
|
+
*/
|
|
140
|
+
function readAffectedResourceSearchResult(data) {
|
|
141
|
+
const json = data && typeof data === "object" && !Array.isArray(data)
|
|
142
|
+
? data
|
|
143
|
+
: {};
|
|
144
|
+
const kinds = [];
|
|
145
|
+
for (const entry of Array.isArray(json["kinds"]) ? json["kinds"] : []) {
|
|
146
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const kindJson = entry;
|
|
150
|
+
const kind = kindJson["kind"];
|
|
151
|
+
if (!isAffectedResourceKind(kind)) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const matches = [];
|
|
155
|
+
const rawMatches = kindJson["matches"];
|
|
156
|
+
for (const match of Array.isArray(rawMatches) ? rawMatches : []) {
|
|
157
|
+
if (!match || typeof match !== "object" || Array.isArray(match)) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const matchJson = match;
|
|
161
|
+
const id = matchJson["_id"];
|
|
162
|
+
if (typeof id !== "string" || !ObjectID_1.default.isValidUUID(id)) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const name = matchJson["name"];
|
|
166
|
+
const detail = matchJson["detail"];
|
|
167
|
+
const read = {
|
|
168
|
+
_id: id,
|
|
169
|
+
name: typeof name === "string" ? name : "",
|
|
170
|
+
};
|
|
171
|
+
if (typeof detail === "string" && detail.trim()) {
|
|
172
|
+
read.detail = detail.trim();
|
|
173
|
+
}
|
|
174
|
+
matches.push(read);
|
|
175
|
+
}
|
|
176
|
+
kinds.push({
|
|
177
|
+
kind: kind,
|
|
178
|
+
count: Math.max(readCount(kindJson["count"]), matches.length),
|
|
179
|
+
matches: matches,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const counts = [];
|
|
183
|
+
for (const entry of Array.isArray(json["counts"]) ? json["counts"] : []) {
|
|
184
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
const countJson = entry;
|
|
188
|
+
const kind = countJson["kind"];
|
|
189
|
+
if (isAffectedResourceKind(kind)) {
|
|
190
|
+
counts.push({ kind: kind, count: readCount(countJson["count"]) });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const unreadableKinds = [];
|
|
194
|
+
for (const kind of Array.isArray(json["unreadableKinds"])
|
|
195
|
+
? json["unreadableKinds"]
|
|
196
|
+
: []) {
|
|
197
|
+
if (isAffectedResourceKind(kind) && !unreadableKinds.includes(kind)) {
|
|
198
|
+
unreadableKinds.push(kind);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return { kinds, counts, unreadableKinds };
|
|
202
|
+
}
|
|
203
|
+
// The answer as JSON, as the route sends it.
|
|
204
|
+
function toAffectedResourceSearchResultJSON(result) {
|
|
205
|
+
return {
|
|
206
|
+
kinds: result.kinds.map((kind) => {
|
|
207
|
+
return {
|
|
208
|
+
kind: kind.kind,
|
|
209
|
+
count: kind.count,
|
|
210
|
+
matches: kind.matches.map((match) => {
|
|
211
|
+
const json = { _id: match._id, name: match.name };
|
|
212
|
+
if (match.detail) {
|
|
213
|
+
json["detail"] = match.detail;
|
|
214
|
+
}
|
|
215
|
+
return json;
|
|
216
|
+
}),
|
|
217
|
+
};
|
|
218
|
+
}),
|
|
219
|
+
counts: result.counts.map((count) => {
|
|
220
|
+
return { kind: count.kind, count: count.count };
|
|
221
|
+
}),
|
|
222
|
+
unreadableKinds: [...result.unreadableKinds],
|
|
223
|
+
};
|
|
224
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import commonJsModule from "./AffectedResourceSearch.js";
|
|
2
|
+
export const AFFECTED_RESOURCE_KINDS = commonJsModule.AFFECTED_RESOURCE_KINDS;
|
|
3
|
+
export const AFFECTED_RESOURCE_SEARCH_DEFAULT_LIMIT = commonJsModule.AFFECTED_RESOURCE_SEARCH_DEFAULT_LIMIT;
|
|
4
|
+
export const AFFECTED_RESOURCE_SEARCH_MAX_LIMIT = commonJsModule.AFFECTED_RESOURCE_SEARCH_MAX_LIMIT;
|
|
5
|
+
export const AFFECTED_RESOURCE_SEARCH_MAX_TEXT_LENGTH = commonJsModule.AFFECTED_RESOURCE_SEARCH_MAX_TEXT_LENGTH;
|
|
6
|
+
export const AFFECTED_RESOURCE_SEARCH_ROUTE = commonJsModule.AFFECTED_RESOURCE_SEARCH_ROUTE;
|
|
7
|
+
export const AffectedResourceKind = commonJsModule.AffectedResourceKind;
|
|
8
|
+
export const isAffectedResourceKind = commonJsModule.isAffectedResourceKind;
|
|
9
|
+
export const readAffectedResourceSearchRequest = commonJsModule.readAffectedResourceSearchRequest;
|
|
10
|
+
export const readAffectedResourceSearchResult = commonJsModule.readAffectedResourceSearchResult;
|
|
11
|
+
export const toAffectedResourceSearchResultJSON = commonJsModule.toAffectedResourceSearchResultJSON;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONArray } from "../JSON.mjs";
|
|
1
|
+
import { JSONArray, JSONObject } from "../JSON.mjs";
|
|
2
2
|
export declare enum ArchivableValueDeleteEffect {
|
|
3
3
|
Refused = "Refused",
|
|
4
4
|
Deleted = "Deleted",
|
|
@@ -8,7 +8,8 @@ export declare enum ArchivableValueDeleteEffect {
|
|
|
8
8
|
}
|
|
9
9
|
export declare enum ArchivableValueUsageKind {
|
|
10
10
|
Records = "Records",
|
|
11
|
-
Settings = "Settings"
|
|
11
|
+
Settings = "Settings",
|
|
12
|
+
Personal = "Personal"
|
|
12
13
|
}
|
|
13
14
|
export interface ArchivableValueUsageItem {
|
|
14
15
|
tableName: string;
|
|
@@ -16,12 +17,30 @@ export interface ArchivableValueUsageItem {
|
|
|
16
17
|
singularTitle: string;
|
|
17
18
|
count: number;
|
|
18
19
|
isCountCapped: boolean;
|
|
20
|
+
totalCount?: number | undefined;
|
|
21
|
+
isTotalCountCapped?: boolean | undefined;
|
|
19
22
|
effect: ArchivableValueDeleteEffect;
|
|
20
23
|
kind: ArchivableValueUsageKind;
|
|
21
24
|
}
|
|
25
|
+
export declare enum ArchivableValuesUsagePurpose {
|
|
26
|
+
Archive = "Archive",
|
|
27
|
+
Delete = "Delete"
|
|
28
|
+
}
|
|
29
|
+
export interface ArchivableValuesUsage {
|
|
30
|
+
usage: Array<ArchivableValueUsageItem>;
|
|
31
|
+
refusedValueIds: Array<string>;
|
|
32
|
+
refusedUsage: Array<ArchivableValueUsageItem>;
|
|
33
|
+
}
|
|
22
34
|
export default class ArchivableValueUsage {
|
|
23
35
|
static toJSONArray(items: Array<ArchivableValueUsageItem>): JSONArray;
|
|
24
36
|
static fromJSONArray(value: unknown): Array<ArchivableValueUsageItem>;
|
|
37
|
+
static valuesUsageToJSON(usage: ArchivableValuesUsage): JSONObject;
|
|
38
|
+
static valuesUsageFromJSON(value: unknown): ArchivableValuesUsage;
|
|
25
39
|
static isDeleteRefused(items: Array<ArchivableValueUsageItem>): boolean;
|
|
26
40
|
static getSettings(items: Array<ArchivableValueUsageItem>): Array<ArchivableValueUsageItem>;
|
|
41
|
+
static getPersonal(items: Array<ArchivableValueUsageItem>): Array<ArchivableValueUsageItem>;
|
|
42
|
+
static getTotalCount(item: ArchivableValueUsageItem): {
|
|
43
|
+
count: number;
|
|
44
|
+
isCountCapped: boolean;
|
|
45
|
+
};
|
|
27
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONArray } from "../JSON";
|
|
1
|
+
import { JSONArray, JSONObject } from "../JSON";
|
|
2
2
|
export declare enum ArchivableValueDeleteEffect {
|
|
3
3
|
Refused = "Refused",
|
|
4
4
|
Deleted = "Deleted",
|
|
@@ -8,7 +8,8 @@ export declare enum ArchivableValueDeleteEffect {
|
|
|
8
8
|
}
|
|
9
9
|
export declare enum ArchivableValueUsageKind {
|
|
10
10
|
Records = "Records",
|
|
11
|
-
Settings = "Settings"
|
|
11
|
+
Settings = "Settings",
|
|
12
|
+
Personal = "Personal"
|
|
12
13
|
}
|
|
13
14
|
export interface ArchivableValueUsageItem {
|
|
14
15
|
tableName: string;
|
|
@@ -16,12 +17,30 @@ export interface ArchivableValueUsageItem {
|
|
|
16
17
|
singularTitle: string;
|
|
17
18
|
count: number;
|
|
18
19
|
isCountCapped: boolean;
|
|
20
|
+
totalCount?: number | undefined;
|
|
21
|
+
isTotalCountCapped?: boolean | undefined;
|
|
19
22
|
effect: ArchivableValueDeleteEffect;
|
|
20
23
|
kind: ArchivableValueUsageKind;
|
|
21
24
|
}
|
|
25
|
+
export declare enum ArchivableValuesUsagePurpose {
|
|
26
|
+
Archive = "Archive",
|
|
27
|
+
Delete = "Delete"
|
|
28
|
+
}
|
|
29
|
+
export interface ArchivableValuesUsage {
|
|
30
|
+
usage: Array<ArchivableValueUsageItem>;
|
|
31
|
+
refusedValueIds: Array<string>;
|
|
32
|
+
refusedUsage: Array<ArchivableValueUsageItem>;
|
|
33
|
+
}
|
|
22
34
|
export default class ArchivableValueUsage {
|
|
23
35
|
static toJSONArray(items: Array<ArchivableValueUsageItem>): JSONArray;
|
|
24
36
|
static fromJSONArray(value: unknown): Array<ArchivableValueUsageItem>;
|
|
37
|
+
static valuesUsageToJSON(usage: ArchivableValuesUsage): JSONObject;
|
|
38
|
+
static valuesUsageFromJSON(value: unknown): ArchivableValuesUsage;
|
|
25
39
|
static isDeleteRefused(items: Array<ArchivableValueUsageItem>): boolean;
|
|
26
40
|
static getSettings(items: Array<ArchivableValueUsageItem>): Array<ArchivableValueUsageItem>;
|
|
41
|
+
static getPersonal(items: Array<ArchivableValueUsageItem>): Array<ArchivableValueUsageItem>;
|
|
42
|
+
static getTotalCount(item: ArchivableValueUsageItem): {
|
|
43
|
+
count: number;
|
|
44
|
+
isCountCapped: boolean;
|
|
45
|
+
};
|
|
27
46
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ArchivableValueUsageKind = exports.ArchivableValueDeleteEffect = void 0;
|
|
3
|
+
exports.ArchivableValuesUsagePurpose = exports.ArchivableValueUsageKind = exports.ArchivableValueDeleteEffect = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* What the server answers about a value's uses (ArchivableValueUsage, the
|
|
6
|
-
* `<value route>/:id/usage` endpoint
|
|
7
|
-
*
|
|
6
|
+
* `<value route>/:id/usage` endpoint, and `<value route>/usage` for several
|
|
7
|
+
* values at once), and what the dashboard reads to say what archiving keeps
|
|
8
|
+
* and what deleting would change.
|
|
8
9
|
*/
|
|
9
10
|
// What deleting the value does to these records.
|
|
10
11
|
var ArchivableValueDeleteEffect;
|
|
@@ -21,21 +22,49 @@ var ArchivableValueDeleteEffect;
|
|
|
21
22
|
ArchivableValueDeleteEffect["LeftDangling"] = "LeftDangling";
|
|
22
23
|
})(ArchivableValueDeleteEffect || (exports.ArchivableValueDeleteEffect = ArchivableValueDeleteEffect = {}));
|
|
23
24
|
/*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* What kind of thing uses the value:
|
|
26
|
+
*
|
|
27
|
+
* - Records have it (incidents, monitors, state history): archiving
|
|
28
|
+
* changes nothing for them.
|
|
29
|
+
* - Settings are the project's own set-up that sets the value or matches
|
|
30
|
+
* on it (rules, templates, monitor criteria, workflows): they keep using
|
|
31
|
+
* an archived value until someone changes them.
|
|
32
|
+
* - Personal settings are a person's own (the on-call rules each person
|
|
33
|
+
* has for a severity, their notification settings): counted by person,
|
|
34
|
+
* since nobody thinks of them as the project's rules. They stay as they
|
|
35
|
+
* are when the value is archived, and keep working for the records that
|
|
36
|
+
* keep it.
|
|
27
37
|
*/
|
|
28
38
|
var ArchivableValueUsageKind;
|
|
29
39
|
(function (ArchivableValueUsageKind) {
|
|
30
40
|
ArchivableValueUsageKind["Records"] = "Records";
|
|
31
41
|
ArchivableValueUsageKind["Settings"] = "Settings";
|
|
42
|
+
ArchivableValueUsageKind["Personal"] = "Personal";
|
|
32
43
|
})(ArchivableValueUsageKind || (exports.ArchivableValueUsageKind = ArchivableValueUsageKind = {}));
|
|
44
|
+
/*
|
|
45
|
+
* What a bulk Archive's or Delete's dialog asks about the values it was
|
|
46
|
+
* opened on (POST <value route>/usage).
|
|
47
|
+
*/
|
|
48
|
+
var ArchivableValuesUsagePurpose;
|
|
49
|
+
(function (ArchivableValuesUsagePurpose) {
|
|
50
|
+
// Every use of any of them: what keeps using them once they are archived.
|
|
51
|
+
ArchivableValuesUsagePurpose["Archive"] = "Archive";
|
|
52
|
+
/*
|
|
53
|
+
* Which of them records still have - a delete of those is refused, and
|
|
54
|
+
* they are left as they are - and what deleting the others changes.
|
|
55
|
+
*/
|
|
56
|
+
ArchivableValuesUsagePurpose["Delete"] = "Delete";
|
|
57
|
+
})(ArchivableValuesUsagePurpose || (exports.ArchivableValuesUsagePurpose = ArchivableValuesUsagePurpose = {}));
|
|
33
58
|
const EFFECTS = Object.values(ArchivableValueDeleteEffect);
|
|
34
59
|
const KINDS = Object.values(ArchivableValueUsageKind);
|
|
60
|
+
const readCount = (value) => {
|
|
61
|
+
const count = Number(value);
|
|
62
|
+
return Number.isFinite(count) && count > 0 ? count : null;
|
|
63
|
+
};
|
|
35
64
|
class ArchivableValueUsage {
|
|
36
65
|
static toJSONArray(items) {
|
|
37
66
|
return items.map((item) => {
|
|
38
|
-
|
|
67
|
+
const json = {
|
|
39
68
|
tableName: item.tableName,
|
|
40
69
|
title: item.title,
|
|
41
70
|
singularTitle: item.singularTitle,
|
|
@@ -44,6 +73,11 @@ class ArchivableValueUsage {
|
|
|
44
73
|
effect: item.effect,
|
|
45
74
|
kind: item.kind,
|
|
46
75
|
};
|
|
76
|
+
if (item.totalCount !== undefined) {
|
|
77
|
+
json["totalCount"] = item.totalCount;
|
|
78
|
+
json["isTotalCountCapped"] = Boolean(item.isTotalCountCapped);
|
|
79
|
+
}
|
|
80
|
+
return json;
|
|
47
81
|
});
|
|
48
82
|
}
|
|
49
83
|
// What came back from the server, keeping only well-formed items.
|
|
@@ -57,16 +91,15 @@ class ArchivableValueUsage {
|
|
|
57
91
|
continue;
|
|
58
92
|
}
|
|
59
93
|
const record = entry;
|
|
60
|
-
const count =
|
|
94
|
+
const count = readCount(record["count"]);
|
|
61
95
|
if (typeof record["tableName"] !== "string" ||
|
|
62
96
|
typeof record["title"] !== "string" ||
|
|
63
|
-
|
|
64
|
-
count <= 0 ||
|
|
97
|
+
count === null ||
|
|
65
98
|
!EFFECTS.includes(record["effect"]) ||
|
|
66
99
|
!KINDS.includes(record["kind"])) {
|
|
67
100
|
continue;
|
|
68
101
|
}
|
|
69
|
-
|
|
102
|
+
const item = {
|
|
70
103
|
tableName: record["tableName"],
|
|
71
104
|
title: record["title"],
|
|
72
105
|
singularTitle: typeof record["singularTitle"] === "string" && record["singularTitle"]
|
|
@@ -76,10 +109,40 @@ class ArchivableValueUsage {
|
|
|
76
109
|
isCountCapped: record["isCountCapped"] === true,
|
|
77
110
|
effect: record["effect"],
|
|
78
111
|
kind: record["kind"],
|
|
79
|
-
}
|
|
112
|
+
};
|
|
113
|
+
// A total is never below the count it includes.
|
|
114
|
+
const totalCount = readCount(record["totalCount"]);
|
|
115
|
+
if (totalCount !== null && totalCount >= count) {
|
|
116
|
+
item.totalCount = totalCount;
|
|
117
|
+
item.isTotalCountCapped = record["isTotalCountCapped"] === true;
|
|
118
|
+
}
|
|
119
|
+
items.push(item);
|
|
80
120
|
}
|
|
81
121
|
return items;
|
|
82
122
|
}
|
|
123
|
+
static valuesUsageToJSON(usage) {
|
|
124
|
+
return {
|
|
125
|
+
usage: ArchivableValueUsage.toJSONArray(usage.usage),
|
|
126
|
+
refusedValueIds: [...usage.refusedValueIds],
|
|
127
|
+
refusedUsage: ArchivableValueUsage.toJSONArray(usage.refusedUsage),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
// What came back for several values, keeping only what is well formed.
|
|
131
|
+
static valuesUsageFromJSON(value) {
|
|
132
|
+
const record = value && typeof value === "object"
|
|
133
|
+
? value
|
|
134
|
+
: {};
|
|
135
|
+
const refusedValueIds = Array.isArray(record["refusedValueIds"])
|
|
136
|
+
? record["refusedValueIds"].filter((id) => {
|
|
137
|
+
return typeof id === "string" && id.length > 0;
|
|
138
|
+
})
|
|
139
|
+
: [];
|
|
140
|
+
return {
|
|
141
|
+
usage: ArchivableValueUsage.fromJSONArray(record["usage"]),
|
|
142
|
+
refusedValueIds: refusedValueIds,
|
|
143
|
+
refusedUsage: ArchivableValueUsage.fromJSONArray(record["refusedUsage"]),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
83
146
|
// Whether something still has the value, so a delete is refused.
|
|
84
147
|
static isDeleteRefused(items) {
|
|
85
148
|
return items.some((item) => {
|
|
@@ -92,5 +155,21 @@ class ArchivableValueUsage {
|
|
|
92
155
|
return item.kind === ArchivableValueUsageKind.Settings;
|
|
93
156
|
});
|
|
94
157
|
}
|
|
158
|
+
// People's own settings that name it, which stay as they are.
|
|
159
|
+
static getPersonal(items) {
|
|
160
|
+
return items.filter((item) => {
|
|
161
|
+
return item.kind === ArchivableValueUsageKind.Personal;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// The number to show for the table's line: every effect together.
|
|
165
|
+
static getTotalCount(item) {
|
|
166
|
+
if (item.totalCount !== undefined && item.totalCount >= item.count) {
|
|
167
|
+
return {
|
|
168
|
+
count: item.totalCount,
|
|
169
|
+
isCountCapped: Boolean(item.isTotalCountCapped),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return { count: item.count, isCountCapped: item.isCountCapped };
|
|
173
|
+
}
|
|
95
174
|
}
|
|
96
175
|
exports.default = ArchivableValueUsage;
|
|
@@ -2,3 +2,4 @@ import commonJsModule from "./ArchivableValueUsage.js";
|
|
|
2
2
|
export default commonJsModule.default;
|
|
3
3
|
export const ArchivableValueDeleteEffect = commonJsModule.ArchivableValueDeleteEffect;
|
|
4
4
|
export const ArchivableValueUsageKind = commonJsModule.ArchivableValueUsageKind;
|
|
5
|
+
export const ArchivableValuesUsagePurpose = commonJsModule.ArchivableValuesUsagePurpose;
|
package/Types/Color.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ZodSchema } from "../Utils/Schema/Zod.mjs";
|
|
2
1
|
import DatabaseProperty from "./Database/DatabaseProperty.mjs";
|
|
3
2
|
import { JSONObject } from "./JSON.mjs";
|
|
4
3
|
import { FindOperator } from "typeorm";
|
|
@@ -22,5 +21,4 @@ export default class Color extends DatabaseProperty {
|
|
|
22
21
|
static rgbToColor(rgb: RGB): Color;
|
|
23
22
|
static fromString(color: string): Color;
|
|
24
23
|
static shouldUseDarkText(color: Color): boolean;
|
|
25
|
-
static getSchema(): ZodSchema;
|
|
26
24
|
}
|
package/Types/Color.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ZodSchema } from "../Utils/Schema/Zod";
|
|
2
1
|
import DatabaseProperty from "./Database/DatabaseProperty";
|
|
3
2
|
import { JSONObject } from "./JSON";
|
|
4
3
|
import { FindOperator } from "typeorm";
|
|
@@ -22,5 +21,4 @@ export default class Color extends DatabaseProperty {
|
|
|
22
21
|
static rgbToColor(rgb: RGB): Color;
|
|
23
22
|
static fromString(color: string): Color;
|
|
24
23
|
static shouldUseDarkText(color: Color): boolean;
|
|
25
|
-
static getSchema(): ZodSchema;
|
|
26
24
|
}
|
package/Types/Color.js
CHANGED
|
@@ -3,7 +3,6 @@ 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
|
-
const Zod_1 = __importDefault(require("../Utils/Schema/Zod"));
|
|
7
6
|
const RefusedValue_1 = require("../Utils/RefusedValue");
|
|
8
7
|
const DatabaseProperty_1 = __importDefault(require("./Database/DatabaseProperty"));
|
|
9
8
|
const BadDataException_1 = __importDefault(require("./Exception/BadDataException"));
|
|
@@ -81,18 +80,5 @@ class Color extends DatabaseProperty_1.default {
|
|
|
81
80
|
}
|
|
82
81
|
return false;
|
|
83
82
|
}
|
|
84
|
-
static getSchema() {
|
|
85
|
-
return Zod_1.default.object({
|
|
86
|
-
_type: Zod_1.default.literal(JSON_1.ObjectType.Color),
|
|
87
|
-
value: Zod_1.default.string().openapi({
|
|
88
|
-
type: "string",
|
|
89
|
-
example: "#ff0000",
|
|
90
|
-
}),
|
|
91
|
-
}).openapi({
|
|
92
|
-
type: "object",
|
|
93
|
-
description: "Color object",
|
|
94
|
-
example: { _type: JSON_1.ObjectType.Color, value: "#ff0000" },
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
83
|
}
|
|
98
84
|
exports.default = Color;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ZodSchema } from "zod";
|
|
2
1
|
import { JSONArray, JSONObject } from "../JSON.mjs";
|
|
3
2
|
import SerializableObject from "../SerializableObject.mjs";
|
|
4
3
|
import { FindOperator } from "typeorm";
|
|
@@ -10,5 +9,4 @@ export default class DatabaseProperty extends SerializableObject {
|
|
|
10
9
|
protected static _fromDatabase(value: string | number | JSONObject | JSONArray): DatabaseProperty | Array<DatabaseProperty> | null;
|
|
11
10
|
protected static _toDatabase(value: DatabaseProperty | FindOperator<DatabaseProperty>): string | number | JSONObject | JSONArray | null;
|
|
12
11
|
static getDatabaseTransformer(): ValueTransformer;
|
|
13
|
-
static getSchema(): ZodSchema;
|
|
14
12
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ZodSchema } from "zod";
|
|
2
1
|
import { JSONArray, JSONObject } from "../JSON";
|
|
3
2
|
import SerializableObject from "../SerializableObject";
|
|
4
3
|
import { FindOperator } from "typeorm";
|
|
@@ -10,5 +9,4 @@ export default class DatabaseProperty extends SerializableObject {
|
|
|
10
9
|
protected static _fromDatabase(value: string | number | JSONObject | JSONArray): DatabaseProperty | Array<DatabaseProperty> | null;
|
|
11
10
|
protected static _toDatabase(value: DatabaseProperty | FindOperator<DatabaseProperty>): string | number | JSONObject | JSONArray | null;
|
|
12
11
|
static getDatabaseTransformer(): ValueTransformer;
|
|
13
|
-
static getSchema(): ZodSchema;
|
|
14
12
|
}
|
package/Types/Date.d.mts
CHANGED
|
@@ -4,7 +4,6 @@ import { JSONObject } from "./JSON.mjs";
|
|
|
4
4
|
import PositiveNumber from "./PositiveNumber.mjs";
|
|
5
5
|
import moment from "moment-timezone";
|
|
6
6
|
import Timezone from "./Timezone.mjs";
|
|
7
|
-
import { ZodSchema } from "../Utils/Schema/Zod.mjs";
|
|
8
7
|
export declare const Moment: typeof moment;
|
|
9
8
|
export type CalendarUnit = "hour" | "day" | "week" | "month" | "year";
|
|
10
9
|
export default class OneUptimeDate {
|
|
@@ -17,7 +16,6 @@ export default class OneUptimeDate {
|
|
|
17
16
|
private static getCurrentTimezoneNames;
|
|
18
17
|
private static getTimezoneNames;
|
|
19
18
|
private static getLocalizedDateText;
|
|
20
|
-
static getSchema(): ZodSchema;
|
|
21
19
|
static getHoursAndMinutesFromMinutes(minutes: number): string;
|
|
22
20
|
private static formatLocalizedDuration;
|
|
23
21
|
static fromUnixTimestamp(timestamp: number): Date;
|
package/Types/Date.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { JSONObject } from "./JSON";
|
|
|
4
4
|
import PositiveNumber from "./PositiveNumber";
|
|
5
5
|
import moment from "moment-timezone";
|
|
6
6
|
import Timezone from "./Timezone";
|
|
7
|
-
import { ZodSchema } from "../Utils/Schema/Zod";
|
|
8
7
|
export declare const Moment: typeof moment;
|
|
9
8
|
export type CalendarUnit = "hour" | "day" | "week" | "month" | "year";
|
|
10
9
|
export default class OneUptimeDate {
|
|
@@ -17,7 +16,6 @@ export default class OneUptimeDate {
|
|
|
17
16
|
private static getCurrentTimezoneNames;
|
|
18
17
|
private static getTimezoneNames;
|
|
19
18
|
private static getLocalizedDateText;
|
|
20
|
-
static getSchema(): ZodSchema;
|
|
21
19
|
static getHoursAndMinutesFromMinutes(minutes: number): string;
|
|
22
20
|
private static formatLocalizedDuration;
|
|
23
21
|
static fromUnixTimestamp(timestamp: number): Date;
|
package/Types/Date.js
CHANGED
|
@@ -45,7 +45,6 @@ const PositiveNumber_1 = __importDefault(require("./PositiveNumber"));
|
|
|
45
45
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
46
46
|
const Timezone_1 = __importDefault(require("./Timezone"));
|
|
47
47
|
const TimezoneAlias_1 = __importDefault(require("./TimezoneAlias"));
|
|
48
|
-
const Zod_1 = __importDefault(require("../Utils/Schema/Zod"));
|
|
49
48
|
const RefusedValue_1 = require("../Utils/RefusedValue");
|
|
50
49
|
const DateLanguage_1 = require("./DateLanguage");
|
|
51
50
|
exports.Moment = moment_timezone_1.default;
|
|
@@ -204,28 +203,6 @@ class OneUptimeDate {
|
|
|
204
203
|
shape: data.shape,
|
|
205
204
|
});
|
|
206
205
|
}
|
|
207
|
-
static getSchema() {
|
|
208
|
-
return Zod_1.default.object({
|
|
209
|
-
_type: Zod_1.default.literal(JSON_1.ObjectType.DateTime),
|
|
210
|
-
value: Zod_1.default.string().openapi({
|
|
211
|
-
type: "string",
|
|
212
|
-
example: "2023-10-01T12:00:00Z",
|
|
213
|
-
}),
|
|
214
|
-
}).openapi({
|
|
215
|
-
type: "object",
|
|
216
|
-
description: "A date time object.",
|
|
217
|
-
/*
|
|
218
|
-
* Machine-readable marker so spec consumers (e.g. the Terraform provider
|
|
219
|
-
* generator) can treat this wrapper as an RFC3339 timestamp instead of an
|
|
220
|
-
* opaque object.
|
|
221
|
-
*/
|
|
222
|
-
"x-oneuptime-type": JSON_1.ObjectType.DateTime,
|
|
223
|
-
example: {
|
|
224
|
-
_type: JSON_1.ObjectType.DateTime,
|
|
225
|
-
value: "2023-10-01T12:00:00Z",
|
|
226
|
-
},
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
206
|
static getHoursAndMinutesFromMinutes(minutes) {
|
|
230
207
|
const hours = Math.floor(minutes / 60);
|
|
231
208
|
const mins = minutes % 60;
|
package/Types/Domain.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import DatabaseProperty from "./Database/DatabaseProperty.mjs";
|
|
2
2
|
import { JSONObject } from "./JSON.mjs";
|
|
3
3
|
import { FindOperator } from "typeorm/find-options/FindOperator.js";
|
|
4
|
-
import { ZodSchema } from "../Utils/Schema/Zod.mjs";
|
|
5
4
|
export default class Domain extends DatabaseProperty {
|
|
6
5
|
static readonly TEST_DOMAIN_SUFFIXES: string[];
|
|
7
6
|
/**
|
|
@@ -38,5 +37,4 @@ export default class Domain extends DatabaseProperty {
|
|
|
38
37
|
toJSON(): JSONObject;
|
|
39
38
|
static fromJSON(json: JSONObject): Domain;
|
|
40
39
|
protected static fromDatabase(_value: string): Domain | null;
|
|
41
|
-
static getSchema(): ZodSchema;
|
|
42
40
|
}
|