@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.
Files changed (215) hide show
  1. package/Models/AnalyticsModels/NetworkFlow.d.mts +4 -0
  2. package/Models/AnalyticsModels/NetworkFlow.d.ts +4 -0
  3. package/Models/AnalyticsModels/NetworkFlow.js +50 -0
  4. package/Models/DatabaseModels/Alert.d.mts +2 -0
  5. package/Models/DatabaseModels/Alert.d.ts +2 -0
  6. package/Models/DatabaseModels/Alert.js +63 -0
  7. package/Models/DatabaseModels/Incident.d.mts +2 -0
  8. package/Models/DatabaseModels/Incident.d.ts +2 -0
  9. package/Models/DatabaseModels/Incident.js +63 -0
  10. package/Models/DatabaseModels/Index.js +10 -0
  11. package/Models/DatabaseModels/NetworkAddressName.d.mts +14 -0
  12. package/Models/DatabaseModels/NetworkAddressName.d.ts +14 -0
  13. package/Models/DatabaseModels/NetworkAddressName.js +300 -0
  14. package/Models/DatabaseModels/NetworkAddressName.mjs +2 -0
  15. package/Models/DatabaseModels/NetworkDevice.d.mts +1 -0
  16. package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
  17. package/Models/DatabaseModels/NetworkDevice.js +38 -0
  18. package/Models/DatabaseModels/SecurityCase.d.mts +8 -0
  19. package/Models/DatabaseModels/SecurityCase.d.ts +8 -0
  20. package/Models/DatabaseModels/SecurityCase.js +145 -0
  21. package/Models/DatabaseModels/SecurityCaseEvidence.d.mts +28 -0
  22. package/Models/DatabaseModels/SecurityCaseEvidence.d.ts +28 -0
  23. package/Models/DatabaseModels/SecurityCaseEvidence.js +489 -0
  24. package/Models/DatabaseModels/SecurityCaseEvidence.mjs +2 -0
  25. package/Models/DatabaseModels/SecurityCaseFeed.d.mts +4 -1
  26. package/Models/DatabaseModels/SecurityCaseFeed.d.ts +4 -1
  27. package/Models/DatabaseModels/SecurityCaseFeed.js +6 -0
  28. package/Models/DatabaseModels/SecurityCasePriority.d.mts +2 -0
  29. package/Models/DatabaseModels/SecurityCasePriority.d.ts +2 -0
  30. package/Models/DatabaseModels/SecurityCasePriority.js +44 -0
  31. package/Models/DatabaseModels/SecurityCaseTask.d.mts +22 -0
  32. package/Models/DatabaseModels/SecurityCaseTask.d.ts +22 -0
  33. package/Models/DatabaseModels/SecurityCaseTask.js +467 -0
  34. package/Models/DatabaseModels/SecurityCaseTask.mjs +2 -0
  35. package/Models/DatabaseModels/SecurityWatchlist.d.mts +22 -0
  36. package/Models/DatabaseModels/SecurityWatchlist.d.ts +22 -0
  37. package/Models/DatabaseModels/SecurityWatchlist.js +411 -0
  38. package/Models/DatabaseModels/SecurityWatchlist.mjs +2 -0
  39. package/Models/DatabaseModels/SecurityWatchlistItem.d.mts +17 -0
  40. package/Models/DatabaseModels/SecurityWatchlistItem.d.ts +17 -0
  41. package/Models/DatabaseModels/SecurityWatchlistItem.js +321 -0
  42. package/Models/DatabaseModels/SecurityWatchlistItem.mjs +2 -0
  43. package/Types/AI/AiAffectedResources.d.mts +2 -1
  44. package/Types/AI/AiAffectedResources.d.ts +2 -1
  45. package/Types/AI/AiAffectedResources.js +12 -1
  46. package/Types/AffectedResources/AffectedResourceSearch.d.mts +53 -0
  47. package/Types/AffectedResources/AffectedResourceSearch.d.ts +53 -0
  48. package/Types/AffectedResources/AffectedResourceSearch.js +224 -0
  49. package/Types/AffectedResources/AffectedResourceSearch.mjs +11 -0
  50. package/Types/ArchivableValue/ArchivableValueUsage.d.mts +21 -2
  51. package/Types/ArchivableValue/ArchivableValueUsage.d.ts +21 -2
  52. package/Types/ArchivableValue/ArchivableValueUsage.js +91 -12
  53. package/Types/ArchivableValue/ArchivableValueUsage.mjs +1 -0
  54. package/Types/Color.d.mts +0 -2
  55. package/Types/Color.d.ts +0 -2
  56. package/Types/Color.js +0 -14
  57. package/Types/Database/DatabaseProperty.d.mts +0 -2
  58. package/Types/Database/DatabaseProperty.d.ts +0 -2
  59. package/Types/Database/DatabaseProperty.js +0 -3
  60. package/Types/Date.d.mts +0 -2
  61. package/Types/Date.d.ts +0 -2
  62. package/Types/Date.js +0 -23
  63. package/Types/Domain.d.mts +0 -2
  64. package/Types/Domain.d.ts +0 -2
  65. package/Types/Domain.js +0 -14
  66. package/Types/Email/EmailTemplateType.d.mts +2 -0
  67. package/Types/Email/EmailTemplateType.d.ts +2 -0
  68. package/Types/Email/EmailTemplateType.js +2 -0
  69. package/Types/Email.d.mts +0 -2
  70. package/Types/Email.d.ts +0 -2
  71. package/Types/Email.js +0 -15
  72. package/Types/IP/IP.d.mts +0 -2
  73. package/Types/IP/IP.d.ts +0 -2
  74. package/Types/IP/IP.js +0 -14
  75. package/Types/Monitor/CriteriaAlert.d.mts +0 -2
  76. package/Types/Monitor/CriteriaAlert.d.ts +0 -2
  77. package/Types/Monitor/CriteriaAlert.js +0 -18
  78. package/Types/Monitor/CriteriaAlert.mjs +1 -2
  79. package/Types/Monitor/CriteriaFilter.d.mts +0 -2
  80. package/Types/Monitor/CriteriaFilter.d.ts +0 -2
  81. package/Types/Monitor/CriteriaFilter.js +1 -42
  82. package/Types/Monitor/CriteriaFilter.mjs +0 -1
  83. package/Types/Monitor/CriteriaIncident.d.mts +0 -2
  84. package/Types/Monitor/CriteriaIncident.d.ts +0 -2
  85. package/Types/Monitor/CriteriaIncident.js +0 -23
  86. package/Types/Monitor/CriteriaIncident.mjs +1 -2
  87. package/Types/Monitor/IncomingMonitor/IncidentGroupingConfig.d.mts +0 -2
  88. package/Types/Monitor/IncomingMonitor/IncidentGroupingConfig.d.ts +0 -2
  89. package/Types/Monitor/IncomingMonitor/IncidentGroupingConfig.js +0 -11
  90. package/Types/Monitor/IncomingMonitor/IncidentGroupingConfig.mjs +1 -2
  91. package/Types/Monitor/MonitorCriteria.d.mts +0 -2
  92. package/Types/Monitor/MonitorCriteria.d.ts +0 -2
  93. package/Types/Monitor/MonitorCriteria.js +0 -21
  94. package/Types/Monitor/MonitorCriteriaInstance.d.mts +0 -2
  95. package/Types/Monitor/MonitorCriteriaInstance.d.ts +0 -2
  96. package/Types/Monitor/MonitorCriteriaInstance.js +0 -54
  97. package/Types/Monitor/MonitorStep.d.mts +0 -2
  98. package/Types/Monitor/MonitorStep.d.ts +0 -2
  99. package/Types/Monitor/MonitorStep.js +0 -80
  100. package/Types/Monitor/MonitorSteps.d.mts +0 -2
  101. package/Types/Monitor/MonitorSteps.d.ts +0 -2
  102. package/Types/Monitor/MonitorSteps.js +0 -31
  103. package/Types/Name.d.mts +0 -2
  104. package/Types/Name.d.ts +0 -2
  105. package/Types/Name.js +0 -14
  106. package/Types/NetFlow/NetworkAddressName.d.mts +30 -0
  107. package/Types/NetFlow/NetworkAddressName.d.ts +30 -0
  108. package/Types/NetFlow/NetworkAddressName.js +149 -0
  109. package/Types/NetFlow/NetworkAddressName.mjs +6 -0
  110. package/Types/NetFlow/NetworkTraffic.d.mts +20 -0
  111. package/Types/NetFlow/NetworkTraffic.d.ts +20 -0
  112. package/Types/NetFlow/NetworkTraffic.js +5 -1
  113. package/Types/NetFlow/NetworkTraffic.mjs +2 -0
  114. package/Types/NetworkController/NetworkControllerReadSummary.d.mts +2 -0
  115. package/Types/NetworkController/NetworkControllerReadSummary.d.ts +2 -0
  116. package/Types/NetworkController/NetworkControllerReadSummary.js +7 -1
  117. package/Types/NetworkDevice/NetworkDeviceDiscoveredDetails.d.mts +47 -1
  118. package/Types/NetworkDevice/NetworkDeviceDiscoveredDetails.d.ts +47 -1
  119. package/Types/NetworkDevice/NetworkDeviceDiscoveredDetails.js +173 -8
  120. package/Types/NetworkDevice/NetworkDeviceDiscoveredDetails.mjs +7 -0
  121. package/Types/NotificationSetting/NotificationEmailRollupCategory.js +3 -0
  122. package/Types/NotificationSetting/NotificationEmailRollupPolicy.js +6 -0
  123. package/Types/NotificationSetting/NotificationSettingEventType.d.mts +2 -0
  124. package/Types/NotificationSetting/NotificationSettingEventType.d.ts +2 -0
  125. package/Types/NotificationSetting/NotificationSettingEventType.js +9 -0
  126. package/Types/ObjectID.d.mts +0 -1
  127. package/Types/ObjectID.d.ts +0 -1
  128. package/Types/ObjectID.js +0 -9
  129. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunEnding.d.mts +4 -0
  130. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunEnding.d.ts +4 -0
  131. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunEnding.js +25 -1
  132. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunEnding.mjs +4 -0
  133. package/Types/OnCallDutyPolicy/OnCallEmptyLevel.d.mts +15 -0
  134. package/Types/OnCallDutyPolicy/OnCallEmptyLevel.d.ts +15 -0
  135. package/Types/OnCallDutyPolicy/OnCallEmptyLevel.js +118 -0
  136. package/Types/OnCallDutyPolicy/OnCallEmptyLevel.mjs +9 -0
  137. package/Types/Permission.d.mts +8 -0
  138. package/Types/Permission.d.ts +8 -0
  139. package/Types/Permission.js +87 -3
  140. package/Types/Phone.d.mts +0 -2
  141. package/Types/Phone.d.ts +0 -2
  142. package/Types/Phone.js +0 -14
  143. package/Types/Port.d.mts +0 -2
  144. package/Types/Port.d.ts +0 -2
  145. package/Types/Port.js +0 -14
  146. package/Types/ProviderLogo/ProviderLogo.d.mts +8 -1
  147. package/Types/ProviderLogo/ProviderLogo.d.ts +8 -1
  148. package/Types/ProviderLogo/ProviderLogo.js +14 -0
  149. package/Types/SecurityCase/SecurityCaseEvidenceKind.d.mts +7 -0
  150. package/Types/SecurityCase/SecurityCaseEvidenceKind.d.ts +7 -0
  151. package/Types/SecurityCase/SecurityCaseEvidenceKind.js +24 -0
  152. package/Types/SecurityCase/SecurityCaseEvidenceKind.mjs +4 -0
  153. package/Types/SecurityEvent/SecurityWatchlist.d.mts +167 -0
  154. package/Types/SecurityEvent/SecurityWatchlist.d.ts +167 -0
  155. package/Types/SecurityEvent/SecurityWatchlist.js +648 -0
  156. package/Types/SecurityEvent/SecurityWatchlist.mjs +51 -0
  157. package/Types/SecurityEvent/SigmaRule.d.mts +2 -0
  158. package/Types/SecurityEvent/SigmaRule.d.ts +2 -0
  159. package/Types/SecurityEvent/SigmaRule.js +5 -0
  160. package/Types/Telemetry/OpenTelemetryGuides.js +177 -5
  161. package/Types/Version.d.mts +0 -2
  162. package/Types/Version.d.ts +0 -2
  163. package/Types/Version.js +0 -14
  164. package/Types/Workflow/AffectedResourcesSetting.d.mts +13 -0
  165. package/Types/Workflow/AffectedResourcesSetting.d.ts +13 -0
  166. package/Types/Workflow/AffectedResourcesSetting.js +120 -0
  167. package/Types/Workflow/AffectedResourcesSetting.mjs +8 -0
  168. package/Types/Workflow/Components/BaseModel.js +15 -3
  169. package/Types/Workflow/Documentation/DatabaseDocumentation.js +36 -0
  170. package/Utils/Inventory/AssetFactSource.d.mts +6 -2
  171. package/Utils/Inventory/AssetFactSource.d.ts +6 -2
  172. package/Utils/Inventory/AssetFactSource.js +18 -1
  173. package/Utils/Inventory/AssetFactSource.mjs +1 -0
  174. package/Utils/Markdown/FeedLead.d.mts +10 -0
  175. package/Utils/Markdown/FeedLead.d.ts +10 -0
  176. package/Utils/Markdown/FeedLead.js +198 -0
  177. package/Utils/Markdown/FeedLead.mjs +8 -0
  178. package/Utils/NetworkDevice/NetworkDeviceAssetFacts.d.mts +9 -1
  179. package/Utils/NetworkDevice/NetworkDeviceAssetFacts.d.ts +9 -1
  180. package/Utils/NetworkDevice/NetworkDeviceAssetFacts.js +139 -18
  181. package/Utils/NetworkDevice/NetworkDeviceAssetFacts.mjs +1 -0
  182. package/Utils/NetworkDevice/NetworkDeviceRefresh.d.mts +88 -0
  183. package/Utils/NetworkDevice/NetworkDeviceRefresh.d.ts +88 -0
  184. package/Utils/NetworkDevice/NetworkDeviceRefresh.js +232 -0
  185. package/Utils/NetworkDevice/NetworkDeviceRefresh.mjs +16 -0
  186. package/Utils/NetworkTraffic/NetworkAddressBlock.d.mts +20 -0
  187. package/Utils/NetworkTraffic/NetworkAddressBlock.d.ts +20 -0
  188. package/Utils/NetworkTraffic/NetworkAddressBlock.js +264 -0
  189. package/Utils/NetworkTraffic/NetworkAddressBlock.mjs +3 -0
  190. package/Utils/Schema/MonitorSchemas.d.mts +9 -0
  191. package/Utils/Schema/MonitorSchemas.d.ts +9 -0
  192. package/Utils/Schema/MonitorSchemas.js +291 -0
  193. package/Utils/Schema/MonitorSchemas.mjs +9 -0
  194. package/Utils/Schema/TypeSchemas.d.mts +12 -0
  195. package/Utils/Schema/TypeSchemas.d.ts +12 -0
  196. package/Utils/Schema/TypeSchemas.js +176 -0
  197. package/Utils/Schema/TypeSchemas.mjs +11 -0
  198. package/Utils/Schema/Zod.js +17 -17
  199. package/Utils/SecurityCase/SecurityCaseMarkdown.d.mts +34 -0
  200. package/Utils/SecurityCase/SecurityCaseMarkdown.d.ts +34 -0
  201. package/Utils/SecurityCase/SecurityCaseMarkdown.js +69 -0
  202. package/Utils/SecurityCase/SecurityCaseMarkdown.mjs +9 -0
  203. package/Utils/SecurityCase/SecurityCasePriorities.d.mts +2 -0
  204. package/Utils/SecurityCase/SecurityCasePriorities.d.ts +2 -0
  205. package/Utils/SecurityCase/SecurityCasePriorities.js +15 -1
  206. package/Utils/SecurityCase/SecurityCaseTargets.d.mts +128 -0
  207. package/Utils/SecurityCase/SecurityCaseTargets.d.ts +128 -0
  208. package/Utils/SecurityCase/SecurityCaseTargets.js +482 -0
  209. package/Utils/SecurityCase/SecurityCaseTargets.mjs +28 -0
  210. package/Utils/SecurityEvent/Sigma/SigmaRuleParser.js +22 -0
  211. package/Utils/SecurityEvent/Sigma/SigmaWatchlists.d.mts +24 -0
  212. package/Utils/SecurityEvent/Sigma/SigmaWatchlists.d.ts +24 -0
  213. package/Utils/SecurityEvent/Sigma/SigmaWatchlists.js +183 -0
  214. package/Utils/SecurityEvent/Sigma/SigmaWatchlists.mjs +9 -0
  215. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
