@oneuptime/common 14.0.102 → 14.0.103

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 (208) hide show
  1. package/Models/DatabaseModels/Index.js +6 -0
  2. package/Models/DatabaseModels/LogSavedView.d.mts +1 -0
  3. package/Models/DatabaseModels/LogSavedView.d.ts +1 -0
  4. package/Models/DatabaseModels/LogSavedView.js +43 -1
  5. package/Models/DatabaseModels/NetworkControllerConnection.d.mts +1 -0
  6. package/Models/DatabaseModels/NetworkControllerConnection.d.ts +1 -0
  7. package/Models/DatabaseModels/NetworkControllerConnection.js +21 -0
  8. package/Models/DatabaseModels/Project.d.mts +3 -0
  9. package/Models/DatabaseModels/Project.d.ts +3 -0
  10. package/Models/DatabaseModels/Project.js +124 -0
  11. package/Models/DatabaseModels/Runner.d.mts +1 -0
  12. package/Models/DatabaseModels/Runner.d.ts +1 -0
  13. package/Models/DatabaseModels/Runner.js +40 -0
  14. package/Models/DatabaseModels/SecurityCase.d.mts +2 -1
  15. package/Models/DatabaseModels/SecurityCase.d.ts +2 -1
  16. package/Models/DatabaseModels/SecurityCase.js +27 -0
  17. package/Models/DatabaseModels/SecurityCaseCustomField.d.mts +20 -0
  18. package/Models/DatabaseModels/SecurityCaseCustomField.d.ts +20 -0
  19. package/Models/DatabaseModels/SecurityCaseCustomField.js +387 -0
  20. package/Models/DatabaseModels/SecurityCaseCustomField.mjs +2 -0
  21. package/Models/DatabaseModels/SecurityCaseNoteTemplate.d.mts +15 -0
  22. package/Models/DatabaseModels/SecurityCaseNoteTemplate.d.ts +15 -0
  23. package/Models/DatabaseModels/SecurityCaseNoteTemplate.js +309 -0
  24. package/Models/DatabaseModels/SecurityCaseNoteTemplate.mjs +2 -0
  25. package/Models/DatabaseModels/WorkspaceHomeChoice.d.mts +11 -0
  26. package/Models/DatabaseModels/WorkspaceHomeChoice.d.ts +11 -0
  27. package/Models/DatabaseModels/WorkspaceHomeChoice.js +186 -0
  28. package/Models/DatabaseModels/WorkspaceHomeChoice.mjs +2 -0
  29. package/Types/AI/AIFixReadiness.d.mts +2 -0
  30. package/Types/AI/AIFixReadiness.d.ts +2 -0
  31. package/Types/AI/AIFixReadiness.js +0 -6
  32. package/Types/AI/CodeTask.d.mts +3 -1
  33. package/Types/AI/CodeTask.d.ts +3 -1
  34. package/Types/AI/CodeTask.js +12 -0
  35. package/Types/CustomField/CustomFieldRecordKinds.js +5 -0
  36. package/Types/CustomField/CustomFieldSavedViews.js +2 -0
  37. package/Types/DateLanguage.js +3 -2
  38. package/Types/DockerSwarm/DockerSwarmInventoryExtractor.d.mts +1 -0
  39. package/Types/DockerSwarm/DockerSwarmInventoryExtractor.d.ts +1 -0
  40. package/Types/DockerSwarm/DockerSwarmInventoryExtractor.js +84 -6
  41. package/Types/DockerSwarm/DockerSwarmInventoryExtractor.mjs +1 -0
  42. package/Types/InstallScripts/InstallScripts.d.mts +1 -0
  43. package/Types/InstallScripts/InstallScripts.d.ts +1 -0
  44. package/Types/InstallScripts/InstallScripts.js +14 -0
  45. package/Types/Monitor/DockerSwarmAlertTemplates.d.mts +15 -0
  46. package/Types/Monitor/DockerSwarmAlertTemplates.d.ts +15 -0
  47. package/Types/Monitor/DockerSwarmAlertTemplates.js +168 -0
  48. package/Types/Monitor/DockerSwarmAlertTemplates.mjs +1 -0
  49. package/Types/Monitor/DockerSwarmMetricCatalog.d.mts +1 -1
  50. package/Types/Monitor/DockerSwarmMetricCatalog.d.ts +1 -1
  51. package/Types/Monitor/DockerSwarmMetricCatalog.js +43 -11
  52. package/Types/Monitor/SeriesContext/SeriesDebugHints.js +19 -0
  53. package/Types/NetworkController/NetworkControllerDeviceAdd.d.mts +70 -0
  54. package/Types/NetworkController/NetworkControllerDeviceAdd.d.ts +70 -0
  55. package/Types/NetworkController/NetworkControllerDeviceAdd.js +389 -0
  56. package/Types/NetworkController/NetworkControllerDeviceAdd.mjs +26 -0
  57. package/Types/NetworkController/NetworkControllerReadSummary.d.mts +2 -0
  58. package/Types/NetworkController/NetworkControllerReadSummary.d.ts +2 -0
  59. package/Types/NetworkController/NetworkControllerReadSummary.js +6 -1
  60. package/Types/NetworkDevice/NetworkTopologyLayout.d.mts +8 -0
  61. package/Types/NetworkDevice/NetworkTopologyLayout.d.ts +8 -0
  62. package/Types/NetworkDevice/NetworkTopologyLayout.js +49 -0
  63. package/Types/NetworkDevice/NetworkTopologyLayout.mjs +3 -0
  64. package/Types/Permission.d.mts +8 -0
  65. package/Types/Permission.d.ts +8 -0
  66. package/Types/Permission.js +87 -3
  67. package/Types/PushNotification/PushNotificationCategory.d.mts +3 -0
  68. package/Types/PushNotification/PushNotificationCategory.d.ts +3 -0
  69. package/Types/PushNotification/PushNotificationCategory.js +38 -0
  70. package/Types/PushNotification/PushNotificationCategory.mjs +4 -0
  71. package/Types/PushNotification/PushNotificationMessage.d.mts +1 -0
  72. package/Types/PushNotification/PushNotificationMessage.d.ts +1 -0
  73. package/Types/Runner/RunnerCodeFixes.d.mts +22 -0
  74. package/Types/Runner/RunnerCodeFixes.d.ts +22 -0
  75. package/Types/Runner/RunnerCodeFixes.js +129 -0
  76. package/Types/Runner/RunnerCodeFixes.mjs +9 -0
  77. package/Types/SecurityCase/SecurityCaseNumber.js +8 -4
  78. package/Types/SecurityEvent/MitreAttack.d.mts +2 -0
  79. package/Types/SecurityEvent/MitreAttack.d.ts +2 -0
  80. package/Types/SecurityEvent/MitreAttack.js +26 -0
  81. package/Types/SecurityEvent/MitreAttack.mjs +2 -0
  82. package/Types/SecurityEvent/OcsfSeverity.js +10 -1
  83. package/Types/Telemetry/TelemetrySearchQuery.js +14 -2
  84. package/Types/Workspace/WorkspaceMessagePayload.d.mts +7 -0
  85. package/Types/Workspace/WorkspaceMessagePayload.d.ts +7 -0
  86. package/Utils/CronScheduleText.d.mts +3 -0
  87. package/Utils/CronScheduleText.d.ts +3 -0
  88. package/Utils/CronScheduleText.js +307 -0
  89. package/Utils/CronScheduleText.mjs +3 -0
  90. package/Utils/Dashboard/DashboardBoardLayout.d.mts +2 -0
  91. package/Utils/Dashboard/DashboardBoardLayout.d.ts +2 -0
  92. package/Utils/Dashboard/DashboardBoardLayout.js +17 -4
  93. package/Utils/Dashboard/DashboardBoardLayout.mjs +1 -0
  94. package/Utils/DeveloperDocs/CliCommands.d.mts +114 -0
  95. package/Utils/DeveloperDocs/CliCommands.d.ts +114 -0
  96. package/Utils/DeveloperDocs/CliCommands.js +750 -0
  97. package/Utils/DeveloperDocs/CliCommands.mjs +37 -0
  98. package/Utils/DeveloperDocs/CliExamples.d.mts +59 -0
  99. package/Utils/DeveloperDocs/CliExamples.d.ts +59 -0
  100. package/Utils/DeveloperDocs/CliExamples.js +348 -0
  101. package/Utils/DeveloperDocs/CliExamples.mjs +17 -0
  102. package/Utils/DeveloperDocs/CliResources.d.mts +18 -0
  103. package/Utils/DeveloperDocs/CliResources.d.ts +18 -0
  104. package/Utils/DeveloperDocs/CliResources.js +129 -0
  105. package/Utils/DeveloperDocs/CliResources.mjs +6 -0
  106. package/Utils/DeveloperDocs/ExampleBuilder.d.mts +6 -0
  107. package/Utils/DeveloperDocs/ExampleBuilder.d.ts +6 -0
  108. package/Utils/DeveloperDocs/ExampleBuilder.js +27 -2
  109. package/Utils/DeveloperDocs/ExampleBuilder.mjs +1 -0
  110. package/Utils/DeveloperDocs/PageLookups.d.mts +1 -1
  111. package/Utils/DeveloperDocs/PageLookups.d.ts +1 -1
  112. package/Utils/DeveloperDocs/PageLookups.js +9 -2
  113. package/Utils/DeveloperDocs/TerraformSchema.d.mts +1 -0
  114. package/Utils/DeveloperDocs/TerraformSchema.d.ts +1 -0
  115. package/Utils/DeveloperDocs/TerraformSchema.js +3 -1
  116. package/Utils/DeveloperDocs/TerraformSchema.mjs +1 -0
  117. package/Utils/LookupTable.d.mts +3 -0
  118. package/Utils/LookupTable.d.ts +3 -0
  119. package/Utils/LookupTable.js +44 -0
  120. package/Utils/LookupTable.mjs +4 -0
  121. package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +62 -0
  122. package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +62 -0
  123. package/Utils/Monitor/MonitorCheckScheduleUtil.js +484 -0
  124. package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +3 -0
  125. package/Utils/Monitor/MonitorOverviewFamily.d.mts +39 -0
  126. package/Utils/Monitor/MonitorOverviewFamily.d.ts +39 -0
  127. package/Utils/Monitor/MonitorOverviewFamily.js +207 -0
  128. package/Utils/Monitor/MonitorOverviewFamily.mjs +4 -0
  129. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +192 -0
  130. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +192 -0
  131. package/Utils/Monitor/MonitorOverviewPresentationUtil.js +1659 -0
  132. package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +5 -0
  133. package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +112 -0
  134. package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +112 -0
  135. package/Utils/Monitor/MonitorOverviewProbeUtil.js +640 -0
  136. package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +3 -0
  137. package/Utils/Monitor/MonitorOverviewTargetUtil.d.mts +1 -1
  138. package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +1 -1
  139. package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +27 -0
  140. package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +27 -0
  141. package/Utils/Monitor/MonitorStatusHistoryUtil.js +132 -0
  142. package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +2 -0
  143. package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +44 -0
  144. package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +44 -0
  145. package/Utils/Monitor/MonitorUptimeSummaryUtil.js +487 -0
  146. package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +2 -0
  147. package/Utils/OldestKeyMap.d.mts +10 -0
  148. package/Utils/OldestKeyMap.d.ts +10 -0
  149. package/Utils/OldestKeyMap.js +91 -0
  150. package/Utils/OldestKeyMap.mjs +2 -0
  151. package/Utils/Project/NextNumber.d.mts +4 -3
  152. package/Utils/Project/NextNumber.d.ts +4 -3
  153. package/Utils/Project/NextNumber.js +11 -2
  154. package/Utils/Project/NumberPrefix.d.mts +1 -1
  155. package/Utils/Project/NumberPrefix.d.ts +1 -1
  156. package/Utils/Project/NumberPrefix.js +12 -0
  157. package/Utils/Schema/AnalyticsModelSchema.d.mts +48 -0
  158. package/Utils/Schema/AnalyticsModelSchema.d.ts +48 -0
  159. package/Utils/Schema/AnalyticsModelSchema.js +767 -0
  160. package/Utils/Schema/AnalyticsModelSchema.mjs +2 -0
  161. package/Utils/Schema/BaseSchema.d.mts +117 -0
  162. package/Utils/Schema/BaseSchema.d.ts +117 -0
  163. package/Utils/Schema/BaseSchema.js +257 -0
  164. package/Utils/Schema/BaseSchema.mjs +3 -0
  165. package/Utils/Schema/ModelSchema.d.mts +80 -0
  166. package/Utils/Schema/ModelSchema.d.ts +80 -0
  167. package/Utils/Schema/ModelSchema.js +1727 -0
  168. package/Utils/Schema/ModelSchema.mjs +2 -0
  169. package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.d.mts +0 -1
  170. package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.d.ts +0 -1
  171. package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.js +9 -25
  172. package/Utils/SecurityEvent/Connectors/AwsSecurityHubNormalizer.mjs +0 -1
  173. package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.mts +1 -1
  174. package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.d.ts +1 -1
  175. package/Utils/SecurityEvent/Connectors/EntraIdNormalizer.js +7 -6
  176. package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.mts +1 -1
  177. package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.d.ts +1 -1
  178. package/Utils/SecurityEvent/Connectors/GoogleWorkspaceNormalizer.js +10 -9
  179. package/Utils/SecurityEvent/Connectors/Microsoft365AuditNormalizer.js +4 -3
  180. package/Utils/SecurityEvent/Connectors/MicrosoftDefenderXdrNormalizer.js +12 -28
  181. package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.d.mts +1 -1
  182. package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.d.ts +1 -1
  183. package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.js +13 -24
  184. package/Utils/SecurityEvent/Connectors/MicrosoftSentinelNormalizer.mjs +1 -1
  185. package/Utils/SecurityEvent/Connectors/OktaNormalizer.d.mts +2 -2
  186. package/Utils/SecurityEvent/Connectors/OktaNormalizer.d.ts +2 -2
  187. package/Utils/SecurityEvent/Connectors/OktaNormalizer.js +7 -6
  188. package/Utils/SecurityEvent/Connectors/SplunkNormalizer.js +7 -26
  189. package/Utils/SecurityEvent/LogParsers/AzureActivityLogParser.js +4 -3
  190. package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.mts +2 -2
  191. package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.d.ts +2 -2
  192. package/Utils/SecurityEvent/LogParsers/WindowsEventLogParser.js +26 -16
  193. package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.mts +1 -1
  194. package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.d.ts +1 -1
  195. package/Utils/SecurityEvent/LogParsers/WindowsEventRecord.js +10 -6
  196. package/Utils/SecurityEvent/SecurityEventNormalizer.js +17 -11
  197. package/Utils/SecurityEvent/SecurityEventSearch.js +8 -1
  198. package/Utils/SecurityEvent/Sigma/SigmaRuleSetParser.js +4 -5
  199. package/Utils/SecurityEvent/ThreatIntel/StixPatternParser.js +7 -3
  200. package/Utils/SecurityEvent/UdmNormalizer.js +10 -6
  201. package/Utils/Telemetry/SavedViewDefault.js +4 -3
  202. package/Utils/Telemetry/SavedViewScope.d.mts +33 -0
  203. package/Utils/Telemetry/SavedViewScope.d.ts +33 -0
  204. package/Utils/Telemetry/SavedViewScope.js +105 -0
  205. package/Utils/Telemetry/SavedViewScope.mjs +7 -0
  206. package/package.json +1 -11
  207. package/UI/Utils/TranslateTemplate.d.mts +0 -8
  208. package/UI/Utils/TranslateTemplate.d.ts +0 -8
