@oneuptime/common 14.0.95 → 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/DatabaseBaseModel/DatabaseBaseModel.js +14 -37
- package/Models/DatabaseModels/DetectionRuleException.d.mts +25 -0
- package/Models/DatabaseModels/DetectionRuleException.d.ts +25 -0
- package/Models/DatabaseModels/DetectionRuleException.js +412 -0
- package/Models/DatabaseModels/DetectionRuleException.mjs +2 -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 +12 -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/Database/TableColumn.d.mts +8 -0
- package/Types/Database/TableColumn.d.ts +8 -0
- package/Types/Database/TableColumn.js +69 -23
- package/Types/Database/TableColumn.mjs +1 -0
- 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/JSONFunctions.js +16 -1
- 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/Monitor/MonitorType.js +5 -4
- package/Types/Monitor/TelemetryAlertRule.d.mts +111 -0
- package/Types/Monitor/TelemetryAlertRule.d.ts +111 -0
- package/Types/Monitor/TelemetryAlertRule.js +886 -0
- package/Types/Monitor/TelemetryAlertRule.mjs +5 -0
- package/Types/Monitor/TelemetryRulePreview.d.mts +57 -0
- package/Types/Monitor/TelemetryRulePreview.d.ts +57 -0
- package/Types/Monitor/TelemetryRulePreview.js +190 -0
- package/Types/Monitor/TelemetryRulePreview.mjs +6 -0
- 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/EveryNewEventRules.d.mts +23 -0
- package/Types/OnCallDutyPolicy/EveryNewEventRules.d.ts +23 -0
- package/Types/OnCallDutyPolicy/EveryNewEventRules.js +105 -0
- package/Types/OnCallDutyPolicy/EveryNewEventRules.mjs +9 -0
- 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 +24 -1
- package/Types/ProviderLogo/ProviderLogo.d.ts +24 -1
- package/Types/ProviderLogo/ProviderLogo.js +47 -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/DetectionRetrohunt.d.mts +38 -0
- package/Types/SecurityEvent/DetectionRetrohunt.d.ts +38 -0
- package/Types/SecurityEvent/DetectionRetrohunt.js +147 -0
- package/Types/SecurityEvent/DetectionRetrohunt.mjs +10 -0
- package/Types/SecurityEvent/DetectionRuleException.d.mts +65 -0
- package/Types/SecurityEvent/DetectionRuleException.d.ts +65 -0
- package/Types/SecurityEvent/DetectionRuleException.js +441 -0
- package/Types/SecurityEvent/DetectionRuleException.mjs +24 -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.d.mts +52 -0
- package/Types/Telemetry/OpenTelemetryGuides.d.ts +52 -0
- package/Types/Telemetry/OpenTelemetryGuides.js +591 -0
- package/Types/Telemetry/OpenTelemetryGuides.mjs +17 -0
- 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/OpenApiMetadataRegistry.d.mts +4 -0
- package/Utils/Schema/OpenApiMetadataRegistry.d.ts +4 -0
- package/Utils/Schema/OpenApiMetadataRegistry.js +20 -0
- package/Utils/Schema/OpenApiMetadataRegistry.mjs +2 -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 +23 -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,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAffectedResourceReferences = exports.getAffectedResourcesSettingTableNames = exports.getAffectedResourcesArgument = exports.MAX_AFFECTED_RESOURCE_REFERENCE_LENGTH = exports.MAX_LINKED_AFFECTED_RESOURCES = exports.MAX_AFFECTED_RESOURCE_REFERENCES = exports.AFFECTED_RESOURCES_ARGUMENT_ID = void 0;
|
|
4
|
+
const Component_1 = require("./Component");
|
|
5
|
+
/*
|
|
6
|
+
* LINKING WHAT AN INCIDENT OR ALERT A WORKFLOW CREATES IS ABOUT.
|
|
7
|
+
*
|
|
8
|
+
* Issue #5341: an alert that arrives from another tool names the router,
|
|
9
|
+
* switch, host or service it is about - "WAN-RTR-01", "10.0.4.1" - and a
|
|
10
|
+
* workflow could only link it by writing each resource's OneUptime ID into
|
|
11
|
+
* JSON Object, under the right list ("hosts", "networkDevices", ...), which
|
|
12
|
+
* nobody receiving a webhook knows. Create One Incident and Create One
|
|
13
|
+
* Alert now have one more setting, Affected Resources: names, addresses or
|
|
14
|
+
* IDs, typed or taken from an earlier step. Each is looked up across every
|
|
15
|
+
* kind of resource the record can be linked to, and what matches is added
|
|
16
|
+
* to what JSON Object and the template already link.
|
|
17
|
+
*
|
|
18
|
+
* Monitors are not among them: they have their own fields in JSON Object
|
|
19
|
+
* (an incident's monitors, an alert's monitorId), because linking a monitor
|
|
20
|
+
* to an incident a person or a workflow declares pauses its checks - a
|
|
21
|
+
* choice to make on purpose, never a side effect of a name that matched.
|
|
22
|
+
*
|
|
23
|
+
* Keyed by the table of the record the step creates; the server resolves
|
|
24
|
+
* the references (Server/Utils/AffectedResources/AffectedResourceReferences)
|
|
25
|
+
* as the step, a Project Admin of the workflow's project.
|
|
26
|
+
*/
|
|
27
|
+
exports.AFFECTED_RESOURCES_ARGUMENT_ID = "affectedResources";
|
|
28
|
+
/*
|
|
29
|
+
* The most references one step resolves, and the most resources it links:
|
|
30
|
+
* a list longer than this is a payload pasted by mistake, not a set of
|
|
31
|
+
* resources one incident is about.
|
|
32
|
+
*/
|
|
33
|
+
exports.MAX_AFFECTED_RESOURCE_REFERENCES = 25;
|
|
34
|
+
exports.MAX_LINKED_AFFECTED_RESOURCES = 50;
|
|
35
|
+
// The longest single reference: a name, an address or an ID.
|
|
36
|
+
exports.MAX_AFFECTED_RESOURCE_REFERENCE_LENGTH = 200;
|
|
37
|
+
const SETTINGS = {
|
|
38
|
+
Incident: { noun: "incident" },
|
|
39
|
+
Alert: { noun: "alert" },
|
|
40
|
+
};
|
|
41
|
+
// The Affected Resources setting of this table's Create One step, if any.
|
|
42
|
+
const getAffectedResourcesArgument = (tableName) => {
|
|
43
|
+
const setting = tableName
|
|
44
|
+
? SETTINGS[tableName]
|
|
45
|
+
: undefined;
|
|
46
|
+
if (!setting) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
id: exports.AFFECTED_RESOURCES_ARGUMENT_ID,
|
|
51
|
+
name: "Affected Resources",
|
|
52
|
+
type: Component_1.ComponentInputType.Text,
|
|
53
|
+
required: false,
|
|
54
|
+
description: `Names, addresses or IDs of the hosts, network devices, clusters, databases or services this ${setting.noun} is about, separated by commas. Each one found is linked. Monitors go in JSON Object.`,
|
|
55
|
+
placeholder: "Example: WAN-RTR-01, 10.0.4.1",
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
exports.getAffectedResourcesArgument = getAffectedResourcesArgument;
|
|
59
|
+
// The tables whose Create One step has the setting.
|
|
60
|
+
const getAffectedResourcesSettingTableNames = () => {
|
|
61
|
+
return Object.keys(SETTINGS).sort();
|
|
62
|
+
};
|
|
63
|
+
exports.getAffectedResourcesSettingTableNames = getAffectedResourcesSettingTableNames;
|
|
64
|
+
/*
|
|
65
|
+
* The references a setting holds, each once, in the order written: split at
|
|
66
|
+
* commas, semicolons and line breaks, trimmed, empty ones dropped, each cut
|
|
67
|
+
* to MAX_AFFECTED_RESOURCE_REFERENCE_LENGTH. A list (an earlier step's value
|
|
68
|
+
* that is an array) gives its entries. Read in one pass, never with a
|
|
69
|
+
* regular expression: the value can be a webhook's text, any length.
|
|
70
|
+
*/
|
|
71
|
+
const readAffectedResourceReferences = (value) => {
|
|
72
|
+
const references = [];
|
|
73
|
+
const seen = new Set();
|
|
74
|
+
let leftOut = 0;
|
|
75
|
+
const add = (raw) => {
|
|
76
|
+
const reference = raw
|
|
77
|
+
.trim()
|
|
78
|
+
.substring(0, exports.MAX_AFFECTED_RESOURCE_REFERENCE_LENGTH)
|
|
79
|
+
.trim();
|
|
80
|
+
if (!reference) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const key = reference.toLowerCase();
|
|
84
|
+
if (seen.has(key)) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
seen.add(key);
|
|
88
|
+
if (references.length >= exports.MAX_AFFECTED_RESOURCE_REFERENCES) {
|
|
89
|
+
leftOut++;
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
references.push(reference);
|
|
93
|
+
};
|
|
94
|
+
const split = (text) => {
|
|
95
|
+
let current = "";
|
|
96
|
+
for (const character of text) {
|
|
97
|
+
if (character === "," ||
|
|
98
|
+
character === ";" ||
|
|
99
|
+
character === "\n" ||
|
|
100
|
+
character === "\r") {
|
|
101
|
+
add(current);
|
|
102
|
+
current = "";
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
current += character;
|
|
106
|
+
}
|
|
107
|
+
add(current);
|
|
108
|
+
};
|
|
109
|
+
const values = Array.isArray(value) ? value : [value];
|
|
110
|
+
for (const item of values) {
|
|
111
|
+
if (typeof item === "string") {
|
|
112
|
+
split(item);
|
|
113
|
+
}
|
|
114
|
+
else if (typeof item === "number" && Number.isFinite(item)) {
|
|
115
|
+
add(String(item));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return { references, leftOut };
|
|
119
|
+
};
|
|
120
|
+
exports.readAffectedResourceReferences = readAffectedResourceReferences;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import commonJsModule from "./AffectedResourcesSetting.js";
|
|
2
|
+
export const AFFECTED_RESOURCES_ARGUMENT_ID = commonJsModule.AFFECTED_RESOURCES_ARGUMENT_ID;
|
|
3
|
+
export const MAX_AFFECTED_RESOURCE_REFERENCES = commonJsModule.MAX_AFFECTED_RESOURCE_REFERENCES;
|
|
4
|
+
export const MAX_AFFECTED_RESOURCE_REFERENCE_LENGTH = commonJsModule.MAX_AFFECTED_RESOURCE_REFERENCE_LENGTH;
|
|
5
|
+
export const MAX_LINKED_AFFECTED_RESOURCES = commonJsModule.MAX_LINKED_AFFECTED_RESOURCES;
|
|
6
|
+
export const getAffectedResourcesArgument = commonJsModule.getAffectedResourcesArgument;
|
|
7
|
+
export const getAffectedResourcesSettingTableNames = commonJsModule.getAffectedResourcesSettingTableNames;
|
|
8
|
+
export const readAffectedResourceReferences = commonJsModule.readAffectedResourceReferences;
|
|
@@ -7,6 +7,7 @@ exports.WATCHED_FIELDS_NAME = exports.SELECT_FIELDS_NAME = void 0;
|
|
|
7
7
|
const IconProp_1 = __importDefault(require("../../Icon/IconProp"));
|
|
8
8
|
const Text_1 = __importDefault(require("../../Text"));
|
|
9
9
|
const CreateFromTemplate_1 = require("../CreateFromTemplate");
|
|
10
|
+
const AffectedResourcesSetting_1 = require("../AffectedResourcesSetting");
|
|
10
11
|
const CreateOrUpdateTrigger_1 = require("../CreateOrUpdateTrigger");
|
|
11
12
|
const DatabaseOperation_1 = require("../DatabaseOperation");
|
|
12
13
|
const Component_1 = require("./../Component");
|
|
@@ -416,6 +417,19 @@ class BaseModelComponent {
|
|
|
416
417
|
if (templateArgument) {
|
|
417
418
|
jsonArgument.notRequiredWhen = { argumentId: templateArgument.id };
|
|
418
419
|
}
|
|
420
|
+
/*
|
|
421
|
+
* An incident or an alert also takes what it is about by name - the
|
|
422
|
+
* host, router or service an alert from another tool names - looked
|
|
423
|
+
* up across every kind of resource it can be linked to and added to
|
|
424
|
+
* its lists (Types/Workflow/AffectedResourcesSetting). Last, after the
|
|
425
|
+
* record it adds to.
|
|
426
|
+
*/
|
|
427
|
+
const affectedResourcesArgument = (0, AffectedResourcesSetting_1.getAffectedResourcesArgument)(model.tableName || undefined);
|
|
428
|
+
const createOneArguments = [
|
|
429
|
+
...(templateArgument ? [templateArgument] : []),
|
|
430
|
+
jsonArgument,
|
|
431
|
+
...(affectedResourcesArgument ? [affectedResourcesArgument] : []),
|
|
432
|
+
];
|
|
419
433
|
components.push({
|
|
420
434
|
id: `${Text_1.default.pascalCaseToDashes(model.tableName)}-create-one`,
|
|
421
435
|
title: `Create One ${model.singularName}`,
|
|
@@ -424,9 +438,7 @@ class BaseModelComponent {
|
|
|
424
438
|
iconProp: IconProp_1.default.Database,
|
|
425
439
|
tableName: model.tableName,
|
|
426
440
|
componentType: Component_1.ComponentType.Component,
|
|
427
|
-
arguments:
|
|
428
|
-
? [templateArgument, jsonArgument]
|
|
429
|
-
: [jsonArgument],
|
|
441
|
+
arguments: createOneArguments,
|
|
430
442
|
returnValues: [
|
|
431
443
|
{
|
|
432
444
|
id: "model",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.getDatabaseDocumentation = exports.getDatabaseOperation = exports.DatabaseOperation = void 0;
|
|
16
16
|
const CreateFromTemplate_1 = require("../CreateFromTemplate");
|
|
17
|
+
const AffectedResourcesSetting_1 = require("../AffectedResourcesSetting");
|
|
17
18
|
const CreateOrUpdateTrigger_1 = require("../CreateOrUpdateTrigger");
|
|
18
19
|
const CustomFieldsColumn_1 = require("../CustomFieldsColumn");
|
|
19
20
|
const DatabaseOperation_1 = require("../DatabaseOperation");
|
|
@@ -204,9 +205,31 @@ const templateTopic = (data) => {
|
|
|
204
205
|
],
|
|
205
206
|
};
|
|
206
207
|
};
|
|
208
|
+
/*
|
|
209
|
+
* An incident or alert linked to what it is about by name (Create One
|
|
210
|
+
* Incident's and Create One Alert's Affected Resources): how a name is
|
|
211
|
+
* matched, what it adds to, and what it never links.
|
|
212
|
+
*/
|
|
213
|
+
const affectedResourcesTopic = (data) => {
|
|
214
|
+
/*
|
|
215
|
+
* An incident's monitors are a list of their own, and linking one pauses
|
|
216
|
+
* its checks; an alert has one monitor, its monitorId.
|
|
217
|
+
*/
|
|
218
|
+
const monitorsSentence = data.words.model.tableName === "Alert"
|
|
219
|
+
? `The ${data.words.one}'s monitor goes in **JSON Object**, as \`monitorId\`.`
|
|
220
|
+
: "Monitors go in **JSON Object**, because linking a monitor to an incident pauses its checks.";
|
|
221
|
+
return {
|
|
222
|
+
title: "Linking what it is about",
|
|
223
|
+
paragraphs: [
|
|
224
|
+
`Under **${data.setting.name}**, write the names, addresses or OneUptime IDs of the hosts, network devices, clusters, databases, cloud resources or services the ${data.words.one} is about, separated by commas - typed in, or taken from an earlier step, such as the host an alert from another tool names. An address is a host's or a network device's IP address or DNS name.`,
|
|
225
|
+
`Each one is matched as a whole, upper or lower case alike, against every kind of resource, and every resource it matches is linked, beside what **JSON Object** and a template already link. A name that matches nothing does not stop the step: the ${data.words.one} is still created, and the run's log says what each name linked and which matched nothing. Archived resources are not linked. ${monitorsSentence}`,
|
|
226
|
+
],
|
|
227
|
+
};
|
|
228
|
+
};
|
|
207
229
|
const createOne = (context, words) => {
|
|
208
230
|
const required = (0, ModelExamples_1.getRequiredCreateColumns)(words.model);
|
|
209
231
|
const templateSetting = (0, CreateFromTemplate_1.getCreateFromTemplateArgument)(words.model.tableName || undefined);
|
|
232
|
+
const affectedResourcesSetting = (0, AffectedResourcesSetting_1.getAffectedResourcesArgument)(words.model.tableName || undefined);
|
|
210
233
|
return {
|
|
211
234
|
summary: `Creates one ${words.one} in this project each time it runs.`,
|
|
212
235
|
steps: [
|
|
@@ -218,6 +241,11 @@ const createOne = (context, words) => {
|
|
|
218
241
|
required.length > 0
|
|
219
242
|
? `Under **JSON Object**, fill in the ${words.one}'s fields. The ones it needs come first.`
|
|
220
243
|
: `Under **JSON Object**, add the ${words.one}'s fields with **Add a field**.`,
|
|
244
|
+
/*
|
|
245
|
+
* Affected Resources gets no step of its own: the help shows at most
|
|
246
|
+
* four before Learn more, and the setting's own description in the
|
|
247
|
+
* dialog says what to write. Learn more says how a name is matched.
|
|
248
|
+
*/
|
|
221
249
|
"Connect **Success** to what runs next, and **Error** to handle a failure.",
|
|
222
250
|
`Use the new ${words.one} in later steps, starting with its ID.`,
|
|
223
251
|
],
|
|
@@ -241,6 +269,14 @@ const createOne = (context, words) => {
|
|
|
241
269
|
...(templateSetting
|
|
242
270
|
? [templateTopic({ words: words, setting: templateSetting })]
|
|
243
271
|
: []),
|
|
272
|
+
...(affectedResourcesSetting
|
|
273
|
+
? [
|
|
274
|
+
affectedResourcesTopic({
|
|
275
|
+
words: words,
|
|
276
|
+
setting: affectedResourcesSetting,
|
|
277
|
+
}),
|
|
278
|
+
]
|
|
279
|
+
: []),
|
|
244
280
|
{
|
|
245
281
|
title: "Writing it as JSON",
|
|
246
282
|
paragraphs: [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import NetworkControllerProvider from "../../Types/NetworkController/NetworkControllerProvider.mjs";
|
|
2
|
+
import { NetworkDeviceControllerReading, NetworkDeviceDiscoveredValue, NetworkDeviceDiscoveryMethod, NetworkDeviceDiscoveryReader } from "../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails.mjs";
|
|
2
3
|
export declare enum AssetFactSourceKind {
|
|
3
4
|
SnmpPoll = "snmpPoll",
|
|
4
5
|
Discovered = "discovered",
|
|
@@ -9,18 +10,21 @@ export declare enum AssetFactSourceKind {
|
|
|
9
10
|
Site = "site",
|
|
10
11
|
Classified = "classified",
|
|
11
12
|
Collector = "collector",
|
|
12
|
-
CloudPlacement = "cloudPlacement"
|
|
13
|
+
CloudPlacement = "cloudPlacement",
|
|
14
|
+
Controller = "controller"
|
|
13
15
|
}
|
|
14
16
|
export interface AssetFactSource {
|
|
15
17
|
kind: AssetFactSourceKind;
|
|
16
18
|
method?: NetworkDeviceDiscoveryMethod | undefined;
|
|
17
19
|
readBy?: NetworkDeviceDiscoveryReader | undefined;
|
|
18
20
|
readAt?: string | undefined;
|
|
21
|
+
provider?: NetworkControllerProvider | undefined;
|
|
19
22
|
}
|
|
20
23
|
export interface AssetFactDifference {
|
|
21
24
|
value: string;
|
|
22
25
|
source: AssetFactSource;
|
|
23
26
|
}
|
|
24
27
|
export declare function sourceOfDiscoveredValue(entry: NetworkDeviceDiscoveredValue): AssetFactSource;
|
|
28
|
+
export declare function sourceOfControllerReading(reading: NetworkDeviceControllerReading): AssetFactSource;
|
|
25
29
|
export declare function isAutomaticAssetFactSource(source: AssetFactSource | undefined): boolean;
|
|
26
30
|
export default AssetFactSource;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import NetworkControllerProvider from "../../Types/NetworkController/NetworkControllerProvider";
|
|
2
|
+
import { NetworkDeviceControllerReading, NetworkDeviceDiscoveredValue, NetworkDeviceDiscoveryMethod, NetworkDeviceDiscoveryReader } from "../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails";
|
|
2
3
|
export declare enum AssetFactSourceKind {
|
|
3
4
|
SnmpPoll = "snmpPoll",
|
|
4
5
|
Discovered = "discovered",
|
|
@@ -9,18 +10,21 @@ export declare enum AssetFactSourceKind {
|
|
|
9
10
|
Site = "site",
|
|
10
11
|
Classified = "classified",
|
|
11
12
|
Collector = "collector",
|
|
12
|
-
CloudPlacement = "cloudPlacement"
|
|
13
|
+
CloudPlacement = "cloudPlacement",
|
|
14
|
+
Controller = "controller"
|
|
13
15
|
}
|
|
14
16
|
export interface AssetFactSource {
|
|
15
17
|
kind: AssetFactSourceKind;
|
|
16
18
|
method?: NetworkDeviceDiscoveryMethod | undefined;
|
|
17
19
|
readBy?: NetworkDeviceDiscoveryReader | undefined;
|
|
18
20
|
readAt?: string | undefined;
|
|
21
|
+
provider?: NetworkControllerProvider | undefined;
|
|
19
22
|
}
|
|
20
23
|
export interface AssetFactDifference {
|
|
21
24
|
value: string;
|
|
22
25
|
source: AssetFactSource;
|
|
23
26
|
}
|
|
24
27
|
export declare function sourceOfDiscoveredValue(entry: NetworkDeviceDiscoveredValue): AssetFactSource;
|
|
28
|
+
export declare function sourceOfControllerReading(reading: NetworkDeviceControllerReading): AssetFactSource;
|
|
25
29
|
export declare function isAutomaticAssetFactSource(source: AssetFactSource | undefined): boolean;
|
|
26
30
|
export default AssetFactSource;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AssetFactSourceKind = void 0;
|
|
4
4
|
exports.sourceOfDiscoveredValue = sourceOfDiscoveredValue;
|
|
5
|
+
exports.sourceOfControllerReading = sourceOfControllerReading;
|
|
5
6
|
exports.isAutomaticAssetFactSource = isAutomaticAssetFactSource;
|
|
6
7
|
/*
|
|
7
8
|
* Where one asset detail came from, and when it was read (OneUptime issue
|
|
@@ -48,6 +49,12 @@ var AssetFactSourceKind;
|
|
|
48
49
|
AssetFactSourceKind["Collector"] = "collector";
|
|
49
50
|
// A host's cloud zone, standing in for a location it does not report.
|
|
50
51
|
AssetFactSourceKind["CloudPlacement"] = "cloudPlacement";
|
|
52
|
+
/*
|
|
53
|
+
* What the device's network controller says it is - the Meraki dashboard
|
|
54
|
+
* of an organization the project reads. `readBy` is the connection that
|
|
55
|
+
* read it, `readAt` when, and `provider` which controller.
|
|
56
|
+
*/
|
|
57
|
+
AssetFactSourceKind["Controller"] = "controller";
|
|
51
58
|
})(AssetFactSourceKind || (exports.AssetFactSourceKind = AssetFactSourceKind = {}));
|
|
52
59
|
// The source of a value discovery read.
|
|
53
60
|
function sourceOfDiscoveredValue(entry) {
|
|
@@ -58,6 +65,15 @@ function sourceOfDiscoveredValue(entry) {
|
|
|
58
65
|
readAt: entry.readAt,
|
|
59
66
|
};
|
|
60
67
|
}
|
|
68
|
+
// The source of what a device's controller says about it.
|
|
69
|
+
function sourceOfControllerReading(reading) {
|
|
70
|
+
return {
|
|
71
|
+
kind: AssetFactSourceKind.Controller,
|
|
72
|
+
readBy: reading.readBy,
|
|
73
|
+
readAt: reading.readAt,
|
|
74
|
+
provider: reading.provider,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
61
77
|
/*
|
|
62
78
|
* True when the source is something OneUptime read by itself, which is what
|
|
63
79
|
* makes it replaceable by a newer reading. A saved value, an assigned role or
|
|
@@ -70,5 +86,6 @@ function isAutomaticAssetFactSource(source) {
|
|
|
70
86
|
return (source.kind === AssetFactSourceKind.SnmpPoll ||
|
|
71
87
|
source.kind === AssetFactSourceKind.Discovered ||
|
|
72
88
|
source.kind === AssetFactSourceKind.LearnedFromArp ||
|
|
73
|
-
source.kind === AssetFactSourceKind.Collector
|
|
89
|
+
source.kind === AssetFactSourceKind.Collector ||
|
|
90
|
+
source.kind === AssetFactSourceKind.Controller);
|
|
74
91
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import commonJsModule from "./AssetFactSource.js";
|
|
2
2
|
export const AssetFactSourceKind = commonJsModule.AssetFactSourceKind;
|
|
3
3
|
export const isAutomaticAssetFactSource = commonJsModule.isAutomaticAssetFactSource;
|
|
4
|
+
export const sourceOfControllerReading = commonJsModule.sourceOfControllerReading;
|
|
4
5
|
export const sourceOfDiscoveredValue = commonJsModule.sourceOfDiscoveredValue;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const FEED_LEAD_SCAN_LENGTH: number;
|
|
2
|
+
export declare const FEED_LEADING_EMOJI: RegExp;
|
|
3
|
+
export declare const FEED_LEAD_VERBS: ReadonlySet<string>;
|
|
4
|
+
export declare const readFeedLeadingEmoji: (text: string) => string;
|
|
5
|
+
export declare const getSentenceAfterName: (sentence: string) => string | null;
|
|
6
|
+
export declare const opensWithFeedLeadVerb: (sentence: string) => boolean;
|
|
7
|
+
export declare const leadWithAuthorMarkdown: (data: {
|
|
8
|
+
authorMarkdown: string;
|
|
9
|
+
markdown: string;
|
|
10
|
+
}) => string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const FEED_LEAD_SCAN_LENGTH: number;
|
|
2
|
+
export declare const FEED_LEADING_EMOJI: RegExp;
|
|
3
|
+
export declare const FEED_LEAD_VERBS: ReadonlySet<string>;
|
|
4
|
+
export declare const readFeedLeadingEmoji: (text: string) => string;
|
|
5
|
+
export declare const getSentenceAfterName: (sentence: string) => string | null;
|
|
6
|
+
export declare const opensWithFeedLeadVerb: (sentence: string) => boolean;
|
|
7
|
+
export declare const leadWithAuthorMarkdown: (data: {
|
|
8
|
+
authorMarkdown: string;
|
|
9
|
+
markdown: string;
|
|
10
|
+
}) => string;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* HOW A FEED ENTRY'S SENTENCE READS AFTER THE NAME OF WHOEVER DID IT.
|
|
4
|
+
*
|
|
5
|
+
* An entry written for somebody's action is a sentence written to follow
|
|
6
|
+
* their name: "👤 Added **Deane Looi** as **Responder** to Incident INC-18",
|
|
7
|
+
* "📄 posted **private note** ...". Both places that show it put the name in
|
|
8
|
+
* front, by these same rules, so they can never read differently:
|
|
9
|
+
*
|
|
10
|
+
* - the Dashboard's feed (UI/Components/Feed/FeedEntryText), which draws
|
|
11
|
+
* the name with its avatar and drops the emoji: "Valeria Mustafaeva
|
|
12
|
+
* added Deane Looi as Responder to Incident INC-18";
|
|
13
|
+
* - Slack and Microsoft Teams (leadWithAuthor below, through
|
|
14
|
+
* WorkspaceUtil.getMessageBlocksByMarkdown), which keep the emoji first,
|
|
15
|
+
* as every line in the channel starts: "👤 Valeria Mustafaeva added
|
|
16
|
+
* Deane Looi as Responder to Incident INC-18". Messages used to put the
|
|
17
|
+
* name before the emoji and keep the verb's capital - "Valeria
|
|
18
|
+
* Mustafaeva 👤 Added Deane Looi ..." - two fragments instead of one
|
|
19
|
+
* sentence.
|
|
20
|
+
*
|
|
21
|
+
* Only the start of the Markdown is ever looked at - never a whole entry,
|
|
22
|
+
* which can be megabytes long (a log pasted into a note) - and every
|
|
23
|
+
* pattern is anchored at the start, so the work does not grow with it.
|
|
24
|
+
*
|
|
25
|
+
* React-free and database-free, so the rules can be tested on their own.
|
|
26
|
+
*/
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.leadWithAuthorMarkdown = exports.opensWithFeedLeadVerb = exports.getSentenceAfterName = exports.readFeedLeadingEmoji = exports.FEED_LEAD_VERBS = exports.FEED_LEADING_EMOJI = exports.FEED_LEAD_SCAN_LENGTH = void 0;
|
|
29
|
+
/*
|
|
30
|
+
* How much of the start of an entry the rules read. Generous for a first
|
|
31
|
+
* sentence, and small enough that no regular expression ever runs over a
|
|
32
|
+
* long value.
|
|
33
|
+
*/
|
|
34
|
+
exports.FEED_LEAD_SCAN_LENGTH = 600;
|
|
35
|
+
/*
|
|
36
|
+
* A leading emoji, with its modifiers, joiners and variation selectors -
|
|
37
|
+
* "👨🏻💻 ", "🏷️ ", "⚠️ " - and the space after it.
|
|
38
|
+
*/
|
|
39
|
+
exports.FEED_LEADING_EMOJI = /^(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\p{Regional_Indicator}||️)+[ \t]*/u;
|
|
40
|
+
// The first word of a sentence: letters only.
|
|
41
|
+
const FIRST_WORD = /^[A-Za-z]+/;
|
|
42
|
+
/*
|
|
43
|
+
* Past-tense verbs an entry written for someone's action opens with, as
|
|
44
|
+
* the server writes them ("Added", "Changed", "posted"). After the name
|
|
45
|
+
* they read in lower case: "Nitin changed the state".
|
|
46
|
+
*/
|
|
47
|
+
exports.FEED_LEAD_VERBS = new Set([
|
|
48
|
+
"acknowledged",
|
|
49
|
+
"added",
|
|
50
|
+
"applied",
|
|
51
|
+
"approved",
|
|
52
|
+
"archived",
|
|
53
|
+
"assigned",
|
|
54
|
+
"attached",
|
|
55
|
+
"cancelled",
|
|
56
|
+
"changed",
|
|
57
|
+
"closed",
|
|
58
|
+
"completed",
|
|
59
|
+
"connected",
|
|
60
|
+
"created",
|
|
61
|
+
"declared",
|
|
62
|
+
"deleted",
|
|
63
|
+
"disabled",
|
|
64
|
+
"disconnected",
|
|
65
|
+
"dismissed",
|
|
66
|
+
"enabled",
|
|
67
|
+
"ended",
|
|
68
|
+
"escalated",
|
|
69
|
+
"executed",
|
|
70
|
+
"invited",
|
|
71
|
+
"joined",
|
|
72
|
+
// "Valeria left the Responder role on Incident INC-18" (IncidentRoleFeedText).
|
|
73
|
+
"left",
|
|
74
|
+
"linked",
|
|
75
|
+
"marked",
|
|
76
|
+
"merged",
|
|
77
|
+
"moved",
|
|
78
|
+
"muted",
|
|
79
|
+
"notified",
|
|
80
|
+
"paged",
|
|
81
|
+
"posted",
|
|
82
|
+
"ran",
|
|
83
|
+
"reassigned",
|
|
84
|
+
"rejected",
|
|
85
|
+
"removed",
|
|
86
|
+
"renamed",
|
|
87
|
+
"reopened",
|
|
88
|
+
"requested",
|
|
89
|
+
"reset",
|
|
90
|
+
"resolved",
|
|
91
|
+
"restored",
|
|
92
|
+
"resumed",
|
|
93
|
+
"scheduled",
|
|
94
|
+
"sent",
|
|
95
|
+
"set",
|
|
96
|
+
"shared",
|
|
97
|
+
"skipped",
|
|
98
|
+
"snoozed",
|
|
99
|
+
"started",
|
|
100
|
+
"stopped",
|
|
101
|
+
// "Valeria took the Incident Commander role on Incident INC-18".
|
|
102
|
+
"took",
|
|
103
|
+
"triggered",
|
|
104
|
+
"unassigned",
|
|
105
|
+
"unlinked",
|
|
106
|
+
"unmuted",
|
|
107
|
+
"updated",
|
|
108
|
+
"uploaded",
|
|
109
|
+
]);
|
|
110
|
+
/*
|
|
111
|
+
* The emoji an entry opens with, with the space after it ("👤 "), or "" when
|
|
112
|
+
* it opens with none.
|
|
113
|
+
*/
|
|
114
|
+
const readFeedLeadingEmoji = (text) => {
|
|
115
|
+
const emoji = text
|
|
116
|
+
.slice(0, exports.FEED_LEAD_SCAN_LENGTH)
|
|
117
|
+
.match(exports.FEED_LEADING_EMOJI);
|
|
118
|
+
return emoji ? emoji[0] : "";
|
|
119
|
+
};
|
|
120
|
+
exports.readFeedLeadingEmoji = readFeedLeadingEmoji;
|
|
121
|
+
/*
|
|
122
|
+
* A sentence as it reads after somebody's name, or null when it is not one
|
|
123
|
+
* written to follow a name. One that opens in lower case already is
|
|
124
|
+
* ("posted **private note** ..."); one that opens with an action's verb
|
|
125
|
+
* reads with the verb in lower case ("Added" - "added"). Anything else - a
|
|
126
|
+
* heading, a noun phrase ("**Incident INC-18 was updated.**"), a word that
|
|
127
|
+
* only looks like a verb ("Setup ...") - is not.
|
|
128
|
+
*/
|
|
129
|
+
const getSentenceAfterName = (sentence) => {
|
|
130
|
+
if (!sentence) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
const firstCharacter = sentence.charAt(0);
|
|
134
|
+
if (firstCharacter !== firstCharacter.toUpperCase()) {
|
|
135
|
+
return sentence;
|
|
136
|
+
}
|
|
137
|
+
const word = sentence
|
|
138
|
+
.slice(0, exports.FEED_LEAD_SCAN_LENGTH)
|
|
139
|
+
.match(FIRST_WORD);
|
|
140
|
+
if (!word) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
const lowerCaseWord = word[0].toLowerCase();
|
|
144
|
+
if (!exports.FEED_LEAD_VERBS.has(lowerCaseWord)) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
// The word must end there: "Setup ..." is not "Set".
|
|
148
|
+
const after = sentence.charAt(word[0].length);
|
|
149
|
+
if (after !== "" && after !== " " && after !== "\t") {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
return lowerCaseWord + sentence.slice(word[0].length);
|
|
153
|
+
};
|
|
154
|
+
exports.getSentenceAfterName = getSentenceAfterName;
|
|
155
|
+
/*
|
|
156
|
+
* Whether a sentence opens with one of the verbs an action is written with,
|
|
157
|
+
* capitalized or not, as a word of its own: "Added ...", "posted ...".
|
|
158
|
+
*/
|
|
159
|
+
const opensWithFeedLeadVerb = (sentence) => {
|
|
160
|
+
const word = sentence
|
|
161
|
+
.slice(0, exports.FEED_LEAD_SCAN_LENGTH)
|
|
162
|
+
.match(FIRST_WORD);
|
|
163
|
+
if (!word || !exports.FEED_LEAD_VERBS.has(word[0].toLowerCase())) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
// The verb must be a word of its own: "created-item" is not "created".
|
|
167
|
+
const after = sentence.charAt(word[0].length);
|
|
168
|
+
return after === "" || after === " " || after === "\t";
|
|
169
|
+
};
|
|
170
|
+
exports.opensWithFeedLeadVerb = opensWithFeedLeadVerb;
|
|
171
|
+
/*
|
|
172
|
+
* A Slack or Microsoft Teams message, opened by whoever did what it says:
|
|
173
|
+
* the emoji the entry starts with, then their name, then the sentence with
|
|
174
|
+
* its verb in lower case - "👤 Valeria Mustafaeva added Deane Looi as
|
|
175
|
+
* Responder to Incident INC-18". `authorMarkdown` is the name as the
|
|
176
|
+
* workspace shows it, ending in a space ("@valeria ", "[Valeria
|
|
177
|
+
* Mustafaeva](...) ", "Jira Automation (API key) "). An entry that is not a
|
|
178
|
+
* sentence written to follow a name keeps the name in front of it, as it
|
|
179
|
+
* is written.
|
|
180
|
+
*/
|
|
181
|
+
const leadWithAuthorMarkdown = (data) => {
|
|
182
|
+
const markdown = data.markdown || "";
|
|
183
|
+
if (!data.authorMarkdown.trim()) {
|
|
184
|
+
return markdown;
|
|
185
|
+
}
|
|
186
|
+
const author = data.authorMarkdown.trimEnd() + " ";
|
|
187
|
+
const text = markdown.trimStart();
|
|
188
|
+
const emoji = (0, exports.readFeedLeadingEmoji)(text);
|
|
189
|
+
const sentence = (0, exports.getSentenceAfterName)(text.slice(emoji.length));
|
|
190
|
+
if (sentence === null) {
|
|
191
|
+
return data.authorMarkdown + markdown;
|
|
192
|
+
}
|
|
193
|
+
if (!emoji) {
|
|
194
|
+
return author + sentence;
|
|
195
|
+
}
|
|
196
|
+
return emoji.trimEnd() + " " + author + sentence;
|
|
197
|
+
};
|
|
198
|
+
exports.leadWithAuthorMarkdown = leadWithAuthorMarkdown;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import commonJsModule from "./FeedLead.js";
|
|
2
|
+
export const FEED_LEADING_EMOJI = commonJsModule.FEED_LEADING_EMOJI;
|
|
3
|
+
export const FEED_LEAD_SCAN_LENGTH = commonJsModule.FEED_LEAD_SCAN_LENGTH;
|
|
4
|
+
export const FEED_LEAD_VERBS = commonJsModule.FEED_LEAD_VERBS;
|
|
5
|
+
export const getSentenceAfterName = commonJsModule.getSentenceAfterName;
|
|
6
|
+
export const leadWithAuthorMarkdown = commonJsModule.leadWithAuthorMarkdown;
|
|
7
|
+
export const opensWithFeedLeadVerb = commonJsModule.opensWithFeedLeadVerb;
|
|
8
|
+
export const readFeedLeadingEmoji = commonJsModule.readFeedLeadingEmoji;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NetworkTopologyDeviceRole } from "../../Types/Monitor/SnmpMonitor/NetworkTopology.mjs";
|
|
2
|
+
import { NetworkDeviceControllerReading, NetworkDeviceDiscoveredDetails, NetworkDeviceDiscoverySighting, NetworkDeviceOtherMachineSighting } from "../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails.mjs";
|
|
2
3
|
import { AssetFactDifference, AssetFactSource } from "../Inventory/AssetFactSource.mjs";
|
|
3
4
|
import { TopologyDeviceRoleInput } from "../Monitor/NetworkDeviceRoleCatalog.mjs";
|
|
4
5
|
import { SystemDescriptionFacts } from "./SystemDescriptionUtil.mjs";
|
|
@@ -60,6 +61,7 @@ export interface NetworkDeviceFactDetails {
|
|
|
60
61
|
system: Record<NetworkDeviceSystemKey, NetworkDeviceFactDetail>;
|
|
61
62
|
foundBy?: NetworkDeviceDiscoverySighting | undefined;
|
|
62
63
|
otherMachine?: NetworkDeviceOtherMachineSighting | undefined;
|
|
64
|
+
controller?: NetworkDeviceControllerReading | undefined;
|
|
63
65
|
}
|
|
64
66
|
/**
|
|
65
67
|
* A value as display text: a trimmed string, or undefined for anything that
|
|
@@ -101,6 +103,11 @@ export interface NetworkDeviceEffectiveInputs {
|
|
|
101
103
|
macAddress: NetworkDeviceEffectiveInput;
|
|
102
104
|
netbiosName: NetworkDeviceEffectiveInput;
|
|
103
105
|
resolvedIpAddress: NetworkDeviceEffectiveInput;
|
|
106
|
+
controllerName: NetworkDeviceEffectiveInput;
|
|
107
|
+
controllerIpAddress: NetworkDeviceEffectiveInput;
|
|
108
|
+
controllerMacAddress: NetworkDeviceEffectiveInput;
|
|
109
|
+
controllerAddress: NetworkDeviceEffectiveInput;
|
|
110
|
+
controllerProductType: NetworkDeviceEffectiveInput;
|
|
104
111
|
details: NetworkDeviceDiscoveredDetails;
|
|
105
112
|
}
|
|
106
113
|
/**
|
|
@@ -108,6 +115,7 @@ export interface NetworkDeviceEffectiveInputs {
|
|
|
108
115
|
* what discovery read - see the header for which wins.
|
|
109
116
|
*/
|
|
110
117
|
export declare function getNetworkDeviceEffectiveInputs(device: NetworkDeviceAssetSource): NetworkDeviceEffectiveInputs;
|
|
118
|
+
export declare function getRoleOfControllerProductType(productType: string | undefined): NetworkTopologyDeviceRole | undefined;
|
|
111
119
|
/**
|
|
112
120
|
* Every asset fact of one network device, each with where it came from, and
|
|
113
121
|
* the SNMP system group the device's page lists. See the header for which
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NetworkTopologyDeviceRole } from "../../Types/Monitor/SnmpMonitor/NetworkTopology";
|
|
2
|
+
import { NetworkDeviceControllerReading, NetworkDeviceDiscoveredDetails, NetworkDeviceDiscoverySighting, NetworkDeviceOtherMachineSighting } from "../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails";
|
|
2
3
|
import { AssetFactDifference, AssetFactSource } from "../Inventory/AssetFactSource";
|
|
3
4
|
import { TopologyDeviceRoleInput } from "../Monitor/NetworkDeviceRoleCatalog";
|
|
4
5
|
import { SystemDescriptionFacts } from "./SystemDescriptionUtil";
|
|
@@ -60,6 +61,7 @@ export interface NetworkDeviceFactDetails {
|
|
|
60
61
|
system: Record<NetworkDeviceSystemKey, NetworkDeviceFactDetail>;
|
|
61
62
|
foundBy?: NetworkDeviceDiscoverySighting | undefined;
|
|
62
63
|
otherMachine?: NetworkDeviceOtherMachineSighting | undefined;
|
|
64
|
+
controller?: NetworkDeviceControllerReading | undefined;
|
|
63
65
|
}
|
|
64
66
|
/**
|
|
65
67
|
* A value as display text: a trimmed string, or undefined for anything that
|
|
@@ -101,6 +103,11 @@ export interface NetworkDeviceEffectiveInputs {
|
|
|
101
103
|
macAddress: NetworkDeviceEffectiveInput;
|
|
102
104
|
netbiosName: NetworkDeviceEffectiveInput;
|
|
103
105
|
resolvedIpAddress: NetworkDeviceEffectiveInput;
|
|
106
|
+
controllerName: NetworkDeviceEffectiveInput;
|
|
107
|
+
controllerIpAddress: NetworkDeviceEffectiveInput;
|
|
108
|
+
controllerMacAddress: NetworkDeviceEffectiveInput;
|
|
109
|
+
controllerAddress: NetworkDeviceEffectiveInput;
|
|
110
|
+
controllerProductType: NetworkDeviceEffectiveInput;
|
|
104
111
|
details: NetworkDeviceDiscoveredDetails;
|
|
105
112
|
}
|
|
106
113
|
/**
|
|
@@ -108,6 +115,7 @@ export interface NetworkDeviceEffectiveInputs {
|
|
|
108
115
|
* what discovery read - see the header for which wins.
|
|
109
116
|
*/
|
|
110
117
|
export declare function getNetworkDeviceEffectiveInputs(device: NetworkDeviceAssetSource): NetworkDeviceEffectiveInputs;
|
|
118
|
+
export declare function getRoleOfControllerProductType(productType: string | undefined): NetworkTopologyDeviceRole | undefined;
|
|
111
119
|
/**
|
|
112
120
|
* Every asset fact of one network device, each with where it came from, and
|
|
113
121
|
* the SNMP system group the device's page lists. See the header for which
|