@oneuptime/common 12.0.9 → 12.0.11

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 (262) hide show
  1. package/Models/DatabaseModels/NetworkDevice.ts +44 -0
  2. package/Models/DatabaseModels/NetworkDeviceLink.ts +116 -0
  3. package/Models/DatabaseModels/RunnerJob.ts +17 -2
  4. package/Server/API/LlmProviderAPI.ts +8 -0
  5. package/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.ts +52 -0
  6. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
  7. package/Server/Services/NetworkDeviceLabelRuleEngineService.ts +240 -0
  8. package/Server/Services/NetworkDeviceLinkService.ts +338 -2
  9. package/Server/Services/NetworkDeviceService.ts +265 -12
  10. package/Server/Services/RunnerJobService.ts +24 -1
  11. package/Server/Types/Billing/MeteredPlan/AllMeteredPlans.ts +19 -5
  12. package/Server/Types/Database/JSONColumnQuery.ts +42 -4
  13. package/Server/Utils/LLM/LLMService.ts +108 -19
  14. package/Server/Utils/Monitor/MonitorAlert.ts +22 -115
  15. package/Server/Utils/Monitor/MonitorIncident.ts +7 -337
  16. package/Server/Utils/Monitor/MonitorMaintenanceSuppression.ts +27 -2
  17. package/Server/Utils/Monitor/SeriesResourceLabels.ts +32 -0
  18. package/Server/Utils/Monitor/SeriesResourceLinker.ts +469 -0
  19. package/Server/Utils/SSRFProtection.ts +5 -4
  20. package/Server/Utils/Telemetry/InventoryEntityRegistry.ts +186 -38
  21. package/Tests/App/AdminDashboard/AdminUsersBulkAddToProject.test.tsx +955 -0
  22. package/Tests/App/AdminDashboard/BulkAddUsersToProject.test.ts +778 -0
  23. package/Tests/App/AdminDashboard/BulkAddUsersToProjectModal.test.tsx +1051 -0
  24. package/Tests/App/Dashboard/AdminNotificationRulesPage.test.tsx +420 -112
  25. package/Tests/App/Dashboard/OnCallReadinessSurfaces.test.tsx +81 -6
  26. package/Tests/App/Dashboard/PayAsYouGoConsentGate.test.tsx +543 -0
  27. package/Tests/App/Dashboard/PayAsYouGoFreePlan.test.ts +125 -0
  28. package/Tests/App/Dashboard/PayAsYouGoNotices.test.tsx +612 -0
  29. package/Tests/App/Dashboard/SloWidgetChartRendering.test.tsx +536 -0
  30. package/Tests/App/Dashboard/UserElementEmail.test.tsx +447 -0
  31. package/Tests/App/Dashboard/UserEmailCallSites.test.tsx +284 -0
  32. package/Tests/Models/AnalyticsModels/CommonModel.test.ts +312 -0
  33. package/Tests/Server/Infrastructure/Postgres/DeviceRoleAndDeclaredLinkParentMigration.test.ts +250 -0
  34. package/Tests/Server/Infrastructure/Postgres/EpisodeMemberNotifyIndexesMigration.test.ts +46 -18
  35. package/Tests/Server/Services/NetworkDeviceLabelRuleRun.test.ts +618 -0
  36. package/Tests/Server/Services/NetworkDeviceLinkParentValidation.test.ts +1043 -0
  37. package/Tests/Server/Services/NetworkSiteAssignmentRuleRun.test.ts +706 -0
  38. package/Tests/Server/Services/RunnerJobEnqueue.test.ts +412 -0
  39. package/Tests/Server/Types/Billing/PayAsYouGoMeteredPricing.test.ts +125 -0
  40. package/Tests/Server/Types/Database/JSONColumnQuery.test.ts +508 -0
  41. package/Tests/Server/Utils/AI/LLMServiceRequestPolicy.test.ts +2 -2
  42. package/Tests/Server/Utils/AI/LLMServiceRetryPolicy.test.ts +450 -0
  43. package/Tests/Server/Utils/Monitor/MonitorAlertResourceLinking.test.ts +556 -0
  44. package/Tests/Server/Utils/Monitor/MonitorIncidentResourceLinking.test.ts +547 -0
  45. package/Tests/Server/Utils/Monitor/MonitorMaintenanceSuppression.test.ts +30 -0
  46. package/Tests/Server/Utils/Monitor/SeriesResourceLinker.test.ts +699 -0
  47. package/Tests/Server/Utils/SeriesResourceLabels.test.ts +55 -0
  48. package/Tests/Server/Utils/Telemetry/InventoryEntityRegistry.test.ts +668 -0
  49. package/Tests/Types/API/URLMalformedTolerance.test.ts +301 -0
  50. package/Tests/Types/API/URLTelScheme.test.ts +261 -0
  51. package/Tests/Types/API/URLUnsupportedScheme.test.ts +148 -0
  52. package/Tests/Types/Billing/PayAsYouGoPricing.test.ts +64 -0
  53. package/Tests/Types/CustomField/CustomFieldTypeCorrespondence.test.ts +107 -0
  54. package/Tests/Types/Monitor/MonitorType.test.ts +62 -0
  55. package/Tests/Types/NetworkAutomation/RuleRunResult.test.ts +184 -0
  56. package/Tests/Types/Runbook/RunbookStepType.test.ts +124 -0
  57. package/Tests/Types/Workflow/BaseModelComponents.test.ts +17 -0
  58. package/Tests/UI/Components/Button.test.tsx +279 -0
  59. package/Tests/UI/Components/Charts/ChartXAxisDataKey.test.tsx +256 -0
  60. package/Tests/UI/Components/Charts/DataPointUtil.test.ts +323 -0
  61. package/Tests/UI/Components/DictionaryValuePlaceholderAndSuggestions.test.tsx +595 -0
  62. package/Tests/UI/Components/Icon.test.tsx +57 -0
  63. package/Tests/UI/Components/List.test.tsx +20 -3
  64. package/Tests/UI/Components/LogsSavedViewsDropdown.test.tsx +304 -0
  65. package/Tests/UI/Components/LogsViewerClearSavedView.test.tsx +179 -0
  66. package/Tests/UI/Components/ModelTable/CustomFieldColumns.test.tsx +349 -1
  67. package/Tests/UI/Components/Pagination.test.tsx +721 -146
  68. package/Tests/UI/Components/PaginationIntegration.test.tsx +386 -0
  69. package/Tests/UI/Components/PaginationUtil.test.ts +417 -0
  70. package/Tests/UI/Components/TelemetrySavedViewsDropdown.test.tsx +343 -0
  71. package/Tests/UI/Components/Workflow/ColumnEditor/ColumnControl.test.ts +289 -0
  72. package/Tests/UI/Components/Workflow/ColumnEditor/ColumnOperators.test.ts +271 -0
  73. package/Tests/UI/Components/Workflow/ColumnEditor/ColumnRow.test.ts +119 -0
  74. package/Tests/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.test.ts +968 -0
  75. package/Tests/UI/Components/Workflow/ModelColumnEditor.render.test.tsx +766 -0
  76. package/Tests/UI/Utils/RunNetworkRule.test.ts +320 -0
  77. package/Tests/Utils/APIRetryPolicy.test.ts +823 -0
  78. package/Tests/Utils/Monitor/NetworkDeviceRoleUtil.test.ts +502 -0
  79. package/Tests/Utils/Monitor/NetworkTopologyDeclaredHierarchy.test.ts +759 -0
  80. package/Tests/Utils/NetworkAutomation/RuleRunSummary.test.ts +286 -0
  81. package/Tests/Utils/Schema/BaseSchema.test.ts +651 -0
  82. package/Types/API/Protocol.ts +9 -0
  83. package/Types/API/URL.ts +286 -20
  84. package/Types/Billing/PayAsYouGoPricing.ts +47 -0
  85. package/Types/CustomField/CustomFieldType.ts +28 -0
  86. package/Types/Monitor/MonitorType.ts +11 -0
  87. package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +13 -0
  88. package/Types/NetworkAutomation/RuleRunResult.ts +121 -0
  89. package/Types/Runbook/RunbookStepType.ts +23 -0
  90. package/UI/Components/AutocompleteTextInput/AutocompleteTextInput.tsx +7 -0
  91. package/UI/Components/Button/Button.tsx +14 -22
  92. package/UI/Components/Charts/Area/AreaChart.tsx +4 -2
  93. package/UI/Components/Charts/Bar/BarChart.tsx +4 -2
  94. package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +13 -0
  95. package/UI/Components/Charts/Line/LineChart.tsx +4 -2
  96. package/UI/Components/Charts/Types/XAxis/XAxis.ts +6 -0
  97. package/UI/Components/Charts/Utils/DataPoint.ts +15 -12
  98. package/UI/Components/Dictionary/Dictionary.tsx +4 -39
  99. package/UI/Components/Icon/Icon.tsx +1 -1
  100. package/UI/Components/LogsViewer/LogsViewer.tsx +5 -1
  101. package/UI/Components/LogsViewer/components/LogsFacetSidebar.tsx +8 -0
  102. package/UI/Components/LogsViewer/components/LogsPagination.tsx +29 -91
  103. package/UI/Components/LogsViewer/components/LogsViewerToolbar.tsx +2 -0
  104. package/UI/Components/LogsViewer/components/SavedViewsDropdown.tsx +66 -1
  105. package/UI/Components/ModelTable/CustomFieldColumns.tsx +55 -0
  106. package/UI/Components/Pagination/Pagination.tsx +373 -328
  107. package/UI/Components/Pagination/PaginationUtil.ts +263 -0
  108. package/UI/Components/Pagination/Screenshots/README.md +15 -0
  109. package/UI/Components/Pagination/Screenshots/pagination-before-after.png +0 -0
  110. package/UI/Components/Pagination/Screenshots/pagination-go-to-page-modal.png +0 -0
  111. package/UI/Components/Pagination/Screenshots/pagination-long-list.png +0 -0
  112. package/UI/Components/Pagination/Screenshots/pagination-mobile.png +0 -0
  113. package/UI/Components/Pagination/Screenshots/pagination-telemetry.png +0 -0
  114. package/UI/Components/TelemetryViewer/components/SavedViewsDropdown.tsx +66 -1
  115. package/UI/Components/TelemetryViewer/components/TelemetryPagination.tsx +38 -92
  116. package/UI/Components/TextArea/TextArea.tsx +3 -0
  117. package/UI/Components/Workflow/ArgumentsForm.tsx +18 -1
  118. package/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.tsx +177 -0
  119. package/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.tsx +243 -0
  120. package/UI/Components/Workflow/ColumnEditor/ColumnControl.ts +255 -0
  121. package/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.tsx +178 -0
  122. package/UI/Components/Workflow/ColumnEditor/ColumnOperators.ts +206 -0
  123. package/UI/Components/Workflow/ColumnEditor/ColumnRow.ts +157 -0
  124. package/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.ts +517 -0
  125. package/UI/Components/Workflow/ColumnEditor/ColumnValueInput.tsx +482 -0
  126. package/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.tsx +131 -0
  127. package/UI/Components/Workflow/ColumnEditor/ModelRecordForm.tsx +163 -0
  128. package/UI/Components/Workflow/ModelColumnEditor.tsx +284 -100
  129. package/UI/Utils/NetworkAutomation/RunNetworkRule.ts +122 -0
  130. package/Utils/API.ts +243 -36
  131. package/Utils/Monitor/NetworkDeviceRoleUtil.ts +45 -0
  132. package/Utils/Monitor/NetworkTopologyUtil.ts +42 -2
  133. package/Utils/NetworkAutomation/RuleRunSummary.ts +147 -0
  134. package/build/dist/Models/DatabaseModels/NetworkDevice.js +45 -0
  135. package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
  136. package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js +115 -0
  137. package/build/dist/Models/DatabaseModels/NetworkDeviceLink.js.map +1 -1
  138. package/build/dist/Models/DatabaseModels/RunnerJob.js +17 -2
  139. package/build/dist/Models/DatabaseModels/RunnerJob.js.map +1 -1
  140. package/build/dist/Server/API/LlmProviderAPI.js +9 -1
  141. package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
  142. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.js +33 -0
  143. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1787400000000-AddDeviceRoleAndDeclaredLinkParent.js.map +1 -0
  144. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
  145. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  146. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js +202 -0
  147. package/build/dist/Server/Services/NetworkDeviceLabelRuleEngineService.js.map +1 -1
  148. package/build/dist/Server/Services/NetworkDeviceLinkService.js +253 -1
  149. package/build/dist/Server/Services/NetworkDeviceLinkService.js.map +1 -1
  150. package/build/dist/Server/Services/NetworkDeviceService.js +223 -12
  151. package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
  152. package/build/dist/Server/Services/RunnerJobService.js +20 -2
  153. package/build/dist/Server/Services/RunnerJobService.js.map +1 -1
  154. package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js +12 -5
  155. package/build/dist/Server/Types/Billing/MeteredPlan/AllMeteredPlans.js.map +1 -1
  156. package/build/dist/Server/Types/Database/JSONColumnQuery.js +40 -4
  157. package/build/dist/Server/Types/Database/JSONColumnQuery.js.map +1 -1
  158. package/build/dist/Server/Utils/LLM/LLMService.js +78 -22
  159. package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
  160. package/build/dist/Server/Utils/Monitor/MonitorAlert.js +22 -98
  161. package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
  162. package/build/dist/Server/Utils/Monitor/MonitorIncident.js +7 -254
  163. package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
  164. package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js +14 -2
  165. package/build/dist/Server/Utils/Monitor/MonitorMaintenanceSuppression.js.map +1 -1
  166. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js +27 -0
  167. package/build/dist/Server/Utils/Monitor/SeriesResourceLabels.js.map +1 -1
  168. package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js +285 -0
  169. package/build/dist/Server/Utils/Monitor/SeriesResourceLinker.js.map +1 -0
  170. package/build/dist/Server/Utils/SSRFProtection.js +5 -4
  171. package/build/dist/Server/Utils/SSRFProtection.js.map +1 -1
  172. package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js +128 -35
  173. package/build/dist/Server/Utils/Telemetry/InventoryEntityRegistry.js.map +1 -1
  174. package/build/dist/Types/API/Protocol.js +9 -0
  175. package/build/dist/Types/API/Protocol.js.map +1 -1
  176. package/build/dist/Types/API/URL.js +241 -18
  177. package/build/dist/Types/API/URL.js.map +1 -1
  178. package/build/dist/Types/Billing/PayAsYouGoPricing.js +41 -0
  179. package/build/dist/Types/Billing/PayAsYouGoPricing.js.map +1 -0
  180. package/build/dist/Types/CustomField/CustomFieldType.js +26 -0
  181. package/build/dist/Types/CustomField/CustomFieldType.js.map +1 -1
  182. package/build/dist/Types/Monitor/MonitorType.js +10 -0
  183. package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
  184. package/build/dist/Types/NetworkAutomation/RuleRunResult.js +39 -0
  185. package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -0
  186. package/build/dist/Types/Runbook/RunbookStepType.js +21 -0
  187. package/build/dist/Types/Runbook/RunbookStepType.js.map +1 -1
  188. package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js +1 -1
  189. package/build/dist/UI/Components/AutocompleteTextInput/AutocompleteTextInput.js.map +1 -1
  190. package/build/dist/UI/Components/Button/Button.js +10 -16
  191. package/build/dist/UI/Components/Button/Button.js.map +1 -1
  192. package/build/dist/UI/Components/Charts/Area/AreaChart.js +2 -1
  193. package/build/dist/UI/Components/Charts/Area/AreaChart.js.map +1 -1
  194. package/build/dist/UI/Components/Charts/Bar/BarChart.js +2 -1
  195. package/build/dist/UI/Components/Charts/Bar/BarChart.js.map +1 -1
  196. package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +12 -0
  197. package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -1
  198. package/build/dist/UI/Components/Charts/Line/LineChart.js +2 -1
  199. package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
  200. package/build/dist/UI/Components/Charts/Utils/DataPoint.js +17 -10
  201. package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -1
  202. package/build/dist/UI/Components/Dictionary/Dictionary.js +4 -18
  203. package/build/dist/UI/Components/Dictionary/Dictionary.js.map +1 -1
  204. package/build/dist/UI/Components/Icon/Icon.js +1 -1
  205. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  206. package/build/dist/UI/Components/LogsViewer/LogsViewer.js +3 -3
  207. package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
  208. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js +5 -1
  209. package/build/dist/UI/Components/LogsViewer/components/LogsFacetSidebar.js.map +1 -1
  210. package/build/dist/UI/Components/LogsViewer/components/LogsPagination.js +14 -44
  211. package/build/dist/UI/Components/LogsViewer/components/LogsPagination.js.map +1 -1
  212. package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js +1 -1
  213. package/build/dist/UI/Components/LogsViewer/components/LogsViewerToolbar.js.map +1 -1
  214. package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js +20 -2
  215. package/build/dist/UI/Components/LogsViewer/components/SavedViewsDropdown.js.map +1 -1
  216. package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js +42 -0
  217. package/build/dist/UI/Components/ModelTable/CustomFieldColumns.js.map +1 -1
  218. package/build/dist/UI/Components/Pagination/Pagination.js +174 -199
  219. package/build/dist/UI/Components/Pagination/Pagination.js.map +1 -1
  220. package/build/dist/UI/Components/Pagination/PaginationUtil.js +160 -0
  221. package/build/dist/UI/Components/Pagination/PaginationUtil.js.map +1 -0
  222. package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js +20 -2
  223. package/build/dist/UI/Components/TelemetryViewer/components/SavedViewsDropdown.js.map +1 -1
  224. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryPagination.js +23 -47
  225. package/build/dist/UI/Components/TelemetryViewer/components/TelemetryPagination.js.map +1 -1
  226. package/build/dist/UI/Components/TextArea/TextArea.js +1 -1
  227. package/build/dist/UI/Components/TextArea/TextArea.js.map +1 -1
  228. package/build/dist/UI/Components/Workflow/ArgumentsForm.js +14 -2
  229. package/build/dist/UI/Components/Workflow/ArgumentsForm.js.map +1 -1
  230. package/build/dist/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.js +86 -0
  231. package/build/dist/UI/Components/Workflow/ColumnEditor/AddColumnDropdown.js.map +1 -0
  232. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.js +119 -0
  233. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnConditionRow.js.map +1 -0
  234. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnControl.js +206 -0
  235. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnControl.js.map +1 -0
  236. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.js +57 -0
  237. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnFieldRow.js.map +1 -0
  238. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnOperators.js +150 -0
  239. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnOperators.js.map +1 -0
  240. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRow.js +67 -0
  241. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRow.js.map +1 -0
  242. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.js +309 -0
  243. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnRowSerialization.js.map +1 -0
  244. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnValueInput.js +204 -0
  245. package/build/dist/UI/Components/Workflow/ColumnEditor/ColumnValueInput.js.map +1 -0
  246. package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js +66 -0
  247. package/build/dist/UI/Components/Workflow/ColumnEditor/ModelQueryBuilder.js.map +1 -0
  248. package/build/dist/UI/Components/Workflow/ColumnEditor/ModelRecordForm.js +83 -0
  249. package/build/dist/UI/Components/Workflow/ColumnEditor/ModelRecordForm.js.map +1 -0
  250. package/build/dist/UI/Components/Workflow/ModelColumnEditor.js +187 -68
  251. package/build/dist/UI/Components/Workflow/ModelColumnEditor.js.map +1 -1
  252. package/build/dist/UI/Utils/NetworkAutomation/RunNetworkRule.js +75 -0
  253. package/build/dist/UI/Utils/NetworkAutomation/RunNetworkRule.js.map +1 -0
  254. package/build/dist/Utils/API.js +175 -34
  255. package/build/dist/Utils/API.js.map +1 -1
  256. package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js +37 -0
  257. package/build/dist/Utils/Monitor/NetworkDeviceRoleUtil.js.map +1 -1
  258. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +25 -3
  259. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
  260. package/build/dist/Utils/NetworkAutomation/RuleRunSummary.js +78 -0
  261. package/build/dist/Utils/NetworkAutomation/RuleRunSummary.js.map +1 -0
  262. package/package.json +1 -1