@@ -0,0 +1,37 @@
1
+ import commonJsModule from "./CliCommands.js";
2
+ export const CLI_ACTIONS = commonJsModule.CLI_ACTIONS;
3
+ export const CLI_FIELDS_SUBCOMMAND = commonJsModule.CLI_FIELDS_SUBCOMMAND;
4
+ export const CLI_MINIMUM_NODE_MAJOR_VERSION = commonJsModule.CLI_MINIMUM_NODE_MAJOR_VERSION;
5
+ export const CLI_NOTE_COLUMN = commonJsModule.CLI_NOTE_COLUMN;
6
+ export const CLI_NOTE_TARGETS = commonJsModule.CLI_NOTE_TARGETS;
7
+ export const CLI_OPERATIONS = commonJsModule.CLI_OPERATIONS;
8
+ export const CLI_RESERVED_FLAGS = commonJsModule.CLI_RESERVED_FLAGS;
9
+ export const CLI_STATE_MACHINES = commonJsModule.CLI_STATE_MACHINES;
10
+ export const CliAction = commonJsModule.CliAction;
11
+ export const CliOperation = commonJsModule.CliOperation;
12
+ export const CliValueError = commonJsModule.CliValueError;
13
+ export const ONEUPTIME_CLI_COMMAND = commonJsModule.ONEUPTIME_CLI_COMMAND;
14
+ export const ONEUPTIME_CLI_PACKAGE = commonJsModule.ONEUPTIME_CLI_PACKAGE;
15
+ export const ONEUPTIME_URL_ENVIRONMENT_VARIABLE = commonJsModule.ONEUPTIME_URL_ENVIRONMENT_VARIABLE;
16
+ export const getCliActions = commonJsModule.getCliActions;
17
+ export const getCliAnalyticsFields = commonJsModule.getCliAnalyticsFields;
18
+ export const getCliAnalyticsOperations = commonJsModule.getCliAnalyticsOperations;
19
+ export const getCliAnalyticsOperationsOf = commonJsModule.getCliAnalyticsOperationsOf;
20
+ export const getCliDatabaseOperations = commonJsModule.getCliDatabaseOperations;
21
+ export const getCliDatabaseOperationsOf = commonJsModule.getCliDatabaseOperationsOf;
22
+ export const getCliFieldFlagHelp = commonJsModule.getCliFieldFlagHelp;
23
+ export const getCliFieldFlags = commonJsModule.getCliFieldFlags;
24
+ export const getCliFieldFlagsFor = commonJsModule.getCliFieldFlagsFor;
25
+ export const getCliNoteTarget = commonJsModule.getCliNoteTarget;
26
+ export const getCliResourceName = commonJsModule.getCliResourceName;
27
+ export const getCliStateMachine = commonJsModule.getCliStateMachine;
28
+ export const getModelApiPathOf = commonJsModule.getModelApiPathOf;
29
+ export const isAnalyticsColumnReadable = commonJsModule.isAnalyticsColumnReadable;
30
+ export const isAnalyticsModelInPublicApi = commonJsModule.isAnalyticsModelInPublicApi;
31
+ export const isCliFieldFlagAllowed = commonJsModule.isCliFieldFlagAllowed;
32
+ export const isCliServerSetColumn = commonJsModule.isCliServerSetColumn;
33
+ export const parseCliFieldValue = commonJsModule.parseCliFieldValue;
34
+ export const parseCliList = commonJsModule.parseCliList;
35
+ export const toCliCommandName = commonJsModule.toCliCommandName;
36
+ export const toCliFlag = commonJsModule.toCliFlag;
37
+ export const toCommanderAttributeName = commonJsModule.toCommanderAttributeName;
@@ -0,0 +1,59 @@
1
+ import { DatabaseBaseModelType } from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.mjs";
2
+ import { JSONObject } from "../../Types/JSON.mjs";
3
+ import { CliAction, CliOperation } from "./CliCommands.mjs";
4
+ export interface CliExample {
5
+ args: Array<string>;
6
+ command: string;
7
+ }
8
+ export declare const CLI_EXAMPLE_LINE_LIMIT: number;
9
+ export declare function formatCliCommand(args: Array<string>): string;
10
+ export declare function getCliCommandOf(modelType: DatabaseBaseModelType): string;
11
+ export declare function getCliWriteArgs(data: {
12
+ modelType: DatabaseBaseModelType;
13
+ operation: CliOperation.Create | CliOperation.Update;
14
+ values: JSONObject;
15
+ emailsById?: Readonly<Record<string, string>> | undefined;
16
+ }): Array<string>;
17
+ export declare function getCliCreateExample(data: {
18
+ modelType: DatabaseBaseModelType;
19
+ values: JSONObject;
20
+ emailsById?: Readonly<Record<string, string>> | undefined;
21
+ }): CliExample;
22
+ export declare function getCliUpdateExample(data: {
23
+ modelType: DatabaseBaseModelType;
24
+ id: string;
25
+ values: JSONObject;
26
+ emailsById?: Readonly<Record<string, string>> | undefined;
27
+ }): CliExample;
28
+ export declare function getCliListExample(data: {
29
+ modelType: DatabaseBaseModelType;
30
+ query?: JSONObject | undefined;
31
+ select?: JSONObject | undefined;
32
+ sort?: JSONObject | undefined;
33
+ limit?: number | undefined;
34
+ }): CliExample;
35
+ export declare function getCliGetExample(data: {
36
+ modelType: DatabaseBaseModelType;
37
+ id: string;
38
+ select?: JSONObject | undefined;
39
+ }): CliExample;
40
+ export declare function getCliCountExample(data: {
41
+ modelType: DatabaseBaseModelType;
42
+ query?: JSONObject | undefined;
43
+ }): CliExample;
44
+ export declare function getCliDeleteExample(data: {
45
+ modelType: DatabaseBaseModelType;
46
+ id: string;
47
+ }): CliExample;
48
+ export declare function getCliFieldsExample(modelType: DatabaseBaseModelType): CliExample;
49
+ export declare function getCliActionExample(data: {
50
+ modelType: DatabaseBaseModelType;
51
+ action: CliAction;
52
+ id: string;
53
+ note?: string | undefined;
54
+ isPublic?: boolean | undefined;
55
+ }): CliExample;
56
+ export declare function getCliInstallScriptCommands(oneuptimeUrl: string): string;
57
+ export declare function getCliNpmInstallCommand(platformVersion: string | null): string;
58
+ export declare function getCliConnectCommands(oneuptimeUrl: string): string;
59
+ export declare function getCliLoginCommand(oneuptimeUrl: string): string;
@@ -0,0 +1,59 @@
1
+ import { DatabaseBaseModelType } from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
2
+ import { JSONObject } from "../../Types/JSON";
3
+ import { CliAction, CliOperation } from "./CliCommands";
4
+ export interface CliExample {
5
+ args: Array<string>;
6
+ command: string;
7
+ }
8
+ export declare const CLI_EXAMPLE_LINE_LIMIT: number;
9
+ export declare function formatCliCommand(args: Array<string>): string;
10
+ export declare function getCliCommandOf(modelType: DatabaseBaseModelType): string;
11
+ export declare function getCliWriteArgs(data: {
12
+ modelType: DatabaseBaseModelType;
13
+ operation: CliOperation.Create | CliOperation.Update;
14
+ values: JSONObject;
15
+ emailsById?: Readonly<Record<string, string>> | undefined;
16
+ }): Array<string>;
17
+ export declare function getCliCreateExample(data: {
18
+ modelType: DatabaseBaseModelType;
19
+ values: JSONObject;
20
+ emailsById?: Readonly<Record<string, string>> | undefined;
21
+ }): CliExample;
22
+ export declare function getCliUpdateExample(data: {
23
+ modelType: DatabaseBaseModelType;
24
+ id: string;
25
+ values: JSONObject;
26
+ emailsById?: Readonly<Record<string, string>> | undefined;
27
+ }): CliExample;
28
+ export declare function getCliListExample(data: {
29
+ modelType: DatabaseBaseModelType;
30
+ query?: JSONObject | undefined;
31
+ select?: JSONObject | undefined;
32
+ sort?: JSONObject | undefined;
33
+ limit?: number | undefined;
34
+ }): CliExample;
35
+ export declare function getCliGetExample(data: {
36
+ modelType: DatabaseBaseModelType;
37
+ id: string;
38
+ select?: JSONObject | undefined;
39
+ }): CliExample;
40
+ export declare function getCliCountExample(data: {
41
+ modelType: DatabaseBaseModelType;
42
+ query?: JSONObject | undefined;
43
+ }): CliExample;
44
+ export declare function getCliDeleteExample(data: {
45
+ modelType: DatabaseBaseModelType;
46
+ id: string;
47
+ }): CliExample;
48
+ export declare function getCliFieldsExample(modelType: DatabaseBaseModelType): CliExample;
49
+ export declare function getCliActionExample(data: {
50
+ modelType: DatabaseBaseModelType;
51
+ action: CliAction;
52
+ id: string;
53
+ note?: string | undefined;
54
+ isPublic?: boolean | undefined;
55
+ }): CliExample;
56
+ export declare function getCliInstallScriptCommands(oneuptimeUrl: string): string;
57
+ export declare function getCliNpmInstallCommand(platformVersion: string | null): string;
58
+ export declare function getCliConnectCommands(oneuptimeUrl: string): string;
59
+ export declare function getCliLoginCommand(oneuptimeUrl: string): string;
@@ -0,0 +1,348 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLI_EXAMPLE_LINE_LIMIT = void 0;
4
+ exports.formatCliCommand = formatCliCommand;
5
+ exports.getCliCommandOf = getCliCommandOf;
6
+ exports.getCliWriteArgs = getCliWriteArgs;
7
+ exports.getCliCreateExample = getCliCreateExample;
8
+ exports.getCliUpdateExample = getCliUpdateExample;
9
+ exports.getCliListExample = getCliListExample;
10
+ exports.getCliGetExample = getCliGetExample;
11
+ exports.getCliCountExample = getCliCountExample;
12
+ exports.getCliDeleteExample = getCliDeleteExample;
13
+ exports.getCliFieldsExample = getCliFieldsExample;
14
+ exports.getCliActionExample = getCliActionExample;
15
+ exports.getCliInstallScriptCommands = getCliInstallScriptCommands;
16
+ exports.getCliNpmInstallCommand = getCliNpmInstallCommand;
17
+ exports.getCliConnectCommands = getCliConnectCommands;
18
+ exports.getCliLoginCommand = getCliLoginCommand;
19
+ const InstallScripts_1 = require("../../Types/InstallScripts/InstallScripts");
20
+ const ApiExamples_1 = require("./ApiExamples");
21
+ const CliCommands_1 = require("./CliCommands");
22
+ const ExampleValues_1 = require("./ExampleValues");
23
+ const TerraformSchema_1 = require("./TerraformSchema");
24
+ /*
25
+ * How long a command may be on one line; a longer one goes a flag a line,
26
+ * as the curl commands do, so a code block beside the side menu never
27
+ * hides its end behind a sideways scroll.
28
+ */
29
+ exports.CLI_EXAMPLE_LINE_LIMIT = 72;
30
+ // A flag's line, after the first, starts here.
31
+ const FLAG_INDENT = " ";
32
+ const CONTINUATION = ` \\\n${FLAG_INDENT}`;
33
+ // The words, quoted, on one line or a flag (with its value) a line.
34
+ function formatCliCommand(args) {
35
+ const words = [CliCommands_1.ONEUPTIME_CLI_COMMAND, ...args].map((word) => {
36
+ return (0, ApiExamples_1.shellQuote)(word);
37
+ });
38
+ const oneLine = words.join(" ");
39
+ if (oneLine.length <= exports.CLI_EXAMPLE_LINE_LIMIT) {
40
+ return oneLine;
41
+ }
42
+ const lines = [];
43
+ for (const word of words) {
44
+ if (word.startsWith("--") || lines.length === 0) {
45
+ lines.push(word);
46
+ }
47
+ else {
48
+ lines[lines.length - 1] = `${lines[lines.length - 1]} ${word}`;
49
+ }
50
+ }
51
+ return lines.join(CONTINUATION);
52
+ }
53
+ // The flags whose values are JSON, whatever the resource.
54
+ const JSON_VALUE_FLAGS = ["--query", "--sort", "--data"];
55
+ const JSON_INDENT = 2;
56
+ /*
57
+ * A JSON value too long for its flag's line, written as the curl commands
58
+ * write a body: a key a line, indented under its flag. On one line,
59
+ * --monitor-steps (every criterion of a monitor) ran 14,000 pixels past
60
+ * the code block's edge. The shell hands the CLI the value with its line
61
+ * breaks, and JSON allows them, so the request is the same.
62
+ */
63
+ function laidOutJson(text) {
64
+ try {
65
+ return JSON.stringify(JSON.parse(text), null, JSON_INDENT)
66
+ .split("\n")
67
+ .join(`\n${FLAG_INDENT}`);
68
+ }
69
+ catch (_a) {
70
+ return text;
71
+ }
72
+ }
73
+ /*
74
+ * The words the CLI is given and the command a reader copies, which reads
75
+ * back as those very words: a long command goes a flag a line, and in it a
76
+ * long JSON value (after one of `jsonFlags`) a key a line.
77
+ */
78
+ function example(args, jsonFlags = JSON_VALUE_FLAGS) {
79
+ if (!formatCliCommand(args).includes("\n")) {
80
+ return { args, command: formatCliCommand(args) };
81
+ }
82
+ const laidOut = args.map((word, index) => {
83
+ const flag = args[index - 1];
84
+ const line = `${FLAG_INDENT}${flag} ${(0, ApiExamples_1.shellQuote)(word)} \\`;
85
+ return flag &&
86
+ jsonFlags.includes(flag) &&
87
+ line.length > exports.CLI_EXAMPLE_LINE_LIMIT
88
+ ? laidOutJson(word)
89
+ : word;
90
+ });
91
+ return { args: laidOut, command: formatCliCommand(laidOut) };
92
+ }
93
+ // A write's JSON flags: --data, and the flags of fields that hold JSON.
94
+ function writeJsonFlags(modelType, operation) {
95
+ return [
96
+ ...JSON_VALUE_FLAGS,
97
+ ...(0, CliCommands_1.getCliFieldFlagsFor)(modelType, operation)
98
+ .filter((flag) => {
99
+ return (flag.kind === TerraformSchema_1.TerraformValueKind.Json ||
100
+ flag.kind === TerraformSchema_1.TerraformValueKind.MonitorSteps);
101
+ })
102
+ .map((flag) => {
103
+ return flag.flag;
104
+ }),
105
+ ];
106
+ }
107
+ function getCliCommandOf(modelType) {
108
+ return (0, CliCommands_1.getCliResourceName)(new modelType());
109
+ }
110
+ const JSON_FLAG = "--json";
111
+ // An ID as the API's JSON may carry it: "x", {"_id": "x"} or {"value": "x"}.
112
+ function idOf(value) {
113
+ var _a;
114
+ if (typeof value === "string") {
115
+ return value;
116
+ }
117
+ if (value && typeof value === "object" && !Array.isArray(value)) {
118
+ const wrapped = value;
119
+ const id = (_a = wrapped["_id"]) !== null && _a !== void 0 ? _a : wrapped["value"];
120
+ return typeof id === "string" ? id : null;
121
+ }
122
+ return null;
123
+ }
124
+ const COMMA = ",";
125
+ /*
126
+ * A field's value as its flag writes it: IDs and words separated by commas
127
+ * (a JSON array when one holds a comma), JSON as JSON, the rest as text.
128
+ * Undefined when the flag cannot carry it, so it goes in --data.
129
+ */
130
+ function toFlagText(flag, value) {
131
+ switch (flag.kind) {
132
+ case TerraformSchema_1.TerraformValueKind.IdSet: {
133
+ if (!Array.isArray(value)) {
134
+ return undefined;
135
+ }
136
+ const ids = value.map(idOf);
137
+ if (ids.some((id) => {
138
+ return !id;
139
+ })) {
140
+ return undefined;
141
+ }
142
+ return ids.join(COMMA);
143
+ }
144
+ case TerraformSchema_1.TerraformValueKind.StringSet: {
145
+ if (!Array.isArray(value)) {
146
+ return undefined;
147
+ }
148
+ const words = value.map(String);
149
+ return words.some((word) => {
150
+ return word.includes(COMMA);
151
+ })
152
+ ? JSON.stringify(words)
153
+ : words.join(COMMA);
154
+ }
155
+ case TerraformSchema_1.TerraformValueKind.Json:
156
+ case TerraformSchema_1.TerraformValueKind.MonitorSteps:
157
+ return JSON.stringify(value);
158
+ case TerraformSchema_1.TerraformValueKind.Bool:
159
+ return typeof value === "boolean" ? String(value) : undefined;
160
+ case TerraformSchema_1.TerraformValueKind.Number:
161
+ return typeof value === "number" ? String(value) : undefined;
162
+ default: {
163
+ if (typeof value === "string") {
164
+ return value;
165
+ }
166
+ // An ID the API wraps, or a value object such as a color.
167
+ const wrapped = idOf(value);
168
+ return wrapped || undefined;
169
+ }
170
+ }
171
+ }
172
+ /*
173
+ * A create's or an update's fields as flags. A person whose address the
174
+ * page knows (`emailsById`: the viewer's) is named by it, with the email
175
+ * flag; a field no flag carries goes in --data.
176
+ */
177
+ function getCliWriteArgs(data) {
178
+ var _a;
179
+ const flags = new Map((0, CliCommands_1.getCliFieldFlagsFor)(data.modelType, data.operation).map((flag) => {
180
+ return [flag.columnName, flag];
181
+ }));
182
+ const args = [];
183
+ const rest = {};
184
+ for (const [column, value] of Object.entries(data.values)) {
185
+ const flag = flags.get(column);
186
+ if (!flag || value === undefined || value === null) {
187
+ if (value !== undefined) {
188
+ rest[column] = value;
189
+ }
190
+ continue;
191
+ }
192
+ const id = flag.person ? idOf(value) : null;
193
+ const email = id ? (_a = data.emailsById) === null || _a === void 0 ? void 0 : _a[id] : undefined;
194
+ if (flag.person && !flag.person.isList && email) {
195
+ args.push(flag.person.flag, email);
196
+ continue;
197
+ }
198
+ const text = toFlagText(flag, value);
199
+ if (text === undefined) {
200
+ rest[column] = value;
201
+ continue;
202
+ }
203
+ args.push(flag.flag, text);
204
+ }
205
+ if (Object.keys(rest).length > 0) {
206
+ args.push("--data", JSON.stringify(rest));
207
+ }
208
+ return args;
209
+ }
210
+ function getCliCreateExample(data) {
211
+ return example([
212
+ getCliCommandOf(data.modelType),
213
+ CliCommands_1.CliOperation.Create,
214
+ ...getCliWriteArgs(Object.assign(Object.assign({}, data), { operation: CliCommands_1.CliOperation.Create })),
215
+ JSON_FLAG,
216
+ ], writeJsonFlags(data.modelType, CliCommands_1.CliOperation.Create));
217
+ }
218
+ function getCliUpdateExample(data) {
219
+ return example([
220
+ getCliCommandOf(data.modelType),
221
+ CliCommands_1.CliOperation.Update,
222
+ data.id,
223
+ ...getCliWriteArgs(Object.assign(Object.assign({}, data), { operation: CliCommands_1.CliOperation.Update })),
224
+ JSON_FLAG,
225
+ ], writeJsonFlags(data.modelType, CliCommands_1.CliOperation.Update));
226
+ }
227
+ // The fields a read asks for, as --fields names them: `_id` always comes.
228
+ function fieldsArgs(select) {
229
+ if (!select) {
230
+ return [];
231
+ }
232
+ const names = Object.keys(select).filter((name) => {
233
+ return name !== "_id";
234
+ });
235
+ return names.length > 0 ? ["--fields", names.join(COMMA)] : [];
236
+ }
237
+ const NEWEST_FIRST = { createdAt: "DESC" };
238
+ function isNewestFirst(sort) {
239
+ return !sort || JSON.stringify(sort) === JSON.stringify(NEWEST_FIRST);
240
+ }
241
+ /*
242
+ * A list: its query and sort as JSON (newest first is the CLI's own
243
+ * order, so it is left out), the fields it asks for, and its page.
244
+ */
245
+ function getCliListExample(data) {
246
+ const args = [
247
+ getCliCommandOf(data.modelType),
248
+ CliCommands_1.CliOperation.List,
249
+ ];
250
+ if (data.query && Object.keys(data.query).length > 0) {
251
+ args.push("--query", JSON.stringify(data.query));
252
+ }
253
+ if (!isNewestFirst(data.sort)) {
254
+ args.push("--sort", JSON.stringify(data.sort));
255
+ }
256
+ args.push(...fieldsArgs(data.select));
257
+ if (data.limit !== undefined) {
258
+ args.push("--limit", String(data.limit));
259
+ }
260
+ args.push(JSON_FLAG);
261
+ return example(args);
262
+ }
263
+ function getCliGetExample(data) {
264
+ return example([
265
+ getCliCommandOf(data.modelType),
266
+ CliCommands_1.CliOperation.Get,
267
+ data.id,
268
+ ...fieldsArgs(data.select),
269
+ JSON_FLAG,
270
+ ]);
271
+ }
272
+ function getCliCountExample(data) {
273
+ const args = [
274
+ getCliCommandOf(data.modelType),
275
+ CliCommands_1.CliOperation.Count,
276
+ ];
277
+ if (data.query && Object.keys(data.query).length > 0) {
278
+ args.push("--query", JSON.stringify(data.query));
279
+ }
280
+ return example(args);
281
+ }
282
+ function getCliDeleteExample(data) {
283
+ return example([
284
+ getCliCommandOf(data.modelType),
285
+ CliCommands_1.CliOperation.Delete,
286
+ data.id,
287
+ ]);
288
+ }
289
+ function getCliFieldsExample(modelType) {
290
+ return example([getCliCommandOf(modelType), CliCommands_1.CLI_FIELDS_SUBCOMMAND]);
291
+ }
292
+ // A dashboard button, as its command: acknowledge, resolve, add-note.
293
+ function getCliActionExample(data) {
294
+ const args = [
295
+ getCliCommandOf(data.modelType),
296
+ data.action,
297
+ data.id,
298
+ ];
299
+ if (data.action === CliCommands_1.CliAction.AddNote) {
300
+ args.push("--note", data.note || "");
301
+ if (data.isPublic) {
302
+ args.push("--public");
303
+ }
304
+ }
305
+ return example(args);
306
+ }
307
+ /*
308
+ * INSTALLING AND CONNECTING
309
+ */
310
+ /*
311
+ * The CLI's installer, served by the OneUptime the reader uses: it
312
+ * installs the CLI of that OneUptime's version (packages/CLI/Install).
313
+ */
314
+ function getCliInstallScriptCommands(oneuptimeUrl) {
315
+ return [
316
+ `curl -fsSL ${(0, ApiExamples_1.shellQuote)((0, InstallScripts_1.getInstallScriptUrl)(oneuptimeUrl, InstallScripts_1.InstallScriptName.Cli))} -o ${InstallScripts_1.INSTALL_SCRIPT_FILE}`,
317
+ `${CliCommands_1.ONEUPTIME_URL_ENVIRONMENT_VARIABLE}=${(0, ApiExamples_1.shellQuote)(oneuptimeUrl)} bash ${InstallScripts_1.INSTALL_SCRIPT_FILE}`,
318
+ ].join("\n");
319
+ }
320
+ const RELEASE_VERSION = /^\d+\.\d+\.\d+$/;
321
+ const DEVELOPMENT_VERSION = "1.0.0";
322
+ /*
323
+ * npm's: the CLI of this OneUptime's version, which knows the resources it
324
+ * has; the newest when the version is not a release's.
325
+ */
326
+ function getCliNpmInstallCommand(platformVersion) {
327
+ const version = platformVersion &&
328
+ RELEASE_VERSION.test(platformVersion.trim()) &&
329
+ platformVersion.trim() !== DEVELOPMENT_VERSION
330
+ ? platformVersion.trim()
331
+ : null;
332
+ return `npm install -g ${CliCommands_1.ONEUPTIME_CLI_PACKAGE}${version ? `@${version}` : ""}`;
333
+ }
334
+ /*
335
+ * The key and the address in the environment - the same export the API
336
+ * and Terraform pages make - and the check that OneUptime takes them.
337
+ */
338
+ function getCliConnectCommands(oneuptimeUrl) {
339
+ return [
340
+ (0, ExampleValues_1.getApiKeyExportCommand)(),
341
+ `export ${CliCommands_1.ONEUPTIME_URL_ENVIRONMENT_VARIABLE}=${(0, ApiExamples_1.shellQuote)(oneuptimeUrl)}`,
342
+ `${CliCommands_1.ONEUPTIME_CLI_COMMAND} whoami --check`,
343
+ ].join("\n");
344
+ }
345
+ // Saving the key as a context instead, for people at a terminal.
346
+ function getCliLoginCommand(oneuptimeUrl) {
347
+ return `${CliCommands_1.ONEUPTIME_CLI_COMMAND} login <api-key> ${(0, ApiExamples_1.shellQuote)(oneuptimeUrl)}`;
348
+ }
@@ -0,0 +1,17 @@
1
+ import commonJsModule from "./CliExamples.js";
2
+ export const CLI_EXAMPLE_LINE_LIMIT = commonJsModule.CLI_EXAMPLE_LINE_LIMIT;
3
+ export const formatCliCommand = commonJsModule.formatCliCommand;
4
+ export const getCliActionExample = commonJsModule.getCliActionExample;
5
+ export const getCliCommandOf = commonJsModule.getCliCommandOf;
6
+ export const getCliConnectCommands = commonJsModule.getCliConnectCommands;
7
+ export const getCliCountExample = commonJsModule.getCliCountExample;
8
+ export const getCliCreateExample = commonJsModule.getCliCreateExample;
9
+ export const getCliDeleteExample = commonJsModule.getCliDeleteExample;
10
+ export const getCliFieldsExample = commonJsModule.getCliFieldsExample;
11
+ export const getCliGetExample = commonJsModule.getCliGetExample;
12
+ export const getCliInstallScriptCommands = commonJsModule.getCliInstallScriptCommands;
13
+ export const getCliListExample = commonJsModule.getCliListExample;
14
+ export const getCliLoginCommand = commonJsModule.getCliLoginCommand;
15
+ export const getCliNpmInstallCommand = commonJsModule.getCliNpmInstallCommand;
16
+ export const getCliUpdateExample = commonJsModule.getCliUpdateExample;
17
+ export const getCliWriteArgs = commonJsModule.getCliWriteArgs;
@@ -0,0 +1,18 @@
1
+ import { AnalyticsBaseModelType } from "../../Models/AnalyticsModels/AnalyticsBaseModel/AnalyticsBaseModel.mjs";
2
+ import { DatabaseBaseModelType } from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.mjs";
3
+ import { CliAction, CliOperation, CliResourceType } from "./CliCommands.mjs";
4
+ export interface CliResource {
5
+ name: string;
6
+ singularName: string;
7
+ pluralName: string;
8
+ tableName: string;
9
+ apiPath: string;
10
+ modelType: CliResourceType;
11
+ operations: Array<CliOperation>;
12
+ actions: Array<CliAction>;
13
+ }
14
+ export declare function getCliResources(): Array<CliResource>;
15
+ export declare function getCliResource(name: string): CliResource | null;
16
+ export declare function getCliResourceByTableName(tableName: string): CliResource | null;
17
+ export declare function getCliDatabaseModelType(resource: CliResource): DatabaseBaseModelType | null;
18
+ export declare function getCliAnalyticsModelType(resource: CliResource): AnalyticsBaseModelType | null;
@@ -0,0 +1,18 @@
1
+ import { AnalyticsBaseModelType } from "../../Models/AnalyticsModels/AnalyticsBaseModel/AnalyticsBaseModel";
2
+ import { DatabaseBaseModelType } from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
3
+ import { CliAction, CliOperation, CliResourceType } from "./CliCommands";
4
+ export interface CliResource {
5
+ name: string;
6
+ singularName: string;
7
+ pluralName: string;
8
+ tableName: string;
9
+ apiPath: string;
10
+ modelType: CliResourceType;
11
+ operations: Array<CliOperation>;
12
+ actions: Array<CliAction>;
13
+ }
14
+ export declare function getCliResources(): Array<CliResource>;
15
+ export declare function getCliResource(name: string): CliResource | null;
16
+ export declare function getCliResourceByTableName(tableName: string): CliResource | null;
17
+ export declare function getCliDatabaseModelType(resource: CliResource): DatabaseBaseModelType | null;
18
+ export declare function getCliAnalyticsModelType(resource: CliResource): AnalyticsBaseModelType | null;