@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,129 @@
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.getCliResources = getCliResources;
7
+ exports.getCliResource = getCliResource;
8
+ exports.getCliResourceByTableName = getCliResourceByTableName;
9
+ exports.getCliDatabaseModelType = getCliDatabaseModelType;
10
+ exports.getCliAnalyticsModelType = getCliAnalyticsModelType;
11
+ const Index_1 = __importDefault(require("../../Models/AnalyticsModels/Index"));
12
+ const Index_2 = __importDefault(require("../../Models/DatabaseModels/Index"));
13
+ const CliCommands_1 = require("./CliCommands");
14
+ const TerraformSchema_1 = require("./TerraformSchema");
15
+ const LEADING_SLASHES = /^\/+/;
16
+ const UNDERSCORES = /_/g;
17
+ function toApiPath(path) {
18
+ return `/${path.replace(LEADING_SLASHES, "")}`;
19
+ }
20
+ /*
21
+ * The model's command (getCliResourceName), or - should a new model share
22
+ * a name with another before ClientResourceNames tells them apart - the
23
+ * table's name, so the CLI still starts with a command for each.
24
+ * Tests/ApiParity in packages/CLI fails on that second case.
25
+ */
26
+ function uniqueName(model, taken) {
27
+ const name = (0, CliCommands_1.getCliResourceName)(model);
28
+ if (!taken.has(name)) {
29
+ return name;
30
+ }
31
+ return (0, TerraformSchema_1.toTerraformTypeSnakeCase)(model.tableName).replace(UNDERSCORES, "-");
32
+ }
33
+ function databaseResource(modelType, taken) {
34
+ var _a;
35
+ const model = new modelType();
36
+ const operations = (0, CliCommands_1.getCliDatabaseOperationsOf)(model);
37
+ if (operations.length === 0) {
38
+ return null;
39
+ }
40
+ const tableName = model.tableName || modelType.name;
41
+ const singularName = model.singularName || tableName;
42
+ return {
43
+ name: uniqueName({ tableName, singularName }, taken),
44
+ singularName,
45
+ pluralName: model.pluralName || `${singularName}s`,
46
+ tableName,
47
+ apiPath: toApiPath(((_a = model.crudApiPath) === null || _a === void 0 ? void 0 : _a.toString()) || ""),
48
+ modelType: "database",
49
+ operations,
50
+ actions: (0, CliCommands_1.getCliActions)(tableName),
51
+ };
52
+ }
53
+ function analyticsResource(modelType, taken) {
54
+ var _a;
55
+ const model = new modelType();
56
+ const operations = (0, CliCommands_1.getCliAnalyticsOperationsOf)(model);
57
+ if (operations.length === 0) {
58
+ return null;
59
+ }
60
+ const tableName = model.tableName || modelType.name;
61
+ const singularName = model.singularName || tableName;
62
+ return {
63
+ name: uniqueName({ tableName, singularName }, taken),
64
+ singularName,
65
+ pluralName: model.pluralName || `${singularName}s`,
66
+ tableName,
67
+ apiPath: toApiPath(((_a = model.crudApiPath) === null || _a === void 0 ? void 0 : _a.toString()) || ""),
68
+ modelType: "analytics",
69
+ operations,
70
+ actions: [],
71
+ };
72
+ }
73
+ let resources = null;
74
+ /*
75
+ * Every resource command, records then telemetry. Worked out once: the
76
+ * models do not change while a process runs.
77
+ */
78
+ function getCliResources() {
79
+ if (resources) {
80
+ return resources;
81
+ }
82
+ const found = [];
83
+ const taken = new Set();
84
+ const add = (resource) => {
85
+ if (!resource) {
86
+ return;
87
+ }
88
+ taken.add(resource.name);
89
+ found.push(resource);
90
+ };
91
+ for (const modelType of Index_2.default) {
92
+ add(databaseResource(modelType, taken));
93
+ }
94
+ for (const modelType of Index_1.default) {
95
+ add(analyticsResource(modelType, taken));
96
+ }
97
+ resources = found;
98
+ return found;
99
+ }
100
+ // A resource by its command, or null.
101
+ function getCliResource(name) {
102
+ return (getCliResources().find((resource) => {
103
+ return resource.name === name;
104
+ }) || null);
105
+ }
106
+ // A resource by its model's table name, or null.
107
+ function getCliResourceByTableName(tableName) {
108
+ return (getCliResources().find((resource) => {
109
+ return resource.tableName === tableName;
110
+ }) || null);
111
+ }
112
+ // The record model of a resource, for its fields and flags.
113
+ function getCliDatabaseModelType(resource) {
114
+ if (resource.modelType !== "database") {
115
+ return null;
116
+ }
117
+ return (Index_2.default.find((modelType) => {
118
+ return new modelType().tableName === resource.tableName;
119
+ }) || null);
120
+ }
121
+ // The telemetry model of a resource.
122
+ function getCliAnalyticsModelType(resource) {
123
+ if (resource.modelType !== "analytics") {
124
+ return null;
125
+ }
126
+ return (Index_1.default.find((modelType) => {
127
+ return new modelType().tableName === resource.tableName;
128
+ }) || null);
129
+ }
@@ -0,0 +1,6 @@
1
+ import commonJsModule from "./CliResources.js";
2
+ export const getCliAnalyticsModelType = commonJsModule.getCliAnalyticsModelType;
3
+ export const getCliDatabaseModelType = commonJsModule.getCliDatabaseModelType;
4
+ export const getCliResource = commonJsModule.getCliResource;
5
+ export const getCliResourceByTableName = commonJsModule.getCliResourceByTableName;
6
+ export const getCliResources = commonJsModule.getCliResources;
@@ -120,9 +120,14 @@ export declare function getApiCreateExample(data: {
120
120
  modelType: DatabaseBaseModelType;
121
121
  context: DeveloperDocsExampleContext;
122
122
  }): DeveloperDocsApiBody;