- import { NetworkDeviceDiscoveredValue, NetworkDeviceDiscoveryMethod, NetworkDeviceDiscoveryReader } from "../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails.mjs";
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 { NetworkDeviceDiscoveredValue, NetworkDeviceDiscoveryMethod, NetworkDeviceDiscoveryReader } from "../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails";
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 { NetworkDeviceDiscoveredDetails, NetworkDeviceDiscoverySighting, NetworkDeviceOtherMachineSighting } from "../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails.mjs";
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 { NetworkDeviceDiscoveredDetails, NetworkDeviceDiscoverySighting, NetworkDeviceOtherMachineSighting } from "../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails";
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
@@ -7,6 +7,7 @@ exports.readText = readText;
7
7
  exports.toOtelMacAddress = toOtelMacAddress;
8
8
  exports.isIpAddressLiteral = isIpAddressLiteral;
9
9
  exports.getNetworkDeviceEffectiveInputs = getNetworkDeviceEffectiveInputs;
10
+ exports.getRoleOfControllerProductType = getRoleOfControllerProductType;
10
11
  exports.getNetworkDeviceFactDetails = getNetworkDeviceFactDetails;
11
12
  exports.getNetworkDeviceHostname = getNetworkDeviceHostname;
12
13
  exports.getNetworkDeviceDnsName = getNetworkDeviceDnsName;