@@ -12,16 +12,92 @@ import Model from "../../Models/DatabaseModels/NetworkDeviceLink";
12
12
  import NetworkDeviceService from "./NetworkDeviceService";
13
13
  import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
14
14
  import BadDataException from "../../Types/Exception/BadDataException";
15
+ import ObjectID from "../../Types/ObjectID";
15
16
  import QueryHelper from "../Types/Database/QueryHelper";
16
17
  import RelationIdUtil from "../Utils/Database/RelationIdUtil";
17
18
  import LIMIT_MAX from "../../Types/Database/LimitMax";
18
19
  // Both spellings of each end, for the same reason RelationIdUtil exists.
19
20
  const FROM_DEVICE_KEYS = ["fromDeviceId", "fromDevice"];
20
21
  const TO_DEVICE_KEYS = ["toDeviceId", "toDevice"];
22
+ const PARENT_DEVICE_KEYS = ["parentDeviceId", "parentDevice"];
23
+ /*
24
+ * A device id, compared the way Postgres compares it.
25
+ *
26
+ * These columns are `uuid`. Postgres normalises and matches them without
27
+ * regard to case, and ObjectID.isValidUUID accepts either case, so an API
28
+ * client may legitimately send `AAAAAAAA-...` for a row stored as
29
+ * `aaaaaaaa-...`. A raw JS !== between the two says "different device" and
30
+ * refuses a parent that is in fact an end of the link. Note that the
31
+ * device-existence check below cannot disagree: it runs in Postgres.
32
+ */
33
+ const sameDeviceId = (a, b) => {
34
+ return a.toString().toLowerCase() === b.toString().toLowerCase();
35
+ };
36
+ /*
37
+ * A declared parent has to be one of the two devices the link connects.
38
+ * Anything else is not a statement about this link at all, and the map
39
+ * would silently ignore it — the operator would have declared a hierarchy
40
+ * and watched nothing change.
41
+ */
42
+ const assertParentIsAnEnd = (parentDeviceId, fromDeviceId, toDeviceId) => {
43
+ if (!parentDeviceId) {
44
+ return;
45
+ }
46
+ if (!sameDeviceId(parentDeviceId, fromDeviceId) &&
47
+ !sameDeviceId(parentDeviceId, toDeviceId)) {
48
+ throw new BadDataException("The parent device must be one of the two devices this link connects.");
49
+ }
50
+ };
51
+ /*
52
+ * Which of `keys` the payload actually WRITES.
53
+ *
54
+ * Not the same question as which keys are present. TypeORM drops
55
+ * undefined-valued keys before it builds the SET list — "it doesn't make
56
+ * sense to update undefined properties" — so a key holding undefined
57
+ * changes nothing in the database. Treating it as a write makes this hook
58
+ * validate a row that is never going to exist: model the parent as
59
+ * cleared, accept the write, and leave the stored parent stranded on a
60
+ * link whose end just moved. Null and "" are different and really do
61
+ * clear the column, which is why the test is against undefined alone.
62
+ */
63
+ const writtenKeys = (data, keys) => {
64
+ return keys.filter((key) => {
65
+ return key in data && data[key] !== undefined;
66
+ });
67
+ };
68
+ /*
69
+ * An update payload is a QueryDeepPartialEntity, so a column may hold a
70
+ * raw SQL-expression function instead of a value. RelationIdUtil reads one
71
+ * as null — indistinguishable from "cleared" — and the whole invariant is
72
+ * then checked against a row that bears no relation to what will be
73
+ * written. Nothing in the tree writes this model that way today; refusing
74
+ * is what keeps that true, and a caller who needs it can resolve the id
75
+ * before calling rather than have it silently mis-validated.
76
+ */
77
+ const assertNoSqlExpression = (data, keys) => {
78
+ for (const key of keys) {
79
+ if (typeof data[key] === "function") {
80
+ throw new BadDataException(`${key} cannot be set to a raw SQL expression on a network device link — the link's ends and its declared parent have to be checked against each other, which needs actual ids.`);
81
+ }
82
+ }
83
+ };
21
84
  export class Service extends DatabaseService {
22
85
  constructor() {
23
86
  super(Model);
24
87
  }
88
+ /*
89
+ * onBeforeUpdate runs before DatabaseService permission-checks the query,
90
+ * so reading the raw client query as root would hand the hook rows from
91
+ * other projects. Re-apply the caller's tenant here. (Same helper as
92
+ * NetworkDeviceService and NetworkSiteService — private per service,
93
+ * which is the shape the codebase already settled on.)
94
+ */
95
+ scopeQueryToCallerTenant(query, props) {
96
+ if (props.isRoot || !props.tenantId) {
97
+ return query;
98
+ }
99
+ return Object.assign(Object.assign({}, query), { projectId: props.tenantId });
100
+ }
25
101
  /*
26
102
  * Two guards, both about links that would be nonsense on the map:
27
103
  *
@@ -34,12 +110,17 @@ export class Service extends DatabaseService {
34
110
  */
35
111
  async onBeforeCreate(createBy) {
36
112
  const data = createBy.data;
113
+ assertNoSqlExpression(data, [
114
+ ...FROM_DEVICE_KEYS,
115
+ ...TO_DEVICE_KEYS,
116
+ ...PARENT_DEVICE_KEYS,
117
+ ]);
37
118
  const fromDeviceId = RelationIdUtil.read(data, FROM_DEVICE_KEYS);
38
119
  const toDeviceId = RelationIdUtil.read(data, TO_DEVICE_KEYS);
39
120
  if (!fromDeviceId || !toDeviceId) {
40
121
  throw new BadDataException("A link needs a device at each end.");
41
122
  }
42
- if (fromDeviceId.toString() === toDeviceId.toString()) {
123
+ if (sameDeviceId(fromDeviceId, toDeviceId)) {
43
124
  throw new BadDataException("A device cannot be linked to itself.");
44
125
  }
45
126
  if (!createBy.data.projectId) {
@@ -58,8 +139,173 @@ export class Service extends DatabaseService {
58
139
  if (devices.length !== 2) {
59
140
  throw new BadDataException("Both devices must exist and belong to this project.");
60
141
  }
142
+ assertParentIsAnEnd(RelationIdUtil.read(data, PARENT_DEVICE_KEYS), fromDeviceId, toDeviceId);
61
143
  return { createBy, carryForward: null };
62
144
  }
145
+ /*
146
+ * The same invariant, on the other write path.
147
+ *
148
+ * An update can break it two ways, and only one of them is obvious. The
149
+ * obvious one is setting a parent that is not on the link. The other is
150
+ * moving an END: re-point `toDevice` at a different switch and a parent
151
+ * that was valid a moment ago now names a device the link no longer
152
+ * touches. So the post-update state is what gets checked, assembled from
153
+ * the payload where it says something and from the stored row where it
154
+ * does not.
155
+ *
156
+ * An update matches a QUERY, not one row, and each matched row may have
157
+ * different ends — so every one of them is validated, and one bad row
158
+ * rejects the whole write. That is the conservative direction: a partial
159
+ * update that fixed some rows and left others contradicting themselves
160
+ * would be far harder to notice than a refusal.
161
+ *
162
+ * It also re-runs onBeforeCreate's TENANCY check on any end that moves.
163
+ * That check used to exist only on create, which left the update path
164
+ * able to re-point an end at another project's device — the exact threat
165
+ * onBeforeCreate's own comment describes, since the FK is global and the
166
+ * column is member-writable.
167
+ *
168
+ * Only costs a read when the payload touches an end or the parent at all;
169
+ * an update of ports or the bound monitor takes the early return.
170
+ */
171
+ async onBeforeUpdate(updateBy) {
172
+ const data = (updateBy.data ||
173
+ {});
174
+ const hierarchyKeys = [
175
+ ...FROM_DEVICE_KEYS,
176
+ ...TO_DEVICE_KEYS,
177
+ ...PARENT_DEVICE_KEYS,
178
+ ];
179
+ if (writtenKeys(data, hierarchyKeys).length === 0) {
180
+ return { updateBy, carryForward: null };
181
+ }
182
+ assertNoSqlExpression(data, hierarchyKeys);
183
+ const writtenFromDeviceId = RelationIdUtil.read(data, FROM_DEVICE_KEYS);
184
+ const writtenToDeviceId = RelationIdUtil.read(data, TO_DEVICE_KEYS);
185
+ const writtenParentDeviceId = RelationIdUtil.read(data, PARENT_DEVICE_KEYS);
186
+ /*
187
+ * Writing the parent key with an empty value is how a hierarchy is
188
+ * cleared back to a peer link. RelationIdUtil reads that as null, which
189
+ * is indistinguishable from "not written" — so the presence of the key
190
+ * (with a value that will actually be written; see writtenKeys), not
191
+ * the truthiness of its value, is what decides whether the stored
192
+ * parent still applies.
193
+ */
194
+ const isParentWritten = writtenKeys(data, PARENT_DEVICE_KEYS).length > 0;
195
+ const existingLinks = await this.findBy({
196
+ query: this.scopeQueryToCallerTenant(updateBy.query, updateBy.props),
197
+ select: {
198
+ _id: true,
199
+ projectId: true,
200
+ fromDeviceId: true,
201
+ toDeviceId: true,
202
+ parentDeviceId: true,
203
+ },
204
+ limit: LIMIT_MAX,
205
+ skip: 0,
206
+ props: {
207
+ isRoot: true,
208
+ },
209
+ });
210
+ /*
211
+ * An end that MOVED has to be re-checked for tenancy, exactly as
212
+ * onBeforeCreate checks it. The FK only requires the device row to
213
+ * exist — it is global — so without this a project member could
214
+ * re-point an end of their own link at another project's device and
215
+ * read its name straight off the map, which is the threat
216
+ * onBeforeCreate's own comment describes. The declared parent inherits
217
+ * the check for free: it has to be one of the two ends.
218
+ *
219
+ * Grouped by project because an update may in principle match links in
220
+ * more than one, and a device is only legitimate within its own.
221
+ */
222
+ /*
223
+ * Deduped: writing the same id to both ends is a self-link, and that
224
+ * has its own error below — it must not surface as "device not found".
225
+ */
226
+ const movedEndIds = [
227
+ ...new Set([writtenFromDeviceId, writtenToDeviceId]
228
+ .filter((id) => {
229
+ return Boolean(id);
230
+ })
231
+ .map((id) => {
232
+ return id.toString();
233
+ })),
234
+ ];
235
+ if (movedEndIds.length > 0 && existingLinks.length > 0) {
236
+ /*
237
+ * Every project this write touches: the caller's own tenant, plus
238
+ * the project of each row the query matched (a root caller has no
239
+ * tenant, and only root can match rows across more than one). The
240
+ * new end has to be legitimate in all of them.
241
+ *
242
+ * Guarded on there being matched rows at all: a query that matched
243
+ * nothing writes nothing, and there is no link for a foreign device
244
+ * to end up attached to.
245
+ */
246
+ const projectIds = new Set();
247
+ if (updateBy.props.tenantId) {
248
+ projectIds.add(updateBy.props.tenantId.toString());
249
+ }
250
+ for (const link of existingLinks) {
251
+ if (link.projectId) {
252
+ projectIds.add(link.projectId.toString());
253
+ }
254
+ }
255
+ /*
256
+ * Fail closed. No project to check against and an end on the move
257
+ * is not a safe update to wave through — it is the one shape where
258
+ * a device from anywhere could be attached to this link.
259
+ */
260
+ if (projectIds.size === 0) {
261
+ throw new BadDataException("Both devices must exist and belong to this project.");
262
+ }
263
+ for (const projectId of projectIds) {
264
+ const devices = await NetworkDeviceService.findBy({
265
+ query: {
266
+ _id: QueryHelper.any(movedEndIds),
267
+ projectId: new ObjectID(projectId),
268
+ },
269
+ select: { _id: true },
270
+ limit: LIMIT_MAX,
271
+ skip: 0,
272
+ props: { isRoot: true },
273
+ });
274
+ /*
275
+ * Compared as a SET of ids rather than as a count. A count says
276
+ * "as many rows came back as I asked about", which a duplicate row
277
+ * satisfies just as well as the right rows do — and this is the
278
+ * check standing between one project's map and another project's
279
+ * device names, so it should be answering the actual question.
280
+ */
281
+ const foundIds = new Set(devices.map((device) => {
282
+ return (device.id || device._id || "").toString().toLowerCase();
283
+ }));
284
+ const isMissingAnEnd = movedEndIds.some((id) => {
285
+ return !foundIds.has(id.toLowerCase());
286
+ });
287
+ if (isMissingAnEnd) {
288
+ throw new BadDataException("Both devices must exist and belong to this project.");
289
+ }
290
+ }
291
+ }
292
+ for (const link of existingLinks) {
293
+ const fromDeviceId = writtenFromDeviceId || link.fromDeviceId;
294
+ const toDeviceId = writtenToDeviceId || link.toDeviceId;
295
+ const parentDeviceId = isParentWritten
296
+ ? writtenParentDeviceId
297
+ : link.parentDeviceId || null;
298
+ // A row mid-migration with a missing end has no invariant to check.
299
+ if (!fromDeviceId || !toDeviceId) {
300
+ continue;
301
+ }
302
+ if (sameDeviceId(fromDeviceId, toDeviceId)) {
303
+ throw new BadDataException("A device cannot be linked to itself.");
304
+ }
305
+ assertParentIsAnEnd(parentDeviceId, fromDeviceId, toDeviceId);
306
+ }
307
+ return { updateBy, carryForward: null };
308
+ }
63
309
  }
64
310
  __decorate([
65
311
  CaptureSpan(),
@@ -67,5 +313,11 @@ __decorate([
67
313
  __metadata("design:paramtypes", [Object]),
68
314
  __metadata("design:returntype", Promise)
69
315
  ], Service.prototype, "onBeforeCreate", null);
316
+ __decorate([
317
+ CaptureSpan(),
318
+ __metadata("design:type", Function),
319
+ __metadata("design:paramtypes", [Object]),
320
+ __metadata("design:returntype", Promise)
321
+ ], Service.prototype, "onBeforeUpdate", null);
70
322
  export default new Service();
71
323
  //# sourceMappingURL=NetworkDeviceLinkService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkDeviceLinkService.js","sourceRoot":"","sources":["../../../../Server/Services/NetworkDeviceLinkService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,MAAM,+CAA+C,CAAC;AAClE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAI1D,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AAEtE,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,SAAS,MAAM,+BAA+B,CAAC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AAE,CAAC;YACP,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACxB,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,gBAAgB,CACxB,qDAAqD,CACtD,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;CACF;AAhD0B;IADxB,WAAW,EAAE;;;;6CAgDb;AAGH,eAAe,IAAI,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"NetworkDeviceLinkService.js","sourceRoot":"","sources":["../../../../Server/Services/NetworkDeviceLinkService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,MAAM,+CAA+C,CAAC;AAClE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAK1D,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,gBAAgB,MAAM,wCAAwC,CAAC;AACtE,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,SAAS,MAAM,+BAA+B,CAAC;AAItD,yEAAyE;AACzE,MAAM,gBAAgB,GAAkB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;AACvE,MAAM,cAAc,GAAkB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACjE,MAAM,kBAAkB,GAAkB,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAE7E;;;;;;;;;GASG;AACH,MAAM,YAAY,GAA0C,CAC1D,CAAW,EACX,CAAW,EACF,EAAE;IACX,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,CAAC;AACnE,CAAC,CAAC;AAEF;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AAC,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC;YAEhC,oEAAoE;YACpE,IAAI,CAAC,YAAY,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjC,SAAS;YACX,CAAC;YAED,IAAI,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,EAAE,CAAC;gBAC3C,MAAM,IAAI,gBAAgB,CAAC,sCAAsC,CAAC,CAAC;YACrE,CAAC;YAED,mBAAmB,CAAC,cAAc,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC1C,CAAC;CACF;AA5Q0B;IADxB,WAAW,EAAE;;;;6CA4Db;AA6BwB;IADxB,WAAW,EAAE;;;;6CAoLb;AAGH,eAAe,IAAI,OAAO,EAAE,CAAC"}
@@ -16,7 +16,8 @@ import NetworkSiteService from "./NetworkSiteService";
16
16
  import Model from "../../Models/DatabaseModels/NetworkDevice";
17
17
  import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
18
18
  import logger from "../Utils/Logger";
19
- import LIMIT_MAX from "../../Types/Database/LimitMax";
19
+ import LIMIT_MAX, { LIMIT_PER_PROJECT } from "../../Types/Database/LimitMax";
20
+ import SortOrder from "../../Types/BaseDatabase/SortOrder";
20
21
  import BadDataException from "../../Types/Exception/BadDataException";
21
22
  import ObjectID from "../../Types/ObjectID";
22
23
  import OneUptimeDate from "../../Types/Date";
@@ -69,6 +70,31 @@ const MONITOR_KEYS = ["monitorId", "monitor"];
69
70
  function readMonitorIdFromData(data) {
70
71
  return RelationIdUtil.read(data, MONITOR_KEYS);
71
72
  }
73
+ /*
74
+ * How many devices a single manual "Run now" of an assignment rule walks.
75
+ * The automatic path only ever sees one device at a time, so this cap is the
76
+ * only thing standing between a rule run and a full-fleet table scan inside
77
+ * one HTTP request. Runs that hit it report isTruncated so the caller can say
78
+ * "run it again" rather than quietly leave half the estate unassigned.
79
+ */
80
+ export const MAX_DEVICES_PER_RULE_RUN = LIMIT_PER_PROJECT;
81
+ // Devices are read in pages so a large estate never lands in memory at once.
82
+ const RULE_RUN_PAGE_SIZE = 1000;
83
+ /*
84
+ * The identity a rule is matched against. The hostname column holds an IP
85
+ * address or a DNS name depending on how the device got here, so it is passed
86
+ * as both — ipInCidr rejects non-IP strings safely. Mirrors the single-device
87
+ * path in applySiteAssignmentRulesToDevice; both must stay in step or a
88
+ * manual run would disagree with what discovery does.
89
+ */
90
+ function toRuleMatchTarget(device) {
91
+ return {
92
+ ip: device.hostname,
93
+ hostname: device.hostname,
94
+ sysName: device.sysName,
95
+ name: device.name,
96
+ };
97
+ }
72
98
  export class Service extends DatabaseService {
73
99
  constructor() {
74
100
  super(Model);
@@ -461,18 +487,12 @@ export class Service extends DatabaseService {
461
487
  return;
462
488
  }
463
489
  /*
464
- * The device's hostname column stores an IP address or a DNS name; pass
465
- * it as both ipInCidr safely rejects non-IP strings. `name` is passed
466
- * too because a discovery import puts the responding IP in `hostname`
467
- * and the device's real identity in `name`, so a hostname pattern that
468
- * only ever saw `hostname` could not match anything a user recognises.
490
+ * `name` is matched on as well as `hostname` because a discovery import
491
+ * puts the responding IP in `hostname` and the device's real identity in
492
+ * `name`, so a hostname pattern that only ever saw `hostname` could not
493
+ * match anything a user recognises. See toRuleMatchTarget.
469
494
  */
470
- const winner = CidrMatchUtil.pickRule(rules, {
471
- ip: device.hostname,
472
- hostname: device.hostname,
473
- sysName: device.sysName,
474
- name: device.name,
475
- });
495
+ const winner = CidrMatchUtil.pickRule(rules, toRuleMatchTarget(device));
476
496
  if (!winner || !winner.siteId) {
477
497
  return;
478
498
  }
@@ -490,6 +510,191 @@ export class Service extends DatabaseService {
490
510
  },
491
511
  });
492
512
  }
513
+ /*
514
+ * Runs ONE assignment rule against the devices that already exist, which is
515
+ * the half the automatic path cannot do: rules only ever fire on create, on
516
+ * an identity change, or on the next poll of a device that has no site, so
517
+ * a rule written after the estate was imported would never reach it
518
+ * (OneUptime/oneuptime#3191).
519
+ *
520
+ * Two rules of the automatic path are kept deliberately:
521
+ *
522
+ * - priority still decides. A device this rule matches but a
523
+ * higher-priority rule also matches is REPORTED, not moved: running one
524
+ * rule must never quietly do another rule's work, or the button would
525
+ * produce a placement no rule alone explains.
526
+ * - a device already in a site is left alone unless the caller explicitly
527
+ * asks otherwise. Nothing records whether a site was chosen by a human
528
+ * or by a rule, so overwriting is the caller's decision to make, with
529
+ * the warning that goes with it — and it is not needed for the case the
530
+ * button exists for, since a device imported before the rule existed
531
+ * has no site at all.
532
+ */
533
+ async applySiteAssignmentRuleToExistingDevices(data) {
534
+ var _a, _b, _c;
535
+ /*
536
+ * Every rule in the project, not just the one being run — pickRule needs
537
+ * the whole set to answer "does something outrank this rule here?".
538
+ * Loading them by project is also what scopes the run to the tenant: a
539
+ * rule id from another project simply is not in this list.
540
+ */
541
+ const rules = await NetworkSiteAssignmentRuleService.findBy({
542
+ query: {
543
+ projectId: data.projectId,
544
+ },
545
+ select: {
546
+ _id: true,
547
+ siteId: true,
548
+ subnetCidr: true,
549
+ hostnamePattern: true,
550
+ priority: true,
551
+ createdAt: true,
552
+ },
553
+ limit: LIMIT_MAX,
554
+ skip: 0,
555
+ props: {
556
+ isRoot: true,
557
+ },
558
+ });
559
+ const rule = rules.find((candidate) => {
560
+ var _a;
561
+ return ((_a = candidate._id) === null || _a === void 0 ? void 0 : _a.toString()) === data.ruleId.toString();
562
+ });
563
+ if (!rule) {
564
+ throw new BadDataException("Assignment rule not found.");
565
+ }
566
+ if (!rule.siteId) {
567
+ throw new BadDataException("This assignment rule has no site to assign devices to.");
568
+ }
569
+ const ruleSiteId = rule.siteId;
570
+ const result = {
571
+ devicesEvaluated: 0,
572
+ devicesMatched: 0,
573
+ devicesAssigned: 0,
574
+ devicesAlreadyInRuleSite: 0,
575
+ devicesSkippedAlreadyInAnotherSite: 0,
576
+ devicesClaimedByHigherPriorityRule: 0,
577
+ devicesFailed: 0,
578
+ isTruncated: false,
579
+ };
580
+ let skip = 0;
581
+ for (;;) {
582
+ const devices = await this.findBy({
583
+ query: {
584
+ projectId: data.projectId,
585
+ },
586
+ select: {
587
+ _id: true,
588
+ siteId: true,
589
+ hostname: true,
590
+ sysName: true,
591
+ name: true,
592
+ },
593
+ /*
594
+ * Sorted by id so paging stays stable while the run writes to the
595
+ * very rows it is paging over. Assigning a site never changes an id,
596
+ * so no device can be skipped or seen twice.
597
+ */
598
+ sort: {
599
+ _id: SortOrder.Ascending,
600
+ },
601
+ limit: RULE_RUN_PAGE_SIZE,
602
+ skip: skip,
603
+ props: {
604
+ isRoot: true,
605
+ },
606
+ });
607
+ if (devices.length === 0) {
608
+ break;
609
+ }
610
+ for (const device of devices) {
611
+ result.devicesEvaluated++;
612
+ const target = toRuleMatchTarget(device);
613
+ if (!CidrMatchUtil.ruleMatches(rule, target)) {
614
+ continue;
615
+ }
616
+ result.devicesMatched++;
617
+ if (((_a = device.siteId) === null || _a === void 0 ? void 0 : _a.toString()) === ruleSiteId.toString()) {
618
+ result.devicesAlreadyInRuleSite++;
619
+ continue;
620
+ }
621
+ if (device.siteId && !data.reassignDevicesAlreadyInASite) {
622
+ result.devicesSkippedAlreadyInAnotherSite++;
623
+ continue;
624
+ }
625
+ const winner = CidrMatchUtil.pickRule(rules, target);
626
+ if (((_b = winner === null || winner === void 0 ? void 0 : winner._id) === null || _b === void 0 ? void 0 : _b.toString()) !== ((_c = rule._id) === null || _c === void 0 ? void 0 : _c.toString())) {
627
+ result.devicesClaimedByHigherPriorityRule++;
628
+ continue;
629
+ }
630
+ /*
631
+ * Counted as a failure rather than skipped silently: every matched
632
+ * device has to land in exactly one bucket, or the summary the
633
+ * operator reads would not add up.
634
+ */
635
+ if (!device.id) {
636
+ result.devicesFailed++;
637
+ continue;
638
+ }
639
+ /*
640
+ * Through updateOneById, not a bulk UPDATE: onUpdateSuccess is what
641
+ * refreshes the rollups of the site the device left and the site it
642
+ * joined, and a raw write would leave both stale.
643
+ */
644
+ try {
645
+ await this.updateOneById({
646
+ id: device.id,
647
+ data: {
648
+ siteId: ruleSiteId,
649
+ },
650
+ props: {
651
+ isRoot: true,
652
+ },
653
+ });
654
+ result.devicesAssigned++;
655
+ }
656
+ catch (error) {
657
+ // One unhappy device must not abandon the rest of the estate.
658
+ result.devicesFailed++;
659
+ logger.error(`Error assigning site from assignment rule ${data.ruleId.toString()} to device ${device.id.toString()}: ${error}`, {
660
+ projectId: data.projectId.toString(),
661
+ networkDeviceId: device.id.toString(),
662
+ });
663
+ }
664
+ }
665
+ skip += devices.length;
666
+ if (devices.length < RULE_RUN_PAGE_SIZE) {
667
+ break;
668
+ }
669
+ if (skip >= MAX_DEVICES_PER_RULE_RUN) {
670
+ /*
671
+ * A full last page does not prove there is an eleventh thousand of
672
+ * devices — an estate of exactly the cap would report a truncation
673
+ * that never happened, and the UI would tell the user to run it
674
+ * again forever. One row is enough to settle it.
675
+ */
676
+ const nextDevice = await this.findBy({
677
+ query: {
678
+ projectId: data.projectId,
679
+ },
680
+ select: {
681
+ _id: true,
682
+ },
683
+ sort: {
684
+ _id: SortOrder.Ascending,
685
+ },
686
+ limit: 1,
687
+ skip: skip,
688
+ props: {
689
+ isRoot: true,
690
+ },
691
+ });
692
+ result.isTruncated = nextDevice.length > 0;
693
+ break;
694
+ }
695
+ }
696
+ return result;
697
+ }
493
698
  /*
494
699
  * Atomically claims the devices this probe should poll now and advances
495
700
  * each device's nextPollAt by its own polling interval — the device-owned
@@ -614,6 +819,12 @@ __decorate([
614
819
  __metadata("design:paramtypes", [ObjectID]),
615
820
  __metadata("design:returntype", Promise)
616
821
  ], Service.prototype, "applySiteAssignmentRulesToDevice", null);
822
+ __decorate([
823
+ CaptureSpan(),
824
+ __metadata("design:type", Function),
825
+ __metadata("design:paramtypes", [Object]),
826
+ __metadata("design:returntype", Promise)
827
+ ], Service.prototype, "applySiteAssignmentRuleToExistingDevices", null);
617
828
  __decorate([
618
829
  CaptureSpan(),
619
830
  __metadata("design:type", Function),
@@ -1 +1 @@
1
-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