@oneuptime/common 14.0.91 → 14.0.93

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 (174) hide show
  1. package/Models/DatabaseModels/Alert.js +8 -1
  2. package/Models/DatabaseModels/AlertEpisodeMember.d.mts +1 -0
  3. package/Models/DatabaseModels/AlertEpisodeMember.d.ts +1 -0
  4. package/Models/DatabaseModels/AlertEpisodeMember.js +50 -0
  5. package/Models/DatabaseModels/AutoRemediationRule.js +1 -1
  6. package/Models/DatabaseModels/CodeRepository.d.mts +1 -0
  7. package/Models/DatabaseModels/CodeRepository.d.ts +1 -0
  8. package/Models/DatabaseModels/CodeRepository.js +69 -6
  9. package/Models/DatabaseModels/IncidentEpisodeMember.d.mts +1 -0
  10. package/Models/DatabaseModels/IncidentEpisodeMember.d.ts +1 -0
  11. package/Models/DatabaseModels/IncidentEpisodeMember.js +50 -0
  12. package/Models/DatabaseModels/IncomingCallPolicy.js +1 -1
  13. package/Models/DatabaseModels/LlmProvider.js +1 -1
  14. package/Models/DatabaseModels/MonitorTemplate.js +10 -4
  15. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +13 -13
  16. package/Models/DatabaseModels/OnCallDutyPolicy.js +1 -1
  17. package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +1 -1
  18. package/Models/DatabaseModels/StatusPage.d.mts +2 -0
  19. package/Models/DatabaseModels/StatusPage.d.ts +2 -0
  20. package/Models/DatabaseModels/StatusPage.js +100 -0
  21. package/Types/AI/CodeTask.d.mts +1 -0
  22. package/Types/AI/CodeTask.d.ts +1 -0
  23. package/Types/AI/TelemetryAiActivity.d.mts +1 -0
  24. package/Types/AI/TelemetryAiActivity.d.ts +1 -0
  25. package/Types/AI/TelemetryAiActivity.js +4 -0
  26. package/Types/CodeRepository/CodeRepositorySetting.d.mts +15 -0
  27. package/Types/CodeRepository/CodeRepositorySetting.d.ts +15 -0
  28. package/Types/CodeRepository/CodeRepositorySetting.js +49 -0
  29. package/Types/CodeRepository/CodeRepositorySetting.mjs +3 -0
  30. package/Types/Database/BlankColumnValue.d.mts +6 -0
  31. package/Types/Database/BlankColumnValue.d.ts +6 -0
  32. package/Types/Database/BlankColumnValue.js +77 -0
  33. package/Types/Database/BlankColumnValue.mjs +4 -0
  34. package/Types/Date.d.mts +10 -0
  35. package/Types/Date.d.ts +10 -0
  36. package/Types/Date.js +385 -98
  37. package/Types/DateLanguage.d.mts +67 -0
  38. package/Types/DateLanguage.d.ts +67 -0
  39. package/Types/DateLanguage.js +478 -0
  40. package/Types/DateLanguage.mjs +21 -0
  41. package/Types/Email/EmailTemplateType.d.mts +1 -0
  42. package/Types/Email/EmailTemplateType.d.ts +1 -0
  43. package/Types/Email/EmailTemplateType.js +1 -0
  44. package/Types/IncomingCall/IncomingCallPolicyRepeat.d.mts +6 -0
  45. package/Types/IncomingCall/IncomingCallPolicyRepeat.d.ts +6 -0
  46. package/Types/IncomingCall/IncomingCallPolicyRepeat.js +41 -14
  47. package/Types/IncomingCall/IncomingCallPolicyRepeat.mjs +3 -0
  48. package/Types/Monitor/CriteriaFilter.d.mts +1 -0
  49. package/Types/Monitor/CriteriaFilter.d.ts +1 -0
  50. package/Types/Monitor/CriteriaFilter.js +9 -0
  51. package/Types/Monitor/DatabaseMetricCatalog.js +2 -2
  52. package/Types/Monitor/KubernetesEventAlertTemplates.d.mts +20 -0
  53. package/Types/Monitor/KubernetesEventAlertTemplates.d.ts +20 -0
  54. package/Types/Monitor/KubernetesEventAlertTemplates.js +232 -0
  55. package/Types/Monitor/KubernetesEventAlertTemplates.mjs +8 -0
  56. package/Types/Monitor/MonitorType.js +12 -2
  57. package/Types/Monitor/Recommendation/MonitorRecommendationCatalog.js +27 -2
  58. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.mts +1 -0
  59. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.d.ts +1 -0
  60. package/Types/Monitor/Recommendation/MonitorRecommendationUtil.js +31 -1
  61. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.mts +3 -1
  62. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.d.ts +3 -1
  63. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +3 -2
  64. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.mts +1 -0
  65. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.d.ts +1 -0
  66. package/Types/NotificationSetting/NotificationEmailRollupCategory.js +2 -0
  67. package/Types/NotificationSetting/NotificationEmailRollupPolicy.js +10 -3
  68. package/Types/NotificationSetting/NotificationSettingEventType.d.mts +1 -0
  69. package/Types/NotificationSetting/NotificationSettingEventType.d.ts +1 -0
  70. package/Types/NotificationSetting/NotificationSettingEventType.js +7 -0
  71. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.mts +7 -0
  72. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.d.ts +7 -0
  73. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.js +51 -0
  74. package/Types/OnCallDutyPolicy/OnCallDutyPolicyRepeat.mjs +4 -0
  75. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.mts +8 -0
  76. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.d.ts +8 -0
  77. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.js +55 -0
  78. package/Types/Reminder/ScheduledMaintenanceReminderNeverReminds.mjs +5 -0
  79. package/Types/Runner/CodeRepositoryRunner.d.mts +7 -0
  80. package/Types/Runner/CodeRepositoryRunner.d.ts +7 -0
  81. package/Types/Runner/CodeRepositoryRunner.js +60 -14
  82. package/Types/Runner/CodeRepositoryRunner.mjs +1 -0
  83. package/Types/SecurityEvent/OcsfProcessActivity.d.mts +25 -0
  84. package/Types/SecurityEvent/OcsfProcessActivity.d.ts +25 -0
  85. package/Types/SecurityEvent/OcsfProcessActivity.js +131 -0
  86. package/Types/SecurityEvent/OcsfProcessActivity.mjs +8 -0
  87. package/Types/Workflow/Templates.js +2 -5
  88. package/UI/Utils/TranslateTemplate.d.mts +73 -0
  89. package/UI/Utils/TranslateTemplate.d.ts +73 -0
  90. package/Utils/ColorContrast.d.mts +3 -0
  91. package/Utils/ColorContrast.d.ts +3 -0
  92. package/Utils/ColorContrast.js +41 -3
  93. package/Utils/ColorContrast.mjs +2 -0
  94. package/Utils/CronTab.d.mts +41 -3
  95. package/Utils/CronTab.d.ts +41 -3
  96. package/Utils/CronTab.js +112 -38
  97. package/Utils/Incident/WhoOpenedItRootCause.d.mts +2 -0
  98. package/Utils/Incident/WhoOpenedItRootCause.d.ts +2 -0
  99. package/Utils/Incident/WhoOpenedItRootCause.js +50 -0
  100. package/Utils/Incident/WhoOpenedItRootCause.mjs +3 -0
  101. package/Utils/Monitor/MonitorOverviewTargetUtil.d.mts +2 -0
  102. package/Utils/Monitor/MonitorOverviewTargetUtil.d.ts +2 -0
  103. package/Utils/Monitor/MonitorOverviewTargetUtil.js +13 -2
  104. package/Utils/Monitor/SyntheticMonitorStepsUtil.d.mts +18 -0
  105. package/Utils/Monitor/SyntheticMonitorStepsUtil.d.ts +18 -0
  106. package/Utils/Monitor/SyntheticMonitorStepsUtil.js +129 -0
  107. package/Utils/Monitor/SyntheticMonitorStepsUtil.mjs +4 -0
  108. package/Utils/Rules/RuleRunSummary.d.mts +1 -0
  109. package/Utils/Rules/RuleRunSummary.d.ts +1 -0
  110. package/Utils/Rules/RuleRunSummary.js +19 -1
  111. package/Utils/Rules/RuleRunSummary.mjs +1 -0
  112. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.mts +5 -0
  113. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.d.ts +5 -0
  114. package/Utils/SecurityEvent/Destinations/GoogleSecOpsUdmMapper.js +219 -58
  115. package/Utils/SecurityEvent/OcsfNormalizer.js +22 -13
  116. package/Utils/Slo/SloDuration.d.mts +1 -0
  117. package/Utils/Slo/SloDuration.d.ts +1 -0
  118. package/Utils/Slo/SloDuration.js +57 -8
  119. package/Utils/Slo/SloDuration.mjs +1 -0
  120. package/Utils/Sms/Gsm7Text.js +9 -1
  121. package/Utils/Sms/OnCallPageSms.d.mts +2 -0
  122. package/Utils/Sms/OnCallPageSms.d.ts +2 -0
  123. package/Utils/Sms/OnCallPageSms.js +19 -2
  124. package/Utils/Sms/OnCallPageSms.mjs +1 -0
  125. package/Utils/Sms/SubscriberSms.d.mts +2 -0
  126. package/Utils/Sms/SubscriberSms.d.ts +2 -0
  127. package/Utils/Sms/SubscriberSms.js +35 -0
  128. package/Utils/Sms/SubscriberSms.mjs +3 -0
  129. package/Utils/Suggestions/CodeFixSuggestion.d.mts +15 -0
  130. package/Utils/Suggestions/CodeFixSuggestion.d.ts +15 -0
  131. package/Utils/Suggestions/CodeFixSuggestion.js +62 -1
  132. package/Utils/Suggestions/CodeFixSuggestion.mjs +4 -0
  133. package/Utils/Suggestions/ProfileFixSuggestion.js +4 -0
  134. package/Utils/Suggestions/SuggestionBlocker.d.mts +8 -0
  135. package/Utils/Suggestions/SuggestionBlocker.d.ts +8 -0
  136. package/Utils/Suggestions/SuggestionBlocker.js +51 -0
  137. package/Utils/Suggestions/SuggestionBlocker.mjs +4 -0
  138. package/Utils/Suggestions/SuggestionOffer.d.mts +2 -1
  139. package/Utils/Suggestions/SuggestionOffer.d.ts +2 -1
  140. package/Utils/Suggestions/SuggestionOffer.js +5 -0
  141. package/Utils/Suggestions/TelemetryAiFixSuggestion.d.mts +2 -7
  142. package/Utils/Suggestions/TelemetryAiFixSuggestion.d.ts +2 -7
  143. package/Utils/Suggestions/TelemetryAiFixSuggestion.js +8 -36
  144. package/Utils/Suggestions/TelemetryImprovementSuggestion.d.mts +1 -0
  145. package/Utils/Suggestions/TelemetryImprovementSuggestion.d.ts +1 -0
  146. package/Utils/Suggestions/TelemetryImprovementSuggestion.js +1 -0
  147. package/Utils/Suggestions/TracePerformanceFixSuggestion.d.mts +6 -0
  148. package/Utils/Suggestions/TracePerformanceFixSuggestion.d.ts +6 -0
  149. package/Utils/Suggestions/TracePerformanceFixSuggestion.js +46 -5
  150. package/package.json +8 -1
  151. package/Utils/Monitor/MonitorCheckScheduleUtil.d.mts +0 -61
  152. package/Utils/Monitor/MonitorCheckScheduleUtil.d.ts +0 -61
  153. package/Utils/Monitor/MonitorCheckScheduleUtil.js +0 -476
  154. package/Utils/Monitor/MonitorCheckScheduleUtil.mjs +0 -3
  155. package/Utils/Monitor/MonitorOverviewFamily.d.mts +0 -39
  156. package/Utils/Monitor/MonitorOverviewFamily.d.ts +0 -39
  157. package/Utils/Monitor/MonitorOverviewFamily.js +0 -206
  158. package/Utils/Monitor/MonitorOverviewFamily.mjs +0 -4
  159. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.mts +0 -189
  160. package/Utils/Monitor/MonitorOverviewPresentationUtil.d.ts +0 -189
  161. package/Utils/Monitor/MonitorOverviewPresentationUtil.js +0 -1480
  162. package/Utils/Monitor/MonitorOverviewPresentationUtil.mjs +0 -5
  163. package/Utils/Monitor/MonitorOverviewProbeUtil.d.mts +0 -112
  164. package/Utils/Monitor/MonitorOverviewProbeUtil.d.ts +0 -112
  165. package/Utils/Monitor/MonitorOverviewProbeUtil.js +0 -640
  166. package/Utils/Monitor/MonitorOverviewProbeUtil.mjs +0 -3
  167. package/Utils/Monitor/MonitorStatusHistoryUtil.d.mts +0 -27
  168. package/Utils/Monitor/MonitorStatusHistoryUtil.d.ts +0 -27
  169. package/Utils/Monitor/MonitorStatusHistoryUtil.js +0 -132
  170. package/Utils/Monitor/MonitorStatusHistoryUtil.mjs +0 -2
  171. package/Utils/Monitor/MonitorUptimeSummaryUtil.d.mts +0 -42
  172. package/Utils/Monitor/MonitorUptimeSummaryUtil.d.ts +0 -42
  173. package/Utils/Monitor/MonitorUptimeSummaryUtil.js +0 -468
  174. package/Utils/Monitor/MonitorUptimeSummaryUtil.mjs +0 -2