@@ -17,6 +18,7 @@ exports.getNetworkDeviceLocation = getNetworkDeviceLocation;
17
18
  exports.getNetworkDeviceSystemDescription = getNetworkDeviceSystemDescription;
18
19
  exports.getNetworkDeviceAssetFacts = getNetworkDeviceAssetFacts;
19
20
  const SnmpVendorTemplate_1 = __importDefault(require("../../Types/Monitor/SnmpMonitor/SnmpVendorTemplate"));
21
+ const NetworkControllerProvider_1 = require("../../Types/NetworkController/NetworkControllerProvider");
20
22
  const DeviceNameSource_1 = require("../../Types/NetworkDevice/DeviceNameSource");
21
23
  const NetworkDeviceDiscoveredDetails_1 = require("../../Types/NetworkDevice/NetworkDeviceDiscoveredDetails");
22
24
  const IP_1 = __importDefault(require("../../Types/IP/IP"));
@@ -109,6 +111,49 @@ function readTime(value) {
109
111
  function isSameValue(left, right) {
110
112
  return left.trim().toLowerCase() === right.trim().toLowerCase();
111
113
  }
114
+ /*
115
+ * One value of the device's controller reading, with its source - or nothing
116
+ * when the controller says nothing about it.
117
+ */
118
+ function controllerInput(reading, field) {
119
+ const value = reading === null || reading === void 0 ? void 0 : reading.values[field];
120
+ return reading && value
121
+ ? { value: value, source: (0, AssetFactSource_1.sourceOfControllerReading)(reading) }
122
+ : {};
123
+ }
124
+ /*
125
+ * A column a poll writes (or a person saved), with what the device's
126
+ * controller says about the same detail - its model, serial number,
127
+ * firmware, maker. The controller FILLS IN:
128
+ *
129
+ * - nothing else has a value: the controller's;
130
+ * - a value saved on the device: the saved value, which is never replaced,
131
+ * and the controller's beside it when the two differ;
132
+ * - a value the device's own poll read: the poll's. It is what the box
133
+ * says about itself, and both are read every few minutes - "the newer
134
+ * wins" between the two would hand the detail back and forth with every
135
+ * read wherever they spell it differently ("15.2(7)E" on the box,
136
+ * "switch-15-21" in the dashboard). A Meraki device's own poll reads no
137
+ * model, serial number or firmware, so for it the dashboard gives them.
138
+ */
139
+ function withControllerReading(input, controller) {
140
+ var _a;
141
+ if (!controller.value || !controller.source) {
142
+ return input;
143
+ }
144
+ if (!input.value) {
145
+ return controller;
146
+ }
147
+ if (((_a = input.source) === null || _a === void 0 ? void 0 : _a.kind) === AssetFactSource_1.AssetFactSourceKind.Saved &&
148
+ !input.discoveredDifferent &&
149
+ !isSameValue(input.value, controller.value)) {
150
+ return Object.assign(Object.assign({}, input), { discoveredDifferent: {
151
+ value: controller.value,
152
+ source: controller.source,
153
+ } });
154
+ }
155
+ return input;
156
+ }
112
157
  function differenceOf(entry) {
113
158
  return { value: entry.value, source: (0, AssetFactSource_1.sourceOfDiscoveredValue)(entry) };
114
159
  }
@@ -166,6 +211,7 @@ function readDiscoveredOnly(discovered) {
166
211
  * what discovery read - see the header for which wins.
167
212
  */
168
213
  function getNetworkDeviceEffectiveInputs(device) {
214
+ var _a;
169
215
  const details = (0, NetworkDeviceDiscoveredDetails_1.readNetworkDeviceDiscoveredDetails)(device.discoveredDetails);
170
216
  const lastPolledAt = readTime(device.lastSnmpSeenAt);
171
217
  const lastPolledAtIso = lastPolledAt === undefined
@@ -220,21 +266,58 @@ function getNetworkDeviceEffectiveInputs(device) {
220
266
  };
221
267
  }
222
268
  }
269
+ /*
270
+ * What the device's controller says (the Meraki dashboard): its maker
271
+ * is the controller's own, and its model, serial number and firmware are
272
+ * the box's. A controller reads no SNMP system group, so it fills none of
273
+ * those.
274
+ */
275
+ const controller = details.controller;
276
+ /*
277
+ * Its MAC, when nothing else gives one; and beside a typed one it differs
278
+ * from, when no ARP table already does.
279
+ */
280
+ const controllerMac = controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.MacAddress);
281
+ if (controllerMac.value && controllerMac.source) {
282
+ if (!macAddress.value) {
283
+ macAddress = controllerMac;
284
+ }
285
+ else if (((_a = macAddress.source) === null || _a === void 0 ? void 0 : _a.kind) === AssetFactSource_1.AssetFactSourceKind.Saved &&
286
+ !macAddress.discoveredDifferent &&
287
+ ((0, EndpointAttachmentUtil_1.normalizeMac)(macAddress.value) || macAddress.value) !==
288
+ controllerMac.value) {
289
+ macAddress = Object.assign(Object.assign({}, macAddress), { discoveredDifferent: {
290
+ value: controllerMac.value,
291
+ source: controllerMac.source,
292
+ } });
293
+ }
294
+ }
295
+ const controllerMaker = controller
296
+ ? {
297
+ value: (0, NetworkControllerProvider_1.getNetworkControllerProviderTitle)(controller.provider),
298
+ source: (0, AssetFactSource_1.sourceOfControllerReading)(controller),
299
+ }
300
+ : {};
223
301
  return {
224
302
  sysName: polled(device.sysName, NetworkDeviceDiscoveredDetails_1.NetworkDeviceDiscoveredField.SystemName),
225
303
  sysDescr: polled(device.sysDescr, NetworkDeviceDiscoveredDetails_1.NetworkDeviceDiscoveredField.SystemDescription),
226
304
  sysObjectId: polled(device.sysObjectId, NetworkDeviceDiscoveredDetails_1.NetworkDeviceDiscoveredField.SystemObjectId),
227
305
  sysLocation: polled(device.sysLocation, NetworkDeviceDiscoveredDetails_1.NetworkDeviceDiscoveredField.SystemLocation),
228
306
  sysContact: polled(device.sysContact, NetworkDeviceDiscoveredDetails_1.NetworkDeviceDiscoveredField.SystemContact),
229
- vendor: polled(device.vendor),
230
- deviceModel: polled(device.deviceModel),
231
- serialNumber: polled(device.serialNumber),
232
- firmwareVersion: polled(device.firmwareVersion),
307
+ vendor: withControllerReading(polled(device.vendor), controllerMaker),
308
+ deviceModel: withControllerReading(polled(device.deviceModel), controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.Model)),
309
+ serialNumber: withControllerReading(polled(device.serialNumber), controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.SerialNumber)),
310
+ firmwareVersion: withControllerReading(polled(device.firmwareVersion), controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.FirmwareVersion)),
233
311
  softwareVersion: polled(device.softwareVersion),
