@oneuptime/common 14.0.110 → 14.1.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/AIRunRecording.d.mts +12 -0
- package/Models/DatabaseModels/AIRunRecording.d.ts +12 -0
- package/Models/DatabaseModels/AIRunRecording.js +181 -0
- package/Models/DatabaseModels/AIRunRecording.mjs +2 -0
- package/Models/DatabaseModels/Alert.js +18 -2
- package/Models/DatabaseModels/DataStore.js +9 -0
- package/Models/DatabaseModels/EmailLog.js +2 -2
- package/Models/DatabaseModels/Form.js +3 -3
- package/Models/DatabaseModels/FormSubmission.js +4 -4
- package/Models/DatabaseModels/GlobalConfig.js +46 -45
- package/Models/DatabaseModels/Incident.js +18 -2
- package/Models/DatabaseModels/IncidentSlaRule.js +2 -2
- package/Models/DatabaseModels/Index.js +4 -0
- package/Models/DatabaseModels/InventoryItem.js +11 -0
- package/Models/DatabaseModels/Monitor.js +51 -17
- package/Models/DatabaseModels/MonitorNetworkDevice.d.mts +11 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.d.ts +11 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.js +189 -0
- package/Models/DatabaseModels/MonitorNetworkDevice.mjs +2 -0
- package/Models/DatabaseModels/MonitorProbe.js +22 -5
- package/Models/DatabaseModels/NetworkDevice.js +23 -7
- package/Models/DatabaseModels/NetworkEndpoint.d.mts +1 -0
- package/Models/DatabaseModels/NetworkEndpoint.d.ts +1 -0
- package/Models/DatabaseModels/NetworkEndpoint.js +39 -7
- package/Models/DatabaseModels/NetworkInterface.js +5 -5
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +19 -5
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.mts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.d.ts +1 -0
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +35 -7
- package/Models/DatabaseModels/OpenStackCloudCheck.js +8 -1
- package/Models/DatabaseModels/Project.d.mts +1 -0
- package/Models/DatabaseModels/Project.d.ts +1 -0
- package/Models/DatabaseModels/Project.js +46 -3
- package/Models/DatabaseModels/ProjectCallSMSConfig.js +3 -1
- package/Models/DatabaseModels/ProjectSmtpConfig.js +2 -0
- package/Models/DatabaseModels/PublicNoteApprovalRequest.js +3 -3
- package/Models/DatabaseModels/PublicNoteApprovalStep.js +1 -1
- package/Models/DatabaseModels/RunbookExecution.js +2 -2
- package/Models/DatabaseModels/RunbookRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenance.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceCalendarFeed.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceLabelRule.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurement.js +7 -7
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +1 -1
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerRule.js +6 -6
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerTeam.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceOwnerUser.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceReminderRule.js +4 -4
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +3 -3
- package/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +5 -5
- package/Models/DatabaseModels/TeamMember.js +10 -1
- package/Models/DatabaseModels/WorkspaceNotificationRule.js +36 -1
- package/Models/DatabaseModels/WorkspaceNotificationSummary.js +1 -1
- package/Models/DatabaseModels/WorkspacePublicNoteApprovalMessage.js +3 -3
- package/Server/Services/DatabaseService.d.mts +4 -1
- package/Server/Services/DatabaseService.d.ts +4 -1
- package/Server/Types/Database/CountBy.d.mts +1 -0
- package/Server/Types/Database/CountBy.d.ts +1 -0
- package/Server/Types/Database/UpdateLimit.d.mts +6 -0
- package/Server/Types/Database/UpdateLimit.d.ts +6 -0
- package/Types/AI/AIActionWords.d.mts +25 -1
- package/Types/AI/AIActionWords.d.ts +25 -1
- package/Types/AI/AIActionWords.js +166 -3
- package/Types/AI/AIActionWords.mjs +6 -0
- package/Types/AI/AIChatTypes.d.mts +2 -1
- package/Types/AI/AIChatTypes.d.ts +2 -1
- package/Types/AI/AiOutcomes.d.mts +57 -0
- package/Types/AI/AiOutcomes.d.ts +57 -0
- package/Types/AI/AiOutcomes.js +67 -0
- package/Types/AI/AiOutcomes.mjs +10 -0
- package/Types/AI/AiRunRefusal.d.mts +45 -0
- package/Types/AI/AiRunRefusal.d.ts +45 -0
- package/Types/AI/AiRunRefusal.js +187 -0
- package/Types/AI/AiRunRefusal.mjs +12 -0
- package/Types/AI/InvestigationRecording.d.mts +46 -0
- package/Types/AI/InvestigationRecording.d.ts +46 -0
- package/Types/AI/InvestigationRecording.js +42 -0
- package/Types/AI/InvestigationRecording.mjs +7 -0
- package/Types/API/HTTPResponse.d.mts +3 -0
- package/Types/API/HTTPResponse.d.ts +3 -0
- package/Types/API/HTTPResponse.js +15 -0
- package/Types/BaseDatabase/AggregateBy.d.mts +16 -0
- package/Types/BaseDatabase/AggregateBy.d.ts +16 -0
- package/Types/BaseDatabase/AggregationIntervalUtil.d.mts +16 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.d.ts +16 -1
- package/Types/BaseDatabase/AggregationIntervalUtil.js +92 -2
- package/Types/BaseDatabase/ListResult.d.mts +1 -0
- package/Types/BaseDatabase/ListResult.d.ts +1 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.d.mts +47 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.d.ts +47 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.js +282 -0
- package/Types/CallAndSMS/ServerTwilioEnvironment.mjs +7 -0
- package/Types/Dashboard/DashboardAutoRefresh.d.mts +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.d.ts +1 -0
- package/Types/Dashboard/DashboardAutoRefresh.js +21 -0
- package/Types/Dashboard/DashboardAutoRefresh.mjs +1 -0
- package/Types/Date.d.mts +6 -1
- package/Types/Date.d.ts +6 -1
- package/Types/Date.js +39 -7
- package/Types/Date.mjs +1 -0
- package/Types/Email/ServerEmailEnvironment.d.mts +85 -0
- package/Types/Email/ServerEmailEnvironment.d.ts +85 -0
- package/Types/Email/ServerEmailEnvironment.js +793 -0
- package/Types/Email/ServerEmailEnvironment.mjs +14 -0
- package/Types/Exception/AiRunRefusalException.d.mts +6 -0
- package/Types/Exception/AiRunRefusalException.d.ts +6 -0
- package/Types/Exception/AiRunRefusalException.js +23 -0
- package/Types/Exception/AiRunRefusalException.mjs +2 -0
- package/Types/Form/FormTargetCatalog.js +2 -2
- package/Types/Form/FormTargetType.js +2 -2
- package/Types/ListData.d.mts +2 -0
- package/Types/ListData.d.ts +2 -0
- package/Types/ListData.js +4 -0
- package/Types/Monitor/MonitorCriteriaInstance.js +9 -0
- package/Types/Monitor/MonitorNotCheckedReason.d.mts +7 -0
- package/Types/Monitor/MonitorNotCheckedReason.d.ts +7 -0
- package/Types/Monitor/MonitorNotCheckedReason.js +36 -0
- package/Types/Monitor/MonitorNotCheckedReason.mjs +4 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.d.mts +6 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.d.ts +6 -0
- package/Types/Monitor/UptimeHistoryLabels.js +2 -2
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.mts +1 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.d.ts +1 -0
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.js +12 -9
- package/Types/OnCallDutyPolicy/GlobalUserOverrideAccess.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.mts +3 -1
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.d.ts +3 -1
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.js +24 -6
- package/Types/OnCallDutyPolicy/OnCallAcknowledgePage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.mts +1 -0
- package/Types/OnCallDutyPolicy/OnCallPagePassOn.d.ts +1 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.mts +12 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.d.ts +12 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.js +38 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyStartedByHand.mjs +3 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.mts +92 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.d.ts +92 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.js +512 -0
- package/Types/OnCallDutyPolicy/ScheduleLayersSave.mjs +7 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.d.mts +23 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.d.ts +23 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.js +105 -0
- package/Types/OnCallDutyPolicy/UserOverrideEdit.mjs +6 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.mts +64 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.d.ts +64 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.js +237 -0
- package/Types/OnCallDutyPolicy/UserOverrideOverlap.mjs +14 -0
- package/Types/Permission.js +2 -2
- package/Types/Probe/ProbeCapability.d.mts +2 -1
- package/Types/Probe/ProbeCapability.d.ts +2 -1
- package/Types/Probe/ProbeCapability.js +10 -0
- package/Types/ReaderLanguage.d.mts +1 -0
- package/Types/ReaderLanguage.d.ts +1 -0
- package/Types/ReaderLanguage.js +13 -1
- package/Types/ReaderLanguage.mjs +1 -0
- package/Types/Rules/RuleRun.js +2 -2
- package/Types/ScheduledMaintenance/MaintenanceCalendar.js +1 -1
- package/Types/ServerSending/ServerSendingStatus.d.mts +7 -0
- package/Types/ServerSending/ServerSendingStatus.d.ts +7 -0
- package/Types/ServerSending/ServerSendingStatus.js +49 -2
- package/Types/ServerSetup/ServerSetupChecklist.js +3 -3
- package/Types/StateTimeline/RowsKeptOnDelete.js +1 -1
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.mts +8 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.d.ts +8 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.js +50 -0
- package/Types/StatusPage/NewIncidentSubscriberNotificationDefault.mjs +3 -0
- package/Types/StatusPage/PublicNoteSubscriberNotificationDefault.js +1 -1
- package/Types/Telemetry/CompatibleIngest.d.mts +20 -0
- package/Types/Telemetry/CompatibleIngest.d.ts +20 -0
- package/Types/Telemetry/CompatibleIngest.js +123 -0
- package/Types/Telemetry/CompatibleIngest.mjs +21 -0
- package/Types/Telemetry/TelemetryIngestSurface.d.mts +5 -0
- package/Types/Telemetry/TelemetryIngestSurface.d.ts +5 -0
- package/Types/Telemetry/TelemetryIngestSurface.js +48 -7
- package/Types/TimezoneAlias.d.mts +1 -0
- package/Types/TimezoneAlias.d.ts +1 -0
- package/Types/TimezoneAlias.js +13 -0
- package/Types/Translator.js +374 -48
- package/Types/Workflow/RunRecord.js +1 -1
- package/Types/Workflow/Templates.js +2 -2
- package/Types/Workspace/NotificationRules/BaseNotificationRule.d.mts +2 -0
- package/Types/Workspace/NotificationRules/BaseNotificationRule.d.ts +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +26 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +26 -1
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.mts +84 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.d.ts +84 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.js +456 -0
- package/Types/Workspace/NotificationRules/NotificationRuleUpdates.mjs +5 -0
- package/Utils/Dashboard/ValueWidgetSeries.d.mts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.d.ts +2 -0
- package/Utils/Dashboard/ValueWidgetSeries.js +75 -0
- package/Utils/DeveloperDocs/ExampleBuilder.js +1 -1
- package/Utils/DeveloperDocs/ResourceProfiles.js +2 -2
- package/Utils/GuidedSetup/StatusPageRecords.d.mts +5 -0
- package/Utils/GuidedSetup/StatusPageRecords.d.ts +5 -0
- package/Utils/GuidedSetup/StatusPageRecords.js +27 -2
- package/Utils/GuidedSetup/StatusPageRecords.mjs +1 -0
- package/Utils/GuidedSetup/WebsiteMonitorRecords.js +6 -0
- package/Utils/HostAddressUtil.d.mts +1 -0
- package/Utils/HostAddressUtil.d.ts +1 -0
- package/Utils/HostAddressUtil.js +30 -0
- package/Utils/LinearRegExp/LinearRegExp.js +5 -1
- package/Utils/Milliseconds.d.mts +7 -0
- package/Utils/Milliseconds.d.ts +7 -0
- package/Utils/Milliseconds.js +60 -0
- package/Utils/Milliseconds.mjs +4 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.mts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.d.ts +8 -0
- package/Utils/Monitor/EndpointAttachmentUtil.js +91 -21
- package/Utils/Monitor/EndpointAttachmentUtil.mjs +4 -0
- package/Utils/Monitor/InterfaceInventoryUtil.d.mts +40 -0
- package/Utils/Monitor/InterfaceInventoryUtil.d.ts +40 -0
- package/Utils/Monitor/InterfaceInventoryUtil.js +217 -5
- package/Utils/Monitor/InterfaceInventoryUtil.mjs +8 -0
- package/Utils/Monitor/MonitorOverviewPresentationUtil.js +63 -29
- package/Utils/Monitor/MonitorOverviewProbeUtil.js +13 -2
- package/Utils/Monitor/MonitorRootCauseWording.d.mts +2 -0
- package/Utils/Monitor/MonitorRootCauseWording.d.ts +2 -0
- package/Utils/Monitor/MonitorRootCauseWording.js +58 -4
- package/Utils/Monitor/MonitoringOff.d.mts +2 -0
- package/Utils/Monitor/MonitoringOff.d.ts +2 -0
- package/Utils/Monitor/MonitoringOff.js +21 -0
- package/Utils/Monitor/NetworkTopologyUtil.d.mts +2 -1
- package/Utils/Monitor/NetworkTopologyUtil.d.ts +2 -1
- package/Utils/Monitor/NetworkTopologyUtil.js +10 -0
- package/Utils/Monitor/NotOperationalMonitorQuery.d.mts +2 -1
- package/Utils/Monitor/NotOperationalMonitorQuery.d.ts +2 -1
- package/Utils/Monitor/NotOperationalMonitorQuery.js +23 -4
- package/Utils/Monitor/ProbeFailureReading.d.mts +14 -0
- package/Utils/Monitor/ProbeFailureReading.d.ts +14 -0
- package/Utils/Monitor/ProbeFailureReading.js +137 -0
- package/Utils/Monitor/ProbeFailureReading.mjs +7 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.d.mts +9 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.d.ts +9 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.js +15 -0
- package/Utils/NetworkDevice/BoundMonitorNotChecked.mjs +2 -0
- package/Utils/Project/NextNumber.js +1 -1
- package/Utils/PromQL/PromQLAst.d.mts +159 -0
- package/Utils/PromQL/PromQLAst.d.ts +159 -0
- package/Utils/PromQL/PromQLAst.js +118 -0
- package/Utils/PromQL/PromQLAst.mjs +12 -0
- package/Utils/PromQL/PromQLDuration.d.mts +2 -0
- package/Utils/PromQL/PromQLDuration.d.ts +2 -0
- package/Utils/PromQL/PromQLDuration.js +78 -0
- package/Utils/PromQL/PromQLDuration.mjs +3 -0
- package/Utils/PromQL/PromQLEngine.d.mts +15 -0
- package/Utils/PromQL/PromQLEngine.d.ts +15 -0
- package/Utils/PromQL/PromQLEngine.js +965 -0
- package/Utils/PromQL/PromQLEngine.mjs +7 -0
- package/Utils/PromQL/PromQLEngineTypes.d.mts +84 -0
- package/Utils/PromQL/PromQLEngineTypes.d.ts +84 -0
- package/Utils/PromQL/PromQLEngineTypes.js +10 -0
- package/Utils/PromQL/PromQLEngineTypes.mjs +2 -0
- package/Utils/PromQL/PromQLError.d.mts +11 -0
- package/Utils/PromQL/PromQLError.d.ts +11 -0
- package/Utils/PromQL/PromQLError.js +27 -0
- package/Utils/PromQL/PromQLError.mjs +3 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.d.mts +8 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.d.ts +8 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.js +773 -0
- package/Utils/PromQL/PromQLFunctionEvaluators.mjs +3 -0
- package/Utils/PromQL/PromQLFunctions.d.mts +10 -0
- package/Utils/PromQL/PromQLFunctions.d.ts +10 -0
- package/Utils/PromQL/PromQLFunctions.js +127 -0
- package/Utils/PromQL/PromQLFunctions.mjs +4 -0
- package/Utils/PromQL/PromQLLabels.d.mts +11 -0
- package/Utils/PromQL/PromQLLabels.d.ts +11 -0
- package/Utils/PromQL/PromQLLabels.js +218 -0
- package/Utils/PromQL/PromQLLabels.mjs +9 -0
- package/Utils/PromQL/PromQLLexer.d.mts +39 -0
- package/Utils/PromQL/PromQLLexer.d.ts +39 -0
- package/Utils/PromQL/PromQLLexer.js +391 -0
- package/Utils/PromQL/PromQLLexer.mjs +3 -0
- package/Utils/PromQL/PromQLMath.d.mts +19 -0
- package/Utils/PromQL/PromQLMath.d.ts +19 -0
- package/Utils/PromQL/PromQLMath.js +200 -0
- package/Utils/PromQL/PromQLMath.mjs +9 -0
- package/Utils/PromQL/PromQLMetricNames.d.mts +21 -0
- package/Utils/PromQL/PromQLMetricNames.d.ts +21 -0
- package/Utils/PromQL/PromQLMetricNames.js +199 -0
- package/Utils/PromQL/PromQLMetricNames.mjs +8 -0
- package/Utils/PromQL/PromQLParser.d.mts +4 -0
- package/Utils/PromQL/PromQLParser.d.ts +4 -0
- package/Utils/PromQL/PromQLParser.js +831 -0
- package/Utils/PromQL/PromQLParser.mjs +4 -0
- package/Utils/PromQL/PromQLRegex.d.mts +9 -0
- package/Utils/PromQL/PromQLRegex.d.ts +9 -0
- package/Utils/PromQL/PromQLRegex.js +74 -0
- package/Utils/PromQL/PromQLRegex.mjs +2 -0
- package/Utils/PromQL/PrometheusResponse.d.mts +25 -0
- package/Utils/PromQL/PrometheusResponse.d.ts +25 -0
- package/Utils/PromQL/PrometheusResponse.js +90 -0
- package/Utils/PromQL/PrometheusResponse.mjs +3 -0
- package/Utils/Rum/PathInSentence.d.mts +5 -0
- package/Utils/Rum/PathInSentence.d.ts +5 -0
- package/Utils/Rum/PathInSentence.js +46 -0
- package/Utils/Rum/PathInSentence.mjs +6 -0
- package/Utils/Rum/UrlScrubber.d.mts +4 -0
- package/Utils/Rum/UrlScrubber.d.ts +4 -0
- package/Utils/Rum/UrlScrubber.js +143 -3
- package/Utils/Rum/UserFlow.d.mts +1 -1
- package/Utils/Rum/UserFlow.d.ts +1 -1
- package/Utils/Rum/UserFlow.js +180 -25
- package/Utils/Rum/UserFlow.mjs +1 -1
- package/Utils/Runbook/RunbookStepsSignature.d.mts +3 -0
- package/Utils/Runbook/RunbookStepsSignature.d.ts +3 -0
- package/Utils/Runbook/RunbookStepsSignature.js +30 -0
- package/Utils/Runbook/RunbookStepsSignature.mjs +3 -0
- package/Utils/Schema/TypeSchemas.js +6 -0
- package/Utils/Slo/SloDuration.d.mts +5 -2
- package/Utils/Slo/SloDuration.d.ts +5 -2
- package/Utils/Slo/SloDuration.js +11 -6
- package/Utils/Slo/SloHealth.js +1 -1
- package/Utils/StateOrder.js +1 -4
- package/Utils/StateTimeline/StateTimelineRowDelete.js +1 -1
- package/Utils/Telemetry/HeartbeatAvailability.d.mts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.d.ts +4 -0
- package/Utils/Telemetry/HeartbeatAvailability.js +118 -26
- package/Utils/Uptime/DayUptimeGraphUtil.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import LinearRegExp from "../LinearRegExp/LinearRegExp.mjs";
|
|
2
|
+
export interface PromQLRegexOptions {
|
|
3
|
+
captures?: boolean | undefined;
|
|
4
|
+
}
|
|
5
|
+
export interface CompiledPromQLRegex {
|
|
6
|
+
regex: LinearRegExp;
|
|
7
|
+
anchoredPattern: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const compilePromQLRegex: (pattern: string, options?: PromQLRegexOptions) => CompiledPromQLRegex;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import LinearRegExp from "../LinearRegExp/LinearRegExp";
|
|
2
|
+
export interface PromQLRegexOptions {
|
|
3
|
+
captures?: boolean | undefined;
|
|
4
|
+
}
|
|
5
|
+
export interface CompiledPromQLRegex {
|
|
6
|
+
regex: LinearRegExp;
|
|
7
|
+
anchoredPattern: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const compilePromQLRegex: (pattern: string, options?: PromQLRegexOptions) => CompiledPromQLRegex;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compilePromQLRegex = void 0;
|
|
4
|
+
const PatternCache_1 = require("../LinearRegExp/PatternCache");
|
|
5
|
+
/*
|
|
6
|
+
* PromQL's regular expressions, read in JavaScript.
|
|
7
|
+
*
|
|
8
|
+
* Prometheus matches with Go's RE2, always anchored at both ends: `=~"api"`
|
|
9
|
+
* matches the value "api" and not "api-2". JavaScript reads nearly all of RE2
|
|
10
|
+
* the same way; the few spellings it reads differently, and that people write
|
|
11
|
+
* in label matchers, are translated here: the `(?i)` flag group at the start,
|
|
12
|
+
* `(?P<name>...)` named groups, and POSIX classes such as `[[:digit:]]`.
|
|
13
|
+
*
|
|
14
|
+
* A matcher's pattern is written by a project's people, so it runs on the
|
|
15
|
+
* linear-time matcher (Utils/LinearRegExp), as every such pattern does: in
|
|
16
|
+
* time in line with the value it reads, as RE2 runs it. It is compiled once
|
|
17
|
+
* and kept (PatternCache), by the pattern, so a query that asks it about
|
|
18
|
+
* every series compiles it once.
|
|
19
|
+
*/
|
|
20
|
+
const POSIX_CLASSES = {
|
|
21
|
+
alnum: "0-9A-Za-z",
|
|
22
|
+
alpha: "A-Za-z",
|
|
23
|
+
ascii: "\\x00-\\x7F",
|
|
24
|
+
blank: "\\t ",
|
|
25
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
26
|
+
digit: "0-9",
|
|
27
|
+
graph: "!-~",
|
|
28
|
+
lower: "a-z",
|
|
29
|
+
print: " -~",
|
|
30
|
+
punct: "!-\\/:-@\\[-`{-~",
|
|
31
|
+
space: "\\t\\n\\v\\f\\r ",
|
|
32
|
+
upper: "A-Z",
|
|
33
|
+
word: "0-9A-Za-z_",
|
|
34
|
+
xdigit: "0-9A-Fa-f",
|
|
35
|
+
};
|
|
36
|
+
const POSIX_CLASS_REGEX = /\[:(\^?)([a-z]+):\]/g;
|
|
37
|
+
const LEADING_FLAGS_REGEX = /^\(\?([imsU]+)\)/;
|
|
38
|
+
const NAMED_GROUP_REGEX = /\(\?P</g;
|
|
39
|
+
/*
|
|
40
|
+
* The regular expression a matcher's pattern means, anchored as Prometheus
|
|
41
|
+
* anchors it. Throws what getLinearRegExp throws: a SyntaxError for a pattern
|
|
42
|
+
* that is not a regular expression, and PatternProblemError for one the
|
|
43
|
+
* linear-time matcher cannot run (a back-reference, or one too large).
|
|
44
|
+
*/
|
|
45
|
+
const compilePromQLRegex = (pattern, options) => {
|
|
46
|
+
let body = pattern;
|
|
47
|
+
let flags = "";
|
|
48
|
+
const leadingFlags = LEADING_FLAGS_REGEX.exec(body);
|
|
49
|
+
if (leadingFlags) {
|
|
50
|
+
body = body.slice(leadingFlags[0].length);
|
|
51
|
+
for (const flag of leadingFlags[1]) {
|
|
52
|
+
// RE2's U (ungreedy) has no JavaScript twin; i, m and s do.
|
|
53
|
+
if (flag !== "U" && !flags.includes(flag)) {
|
|
54
|
+
flags += flag;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
body = body.replace(NAMED_GROUP_REGEX, "(?<");
|
|
59
|
+
body = body.replace(POSIX_CLASS_REGEX, (whole, negated, name) => {
|
|
60
|
+
const members = POSIX_CLASSES[name];
|
|
61
|
+
// A negated POSIX class only reads inside its own bracket: `[^[:digit:]]`.
|
|
62
|
+
if (!members || negated) {
|
|
63
|
+
return whole;
|
|
64
|
+
}
|
|
65
|
+
return members;
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
regex: (0, PatternCache_1.getLinearRegExp)(`^(?:${body})$`, flags, {
|
|
69
|
+
captures: (options === null || options === void 0 ? void 0 : options.captures) === true,
|
|
70
|
+
}),
|
|
71
|
+
anchoredPattern: `^(?:${pattern})$`,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
exports.compilePromQLRegex = compilePromQLRegex;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PromQLLabels } from "./PromQLLabels.mjs";
|
|
2
|
+
export interface PrometheusPoint {
|
|
3
|
+
timestampMs: number;
|
|
4
|
+
value: number;
|
|
5
|
+
}
|
|
6
|
+
export interface PrometheusSeries {
|
|
7
|
+
labels: PromQLLabels;
|
|
8
|
+
points: Array<PrometheusPoint>;
|
|
9
|
+
}
|
|
10
|
+
export type PrometheusResult = {
|
|
11
|
+
resultType: "matrix";
|
|
12
|
+
series: Array<PrometheusSeries>;
|
|
13
|
+
} | {
|
|
14
|
+
resultType: "vector";
|
|
15
|
+
series: Array<PrometheusSeries>;
|
|
16
|
+
} | {
|
|
17
|
+
resultType: "scalar";
|
|
18
|
+
value: PrometheusPoint;
|
|
19
|
+
} | {
|
|
20
|
+
resultType: "string";
|
|
21
|
+
timestampMs: number;
|
|
22
|
+
text: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const parsePrometheusValue: (value: unknown) => number;
|
|
25
|
+
export declare const parsePrometheusResult: (data: unknown) => PrometheusResult | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PromQLLabels } from "./PromQLLabels";
|
|
2
|
+
export interface PrometheusPoint {
|
|
3
|
+
timestampMs: number;
|
|
4
|
+
value: number;
|
|
5
|
+
}
|
|
6
|
+
export interface PrometheusSeries {
|
|
7
|
+
labels: PromQLLabels;
|
|
8
|
+
points: Array<PrometheusPoint>;
|
|
9
|
+
}
|
|
10
|
+
export type PrometheusResult = {
|
|
11
|
+
resultType: "matrix";
|
|
12
|
+
series: Array<PrometheusSeries>;
|
|
13
|
+
} | {
|
|
14
|
+
resultType: "vector";
|
|
15
|
+
series: Array<PrometheusSeries>;
|
|
16
|
+
} | {
|
|
17
|
+
resultType: "scalar";
|
|
18
|
+
value: PrometheusPoint;
|
|
19
|
+
} | {
|
|
20
|
+
resultType: "string";
|
|
21
|
+
timestampMs: number;
|
|
22
|
+
text: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const parsePrometheusValue: (value: unknown) => number;
|
|
25
|
+
export declare const parsePrometheusResult: (data: unknown) => PrometheusResult | undefined;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parsePrometheusResult = exports.parsePrometheusValue = void 0;
|
|
4
|
+
const parsePrometheusValue = (value) => {
|
|
5
|
+
if (typeof value === "number") {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
const text = String(value);
|
|
9
|
+
if (text === "+Inf" || text === "Inf") {
|
|
10
|
+
return Infinity;
|
|
11
|
+
}
|
|
12
|
+
if (text === "-Inf") {
|
|
13
|
+
return -Infinity;
|
|
14
|
+
}
|
|
15
|
+
return Number(text);
|
|
16
|
+
};
|
|
17
|
+
exports.parsePrometheusValue = parsePrometheusValue;
|
|
18
|
+
const toPoint = (pair) => {
|
|
19
|
+
if (!Array.isArray(pair) || pair.length < 2) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const seconds = Number(pair[0]);
|
|
23
|
+
if (!Number.isFinite(seconds)) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
timestampMs: Math.round(seconds * 1000),
|
|
28
|
+
value: (0, exports.parsePrometheusValue)(pair[1]),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const toLabels = (metric) => {
|
|
32
|
+
if (!metric || typeof metric !== "object") {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
const labels = {};
|
|
36
|
+
for (const [name, value] of Object.entries(metric)) {
|
|
37
|
+
labels[name] = String(value);
|
|
38
|
+
}
|
|
39
|
+
return labels;
|
|
40
|
+
};
|
|
41
|
+
/*
|
|
42
|
+
* The result of a successful /query or /query_range answer's `data`.
|
|
43
|
+
* Undefined for a shape that is not one.
|
|
44
|
+
*/
|
|
45
|
+
const parsePrometheusResult = (data) => {
|
|
46
|
+
if (!data || typeof data !== "object") {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const record = data;
|
|
50
|
+
const resultType = record["resultType"];
|
|
51
|
+
const result = record["result"];
|
|
52
|
+
if (resultType === "scalar") {
|
|
53
|
+
const point = toPoint(result);
|
|
54
|
+
return point ? { resultType: "scalar", value: point } : undefined;
|
|
55
|
+
}
|
|
56
|
+
if (resultType === "string") {
|
|
57
|
+
if (!Array.isArray(result) || result.length < 2) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
resultType: "string",
|
|
62
|
+
timestampMs: Math.round(Number(result[0]) * 1000),
|
|
63
|
+
text: String(result[1]),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if ((resultType !== "matrix" && resultType !== "vector") ||
|
|
67
|
+
!Array.isArray(result)) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const series = result.map((entry) => {
|
|
71
|
+
const item = entry && typeof entry === "object"
|
|
72
|
+
? entry
|
|
73
|
+
: {};
|
|
74
|
+
const pairs = resultType === "matrix"
|
|
75
|
+
? Array.isArray(item["values"])
|
|
76
|
+
? item["values"]
|
|
77
|
+
: []
|
|
78
|
+
: [item["value"]];
|
|
79
|
+
const points = [];
|
|
80
|
+
for (const pair of pairs) {
|
|
81
|
+
const point = toPoint(pair);
|
|
82
|
+
if (point) {
|
|
83
|
+
points.push(point);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return { labels: toLabels(item["metric"]), points };
|
|
87
|
+
});
|
|
88
|
+
return { resultType, series };
|
|
89
|
+
};
|
|
90
|
+
exports.parsePrometheusResult = parsePrometheusResult;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const PATH_LEFT_TO_RIGHT_ISOLATE: string;
|
|
2
|
+
export declare const PATH_POP_DIRECTIONAL_ISOLATE: string;
|
|
3
|
+
export declare const PATH_DIRECTION_SCAN_LENGTH: number;
|
|
4
|
+
export declare function isPathSetApartInSentence(path: string): boolean;
|
|
5
|
+
export declare function setPathApartInSentence(path: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const PATH_LEFT_TO_RIGHT_ISOLATE: string;
|
|
2
|
+
export declare const PATH_POP_DIRECTIONAL_ISOLATE: string;
|
|
3
|
+
export declare const PATH_DIRECTION_SCAN_LENGTH: number;
|
|
4
|
+
export declare function isPathSetApartInSentence(path: string): boolean;
|
|
5
|
+
export declare function setPathApartInSentence(path: string): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* A PATH IN A SENTENCE READ FROM THE LEFT, SET APART.
|
|
4
|
+
*
|
|
5
|
+
* A path reads from the left on every page, its "/" first, and the Arabic
|
|
6
|
+
* or Persian words in it still read from the right (RFC 3987's
|
|
7
|
+
* bidirectional IRIs, as a browser's address bar draws them). A path with
|
|
8
|
+
* a letter of a script read from the right is set apart, left to right,
|
|
9
|
+
* in a Unicode isolate (LRI ... PDI); a path in letters read from the left
|
|
10
|
+
* comes back as it is.
|
|
11
|
+
*
|
|
12
|
+
* This is Types/ReadingDirection's isSetApartInSentence(path,
|
|
13
|
+
* LEFT_TO_RIGHT), wrapped in Types/CodeInSentence's LEFT_TO_RIGHT_ISOLATE,
|
|
14
|
+
* written out here because a module in Common/{Utils,Types}/Rum imports
|
|
15
|
+
* nothing from the rest of Common: the browser recorder inlines these
|
|
16
|
+
* modules into the page it is served to, and its SourceHygiene test holds
|
|
17
|
+
* every one of them to that. Tests/Utils/Rum/PathInSentence.test.ts holds
|
|
18
|
+
* this copy to ReadingDirection's rule, code point by code point.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.PATH_DIRECTION_SCAN_LENGTH = exports.PATH_POP_DIRECTIONAL_ISOLATE = exports.PATH_LEFT_TO_RIGHT_ISOLATE = void 0;
|
|
22
|
+
exports.isPathSetApartInSentence = isPathSetApartInSentence;
|
|
23
|
+
exports.setPathApartInSentence = setPathApartInSentence;
|
|
24
|
+
// Types/CodeInSentence's LEFT_TO_RIGHT_ISOLATE (LRI).
|
|
25
|
+
exports.PATH_LEFT_TO_RIGHT_ISOLATE = String.fromCharCode(0x2066);
|
|
26
|
+
// Types/ReadingDirection's POP_DIRECTIONAL_ISOLATE (PDI).
|
|
27
|
+
exports.PATH_POP_DIRECTIONAL_ISOLATE = String.fromCharCode(0x2069);
|
|
28
|
+
/*
|
|
29
|
+
* Types/ReadingDirection's TEXT_DIRECTION_SCAN_LENGTH: only the start of a
|
|
30
|
+
* path is read.
|
|
31
|
+
*/
|
|
32
|
+
exports.PATH_DIRECTION_SCAN_LENGTH = 4096;
|
|
33
|
+
/*
|
|
34
|
+
* A letter of a script written from right to left, by the scripts that use
|
|
35
|
+
* it: Types/ReadingDirection's RIGHT_TO_LEFT_LETTER_REGEX, which says why
|
|
36
|
+
* script extensions decide it, and only for a letter.
|
|
37
|
+
*/
|
|
38
|
+
const RIGHT_TO_LEFT_LETTER_REGEX = /(?=\p{L})[\p{Script_Extensions=Arabic}\p{Script_Extensions=Hebrew}\p{Script_Extensions=Syriac}\p{Script_Extensions=Thaana}\p{Script_Extensions=Nko}\p{Script_Extensions=Adlam}\p{Script_Extensions=Hanifi_Rohingya}\p{Script_Extensions=Mandaic}\p{Script_Extensions=Samaritan}]/u;
|
|
39
|
+
function isPathSetApartInSentence(path) {
|
|
40
|
+
return RIGHT_TO_LEFT_LETTER_REGEX.test(path.slice(0, exports.PATH_DIRECTION_SCAN_LENGTH));
|
|
41
|
+
}
|
|
42
|
+
function setPathApartInSentence(path) {
|
|
43
|
+
return isPathSetApartInSentence(path)
|
|
44
|
+
? `${exports.PATH_LEFT_TO_RIGHT_ISOLATE}${path}${exports.PATH_POP_DIRECTIONAL_ISOLATE}`
|
|
45
|
+
: path;
|
|
46
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import commonJsModule from "./PathInSentence.js";
|
|
2
|
+
export const PATH_DIRECTION_SCAN_LENGTH = commonJsModule.PATH_DIRECTION_SCAN_LENGTH;
|
|
3
|
+
export const PATH_LEFT_TO_RIGHT_ISOLATE = commonJsModule.PATH_LEFT_TO_RIGHT_ISOLATE;
|
|
4
|
+
export const PATH_POP_DIRECTIONAL_ISOLATE = commonJsModule.PATH_POP_DIRECTIONAL_ISOLATE;
|
|
5
|
+
export const isPathSetApartInSentence = commonJsModule.isPathSetApartInSentence;
|
|
6
|
+
export const setPathApartInSentence = commonJsModule.setPathApartInSentence;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export default class UrlScrubber {
|
|
2
2
|
static scrub(rawUrl: string, allowlistedQueryParams?: Array<string> | undefined): string;
|
|
3
|
+
static scrubHashRoute(hash: string): string;
|
|
4
|
+
static getHashRoute(hash: string): string | null;
|
|
5
|
+
static normalizePathSpelling(path: string): string;
|
|
6
|
+
private static spellWords;
|
|
3
7
|
static scrubPath(pathname: string): string;
|
|
4
8
|
static scrubQuery(params: URLSearchParams, allowlistedQueryParams?: Array<string> | undefined): string;
|
|
5
9
|
static getScrubbedPathname(rawUrl: string): string;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export default class UrlScrubber {
|
|
2
2
|
static scrub(rawUrl: string, allowlistedQueryParams?: Array<string> | undefined): string;
|
|
3
|
+
static scrubHashRoute(hash: string): string;
|
|
4
|
+
static getHashRoute(hash: string): string | null;
|
|
5
|
+
static normalizePathSpelling(path: string): string;
|
|
6
|
+
private static spellWords;
|
|
3
7
|
static scrubPath(pathname: string): string;
|
|
4
8
|
static scrubQuery(params: URLSearchParams, allowlistedQueryParams?: Array<string> | undefined): string;
|
|
5
9
|
static getScrubbedPathname(rawUrl: string): string;
|
package/Utils/Rum/UrlScrubber.js
CHANGED
|
@@ -41,6 +41,25 @@ const LONG_DIGIT_SEGMENT = /^\d{9,}$/;
|
|
|
41
41
|
*/
|
|
42
42
|
const OPAQUE_TOKEN_SEGMENT = /^[A-Za-z0-9_-]{32,}$/;
|
|
43
43
|
const REDACTED = "[redacted]";
|
|
44
|
+
/*
|
|
45
|
+
* A fragment that is a route rather than an in-page anchor. Hash routers
|
|
46
|
+
* (Angular's HashLocationStrategy, React's HashRouter, Vue's hash mode,
|
|
47
|
+
* every "#/"-routed admin tool) keep the whole route there:
|
|
48
|
+
* "https://shop.example.com/#/orders/42", or "#!/orders/42".
|
|
49
|
+
*/
|
|
50
|
+
const HASH_ROUTE_PATTERN = /^#!?\//;
|
|
51
|
+
/* One escaped byte: "%c3", "%2F". */
|
|
52
|
+
const ESCAPED_BYTE = /^%[0-9A-Fa-f]{2}$/;
|
|
53
|
+
/*
|
|
54
|
+
* Text with no ASCII in it. An escaped character is written composed only
|
|
55
|
+
* when it stays beyond ASCII composed: NFC turns three into ASCII, U+037E
|
|
56
|
+
* into ";", U+1FEF into "`" and U+212A into "K".
|
|
57
|
+
*/
|
|
58
|
+
const BEYOND_ASCII = /^[\u0080-\uffff]+$/;
|
|
59
|
+
/* An escape, or a character beyond ASCII: a path with a spelling to settle. */
|
|
60
|
+
const SPELLED_CHARACTER = /[%\u0080-\uffff]/;
|
|
61
|
+
/* Characters beyond ASCII, which the URL parser escapes. */
|
|
62
|
+
const NON_ASCII_RUN = /[\u0080-\uffff]+/g;
|
|
44
63
|
class UrlScrubber {
|
|
45
64
|
/*
|
|
46
65
|
* Reduce a URL to origin + scrubbed path. Query and fragment are
|
|
@@ -49,6 +68,16 @@ class UrlScrubber {
|
|
|
49
68
|
* tell "this page was loaded with a coupon code" from "it wasn't",
|
|
50
69
|
* without recording which code.
|
|
51
70
|
*
|
|
71
|
+
* The one fragment kept is a hash router's route (scrubHashRoute): it
|
|
72
|
+
* is the page, as much as the path is. Without it every page of a
|
|
73
|
+
* hash-routed app was stored as "https://shop.example.com/", and the
|
|
74
|
+
* app reported one page per session. Any other fragment - an anchor
|
|
75
|
+
* ("#pricing"), a token ("#access_token=...") - is still dropped.
|
|
76
|
+
*
|
|
77
|
+
* The browser recorder and the ingest both run this, the ingest again
|
|
78
|
+
* over whatever the recorder sent, so it has to keep what it keeps
|
|
79
|
+
* when it runs over its own output.
|
|
80
|
+
*
|
|
52
81
|
* Never throws: a URL that will not parse is reduced to a constant
|
|
53
82
|
* rather than propagating an exception into the recorder's hot path or
|
|
54
83
|
* being passed through unscrubbed. Failing closed matters more here
|
|
@@ -77,14 +106,125 @@ class UrlScrubber {
|
|
|
77
106
|
const base = isRelativeInput
|
|
78
107
|
? scrubbedPath
|
|
79
108
|
: `${parsed.origin}${scrubbedPath}`;
|
|
80
|
-
|
|
109
|
+
const hashRoute = UrlScrubber.scrubHashRoute(parsed.hash);
|
|
110
|
+
return `${query ? `${base}?${query}` : base}${hashRoute}`;
|
|
111
|
+
}
|
|
112
|
+
/*
|
|
113
|
+
* A hash router's route, scrubbed as a path is: "#/orders/42?token=x" ->
|
|
114
|
+
* "#/orders/42", "#!/u/someone@example.com" -> "#!/u/[redacted]". Empty
|
|
115
|
+
* for any other fragment, which is dropped.
|
|
116
|
+
*/
|
|
117
|
+
static scrubHashRoute(hash) {
|
|
118
|
+
const route = UrlScrubber.getHashRoute(hash);
|
|
119
|
+
if (route === null) {
|
|
120
|
+
return "";
|
|
121
|
+
}
|
|
122
|
+
return `${hash.slice(0, hash.indexOf("/"))}${UrlScrubber.scrubPath(route)}`;
|
|
123
|
+
}
|
|
124
|
+
/*
|
|
125
|
+
* The path of a hash router's route, without the query a route can
|
|
126
|
+
* carry inside the fragment: "#/orders/42?tab=open" and "#!/orders/42"
|
|
127
|
+
* are "/orders/42". Null when the fragment is not a route.
|
|
128
|
+
*/
|
|
129
|
+
static getHashRoute(hash) {
|
|
130
|
+
if (!HASH_ROUTE_PATTERN.test(hash)) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
const route = hash.slice(hash.indexOf("/"));
|
|
134
|
+
const queryIndex = route.indexOf("?");
|
|
135
|
+
return queryIndex === -1 ? route : route.slice(0, queryIndex);
|
|
81
136
|
}
|
|
82
|
-
/*
|
|
137
|
+
/*
|
|
138
|
+
* A path in the one spelling the URL parser writes for its words.
|
|
139
|
+
*
|
|
140
|
+
* The parser escapes every character beyond ASCII as UTF-8 in upper-case
|
|
141
|
+
* hex ("/café" is "/caf%C3%A9"), but keeps an escape it is given as
|
|
142
|
+
* written. So one page reached through a link to "/caf%c3%a9" (lower-case
|
|
143
|
+
* hex, as .NET's HttpUtility.UrlEncode and WordPress write it), or
|
|
144
|
+
* through "/café" with its accent decomposed (an "e" and U+0301, as macOS
|
|
145
|
+
* writes file names: "/cafe%CC%81"), was stored, and shown on User Flows,
|
|
146
|
+
* as two or three pages, each named "/café". Here every escape is written
|
|
147
|
+
* in upper-case hex (RFC 3986, 6.2.2.1), and the escaped characters
|
|
148
|
+
* beyond ASCII are decoded, composed (NFC) and escaped again as the
|
|
149
|
+
* parser escapes them: all three are "/caf%C3%A9".
|
|
150
|
+
*
|
|
151
|
+
* Nothing that can name another page is merged. Every other escape keeps
|
|
152
|
+
* its place: an escaped "/", "?", "#" or "%" ("/a%2Fb" is not "/a/b") and
|
|
153
|
+
* any other escape of an ASCII character, bytes that are not UTF-8, and
|
|
154
|
+
* the three characters NFC would turn into ASCII (BEYOND_ASCII), so an
|
|
155
|
+
* escape never passes for a character the parser writes plainly. Each
|
|
156
|
+
* also ends the text an accent is composed with, so it never takes one
|
|
157
|
+
* ("%2F" and U+0307 would compose the "F" into U+1E1E). Case outside
|
|
158
|
+
* escapes stays: "/Cart" is not "/cart". (User Flows draws the words
|
|
159
|
+
* decoded for a person: getUserFlowPageText.)
|
|
160
|
+
*
|
|
161
|
+
* No Unicode property escape decides it: the recorder inlines this
|
|
162
|
+
* module, and a browser that cannot parse one would not load it at all.
|
|
163
|
+
*
|
|
164
|
+
* Running it over its own result changes nothing, so the ingest's second
|
|
165
|
+
* scrub keeps the recorder's spelling.
|
|
166
|
+
*/
|
|
167
|
+
static normalizePathSpelling(path) {
|
|
168
|
+
if (!SPELLED_CHARACTER.test(path)) {
|
|
169
|
+
return path;
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
let spelled = "";
|
|
173
|
+
// The words since the last escape kept as written, decoded.
|
|
174
|
+
let words = "";
|
|
175
|
+
let index = 0;
|
|
176
|
+
while (index < path.length) {
|
|
177
|
+
const escape = path.slice(index, index + 3);
|
|
178
|
+
if (!ESCAPED_BYTE.test(escape)) {
|
|
179
|
+
words += path.charAt(index);
|
|
180
|
+
index += 1;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
// A character's escapes: 2 to 4 bytes, as many as its first says.
|
|
184
|
+
const lead = parseInt(escape.slice(1), 16);
|
|
185
|
+
const length = lead < 0xc2 ? 0 : lead < 0xe0 ? 6 : lead < 0xf0 ? 9 : 12;
|
|
186
|
+
let character = "";
|
|
187
|
+
try {
|
|
188
|
+
character = length
|
|
189
|
+
? decodeURIComponent(path.slice(index, index + length))
|
|
190
|
+
: "";
|
|
191
|
+
}
|
|
192
|
+
catch (_a) {
|
|
193
|
+
// Not UTF-8: cut short, written too long, a surrogate.
|
|
194
|
+
}
|
|
195
|
+
if (BEYOND_ASCII.test(character.normalize("NFC"))) {
|
|
196
|
+
words += character;
|
|
197
|
+
index += length;
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
spelled += UrlScrubber.spellWords(words) + escape.toUpperCase();
|
|
201
|
+
words = "";
|
|
202
|
+
index += 3;
|
|
203
|
+
}
|
|
204
|
+
return spelled + UrlScrubber.spellWords(words);
|
|
205
|
+
}
|
|
206
|
+
catch (_b) {
|
|
207
|
+
// A lone surrogate, which only a path the parser never read holds.
|
|
208
|
+
return path;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// Composed, and every character beyond ASCII escaped as the parser does.
|
|
212
|
+
static spellWords(words) {
|
|
213
|
+
return words
|
|
214
|
+
.normalize("NFC")
|
|
215
|
+
.replace(NON_ASCII_RUN, (run) => {
|
|
216
|
+
return encodeURIComponent(run);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/*
|
|
220
|
+
* Replace identifier-shaped segments, preserving route structure, in
|
|
221
|
+
* the path's one spelling (normalizePathSpelling).
|
|
222
|
+
*/
|
|
83
223
|
static scrubPath(pathname) {
|
|
84
224
|
if (!pathname || pathname === "/") {
|
|
85
225
|
return pathname || "/";
|
|
86
226
|
}
|
|
87
|
-
const segments = pathname.split("/");
|
|
227
|
+
const segments = UrlScrubber.normalizePathSpelling(pathname).split("/");
|
|
88
228
|
const scrubbed = segments.map((segment) => {
|
|
89
229
|
if (!segment) {
|
|
90
230
|
return segment;
|
package/Utils/Rum/UserFlow.d.mts
CHANGED
|
@@ -164,7 +164,7 @@ export declare function toUserFlowPageKey(rawUrl: string, options: {
|
|
|
164
164
|
}): string;
|
|
165
165
|
export declare function spansMultipleHosts(rawUrls: Array<string>): boolean;
|
|
166
166
|
export declare function toSessionListUrlPrefix(page: string): string;
|
|
167
|
-
export declare function
|
|
167
|
+
export declare function getUserFlowPageText(page: string): string;
|
|
168
168
|
export declare function buildUserFlowJourneys(response: UserFlowJourneysResponseDto, options: Pick<UserFlowOptions, "groupDynamicSegments" | "hiddenPages" | "sessionFilter" | "deviceType">): {
|
|
169
169
|
journeys: Array<UserFlowJourney>;
|
|
170
170
|
includesHost: boolean;
|
package/Utils/Rum/UserFlow.d.ts
CHANGED
|
@@ -164,7 +164,7 @@ export declare function toUserFlowPageKey(rawUrl: string, options: {
|
|
|
164
164
|
}): string;
|
|
165
165
|
export declare function spansMultipleHosts(rawUrls: Array<string>): boolean;
|
|
166
166
|
export declare function toSessionListUrlPrefix(page: string): string;
|
|
167
|
-
export declare function
|
|
167
|
+
export declare function getUserFlowPageText(page: string): string;
|
|
168
168
|
export declare function buildUserFlowJourneys(response: UserFlowJourneysResponseDto, options: Pick<UserFlowOptions, "groupDynamicSegments" | "hiddenPages" | "sessionFilter" | "deviceType">): {
|
|
169
169
|
journeys: Array<UserFlowJourney>;
|
|
170
170
|
includesHost: boolean;
|