@@ -0,0 +1,8 @@
1
+ import commonJsModule from "./OcsfProcessActivity.js";
2
+ export const OCSF_PROCESS_ACTIVITY_CLASS_UID = commonJsModule.OCSF_PROCESS_ACTIVITY_CLASS_UID;
3
+ export const OCSF_PROCESS_ACTIVITY_NAMES = commonJsModule.OCSF_PROCESS_ACTIVITY_NAMES;
4
+ export const OcsfProcessActivityId = commonJsModule.OcsfProcessActivityId;
5
+ export const ProcessActivityKind = commonJsModule.ProcessActivityKind;
6
+ export const getProcessActivityKind = commonJsModule.getProcessActivityKind;
7
+ export const ocsfProcessActivityName = commonJsModule.ocsfProcessActivityName;
8
+ export const readProcessActivityId = commonJsModule.readProcessActivityId;
@@ -467,18 +467,15 @@ const ALERT_KIND = {
467
467
  creating: "Creating",
468
468
  quietCreateFields: {},
469
469
  quietCreateText: "",
470
- /*
471
- * An alert's root cause is written when the alert is created and cannot be
472
- * edited afterwards, so it is not listened on. The comment still shows it.
473
- */
474
470
  editListenOn: {
475
471
  title: true,
476
472
  description: true,
477
473
  alertSeverityId: true,
478
474
  alertSeverity: true,
475
+ rootCause: true,
479
476
  remediationNotes: true,
480
477
  },
481
- editedFieldsText: "title, severity, description or remediation notes",
478
+ editedFieldsText: "title, severity, description, root cause or remediation notes",
482
479
  hasPublicNotes: false,
483
480
  otherPlural: "incidents",
484
481
  };