123
+ export declare enum DeveloperDocsClient {
124
+ Api = "API",
125
+ Cli = "CLI"
126
+ }
123
127
  export declare function getApiUpdateExample(data: {
124
128
  modelType: DatabaseBaseModelType;
125
129
  context: DeveloperDocsExampleContext;
130
+ client?: DeveloperDocsClient | undefined;
126
131
  }): {
127
132
  data: JSONObject;
128
133
  description: string;
@@ -156,6 +161,7 @@ export interface DeveloperDocsApiTask {
156
161
  operation: "create" | "list";
157
162
  body: JSONObject;
158
163
  isPlaceholder: boolean;
164
+ liveFlags: Record<string, string>;
159
165
  }
160
166
  export declare function getApiTasks(data: {
161
167
  modelType: DatabaseBaseModelType;
@@ -120,9 +120,14 @@ export declare function getApiCreateExample(data: {
120
120
  modelType: DatabaseBaseModelType;
121
121
  context: DeveloperDocsExampleContext;
122
122
  }): DeveloperDocsApiBody;
123
+ export declare enum DeveloperDocsClient {
124
+ Api = "API",
125
+ Cli = "CLI"
126
+ }
123
127
  export declare function getApiUpdateExample(data: {
124
128
  modelType: DatabaseBaseModelType;
125
129
  context: DeveloperDocsExampleContext;
130
+ client?: DeveloperDocsClient | undefined;
126
131
  }): {
127
132
  data: JSONObject;
128
133
  description: string;
@@ -156,6 +161,7 @@ export interface DeveloperDocsApiTask {
156
161
  operation: "create" | "list";
157
162
  body: JSONObject;
158
163
  isPlaceholder: boolean;
164
+ liveFlags: Record<string, string>;
159
165
  }
160
166
  export declare function getApiTasks(data: {
161
167
  modelType: DatabaseBaseModelType;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DeveloperDocsExampleError = void 0;
6
+ exports.DeveloperDocsClient = exports.DeveloperDocsExampleError = void 0;
7
7
  exports.getPlaceholder = getPlaceholder;
8
8
  exports.isPlaceholderText = isPlaceholderText;
9
9
  exports.getRelatedModelType = getRelatedModelType;
@@ -886,6 +886,16 @@ function getApiCreateExample(data) {
886
886
  context: data.context,
887
887
  });
888
888
  }
889
+ /*
890
+ * What sends an example's request: the API page's curl, or the CLI page's
891
+ * command. A new description names it, so the CLI page never writes
892
+ * "Updated with the OneUptime API." with the CLI.
893
+ */
894
+ var DeveloperDocsClient;
895
+ (function (DeveloperDocsClient) {
896
+ DeveloperDocsClient["Api"] = "API";
897
+ DeveloperDocsClient["Cli"] = "CLI";
898
+ })(DeveloperDocsClient || (exports.DeveloperDocsClient = DeveloperDocsClient = {}));
889
899
  /*
890
900
  * The `data` of the "Change it" example: the profile's change, or a new
891
901
  * description. A field pointing at a record moves to another one than the
@@ -938,7 +948,9 @@ function getApiUpdateExample(data) {
938
948
  }
939
949
  if (updatable.has("description")) {
940
950
  return {
941
- data: { description: "Updated with the OneUptime API." },
951
+ data: {
952
+ description: `Updated with the OneUptime ${data.client || DeveloperDocsClient.Api}.`,
953
+ },
942
954
  description: "Send only the fields you want to change. Everything else stays as it is.",
943
955
  };
944
956
  }
@@ -1104,6 +1116,17 @@ function fillName(text, names, fallbackNoun) {
1104
1116
  const name = names[0];
1105
1117
  return text.replace(/\{name\}/g, name ? `“${name}”` : `the ${fallbackNoun} you choose`);
1106
1118
  }
1119
+ // The flags a task's live fields were picked by, by column.
1120
+ function getLiveFlags(task) {
1121
+ var _a, _b;
1122
+ const flags = {};
1123
+ for (const field of task.fields || []) {
1124
+ if (((_a = field.value) === null || _a === void 0 ? void 0 : _a.kind) === "live" && ((_b = field.value.pick) === null || _b === void 0 ? void 0 : _b.flag)) {
1125
+ flags[field.column] = field.value.pick.flag;
1126
+ }
1127
+ }
1128
+ return flags;
1129
+ }
1107
1130
  // The profile's tasks for a scope, as request bodies.
1108
1131
  function getApiTasks(data) {
1109
1132
  return ((0, ResourceProfiles_1.getDeveloperDocsProfile)(data.modelType).tasks || [])
@@ -1144,6 +1167,7 @@ function getApiTasks(data) {
1144
1167
  operation: "create",
1145
1168
  body: { data: created.body },
1146
1169
  isPlaceholder: created.isPlaceholder,
1170
+ liveFlags: getLiveFlags(task),
1147
1171
  };
1148
1172
  }
1149
1173
  const query = getApiQuery({
@@ -1163,6 +1187,7 @@ function getApiTasks(data) {
1163
1187
  operation: "list",
1164
1188
  body: { query: query.query, select, sort: toSortJson(task.sort) },
1165
1189
  isPlaceholder: query.isPlaceholder,
1190
+ liveFlags: getLiveFlags(task),
1166
1191
  };
1167
1192
  });
1168
1193
  }
@@ -1,4 +1,5 @@
1
1
  import commonJsModule from "./ExampleBuilder.js";
2
+ export const DeveloperDocsClient = commonJsModule.DeveloperDocsClient;
2
3
  export const DeveloperDocsExampleError = commonJsModule.DeveloperDocsExampleError;
3
4
  export const getApiCreateData = commonJsModule.getApiCreateData;
4
5
  export const getApiCreateExample = commonJsModule.getApiCreateExample;
@@ -2,7 +2,7 @@ import { DatabaseBaseModelType } from "../../Models/DatabaseModels/DatabaseBaseM
2
2
  import Dictionary from "../../Types/Dictionary.mjs";
3
3
  import { DeveloperDocsLookup } from "./LiveData.mjs";
4
4
  import { DeveloperDocsScopeName, DeveloperDocsValue } from "./ResourceProfiles.mjs";
5
- export type DeveloperDocsPageKind = "terraform" | "api" | "ai-assistants";
5
+ export type DeveloperDocsPageKind = "terraform" | "api" | "cli" | "ai-assistants";
6
6
  export declare function getModelsForValue(data: {
7
7
  modelType: DatabaseBaseModelType;
8
8
  column: string;
@@ -2,7 +2,7 @@ import { DatabaseBaseModelType } from "../../Models/DatabaseModels/DatabaseBaseM
2
2
  import Dictionary from "../../Types/Dictionary";
3
3
  import { DeveloperDocsLookup } from "./LiveData";
4
4
  import { DeveloperDocsScopeName, DeveloperDocsValue } from "./ResourceProfiles";
5
- export type DeveloperDocsPageKind = "terraform" | "api" | "ai-assistants";
5
+ export type DeveloperDocsPageKind = "terraform" | "api" | "cli" | "ai-assistants";
6
6
  export declare function getModelsForValue(data: {
7
7
  modelType: DatabaseBaseModelType;
8
8
  column: string;
@@ -19,6 +19,13 @@ const LiveData_1 = require("./LiveData");
19
19
  const ResourceProfiles_1 = require("./ResourceProfiles");
20
20
  const TerraformSchema_1 = require("./TerraformSchema");
21
21
  const TerraformValues_1 = require("./TerraformValues");
22
+ /*
23
+ * The CLI page shows the API page's requests as commands - the same
24
+ * create, filters, change and tasks - so it looks up what they point at.
25
+ */
26
+ function usesApiExamples(page) {
27
+ return page === "api" || page === "cli";
28
+ }
22
29
  // What a new monitor's steps point at: the project's statuses and severities.
23
30
  const MONITOR_STEP_MODELS = [
24
31
  MonitorStatus_1.default,
@@ -101,14 +108,14 @@ function getDeveloperDocsLiveModels(data) {
101
108
  }
102
109
  }
103
110
  }
104
- if (data.page === "api" && data.scope === "list") {
111
+ if (usesApiExamples(data.page) && data.scope === "list") {
105
112
  for (const filter of profile.filters || []) {
106
113
  for (const part of filter.query) {
107
114
  add(data.modelType, part.column, part.value);
108
115
  }
109
116
  }
110
117
  }
111
- if (data.page === "api" && data.scope === "view") {
118
+ if (usesApiExamples(data.page) && data.scope === "view") {
112
119
  for (const field of ((_a = profile.update) === null || _a === void 0 ? void 0 : _a.fields) || []) {
113
120
  add(data.modelType, field.column, field.value);
114
121
  }
@@ -46,6 +46,7 @@ export declare const TERRAFORM_RESOURCE_META_ARGUMENTS: ReadonlyArray<string>;
46
46
  export declare const SERVER_MANAGED_COLUMNS_BY_TABLE: Readonly<Record<string, ReadonlyArray<string>>>;
47
47
  export declare function toTerraformSnakeCase(value: string): string;
48
48
  export declare function toTerraformTypeSnakeCase(value: string): string;
49
+ export declare function isApiExcludedForPermissions(permissions: Array<Permission> | undefined): boolean;
49
50
  export interface TerraformModelOperations {
50
51
  canCreate: boolean;
51
52
  canRead: boolean;
@@ -46,6 +46,7 @@ export declare const TERRAFORM_RESOURCE_META_ARGUMENTS: ReadonlyArray<string>;
46
46
  export declare const SERVER_MANAGED_COLUMNS_BY_TABLE: Readonly<Record<string, ReadonlyArray<string>>>;
47
47
  export declare function toTerraformSnakeCase(value: string): string;
48
48
  export declare function toTerraformTypeSnakeCase(value: string): string;
49
+ export declare function isApiExcludedForPermissions(permissions: Array<Permission> | undefined): boolean;
49
50
  export interface TerraformModelOperations {
50
51
  canCreate: boolean;
51
52
  canRead: boolean;
@@ -7,6 +7,7 @@ exports.SERVER_MANAGED_COLUMNS_BY_TABLE = exports.TERRAFORM_RESOURCE_META_ARGUME
7
7
  exports.isRequiredInTerraform = isRequiredInTerraform;
8
8
  exports.toTerraformSnakeCase = toTerraformSnakeCase;
9
9
  exports.toTerraformTypeSnakeCase = toTerraformTypeSnakeCase;
10
+ exports.isApiExcludedForPermissions = isApiExcludedForPermissions;
10
11
  exports.getTerraformModelOperations = getTerraformModelOperations;
11
12
  exports.isModelInPublicApi = isModelInPublicApi;
12
13
  exports.getTerraformTypeName = getTerraformTypeName;
@@ -227,7 +228,8 @@ function toTerraformTypeSnakeCase(value) {
227
228
  /*
228
229
  * Whether a list of permissions keeps an API from being generated
229
230
  * (OpenAPIUtil.shouldExcludeApiForPermissions): none at all, or only Public
230
- * and CurrentUser.
231
+ * and CurrentUser. The CLI's commands follow the same rule (CliCommands.ts),
232
+ * for telemetry as for records.
231
233
  */
232
234
  function isApiExcludedForPermissions(permissions) {
233
235
  if (!permissions || permissions.length === 0) {
@@ -10,6 +10,7 @@ export const getTerraformAttribute = commonJsModule.getTerraformAttribute;
10
10
  export const getTerraformAttributes = commonJsModule.getTerraformAttributes;
11
11
  export const getTerraformModelOperations = commonJsModule.getTerraformModelOperations;
12
12
  export const getTerraformTypeName = commonJsModule.getTerraformTypeName;
13
+ export const isApiExcludedForPermissions = commonJsModule.isApiExcludedForPermissions;
13
14
  export const isModelInPublicApi = commonJsModule.isModelInPublicApi;
14
15
  export const isRequiredInTerraform = commonJsModule.isRequiredInTerraform;
15
16
  export const isServerManagedColumn = commonJsModule.isServerManagedColumn;
@@ -0,0 +1,3 @@
1
+ export declare function lookupTable<T>(entries: Readonly<Record<string, T>>): ReadonlyMap<string, T>;
2
+ export declare function readOwnValue<T>(record: Readonly<Record<string, T>> | null | undefined, key: string): T | undefined;
3
+ export default lookupTable;
@@ -0,0 +1,3 @@
1
+ export declare function lookupTable<T>(entries: Readonly<Record<string, T>>): ReadonlyMap<string, T>;
2
+ export declare function readOwnValue<T>(record: Readonly<Record<string, T>> | null | undefined, key: string): T | undefined;
3
+ export default lookupTable;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lookupTable = lookupTable;
4
+ exports.readOwnValue = readOwnValue;
5
+ /*
6
+ * A TABLE READ BY TEXT FROM OUTSIDE ONEUPTIME.
7
+ *
8
+ * Security Events reads what other products write - a severity, a tactic's
9
+ * name, a status, a risk type, a Windows provider - and looks each one up in
10
+ * a table of its own words. Search boxes read what somebody typed - a field
11
+ * name before a colon - the same way. Kept as a plain object, such a table
12
+ * answers for names it never listed: every object inherits "constructor",
13
+ * "toString", "valueOf", "hasOwnProperty" and the rest from
14
+ * Object.prototype, and "__proto__" is that prototype itself. So
15
+ * `TACTIC_ID_BY_NAME["constructor"]` was a function, not undefined, and
16
+ * `table[name] || fallback` handed the function on: a tactic named
17
+ * "constructor" went into an event's tactics as code, a severity named
18
+ * "__proto__" as an object, and a search for `constructor:x` broke the
19
+ * search box that read its suggestions as a list.
20
+ *
21
+ * A Map answers only for the keys it was given, so a table read by a
22
+ * source's text is one: written as the object literal it always was, and
23
+ * read with get(). TypeScript refuses `map[key]` on a Map, so nobody can
24
+ * read it the old way by accident (Common's TextLookupTablesGuard holds the
25
+ * Security Events ingest code and the search boxes to this).
26
+ */
27
+ function lookupTable(entries) {
28
+ // Own keys only: Object.entries never lists what an object inherits.
29
+ return new Map(Object.entries(entries));
30
+ }
31
+ /*
32
+ * The value a record built at run time - a prop, a response, suggestions
33
+ * per field - holds under a key somebody typed, or undefined when the
34
+ * record does not hold that key itself. The record stays the plain object
35
+ * it is; only the read changes: "constructor" is a key of no record, and
36
+ * neither is anything else an object inherits.
37
+ */
38
+ function readOwnValue(record, key) {
39
+ if (!record || !Object.prototype.hasOwnProperty.call(record, key)) {
40
+ return undefined;
41
+ }
42
+ return record[key];
43
+ }
44
+ exports.default = lookupTable;
@@ -0,0 +1,4 @@
1
+ import commonJsModule from "./LookupTable.js";
2
+ export default commonJsModule.default;
3
+ export const lookupTable = commonJsModule.lookupTable;
4
+ export const readOwnValue = commonJsModule.readOwnValue;
@@ -0,0 +1,62 @@
1
+ import Monitor from "../../Models/DatabaseModels/Monitor.mjs";
2
+ import { Translator } from "../../Types/Translator.mjs";
3
+ export declare enum MonitorCheckFreshness {
4
+ Fresh = "Fresh",
5
+ Stale = "Stale",
6
+ AwaitingFirstResult = "AwaitingFirstResult",
7
+ NotScheduled = "NotScheduled",
8
+ Unknown = "Unknown"
9
+ }
10
+ export interface MonitorCheckFreshnessResult {
11
+ freshness: MonitorCheckFreshness;
12
+ overdueSeconds: number | null;
13
+ resultAgeSeconds: number | null;
14
+ }
15
+ export interface MonitorScheduledRun {
16
+ runAt: Date;
17
+ spacingSeconds: number;
18
+ }
19
+ export interface MonitorResultLateness {
20
+ lateSeconds: number;
21
+ graceSeconds: number;
22
+ }
23
+ export default class MonitorCheckScheduleUtil {
24
+ static readonly DEFAULT_CADENCE_SECONDS: number;
25
+ static getCadenceSeconds(data: {
26
+ monitoringInterval: string | null | undefined;
27
+ from: Date;
28
+ }): number | null;
29
+ static resolveCadenceSeconds(data: {
30
+ monitoringInterval: string | null | undefined;
31
+ from: Date;
32
+ }): number;
33
+ static getNextRunAfter(data: {
34
+ monitoringInterval: string | null | undefined;
35
+ after: Date;
36
+ }): MonitorScheduledRun | null;
37
+ private static getNextTwoRuns;
38
+ private static isScheduleWithoutRuns;
39
+ static getResultLateness(data: {
40
+ lastResultAt: Date;
41
+ monitoringInterval?: string | null | undefined;
42
+ cadenceSeconds: number;
43
+ now: Date;
44
+ }): MonitorResultLateness;
45
+ static describeInterval(monitoringInterval: string | null | undefined, translator?: Translator | undefined): string;
46
+ static getGraceSeconds(cadenceSeconds: number): number;
47
+ static getCheckFreshness(data: {
48
+ isScheduled: boolean;
49
+ isKnown: boolean;
50
+ lastResultAt: Date | undefined;
51
+ nextCheckAt: Date | undefined;
52
+ cadenceSeconds: number;
53
+ createdAt: Date | undefined;
54
+ now: Date;
55
+ monitoringInterval?: string | null | undefined;
56
+ }): MonitorCheckFreshnessResult;
57
+ static getLatestSignalAt(data: {
58
+ monitor: Monitor;
59
+ probeLastResultAt: Date | undefined;
60
+ }): Date | undefined;
61
+ static parseDate(value: unknown): Date | undefined;
62
+ }
@@ -0,0 +1,62 @@
1
+ import Monitor from "../../Models/DatabaseModels/Monitor";
2
+ import { Translator } from "../../Types/Translator";
3
+ export declare enum MonitorCheckFreshness {
4
+ Fresh = "Fresh",
5
+ Stale = "Stale",
6
+ AwaitingFirstResult = "AwaitingFirstResult",
7
+ NotScheduled = "NotScheduled",
8
+ Unknown = "Unknown"
9
+ }
10
+ export interface MonitorCheckFreshnessResult {
11
+ freshness: MonitorCheckFreshness;
12
+ overdueSeconds: number | null;
13
+ resultAgeSeconds: number | null;
14
+ }
15
+ export interface MonitorScheduledRun {
16
+ runAt: Date;
17
+ spacingSeconds: number;
18
+ }
19
+ export interface MonitorResultLateness {
20
+ lateSeconds: number;
21
+ graceSeconds: number;
22
+ }
23
+ export default class MonitorCheckScheduleUtil {
24
+ static readonly DEFAULT_CADENCE_SECONDS: number;
25
+ static getCadenceSeconds(data: {
26
+ monitoringInterval: string | null | undefined;
27
+ from: Date;
28
+ }): number | null;
29
+ static resolveCadenceSeconds(data: {
30
+ monitoringInterval: string | null | undefined;
31
+ from: Date;
32
+ }): number;
33
+ static getNextRunAfter(data: {
34
+ monitoringInterval: string | null | undefined;
35
+ after: Date;
36
+ }): MonitorScheduledRun | null;
37
+ private static getNextTwoRuns;
38
+ private static isScheduleWithoutRuns;
39
+ static getResultLateness(data: {
40
+ lastResultAt: Date;
41
+ monitoringInterval?: string | null | undefined;
42
+ cadenceSeconds: number;
43
+ now: Date;
44
+ }): MonitorResultLateness;
45
+ static describeInterval(monitoringInterval: string | null | undefined, translator?: Translator | undefined): string;
46
+ static getGraceSeconds(cadenceSeconds: number): number;
47
+ static getCheckFreshness(data: {
48
+ isScheduled: boolean;
49
+ isKnown: boolean;
50
+ lastResultAt: Date | undefined;
51
+ nextCheckAt: Date | undefined;
52
+ cadenceSeconds: number;
53
+ createdAt: Date | undefined;
54
+ now: Date;
55
+ monitoringInterval?: string | null | undefined;
56
+ }): MonitorCheckFreshnessResult;
57
+ static getLatestSignalAt(data: {
58
+ monitor: Monitor;
59
+ probeLastResultAt: Date | undefined;
60
+ }): Date | undefined;
61
+ static parseDate(value: unknown): Date | undefined;
62
+ }