@oneuptime/common 14.0.93 → 14.0.94

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 (191) hide show
  1. package/Models/DatabaseModels/Alert.d.mts +2 -0
  2. package/Models/DatabaseModels/Alert.d.ts +2 -0
  3. package/Models/DatabaseModels/Alert.js +54 -0
  4. package/Models/DatabaseModels/CloudAccount.d.mts +29 -0
  5. package/Models/DatabaseModels/CloudAccount.d.ts +29 -0
  6. package/Models/DatabaseModels/CloudAccount.js +546 -0
  7. package/Models/DatabaseModels/CloudAccount.mjs +2 -0
  8. package/Models/DatabaseModels/CloudResource.d.mts +8 -0
  9. package/Models/DatabaseModels/CloudResource.d.ts +8 -0
  10. package/Models/DatabaseModels/CloudResource.js +169 -0
  11. package/Models/DatabaseModels/CloudResourceLabelRule.d.mts +1 -0
  12. package/Models/DatabaseModels/CloudResourceLabelRule.d.ts +1 -0
  13. package/Models/DatabaseModels/CloudResourceLabelRule.js +40 -0
  14. package/Models/DatabaseModels/CloudResourceOwnerRule.d.mts +1 -0
  15. package/Models/DatabaseModels/CloudResourceOwnerRule.d.ts +1 -0
  16. package/Models/DatabaseModels/CloudResourceOwnerRule.js +40 -0
  17. package/Models/DatabaseModels/Incident.d.mts +2 -0
  18. package/Models/DatabaseModels/Incident.d.ts +2 -0
  19. package/Models/DatabaseModels/Incident.js +54 -0
  20. package/Models/DatabaseModels/Index.js +2 -0
  21. package/Models/DatabaseModels/Monitor.d.mts +2 -0
  22. package/Models/DatabaseModels/Monitor.d.ts +2 -0
  23. package/Models/DatabaseModels/Monitor.js +54 -0
  24. package/Models/DatabaseModels/OpenSourceDeployment.d.mts +1 -0
  25. package/Models/DatabaseModels/OpenSourceDeployment.d.ts +1 -0
  26. package/Models/DatabaseModels/OpenSourceDeployment.js +25 -6
  27. package/Models/DatabaseModels/ScheduledMaintenance.d.mts +1 -0
  28. package/Models/DatabaseModels/ScheduledMaintenance.d.ts +1 -0
  29. package/Models/DatabaseModels/ScheduledMaintenance.js +50 -0
  30. package/Types/AI/AiAffectedResources.d.mts +40 -0
  31. package/Types/AI/AiAffectedResources.d.ts +40 -0
  32. package/Types/AI/AiAffectedResources.js +292 -0
  33. package/Types/AI/AiAffectedResources.mjs +10 -0
  34. package/Types/Cloud/CloudAccountSummary.d.mts +25 -0
  35. package/Types/Cloud/CloudAccountSummary.d.ts +25 -0
  36. package/Types/Cloud/CloudAccountSummary.js +114 -0
  37. package/Types/Cloud/CloudAccountSummary.mjs +5 -0
  38. package/Types/Cloud/CloudEndpointMatch.d.mts +26 -0
  39. package/Types/Cloud/CloudEndpointMatch.d.ts +26 -0
  40. package/Types/Cloud/CloudEndpointMatch.js +134 -0
  41. package/Types/Cloud/CloudEndpointMatch.mjs +5 -0
  42. package/Types/Cloud/CloudInventory.d.mts +34 -0
  43. package/Types/Cloud/CloudInventory.d.ts +34 -0
  44. package/Types/Cloud/CloudInventory.js +362 -0
  45. package/Types/Cloud/CloudInventory.mjs +22 -0
  46. package/Types/Cloud/CloudResourceCatalog.d.mts +2 -0
  47. package/Types/Cloud/CloudResourceCatalog.d.ts +2 -0
  48. package/Types/Cloud/CloudResourceCatalog.js +29 -1
  49. package/Types/Cloud/CloudResourceCatalog.mjs +2 -0
  50. package/Types/Cloud/CloudResourceIndex.d.mts +44 -0
  51. package/Types/Cloud/CloudResourceIndex.d.ts +44 -0
  52. package/Types/Cloud/CloudResourceIndex.js +191 -0
  53. package/Types/Cloud/CloudResourceIndex.mjs +4 -0
  54. package/Types/CloudConnection/CloudConnectionCatalog.d.mts +3 -0
  55. package/Types/CloudConnection/CloudConnectionCatalog.d.ts +3 -0
  56. package/Types/CloudConnection/CloudConnectionCatalog.js +70 -12
  57. package/Types/CloudConnection/CloudConnectionCatalog.mjs +2 -0
  58. package/Types/CloudConnection/CloudConnectionPaste.js +7 -1
  59. package/Types/CloudConnection/CloudConnectionSetupCommands.d.mts +43 -3
  60. package/Types/CloudConnection/CloudConnectionSetupCommands.d.ts +43 -3
  61. package/Types/CloudConnection/CloudConnectionSetupCommands.js +280 -30
  62. package/Types/CloudConnection/CloudConnectionSetupCommands.mjs +14 -0
  63. package/Types/CloudConnection/CloudConnectionTest.d.mts +1 -0
  64. package/Types/CloudConnection/CloudConnectionTest.d.ts +1 -0
  65. package/Types/CloudConnection/CloudConnectionTest.js +1 -0
  66. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.d.mts +19 -0
  67. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.d.ts +19 -0
  68. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.js +27 -1
  69. package/Types/Dashboard/DashboardComponents/DashboardTableComponent.mjs +3 -0
  70. package/Types/Date.d.mts +1 -0
  71. package/Types/Date.d.ts +1 -0
  72. package/Types/Date.js +32 -6
  73. package/Types/DateLanguage.d.mts +2 -0
  74. package/Types/DateLanguage.d.ts +2 -0
  75. package/Types/DateLanguage.js +67 -12
  76. package/Types/DateLanguage.mjs +2 -0
  77. package/Types/Domain.d.mts +2 -0
  78. package/Types/Domain.d.ts +2 -0
  79. package/Types/Domain.js +27 -0
  80. package/Types/Email/EmailTemplateType.d.mts +1 -0
  81. package/Types/Email/EmailTemplateType.d.ts +1 -0
  82. package/Types/Email/EmailTemplateType.js +1 -0
  83. package/Types/Email.d.mts +1 -0
  84. package/Types/Email.d.ts +1 -0
  85. package/Types/Email.js +16 -0
  86. package/Types/Monitor/ExternalStatusPageMonitor/ExternalStatusPageMonitorResponse.d.mts +4 -0
  87. package/Types/Monitor/ExternalStatusPageMonitor/ExternalStatusPageMonitorResponse.d.ts +4 -0
  88. package/Types/Monitor/MonitorStepExternalStatusPageMonitor.d.mts +3 -0
  89. package/Types/Monitor/MonitorStepExternalStatusPageMonitor.d.ts +3 -0
  90. package/Types/Monitor/MonitorStepExternalStatusPageMonitor.js +35 -0
  91. package/Types/Monitor/MonitorTemplateSyncField.js +6 -1
  92. package/Types/Monitor/UptimeBarTooltipMaintenance.d.mts +15 -0
  93. package/Types/Monitor/UptimeBarTooltipMaintenance.d.ts +15 -0
  94. package/Types/Monitor/UptimeBarTooltipMaintenance.js +2 -0
  95. package/Types/Monitor/UptimeBarTooltipMaintenance.mjs +1 -0
  96. package/Types/Monitor/UptimeHistoryLabels.d.mts +5 -0
  97. package/Types/Monitor/UptimeHistoryLabels.d.ts +5 -0
  98. package/Types/Monitor/UptimeHistoryLabels.js +5 -0
  99. package/Types/ReadingDirection.d.mts +10 -0
  100. package/Types/ReadingDirection.d.ts +10 -0
  101. package/Types/ReadingDirection.js +171 -0
  102. package/Types/ReadingDirection.mjs +10 -0
  103. package/Types/Rules/RuleCriteriaFieldRegistry.js +2 -0
  104. package/Types/Runbook/HttpStepVariables.d.mts +8 -0
  105. package/Types/Runbook/HttpStepVariables.d.ts +8 -0
  106. package/Types/Runbook/HttpStepVariables.js +109 -0
  107. package/Types/Runbook/HttpStepVariables.mjs +5 -0
  108. package/Types/Runbook/RunbookStep.d.mts +1 -0
  109. package/Types/Runbook/RunbookStep.d.ts +1 -0
  110. package/Types/Runbook/RunnerFeatures.d.mts +1 -0
  111. package/Types/Runbook/RunnerFeatures.d.ts +1 -0
  112. package/Types/Runbook/RunnerFeatures.js +15 -3
  113. package/Types/Runbook/RunnerFeatures.mjs +1 -0
  114. package/Types/Runbook/SshHostKey.d.mts +22 -0
  115. package/Types/Runbook/SshHostKey.d.ts +22 -0
  116. package/Types/Runbook/SshHostKey.js +201 -0
  117. package/Types/Runbook/SshHostKey.mjs +10 -0
  118. package/Types/Runner/CodeRepositoryRunner.js +2 -3
  119. package/Types/Runner/GlobalAIAgentsGone.d.mts +1 -0
  120. package/Types/Runner/GlobalAIAgentsGone.d.ts +1 -0
  121. package/Types/Runner/GlobalAIAgentsGone.js +19 -0
  122. package/Types/Runner/GlobalAIAgentsGone.mjs +2 -0
  123. package/Types/Runner/GlobalRunnerWork.d.mts +1 -0
  124. package/Types/Runner/GlobalRunnerWork.d.ts +1 -0
  125. package/Types/Runner/GlobalRunnerWork.js +21 -1
  126. package/Types/Runner/GlobalRunnerWork.mjs +1 -0
  127. package/Types/SSO/SignInMethods.d.mts +31 -0
  128. package/Types/SSO/SignInMethods.d.ts +31 -0
  129. package/Types/SSO/SignInMethods.js +160 -0
  130. package/Types/SSO/SignInMethods.mjs +8 -0
  131. package/Types/ScheduledMaintenance/ScheduledMaintenancePublication.d.mts +24 -0
  132. package/Types/ScheduledMaintenance/ScheduledMaintenancePublication.d.ts +24 -0
  133. package/Types/ScheduledMaintenance/ScheduledMaintenancePublication.js +159 -0
  134. package/Types/ScheduledMaintenance/ScheduledMaintenancePublication.mjs +8 -0
  135. package/Types/StatusPage/StatusPageLanguage.d.mts +6 -0
  136. package/Types/StatusPage/StatusPageLanguage.d.ts +6 -0
  137. package/Types/StatusPage/StatusPageLanguage.js +17 -1
  138. package/Types/StatusPage/StatusPageLanguage.mjs +1 -0
  139. package/Types/Workflow/WorkflowPlan.d.mts +7 -0
  140. package/Types/Workflow/WorkflowPlan.d.ts +7 -0
  141. package/Types/Workflow/WorkflowPlan.js +39 -0
  142. package/Types/Workflow/WorkflowPlan.mjs +3 -0
  143. package/Types/Workspace/WorkspaceMessagePayload.d.mts +11 -0
  144. package/Types/Workspace/WorkspaceMessagePayload.d.ts +11 -0
  145. package/Utils/Dashboard/TableThresholds.d.mts +44 -0
  146. package/Utils/Dashboard/TableThresholds.d.ts +44 -0
  147. package/Utils/Dashboard/TableThresholds.js +288 -0
  148. package/Utils/Dashboard/TableThresholds.mjs +17 -0
  149. package/Utils/Dashboard/ValueWidgetSeries.d.mts +6 -0
  150. package/Utils/Dashboard/ValueWidgetSeries.d.ts +6 -0
  151. package/Utils/Dashboard/ValueWidgetSeries.js +70 -1
  152. package/Utils/Dashboard/ValueWidgetSeries.mjs +2 -0
  153. package/Utils/DeveloperDocs/ResourceProfiles.js +16 -0
  154. package/Utils/DeveloperDocs/TerraformSchema.d.mts +1 -0
  155. package/Utils/DeveloperDocs/TerraformSchema.d.ts +1 -0
  156. package/Utils/DeveloperDocs/TerraformSchema.js +17 -0
  157. package/Utils/DeveloperDocs/TerraformSchema.mjs +1 -0
  158. package/Utils/Monitor/ExternalStatusPageComponentNames.d.mts +17 -0
  159. package/Utils/Monitor/ExternalStatusPageComponentNames.d.ts +17 -0
  160. package/Utils/Monitor/ExternalStatusPageComponentNames.js +274 -0
  161. package/Utils/Monitor/ExternalStatusPageComponentNames.mjs +6 -0
  162. package/Utils/Monitor/ExternalStatusPageReading.d.mts +35 -0
  163. package/Utils/Monitor/ExternalStatusPageReading.d.ts +35 -0
  164. package/Utils/Monitor/ExternalStatusPageReading.js +380 -0
  165. package/Utils/Monitor/ExternalStatusPageReading.mjs +6 -0
  166. package/Utils/Monitor/ExternalStatusPageScope.d.mts +43 -0
  167. package/Utils/Monitor/ExternalStatusPageScope.d.ts +43 -0
  168. package/Utils/Monitor/ExternalStatusPageScope.js +213 -0
  169. package/Utils/Monitor/ExternalStatusPageScope.mjs +4 -0
  170. package/Utils/Runbook/SshHostKeyFingerprint.d.mts +8 -0
  171. package/Utils/Runbook/SshHostKeyFingerprint.d.ts +8 -0
  172. package/Utils/Runbook/SshHostKeyFingerprint.js +83 -0
  173. package/Utils/Runbook/SshHostKeyFingerprint.mjs +5 -0
  174. package/Utils/ScheduledMaintenanceStart.d.mts +6 -0
  175. package/Utils/ScheduledMaintenanceStart.d.ts +6 -0
  176. package/Utils/ScheduledMaintenanceStart.js +15 -0
  177. package/Utils/StatusPage/HistoryChartBarColors.d.mts +2 -0
  178. package/Utils/StatusPage/HistoryChartBarColors.d.ts +2 -0
  179. package/Utils/StatusPage/HistoryChartBarColors.js +12 -1
  180. package/Utils/StatusPage/HistoryChartBarColors.mjs +2 -0
  181. package/Utils/Telemetry/ChangeEventFields.d.mts +19 -1
  182. package/Utils/Telemetry/ChangeEventFields.d.ts +19 -1
  183. package/Utils/Telemetry/ChangeEventFields.js +52 -1
  184. package/Utils/Uptime/DayUptimeGraphUtil.d.mts +6 -0
  185. package/Utils/Uptime/DayUptimeGraphUtil.d.ts +6 -0
  186. package/Utils/Uptime/DayUptimeGraphUtil.js +37 -6
  187. package/Utils/Uptime/UptimeMaintenanceUtil.d.mts +60 -0
  188. package/Utils/Uptime/UptimeMaintenanceUtil.d.ts +60 -0
  189. package/Utils/Uptime/UptimeMaintenanceUtil.js +295 -0
  190. package/Utils/Uptime/UptimeMaintenanceUtil.mjs +3 -0
  191. package/package.json +1 -1