234
312
  dnsName: dnsName,
235
313
  macAddress: macAddress,
236
314
  netbiosName: readDiscoveredOnly(details.values[NetworkDeviceDiscoveredDetails_1.NetworkDeviceDiscoveredField.NetbiosName]),
237
315
  resolvedIpAddress: readDiscoveredOnly(details.values[NetworkDeviceDiscoveredDetails_1.NetworkDeviceDiscoveredField.IpAddress]),
316
+ controllerName: controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.Name),
317
+ controllerIpAddress: controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.IpAddress),
318
+ controllerMacAddress: controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.MacAddress),
319
+ controllerAddress: controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.Address),
320
+ controllerProductType: controllerInput(controller, NetworkDeviceDiscoveredDetails_1.NetworkDeviceControllerField.ProductType),
238
321
  details: details,
239
322
  };
240
323
  }
@@ -315,7 +398,12 @@ function getHostnameFact(device, inputs, dnsName) {
315
398
  dnsName: dnsNameForHostname.value,
316
399
  });
317
400
  if (!(choice === null || choice === void 0 ? void 0 : choice.name)) {
318
- return {};
401
+ /*
402
+ * Nothing the device says names it: the name its controller files it
403
+ * under (the Meraki dashboard's), when it has one. Still never its
404
+ * address.
405
+ */
406
+ return fact(inputs.controllerName.value, inputs.controllerName);
319
407
  }