@@ -0,0 +1,73 @@
1
+ export interface TranslatableTerm {
2
+ readonly translatableTerm: string;
3
+ readonly inSentence: boolean;
4
+ }
5
+ export interface ComposedValue {
6
+ readonly compose: (translator: Translator) => string;
7
+ }
8
+ export type TemplateValue = string | number | TranslatableTerm | ComposedValue;
9
+ export type TemplateValues = Record<string, TemplateValue>;
10
+ export interface PluralTemplate {
11
+ one: string;
12
+ other: string;
13
+ }
14
+ export type TextLookup = (text: string) => string | undefined;
15
+ export interface TermOptions {
16
+ inSentence?: boolean | undefined;
17
+ }
18
+ export declare const translatableTerm: (text: string, options?: TermOptions) => TranslatableTerm;
19
+ export declare const isTranslatableTerm: (value: unknown) => value is TranslatableTerm;
20
+ export declare const composedValue: (compose: (translator: Translator) => string) => ComposedValue;
21
+ export declare const isComposedValue: (value: unknown) => value is ComposedValue;
22
+ export declare const translationKey: <T extends string>(text: T) => T;
23
+ export declare const DEFAULT_LANGUAGE: string;
24
+ export declare const toSentenceTerm: (text: string, language?: string) => string;
25
+ export declare const getPluralCategory: (language: string, count: number) => string;
26
+ export declare const getTemplatePlaceholders: (template: string) => Array<string>;
27
+ export declare const fillTemplate: (template: string, values?: TemplateValues) => string;
28
+ export interface Translator {
29
+ language: string;
30
+ translateText: (text: string | undefined) => string | undefined;
31
+ hasTranslation: (text: string) => boolean;
32
+ translateTemplate: (template: string, values?: TemplateValues) => string;
33
+ translatePlural: (template: PluralTemplate, count: number, values?: TemplateValues) => string;
34
+ translateTerm: (text: string | undefined, options?: TermOptions) => string;
35
+ formatNumber: (value: number) => string;
36
+ }
37
+ export declare const createTranslator: (lookup: TextLookup | undefined, language?: string | undefined) => Translator;
38
+ export declare const getGlobalTranslator: () => Translator;
39
+ export declare const translateText: (text: string | undefined) => string | undefined;
40
+ export declare const translateTerm: (text: string | undefined, options?: TermOptions) => string;
41
+ export declare const translateTemplate: (template: string, values?: TemplateValues) => string;
42
+ export declare const translatePlural: (template: PluralTemplate, count: number, values?: TemplateValues) => string;
43
+ export declare const getSentenceLanguage: (translator: Translator, template: string | PluralTemplate) => string;
44
+ export declare const translateNamedAction: (translator: Translator, data: {
45
+ template: string;
46
+ itemName: string;
47
+ values?: TemplateValues;
48
+ }) => string;
49
+ export type SentencePart = {
50
+ kind: "text";
51
+ text: string;
52
+ } | {
53
+ kind: "slot";
54
+ slot: string;
55
+ };
56
+ export interface SentenceParts {
57
+ parts: Array<SentencePart>;
58
+ language: string;
59
+ }
60
+ export interface SentencePartsInput {
61
+ translator: Translator;
62
+ template: string | PluralTemplate;
63
+ slots: ReadonlyArray<string>;
64
+ values?: TemplateValues | undefined;
65
+ count?: number | undefined;
66
+ }
67
+ export declare const getSentenceParts: (data: SentencePartsInput) => Array<SentencePart>;
68
+ export declare const getSentencePartsAndLanguage: (data: SentencePartsInput) => SentenceParts;
69
+ export interface TemplateAround {
70
+ before: string;
71
+ after: string;
72
+ }
73
+ export declare const translateTemplateAround: (template: string, slot: string, values?: TemplateValues) => TemplateAround;
@@ -0,0 +1,73 @@
1
+ export interface TranslatableTerm {
2
+ readonly translatableTerm: string;
3
+ readonly inSentence: boolean;
4
+ }
5
+ export interface ComposedValue {
6
+ readonly compose: (translator: Translator) => string;
7
+ }
8
+ export type TemplateValue = string | number | TranslatableTerm | ComposedValue;
9
+ export type TemplateValues = Record<string, TemplateValue>;
10
+ export interface PluralTemplate {
11
+ one: string;
12
+ other: string;
13
+ }
14
+ export type TextLookup = (text: string) => string | undefined;
15
+ export interface TermOptions {
16
+ inSentence?: boolean | undefined;
17
+ }
18
+ export declare const translatableTerm: (text: string, options?: TermOptions) => TranslatableTerm;
19
+ export declare const isTranslatableTerm: (value: unknown) => value is TranslatableTerm;
20
+ export declare const composedValue: (compose: (translator: Translator) => string) => ComposedValue;
21
+ export declare const isComposedValue: (value: unknown) => value is ComposedValue;
22
+ export declare const translationKey: <T extends string>(text: T) => T;
23
+ export declare const DEFAULT_LANGUAGE: string;
24
+ export declare const toSentenceTerm: (text: string, language?: string) => string;
25
+ export declare const getPluralCategory: (language: string, count: number) => string;
26
+ export declare const getTemplatePlaceholders: (template: string) => Array<string>;
27
+ export declare const fillTemplate: (template: string, values?: TemplateValues) => string;
28
+ export interface Translator {
29
+ language: string;
30
+ translateText: (text: string | undefined) => string | undefined;
31
+ hasTranslation: (text: string) => boolean;
32
+ translateTemplate: (template: string, values?: TemplateValues) => string;
33
+ translatePlural: (template: PluralTemplate, count: number, values?: TemplateValues) => string;
34
+ translateTerm: (text: string | undefined, options?: TermOptions) => string;
35
+ formatNumber: (value: number) => string;
36
+ }
37
+ export declare const createTranslator: (lookup: TextLookup | undefined, language?: string | undefined) => Translator;
38
+ export declare const getGlobalTranslator: () => Translator;
39
+ export declare const translateText: (text: string | undefined) => string | undefined;
40
+ export declare const translateTerm: (text: string | undefined, options?: TermOptions) => string;
41
+ export declare const translateTemplate: (template: string, values?: TemplateValues) => string;
42
+ export declare const translatePlural: (template: PluralTemplate, count: number, values?: TemplateValues) => string;
43
+ export declare const getSentenceLanguage: (translator: Translator, template: string | PluralTemplate) => string;
44
+ export declare const translateNamedAction: (translator: Translator, data: {
45
+ template: string;
46
+ itemName: string;
47
+ values?: TemplateValues;
48
+ }) => string;
49
+ export type SentencePart = {
50
+ kind: "text";
51
+ text: string;
52
+ } | {
53
+ kind: "slot";
54
+ slot: string;
55
+ };
56
+ export interface SentenceParts {
57
+ parts: Array<SentencePart>;
58
+ language: string;
59
+ }
60
+ export interface SentencePartsInput {
61
+ translator: Translator;
62
+ template: string | PluralTemplate;
63
+ slots: ReadonlyArray<string>;
64
+ values?: TemplateValues | undefined;
65
+ count?: number | undefined;
66
+ }
67
+ export declare const getSentenceParts: (data: SentencePartsInput) => Array<SentencePart>;
68
+ export declare const getSentencePartsAndLanguage: (data: SentencePartsInput) => SentenceParts;
69
+ export interface TemplateAround {
70
+ before: string;
71
+ after: string;
72
+ }
73
+ export declare const translateTemplateAround: (template: string, slot: string, values?: TemplateValues) => TemplateAround;
@@ -8,7 +8,10 @@ export declare function getReadableShade(data: {
8
8
  background: RGB;
9
9
  minimumContrast: number;
10
10
  maximumSaturation?: number | undefined;
11
+ towards?: "dark" | "light" | undefined;
11
12
  }): RGB;