@@ -51,5 +51,6 @@ export declare function getTerraformTypeName(modelType: DatabaseBaseModelType):
51
51
  export declare function isServerManagedColumn(tableName: string, columnName: string): boolean;
52
52
  export declare function getTerraformAttributes(modelType: DatabaseBaseModelType): Array<TerraformAttributeDescriptor>;
53
53
  export declare function getTerraformAttribute(modelType: DatabaseBaseModelType, columnName: string): TerraformAttributeDescriptor | undefined;
54
+ export declare function getColumnsRequiredOnCreate(modelType: DatabaseBaseModelType): Array<string>;
54
55
  export declare function canLookUpByName(modelType: DatabaseBaseModelType): boolean;
55
56
  export declare function getNameColumn(modelType: DatabaseBaseModelType): string | null;
@@ -51,5 +51,6 @@ export declare function getTerraformTypeName(modelType: DatabaseBaseModelType):
51
51
  export declare function isServerManagedColumn(tableName: string, columnName: string): boolean;
52
52
  export declare function getTerraformAttributes(modelType: DatabaseBaseModelType): Array<TerraformAttributeDescriptor>;
53
53
  export declare function getTerraformAttribute(modelType: DatabaseBaseModelType, columnName: string): TerraformAttributeDescriptor | undefined;
