@oneuptime/common 14.1.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/DatabaseModels/Alert.d.mts +1 -0
- package/Models/DatabaseModels/Alert.d.ts +1 -0
- package/Models/DatabaseModels/Alert.js +34 -0
- package/Models/DatabaseModels/AutoRemediationSuggestion.d.mts +2 -0
- package/Models/DatabaseModels/AutoRemediationSuggestion.d.ts +2 -0
- package/Models/DatabaseModels/AutoRemediationSuggestion.js +62 -0
- package/Models/DatabaseModels/Incident.d.mts +1 -0
- package/Models/DatabaseModels/Incident.d.ts +1 -0
- package/Models/DatabaseModels/Incident.js +35 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.d.mts +31 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.d.ts +31 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.js +591 -0
- package/Models/DatabaseModels/IncidentPostmortemActionItem.mjs +3 -0
- package/Models/DatabaseModels/Index.js +2 -0
- package/Models/DatabaseModels/TelemetryIngestionKey.js +1 -1
- package/Types/AI/AIActionWords.d.mts +3 -1
- package/Types/AI/AIActionWords.d.ts +3 -1
- package/Types/AI/AIActionWords.js +70 -1
- package/Types/AI/AIActionWords.mjs +2 -0
- package/Types/AI/AIChatTypes.d.mts +2 -1
- package/Types/AI/AIChatTypes.d.ts +2 -1
- package/Types/AI/AIReadTableWords.d.mts +192 -0
- package/Types/AI/AIReadTableWords.d.ts +192 -0
- package/Types/AI/AIReadTableWords.js +368 -0
- package/Types/AI/AIReadTableWords.mjs +18 -0
- package/Types/AI/AiRunRefusal.d.mts +3 -0
- package/Types/AI/AiRunRefusal.d.ts +3 -0
- package/Types/AI/AiRunRefusal.js +22 -1
- package/Types/AI/ResourceAiAccessPermissions.js +7 -18
- package/Types/AuditLog/AuditLogActionLabel.js +19 -9
- package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.js +123 -16
- package/Types/Cloud/CloudResourceHealth.d.mts +30 -1
- package/Types/Cloud/CloudResourceHealth.d.ts +30 -1
- package/Types/Cloud/CloudResourceHealth.js +405 -13
- package/Types/Cloud/CloudResourceHealth.mjs +28 -0
- package/Types/DataObservability/DataCheckRefusals.d.mts +32 -0
- package/Types/DataObservability/DataCheckRefusals.d.ts +32 -0
- package/Types/DataObservability/DataCheckRefusals.js +77 -0
- package/Types/DataObservability/DataCheckRefusals.mjs +8 -0
- package/Types/Database/AccessControl/PermissionScopeNarrowing.js +4 -0
- package/Types/Date.d.mts +2 -0
- package/Types/Date.d.ts +2 -0
- package/Types/Date.js +22 -0
- package/Types/DateLanguage.d.mts +2 -0
- package/Types/DateLanguage.d.ts +2 -0
- package/Types/DateLanguage.js +8 -5
- package/Types/Email/EmailTemplateType.d.mts +1 -0
- package/Types/Email/EmailTemplateType.d.ts +1 -0
- package/Types/Email/EmailTemplateType.js +2 -0
- package/Types/Exception/EgressGuardException.js +1 -1
- package/Types/Exception/ErrorMessageRule.d.mts +1 -0
- package/Types/Exception/ErrorMessageRule.d.ts +1 -0
- package/Types/Exception/ErrorMessageRule.js +67 -13
- package/Types/Exception/ErrorMessageRule.mjs +1 -0
- package/Types/Exception/ExceptionMessages.d.mts +2 -0
- package/Types/Exception/ExceptionMessages.d.ts +2 -0
- package/Types/Exception/ExceptionMessages.js +2 -0
- package/Types/Incident/PostmortemActionItemStatus.d.mts +17 -0
- package/Types/Incident/PostmortemActionItemStatus.d.ts +17 -0
- package/Types/Incident/PostmortemActionItemStatus.js +74 -0
- package/Types/Incident/PostmortemActionItemStatus.mjs +5 -0
- package/Types/JSONFunctions.js +10 -3
- package/Types/Link.d.mts +1 -0
- package/Types/Link.d.ts +1 -0
- package/Types/MeaningKeys.d.mts +4 -0
- package/Types/MeaningKeys.d.ts +4 -0
- package/Types/MeaningKeys.js +74 -0
- package/Types/MeaningKeys.mjs +5 -0
- package/Types/Monitor/WhoIsTold.d.mts +3 -0
- package/Types/Monitor/WhoIsTold.d.ts +3 -0
- package/Types/Monitor/WhoIsTold.js +63 -13
- package/Types/NoBreakSpaces.d.mts +16 -0
- package/Types/NoBreakSpaces.d.ts +16 -0
- package/Types/NoBreakSpaces.js +419 -0
- package/Types/NoBreakSpaces.mjs +9 -0
- package/Types/NotificationRule/PagingLadder.d.mts +12 -0
- package/Types/NotificationRule/PagingLadder.d.ts +12 -0
- package/Types/NotificationRule/PagingLadder.js +159 -11
- package/Types/NotificationRule/PagingLadder.mjs +3 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.mts +3 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.d.ts +3 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.js +42 -0
- package/Types/OnCallDutyPolicy/OnCallPageRecordGone.mjs +4 -0
- package/Types/OnCallDutyPolicy/OnCallPageWords.d.mts +6 -2
- package/Types/OnCallDutyPolicy/OnCallPageWords.d.ts +6 -2
- package/Types/OnCallDutyPolicy/OnCallPageWords.js +21 -20
- package/Types/OnCallDutyPolicy/OnCallPersonPage.d.mts +4 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.d.ts +4 -0
- package/Types/OnCallDutyPolicy/OnCallPersonPage.js +125 -1
- package/Types/OnCallDutyPolicy/OnCallPersonPage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.mts +2 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +2 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.js +12 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +1 -0
- package/Types/OpenStack/OpenStackCapacity.js +12 -5
- package/Types/Permission.d.mts +4 -0
- package/Types/Permission.d.ts +4 -0
- package/Types/Permission.js +64 -8
- package/Types/Product/ProductUsage.js +2 -1
- package/Types/Product/ProjectProductsAnswer.js +2 -1
- package/Types/ResourceAiAgent/AiResourceType.d.mts +1 -0
- package/Types/ResourceAiAgent/AiResourceType.d.ts +1 -0
- package/Types/ResourceAiAgent/AiResourceType.js +12 -0
- package/Types/Rum/ProductAnalyticsEventReads.js +10 -1
- package/Types/Rum/ProductAnalyticsEvents.js +13 -1
- package/Types/Rum/SessionReplayCustomEvents.d.mts +4 -1
- package/Types/Rum/SessionReplayCustomEvents.d.ts +4 -1
- package/Types/Rum/SessionReplayCustomEvents.js +12 -0
- package/Types/Rum/SessionReplayCustomEvents.mjs +1 -0
- package/Types/SetupHealth/SetupHealth.d.mts +1 -0
- package/Types/SetupHealth/SetupHealth.d.ts +1 -0
- package/Types/SetupHealth/SetupHealth.js +13 -5
- package/Types/StatusPage/DefaultStatusNames.d.mts +11 -3
- package/Types/StatusPage/DefaultStatusNames.d.ts +11 -3
- package/Types/StatusPage/DefaultStatusNames.js +74 -28
- package/Types/StatusPage/DefaultStatusNames.mjs +9 -2
- package/Types/StatusPage/StateChangeNoteMessage.d.mts +3 -2
- package/Types/StatusPage/StateChangeNoteMessage.d.ts +3 -2
- package/Types/StatusPage/StateChangeNoteMessage.js +16 -13
- package/Types/Telemetry/TelemetryIngestionKeyType.js +7 -6
- package/Types/Translator.d.mts +1 -0
- package/Types/Translator.d.ts +1 -0
- package/Types/Translator.js +100 -19
- package/Types/Translator.mjs +1 -0
- package/Types/UserSession/SessionLength.d.mts +33 -0
- package/Types/UserSession/SessionLength.d.ts +33 -0
- package/Types/UserSession/SessionLength.js +134 -5
- package/Types/UserSession/SessionLength.mjs +5 -0
- package/Types/Workflow/WorkflowStatus.js +21 -10
- package/Utils/AI/InvestigationReport.js +2 -2
- package/Utils/API.d.mts +0 -11
- package/Utils/API.d.ts +0 -11
- package/Utils/API.js +0 -432
- package/Utils/AiRemediation/Resource/ResourceCommandPolicy.js +2 -2
- package/Utils/AiRemediation/VerifiedFixRunbook.d.mts +39 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.d.ts +39 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.js +231 -0
- package/Utils/AiRemediation/VerifiedFixRunbook.mjs +10 -0
- package/Utils/Dashboard/DashboardWidgetSorts.js +11 -2
- package/Utils/Dashboard/MonitorListWidgetFormat.d.mts +2 -1
- package/Utils/Dashboard/MonitorListWidgetFormat.d.ts +2 -1
- package/Utils/Dashboard/MonitorListWidgetFormat.js +5 -3
- package/Utils/DefaultRecordNames.d.mts +6 -0
- package/Utils/DefaultRecordNames.d.ts +6 -0
- package/Utils/DefaultRecordNames.js +122 -0
- package/Utils/DefaultRecordNames.mjs +6 -0
- package/Utils/Grok/Grok.js +7 -4
- package/Utils/Incident/PostmortemActionItemCodeTask.d.mts +20 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.d.ts +20 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.js +107 -0
- package/Utils/Incident/PostmortemActionItemCodeTask.mjs +10 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.d.mts +39 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.d.ts +39 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.js +118 -0
- package/Utils/Incident/PostmortemActionItemMarkdown.mjs +12 -0
- package/Utils/Incident/PostmortemNoteActionItems.d.mts +29 -0
- package/Utils/Incident/PostmortemNoteActionItems.d.ts +29 -0
- package/Utils/Incident/PostmortemNoteActionItems.js +544 -0
- package/Utils/Incident/PostmortemNoteActionItems.mjs +7 -0
- package/Utils/LookupTable.d.mts +3 -0
- package/Utils/LookupTable.d.ts +3 -0
- package/Utils/LookupTable.js +61 -0
- package/Utils/LookupTable.mjs +3 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.mts +2 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.ts +2 -0
- package/Utils/Markdown/LinkReferenceDefinitions.js +101 -1
- package/Utils/Markdown/LinkReferenceDefinitions.mjs +2 -0
- package/Utils/Markdown/OverLongText.js +296 -2
- package/Utils/Markdown/SlowMarkdown.d.mts +1 -0
- package/Utils/Markdown/SlowMarkdown.d.ts +1 -0
- package/Utils/Markdown/SlowMarkdown.js +354 -4
- package/Utils/Markdown/SlowMarkdown.mjs +1 -0
- package/Utils/Metrics/MetricFormulaEvaluator.js +10 -4
- package/Utils/Metrics/MetricSeriesFingerprint.js +13 -4
- package/Utils/Metrics/MetricSeriesScope.d.mts +5 -0
- package/Utils/Metrics/MetricSeriesScope.d.ts +5 -0
- package/Utils/Metrics/MetricSeriesScope.js +5 -1
- package/Utils/Monitor/MonitorRootCauseWording.d.mts +3 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +3 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +100 -11
- package/Utils/Monitor/ProbeAgreementRule.d.mts +10 -0
- package/Utils/Monitor/ProbeAgreementRule.d.ts +10 -0
- package/Utils/Monitor/ProbeAgreementRule.js +58 -0
- package/Utils/Monitor/ProbeAgreementRule.mjs +3 -0
- package/Utils/Monitor/ProbeFailureReading.d.mts +4 -0
- package/Utils/Monitor/ProbeFailureReading.d.ts +4 -0
- package/Utils/Monitor/ProbeFailureReading.js +30 -1
- package/Utils/Monitor/ProbeFailureReading.mjs +1 -0
- package/Utils/Monitor/RequestFailureDescriptions.d.mts +61 -0
- package/Utils/Monitor/RequestFailureDescriptions.d.ts +61 -0
- package/Utils/Monitor/RequestFailureDescriptions.js +252 -0
- package/Utils/Monitor/RequestFailureDescriptions.mjs +6 -0
- package/Utils/PromQL/PromQLEngine.js +18 -9
- package/Utils/PromQL/PromQLFunctionEvaluators.js +114 -58
- package/Utils/PromQL/PromQLLabelOrder.d.mts +8 -0
- package/Utils/PromQL/PromQLLabelOrder.d.ts +8 -0
- package/Utils/PromQL/PromQLLabelOrder.js +212 -0
- package/Utils/PromQL/PromQLLabelOrder.mjs +6 -0
- package/Utils/PromQL/PromQLLabels.js +4 -3
- package/Utils/PromQL/PromQLMetricNames.js +8 -2
- package/Utils/PromQL/PromQLParser.js +11 -6
- package/Utils/PromQL/PromQLRegex.d.mts +11 -0
- package/Utils/PromQL/PromQLRegex.d.ts +11 -0
- package/Utils/PromQL/PromQLRegex.js +990 -50
- package/Utils/PromQL/PromQLRegex.mjs +3 -0
- package/Utils/PromQL/PrometheusResponse.js +3 -1
- package/Utils/PromQL/RE2CharacterClass.d.mts +24 -0
- package/Utils/PromQL/RE2CharacterClass.d.ts +24 -0
- package/Utils/PromQL/RE2CharacterClass.js +532 -0
- package/Utils/PromQL/RE2CharacterClass.mjs +16 -0
- package/Utils/RequestFailedDetailsUtil.d.mts +15 -0
- package/Utils/RequestFailedDetailsUtil.d.ts +15 -0
- package/Utils/RequestFailedDetailsUtil.js +452 -0
- package/Utils/RequestFailedDetailsUtil.mjs +2 -0
- package/Utils/Rum/UrlScrubber.d.mts +1 -1
- package/Utils/Rum/UrlScrubber.d.ts +1 -1
- package/Utils/Rum/UrlScrubber.js +10 -4
- package/Utils/Rum/UserFlow.js +22 -4
- package/Utils/SecurityCase/SecurityOverviewMetrics.d.mts +11 -1
- package/Utils/SecurityCase/SecurityOverviewMetrics.d.ts +11 -1
- package/Utils/SecurityCase/SecurityOverviewMetrics.js +99 -17
- package/Utils/SecurityCase/SecurityOverviewMetrics.mjs +3 -0
- package/Utils/Sms/OnCallPageSms.d.mts +2 -0
- package/Utils/Sms/OnCallPageSms.d.ts +2 -0
- package/Utils/Sms/OnCallPageSms.js +3 -1
- package/Utils/StateListType.d.mts +11 -0
- package/Utils/StateListType.d.ts +11 -0
- package/Utils/StateListType.js +21 -0
- package/Utils/StateListType.mjs +2 -0
- package/Utils/StateOrder.d.mts +8 -11
- package/Utils/StateOrder.d.ts +8 -11
- package/Utils/StateOrder.js +49 -84
- package/Utils/StateOrder.mjs +2 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.mts +9 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.d.ts +9 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.js +25 -0
- package/Utils/Suggestions/ActionItemCodeTaskSuggestion.mjs +2 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.mts +5 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.d.ts +5 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.js +39 -0
- package/Utils/Suggestions/VerifiedFixRunbookSuggestion.mjs +2 -0
- package/Utils/Syslog/SyslogMessageParser.js +16 -6
- package/Utils/Telemetry/HeartbeatAvailability.js +16 -21
- package/Utils/ValueFormatter.d.mts +1 -0
- package/Utils/ValueFormatter.d.ts +1 -0
- package/Utils/ValueFormatter.js +258 -18
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.forEachBracketedLabel = exports.getLinkReferenceDefinitions = exports.normalizeLinkLabel = exports.MAX_DEFINITION_NESTING_DEPTH = void 0;
|
|
3
|
+
exports.forEachLabelMarkedLooksUp = exports.normalizeReferenceLabel = exports.forEachBracketedLabel = exports.getLinkReferenceDefinitions = exports.normalizeLinkLabel = exports.MAX_DEFINITION_NESTING_DEPTH = void 0;
|
|
4
4
|
const RegExpCharacterClasses_1 = require("../RegExpCharacterClasses");
|
|
5
5
|
/*
|
|
6
6
|
* How many block quotes and list items deep a definition is still found:
|
|
@@ -1899,3 +1899,103 @@ const forEachBracketedLabel = (text, start, end, found) => {
|
|
|
1899
1899
|
}
|
|
1900
1900
|
};
|
|
1901
1901
|
exports.forEachBracketedLabel = forEachBracketedLabel;
|
|
1902
|
+
/*
|
|
1903
|
+
* A reference's label as marked's inline lexer looks it up
|
|
1904
|
+
* (Tokenizer.reflink): each run of white space one space, then in lower
|
|
1905
|
+
* case - the other way round from a definition's label
|
|
1906
|
+
* (normalizeLinkLabel), which only differs where a "Σ" ends a word.
|
|
1907
|
+
* Read with a loop: a label can be as long as its text.
|
|
1908
|
+
*/
|
|
1909
|
+
const normalizeReferenceLabel = (label) => {
|
|
1910
|
+
let collapsed = "";
|
|
1911
|
+
let copiedUpTo = 0;
|
|
1912
|
+
let index = 0;
|
|
1913
|
+
while (index < label.length) {
|
|
1914
|
+
if (!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(label.charCodeAt(index))) {
|
|
1915
|
+
index++;
|
|
1916
|
+
continue;
|
|
1917
|
+
}
|
|
1918
|
+
let runEnd = index + 1;
|
|
1919
|
+
while (runEnd < label.length &&
|
|
1920
|
+
(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(label.charCodeAt(runEnd))) {
|
|
1921
|
+
runEnd++;
|
|
1922
|
+
}
|
|
1923
|
+
// One space is already as marked makes it.
|
|
1924
|
+
if (runEnd - index > 1 || label.charCodeAt(index) !== SPACE) {
|
|
1925
|
+
collapsed += `${label.slice(copiedUpTo, index)} `;
|
|
1926
|
+
copiedUpTo = runEnd;
|
|
1927
|
+
}
|
|
1928
|
+
index = runEnd;
|
|
1929
|
+
}
|
|
1930
|
+
return (copiedUpTo === 0 ? label : collapsed + label.slice(copiedUpTo)).toLowerCase();
|
|
1931
|
+
};
|
|
1932
|
+
exports.normalizeReferenceLabel = normalizeReferenceLabel;
|
|
1933
|
+
/*
|
|
1934
|
+
* WHAT MARKED LOOKS A DEFINITION UP BY, IN ONE INLINE TEXT (#7597).
|
|
1935
|
+
*
|
|
1936
|
+
* marked 12 reads the inline Markdown of every paragraph, heading, table
|
|
1937
|
+
* cell and list item - and again of every link's text and every
|
|
1938
|
+
* emphasis's - with Lexer.inlineTokens, and each read starts by listing
|
|
1939
|
+
* every definition of the whole text (Object.keys(tokens.links)), then
|
|
1940
|
+
* looks each reference it finds up in that list. So D definitions and C
|
|
1941
|
+
* such reads cost marked D times C: 20,000 definitions and 20,000 one-word
|
|
1942
|
+
* paragraphs took 42 s, though no paragraph named one of them. A read only
|
|
1943
|
+
* ever looks a definition up by what its own text holds, in two ways:
|
|
1944
|
+
*
|
|
1945
|
+
* - before it reads, it masks each reference whose label is defined
|
|
1946
|
+
* (`reflinkSearch`), so emphasis is not read across it. The label it
|
|
1947
|
+
* checks is what follows the last "[" before the reference's "]" - an
|
|
1948
|
+
* escaped "\[" too - as written, never normalized: text[open + 1, close)
|
|
1949
|
+
* where text[open] is the last "[" before the "]" at `close`.
|
|
1950
|
+
* - as it reads, each reference - "[text][label]", "[label][]",
|
|
1951
|
+
* "[label]", an image's too - by its label, from the "[" that opens it
|
|
1952
|
+
* to the "]" that closes it, normalized (normalizeReferenceLabel). The
|
|
1953
|
+
* label holds no "[" or "]" that a backslash does not escape, and its
|
|
1954
|
+
* "[" is one no backslash escapes: marked reads "\[" as an escape
|
|
1955
|
+
* before it could read a reference there.
|
|
1956
|
+
*
|
|
1957
|
+
* A backslash escapes the character after it, but a line break, and
|
|
1958
|
+
* backslashes pair off from the first of a run, as marked reads them. So
|
|
1959
|
+
* this calls `found` with every such label of `text`, both ways: each "]"
|
|
1960
|
+
* that no backslash escapes closes the last "[" before it, as written,
|
|
1961
|
+
* and the last "[" no backslash escapes, normalized - and opens no other.
|
|
1962
|
+
* More labels than marked looks up, never fewer: a link's own text, a
|
|
1963
|
+
* bracket in code, a label that never closes. One pass, and each label
|
|
1964
|
+
* read once: every character of the text is in one label of each way at
|
|
1965
|
+
* most.
|
|
1966
|
+
*/
|
|
1967
|
+
const forEachLabelMarkedLooksUp = (text, found) => {
|
|
1968
|
+
// The last "[" since a "]" closed one, and the last no backslash escapes.
|
|
1969
|
+
let open = -1;
|
|
1970
|
+
let unescapedOpen = -1;
|
|
1971
|
+
let index = 0;
|
|
1972
|
+
while (index < text.length) {
|
|
1973
|
+
const code = text.charCodeAt(index);
|
|
1974
|
+
if (code === BACKSLASH) {
|
|
1975
|
+
if (index + 1 < text.length &&
|
|
1976
|
+
!(0, RegExpCharacterClasses_1.isLineTerminatorCode)(text.charCodeAt(index + 1))) {
|
|
1977
|
+
if (text.charCodeAt(index + 1) === OPEN_BRACKET) {
|
|
1978
|
+
open = index + 1;
|
|
1979
|
+
}
|
|
1980
|
+
index += 2;
|
|
1981
|
+
continue;
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
else if (code === OPEN_BRACKET) {
|
|
1985
|
+
open = index;
|
|
1986
|
+
unescapedOpen = index;
|
|
1987
|
+
}
|
|
1988
|
+
else if (code === CLOSE_BRACKET) {
|
|
1989
|
+
if (open !== -1) {
|
|
1990
|
+
found(text.slice(open + 1, index));
|
|
1991
|
+
}
|
|
1992
|
+
if (unescapedOpen !== -1) {
|
|
1993
|
+
found((0, exports.normalizeReferenceLabel)(text.slice(unescapedOpen + 1, index)));
|
|
1994
|
+
}
|
|
1995
|
+
open = -1;
|
|
1996
|
+
unescapedOpen = -1;
|
|
1997
|
+
}
|
|
1998
|
+
index++;
|
|
1999
|
+
}
|
|
2000
|
+
};
|
|
2001
|
+
exports.forEachLabelMarkedLooksUp = forEachLabelMarkedLooksUp;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import commonJsModule from "./LinkReferenceDefinitions.js";
|
|
2
2
|
export const MAX_DEFINITION_NESTING_DEPTH = commonJsModule.MAX_DEFINITION_NESTING_DEPTH;
|
|
3
3
|
export const forEachBracketedLabel = commonJsModule.forEachBracketedLabel;
|
|
4
|
+
export const forEachLabelMarkedLooksUp = commonJsModule.forEachLabelMarkedLooksUp;
|
|
4
5
|
export const getLinkReferenceDefinitions = commonJsModule.getLinkReferenceDefinitions;
|
|
5
6
|
export const normalizeLinkLabel = commonJsModule.normalizeLinkLabel;
|
|
7
|
+
export const normalizeReferenceLabel = commonJsModule.normalizeReferenceLabel;
|
|
@@ -30,7 +30,10 @@ const RegExpCharacterClasses_1 = require("../RegExpCharacterClasses");
|
|
|
30
30
|
* on from the kept start into the middle keeps its structure: its
|
|
31
31
|
* address and its title are held back apart, with what parts them in
|
|
32
32
|
* view (holdBackMiddle). So does one that goes on from the middle
|
|
33
|
-
* into the kept end: its "[" and "](" stay in view
|
|
33
|
+
* into the kept end: its "[" and "](" stay in view - and a link whose
|
|
34
|
+
* text crosses a cut keeps its "[" and "](" in view too, and a bare
|
|
35
|
+
* address from the middle into the kept end its scheme and domain
|
|
36
|
+
* (#7600).
|
|
34
37
|
* - in every run of lines with no blank line between them that is longer
|
|
35
38
|
* than OVER_LONG_RUN_LENGTH characters, each group of consecutive lines
|
|
36
39
|
* that only continue the block they are in (isContinuationLine: plain
|
|
@@ -388,6 +391,211 @@ const readLinkUnit = (text, index, reading) => {
|
|
|
388
391
|
const isInLink = (reading) => {
|
|
389
392
|
return reading.part !== "text";
|
|
390
393
|
};
|
|
394
|
+
/*
|
|
395
|
+
* A LINK'S TEXT ACROSS A CUT (#7600).
|
|
396
|
+
*
|
|
397
|
+
* A link's text can be longer than what a line keeps on its side of a cut
|
|
398
|
+
* - a run's name, an error's first line. Where its "[" is in the middle and
|
|
399
|
+
* its "](" in the kept end, the "[" went into the middle's token, and an
|
|
400
|
+
* email showed "run run ... run](https://example.com/x)", the address
|
|
401
|
+
* autolinked; where its "[" is in the kept start and its "](" in the
|
|
402
|
+
* middle, the "](" and the address went into the token, and it showed
|
|
403
|
+
* "[run run ..." as text. So such a link keeps its "[" and its "](" in
|
|
404
|
+
* view, and the part of its text the middle holds is held back as a piece
|
|
405
|
+
* of its own, read as plain text between them.
|
|
406
|
+
*
|
|
407
|
+
* Which "[" opens the link is read as marked reads a link's text (its
|
|
408
|
+
* `_inlineLabel`, readLinkText): brackets nested one deep, a backslash
|
|
409
|
+
* escaping the character after it, a code span in single backticks hiding
|
|
410
|
+
* brackets - and only where the text is in none of those at the cut, so
|
|
411
|
+
* the token in its place reads as the text it stands for. The first "["
|
|
412
|
+
* whose text closes with "](" across the cut opens it, as marked takes the
|
|
413
|
+
* first, of the last MAX_CROSSING_LINK_TEXTS labels left open there.
|
|
414
|
+
*/
|
|
415
|
+
// The most labels open at a cut that are read to see whether they close across it.
|
|
416
|
+
const MAX_CROSSING_LINK_TEXTS = 4;
|
|
417
|
+
const BACKTICK = 0x60;
|
|
418
|
+
/*
|
|
419
|
+
* Reads a link's text - what follows its "[", from `from` - as marked reads
|
|
420
|
+
* one (see "A link's text across a cut" above), and returns where the "]"
|
|
421
|
+
* that closes it is. -1 when it closes before `cut`, cannot close (a "["
|
|
422
|
+
* in brackets nested in it, a backslash before a line break), is in nested
|
|
423
|
+
* brackets, code or an escape at the cut, or reads past the cut to `end`
|
|
424
|
+
* without closing - or when `isRead` says, at the cut, not to read on.
|
|
425
|
+
*/
|
|
426
|
+
const readLinkTextAcross = (data) => {
|
|
427
|
+
const text = data.text;
|
|
428
|
+
let part = "text";
|
|
429
|
+
let index = data.from;
|
|
430
|
+
while (index < data.end) {
|
|
431
|
+
if (index === data.cut && (part !== "text" || !data.isRead())) {
|
|
432
|
+
return -1;
|
|
433
|
+
}
|
|
434
|
+
const code = text.charCodeAt(index);
|
|
435
|
+
if (part === "code") {
|
|
436
|
+
if (code === BACKTICK) {
|
|
437
|
+
part = "text";
|
|
438
|
+
}
|
|
439
|
+
index++;
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
if (code === BACKSLASH) {
|
|
443
|
+
const escaped = text.charCodeAt(index + 1);
|
|
444
|
+
if (index + 1 >= data.end ||
|
|
445
|
+
index + 1 === data.cut ||
|
|
446
|
+
escaped === 0x0a ||
|
|
447
|
+
escaped === CARRIAGE_RETURN) {
|
|
448
|
+
return -1;
|
|
449
|
+
}
|
|
450
|
+
index += 2;
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
if (code === OPEN_BRACKET) {
|
|
454
|
+
if (part === "nested") {
|
|
455
|
+
return -1;
|
|
456
|
+
}
|
|
457
|
+
part = "nested";
|
|
458
|
+
}
|
|
459
|
+
else if (code === CLOSE_BRACKET) {
|
|
460
|
+
if (part === "text") {
|
|
461
|
+
return index >= data.cut ? index : -1;
|
|
462
|
+
}
|
|
463
|
+
part = "text";
|
|
464
|
+
}
|
|
465
|
+
else if (code === BACKTICK && part === "text") {
|
|
466
|
+
part = "code";
|
|
467
|
+
}
|
|
468
|
+
index++;
|
|
469
|
+
}
|
|
470
|
+
return -1;
|
|
471
|
+
};
|
|
472
|
+
/*
|
|
473
|
+
* Of the labels `opens` - where each "[" or ", reading plainly at the cut: where it
|
|
476
|
+
* starts and where its "]" is. Null when none does. At most
|
|
477
|
+
* MAX_CROSSING_LINK_TEXTS of them are read past the cut.
|
|
478
|
+
*/
|
|
479
|
+
const findLinkTextAcross = (data) => {
|
|
480
|
+
let readPastCut = 0;
|
|
481
|
+
const isRead = () => {
|
|
482
|
+
readPastCut++;
|
|
483
|
+
return readPastCut <= MAX_CROSSING_LINK_TEXTS;
|
|
484
|
+
};
|
|
485
|
+
for (const start of data.opens) {
|
|
486
|
+
if (start < data.from) {
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
const labelOpen = data.text.charCodeAt(start) === OPEN_BRACKET ? start : start + 1;
|
|
490
|
+
const close = readLinkTextAcross({
|
|
491
|
+
text: data.text,
|
|
492
|
+
from: labelOpen + 1,
|
|
493
|
+
cut: data.cut,
|
|
494
|
+
end: data.end,
|
|
495
|
+
isRead: isRead,
|
|
496
|
+
});
|
|
497
|
+
if (close !== -1 && data.text.charCodeAt(close + 1) === OPEN_PARENTHESIS) {
|
|
498
|
+
return { start: start, close: close };
|
|
499
|
+
}
|
|
500
|
+
if (readPastCut >= MAX_CROSSING_LINK_TEXTS) {
|
|
501
|
+
return null;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return null;
|
|
505
|
+
};
|
|
506
|
+
/*
|
|
507
|
+
* A BARE ADDRESS ACROSS THE END OF A LINE'S MIDDLE (#7600).
|
|
508
|
+
*
|
|
509
|
+
* An address written as text - a GFM autolink literal, "https://",
|
|
510
|
+
* "http://", "ftp://" or "www." and what follows - can start in the middle
|
|
511
|
+
* and run into the kept end: a signed URL of 2 KB at the end of a long log
|
|
512
|
+
* line. Its start went into the middle's token, and the kept end showed
|
|
513
|
+
* the rest of it as text. So its start - the scheme and the domain, and a
|
|
514
|
+
* "/" after it - stays in view, and the rest of it the middle holds is held
|
|
515
|
+
* back as a piece of its own, which the parser reads as part of the
|
|
516
|
+
* address: no white space or "<" ends it. The white space before it stays
|
|
517
|
+
* in view too, where a parser needs it before "www.". A word with a
|
|
518
|
+
* backtick or a "<" in it before the cut is left as it was: it may be code
|
|
519
|
+
* or a tag.
|
|
520
|
+
*/
|
|
521
|
+
// The schemes that start an address written as text, in lower case.
|
|
522
|
+
const ADDRESS_SCHEMES = [
|
|
523
|
+
"https://",
|
|
524
|
+
"http://",
|
|
525
|
+
"ftp://",
|
|
526
|
+
"www.",
|
|
527
|
+
];
|
|
528
|
+
// Whether text[index] is a character of an address's domain: a letter, a digit, "-" or ".".
|
|
529
|
+
const isDomainCode = (code) => {
|
|
530
|
+
return isAsciiLetter(code) || isDigit(code) || code === 0x2d || code === 0x2e;
|
|
531
|
+
};
|
|
532
|
+
/*
|
|
533
|
+
* The scheme that text[index] starts, as one of ADDRESS_SCHEMES - any case
|
|
534
|
+
* - with a domain's character after it; null when it starts none.
|
|
535
|
+
*/
|
|
536
|
+
const getAddressSchemeAt = (text, index) => {
|
|
537
|
+
// "h", "f" or "w", in either case: most characters start no scheme.
|
|
538
|
+
const first = text.charCodeAt(index) | 0x20;
|
|
539
|
+
if (first !== 0x68 && first !== 0x66 && first !== 0x77) {
|
|
540
|
+
return null;
|
|
541
|
+
}
|
|
542
|
+
for (const scheme of ADDRESS_SCHEMES) {
|
|
543
|
+
if (text.slice(index, index + scheme.length).toLowerCase() === scheme &&
|
|
544
|
+
isDomainCode(text.charCodeAt(index + scheme.length)) &&
|
|
545
|
+
text.charCodeAt(index + scheme.length) !== 0x2e) {
|
|
546
|
+
return scheme;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return null;
|
|
550
|
+
};
|
|
551
|
+
/*
|
|
552
|
+
* Where to keep a bare address that starts in text[from, cut) and runs on
|
|
553
|
+
* past `cut` in view: from where the address - or the white space before
|
|
554
|
+
* it - starts, to past its scheme, its domain and a "/" after it (at most
|
|
555
|
+
* MAX_KEPT_SEPARATOR_LENGTH characters of the domain). Null when the cut is
|
|
556
|
+
* not inside such an address.
|
|
557
|
+
*/
|
|
558
|
+
const findAddressAcrossEnd = (text, from, cut) => {
|
|
559
|
+
if (cut <= from ||
|
|
560
|
+
(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(cut - 1)) ||
|
|
561
|
+
(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(cut))) {
|
|
562
|
+
return null;
|
|
563
|
+
}
|
|
564
|
+
let wordStart = cut - 1;
|
|
565
|
+
while (wordStart > from &&
|
|
566
|
+
!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(wordStart - 1))) {
|
|
567
|
+
wordStart--;
|
|
568
|
+
}
|
|
569
|
+
if (wordStart === from && !(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(from - 1))) {
|
|
570
|
+
// The word goes on before what is left to hold back: as it was.
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
for (let index = wordStart; index < cut; index++) {
|
|
574
|
+
const code = text.charCodeAt(index);
|
|
575
|
+
if (code === BACKTICK || code === LESS_THAN) {
|
|
576
|
+
return null;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
for (let index = wordStart; index < cut; index++) {
|
|
580
|
+
const scheme = getAddressSchemeAt(text, index);
|
|
581
|
+
if (scheme === null) {
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
let keepEnd = index + scheme.length;
|
|
585
|
+
const domainLimit = Math.min(cut, keepEnd + MAX_KEPT_SEPARATOR_LENGTH);
|
|
586
|
+
while (keepEnd < domainLimit && isDomainCode(text.charCodeAt(keepEnd))) {
|
|
587
|
+
keepEnd++;
|
|
588
|
+
}
|
|
589
|
+
if (keepEnd < cut && text.charCodeAt(keepEnd) === 0x2f) {
|
|
590
|
+
keepEnd++;
|
|
591
|
+
}
|
|
592
|
+
return {
|
|
593
|
+
start: index === wordStart && index > from ? index - 1 : index,
|
|
594
|
+
keepEnd: Math.min(keepEnd, cut),
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
return null;
|
|
598
|
+
};
|
|
391
599
|
/*
|
|
392
600
|
* Where the address of the link reference definition on the line that
|
|
393
601
|
* starts at `lineStart` starts to be read - just after its "]:" - or -1
|
|
@@ -528,6 +736,11 @@ const holdBackMiddle = (data) => {
|
|
|
528
736
|
let autolinkStart = -1;
|
|
529
737
|
// The last "!" read as text: an "[" right after it opens an image.
|
|
530
738
|
let exclamationMark = -1;
|
|
739
|
+
/*
|
|
740
|
+
* Whether a backtick has opened code a later one closes: as in a link's
|
|
741
|
+
* text (readLinkTextAcross), a bracket in it opens and closes no label.
|
|
742
|
+
*/
|
|
743
|
+
let isInCode = false;
|
|
531
744
|
// The start of the label a "]" closes, or -1 when it is not known.
|
|
532
745
|
const closeLabel = () => {
|
|
533
746
|
var _a;
|
|
@@ -540,7 +753,10 @@ const holdBackMiddle = (data) => {
|
|
|
540
753
|
let at = from;
|
|
541
754
|
while (at < middleEnd) {
|
|
542
755
|
const part = reading.part;
|
|
543
|
-
if (part === "text") {
|
|
756
|
+
if (part === "text" && text.charCodeAt(at) === BACKTICK) {
|
|
757
|
+
isInCode = !isInCode;
|
|
758
|
+
}
|
|
759
|
+
if (part === "text" && !isInCode) {
|
|
544
760
|
const code = text.charCodeAt(at);
|
|
545
761
|
if (code === OPEN_BRACKET) {
|
|
546
762
|
if (labelStarts.length < MAX_OPEN_LABELS) {
|
|
@@ -601,6 +817,39 @@ const holdBackMiddle = (data) => {
|
|
|
601
817
|
spaced: false,
|
|
602
818
|
}, linkClose + 2);
|
|
603
819
|
}
|
|
820
|
+
else if (reading.part === "text") {
|
|
821
|
+
/*
|
|
822
|
+
* A link whose text the middle ends inside of, with its "](" in the
|
|
823
|
+
* kept end: its "[" or "![" stays in view, and what the middle holds
|
|
824
|
+
* of its text is a piece of its own (see "A link's text across a
|
|
825
|
+
* cut"). Not when more labels were open than are remembered: which
|
|
826
|
+
* are open then is not known. Else a bare address the middle ends
|
|
827
|
+
* inside of keeps its start in view (see "A bare address across the
|
|
828
|
+
* end of a line's middle").
|
|
829
|
+
*/
|
|
830
|
+
const across = labelsLeftOut === 0
|
|
831
|
+
? findLinkTextAcross({
|
|
832
|
+
text: text,
|
|
833
|
+
opens: labelStarts.slice(-MAX_CROSSING_LINK_TEXTS),
|
|
834
|
+
from: position,
|
|
835
|
+
cut: middleEnd,
|
|
836
|
+
end: data.lineEnd,
|
|
837
|
+
})
|
|
838
|
+
: null;
|
|
839
|
+
if (across !== null) {
|
|
840
|
+
holdTo(across.start);
|
|
841
|
+
keepTo(text.charCodeAt(across.start) === OPEN_BRACKET
|
|
842
|
+
? across.start + 1
|
|
843
|
+
: across.start + 2);
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
const address = findAddressAcrossEnd(text, position, middleEnd);
|
|
847
|
+
if (address !== null) {
|
|
848
|
+
holdTo(address.start);
|
|
849
|
+
keepTo(address.keepEnd);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
}
|
|
604
853
|
holdTo(middleEnd);
|
|
605
854
|
};
|
|
606
855
|
// Where the kept start leaves the line: read from the line's start.
|
|
@@ -618,9 +867,53 @@ const holdBackMiddle = (data) => {
|
|
|
618
867
|
else {
|
|
619
868
|
reading.part = "beforeDestination";
|
|
620
869
|
}
|
|
870
|
+
// The "[" the kept start opens as text - in no code - the first first.
|
|
871
|
+
const opens = [];
|
|
872
|
+
let isInCode = false;
|
|
621
873
|
while (index < data.middleStart) {
|
|
874
|
+
if (reading.part === "text") {
|
|
875
|
+
const code = text.charCodeAt(index);
|
|
876
|
+
if (code === BACKTICK) {
|
|
877
|
+
isInCode = !isInCode;
|
|
878
|
+
}
|
|
879
|
+
else if (code === OPEN_BRACKET &&
|
|
880
|
+
!isInCode &&
|
|
881
|
+
opens.length < MAX_OPEN_LABELS) {
|
|
882
|
+
opens.push(index);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
622
885
|
index = readLinkUnit(text, index, reading);
|
|
623
886
|
}
|
|
887
|
+
/*
|
|
888
|
+
* A link whose text the kept start ends inside of, with its "](" in the
|
|
889
|
+
* middle: what the middle holds of its text is a piece of its own, and
|
|
890
|
+
* its "](" stays in view (see "A link's text across a cut"). Its address
|
|
891
|
+
* and title are then read as a link's across the start.
|
|
892
|
+
*/
|
|
893
|
+
const across = isInLink(reading)
|
|
894
|
+
? null
|
|
895
|
+
: findLinkTextAcross({
|
|
896
|
+
text: text,
|
|
897
|
+
opens: opens,
|
|
898
|
+
from: data.lineStart,
|
|
899
|
+
cut: data.middleStart,
|
|
900
|
+
end: middleEnd,
|
|
901
|
+
});
|
|
902
|
+
if (across !== null && across.close + 2 > middleEnd) {
|
|
903
|
+
// Its "(" is the kept end's first character.
|
|
904
|
+
holdTo(across.close);
|
|
905
|
+
keepTo(middleEnd);
|
|
906
|
+
return;
|
|
907
|
+
}
|
|
908
|
+
if (across !== null) {
|
|
909
|
+
holdTo(across.close);
|
|
910
|
+
keepTo(across.close + 2);
|
|
911
|
+
index = across.close + 2;
|
|
912
|
+
reading.part = "beforeDestination";
|
|
913
|
+
reading.isInline = true;
|
|
914
|
+
reading.depth = 0;
|
|
915
|
+
reading.spaced = false;
|
|
916
|
+
}
|
|
624
917
|
if (!isInLink(reading)) {
|
|
625
918
|
/*
|
|
626
919
|
* A word the cut is inside of - with no space near the cut, the kept
|
|
@@ -717,6 +1010,7 @@ const holdBackOverLongLines = (text, hold) => {
|
|
|
717
1010
|
lineStart: lineStart,
|
|
718
1011
|
middleStart: middleStart,
|
|
719
1012
|
middleEnd: middleEnd,
|
|
1013
|
+
lineEnd: lineEnd,
|
|
720
1014
|
hold: hold,
|
|
721
1015
|
pieces: pieces,
|
|
722
1016
|
});
|
|
@@ -47,6 +47,7 @@ export interface MarkedLineWork {
|
|
|
47
47
|
isDefinition: boolean;
|
|
48
48
|
}
|
|
49
49
|
export declare const getMarkedLineWork: (text: string, start: number, end: number, counting?: Partial<InlineCounting>) => MarkedLineWork;
|
|
50
|
+
export declare const MARKED_LIST_LINE_SHARE: number;
|
|
50
51
|
export declare const holdBackSlowMarkdown: (text: string, holder: SlowMarkdownHolder, limits: SlowMarkdownLimits) => string;
|
|
51
52
|
export declare const measureSlowMarkdownRuns: (text: string, counting?: Partial<InlineCounting>) => Array<SlowMarkdownRun>;
|
|
52
53
|
export declare const measureSlowMarkdownCodeBlocks: (text: string) => Array<{
|
|
@@ -47,6 +47,7 @@ export interface MarkedLineWork {
|
|
|
47
47
|
isDefinition: boolean;
|
|
48
48
|
}
|
|
49
49
|
export declare const getMarkedLineWork: (text: string, start: number, end: number, counting?: Partial<InlineCounting>) => MarkedLineWork;
|
|
50
|
+
export declare const MARKED_LIST_LINE_SHARE: number;
|
|
50
51
|
export declare const holdBackSlowMarkdown: (text: string, holder: SlowMarkdownHolder, limits: SlowMarkdownLimits) => string;
|
|
51
52
|
export declare const measureSlowMarkdownRuns: (text: string, counting?: Partial<InlineCounting>) => Array<SlowMarkdownRun>;
|
|
52
53
|
export declare const measureSlowMarkdownCodeBlocks: (text: string) => Array<{
|