@oneuptime/common 14.0.110 → 14.1.0

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 (322) hide show
  1. package/Models/DatabaseModels/AIRunRecording.d.mts +12 -0
  2. package/Models/DatabaseModels/AIRunRecording.d.ts +12 -0
  3. package/Models/DatabaseModels/AIRunRecording.js +181 -0
  4. package/Models/DatabaseModels/AIRunRecording.mjs +2 -0
  5. package/Models/DatabaseModels/Alert.js +18 -2
  6. package/Models/DatabaseModels/DataStore.js +9 -0
  7. package/Models/DatabaseModels/EmailLog.js +2 -2
  8. package/Models/DatabaseModels/Form.js +3 -3
  9. package/Models/DatabaseModels/FormSubmission.js +4 -4
  10. package/Models/DatabaseModels/GlobalConfig.js +46 -45
  11. package/Models/DatabaseModels/Incident.js +18 -2
  12. package/Models/DatabaseModels/IncidentSlaRule.js +2 -2
  13. package/Models/DatabaseModels/Index.js +4 -0
  14. package/Models/DatabaseModels/InventoryItem.js +11 -0
  15. package/Models/DatabaseModels/Monitor.js +51 -17
  16. package/Models/DatabaseModels/MonitorNetworkDevice.d.mts +11 -0
  17. package/Models/DatabaseModels/MonitorNetworkDevice.d.ts +11 -0
  18. package/Models/DatabaseModels/MonitorNetworkDevice.js +189 -0
  19. package/Models/DatabaseModels/MonitorNetworkDevice.mjs +2 -0
  20. package/Models/DatabaseModels/MonitorProbe.js +22 -5
  21. package/Models/DatabaseModels/NetworkDevice.js +23 -7
  22. package/Models/DatabaseModels/NetworkEndpoint.d.mts +1 -0
  23. package/Models/DatabaseModels/NetworkEndpoint.d.ts +1 -0
  24. package/Models/DatabaseModels/NetworkEndpoint.js +39 -7
  25. package/Models/DatabaseModels/NetworkInterface.js +5 -5
  26. package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +19 -5
  27. package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.mts +1 -0
  28. package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.ts +1 -0
  29. package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +2 -0
  30. package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +35 -7
  31. package/Models/DatabaseModels/OpenStackCloudCheck.js +8 -1
  32. package/Models/DatabaseModels/Project.d.mts +1 -0
  33. package/Models/DatabaseModels/Project.d.ts +1 -0
  34. package/Models/DatabaseModels/Project.js +46 -3
  35. package/Models/DatabaseModels/ProjectCallSMSConfig.js +3 -1
  36. package/Models/DatabaseModels/ProjectSmtpConfig.js +2 -0
  37. package/Models/DatabaseModels/PublicNoteApprovalRequest.js +3 -3
  38. package/Models/DatabaseModels/PublicNoteApprovalStep.js +1 -1
  39. package/Models/DatabaseModels/RunbookExecution.js +2 -2
  40. package/Models/DatabaseModels/RunbookRule.js +6 -6
  41. package/Models/DatabaseModels/ScheduledMaintenance.js +3 -3
  42. package/Models/DatabaseModels/ScheduledMaintenanceCalendarFeed.js +1 -1
  43. package/Models/DatabaseModels/ScheduledMaintenanceLabelRule.js +1 -1
  44. package/Models/DatabaseModels/ScheduledMaintenanceMeasurement.js +7 -7
  45. package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +1 -1
  46. package/Models/DatabaseModels/ScheduledMaintenanceOwnerRule.js +6 -6
  47. package/Models/DatabaseModels/ScheduledMaintenanceOwnerTeam.js +4 -4
  48. package/Models/DatabaseModels/ScheduledMaintenanceOwnerUser.js +4 -4
  49. package/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +3 -3
  50. package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +4 -4
  51. package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +3 -3
  52. package/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +5 -5
  53. package/Models/DatabaseModels/TeamMember.js +10 -1
  54. package/Models/DatabaseModels/WorkspaceNotificationRule.js +36 -1
  55. package/Models/DatabaseModels/WorkspaceNotificationSummary.js +1 -1
  56. package/Models/DatabaseModels/WorkspacePublicNoteApprovalMessage.js +3 -3
  57. package/Server/Services/DatabaseService.d.mts +4 -1
  58. package/Server/Services/DatabaseService.d.ts +4 -1
  59. package/Server/Types/Database/CountBy.d.mts +1 -0
  60. package/Server/Types/Database/CountBy.d.ts +1 -0
  61. package/Server/Types/Database/UpdateLimit.d.mts +6 -0
  62. package/Server/Types/Database/UpdateLimit.d.ts +6 -0
  63. package/Types/AI/AIActionWords.d.mts +25 -1
  64. package/Types/AI/AIActionWords.d.ts +25 -1
  65. package/Types/AI/AIActionWords.js +166 -3
  66. package/Types/AI/AIActionWords.mjs +6 -0
  67. package/Types/AI/AIChatTypes.d.mts +2 -1
  68. package/Types/AI/AIChatTypes.d.ts +2 -1
  69. package/Types/AI/AiOutcomes.d.mts +57 -0
  70. package/Types/AI/AiOutcomes.d.ts +57 -0
  71. package/Types/AI/AiOutcomes.js +67 -0
  72. package/Types/AI/AiOutcomes.mjs +10 -0
  73. package/Types/AI/AiRunRefusal.d.mts +45 -0
  74. package/Types/AI/AiRunRefusal.d.ts +45 -0
  75. package/Types/AI/AiRunRefusal.js +187 -0
  76. package/Types/AI/AiRunRefusal.mjs +12 -0
  77. package/Types/AI/InvestigationRecording.d.mts +46 -0
  78. package/Types/AI/InvestigationRecording.d.ts +46 -0
  79. package/Types/AI/InvestigationRecording.js +42 -0
  80. package/Types/AI/InvestigationRecording.mjs +7 -0
  81. package/Types/API/HTTPResponse.d.mts +3 -0
  82. package/Types/API/HTTPResponse.d.ts +3 -0
  83. package/Types/API/HTTPResponse.js +15 -0
  84. package/Types/BaseDatabase/AggregateBy.d.mts +16 -0
  85. package/Types/BaseDatabase/AggregateBy.d.ts +16 -0
  86. package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +16 -1
  87. package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +16 -1
  88. package/Types/BaseDatabase/AggregationIntervalUtil.js +92 -2
  89. package/Types/BaseDatabase/ListResult.d.mts +1 -0
  90. package/Types/BaseDatabase/ListResult.d.ts +1 -0
  91. package/Types/CallAndSMS/ServerTwilioEnvironment.d.mts +47 -0
  92. package/Types/CallAndSMS/ServerTwilioEnvironment.d.ts +47 -0
  93. package/Types/CallAndSMS/ServerTwilioEnvironment.js +282 -0
  94. package/Types/CallAndSMS/ServerTwilioEnvironment.mjs +7 -0
  95. package/Types/Dashboard/DashboardAutoRefresh.d.mts +1 -0
  96. package/Types/Dashboard/DashboardAutoRefresh.d.ts +1 -0
  97. package/Types/Dashboard/DashboardAutoRefresh.js +21 -0
  98. package/Types/Dashboard/DashboardAutoRefresh.mjs +1 -0
  99. package/Types/Date.d.mts +6 -1
  100. package/Types/Date.d.ts +6 -1
  101. package/Types/Date.js +39 -7
  102. package/Types/Date.mjs +1 -0
  103. package/Types/Email/ServerEmailEnvironment.d.mts +85 -0
  104. package/Types/Email/ServerEmailEnvironment.d.ts +85 -0
  105. package/Types/Email/ServerEmailEnvironment.js +793 -0
  106. package/Types/Email/ServerEmailEnvironment.mjs +14 -0
  107. package/Types/Exception/AiRunRefusalException.d.mts +6 -0
  108. package/Types/Exception/AiRunRefusalException.d.ts +6 -0
  109. package/Types/Exception/AiRunRefusalException.js +23 -0
  110. package/Types/Exception/AiRunRefusalException.mjs +2 -0
  111. package/Types/Form/FormTargetCatalog.js +2 -2
  112. package/Types/Form/FormTargetType.js +2 -2
  113. package/Types/ListData.d.mts +2 -0
  114. package/Types/ListData.d.ts +2 -0
  115. package/Types/ListData.js +4 -0
  116. package/Types/Monitor/MonitorCriteriaInstance.js +9 -0
  117. package/Types/Monitor/MonitorNotCheckedReason.d.mts +7 -0
  118. package/Types/Monitor/MonitorNotCheckedReason.d.ts +7 -0
  119. package/Types/Monitor/MonitorNotCheckedReason.js +36 -0
  120. package/Types/Monitor/MonitorNotCheckedReason.mjs +4 -0
  121. package/Types/Monitor/SnmpMonitor/NetworkTopology.d.mts +6 -0
  122. package/Types/Monitor/SnmpMonitor/NetworkTopology.d.ts +6 -0
  123. package/Types/Monitor/UptimeHistoryLabels.js +2 -2
  124. package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.mts +1 -0
  125. package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.ts +1 -0
  126. package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.js +12 -9
  127. package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.mjs +1 -0
  128. package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.mts +3 -1
  129. package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.ts +3 -1
  130. package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.js +24 -6
  131. package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.mjs +1 -0
  132. package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.mts +1 -0
  133. package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.ts +1 -0
  134. package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.mts +12 -0
  135. package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.ts +12 -0
  136. package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.js +38 -0
  137. package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.mjs +3 -0
  138. package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.mts +92 -0
  139. package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.ts +92 -0
  140. package/Types/OnCallDutyPolicy/ScheduleLayersSave.js +512 -0
  141. package/Types/OnCallDutyPolicy/ScheduleLayersSave.mjs +7 -0
  142. package/Types/OnCallDutyPolicy/UserOverrideEdit.d.mts +23 -0
  143. package/Types/OnCallDutyPolicy/UserOverrideEdit.d.ts +23 -0
  144. package/Types/OnCallDutyPolicy/UserOverrideEdit.js +105 -0
  145. package/Types/OnCallDutyPolicy/UserOverrideEdit.mjs +6 -0
  146. package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.mts +64 -0
  147. package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.ts +64 -0
  148. package/Types/OnCallDutyPolicy/UserOverrideOverlap.js +237 -0
  149. package/Types/OnCallDutyPolicy/UserOverrideOverlap.mjs +14 -0
  150. package/Types/Permission.js +2 -2
  151. package/Types/Probe/ProbeCapability.d.mts +2 -1
  152. package/Types/Probe/ProbeCapability.d.ts +2 -1
  153. package/Types/Probe/ProbeCapability.js +10 -0
  154. package/Types/ReaderLanguage.d.mts +1 -0
  155. package/Types/ReaderLanguage.d.ts +1 -0
  156. package/Types/ReaderLanguage.js +13 -1
  157. package/Types/ReaderLanguage.mjs +1 -0
  158. package/Types/Rules/RuleRun.js +2 -2
  159. package/Types/ScheduledMaintenance/MaintenanceCalendar.js +1 -1
  160. package/Types/ServerSending/ServerSendingStatus.d.mts +7 -0
  161. package/Types/ServerSending/ServerSendingStatus.d.ts +7 -0
  162. package/Types/ServerSending/ServerSendingStatus.js +49 -2
  163. package/Types/ServerSetup/ServerSetupChecklist.js +3 -3
  164. package/Types/StateTimeline/RowsKeptOnDelete.js +1 -1
  165. package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.mts +8 -0
  166. package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.ts +8 -0
  167. package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.js +50 -0
  168. package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.mjs +3 -0
  169. package/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js +1 -1
  170. package/Types/Telemetry/CompatibleIngest.d.mts +20 -0
  171. package/Types/Telemetry/CompatibleIngest.d.ts +20 -0
  172. package/Types/Telemetry/CompatibleIngest.js +123 -0
  173. package/Types/Telemetry/CompatibleIngest.mjs +21 -0
  174. package/Types/Telemetry/TelemetryIngestSurface.d.mts +5 -0
  175. package/Types/Telemetry/TelemetryIngestSurface.d.ts +5 -0
  176. package/Types/Telemetry/TelemetryIngestSurface.js +48 -7
  177. package/Types/TimezoneAlias.d.mts +1 -0
  178. package/Types/TimezoneAlias.d.ts +1 -0
  179. package/Types/TimezoneAlias.js +13 -0
  180. package/Types/Translator.js +374 -48
  181. package/Types/Workflow/RunRecord.js +1 -1
  182. package/Types/Workflow/Templates.js +2 -2
  183. package/Types/Workspace/NotificationRules/BaseNotificationRule.d.mts +2 -0
  184. package/Types/Workspace/NotificationRules/BaseNotificationRule.d.ts +2 -0
  185. package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +26 -1
  186. package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +26 -1
  187. package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.mts +84 -0
  188. package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.ts +84 -0
  189. package/Types/Workspace/NotificationRules/NotificationRuleUpdates.js +456 -0
  190. package/Types/Workspace/NotificationRules/NotificationRuleUpdates.mjs +5 -0
  191. package/Utils/Dashboard/ValueWidgetSeries.d.mts +2 -0
  192. package/Utils/Dashboard/ValueWidgetSeries.d.ts +2 -0
  193. package/Utils/Dashboard/ValueWidgetSeries.js +75 -0
  194. package/Utils/DeveloperDocs/ExampleBuilder.js +1 -1
  195. package/Utils/DeveloperDocs/ResourceProfiles.js +2 -2
  196. package/Utils/GuidedSetup/StatusPageRecords.d.mts +5 -0
  197. package/Utils/GuidedSetup/StatusPageRecords.d.ts +5 -0
  198. package/Utils/GuidedSetup/StatusPageRecords.js +27 -2
  199. package/Utils/GuidedSetup/StatusPageRecords.mjs +1 -0
  200. package/Utils/GuidedSetup/WebsiteMonitorRecords.js +6 -0
  201. package/Utils/HostAddressUtil.d.mts +1 -0
  202. package/Utils/HostAddressUtil.d.ts +1 -0
  203. package/Utils/HostAddressUtil.js +30 -0
  204. package/Utils/LinearRegExp/LinearRegExp.js +5 -1
  205. package/Utils/Milliseconds.d.mts +7 -0
  206. package/Utils/Milliseconds.d.ts +7 -0
  207. package/Utils/Milliseconds.js +60 -0
  208. package/Utils/Milliseconds.mjs +4 -0
  209. package/Utils/Monitor/EndpointAttachmentUtil.d.mts +8 -0
  210. package/Utils/Monitor/EndpointAttachmentUtil.d.ts +8 -0
  211. package/Utils/Monitor/EndpointAttachmentUtil.js +91 -21
  212. package/Utils/Monitor/EndpointAttachmentUtil.mjs +4 -0
  213. package/Utils/Monitor/InterfaceInventoryUtil.d.mts +40 -0
  214. package/Utils/Monitor/InterfaceInventoryUtil.d.ts +40 -0
  215. package/Utils/Monitor/InterfaceInventoryUtil.js +217 -5
  216. package/Utils/Monitor/InterfaceInventoryUtil.mjs +8 -0
  217. package/Utils/Monitor/MonitorOverviewPresentationUtil.js +63 -29
  218. package/Utils/Monitor/MonitorOverviewProbeUtil.js +13 -2
  219. package/Utils/Monitor/MonitorRootCauseWording.d.mts +2 -0
  220. package/Utils/Monitor/MonitorRootCauseWording.d.ts +2 -0
  221. package/Utils/Monitor/MonitorRootCauseWording.js +58 -4
  222. package/Utils/Monitor/MonitoringOff.d.mts +2 -0
  223. package/Utils/Monitor/MonitoringOff.d.ts +2 -0
  224. package/Utils/Monitor/MonitoringOff.js +21 -0
  225. package/Utils/Monitor/NetworkTopologyUtil.d.mts +2 -1
  226. package/Utils/Monitor/NetworkTopologyUtil.d.ts +2 -1
  227. package/Utils/Monitor/NetworkTopologyUtil.js +10 -0
  228. package/Utils/Monitor/NotOperationalMonitorQuery.d.mts +2 -1
  229. package/Utils/Monitor/NotOperationalMonitorQuery.d.ts +2 -1
  230. package/Utils/Monitor/NotOperationalMonitorQuery.js +23 -4
  231. package/Utils/Monitor/ProbeFailureReading.d.mts +14 -0
  232. package/Utils/Monitor/ProbeFailureReading.d.ts +14 -0
  233. package/Utils/Monitor/ProbeFailureReading.js +137 -0
  234. package/Utils/Monitor/ProbeFailureReading.mjs +7 -0
  235. package/Utils/NetworkDevice/BoundMonitorNotChecked.d.mts +9 -0
  236. package/Utils/NetworkDevice/BoundMonitorNotChecked.d.ts +9 -0
  237. package/Utils/NetworkDevice/BoundMonitorNotChecked.js +15 -0
  238. package/Utils/NetworkDevice/BoundMonitorNotChecked.mjs +2 -0
  239. package/Utils/Project/NextNumber.js +1 -1
  240. package/Utils/PromQL/PromQLAst.d.mts +159 -0
  241. package/Utils/PromQL/PromQLAst.d.ts +159 -0
  242. package/Utils/PromQL/PromQLAst.js +118 -0
  243. package/Utils/PromQL/PromQLAst.mjs +12 -0
  244. package/Utils/PromQL/PromQLDuration.d.mts +2 -0
  245. package/Utils/PromQL/PromQLDuration.d.ts +2 -0
  246. package/Utils/PromQL/PromQLDuration.js +78 -0
  247. package/Utils/PromQL/PromQLDuration.mjs +3 -0
  248. package/Utils/PromQL/PromQLEngine.d.mts +15 -0
  249. package/Utils/PromQL/PromQLEngine.d.ts +15 -0
  250. package/Utils/PromQL/PromQLEngine.js +965 -0
  251. package/Utils/PromQL/PromQLEngine.mjs +7 -0
  252. package/Utils/PromQL/PromQLEngineTypes.d.mts +84 -0
  253. package/Utils/PromQL/PromQLEngineTypes.d.ts +84 -0
  254. package/Utils/PromQL/PromQLEngineTypes.js +10 -0
  255. package/Utils/PromQL/PromQLEngineTypes.mjs +2 -0
  256. package/Utils/PromQL/PromQLError.d.mts +11 -0
  257. package/Utils/PromQL/PromQLError.d.ts +11 -0
  258. package/Utils/PromQL/PromQLError.js +27 -0
  259. package/Utils/PromQL/PromQLError.mjs +3 -0
  260. package/Utils/PromQL/PromQLFunctionEvaluators.d.mts +8 -0
  261. package/Utils/PromQL/PromQLFunctionEvaluators.d.ts +8 -0
  262. package/Utils/PromQL/PromQLFunctionEvaluators.js +773 -0
  263. package/Utils/PromQL/PromQLFunctionEvaluators.mjs +3 -0
  264. package/Utils/PromQL/PromQLFunctions.d.mts +10 -0
  265. package/Utils/PromQL/PromQLFunctions.d.ts +10 -0
  266. package/Utils/PromQL/PromQLFunctions.js +127 -0
  267. package/Utils/PromQL/PromQLFunctions.mjs +4 -0
  268. package/Utils/PromQL/PromQLLabels.d.mts +11 -0
  269. package/Utils/PromQL/PromQLLabels.d.ts +11 -0
  270. package/Utils/PromQL/PromQLLabels.js +218 -0
  271. package/Utils/PromQL/PromQLLabels.mjs +9 -0
  272. package/Utils/PromQL/PromQLLexer.d.mts +39 -0
  273. package/Utils/PromQL/PromQLLexer.d.ts +39 -0
  274. package/Utils/PromQL/PromQLLexer.js +391 -0
  275. package/Utils/PromQL/PromQLLexer.mjs +3 -0
  276. package/Utils/PromQL/PromQLMath.d.mts +19 -0
  277. package/Utils/PromQL/PromQLMath.d.ts +19 -0
  278. package/Utils/PromQL/PromQLMath.js +200 -0
  279. package/Utils/PromQL/PromQLMath.mjs +9 -0
  280. package/Utils/PromQL/PromQLMetricNames.d.mts +21 -0
  281. package/Utils/PromQL/PromQLMetricNames.d.ts +21 -0
  282. package/Utils/PromQL/PromQLMetricNames.js +199 -0
  283. package/Utils/PromQL/PromQLMetricNames.mjs +8 -0
  284. package/Utils/PromQL/PromQLParser.d.mts +4 -0
  285. package/Utils/PromQL/PromQLParser.d.ts +4 -0
  286. package/Utils/PromQL/PromQLParser.js +831 -0
  287. package/Utils/PromQL/PromQLParser.mjs +4 -0
  288. package/Utils/PromQL/PromQLRegex.d.mts +9 -0
  289. package/Utils/PromQL/PromQLRegex.d.ts +9 -0
  290. package/Utils/PromQL/PromQLRegex.js +74 -0
  291. package/Utils/PromQL/PromQLRegex.mjs +2 -0
  292. package/Utils/PromQL/PrometheusResponse.d.mts +25 -0
  293. package/Utils/PromQL/PrometheusResponse.d.ts +25 -0
  294. package/Utils/PromQL/PrometheusResponse.js +90 -0
  295. package/Utils/PromQL/PrometheusResponse.mjs +3 -0
  296. package/Utils/Rum/PathInSentence.d.mts +5 -0
  297. package/Utils/Rum/PathInSentence.d.ts +5 -0
  298. package/Utils/Rum/PathInSentence.js +46 -0
  299. package/Utils/Rum/PathInSentence.mjs +6 -0
  300. package/Utils/Rum/UrlScrubber.d.mts +4 -0
  301. package/Utils/Rum/UrlScrubber.d.ts +4 -0
  302. package/Utils/Rum/UrlScrubber.js +143 -3
  303. package/Utils/Rum/UserFlow.d.mts +1 -1
  304. package/Utils/Rum/UserFlow.d.ts +1 -1
  305. package/Utils/Rum/UserFlow.js +180 -25
  306. package/Utils/Rum/UserFlow.mjs +1 -1
  307. package/Utils/Runbook/RunbookStepsSignature.d.mts +3 -0
  308. package/Utils/Runbook/RunbookStepsSignature.d.ts +3 -0
  309. package/Utils/Runbook/RunbookStepsSignature.js +30 -0
  310. package/Utils/Runbook/RunbookStepsSignature.mjs +3 -0
  311. package/Utils/Schema/TypeSchemas.js +6 -0
  312. package/Utils/Slo/SloDuration.d.mts +5 -2
  313. package/Utils/Slo/SloDuration.d.ts +5 -2
  314. package/Utils/Slo/SloDuration.js +11 -6
  315. package/Utils/Slo/SloHealth.js +1 -1
  316. package/Utils/StateOrder.js +1 -4
  317. package/Utils/StateTimeline/StateTimelineRowDelete.js +1 -1
  318. package/Utils/Telemetry/HeartbeatAvailability.d.mts +4 -0
  319. package/Utils/Telemetry/HeartbeatAvailability.d.ts +4 -0
  320. package/Utils/Telemetry/HeartbeatAvailability.js +118 -26
  321. package/Utils/Uptime/DayUptimeGraphUtil.js +2 -2
  322. package/package.json +1 -1