13
+ export declare const FILLED_TEXT_MINIMUM_CONTRAST: number;
14
+ export declare function getReadableTextOnFill(fill: RGB): RGB;
12
15
  export declare function getAlphaForLuminance(data: {
13
16
  color: RGB;
14
17
  surface: RGB;
@@ -8,7 +8,10 @@ export declare function getReadableShade(data: {
8
8
  background: RGB;
9
9
  minimumContrast: number;
10
10
  maximumSaturation?: number | undefined;
11
+ towards?: "dark" | "light" | undefined;
11
12
  }): RGB;
13
+ export declare const FILLED_TEXT_MINIMUM_CONTRAST: number;
14
+ export declare function getReadableTextOnFill(fill: RGB): RGB;
12
15
  export declare function getAlphaForLuminance(data: {
13
16
  color: RGB;
14
17
  surface: RGB;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FILLED_TEXT_MINIMUM_CONTRAST = void 0;
3
4
  exports.parseColor = parseColor;
4
5
  exports.getRelativeLuminance = getRelativeLuminance;
5
6
  exports.getContrastRatio = getContrastRatio;
6
7
  exports.composite = composite;
7
8
  exports.getReadableShade = getReadableShade;
9
+ exports.getReadableTextOnFill = getReadableTextOnFill;
8
10
  exports.getAlphaForLuminance = getAlphaForLuminance;
9
11
  // #rgb, #rrggbb, or #rrggbbaa (the alpha is ignored); the # is optional.
10
12
  const HEX_PATTERN = /^#?([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/;
@@ -132,8 +134,8 @@ function hslToRgb(hsl) {
132
134
  * The shade of `color` nearest to it that reaches `minimumContrast` against
133
135
  * `background`: the colour itself when it already does, otherwise the same
134
136
  * hue with only the lightness moved - toward black on a light background,
135
- * toward white on a dark one. Lightness moves luminance one way only, so a
136
- * binary search finds the boundary.
137
+ * toward white on a dark one, or the way `towards` says. Lightness moves
138
+ * luminance one way only, so a binary search finds the boundary.
137
139
  */
138
140
  function getReadableShade(data) {
139
141
  if (getContrastRatio(data.color, data.background) >= data.minimumContrast) {
@@ -150,7 +152,13 @@ function getReadableShade(data) {
150
152
  }
151
153
  // `low` never passes; `high` always does (black or white at the limit).
152
154
  let low = hsl.lightness;
153
- let high = getRelativeLuminance(data.background) < 0.5 ? 1 : 0;
155
+ let high = data.towards
156
+ ? data.towards === "light"
157
+ ? 1
158
+ : 0
159
+ : getRelativeLuminance(data.background) < 0.5
160
+ ? 1
161
+ : 0;
154
162
  for (let step = 0; step < 24; step++) {
155
163
  const middle = (low + high) / 2;
156
164
  if (passes(middle)) {
@@ -162,6 +170,36 @@ function getReadableShade(data) {
162
170
  }
163
171
  return hslToRgb(Object.assign(Object.assign({}, hsl), { lightness: high }));
164
172
  }
173
+ /*
174
+ * WCAG's minimum for text: what text written on a filled colour must reach.
175
+ */
176
+ exports.FILLED_TEXT_MINIMUM_CONTRAST = 4.5;
177
+ const WHITE = { red: 255, green: 255, blue: 255 };
178
+ /*
179
+ * The colour of text written on a filled colour someone picked - a status
180
+ * page's banner in the colour its owner gave a monitor status: white when
181
+ * white reads on it at 4.5:1, otherwise the lightest shade of the fill's own
182
+ * colour that does, so the words keep its family - deep green on a green
183
+ * banner, deep amber on a yellow one - rather than turning grey.
184
+ *
185
+ * White on the default Operational green (#2ab57d) was 2.6:1, on Degraded's
186
+ * yellow (#ffbf53) 1.6:1. A shade toward black always reaches 4.5:1 where
187
+ * white does not (black reaches more than 4.6:1 on anything white fails
188
+ * on), so there always is one. The fill itself is never changed: it is the colour
189
+ * the owner chose, the same in the light theme and the dark one, and so is
190
+ * the text on it.
191
+ */
192
+ function getReadableTextOnFill(fill) {
193
+ if (getContrastRatio(WHITE, fill) >= exports.FILLED_TEXT_MINIMUM_CONTRAST) {
194
+ return WHITE;
195
+ }
196
+ return getReadableShade({
197
+ color: fill,
198
+ background: fill,
199
+ minimumContrast: exports.FILLED_TEXT_MINIMUM_CONTRAST,
200
+ towards: "dark",
201
+ });
202
+ }
165
203
  /*
166
204
  * The opacity at which `color` over `surface` lands nearest to
167
205
  * `targetLuminance`, kept inside `range`. More opacity only ever moves the
@@ -1,7 +1,9 @@
1
1
  import commonJsModule from "./ColorContrast.js";
2
+ export const FILLED_TEXT_MINIMUM_CONTRAST = commonJsModule.FILLED_TEXT_MINIMUM_CONTRAST;
2
3
  export const composite = commonJsModule.composite;
3
4
  export const getAlphaForLuminance = commonJsModule.getAlphaForLuminance;
4
5
  export const getContrastRatio = commonJsModule.getContrastRatio;
5
6
  export const getReadableShade = commonJsModule.getReadableShade;
7
+ export const getReadableTextOnFill = commonJsModule.getReadableTextOnFill;
6
8
  export const getRelativeLuminance = commonJsModule.getRelativeLuminance;
7
9
  export const parseColor = commonJsModule.parseColor;
@@ -45,6 +45,41 @@ export interface CronExpressionFields {
45
45
  readonly dayOfWeek: CronFieldValues;
46
46
  readonly hasSeconds: boolean;
47
47
  }
48
+ export type CronScheduleShape = {
49
+ kind: "everyMinute";
50
+ } | {
51
+ kind: "everyMinutes";
52
+ step: number;
53
+ } | {
54
+ kind: "everyHourOnTheHour";
55
+ } | {
56
+ kind: "everyHours";
57
+ step: number;
58
+ minute: number;
59
+ } | {
60
+ kind: "daily";
61
+ hour: number;
62
+ minute: number;
63
+ } | {
64
+ kind: "weekly";
65
+ weekdays: Array<number>;
66
+ hour: number;
67
+ minute: number;
68
+ } | {
69
+ kind: "monthly";
70
+ daysOfMonth: Array<number>;
71
+ monthStep: number;
72
+ hour: number;
73
+ minute: number;
74
+ } | {
75
+ kind: "yearly";
76
+ daysOfMonth: Array<number>;
77
+ months: Array<number>;
78
+ hour: number;
79
+ minute: number;
80
+ } | {
81
+ kind: "fieldByField";
82
+ };
48
83
  export default class CronTab {
49
84
  /**
50
85
  * Curated list of common schedules offered in the picker. Every value here
@@ -71,6 +106,7 @@ export default class CronTab {
71
106
  * expression cannot be parsed.
72
107
  */
73
108
  static getHumanReadableDescription(expression: string): string | null;
109
+ static getScheduleShape(expression: string): CronScheduleShape | null;
74
110
  /**
75
111
  * Computes the next `count` fire times (in UTC) at or after `from`
76
112
  * (exclusive). Returns fewer than `count` entries only if the pattern has no
@@ -94,6 +130,8 @@ export default class CronTab {
94
130
  private static nextAllowed;
95
131
  private static startOfNextDay;
96
132
  private static advanceToNextMonth;
133
+ private static getShapeOf;
134
+ static describeTimeOfDay(hour: number, minute: number): string;
97
135
  private static describe;
98
136
  private static describeGeneric;
99
137
  private static isDefaultSecond;
@@ -104,9 +142,9 @@ export default class CronTab {
104
142
  * Returns the step, or null when the field isn't a clean step.
105
143
  */
106
144
  private static detectStep;
107
- private static describeWeekdays;
108
- private static describeMonths;
109
- private static describeDaysOfMonth;
145
+ static describeWeekdays(values: Array<number>): string;
146
+ static describeMonths(values: Array<number>): string;
147
+ static describeDaysOfMonth(values: Array<number>): string;
110
148
  private static joinList;
111
149
  private static ordinal;
112
150
  private static pad;
@@ -45,6 +45,41 @@ export interface CronExpressionFields {
45
45
  readonly dayOfWeek: CronFieldValues;
46
46
  readonly hasSeconds: boolean;
47
47
  }
48
+ export type CronScheduleShape = {
49
+ kind: "everyMinute";
50
+ } | {
51
+ kind: "everyMinutes";
52
+ step: number;
53
+ } | {
54
+ kind: "everyHourOnTheHour";
55
+ } | {
56
+ kind: "everyHours";
57
+ step: number;
58
+ minute: number;
59
+ } | {
60
+ kind: "daily";
61
+ hour: number;
62
+ minute: number;
63
+ } | {
64
+ kind: "weekly";
65
+ weekdays: Array<number>;
66
+ hour: number;
67
+ minute: number;
68
+ } | {
69
+ kind: "monthly";
70
+ daysOfMonth: Array<number>;
71
+ monthStep: number;
72
+ hour: number;
73
+ minute: number;
74
+ } | {
75
+ kind: "yearly";
76
+ daysOfMonth: Array<number>;
77
+ months: Array<number>;
78
+ hour: number;
79
+ minute: number;
80
+ } | {
81
+ kind: "fieldByField";
82
+ };
48
83
  export default class CronTab {
49
84
  /**
50
85
  * Curated list of common schedules offered in the picker. Every value here
@@ -71,6 +106,7 @@ export default class CronTab {
71
106
  * expression cannot be parsed.
72
107
  */
73
108
  static getHumanReadableDescription(expression: string): string | null;
109
+ static getScheduleShape(expression: string): CronScheduleShape | null;
74
110
  /**
75
111
  * Computes the next `count` fire times (in UTC) at or after `from`
76
112
  * (exclusive). Returns fewer than `count` entries only if the pattern has no
@@ -94,6 +130,8 @@ export default class CronTab {
94
130
  private static nextAllowed;
95
131
  private static startOfNextDay;
96
132
  private static advanceToNextMonth;
133
+ private static getShapeOf;
134
+ static describeTimeOfDay(hour: number, minute: number): string;
97
135
  private static describe;
98
136
  private static describeGeneric;
99
137
  private static isDefaultSecond;
@@ -104,9 +142,9 @@ export default class CronTab {
104
142
  * Returns the step, or null when the field isn't a clean step.
105
143
  */
106
144
  private static detectStep;
107
- private static describeWeekdays;
108
- private static describeMonths;
109
- private static describeDaysOfMonth;
145
+ static describeWeekdays(values: Array<number>): string;
146
+ static describeMonths(values: Array<number>): string;
147
+ static describeDaysOfMonth(values: Array<number>): string;
110
148
  private static joinList;
111
149
  private static ordinal;
112
150
  private static pad;