54
+ export declare function getColumnsRequiredOnCreate(modelType: DatabaseBaseModelType): Array<string>;
54
55
  export declare function canLookUpByName(modelType: DatabaseBaseModelType): boolean;
55
56
  export declare function getNameColumn(modelType: DatabaseBaseModelType): string | null;
@@ -12,6 +12,7 @@ exports.getTerraformTypeName = getTerraformTypeName;
12
12
  exports.isServerManagedColumn = isServerManagedColumn;
13
13
  exports.getTerraformAttributes = getTerraformAttributes;
14
14
  exports.getTerraformAttribute = getTerraformAttribute;
15
+ exports.getColumnsRequiredOnCreate = getColumnsRequiredOnCreate;
15
16
  exports.canLookUpByName = canLookUpByName;
16
17
  exports.getNameColumn = getNameColumn;
17
18
  const CapitalRuns_1 = require("../CapitalRuns");
@@ -507,6 +508,22 @@ function getTerraformAttribute(modelType, columnName) {
507
508
  return descriptor.columnName === columnName;
508
509
  });
509
510
  }
511
+ /*
512
+ * The columns a create over the API must send: the ones the create schema
513
+ * requires, by the rules above - so not a column with a default, a slug, the
514
+ * project id (the API key's), one that takes any value, a relation object or
515
+ * one a create cannot write. None when the model cannot be created over the
516
+ * API. The API reference badges these, and only these, Required.
517
+ */
518
+ function getColumnsRequiredOnCreate(modelType) {
519
+ return getTerraformAttributes(modelType)
520
+ .filter((descriptor) => {
521
+ return descriptor.isRequired;
522
+ })
523
+ .map((descriptor) => {
524
+ return descriptor.columnName;
525
+ });
526
+ }
510
527
  /*
511
528
  * Whether the model's data source can look a record up by `name`: the
512
529
  * provider's lookup sends `{"query": {"name": ...}}`, so it works only for
@@ -4,6 +4,7 @@ export const TERRAFORM_RESOURCE_META_ARGUMENTS = commonJsModule.TERRAFORM_RESOUR
4
4
  export const TerraformSecretKind = commonJsModule.TerraformSecretKind;
5
5
  export const TerraformValueKind = commonJsModule.TerraformValueKind;
6
6
  export const canLookUpByName = commonJsModule.canLookUpByName;
7
+ export const getColumnsRequiredOnCreate = commonJsModule.getColumnsRequiredOnCreate;
7
8
  export const getNameColumn = commonJsModule.getNameColumn;
8
9
  export const getTerraformAttribute = commonJsModule.getTerraformAttribute;
9
10
  export const getTerraformAttributes = commonJsModule.getTerraformAttributes;
@@ -0,0 +1,17 @@
1
+ export declare const EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD: string;
2
+ export declare const EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAMES: number;
3
+ export declare const EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAME_LENGTH: number;
4
+ export declare const EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH: number;
5
+ export default class ExternalStatusPageComponentNames {
6
+ static comparable(text: string): string;
7
+ static isPattern(name: string): boolean;
8
+ static normalize(value: unknown): Array<string>;
9
+ static matchesComponent(name: string, componentName: string): boolean;
10
+ static picker(names: Array<string>): (componentName: string) => boolean;
11
+ static unmatched(names: Array<string>, componentNames: Array<string>): Array<string>;
12
+ static isFoundIn(name: string, text: string): boolean;
13
+ static fromLegacyName(componentName: unknown): Array<string>;
14
+ static toLegacyName(names: Array<string>): string | undefined;
15
+ private static isOnlyWildcards;
16
+ private static wildcardMatches;
17
+ }
@@ -0,0 +1,17 @@
1
+ export declare const EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD: string;
2
+ export declare const EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAMES: number;
3
+ export declare const EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAME_LENGTH: number;
4
+ export declare const EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH: number;
5
+ export default class ExternalStatusPageComponentNames {
6
+ static comparable(text: string): string;
7
+ static isPattern(name: string): boolean;
8
+ static normalize(value: unknown): Array<string>;
9
+ static matchesComponent(name: string, componentName: string): boolean;
10
+ static picker(names: Array<string>): (componentName: string) => boolean;
11
+ static unmatched(names: Array<string>, componentNames: Array<string>): Array<string>;
12
+ static isFoundIn(name: string, text: string): boolean;
13
+ static fromLegacyName(componentName: unknown): Array<string>;
14
+ static toLegacyName(names: Array<string>): string | undefined;
15
+ private static isOnlyWildcards;
16
+ private static wildcardMatches;
17
+ }
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+ /*
3
+ * THE COMPONENTS AN EXTERNAL STATUS PAGE MONITOR WATCHES, BY NAME.
4
+ *
5
+ * A monitor of a status page can watch the whole page, or only some of its
6
+ * components (issue #5156: GitHub's Git Operations and Pull Requests, not
7
+ * Copilot). It keeps them as names (MonitorStepExternalStatusPageMonitor's
8
+ * componentNames), and a name picks a page's components this way:
9
+ *
10
+ * - A name watches the component of exactly that name. Case and white
11
+ * space do not count: "git operations" is "Git Operations". A picked
12
+ * component never takes another along with it - "Workers" on
13
+ * Cloudflare's page is not "Workers KV", "Copilot" on GitHub's is not
14
+ * "Copilot AI Model Providers".
15
+ * - A "*" stands for any text: "*us-east-1*" watches every component
16
+ * with us-east-1 in its name, "Workers*" every one whose name starts
17
+ * with Workers.
18
+ * - An RSS or Atom feed's items have titles, not components: there a name
19
+ * picks every item whose title holds it somewhere ("Git Operations"
20
+ * picks "Incident with Git Operations").
21
+ *
22
+ * A monitor saved before it could watch several components had one
23
+ * Component Name Filter, which matched every component whose name
24
+ * contained it. It reads as that name between two stars (fromLegacyName),
25
+ * so it watches exactly what it watched before.
26
+ *
27
+ * Names come from the person (what they picked or typed) and from the page
28
+ * (what it lists, what its incidents name): both are read in loops, never
29
+ * by a pattern, in time in line with their length.
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH = exports.EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAME_LENGTH = exports.EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAMES = exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD = void 0;
33
+ exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD = "*";
34
+ // The most names a monitor keeps: more than any page's list needs.
35
+ exports.EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAMES = 500;
36
+ // The longest name a monitor keeps.
37
+ exports.EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAME_LENGTH = 255;
38
+ /*
39
+ * How much of a name or a title a comparison reads. A page's names are
40
+ * short; one that sends a name of megabytes is read for this much of it.
41
+ */
42
+ exports.EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH = 1000;
43
+ // Whether a UTF-16 code unit is white space as a name is read.
44
+ const isWhiteSpaceCode = (code) => {
45
+ return (code === 0x20 || // space
46
+ (code >= 0x09 && code <= 0x0d) || // tab, line breaks
47
+ code === 0xa0 || // no-break space
48
+ code === 0x1680 ||
49
+ (code >= 0x2000 && code <= 0x200a) ||
50
+ code === 0x2028 ||
51
+ code === 0x2029 ||
52
+ code === 0x202f ||
53
+ code === 0x205f ||
54
+ code === 0x3000 ||
55
+ code === 0xfeff);
56
+ };
57
+ class ExternalStatusPageComponentNames {
58
+ /*
59
+ * A name as two names are compared: lower case, without white space at
60
+ * either end, each run of it inside one space, and at most
61
+ * EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH long.
62
+ */
63
+ static comparable(text) {
64
+ const limited = text.length > exports.EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH
65
+ ? text.slice(0, exports.EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH)
66
+ : text;
67
+ let result = "";
68
+ let pendingSpace = false;
69
+ for (let index = 0; index < limited.length; index++) {
70
+ const code = limited.charCodeAt(index);
71
+ if (isWhiteSpaceCode(code)) {
72
+ pendingSpace = result.length > 0;
73
+ continue;
74
+ }
75
+ if (pendingSpace) {
76
+ result += " ";
77
+ pendingSpace = false;
78
+ }
79
+ result += limited.charAt(index);
80
+ }
81
+ return result.toLowerCase();
82
+ }
83
+ // A name with a "*" in it: it stands for any text.
84
+ static isPattern(name) {
85
+ return name.includes(exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD);
86
+ }
87
+ /*
88
+ * The names a monitor keeps, from whatever was stored or typed: each
89
+ * trimmed and at most EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAME_LENGTH
90
+ * long, none empty, each once (as names compare, the first spelling
91
+ * kept), at most EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAMES of them.
92
+ * Anything but a list of names is no names.
93
+ */
94
+ static normalize(value) {
95
+ if (!Array.isArray(value)) {
96
+ return [];
97
+ }
98
+ const names = [];
99
+ const seen = new Set();
100
+ for (const item of value) {
101
+ if (typeof item !== "string") {
102
+ continue;
103
+ }
104
+ const name = item
105
+ .trim()
106
+ .slice(0, exports.EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAME_LENGTH)
107
+ .trim();
108
+ const key = ExternalStatusPageComponentNames.comparable(name);
109
+ if (ExternalStatusPageComponentNames.isOnlyWildcards(key)) {
110
+ /*
111
+ * Nothing, or stars alone, which pick every component: that is the
112
+ * whole page, which no names at all already say.
113
+ */
114
+ continue;
115
+ }
116
+ if (seen.has(key)) {
117
+ continue;
118
+ }
119
+ seen.add(key);
120
+ names.push(name);
121
+ if (names.length >= exports.EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAMES) {
122
+ break;
123
+ }
124
+ }
125
+ return names;
126
+ }
127
+ /*
128
+ * Whether a name the monitor keeps picks a component of this name: the
129
+ * same name, or one its stars match.
130
+ */
131
+ static matchesComponent(name, componentName) {
132
+ const pattern = ExternalStatusPageComponentNames.comparable(name);
133
+ if (!pattern) {
134
+ return false;
135
+ }
136
+ return ExternalStatusPageComponentNames.wildcardMatches(pattern, ExternalStatusPageComponentNames.comparable(componentName));
137
+ }
138
+ /*
139
+ * Whether any of the names picks a component of this name: each name read
140
+ * once for every component a page lists, each component's name once.
141
+ */
142
+ static picker(names) {
143
+ // Names without a star are looked up; only patterns are matched.
144
+ const exact = new Set();
145
+ const patterns = [];
146
+ for (const name of names) {
147
+ const pattern = ExternalStatusPageComponentNames.comparable(name);
148
+ if (!pattern) {
149
+ continue;
150
+ }
151
+ if (ExternalStatusPageComponentNames.isPattern(pattern)) {
152
+ patterns.push(pattern);
153
+ }
154
+ else {
155
+ exact.add(pattern);
156
+ }
157
+ }
158
+ return (componentName) => {
159
+ const text = ExternalStatusPageComponentNames.comparable(componentName);
160
+ return (exact.has(text) ||
161
+ patterns.some((pattern) => {
162
+ return ExternalStatusPageComponentNames.wildcardMatches(pattern, text);
163
+ }));
164
+ };
165
+ }
166
+ /*
167
+ * The names that pick none of these components: a typo, or a component
168
+ * the page renamed or removed.
169
+ */
170
+ static unmatched(names, componentNames) {
171
+ const texts = componentNames.map((componentName) => {
172
+ return ExternalStatusPageComponentNames.comparable(componentName);
173
+ });
174
+ const known = new Set(texts);
175
+ return names.filter((name) => {
176
+ const pattern = ExternalStatusPageComponentNames.comparable(name);
177
+ if (!pattern) {
178
+ return true;
179
+ }
180
+ if (!ExternalStatusPageComponentNames.isPattern(pattern)) {
181
+ return !known.has(pattern);
182
+ }
183
+ return !texts.some((text) => {
184
+ return ExternalStatusPageComponentNames.wildcardMatches(pattern, text);
185
+ });
186
+ });
187
+ }
188
+ /*
189
+ * Whether a name the monitor keeps is somewhere in a feed item's title,
190
+ * its stars matching any text.
191
+ */
192
+ static isFoundIn(name, text) {
193
+ const pattern = ExternalStatusPageComponentNames.comparable(name);
194
+ if (!pattern) {
195
+ return false;
196
+ }
197
+ return ExternalStatusPageComponentNames.wildcardMatches(`${exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD}${pattern}${exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD}`, ExternalStatusPageComponentNames.comparable(text));
198
+ }
199
+ /*
200
+ * The names of a monitor saved with one Component Name Filter, which
201
+ * matched every component whose name contained it: that name between
202
+ * stars, which matches the same components.
203
+ */
204
+ static fromLegacyName(componentName) {
205
+ if (typeof componentName !== "string" || !componentName.trim()) {
206
+ return [];
207
+ }
208
+ return ExternalStatusPageComponentNames.normalize([
209
+ `${exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD}${componentName.trim()}${exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD}`,
210
+ ]);
211
+ }
212
+ /*
213
+ * The one filter a probe that has not been upgraded understands, for these
214
+ * names: it matches every component whose name contains it. One name
215
+ * gives its longest run of text between stars - never fewer components
216
+ * than the name picks, only as many or more. Two or more names have none:
217
+ * such a probe watches the whole page (or group) until it is upgraded,
218
+ * rather than one of the names alone.
219
+ */
220
+ static toLegacyName(names) {
221
+ if (names.length !== 1) {
222
+ return undefined;
223
+ }
224
+ let longest = "";
225
+ for (const part of names[0].split(exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD)) {
226
+ const trimmed = part.trim();
227
+ if (trimmed.length > longest.length) {
228
+ longest = trimmed;
229
+ }
230
+ }
231
+ return longest || undefined;
232
+ }
233
+ // Whether a comparable name is empty, or stars and nothing else.
234
+ static isOnlyWildcards(name) {
235
+ for (let index = 0; index < name.length; index++) {
236
+ if (name.charAt(index) !== exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD) {
237
+ return false;
238
+ }
239
+ }
240
+ return true;
241
+ }
242
+ /*
243
+ * Whether a pattern of text and stars matches the whole of a text, both
244
+ * already comparable. The first piece must start the text, the last end
245
+ * it, and each piece between is found after the one before: for patterns
246
+ * whose only wildcard is "*", taking each piece where it is first found
247
+ * is never wrong.
248
+ */
249
+ static wildcardMatches(pattern, text) {
250
+ const pieces = pattern.split(exports.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD);
251
+ if (pieces.length === 1) {
252
+ return pattern === text;
253
+ }
254
+ const first = pieces[0];
255
+ const last = pieces[pieces.length - 1];
256
+ if (!text.startsWith(first)) {
257
+ return false;
258
+ }
259
+ let position = first.length;
260
+ for (let index = 1; index < pieces.length - 1; index++) {
261
+ const piece = pieces[index];
262
+ if (!piece) {
263
+ continue;
264
+ }
265
+ const found = text.indexOf(piece, position);
266
+ if (found === -1) {
267
+ return false;
268
+ }
269
+ position = found + piece.length;
270
+ }
271
+ return text.length - last.length >= position && text.endsWith(last);
272
+ }
273
+ }
274
+ exports.default = ExternalStatusPageComponentNames;
@@ -0,0 +1,6 @@
1
+ import commonJsModule from "./ExternalStatusPageComponentNames.js";
2
+ export default commonJsModule.default;
3
+ export const EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD = commonJsModule.EXTERNAL_STATUS_PAGE_COMPONENT_WILDCARD;
4
+ export const EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH = commonJsModule.EXTERNAL_STATUS_PAGE_MAX_COMPARED_LENGTH;
5
+ export const EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAMES = commonJsModule.EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAMES;
6
+ export const EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAME_LENGTH = commonJsModule.EXTERNAL_STATUS_PAGE_MAX_COMPONENT_NAME_LENGTH;
@@ -0,0 +1,35 @@
1
+ import { StatusPageSummary } from "../../Types/StatusPage/StatusPageSummary.mjs";
2
+ export declare const EXTERNAL_STATUS_PAGE_MAX_COMPONENTS: number;
3
+ export declare const EXTERNAL_STATUS_PAGE_MAX_INCIDENTS: number;
4
+ export declare const EXTERNAL_STATUS_PAGE_UNNAMED_INCIDENT: string;
5
+ export declare const EXTERNAL_STATUS_PAGE_ONEUPTIME_STATUS_NOT_SHOWN: string;
6
+ export interface ExternalStatusPageComponent {
7
+ name: string;
8
+ status: string;
9
+ description?: string | undefined;
10
+ groupName?: string | undefined;
11
+ key?: string | undefined;
12
+ }
13
+ export interface ExternalStatusPageIncident {
14
+ name: string;
15
+ affectedComponentNames: Array<string>;
16
+ affectedComponentKeys?: Array<string> | undefined;
17
+ }
18
+ export interface ExternalStatusPageContents {
19
+ components: Array<ExternalStatusPageComponent>;
20
+ incidents: Array<ExternalStatusPageIncident>;
21
+ }
22
+ export interface AtlassianStatuspageUrls {
23
+ status: string;
24
+ components: string;
25
+ unresolvedIncidents: string;
26
+ }
27
+ export default class ExternalStatusPageReading {
28
+ static getAtlassianUrls(statusPageUrl: string): AtlassianStatuspageUrls;
29
+ static getIncidentIoUrl(statusPageUrl: string): string | null;
30
+ static readAtlassianPageStatus(json: unknown): string | null;
31
+ static readAtlassianComponents(json: unknown): Array<ExternalStatusPageComponent> | null;
32
+ static readAtlassianIncidents(json: unknown): Array<ExternalStatusPageIncident>;
33
+ static readIncidentIo(json: unknown): ExternalStatusPageContents | null;
34
+ static readOneUptimeSummary(summary: StatusPageSummary): ExternalStatusPageContents;
35
+ }
@@ -0,0 +1,35 @@
1
+ import { StatusPageSummary } from "../../Types/StatusPage/StatusPageSummary";
2
+ export declare const EXTERNAL_STATUS_PAGE_MAX_COMPONENTS: number;
3
+ export declare const EXTERNAL_STATUS_PAGE_MAX_INCIDENTS: number;
4
+ export declare const EXTERNAL_STATUS_PAGE_UNNAMED_INCIDENT: string;
5
+ export declare const EXTERNAL_STATUS_PAGE_ONEUPTIME_STATUS_NOT_SHOWN: string;
6
+ export interface ExternalStatusPageComponent {
7
+ name: string;
8
+ status: string;
9
+ description?: string | undefined;
10
+ groupName?: string | undefined;
11
+ key?: string | undefined;
12
+ }
13
+ export interface ExternalStatusPageIncident {
14
+ name: string;
15
+ affectedComponentNames: Array<string>;
16
+ affectedComponentKeys?: Array<string> | undefined;
17
+ }
18
+ export interface ExternalStatusPageContents {
19
+ components: Array<ExternalStatusPageComponent>;
20
+ incidents: Array<ExternalStatusPageIncident>;
21
+ }
22
+ export interface AtlassianStatuspageUrls {
23
+ status: string;
24
+ components: string;
25
+ unresolvedIncidents: string;
26
+ }
27
+ export default class ExternalStatusPageReading {
28
+ static getAtlassianUrls(statusPageUrl: string): AtlassianStatuspageUrls;
29
+ static getIncidentIoUrl(statusPageUrl: string): string | null;
30
+ static readAtlassianPageStatus(json: unknown): string | null;
31
+ static readAtlassianComponents(json: unknown): Array<ExternalStatusPageComponent> | null;
32
+ static readAtlassianIncidents(json: unknown): Array<ExternalStatusPageIncident>;
33
+ static readIncidentIo(json: unknown): ExternalStatusPageContents | null;
34
+ static readOneUptimeSummary(summary: StatusPageSummary): ExternalStatusPageContents;
35
+ }