@@ -6,6 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AggregationIntervalUtil = void 0;
7
7
  const AggregationInterval_1 = __importDefault(require("./AggregationInterval"));
8
8
  const Date_1 = __importDefault(require("../Date"));
9
+ const TimezoneAlias_1 = __importDefault(require("../TimezoneAlias"));
10
+ /*
11
+ * The intervals whose buckets are units of a calendar: a day from midnight,
12
+ * a week from Monday, a month from its 1st, a year from 1 January. Where
13
+ * those begin depends on the time zone they are read in. An hour and
14
+ * shorter are counted from the epoch, the same instants in every zone, and
15
+ * Total is no bucket at all.
16
+ */
17
+ const CALENDAR_INTERVALS = [
18
+ AggregationInterval_1.default.Day,
19
+ AggregationInterval_1.default.Week,
20
+ AggregationInterval_1.default.Month,
21
+ AggregationInterval_1.default.Year,
22
+ ];
9
23
  /*
10
24
  * Single source of truth for "which time-bucket size does the
11
25
  * analytics aggregate API use for a given query window". The server
@@ -65,6 +79,68 @@ class AggregationIntervalUtil {
65
79
  }
66
80
  return AggregationInterval_1.default.Year;
67
81
  }
82
+ /*
83
+ * True for Day, Week, Month and Year: the buckets that start at the
84
+ * reader's midnight, Monday, 1st or 1 January when an aggregate carries
85
+ * the reader's zone (AggregateBy.timezone), and in UTC otherwise.
86
+ */
87
+ static isCalendarInterval(interval) {
88
+ return CALENDAR_INTERVALS.includes(interval);
89
+ }
90
+ /*
91
+ * The zone an aggregate over this window asks its buckets to follow: the
92
+ * reader's (OneUptimeDate.getCurrentTimezone(), the zone User Settings
93
+ * picked, or the browser's), when its buckets are days, weeks, months or
94
+ * years. A chart draws those on the reader's calendar, so their buckets
95
+ * must start where the reader's days do (issue #7277).
96
+ *
97
+ * Undefined for an hour and shorter and for Total, which no zone moves,
98
+ * so those requests stay exactly as they were. Undefined too for a zone
99
+ * the Timezone list does not name - a browser can report a zone newer
100
+ * than the list, and the server refuses any other - so those buckets
101
+ * follow UTC, as before, rather than the chart failing.
102
+ */
103
+ static getReaderTimezone(data) {
104
+ const interval = this.getAggregationIntervalForWindow(data);
105
+ if (!this.isCalendarInterval(interval)) {
106
+ return undefined;
107
+ }
108
+ const timezone = Date_1.default.getCurrentTimezone();
109
+ return TimezoneAlias_1.default.isListedName(timezone) ? timezone : undefined;
110
+ }
111
+ /*
112
+ * The request with the reader's zone on it (getReaderTimezone), as the
113
+ * dashboard sends every aggregate: a new object, the one given left as it
114
+ * is. A request that names its zone keeps it - a cloud's cost is for a
115
+ * UTC day, and its readers ask for Timezone.UTC - and one with no window
116
+ * to read an interval from, or no zone to add, comes back unchanged.
117
+ */
118
+ static withReaderTimezone(aggregateBy) {
119
+ if (!aggregateBy ||
120
+ (aggregateBy.timezone !== undefined && aggregateBy.timezone !== null)) {
121
+ return aggregateBy;
122
+ }
123
+ let timezone = undefined;
124
+ try {
125
+ timezone = this.getReaderTimezone({
126
+ startDate: aggregateBy.startTimestamp,
127
+ endDate: aggregateBy.endTimestamp,
128
+ aggregationInterval: aggregateBy.aggregationInterval,
129
+ });
130
+ }
131
+ catch (_a) {
132
+ /*
133
+ * No window to read an interval from (fromString throws on a missing
134
+ * date): the request goes as it is, and the server answers it as it
135
+ * always has.
136
+ */
137
+ return aggregateBy;
138
+ }
139
+ if (!timezone) {
140
+ return aggregateBy;
141
+ }
142
+ return Object.assign(Object.assign({}, aggregateBy), { timezone: timezone });
143
+ }
68
144
  /*
69
145
  * Nominal bucket width in milliseconds. Month and Year are
70
146
  * calendar-variable in ClickHouse (`toStartOfInterval` snaps to
@@ -124,8 +200,15 @@ class AggregationIntervalUtil {
124
200
  * server-side, which a fixed-ms grid can't reproduce, so those (and
125
201
  * `Total`) are returned UNCHANGED rather than risk shifting the gap for
126
202
  * long windows — their pre-existing behavior is preserved.
203
+ *
204
+ * `timezone` is the zone the request's buckets follow (its
205
+ * AggregateBy.timezone, see getReaderTimezone): a Day then floors to that
206
+ * zone's midnight, where the server starts the day, and not to UTC's - in
207
+ * New York a UTC midnight is 19:00 the evening before, so the window's
208
+ * first day would hold five hours of it. Every finer interval is the same
209
+ * in every zone and ignores it.
127
210
  */