320
408
  const from = choice.source === DeviceNameSource_1.DeviceNameSource.SystemName
321
409
  ? systemName
@@ -338,7 +426,11 @@ function getIpAddressFact(device, inputs) {
338
426
  * A device polled at a DNS name: the address its probe resolved the name
339
427
  * to - only ever recorded for that very name, so it is the device's.
340
428
  */
341
- return fact(inputs.resolvedIpAddress.value, inputs.resolvedIpAddress);
429
+ if (inputs.resolvedIpAddress.value) {
430
+ return fact(inputs.resolvedIpAddress.value, inputs.resolvedIpAddress);
431
+ }
432
+ // Else the management address its controller lists for it.
433
+ return fact(inputs.controllerIpAddress.value, inputs.controllerIpAddress);
342
434
  }
343
435
  function isSnmpAgentVendor(vendor) {
344
436
  return SNMP_AGENT_VENDORS.has(vendor.trim().toLowerCase());
@@ -394,7 +486,7 @@ function getDeviceTypeFact(device, inputs, options) {
394
486
  if (assignedName) {
395
487
  return fact(assignedName, { kind: AssetFactSource_1.AssetFactSourceKind.AssignedRole });
396
488
  }
397
- const classified = (0, NetworkDeviceRoleUtil_1.classifyDeviceRole)({
489
+ let classified = (0, NetworkDeviceRoleUtil_1.classifyDeviceRole)({
398
490
  sysDescr: inputs.sysDescr.value,
399
491
  sysObjectId: inputs.sysObjectId.value,
400
492
  vendor: inputs.vendor.value,
@@ -402,31 +494,59 @@ function getDeviceTypeFact(device, inputs, options) {
402
494
  name: readText(device.name),
403
495
  sysName: inputs.sysName.value || readText(device.hostname),
404
496
  });
497
+ let classifiedBy = { kind: AssetFactSource_1.AssetFactSourceKind.Classified };
498
+ /*
499
+ * Nothing it reports or is called says what it is: what its controller
500
+ * files it as (a Meraki "switch", "wireless"...), when it says.
501
+ */
502
+ const controllerRole = classified === "unknown"
503
+ ? getRoleOfControllerProductType(inputs.controllerProductType.value)
504
+ : undefined;
505
+ if (controllerRole && inputs.controllerProductType.source) {
506
+ classified = controllerRole;
507
+ classifiedBy = inputs.controllerProductType.source;
508
+ }
405
509
  const assignedKey = readText((_b = device.networkDeviceRole) === null || _b === void 0 ? void 0 : _b.key);
406
510
  const roleKey = (0, NetworkDeviceRoleCatalog_1.roleKeyForNode)(assignedKey, classified);
407
511
  const projectLabel = (0, NetworkDeviceRoleCatalog_1.stampForRoleKey)(roleKey, (0, NetworkDeviceRoleCatalog_1.buildDeviceRoleIndex)((options === null || options === void 0 ? void 0 : options.roles) || [])).roleLabel;
408
512
  if (projectLabel) {
409
- return fact(projectLabel, {
410
- kind: assignedKey
411
- ? AssetFactSource_1.AssetFactSourceKind.AssignedRole
412
- : AssetFactSource_1.AssetFactSourceKind.Classified,
413
- });
513
+ return fact(projectLabel, assignedKey ? { kind: AssetFactSource_1.AssetFactSourceKind.AssignedRole } : classifiedBy);
414
514
  }
415
515
  if (classified === "unknown") {
416
516
  return {};
417
517
  }
418
- return fact((0, NetworkDeviceRoleUtil_1.labelForDeviceRole)(classified), {
419
- kind: AssetFactSource_1.AssetFactSourceKind.Classified,
420
- });
518
+ return fact((0, NetworkDeviceRoleUtil_1.labelForDeviceRole)(classified), classifiedBy);
421
519
  }
422
520
  /*
423
- * Where the device says it is (sysLocation), or nothing for a blank or an
424
- * agent's default.
521
+ * The role a controller's product type stands for, or undefined for one that
522
+ * names no network role (a sensor, a Systems Manager endpoint). A Meraki MX
523
+ * or Z - an "appliance" - is a security appliance, as the classifier draws an
524
+ * MX; a cellular or campus gateway routes.
525
+ */
526
+ const ROLE_BY_CONTROLLER_PRODUCT_TYPE = {
527
+ appliance: "firewall",
528
+ switch: "switch",
529
+ wireless: "wirelessAccessPoint",
530
+ wirelessController: "wirelessAccessPoint",
531
+ camera: "camera",
532
+ cellularGateway: "router",
533
+ campusGateway: "router",
534
+ };
535
+ function getRoleOfControllerProductType(productType) {
536
+ if (!productType ||
537
+ !Object.prototype.hasOwnProperty.call(ROLE_BY_CONTROLLER_PRODUCT_TYPE, productType)) {
538
+ return undefined;
539
+ }
540
+ return ROLE_BY_CONTROLLER_PRODUCT_TYPE[productType];
541
+ }
542
+ /*
543
+ * Where the device says it is (sysLocation) - else the street address its
544
+ * controller files it under - or nothing for a blank or an agent's default.
425
545
  */
426
546
  function getSystemLocation(inputs) {
427
547
  const location = inputs.sysLocation.value;
428
548
  if (!location || PLACEHOLDER_LOCATIONS.has(location.toLowerCase())) {
429
- return {};
549
+ return fact(inputs.controllerAddress.value, inputs.controllerAddress);
430
550
  }
431
551
  return fact(location, inputs.sysLocation);
432
552
  }
@@ -482,6 +602,7 @@ function getNetworkDeviceFactDetails(device, options) {
482
602
  },
483
603
  foundBy: inputs.details.foundBy,
484
604
  otherMachine: inputs.details.otherMachine,
605
+ controller: inputs.details.controller,
485
606
  };
486
607
  }
487
608
  /**