128
- static floorDateToIntervalGrid(date, interval) {
211
+ static floorDateToIntervalGrid(date, interval, timezone) {
129
212
  const ms = Date_1.default.fromString(date).getTime();
130
213
  const alignableIntervals = [
131
214
  AggregationInterval_1.default.Minute,
@@ -138,6 +221,9 @@ class AggregationIntervalUtil {
138
221
  if (!alignableIntervals.includes(interval)) {
139
222
  return new Date(ms);
140
223
  }
224
+ if (interval === AggregationInterval_1.default.Day && timezone) {
225
+ return Date_1.default.getStartOfDay(new Date(ms), timezone);
226
+ }
141
227
  const bucketMs = this.getAggregationIntervalMs(interval);
142
228
  if (!Number.isFinite(bucketMs) || bucketMs <= 0) {
143
229
  return new Date(ms);
@@ -154,6 +240,10 @@ class AggregationIntervalUtil {
154
240
  * is floored DOWN so the first bucket is complete and lands on the axis
155
241
  * origin (removing the leading gap); the end is left untouched so the
156
242
  * latest, still-in-progress bucket and its live data continue to show.
243
+ *
244
+ * `timezone` is the zone the window's request will carry (see
245
+ * floorDateToIntervalGrid); the caller reads it with getReaderTimezone,
246
+ * as the request does, so the two always agree.
157
247
  */
158
248
  static getIntervalAlignedWindow(data) {
159
249
  const interval = this.getAggregationIntervalForWindow({
@@ -161,7 +251,7 @@ class AggregationIntervalUtil {
161
251
  endDate: data.endDate,
162
252
  });
163
253
  return {
164
- startDate: this.floorDateToIntervalGrid(data.startDate, interval),
254
+ startDate: this.floorDateToIntervalGrid(data.startDate, interval, data.timezone),
165
255
  endDate: Date_1.default.fromString(data.endDate),
166
256
  interval,
167
257
  };
@@ -7,4 +7,5 @@ export default interface ListResult<TBaseModel extends BaseModel | AnalyticsBase
7
7
  skip: number;
8
8
  limit: number;
9
9
  hasMore?: boolean | undefined;
10
+ isCountCapped?: boolean | undefined;
10
11
  }
@@ -7,4 +7,5 @@ export default interface ListResult<TBaseModel extends BaseModel | AnalyticsBase
7
7
  skip: number;
8
8
  limit: number;
9
9
  hasMore?: boolean | undefined;
10
+ isCountCapped?: boolean | undefined;
10
11
  }
@@ -0,0 +1,47 @@
1
+ import Phone from "../Phone.mjs";
2
+ import { TwilioConfigUse } from "./TwilioConfigUse.mjs";
3
+ export declare enum ServerTwilioEnvironmentVariable {
4
+ AccountSid = "GLOBAL_TWILIO_ACCOUNT_SID",
5
+ AuthToken = "GLOBAL_TWILIO_AUTH_TOKEN",
6
+ UsedFor = "GLOBAL_TWILIO_USED_FOR",
7
+ PrimaryPhoneNumber = "GLOBAL_TWILIO_PRIMARY_PHONE_NUMBER",
8
+ SecondaryPhoneNumbers = "GLOBAL_TWILIO_SECONDARY_PHONE_NUMBERS",
9
+ SmsPhoneNumbers = "GLOBAL_TWILIO_SMS_PHONE_NUMBERS"
10
+ }
11
+ export declare const SERVER_TWILIO_ENVIRONMENT_VARIABLES: ReadonlyArray<ServerTwilioEnvironmentVariable>;
12
+ export declare const SERVER_TWILIO_USED_FOR_VALUES: Readonly<Record<TwilioConfigUse, string>>;
13
+ export declare const SERVER_TWILIO_ENVIRONMENT_ROUTE: string;
14
+ export declare const SERVER_TWILIO_SET_BY_ENVIRONMENT_MESSAGE: string;
15
+ export interface ServerTwilioEnvironmentAccount {
16
+ twilioAccountSID: string;
17
+ twilioAuthToken: string;
18
+ twilioUsedFor: TwilioConfigUse;
19
+ twilioPrimaryPhoneNumber?: Phone | undefined;
20
+ twilioSecondaryPhoneNumbers: string;
21
+ twilioSmsPhoneNumbers: string;
22
+ }
23
+ export interface ServerTwilioEnvironmentReading {
24
+ isSet: boolean;
25
+ account: ServerTwilioEnvironmentAccount | null;
26
+ problems: Array<string>;
27
+ }
28
+ export interface ServerTwilioEnvironmentAnswer {
29
+ isSetByEnvironment: boolean;
30
+ usedFor: TwilioConfigUse | null;
31
+ accountSid: string | null;
32
+ hasAuthToken: boolean;
33
+ primaryPhoneNumber: string | null;
34
+ secondaryPhoneNumbers: string | null;
35
+ smsPhoneNumbers: string | null;
36
+ problems: Array<string>;
37
+ }
38
+ export type ServerTwilioEnvironmentValues = Readonly<Record<string, string | undefined>>;
39
+ export default class ServerTwilioEnvironment {
40
+ static readUse(value: string | undefined): TwilioConfigUse | null;
41
+ static read(environment: ServerTwilioEnvironmentValues): ServerTwilioEnvironmentReading;
42
+ static isUsable(reading: ServerTwilioEnvironmentReading): boolean;
43
+ static toAnswer(reading: ServerTwilioEnvironmentReading): ServerTwilioEnvironmentAnswer;
44
+ static answerFromJSON(json: unknown): ServerTwilioEnvironmentAnswer;
45
+ static getStartupNotice(reading: ServerTwilioEnvironmentReading): string | null;
46
+ static getStartupWarning(reading: ServerTwilioEnvironmentReading): string | null;
47
+ }
@@ -0,0 +1,47 @@
1
+ import Phone from "../Phone";
2
+ import { TwilioConfigUse } from "./TwilioConfigUse";
3
+ export declare enum ServerTwilioEnvironmentVariable {
4
+ AccountSid = "GLOBAL_TWILIO_ACCOUNT_SID",
5
+ AuthToken = "GLOBAL_TWILIO_AUTH_TOKEN",
6
+ UsedFor = "GLOBAL_TWILIO_USED_FOR",
7
+ PrimaryPhoneNumber = "GLOBAL_TWILIO_PRIMARY_PHONE_NUMBER",
8
+ SecondaryPhoneNumbers = "GLOBAL_TWILIO_SECONDARY_PHONE_NUMBERS",
9
+ SmsPhoneNumbers = "GLOBAL_TWILIO_SMS_PHONE_NUMBERS"
10
+ }
11
+ export declare const SERVER_TWILIO_ENVIRONMENT_VARIABLES: ReadonlyArray<ServerTwilioEnvironmentVariable>;
12
+ export declare const SERVER_TWILIO_USED_FOR_VALUES: Readonly<Record<TwilioConfigUse, string>>;
13
+ export declare const SERVER_TWILIO_ENVIRONMENT_ROUTE: string;
14
+ export declare const SERVER_TWILIO_SET_BY_ENVIRONMENT_MESSAGE: string;
15
+ export interface ServerTwilioEnvironmentAccount {
16
+ twilioAccountSID: string;
17
+ twilioAuthToken: string;
18
+ twilioUsedFor: TwilioConfigUse;
19
+ twilioPrimaryPhoneNumber?: Phone | undefined;
20
+ twilioSecondaryPhoneNumbers: string;
21
+ twilioSmsPhoneNumbers: string;
22
+ }
23
+ export interface ServerTwilioEnvironmentReading {
24
+ isSet: boolean;
25
+ account: ServerTwilioEnvironmentAccount | null;
26
+ problems: Array<string>;
27
+ }
28
+ export interface ServerTwilioEnvironmentAnswer {
29
+ isSetByEnvironment: boolean;
30
+ usedFor: TwilioConfigUse | null;
31
+ accountSid: string | null;
32
+ hasAuthToken: boolean;
33
+ primaryPhoneNumber: string | null;
34
+ secondaryPhoneNumbers: string | null;
35
+ smsPhoneNumbers: string | null;
36
+ problems: Array<string>;
37
+ }
38
+ export type ServerTwilioEnvironmentValues = Readonly<Record<string, string | undefined>>;
39
+ export default class ServerTwilioEnvironment {
40
+ static readUse(value: string | undefined): TwilioConfigUse | null;
41
+ static read(environment: ServerTwilioEnvironmentValues): ServerTwilioEnvironmentReading;
42
+ static isUsable(reading: ServerTwilioEnvironmentReading): boolean;
43
+ static toAnswer(reading: ServerTwilioEnvironmentReading): ServerTwilioEnvironmentAnswer;
44
+ static answerFromJSON(json: unknown): ServerTwilioEnvironmentAnswer;
45
+ static getStartupNotice(reading: ServerTwilioEnvironmentReading): string | null;
46
+ static getStartupWarning(reading: ServerTwilioEnvironmentReading): string | null;
47
+ }
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SERVER_TWILIO_SET_BY_ENVIRONMENT_MESSAGE = exports.SERVER_TWILIO_ENVIRONMENT_ROUTE = exports.SERVER_TWILIO_USED_FOR_VALUES = exports.SERVER_TWILIO_ENVIRONMENT_VARIABLES = exports.ServerTwilioEnvironmentVariable = void 0;
7
+ const Phone_1 = __importDefault(require("../Phone"));
8
+ const RefusedValue_1 = require("../../Utils/RefusedValue");
9
+ const TwilioConfigUse_1 = require("./TwilioConfigUse");
10
+ const TwilioPhoneNumbers_1 = __importDefault(require("./TwilioPhoneNumbers"));
11
+ /*
12
+ * THE SERVER'S OWN TWILIO ACCOUNT, SET BY ENVIRONMENT VARIABLES (#7515).
13
+ *
14
+ * Admin Dashboard > Settings > Call and SMS keeps the server's Twilio
15
+ * account in GlobalConfig. An installation that keeps its configuration in
16
+ * code - Helm values, Terraform's helm_release, a config.env kept in git -
17
+ * sets it with these variables instead. Once GLOBAL_TWILIO_ACCOUNT_SID is
18
+ * set, the server's account is the one the variables describe: the senders
19
+ * read it (Server/Utils/ServerTwilioConfig), the Admin Dashboard shows it
20
+ * without an Edit button, and the server refuses a write to the saved one
21
+ * (GlobalConfigService). Unset, the saved account applies again, as it was.
22
+ * Nothing is copied into the database, so the auth token stays where it was
23
+ * given: a Kubernetes Secret, or config.env.
24
+ *
25
+ * All of the account comes from the variables, or none of it: a variable
26
+ * left unset is empty, never the saved value, so the variables are the
27
+ * whole account and a value nobody wrote down cannot change what is sent.
28
+ *
29
+ * What is wrong with them is said by the variable's name, and never with
30
+ * the auth token: when the server starts, on the Admin Dashboard's Call and
31
+ * SMS page, and in what the server's sending status says SMS and calls are
32
+ * missing (ServerChannelSetup). An account with something wrong sends
33
+ * nothing, as an account that is not set up, rather than send from a number
34
+ * nobody meant or with a use nobody chose.
35
+ *
36
+ * The variables are new names. TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN and
37
+ * TWILIO_PHONE_NUMBER were read once, into a new installation's database, by
38
+ * the UpdateGlobalConfigFromEnv data migration, and an old config.env may
39
+ * still hold them: reading them again would put a stale account over the one
40
+ * an admin has saved since.
41
+ */
42
+ var ServerTwilioEnvironmentVariable;
43
+ (function (ServerTwilioEnvironmentVariable) {
44
+ ServerTwilioEnvironmentVariable["AccountSid"] = "GLOBAL_TWILIO_ACCOUNT_SID";
45
+ ServerTwilioEnvironmentVariable["AuthToken"] = "GLOBAL_TWILIO_AUTH_TOKEN";
46
+ ServerTwilioEnvironmentVariable["UsedFor"] = "GLOBAL_TWILIO_USED_FOR";
47
+ ServerTwilioEnvironmentVariable["PrimaryPhoneNumber"] = "GLOBAL_TWILIO_PRIMARY_PHONE_NUMBER";
48
+ ServerTwilioEnvironmentVariable["SecondaryPhoneNumbers"] = "GLOBAL_TWILIO_SECONDARY_PHONE_NUMBERS";
49
+ ServerTwilioEnvironmentVariable["SmsPhoneNumbers"] = "GLOBAL_TWILIO_SMS_PHONE_NUMBERS";
50
+ })(ServerTwilioEnvironmentVariable || (exports.ServerTwilioEnvironmentVariable = ServerTwilioEnvironmentVariable = {}));
51
+ // Every variable, the one that turns them on first.
52
+ exports.SERVER_TWILIO_ENVIRONMENT_VARIABLES = [
53
+ ServerTwilioEnvironmentVariable.AccountSid,
54
+ ServerTwilioEnvironmentVariable.AuthToken,
55
+ ServerTwilioEnvironmentVariable.UsedFor,
56
+ ServerTwilioEnvironmentVariable.PrimaryPhoneNumber,
57
+ ServerTwilioEnvironmentVariable.SecondaryPhoneNumbers,
58
+ ServerTwilioEnvironmentVariable.SmsPhoneNumbers,
59
+ ];
60
+ /*
61
+ * What GLOBAL_TWILIO_USED_FOR is written as for each use, in the docs, the
62
+ * Helm chart and config.example.env. The Admin Dashboard's own words ("SMS
63
+ * only") are taken too, in any case and with spaces, hyphens or underscores
64
+ * (readUse): "Calls and SMS", "calls_and_sms" and "CallsAndSms" are one use.
65
+ * Unset, it is calls and SMS, as every account was before the choice.
66
+ */
67
+ exports.SERVER_TWILIO_USED_FOR_VALUES = {
68
+ [TwilioConfigUse_1.TwilioConfigUse.CallsAndSms]: "calls-and-sms",
69
+ [TwilioConfigUse_1.TwilioConfigUse.SmsOnly]: "sms-only",
70
+ [TwilioConfigUse_1.TwilioConfigUse.CallsOnly]: "calls-only",
71
+ };
72
+ // Where the Admin Dashboard asks the server whether the variables set its account.
73
+ exports.SERVER_TWILIO_ENVIRONMENT_ROUTE = "/global-config/twilio-environment";
74
+ /*
75
+ * Said when someone tries to change an account the variables set: the
76
+ * server refuses the write (GlobalConfigService), and the docs and the
77
+ * Admin Dashboard say where the account is changed instead.
78
+ */
79
+ exports.SERVER_TWILIO_SET_BY_ENVIRONMENT_MESSAGE = `This server's Twilio account is set by environment variables (${ServerTwilioEnvironmentVariable.AccountSid} and the other GLOBAL_TWILIO_ variables), so it cannot be changed in the Admin Dashboard. Change those variables - twilio in the Helm chart's values, or config.env with Docker Compose - and restart OneUptime.`;
80
+ // "callsandsms" for "Calls and SMS", "calls-and-sms" and "CALLS_AND_SMS".
81
+ const comparableUse = (value) => {
82
+ return value.toLowerCase().replace(/[^a-z]/g, "");
83
+ };
84
+ // "A", "A and B", "A, B and C".
85
+ const listed = (names) => {
86
+ if (names.length <= 1) {
87
+ return names.join("");
88
+ }
89
+ return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
90
+ };
91
+ const NO_ACCOUNT_ANSWER = {
92
+ isSetByEnvironment: false,
93
+ usedFor: null,
94
+ accountSid: null,
95
+ hasAuthToken: false,
96
+ primaryPhoneNumber: null,
97
+ secondaryPhoneNumbers: null,
98
+ smsPhoneNumbers: null,
99
+ problems: [],
100
+ };
101
+ class ServerTwilioEnvironment {
102
+ /*
103
+ * The use GLOBAL_TWILIO_USED_FOR names, calls and SMS when it is empty,
104
+ * or null when it names none of the three.
105
+ */
106
+ static readUse(value) {
107
+ const written = (value || "").trim();
108
+ if (!written) {
109
+ return TwilioConfigUse_1.DEFAULT_TWILIO_CONFIG_USE;
110
+ }
111
+ for (const use of TwilioConfigUse_1.TWILIO_CONFIG_USES) {
112
+ if (comparableUse(use) === comparableUse(written)) {
113
+ return use;
114
+ }
115
+ }
116
+ return null;
117
+ }
118
+ /*
119
+ * The server's Twilio account as the environment sets it - process.env on
120
+ * the server, read again on every call, so nothing it held goes stale.
121
+ * Each value is read without the whitespace around it: a token read from
122
+ * a file keeps its final newline (helm --set-file, Terraform's file()).
123
+ */
124
+ static read(environment) {
125
+ const value = (variable) => {
126
+ const written = environment[variable];
127
+ return typeof written === "string" ? written.trim() : "";
128
+ };
129
+ const accountSid = value(ServerTwilioEnvironmentVariable.AccountSid);
130
+ if (!accountSid) {
131
+ const unused = exports.SERVER_TWILIO_ENVIRONMENT_VARIABLES.filter((variable) => {
132
+ return Boolean(value(variable));
133
+ });
134
+ return {
135
+ isSet: false,
136
+ account: null,
137
+ problems: unused.length > 0
138
+ ? [
139
+ `${listed(unused)} ${unused.length === 1 ? "is" : "are"} set, but ${ServerTwilioEnvironmentVariable.AccountSid} is not, so nothing reads ${unused.length === 1 ? "it" : "them"}: the Twilio account saved in the Admin Dashboard is used. Set ${ServerTwilioEnvironmentVariable.AccountSid} too, or remove ${unused.length === 1 ? "it" : "them"}.`,
140
+ ]
141
+ : [],
142
+ };
143
+ }
144
+ const problems = [];
145
+ const authToken = value(ServerTwilioEnvironmentVariable.AuthToken);
146
+ if (!authToken) {
147
+ problems.push(`${ServerTwilioEnvironmentVariable.AuthToken} is not set: Twilio refuses the account without its auth token.`);
148
+ }
149
+ const usedForText = value(ServerTwilioEnvironmentVariable.UsedFor);
150
+ const use = ServerTwilioEnvironment.readUse(usedForText);
151
+ if (!use) {
152
+ problems.push(`${ServerTwilioEnvironmentVariable.UsedFor} must be ${exports.SERVER_TWILIO_USED_FOR_VALUES[TwilioConfigUse_1.TwilioConfigUse.CallsAndSms]}, ${exports.SERVER_TWILIO_USED_FOR_VALUES[TwilioConfigUse_1.TwilioConfigUse.SmsOnly]} or ${exports.SERVER_TWILIO_USED_FOR_VALUES[TwilioConfigUse_1.TwilioConfigUse.CallsOnly]}, not "${(0, RefusedValue_1.refusedValue)(usedForText)}".`);
153
+ }
154
+ const primaryText = value(ServerTwilioEnvironmentVariable.PrimaryPhoneNumber);
155
+ let primaryPhoneNumber = undefined;
156
+ if (primaryText) {
157
+ try {
158
+ primaryPhoneNumber = new Phone_1.default(primaryText);
159
+ }
160
+ catch (_a) {
161
+ problems.push(`${ServerTwilioEnvironmentVariable.PrimaryPhoneNumber}: "${(0, RefusedValue_1.refusedValue)(primaryText)}" is not a phone number. Write it with its country code, like +14155550100.`);
162
+ }
163
+ }
164
+ const secondaryText = value(ServerTwilioEnvironmentVariable.SecondaryPhoneNumbers);
165
+ const smsText = value(ServerTwilioEnvironmentVariable.SmsPhoneNumbers);
166
+ for (const [variable, text] of [
167
+ [ServerTwilioEnvironmentVariable.SecondaryPhoneNumbers, secondaryText],
168
+ [ServerTwilioEnvironmentVariable.SmsPhoneNumbers, smsText],
169
+ ]) {
170
+ const error = TwilioPhoneNumbers_1.default.getListError(text);
171
+ if (error) {
172
+ problems.push(`${variable}: ${error}`);
173
+ }
174
+ }
175
+ /*
176
+ * The numbers its use takes, as the Admin Dashboard's form asks for
177
+ * them (TwilioConfigUses.getMissingNumberError): SMS numbers for an
178
+ * account used for SMS only, a number to make calls from for the rest.
179
+ */
180
+ if (use === TwilioConfigUse_1.TwilioConfigUse.SmsOnly) {
181
+ if (TwilioPhoneNumbers_1.default.getListEntries(smsText).length === 0) {
182
+ problems.push(`${ServerTwilioEnvironmentVariable.SmsPhoneNumbers} is not set: an account used for SMS only sends every SMS from one of them.`);
183
+ }
184
+ }
185
+ else if (use && !primaryText) {
186
+ problems.push(`${ServerTwilioEnvironmentVariable.PrimaryPhoneNumber} is not set: calls go out from it.`);
187
+ }
188
+ const account = {
189
+ twilioAccountSID: accountSid,
190
+ twilioAuthToken: authToken,
191
+ twilioUsedFor: use || TwilioConfigUse_1.DEFAULT_TWILIO_CONFIG_USE,
192
+ twilioSecondaryPhoneNumbers: secondaryText,
193
+ twilioSmsPhoneNumbers: smsText,
194
+ };
195
+ if (primaryPhoneNumber) {
196
+ account.twilioPrimaryPhoneNumber = primaryPhoneNumber;
197
+ }
198
+ return {
199
+ isSet: true,
200
+ account: account,
201
+ problems: problems,
202
+ };
203
+ }
204
+ // Whether the account the variables set can send: set, with nothing wrong.
205
+ static isUsable(reading) {
206
+ return (reading.isSet && reading.account !== null && reading.problems.length === 0);
207
+ }
208
+ // What the Admin Dashboard is told: never the auth token.
209
+ static toAnswer(reading) {
210
+ if (!reading.isSet || !reading.account) {
211
+ return Object.assign(Object.assign({}, NO_ACCOUNT_ANSWER), { problems: [...reading.problems] });
212
+ }
213
+ const account = reading.account;
214
+ return {
215
+ isSetByEnvironment: true,
216
+ usedFor: account.twilioUsedFor,
217
+ accountSid: account.twilioAccountSID,
218
+ hasAuthToken: Boolean(account.twilioAuthToken),
219
+ primaryPhoneNumber: account.twilioPrimaryPhoneNumber
220
+ ? account.twilioPrimaryPhoneNumber.toString()
221
+ : null,
222
+ secondaryPhoneNumbers: account.twilioSecondaryPhoneNumbers || null,
223
+ smsPhoneNumbers: account.twilioSmsPhoneNumbers || null,
224
+ problems: [...reading.problems],
225
+ };
226
+ }
227
+ /*
228
+ * The answer as the Admin Dashboard reads it back. Anything that is not
229
+ * the answer's shape reads as the variables not set, so the page shows
230
+ * the saved account and its Edit button, and the server still refuses a
231
+ * write it must not take.
232
+ */
233
+ static answerFromJSON(json) {
234
+ if (!json || typeof json !== "object" || Array.isArray(json)) {
235
+ return Object.assign(Object.assign({}, NO_ACCOUNT_ANSWER), { problems: [] });
236
+ }
237
+ const data = json;
238
+ const text = (key) => {
239
+ const read = data[key];
240
+ return typeof read === "string" && read.trim() ? read : null;
241
+ };
242
+ const usedFor = data["usedFor"];
243
+ return {
244
+ isSetByEnvironment: data["isSetByEnvironment"] === true,
245
+ usedFor: TwilioConfigUse_1.TWILIO_CONFIG_USES.includes(usedFor)
246
+ ? usedFor
247
+ : null,
248
+ accountSid: text("accountSid"),
249
+ hasAuthToken: data["hasAuthToken"] === true,
250
+ primaryPhoneNumber: text("primaryPhoneNumber"),
251
+ secondaryPhoneNumbers: text("secondaryPhoneNumbers"),
252
+ smsPhoneNumbers: text("smsPhoneNumbers"),
253
+ problems: Array.isArray(data["problems"])
254
+ ? data["problems"].filter((problem) => {
255
+ return typeof problem === "string" && problem.length > 0;
256
+ })
257
+ : [],
258
+ };
259
+ }
260
+ /*
261
+ * What the server says once as it starts, so nobody looks for the
262
+ * account in the Admin Dashboard: the variables set it, or are set and
263
+ * unused. Null when no variable is set.
264
+ */
265
+ static getStartupNotice(reading) {
266
+ if (!reading.isSet) {
267
+ return null;
268
+ }
269
+ return `The server's Twilio account is set by environment variables (${ServerTwilioEnvironmentVariable.AccountSid} and the other GLOBAL_TWILIO_ variables): the account saved in the Admin Dashboard is not used.`;
270
+ }
271
+ // What is wrong with the variables, as the server says it when it starts.
272
+ static getStartupWarning(reading) {
273
+ if (reading.problems.length === 0) {
274
+ return null;
275
+ }
276
+ if (!reading.isSet) {
277
+ return reading.problems.join(" ");
278
+ }
279
+ return `The Twilio account set by environment variables sends no SMS and makes no calls until this is fixed: ${reading.problems.join(" ")}`;
280
+ }
281
+ }
282
+ exports.default = ServerTwilioEnvironment;
@@ -0,0 +1,7 @@
1
+ import commonJsModule from "./ServerTwilioEnvironment.js";
2
+ export default commonJsModule.default;
3
+ export const SERVER_TWILIO_ENVIRONMENT_ROUTE = commonJsModule.SERVER_TWILIO_ENVIRONMENT_ROUTE;
4
+ export const SERVER_TWILIO_ENVIRONMENT_VARIABLES = commonJsModule.SERVER_TWILIO_ENVIRONMENT_VARIABLES;
5
+ export const SERVER_TWILIO_SET_BY_ENVIRONMENT_MESSAGE = commonJsModule.SERVER_TWILIO_SET_BY_ENVIRONMENT_MESSAGE;
6
+ export const SERVER_TWILIO_USED_FOR_VALUES = commonJsModule.SERVER_TWILIO_USED_FOR_VALUES;
7
+ export const ServerTwilioEnvironmentVariable = commonJsModule.ServerTwilioEnvironmentVariable;
@@ -2,6 +2,7 @@ import { AutoRefreshInterval } from "./DashboardViewConfig.mjs";
2
2
  import { DashboardSetting } from "./DashboardViewerChoice.mjs";
3
3
  export declare const DASHBOARD_AUTO_REFRESH_FIELD: string;
4
4
  export declare const DASHBOARD_AUTO_REFRESH_FALLBACK: AutoRefreshInterval;
5
+ export declare function formatAutoRefreshInterval(interval: AutoRefreshInterval, language?: string | undefined): string | null;
5
6
  export declare const DASHBOARD_AUTO_REFRESH_INTERVALS: ReadonlyArray<AutoRefreshInterval>;
6
7
  export declare function isDashboardAutoRefreshInterval(value: unknown): value is AutoRefreshInterval;
7
8
  export declare function parseDashboardAutoRefreshInterval(value: unknown): AutoRefreshInterval | null;
@@ -2,6 +2,7 @@ import { AutoRefreshInterval } from "./DashboardViewConfig";
2
2
  import { DashboardSetting } from "./DashboardViewerChoice";
3
3
  export declare const DASHBOARD_AUTO_REFRESH_FIELD: string;
4
4
  export declare const DASHBOARD_AUTO_REFRESH_FALLBACK: AutoRefreshInterval;
5
+ export declare function formatAutoRefreshInterval(interval: AutoRefreshInterval, language?: string | undefined): string | null;
5
6
  export declare const DASHBOARD_AUTO_REFRESH_INTERVALS: ReadonlyArray<AutoRefreshInterval>;
6
7
  export declare function isDashboardAutoRefreshInterval(value: unknown): value is AutoRefreshInterval;
7
8
  export declare function parseDashboardAutoRefreshInterval(value: unknown): AutoRefreshInterval | null;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DASHBOARD_AUTO_REFRESH_LINK_PARAMETER = exports.DASHBOARD_AUTO_REFRESH_PROBLEM = exports.DASHBOARD_AUTO_REFRESH_INTERVALS = exports.DASHBOARD_AUTO_REFRESH_FALLBACK = exports.DASHBOARD_AUTO_REFRESH_FIELD = void 0;
4
+ exports.formatAutoRefreshInterval = formatAutoRefreshInterval;
4
5
  exports.isDashboardAutoRefreshInterval = isDashboardAutoRefreshInterval;
5
6
  exports.parseDashboardAutoRefreshInterval = parseDashboardAutoRefreshInterval;
6
7
  exports.getDashboardAutoRefreshProblem = getDashboardAutoRefreshProblem;
@@ -8,6 +9,7 @@ exports.parseDashboardLinkAutoRefreshInterval = parseDashboardLinkAutoRefreshInt
8
9
  exports.getDashboardLinkAutoRefreshIntervalFromSearch = getDashboardLinkAutoRefreshIntervalFromSearch;
9
10
  exports.getDashboardAutoRefreshInterval = getDashboardAutoRefreshInterval;
10
11
  const DashboardViewConfig_1 = require("./DashboardViewConfig");
12
+ const SloDuration_1 = require("../../Utils/Slo/SloDuration");
11
13
  const DashboardViewerChoice_1 = require("./DashboardViewerChoice");
12
14
  /*
13
15
  * A dashboard's auto-refresh: how often every widget on it reads its data
@@ -41,6 +43,25 @@ const DashboardViewerChoice_1 = require("./DashboardViewerChoice");
41
43
  exports.DASHBOARD_AUTO_REFRESH_FIELD = "refreshInterval";
42
44
  // What a dashboard that names no auto-refresh opens with: off.
43
45
  exports.DASHBOARD_AUTO_REFRESH_FALLBACK = DashboardViewConfig_1.AutoRefreshInterval.OFF;
46
+ /*
47
+ * An interval as the auto-refresh pickers name it, in `language`: "30s" and
48
+ * "1m" in English - getAutoRefreshIntervalLabel's short forms, word for word
49
+ * - and the language's own short duration elsewhere: "30 Sek." in German,
50
+ * "۳۰ ثانیه" in Persian, "30 秒" in Japanese. It goes into a sentence
51
+ * ("Every {{interval}}") in that sentence's language: a Persian picker read
52
+ * "هر 30s", English digits and letters beside Persian ones everywhere else
53
+ * on the page.
54
+ *
55
+ * Off is no duration: null, and the picker says Off in its own words.
56
+ * Without a language, the page's (the date display language).
57
+ */
58
+ function formatAutoRefreshInterval(interval, language) {
59
+ const intervalMs = (0, DashboardViewConfig_1.getAutoRefreshIntervalInMs)(interval);
60
+ if (intervalMs === null) {
61
+ return null;
62
+ }
63
+ return (0, SloDuration_1.formatDurationCompactInLanguage)(intervalMs / 1000, language);
64
+ }
44
65
  // The intervals, in the order the auto-refresh menu offers them.
45
66
  exports.DASHBOARD_AUTO_REFRESH_INTERVALS = [
46
67
  DashboardViewConfig_1.AutoRefreshInterval.OFF,
@@ -4,6 +4,7 @@ export const DASHBOARD_AUTO_REFRESH_FIELD = commonJsModule.DASHBOARD_AUTO_REFRES
4
4
  export const DASHBOARD_AUTO_REFRESH_INTERVALS = commonJsModule.DASHBOARD_AUTO_REFRESH_INTERVALS;
5
5
  export const DASHBOARD_AUTO_REFRESH_LINK_PARAMETER = commonJsModule.DASHBOARD_AUTO_REFRESH_LINK_PARAMETER;
6
6
  export const DASHBOARD_AUTO_REFRESH_PROBLEM = commonJsModule.DASHBOARD_AUTO_REFRESH_PROBLEM;
7
+ export const formatAutoRefreshInterval = commonJsModule.formatAutoRefreshInterval;
7
8
  export const getDashboardAutoRefreshInterval = commonJsModule.getDashboardAutoRefreshInterval;
8
9
  export const getDashboardAutoRefreshProblem = commonJsModule.getDashboardAutoRefreshProblem;
9
10
  export const getDashboardLinkAutoRefreshIntervalFromSearch = commonJsModule.getDashboardLinkAutoRefreshIntervalFromSearch;
package/Types/Date.d.mts CHANGED
@@ -12,6 +12,11 @@ export interface ExactUnixNano {
12
12
  export declare const DATE_TIME_SEPARATOR: string;
13
13
  export declare const ARABIC_DATE_TIME_SEPARATOR: string;
14
14
  export type CalendarUnit = "hour" | "day" | "week" | "month" | "year";
15
+ export interface FriendlyTimeOptions {
16
+ maxUnits?: number | undefined;
17
+ writesZero?: boolean | undefined;
18
+ }
19
+ export declare const ZERO_FRIENDLY_TIME_TEXT: string;
15
20
  export default class OneUptimeDate {
16
21
  private static userTimezone;
17
22
  private static padDatePart;
@@ -351,7 +356,7 @@ export default class OneUptimeDate {
351
356
  static getSomeDaysAfter(days: PositiveNumber | number): Date;
352
357
  static secondsToFormattedTimeString(seconds: number): string;
353
358
  static toUnixTimestamp(date: Date): number;
354
- static secondsToFormattedFriendlyTimeString(seconds: number): string;
359
+ static secondsToFormattedFriendlyTimeString(seconds: number, options?: FriendlyTimeOptions | undefined): string;
355
360
  private static getFriendlyTimeParts;
356
361
  static getGreaterDate(a: Date, b: Date): Date;
357
362
  static getLesserDate(a: Date, b: Date): Date;
package/Types/Date.d.ts CHANGED
@@ -12,6 +12,11 @@ export interface ExactUnixNano {
12
12
  export declare const DATE_TIME_SEPARATOR: string;
13
13
  export declare const ARABIC_DATE_TIME_SEPARATOR: string;
14
14
  export type CalendarUnit = "hour" | "day" | "week" | "month" | "year";
15
+ export interface FriendlyTimeOptions {
16
+ maxUnits?: number | undefined;
17
+ writesZero?: boolean | undefined;
18
+ }
19
+ export declare const ZERO_FRIENDLY_TIME_TEXT: string;
15
20
  export default class OneUptimeDate {
16
21
  private static userTimezone;
17
22
  private static padDatePart;
@@ -351,7 +356,7 @@ export default class OneUptimeDate {
351
356
  static getSomeDaysAfter(days: PositiveNumber | number): Date;
352
357
  static secondsToFormattedTimeString(seconds: number): string;
353
358
  static toUnixTimestamp(date: Date): number;
354
- static secondsToFormattedFriendlyTimeString(seconds: number): string;
359
+ static secondsToFormattedFriendlyTimeString(seconds: number, options?: FriendlyTimeOptions | undefined): string;
355
360
  private static getFriendlyTimeParts;
356
361
  static getGreaterDate(a: Date, b: Date): Date;
357
362
  static getLesserDate(a: Date, b: Date): Date;