@osdk/react-devtools 0.5.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/CHANGELOG.md +79 -0
- package/build/esm/DevToolsContext.js +19 -0
- package/build/esm/DevToolsContext.js.map +1 -0
- package/build/esm/components/ActionMetrics.js +89 -0
- package/build/esm/components/ActionMetrics.js.map +1 -0
- package/build/esm/components/BubbleChart.js +175 -0
- package/build/esm/components/BubbleChart.js.map +1 -0
- package/build/esm/components/BubbleChart.module.scss.js +6 -0
- package/build/esm/components/CacheInspectorTab.js +291 -0
- package/build/esm/components/CacheInspectorTab.js.map +1 -0
- package/build/esm/components/CacheInspectorTab.module.scss.js +39 -0
- package/build/esm/components/CacheMetrics.js +55 -0
- package/build/esm/components/CacheMetrics.js.map +1 -0
- package/build/esm/components/ComponentCard.js +124 -0
- package/build/esm/components/ComponentCard.js.map +1 -0
- package/build/esm/components/ComponentCard.module.scss.js +31 -0
- package/build/esm/components/ComputeTab.js +175 -0
- package/build/esm/components/ComputeTab.js.map +1 -0
- package/build/esm/components/CopyableCodeBlock.js +49 -0
- package/build/esm/components/CopyableCodeBlock.js.map +1 -0
- package/build/esm/components/CopyableCodeBlock.module.scss.js +10 -0
- package/build/esm/components/DebuggingTab.js +342 -0
- package/build/esm/components/DebuggingTab.js.map +1 -0
- package/build/esm/components/DebuggingTab.module.scss.js +18 -0
- package/build/esm/components/HookRow.js +180 -0
- package/build/esm/components/HookRow.js.map +1 -0
- package/build/esm/components/HookRow.module.scss.js +16 -0
- package/build/esm/components/ImprovementsTab.js +138 -0
- package/build/esm/components/ImprovementsTab.js.map +1 -0
- package/build/esm/components/ImprovementsTab.module.scss.js +30 -0
- package/build/esm/components/InspectorSelectionHeader.js +65 -0
- package/build/esm/components/InspectorSelectionHeader.js.map +1 -0
- package/build/esm/components/InterceptTab.js +862 -0
- package/build/esm/components/InterceptTab.js.map +1 -0
- package/build/esm/components/InterceptTab.module.scss.js +49 -0
- package/build/esm/components/IssueCard.js +115 -0
- package/build/esm/components/IssueCard.js.map +1 -0
- package/build/esm/components/IssueCard.module.scss.js +24 -0
- package/build/esm/components/LogEntryCard.js +94 -0
- package/build/esm/components/LogEntryCard.js.map +1 -0
- package/build/esm/components/LogEntryCard.module.scss.js +19 -0
- package/build/esm/components/MockEditor.js +316 -0
- package/build/esm/components/MockEditor.js.map +1 -0
- package/build/esm/components/MonitorErrorBoundary.js +64 -0
- package/build/esm/components/MonitorErrorBoundary.js.map +1 -0
- package/build/esm/components/MonitorErrorBoundary.module.scss.js +9 -0
- package/build/esm/components/MonitoringPanel.js +434 -0
- package/build/esm/components/MonitoringPanel.js.map +1 -0
- package/build/esm/components/MonitoringPanel.module.scss.js +81 -0
- package/build/esm/components/ObjectLoadingMetrics.js +60 -0
- package/build/esm/components/ObjectLoadingMetrics.js.map +1 -0
- package/build/esm/components/OsdkAppErrorBoundary.js +68 -0
- package/build/esm/components/OsdkAppErrorBoundary.js.map +1 -0
- package/build/esm/components/OsdkDevTools.js +40 -0
- package/build/esm/components/OsdkDevTools.js.map +1 -0
- package/build/esm/components/OverrideEditor.js +197 -0
- package/build/esm/components/OverrideEditor.js.map +1 -0
- package/build/esm/components/PerformanceTab.js +297 -0
- package/build/esm/components/PerformanceTab.js.map +1 -0
- package/build/esm/components/PrimitiveSelectionPanel.js +220 -0
- package/build/esm/components/PrimitiveSelectionPanel.js.map +1 -0
- package/build/esm/components/PrimitiveSelectionPanel.module.scss.js +26 -0
- package/build/esm/components/issueTypes.js +2 -0
- package/build/esm/components/issueTypes.js.map +1 -0
- package/build/esm/components/resolveComponentName.js +57 -0
- package/build/esm/components/resolveComponentName.js.map +1 -0
- package/build/esm/components/testHelpers.js +312 -0
- package/build/esm/components/testHelpers.js.map +1 -0
- package/build/esm/css.d.ts +20 -0
- package/build/esm/fiber/DegradationNotice.js +193 -0
- package/build/esm/fiber/DegradationNotice.js.map +1 -0
- package/build/esm/fiber/DevtoolsHook.js +252 -0
- package/build/esm/fiber/DevtoolsHook.js.map +1 -0
- package/build/esm/fiber/FiberAccess.js +65 -0
- package/build/esm/fiber/FiberAccess.js.map +1 -0
- package/build/esm/fiber/FiberInspection.js +140 -0
- package/build/esm/fiber/FiberInspection.js.map +1 -0
- package/build/esm/fiber/FiberTags.js +52 -0
- package/build/esm/fiber/FiberTags.js.map +1 -0
- package/build/esm/fiber/HookStateInspector.js +254 -0
- package/build/esm/fiber/HookStateInspector.js.map +1 -0
- package/build/esm/fiber/SafeFiberOperation.js +35 -0
- package/build/esm/fiber/SafeFiberOperation.js.map +1 -0
- package/build/esm/fiber/capabilities.js +180 -0
- package/build/esm/fiber/capabilities.js.map +1 -0
- package/build/esm/fiber/traverseFiber.js +129 -0
- package/build/esm/fiber/traverseFiber.js.map +1 -0
- package/build/esm/fiber/types.js +2 -0
- package/build/esm/fiber/types.js.map +1 -0
- package/build/esm/fiber/validation.js +155 -0
- package/build/esm/fiber/validation.js.map +1 -0
- package/build/esm/hooks/createPollingStore.js +81 -0
- package/build/esm/hooks/createPollingStore.js.map +1 -0
- package/build/esm/hooks/useActiveComponents.js +27 -0
- package/build/esm/hooks/useActiveComponents.js.map +1 -0
- package/build/esm/hooks/useComponentRegistry.js +25 -0
- package/build/esm/hooks/useComponentRegistry.js.map +1 -0
- package/build/esm/hooks/useComputeSelectors.js +43 -0
- package/build/esm/hooks/useComputeSelectors.js.map +1 -0
- package/build/esm/hooks/useConsoleLogs.js +46 -0
- package/build/esm/hooks/useConsoleLogs.js.map +1 -0
- package/build/esm/hooks/useInspectorSelection.js +93 -0
- package/build/esm/hooks/useInspectorSelection.js.map +1 -0
- package/build/esm/hooks/useMetrics.js +23 -0
- package/build/esm/hooks/useMetrics.js.map +1 -0
- package/build/esm/hooks/usePersistedState.js +89 -0
- package/build/esm/hooks/usePersistedState.js.map +1 -0
- package/build/esm/hooks/useRecommendations.js +123 -0
- package/build/esm/hooks/useRecommendations.js.map +1 -0
- package/build/esm/hooks/useSharedTick.js +49 -0
- package/build/esm/hooks/useSharedTick.js.map +1 -0
- package/build/esm/hooks/useTimeElapsed.js +51 -0
- package/build/esm/hooks/useTimeElapsed.js.map +1 -0
- package/build/esm/hooks/useTrackerSubscription.js +97 -0
- package/build/esm/hooks/useTrackerSubscription.js.map +1 -0
- package/build/esm/hooks/useUnusedFieldAnalysis.js +99 -0
- package/build/esm/hooks/useUnusedFieldAnalysis.js.map +1 -0
- package/build/esm/index.js +31 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/inspector/ClickToInspectSystem.js +228 -0
- package/build/esm/inspector/ClickToInspectSystem.js.map +1 -0
- package/build/esm/inspector/components/ComponentLabel.js +175 -0
- package/build/esm/inspector/components/ComponentLabel.js.map +1 -0
- package/build/esm/inspector/components/ComponentLabel.module.scss.js +12 -0
- package/build/esm/inspector/components/InspectorBanner.js +79 -0
- package/build/esm/inspector/components/InspectorBanner.js.map +1 -0
- package/build/esm/inspector/components/InspectorOverlay.js +149 -0
- package/build/esm/inspector/components/InspectorOverlay.js.map +1 -0
- package/build/esm/inspector/components/SelectionHighlight.js +74 -0
- package/build/esm/inspector/components/SelectionHighlight.js.map +1 -0
- package/build/esm/inspector/createClickToInspect.js +21 -0
- package/build/esm/inspector/createClickToInspect.js.map +1 -0
- package/build/esm/inspector/hooks/useAnimatedBounds.js +167 -0
- package/build/esm/inspector/hooks/useAnimatedBounds.js.map +1 -0
- package/build/esm/inspector/index.js +40 -0
- package/build/esm/inspector/index.js.map +1 -0
- package/build/esm/inspector/inspectorController.js +328 -0
- package/build/esm/inspector/inspectorController.js.map +1 -0
- package/build/esm/inspector/types.js +2 -0
- package/build/esm/inspector/types.js.map +1 -0
- package/build/esm/inspector/utils/elementBounds.js +72 -0
- package/build/esm/inspector/utils/elementBounds.js.map +1 -0
- package/build/esm/inspector/utils/interpolation.js +26 -0
- package/build/esm/inspector/utils/interpolation.js.map +1 -0
- package/build/esm/inspector/utils/labelPositioning.js +62 -0
- package/build/esm/inspector/utils/labelPositioning.js.map +1 -0
- package/build/esm/mocking/MockCacheKeyGenerator.js +109 -0
- package/build/esm/mocking/MockCacheKeyGenerator.js.map +1 -0
- package/build/esm/mocking/MockManager.js +281 -0
- package/build/esm/mocking/MockManager.js.map +1 -0
- package/build/esm/prototyping/PrototypeOverrideStore.js +66 -0
- package/build/esm/prototyping/PrototypeOverrideStore.js.map +1 -0
- package/build/esm/prototyping/index.js +18 -0
- package/build/esm/prototyping/index.js.map +1 -0
- package/build/esm/public/vite.js +19 -0
- package/build/esm/public/vite.js.map +1 -0
- package/build/esm/register.js +41 -0
- package/build/esm/register.js.map +1 -0
- package/build/esm/scss.d.ts +20 -0
- package/build/esm/store/ComputeStore.js +269 -0
- package/build/esm/store/ComputeStore.js.map +1 -0
- package/build/esm/store/ConsoleLogStore.js +289 -0
- package/build/esm/store/ConsoleLogStore.js.map +1 -0
- package/build/esm/store/MetricsStore.js +428 -0
- package/build/esm/store/MetricsStore.js.map +1 -0
- package/build/esm/store/MonitorStore.js +288 -0
- package/build/esm/store/MonitorStore.js.map +1 -0
- package/build/esm/store/SubscribableStore.js +38 -0
- package/build/esm/store/SubscribableStore.js.map +1 -0
- package/build/esm/store/WindowErrorStore.js +195 -0
- package/build/esm/store/WindowErrorStore.js.map +1 -0
- package/build/esm/styles.css +19441 -0
- package/build/esm/styles.js +31 -0
- package/build/esm/styles.js.map +1 -0
- package/build/esm/types/compute.js +2 -0
- package/build/esm/types/compute.js.map +1 -0
- package/build/esm/types/emissions.js +2 -0
- package/build/esm/types/emissions.js.map +1 -0
- package/build/esm/types/index.js +23 -0
- package/build/esm/types/index.js.map +1 -0
- package/build/esm/utils/ActionLifecycleTracker.js +178 -0
- package/build/esm/utils/ActionLifecycleTracker.js.map +1 -0
- package/build/esm/utils/CacheEfficiencyAnalyzer.js +198 -0
- package/build/esm/utils/CacheEfficiencyAnalyzer.js.map +1 -0
- package/build/esm/utils/CircularBuffer.js +96 -0
- package/build/esm/utils/CircularBuffer.js.map +1 -0
- package/build/esm/utils/ComponentContextCapture.js +215 -0
- package/build/esm/utils/ComponentContextCapture.js.map +1 -0
- package/build/esm/utils/ComponentPrimitiveDiscovery.js +173 -0
- package/build/esm/utils/ComponentPrimitiveDiscovery.js.map +1 -0
- package/build/esm/utils/ComponentQueryRegistry.js +340 -0
- package/build/esm/utils/ComponentQueryRegistry.js.map +1 -0
- package/build/esm/utils/ComputeMonitor.js +199 -0
- package/build/esm/utils/ComputeMonitor.js.map +1 -0
- package/build/esm/utils/EventTimeline.js +130 -0
- package/build/esm/utils/EventTimeline.js.map +1 -0
- package/build/esm/utils/LinkTraversalTracker.js +116 -0
- package/build/esm/utils/LinkTraversalTracker.js.map +1 -0
- package/build/esm/utils/MockDataGenerator.js +473 -0
- package/build/esm/utils/MockDataGenerator.js.map +1 -0
- package/build/esm/utils/ObservableClientMonitor.js +768 -0
- package/build/esm/utils/ObservableClientMonitor.js.map +1 -0
- package/build/esm/utils/PerformanceRecommendationEngine.js +185 -0
- package/build/esm/utils/PerformanceRecommendationEngine.js.map +1 -0
- package/build/esm/utils/PropertyAccessTracker.js +238 -0
- package/build/esm/utils/PropertyAccessTracker.js.map +1 -0
- package/build/esm/utils/RecommendationMatcher.js +53 -0
- package/build/esm/utils/RecommendationMatcher.js.map +1 -0
- package/build/esm/utils/SubscriptionTracker.js +132 -0
- package/build/esm/utils/SubscriptionTracker.js.map +1 -0
- package/build/esm/utils/UnusedFieldAnalyzer.js +186 -0
- package/build/esm/utils/UnusedFieldAnalyzer.js.map +1 -0
- package/build/esm/utils/WaterfallDetector.js +200 -0
- package/build/esm/utils/WaterfallDetector.js.map +1 -0
- package/build/esm/utils/computePayload.js +37 -0
- package/build/esm/utils/computePayload.js.map +1 -0
- package/build/esm/utils/computeRequest.js +29 -0
- package/build/esm/utils/computeRequest.js.map +1 -0
- package/build/esm/utils/format.js +69 -0
- package/build/esm/utils/format.js.map +1 -0
- package/build/esm/utils/logger.js +31 -0
- package/build/esm/utils/logger.js.map +1 -0
- package/build/esm/vite/constants.js +18 -0
- package/build/esm/vite/constants.js.map +1 -0
- package/build/esm/vite/hookInstaller.js +99 -0
- package/build/esm/vite/hookInstaller.js.map +1 -0
- package/build/esm/vite/index.js +77 -0
- package/build/esm/vite/index.js.map +1 -0
- package/build/types/DevToolsContext.d.ts +3 -0
- package/build/types/DevToolsContext.d.ts.map +1 -0
- package/build/types/components/ActionMetrics.d.ts +6 -0
- package/build/types/components/ActionMetrics.d.ts.map +1 -0
- package/build/types/components/BubbleChart.d.ts +10 -0
- package/build/types/components/BubbleChart.d.ts.map +1 -0
- package/build/types/components/CacheInspectorTab.d.ts +6 -0
- package/build/types/components/CacheInspectorTab.d.ts.map +1 -0
- package/build/types/components/CacheMetrics.d.ts +6 -0
- package/build/types/components/CacheMetrics.d.ts.map +1 -0
- package/build/types/components/ComponentCard.d.ts +13 -0
- package/build/types/components/ComponentCard.d.ts.map +1 -0
- package/build/types/components/ComputeTab.d.ts +6 -0
- package/build/types/components/ComputeTab.d.ts.map +1 -0
- package/build/types/components/CopyableCodeBlock.d.ts +7 -0
- package/build/types/components/CopyableCodeBlock.d.ts.map +1 -0
- package/build/types/components/DebuggingTab.d.ts +6 -0
- package/build/types/components/DebuggingTab.d.ts.map +1 -0
- package/build/types/components/HookRow.d.ts +9 -0
- package/build/types/components/HookRow.d.ts.map +1 -0
- package/build/types/components/ImprovementsTab.d.ts +7 -0
- package/build/types/components/ImprovementsTab.d.ts.map +1 -0
- package/build/types/components/InspectorSelectionHeader.d.ts +12 -0
- package/build/types/components/InspectorSelectionHeader.d.ts.map +1 -0
- package/build/types/components/InterceptTab.d.ts +126 -0
- package/build/types/components/InterceptTab.d.ts.map +1 -0
- package/build/types/components/IssueCard.d.ts +8 -0
- package/build/types/components/IssueCard.d.ts.map +1 -0
- package/build/types/components/LogEntryCard.d.ts +7 -0
- package/build/types/components/LogEntryCard.d.ts.map +1 -0
- package/build/types/components/MockEditor.d.ts +58 -0
- package/build/types/components/MockEditor.d.ts.map +1 -0
- package/build/types/components/MonitorErrorBoundary.d.ts +16 -0
- package/build/types/components/MonitorErrorBoundary.d.ts.map +1 -0
- package/build/types/components/MonitoringPanel.d.ts +8 -0
- package/build/types/components/MonitoringPanel.d.ts.map +1 -0
- package/build/types/components/ObjectLoadingMetrics.d.ts +7 -0
- package/build/types/components/ObjectLoadingMetrics.d.ts.map +1 -0
- package/build/types/components/OsdkAppErrorBoundary.d.ts +18 -0
- package/build/types/components/OsdkAppErrorBoundary.d.ts.map +1 -0
- package/build/types/components/OsdkDevTools.d.ts +2 -0
- package/build/types/components/OsdkDevTools.d.ts.map +1 -0
- package/build/types/components/OverrideEditor.d.ts +26 -0
- package/build/types/components/OverrideEditor.d.ts.map +1 -0
- package/build/types/components/PerformanceTab.d.ts +8 -0
- package/build/types/components/PerformanceTab.d.ts.map +1 -0
- package/build/types/components/PrimitiveSelectionPanel.d.ts +28 -0
- package/build/types/components/PrimitiveSelectionPanel.d.ts.map +1 -0
- package/build/types/components/issueTypes.d.ts +16 -0
- package/build/types/components/issueTypes.d.ts.map +1 -0
- package/build/types/components/resolveComponentName.d.ts +3 -0
- package/build/types/components/resolveComponentName.d.ts.map +1 -0
- package/build/types/components/testHelpers.d.ts +2 -0
- package/build/types/components/testHelpers.d.ts.map +1 -0
- package/build/types/css.d.d.ts +4 -0
- package/build/types/css.d.d.ts.map +1 -0
- package/build/types/fiber/DegradationNotice.d.ts +8 -0
- package/build/types/fiber/DegradationNotice.d.ts.map +1 -0
- package/build/types/fiber/DevtoolsHook.d.ts +7 -0
- package/build/types/fiber/DevtoolsHook.d.ts.map +1 -0
- package/build/types/fiber/FiberAccess.d.ts +2 -0
- package/build/types/fiber/FiberAccess.d.ts.map +1 -0
- package/build/types/fiber/FiberInspection.d.ts +6 -0
- package/build/types/fiber/FiberInspection.d.ts.map +1 -0
- package/build/types/fiber/FiberTags.d.ts +33 -0
- package/build/types/fiber/FiberTags.d.ts.map +1 -0
- package/build/types/fiber/HookStateInspector.d.ts +45 -0
- package/build/types/fiber/HookStateInspector.d.ts.map +1 -0
- package/build/types/fiber/SafeFiberOperation.d.ts +7 -0
- package/build/types/fiber/SafeFiberOperation.d.ts.map +1 -0
- package/build/types/fiber/capabilities.d.ts +38 -0
- package/build/types/fiber/capabilities.d.ts.map +1 -0
- package/build/types/fiber/traverseFiber.d.ts +5 -0
- package/build/types/fiber/traverseFiber.d.ts.map +1 -0
- package/build/types/fiber/types.d.ts +87 -0
- package/build/types/fiber/types.d.ts.map +1 -0
- package/build/types/fiber/validation.d.ts +10 -0
- package/build/types/fiber/validation.d.ts.map +1 -0
- package/build/types/hooks/createPollingStore.d.ts +5 -0
- package/build/types/hooks/createPollingStore.d.ts.map +1 -0
- package/build/types/hooks/useActiveComponents.d.ts +3 -0
- package/build/types/hooks/useActiveComponents.d.ts.map +1 -0
- package/build/types/hooks/useComponentRegistry.d.ts +3 -0
- package/build/types/hooks/useComponentRegistry.d.ts.map +1 -0
- package/build/types/hooks/useComputeSelectors.d.ts +7 -0
- package/build/types/hooks/useComputeSelectors.d.ts.map +1 -0
- package/build/types/hooks/useConsoleLogs.d.ts +7 -0
- package/build/types/hooks/useConsoleLogs.d.ts.map +1 -0
- package/build/types/hooks/useInspectorSelection.d.ts +9 -0
- package/build/types/hooks/useInspectorSelection.d.ts.map +1 -0
- package/build/types/hooks/useMetrics.d.ts +3 -0
- package/build/types/hooks/useMetrics.d.ts.map +1 -0
- package/build/types/hooks/usePersistedState.d.ts +1 -0
- package/build/types/hooks/usePersistedState.d.ts.map +1 -0
- package/build/types/hooks/useRecommendations.d.ts +10 -0
- package/build/types/hooks/useRecommendations.d.ts.map +1 -0
- package/build/types/hooks/useSharedTick.d.ts +1 -0
- package/build/types/hooks/useSharedTick.d.ts.map +1 -0
- package/build/types/hooks/useTimeElapsed.d.ts +1 -0
- package/build/types/hooks/useTimeElapsed.d.ts.map +1 -0
- package/build/types/hooks/useTrackerSubscription.d.ts +16 -0
- package/build/types/hooks/useTrackerSubscription.d.ts.map +1 -0
- package/build/types/hooks/useUnusedFieldAnalysis.d.ts +8 -0
- package/build/types/hooks/useUnusedFieldAnalysis.d.ts.map +1 -0
- package/build/types/index.d.ts +21 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/inspector/ClickToInspectSystem.d.ts +40 -0
- package/build/types/inspector/ClickToInspectSystem.d.ts.map +1 -0
- package/build/types/inspector/components/ComponentLabel.d.ts +3 -0
- package/build/types/inspector/components/ComponentLabel.d.ts.map +1 -0
- package/build/types/inspector/components/InspectorBanner.d.ts +5 -0
- package/build/types/inspector/components/InspectorBanner.d.ts.map +1 -0
- package/build/types/inspector/components/InspectorOverlay.d.ts +3 -0
- package/build/types/inspector/components/InspectorOverlay.d.ts.map +1 -0
- package/build/types/inspector/components/SelectionHighlight.d.ts +3 -0
- package/build/types/inspector/components/SelectionHighlight.d.ts.map +1 -0
- package/build/types/inspector/createClickToInspect.d.ts +3 -0
- package/build/types/inspector/createClickToInspect.d.ts.map +1 -0
- package/build/types/inspector/hooks/useAnimatedBounds.d.ts +2 -0
- package/build/types/inspector/hooks/useAnimatedBounds.d.ts.map +1 -0
- package/build/types/inspector/index.d.ts +13 -0
- package/build/types/inspector/index.d.ts.map +1 -0
- package/build/types/inspector/inspectorController.d.ts +2 -0
- package/build/types/inspector/inspectorController.d.ts.map +1 -0
- package/build/types/inspector/types.d.ts +94 -0
- package/build/types/inspector/types.d.ts.map +1 -0
- package/build/types/inspector/utils/elementBounds.d.ts +3 -0
- package/build/types/inspector/utils/elementBounds.d.ts.map +1 -0
- package/build/types/inspector/utils/interpolation.d.ts +7 -0
- package/build/types/inspector/utils/interpolation.d.ts.map +1 -0
- package/build/types/inspector/utils/labelPositioning.d.ts +3 -0
- package/build/types/inspector/utils/labelPositioning.d.ts.map +1 -0
- package/build/types/mocking/MockCacheKeyGenerator.d.ts +41 -0
- package/build/types/mocking/MockCacheKeyGenerator.d.ts.map +1 -0
- package/build/types/mocking/MockManager.d.ts +103 -0
- package/build/types/mocking/MockManager.d.ts.map +1 -0
- package/build/types/prototyping/PrototypeOverrideStore.d.ts +33 -0
- package/build/types/prototyping/PrototypeOverrideStore.d.ts.map +1 -0
- package/build/types/prototyping/index.d.ts +1 -0
- package/build/types/prototyping/index.d.ts.map +1 -0
- package/build/types/public/vite.d.ts +2 -0
- package/build/types/public/vite.d.ts.map +1 -0
- package/build/types/register.d.ts +1 -0
- package/build/types/register.d.ts.map +1 -0
- package/build/types/scss.d.d.ts +6 -0
- package/build/types/scss.d.d.ts.map +1 -0
- package/build/types/store/ComputeStore.d.ts +47 -0
- package/build/types/store/ComputeStore.d.ts.map +1 -0
- package/build/types/store/ConsoleLogStore.d.ts +29 -0
- package/build/types/store/ConsoleLogStore.d.ts.map +1 -0
- package/build/types/store/MetricsStore.d.ts +42 -0
- package/build/types/store/MetricsStore.d.ts.map +1 -0
- package/build/types/store/MonitorStore.d.ts +86 -0
- package/build/types/store/MonitorStore.d.ts.map +1 -0
- package/build/types/store/SubscribableStore.d.ts +6 -0
- package/build/types/store/SubscribableStore.d.ts.map +1 -0
- package/build/types/store/WindowErrorStore.d.ts +32 -0
- package/build/types/store/WindowErrorStore.d.ts.map +1 -0
- package/build/types/styles.d.ts +1 -0
- package/build/types/styles.d.ts.map +1 -0
- package/build/types/types/compute.d.ts +73 -0
- package/build/types/types/compute.d.ts.map +1 -0
- package/build/types/types/emissions.d.ts +24 -0
- package/build/types/types/emissions.d.ts.map +1 -0
- package/build/types/types/index.d.ts +143 -0
- package/build/types/types/index.d.ts.map +1 -0
- package/build/types/utils/ActionLifecycleTracker.d.ts +39 -0
- package/build/types/utils/ActionLifecycleTracker.d.ts.map +1 -0
- package/build/types/utils/CacheEfficiencyAnalyzer.d.ts +45 -0
- package/build/types/utils/CacheEfficiencyAnalyzer.d.ts.map +1 -0
- package/build/types/utils/CircularBuffer.d.ts +18 -0
- package/build/types/utils/CircularBuffer.d.ts.map +1 -0
- package/build/types/utils/ComponentContextCapture.d.ts +29 -0
- package/build/types/utils/ComponentContextCapture.d.ts.map +1 -0
- package/build/types/utils/ComponentPrimitiveDiscovery.d.ts +62 -0
- package/build/types/utils/ComponentPrimitiveDiscovery.d.ts.map +1 -0
- package/build/types/utils/ComponentQueryRegistry.d.ts +91 -0
- package/build/types/utils/ComponentQueryRegistry.d.ts.map +1 -0
- package/build/types/utils/ComputeMonitor.d.ts +14 -0
- package/build/types/utils/ComputeMonitor.d.ts.map +1 -0
- package/build/types/utils/EventTimeline.d.ts +102 -0
- package/build/types/utils/EventTimeline.d.ts.map +1 -0
- package/build/types/utils/LinkTraversalTracker.d.ts +43 -0
- package/build/types/utils/LinkTraversalTracker.d.ts.map +1 -0
- package/build/types/utils/MockDataGenerator.d.ts +23 -0
- package/build/types/utils/MockDataGenerator.d.ts.map +1 -0
- package/build/types/utils/ObservableClientMonitor.d.ts +62 -0
- package/build/types/utils/ObservableClientMonitor.d.ts.map +1 -0
- package/build/types/utils/PerformanceRecommendationEngine.d.ts +67 -0
- package/build/types/utils/PerformanceRecommendationEngine.d.ts.map +1 -0
- package/build/types/utils/PropertyAccessTracker.d.ts +50 -0
- package/build/types/utils/PropertyAccessTracker.d.ts.map +1 -0
- package/build/types/utils/RecommendationMatcher.d.ts +5 -0
- package/build/types/utils/RecommendationMatcher.d.ts.map +1 -0
- package/build/types/utils/SubscriptionTracker.d.ts +17 -0
- package/build/types/utils/SubscriptionTracker.d.ts.map +1 -0
- package/build/types/utils/UnusedFieldAnalyzer.d.ts +46 -0
- package/build/types/utils/UnusedFieldAnalyzer.d.ts.map +1 -0
- package/build/types/utils/WaterfallDetector.d.ts +28 -0
- package/build/types/utils/WaterfallDetector.d.ts.map +1 -0
- package/build/types/utils/computePayload.d.ts +3 -0
- package/build/types/utils/computePayload.d.ts.map +1 -0
- package/build/types/utils/computeRequest.d.ts +20 -0
- package/build/types/utils/computeRequest.d.ts.map +1 -0
- package/build/types/utils/format.d.ts +5 -0
- package/build/types/utils/format.d.ts.map +1 -0
- package/build/types/utils/logger.d.ts +2 -0
- package/build/types/utils/logger.d.ts.map +1 -0
- package/build/types/vite/constants.d.ts +1 -0
- package/build/types/vite/constants.d.ts.map +1 -0
- package/build/types/vite/hookInstaller.d.ts +1 -0
- package/build/types/vite/hookInstaller.d.ts.map +1 -0
- package/build/types/vite/index.d.ts +20 -0
- package/build/types/vite/index.d.ts.map +1 -0
- package/package.json +114 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const INTERNAL_FRAME_PATTERNS = [/node_modules/, /@osdk\/react/, /react-devtools/, /ComponentContextCapture/, /ObservableClientMonitor/, /ComponentQueryRegistry/, /packages\/react\/build/, /packages\/react\/esm/, /packages\/react\/src/];
|
|
18
|
+
const CHROME_STACK_RE = /\((.*?):(\d+):(\d+)\)/;
|
|
19
|
+
const FIREFOX_STACK_RE = /@(.*?):(\d+):(\d+)/;
|
|
20
|
+
function isInternalFrame(filePath) {
|
|
21
|
+
for (const pattern of INTERNAL_FRAME_PATTERNS) {
|
|
22
|
+
if (pattern.test(filePath)) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
export class ComponentQueryRegistry {
|
|
29
|
+
bindings = new Map();
|
|
30
|
+
componentToBindings = new Map();
|
|
31
|
+
queryToBindings = new Map();
|
|
32
|
+
subscriptionToBinding = new Map();
|
|
33
|
+
bindingIdCounter = 0;
|
|
34
|
+
changeVersion = 0;
|
|
35
|
+
changeListeners = new Set();
|
|
36
|
+
getVersion() {
|
|
37
|
+
return this.changeVersion;
|
|
38
|
+
}
|
|
39
|
+
subscribe(listener) {
|
|
40
|
+
this.changeListeners.add(listener);
|
|
41
|
+
return () => this.changeListeners.delete(listener);
|
|
42
|
+
}
|
|
43
|
+
notifyChange() {
|
|
44
|
+
this.changeVersion++;
|
|
45
|
+
for (const listener of this.changeListeners) {
|
|
46
|
+
listener();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
registerBinding(options) {
|
|
50
|
+
const existingBindings = this.componentToBindings.get(options.componentId);
|
|
51
|
+
if (existingBindings) {
|
|
52
|
+
for (const existingId of existingBindings) {
|
|
53
|
+
const existing = this.bindings.get(existingId);
|
|
54
|
+
if (existing && existing.hookType === options.hookType && existing.querySignature === options.querySignature && !existing.unmountedAt) {
|
|
55
|
+
return existingId;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const bindingId = `binding-${this.bindingIdCounter++}`;
|
|
60
|
+
const stack = new Error().stack || "";
|
|
61
|
+
const location = this.parseStackTrace(stack);
|
|
62
|
+
const binding = {
|
|
63
|
+
...options,
|
|
64
|
+
subscriptionId: options.subscriptionId || "",
|
|
65
|
+
stackTrace: stack,
|
|
66
|
+
filePath: location.file,
|
|
67
|
+
lineNumber: location.line,
|
|
68
|
+
columnNumber: location.column,
|
|
69
|
+
mountedAt: Date.now(),
|
|
70
|
+
renderCount: 0,
|
|
71
|
+
lastRenderDuration: 0,
|
|
72
|
+
avgRenderDuration: 0
|
|
73
|
+
};
|
|
74
|
+
this.bindings.set(bindingId, binding);
|
|
75
|
+
if (!this.componentToBindings.has(options.componentId)) {
|
|
76
|
+
this.componentToBindings.set(options.componentId, new Set());
|
|
77
|
+
}
|
|
78
|
+
const componentBindings = this.componentToBindings.get(options.componentId);
|
|
79
|
+
if (componentBindings) {
|
|
80
|
+
componentBindings.add(bindingId);
|
|
81
|
+
}
|
|
82
|
+
if (!this.queryToBindings.has(options.querySignature)) {
|
|
83
|
+
this.queryToBindings.set(options.querySignature, new Set());
|
|
84
|
+
}
|
|
85
|
+
const queryBindings = this.queryToBindings.get(options.querySignature);
|
|
86
|
+
if (queryBindings) {
|
|
87
|
+
queryBindings.add(bindingId);
|
|
88
|
+
}
|
|
89
|
+
if (options.subscriptionId) {
|
|
90
|
+
this.subscriptionToBinding.set(options.subscriptionId, bindingId);
|
|
91
|
+
}
|
|
92
|
+
this.notifyChange();
|
|
93
|
+
return bindingId;
|
|
94
|
+
}
|
|
95
|
+
linkSubscription(bindingId, subscriptionId) {
|
|
96
|
+
const binding = this.bindings.get(bindingId);
|
|
97
|
+
if (!binding) return;
|
|
98
|
+
binding.subscriptionId = subscriptionId;
|
|
99
|
+
this.subscriptionToBinding.set(subscriptionId, bindingId);
|
|
100
|
+
}
|
|
101
|
+
unregisterComponent(componentId) {
|
|
102
|
+
const bindingIds = this.componentToBindings.get(componentId);
|
|
103
|
+
if (!bindingIds) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const now = Date.now();
|
|
107
|
+
for (const bindingId of bindingIds) {
|
|
108
|
+
const binding = this.bindings.get(bindingId);
|
|
109
|
+
if (binding) {
|
|
110
|
+
binding.unmountedAt = now;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
this.notifyChange();
|
|
114
|
+
}
|
|
115
|
+
recordRender(componentId, duration) {
|
|
116
|
+
const bindingIds = this.componentToBindings.get(componentId);
|
|
117
|
+
if (!bindingIds) return;
|
|
118
|
+
for (const bindingId of bindingIds) {
|
|
119
|
+
const binding = this.bindings.get(bindingId);
|
|
120
|
+
if (binding && !binding.unmountedAt) {
|
|
121
|
+
binding.renderCount++;
|
|
122
|
+
binding.lastRenderDuration = duration;
|
|
123
|
+
binding.avgRenderDuration = (binding.avgRenderDuration * (binding.renderCount - 1) + duration) / binding.renderCount;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
getComponentBindings(componentId) {
|
|
128
|
+
const bindingIds = this.componentToBindings.get(componentId);
|
|
129
|
+
if (!bindingIds) return [];
|
|
130
|
+
return Array.from(bindingIds).map(id => this.bindings.get(id)).filter(b => b !== undefined);
|
|
131
|
+
}
|
|
132
|
+
getQuerySubscribers(querySignature) {
|
|
133
|
+
const bindingIds = this.queryToBindings.get(querySignature);
|
|
134
|
+
if (!bindingIds) return [];
|
|
135
|
+
return Array.from(bindingIds).map(id => this.bindings.get(id)).filter(b => b !== undefined).filter(b => !b.unmountedAt);
|
|
136
|
+
}
|
|
137
|
+
getBindingBySubscription(subscriptionId) {
|
|
138
|
+
const bindingId = this.subscriptionToBinding.get(subscriptionId);
|
|
139
|
+
return bindingId ? this.bindings.get(bindingId) : undefined;
|
|
140
|
+
}
|
|
141
|
+
getActiveComponents() {
|
|
142
|
+
const result = new Map();
|
|
143
|
+
for (const [componentId, bindingIds] of this.componentToBindings) {
|
|
144
|
+
const bindings = Array.from(bindingIds).map(id => this.bindings.get(id)).filter(b => b !== undefined && !b.unmountedAt);
|
|
145
|
+
if (bindings.length > 0) {
|
|
146
|
+
result.set(componentId, bindings);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
parseStackTrace(stack) {
|
|
152
|
+
const lines = stack.split("\n");
|
|
153
|
+
for (let i = 3; i < Math.min(lines.length, 25); i++) {
|
|
154
|
+
const line = lines[i];
|
|
155
|
+
const chromeMatch = line.match(CHROME_STACK_RE);
|
|
156
|
+
if (chromeMatch) {
|
|
157
|
+
const filePath = chromeMatch[1];
|
|
158
|
+
if (!isInternalFrame(filePath)) {
|
|
159
|
+
return {
|
|
160
|
+
file: filePath,
|
|
161
|
+
line: parseInt(chromeMatch[2], 10),
|
|
162
|
+
column: parseInt(chromeMatch[3], 10)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
const firefoxMatch = line.match(FIREFOX_STACK_RE);
|
|
168
|
+
if (firefoxMatch) {
|
|
169
|
+
const filePath = firefoxMatch[1];
|
|
170
|
+
if (!isInternalFrame(filePath)) {
|
|
171
|
+
return {
|
|
172
|
+
file: filePath,
|
|
173
|
+
line: parseInt(firefoxMatch[2], 10),
|
|
174
|
+
column: parseInt(firefoxMatch[3], 10)
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return {};
|
|
181
|
+
}
|
|
182
|
+
updateFromFiberDiscovery(discovered) {
|
|
183
|
+
const seenComponentIds = new Set();
|
|
184
|
+
for (const [componentId, component] of discovered) {
|
|
185
|
+
seenComponentIds.add(componentId);
|
|
186
|
+
const existingBindingIds = this.componentToBindings.get(componentId);
|
|
187
|
+
if (existingBindingIds && existingBindingIds.size > 0) {
|
|
188
|
+
for (const bindingId of existingBindingIds) {
|
|
189
|
+
const binding = this.bindings.get(bindingId);
|
|
190
|
+
if (binding && !binding.unmountedAt) {
|
|
191
|
+
binding.componentName = component.componentName;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
for (const hookMeta of component.hooks) {
|
|
196
|
+
const querySignature = this.buildQuerySignature(hookMeta);
|
|
197
|
+
const hookType = this.mapHookType(hookMeta.hookType);
|
|
198
|
+
const queryParams = this.buildQueryParams(hookMeta);
|
|
199
|
+
this.registerBinding({
|
|
200
|
+
componentId,
|
|
201
|
+
componentName: component.componentName,
|
|
202
|
+
hookType,
|
|
203
|
+
hookIndex: 0,
|
|
204
|
+
querySignature,
|
|
205
|
+
queryParams
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const now = Date.now();
|
|
211
|
+
for (const [componentId, bindingIds] of this.componentToBindings) {
|
|
212
|
+
if (!seenComponentIds.has(componentId)) {
|
|
213
|
+
for (const bindingId of bindingIds) {
|
|
214
|
+
const binding = this.bindings.get(bindingId);
|
|
215
|
+
if (binding && !binding.unmountedAt) {
|
|
216
|
+
binding.unmountedAt = now;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
buildQuerySignature(hookMeta) {
|
|
223
|
+
switch (hookMeta.hookType) {
|
|
224
|
+
case "useOsdkObject":
|
|
225
|
+
return `object:${hookMeta.objectType}:${hookMeta.primaryKey}`;
|
|
226
|
+
case "useOsdkObjects":
|
|
227
|
+
return `useOsdkObjects:${hookMeta.objectType}:${JSON.stringify(hookMeta.where)}:${JSON.stringify(hookMeta.orderBy)}`;
|
|
228
|
+
case "useOsdkAction":
|
|
229
|
+
return `action:${hookMeta.actionName}`;
|
|
230
|
+
case "useLinks":
|
|
231
|
+
return `links:${hookMeta.sourceObjectType || "unknown"}:${hookMeta.linkName || "unknown"}`;
|
|
232
|
+
case "useOsdkAggregation":
|
|
233
|
+
return `aggregation:${hookMeta.objectType}:${JSON.stringify(hookMeta.aggregate)}`;
|
|
234
|
+
default:
|
|
235
|
+
return `unknown:${JSON.stringify(hookMeta)}`;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
mapHookType(hookType) {
|
|
239
|
+
switch (hookType) {
|
|
240
|
+
case "useOsdkObject":
|
|
241
|
+
return "useOsdkObject";
|
|
242
|
+
case "useOsdkObjects":
|
|
243
|
+
return "useOsdkObjects";
|
|
244
|
+
case "useOsdkAction":
|
|
245
|
+
return "useOsdkAction";
|
|
246
|
+
case "useLinks":
|
|
247
|
+
return "useLinks";
|
|
248
|
+
case "useOsdkAggregation":
|
|
249
|
+
return "useOsdkAggregation";
|
|
250
|
+
default:
|
|
251
|
+
return "useOsdkObject";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
buildQueryParams(hookMeta) {
|
|
255
|
+
switch (hookMeta.hookType) {
|
|
256
|
+
case "useOsdkObject":
|
|
257
|
+
return {
|
|
258
|
+
type: "object",
|
|
259
|
+
objectType: hookMeta.objectType || "Unknown",
|
|
260
|
+
primaryKey: hookMeta.primaryKey || ""
|
|
261
|
+
};
|
|
262
|
+
case "useOsdkObjects":
|
|
263
|
+
return {
|
|
264
|
+
type: "list",
|
|
265
|
+
objectType: hookMeta.objectType || "Unknown",
|
|
266
|
+
where: hookMeta.where,
|
|
267
|
+
orderBy: hookMeta.orderBy,
|
|
268
|
+
pageSize: hookMeta.pageSize
|
|
269
|
+
};
|
|
270
|
+
case "useOsdkAction":
|
|
271
|
+
return {
|
|
272
|
+
type: "action",
|
|
273
|
+
actionName: hookMeta.actionName || "Unknown"
|
|
274
|
+
};
|
|
275
|
+
case "useLinks":
|
|
276
|
+
return {
|
|
277
|
+
type: "links",
|
|
278
|
+
sourceObject: hookMeta.sourceObjectType || "Unknown",
|
|
279
|
+
linkName: hookMeta.linkName || "Unknown"
|
|
280
|
+
};
|
|
281
|
+
case "useOsdkAggregation":
|
|
282
|
+
return {
|
|
283
|
+
type: "aggregation",
|
|
284
|
+
objectType: hookMeta.objectType || "Unknown",
|
|
285
|
+
where: hookMeta.where,
|
|
286
|
+
aggregate: hookMeta.aggregate
|
|
287
|
+
};
|
|
288
|
+
default:
|
|
289
|
+
return {
|
|
290
|
+
type: "object",
|
|
291
|
+
objectType: "Unknown",
|
|
292
|
+
primaryKey: ""
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
cleanupOldBindings(maxAgeMs = 5 * 60 * 1000) {
|
|
297
|
+
const now = Date.now();
|
|
298
|
+
let cleanedCount = 0;
|
|
299
|
+
for (const [bindingId, binding] of this.bindings.entries()) {
|
|
300
|
+
if (binding.unmountedAt && now - binding.unmountedAt > maxAgeMs) {
|
|
301
|
+
this.bindings.delete(bindingId);
|
|
302
|
+
this.componentToBindings.get(binding.componentId)?.delete(bindingId);
|
|
303
|
+
this.queryToBindings.get(binding.querySignature)?.delete(bindingId);
|
|
304
|
+
if (binding.subscriptionId) {
|
|
305
|
+
this.subscriptionToBinding.delete(binding.subscriptionId);
|
|
306
|
+
}
|
|
307
|
+
cleanedCount++;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return cleanedCount;
|
|
311
|
+
}
|
|
312
|
+
clear() {
|
|
313
|
+
this.bindings.clear();
|
|
314
|
+
this.componentToBindings.clear();
|
|
315
|
+
this.queryToBindings.clear();
|
|
316
|
+
this.subscriptionToBinding.clear();
|
|
317
|
+
}
|
|
318
|
+
getStats() {
|
|
319
|
+
let activeBindings = 0;
|
|
320
|
+
let unmountedBindings = 0;
|
|
321
|
+
for (const binding of this.bindings.values()) {
|
|
322
|
+
if (binding.unmountedAt) {
|
|
323
|
+
unmountedBindings++;
|
|
324
|
+
} else {
|
|
325
|
+
activeBindings++;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
totalBindings: this.bindings.size,
|
|
330
|
+
activeBindings,
|
|
331
|
+
unmountedBindings,
|
|
332
|
+
components: this.componentToBindings.size,
|
|
333
|
+
queries: this.queryToBindings.size
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
getAllBindings() {
|
|
337
|
+
return Array.from(this.bindings.values());
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=ComponentQueryRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentQueryRegistry.js","names":["INTERNAL_FRAME_PATTERNS","CHROME_STACK_RE","FIREFOX_STACK_RE","isInternalFrame","filePath","pattern","test","ComponentQueryRegistry","bindings","Map","componentToBindings","queryToBindings","subscriptionToBinding","bindingIdCounter","changeVersion","changeListeners","Set","getVersion","subscribe","listener","add","delete","notifyChange","registerBinding","options","existingBindings","get","componentId","existingId","existing","hookType","querySignature","unmountedAt","bindingId","stack","Error","location","parseStackTrace","binding","subscriptionId","stackTrace","file","lineNumber","line","columnNumber","column","mountedAt","Date","now","renderCount","lastRenderDuration","avgRenderDuration","set","has","componentBindings","queryBindings","linkSubscription","unregisterComponent","bindingIds","recordRender","duration","getComponentBindings","Array","from","map","id","filter","b","undefined","getQuerySubscribers","getBindingBySubscription","getActiveComponents","result","length","lines","split","i","Math","min","chromeMatch","match","parseInt","firefoxMatch","updateFromFiberDiscovery","discovered","seenComponentIds","component","existingBindingIds","size","componentName","hookMeta","hooks","buildQuerySignature","mapHookType","queryParams","buildQueryParams","hookIndex","objectType","primaryKey","JSON","stringify","where","orderBy","actionName","sourceObjectType","linkName","aggregate","type","pageSize","sourceObject","cleanupOldBindings","maxAgeMs","cleanedCount","entries","clear","getStats","activeBindings","unmountedBindings","values","totalBindings","components","queries","getAllBindings"],"sources":["ComponentQueryRegistry.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DiscoveredComponent } from \"../fiber/HookStateInspector.js\";\n\nexport interface ComponentHookBinding {\n componentId: string;\n componentName: string;\n componentDisplayName?: string;\n\n hookType:\n | \"useOsdkObject\"\n | \"useOsdkObjects\"\n | \"useOsdkAction\"\n | \"useOsdkAggregation\"\n | \"useLinks\"\n | \"useObjectSet\";\n hookIndex: number;\n\n subscriptionId: string;\n querySignature: string;\n queryParams: QueryParams;\n\n stackTrace: string;\n filePath?: string;\n lineNumber?: number;\n columnNumber?: number;\n mountedAt: number;\n unmountedAt?: number;\n renderCount: number;\n\n lastRenderDuration: number;\n avgRenderDuration: number;\n}\n\nexport type QueryParams =\n | { type: \"object\"; objectType: string; primaryKey: string }\n | {\n type: \"list\";\n objectType: string;\n where?: unknown;\n orderBy?: unknown;\n pageSize?: number;\n }\n | { type: \"action\"; actionName: string }\n | { type: \"links\"; sourceObject: string; linkName: string }\n | { type: \"objectSet\"; baseObjectSet: string; operations: unknown[] }\n | {\n type: \"aggregation\";\n objectType: string;\n where?: unknown;\n aggregate?: unknown;\n };\n\nconst INTERNAL_FRAME_PATTERNS = [\n /node_modules/,\n /@osdk\\/react/,\n /react-devtools/,\n /ComponentContextCapture/,\n /ObservableClientMonitor/,\n /ComponentQueryRegistry/,\n /packages\\/react\\/build/,\n /packages\\/react\\/esm/,\n /packages\\/react\\/src/,\n];\n\nconst CHROME_STACK_RE = /\\((.*?):(\\d+):(\\d+)\\)/;\nconst FIREFOX_STACK_RE = /@(.*?):(\\d+):(\\d+)/;\n\nfunction isInternalFrame(filePath: string): boolean {\n for (const pattern of INTERNAL_FRAME_PATTERNS) {\n if (pattern.test(filePath)) {\n return true;\n }\n }\n return false;\n}\n\nexport class ComponentQueryRegistry {\n private bindings = new Map<string, ComponentHookBinding>();\n private componentToBindings = new Map<string, Set<string>>();\n private queryToBindings = new Map<string, Set<string>>();\n private subscriptionToBinding = new Map<string, string>();\n\n private bindingIdCounter = 0;\n private changeVersion = 0;\n private changeListeners = new Set<() => void>();\n\n getVersion(): number {\n return this.changeVersion;\n }\n\n subscribe(listener: () => void): () => void {\n this.changeListeners.add(listener);\n return () => this.changeListeners.delete(listener);\n }\n\n private notifyChange(): void {\n this.changeVersion++;\n for (const listener of this.changeListeners) {\n listener();\n }\n }\n\n registerBinding(options: {\n componentId: string;\n componentName: string;\n componentDisplayName?: string;\n hookType: ComponentHookBinding[\"hookType\"];\n hookIndex: number;\n querySignature: string;\n queryParams: QueryParams;\n subscriptionId?: string;\n }): string {\n const existingBindings = this.componentToBindings.get(options.componentId);\n if (existingBindings) {\n for (const existingId of existingBindings) {\n const existing = this.bindings.get(existingId);\n if (\n existing\n && existing.hookType === options.hookType\n && existing.querySignature === options.querySignature\n && !existing.unmountedAt\n ) {\n return existingId;\n }\n }\n }\n\n const bindingId = `binding-${this.bindingIdCounter++}`;\n\n const stack = new Error().stack || \"\";\n const location = this.parseStackTrace(stack);\n\n const binding: ComponentHookBinding = {\n ...options,\n subscriptionId: options.subscriptionId || \"\",\n stackTrace: stack,\n filePath: location.file,\n lineNumber: location.line,\n columnNumber: location.column,\n mountedAt: Date.now(),\n renderCount: 0,\n lastRenderDuration: 0,\n avgRenderDuration: 0,\n };\n\n this.bindings.set(bindingId, binding);\n\n if (!this.componentToBindings.has(options.componentId)) {\n this.componentToBindings.set(options.componentId, new Set());\n }\n const componentBindings = this.componentToBindings.get(options.componentId);\n if (componentBindings) {\n componentBindings.add(bindingId);\n }\n\n if (!this.queryToBindings.has(options.querySignature)) {\n this.queryToBindings.set(options.querySignature, new Set());\n }\n const queryBindings = this.queryToBindings.get(options.querySignature);\n if (queryBindings) {\n queryBindings.add(bindingId);\n }\n\n if (options.subscriptionId) {\n this.subscriptionToBinding.set(options.subscriptionId, bindingId);\n }\n\n this.notifyChange();\n return bindingId;\n }\n\n linkSubscription(bindingId: string, subscriptionId: string): void {\n const binding = this.bindings.get(bindingId);\n if (!binding) return;\n\n binding.subscriptionId = subscriptionId;\n this.subscriptionToBinding.set(subscriptionId, bindingId);\n }\n\n unregisterComponent(componentId: string): void {\n const bindingIds = this.componentToBindings.get(componentId);\n if (!bindingIds) {\n return;\n }\n\n const now = Date.now();\n for (const bindingId of bindingIds) {\n const binding = this.bindings.get(bindingId);\n if (binding) {\n binding.unmountedAt = now;\n }\n }\n this.notifyChange();\n }\n\n recordRender(componentId: string, duration: number): void {\n const bindingIds = this.componentToBindings.get(componentId);\n if (!bindingIds) return;\n\n for (const bindingId of bindingIds) {\n const binding = this.bindings.get(bindingId);\n if (binding && !binding.unmountedAt) {\n binding.renderCount++;\n binding.lastRenderDuration = duration;\n binding.avgRenderDuration =\n (binding.avgRenderDuration * (binding.renderCount - 1) + duration)\n / binding.renderCount;\n }\n }\n }\n\n getComponentBindings(componentId: string): ComponentHookBinding[] {\n const bindingIds = this.componentToBindings.get(componentId);\n if (!bindingIds) return [];\n\n return Array.from(bindingIds)\n .map((id) => this.bindings.get(id))\n .filter((b): b is ComponentHookBinding => b !== undefined);\n }\n\n getQuerySubscribers(querySignature: string): ComponentHookBinding[] {\n const bindingIds = this.queryToBindings.get(querySignature);\n if (!bindingIds) return [];\n\n return Array.from(bindingIds)\n .map((id) => this.bindings.get(id))\n .filter((b): b is ComponentHookBinding => b !== undefined)\n .filter((b) => !b.unmountedAt);\n }\n\n getBindingBySubscription(\n subscriptionId: string,\n ): ComponentHookBinding | undefined {\n const bindingId = this.subscriptionToBinding.get(subscriptionId);\n return bindingId ? this.bindings.get(bindingId) : undefined;\n }\n\n getActiveComponents(): Map<string, ComponentHookBinding[]> {\n const result = new Map<string, ComponentHookBinding[]>();\n\n for (const [componentId, bindingIds] of this.componentToBindings) {\n const bindings = Array.from(bindingIds)\n .map((id) => this.bindings.get(id))\n .filter(\n (b): b is ComponentHookBinding => b !== undefined && !b.unmountedAt,\n );\n\n if (bindings.length > 0) {\n result.set(componentId, bindings);\n }\n }\n\n return result;\n }\n\n private parseStackTrace(\n stack: string,\n ): { file?: string; line?: number; column?: number } {\n const lines = stack.split(\"\\n\");\n\n for (let i = 3; i < Math.min(lines.length, 25); i++) {\n const line = lines[i];\n\n const chromeMatch = line.match(CHROME_STACK_RE);\n if (chromeMatch) {\n const filePath = chromeMatch[1];\n if (!isInternalFrame(filePath)) {\n return {\n file: filePath,\n line: parseInt(chromeMatch[2], 10),\n column: parseInt(chromeMatch[3], 10),\n };\n }\n continue;\n }\n\n const firefoxMatch = line.match(FIREFOX_STACK_RE);\n if (firefoxMatch) {\n const filePath = firefoxMatch[1];\n if (!isInternalFrame(filePath)) {\n return {\n file: filePath,\n line: parseInt(firefoxMatch[2], 10),\n column: parseInt(firefoxMatch[3], 10),\n };\n }\n continue;\n }\n }\n\n return {};\n }\n\n updateFromFiberDiscovery(\n discovered: Map<string, DiscoveredComponent>,\n ): void {\n const seenComponentIds = new Set<string>();\n\n for (const [componentId, component] of discovered) {\n seenComponentIds.add(componentId);\n\n const existingBindingIds = this.componentToBindings.get(componentId);\n\n if (existingBindingIds && existingBindingIds.size > 0) {\n for (const bindingId of existingBindingIds) {\n const binding = this.bindings.get(bindingId);\n if (binding && !binding.unmountedAt) {\n binding.componentName = component.componentName;\n }\n }\n } else {\n for (const hookMeta of component.hooks) {\n const querySignature = this.buildQuerySignature(hookMeta);\n const hookType = this.mapHookType(hookMeta.hookType);\n const queryParams = this.buildQueryParams(hookMeta);\n\n this.registerBinding({\n componentId,\n componentName: component.componentName,\n hookType,\n hookIndex: 0,\n querySignature,\n queryParams,\n });\n }\n }\n }\n\n const now = Date.now();\n for (const [componentId, bindingIds] of this.componentToBindings) {\n if (!seenComponentIds.has(componentId)) {\n for (const bindingId of bindingIds) {\n const binding = this.bindings.get(bindingId);\n if (binding && !binding.unmountedAt) {\n binding.unmountedAt = now;\n }\n }\n }\n }\n }\n\n private buildQuerySignature(\n hookMeta: DiscoveredComponent[\"hooks\"][0],\n ): string {\n switch (hookMeta.hookType) {\n case \"useOsdkObject\":\n return `object:${hookMeta.objectType}:${hookMeta.primaryKey}`;\n case \"useOsdkObjects\":\n return `useOsdkObjects:${hookMeta.objectType}:${\n JSON.stringify(hookMeta.where)\n }:${JSON.stringify(hookMeta.orderBy)}`;\n case \"useOsdkAction\":\n return `action:${hookMeta.actionName}`;\n case \"useLinks\":\n return `links:${hookMeta.sourceObjectType || \"unknown\"}:${\n hookMeta.linkName || \"unknown\"\n }`;\n case \"useOsdkAggregation\":\n return `aggregation:${hookMeta.objectType}:${\n JSON.stringify(hookMeta.aggregate)\n }`;\n default:\n return `unknown:${JSON.stringify(hookMeta)}`;\n }\n }\n\n private mapHookType(\n hookType: DiscoveredComponent[\"hooks\"][0][\"hookType\"],\n ): ComponentHookBinding[\"hookType\"] {\n switch (hookType) {\n case \"useOsdkObject\":\n return \"useOsdkObject\";\n case \"useOsdkObjects\":\n return \"useOsdkObjects\";\n case \"useOsdkAction\":\n return \"useOsdkAction\";\n case \"useLinks\":\n return \"useLinks\";\n case \"useOsdkAggregation\":\n return \"useOsdkAggregation\";\n default:\n return \"useOsdkObject\";\n }\n }\n\n private buildQueryParams(\n hookMeta: DiscoveredComponent[\"hooks\"][0],\n ): QueryParams {\n switch (hookMeta.hookType) {\n case \"useOsdkObject\":\n return {\n type: \"object\",\n objectType: hookMeta.objectType || \"Unknown\",\n primaryKey: hookMeta.primaryKey || \"\",\n };\n case \"useOsdkObjects\":\n return {\n type: \"list\",\n objectType: hookMeta.objectType || \"Unknown\",\n where: hookMeta.where,\n orderBy: hookMeta.orderBy,\n pageSize: hookMeta.pageSize,\n };\n case \"useOsdkAction\":\n return {\n type: \"action\",\n actionName: hookMeta.actionName || \"Unknown\",\n };\n case \"useLinks\":\n return {\n type: \"links\",\n sourceObject: hookMeta.sourceObjectType || \"Unknown\",\n linkName: hookMeta.linkName || \"Unknown\",\n };\n case \"useOsdkAggregation\":\n return {\n type: \"aggregation\",\n objectType: hookMeta.objectType || \"Unknown\",\n where: hookMeta.where,\n aggregate: hookMeta.aggregate,\n };\n default:\n return {\n type: \"object\",\n objectType: \"Unknown\",\n primaryKey: \"\",\n };\n }\n }\n\n cleanupOldBindings(maxAgeMs: number = 5 * 60 * 1000): number {\n const now = Date.now();\n let cleanedCount = 0;\n\n for (const [bindingId, binding] of this.bindings.entries()) {\n if (\n binding.unmountedAt\n && now - binding.unmountedAt > maxAgeMs\n ) {\n this.bindings.delete(bindingId);\n\n this.componentToBindings.get(binding.componentId)?.delete(bindingId);\n this.queryToBindings.get(binding.querySignature)?.delete(bindingId);\n if (binding.subscriptionId) {\n this.subscriptionToBinding.delete(binding.subscriptionId);\n }\n\n cleanedCount++;\n }\n }\n\n return cleanedCount;\n }\n\n clear(): void {\n this.bindings.clear();\n this.componentToBindings.clear();\n this.queryToBindings.clear();\n this.subscriptionToBinding.clear();\n }\n\n getStats(): {\n totalBindings: number;\n activeBindings: number;\n unmountedBindings: number;\n components: number;\n queries: number;\n } {\n let activeBindings = 0;\n let unmountedBindings = 0;\n\n for (const binding of this.bindings.values()) {\n if (binding.unmountedAt) {\n unmountedBindings++;\n } else {\n activeBindings++;\n }\n }\n\n return {\n totalBindings: this.bindings.size,\n activeBindings,\n unmountedBindings,\n components: this.componentToBindings.size,\n queries: this.queryToBindings.size,\n };\n }\n\n getAllBindings(): ComponentHookBinding[] {\n return Array.from(this.bindings.values());\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqDA,MAAMA,uBAAuB,GAAG,CAC9B,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,CACvB;AAED,MAAMC,eAAe,GAAG,uBAAuB;AAC/C,MAAMC,gBAAgB,GAAG,oBAAoB;AAE7C,SAASC,eAAeA,CAACC,QAAgB,EAAW;EAClD,KAAK,MAAMC,OAAO,IAAIL,uBAAuB,EAAE;IAC7C,IAAIK,OAAO,CAACC,IAAI,CAACF,QAAQ,CAAC,EAAE;MAC1B,OAAO,IAAI;IACb;EACF;EACA,OAAO,KAAK;AACd;AAEA,OAAO,MAAMG,sBAAsB,CAAC;EAC1BC,QAAQ,GAAG,IAAIC,GAAG,CAA+B,CAAC;EAClDC,mBAAmB,GAAG,IAAID,GAAG,CAAsB,CAAC;EACpDE,eAAe,GAAG,IAAIF,GAAG,CAAsB,CAAC;EAChDG,qBAAqB,GAAG,IAAIH,GAAG,CAAiB,CAAC;EAEjDI,gBAAgB,GAAG,CAAC;EACpBC,aAAa,GAAG,CAAC;EACjBC,eAAe,GAAG,IAAIC,GAAG,CAAa,CAAC;EAE/CC,UAAUA,CAAA,EAAW;IACnB,OAAO,IAAI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CAAC;IAC5B,IAAI,CAACtG,qBAAqB,CAACsG,KAAK,CAAC,CAAC;EACpC;EAEAC,QAAQA,CAAA,EAMN;IACA,IAAIC,cAAc,GAAG,CAAC;IACtB,IAAIC,iBAAiB,GAAG,CAAC;IAEzB,KAAK,MAAM/E,OAAO,IAAI,IAAI,CAAC9B,QAAQ,CAAC8G,MAAM,CAAC,CAAC,EAAE;MAC5C,IAAIhF,OAAO,CAACN,WAAW,EAAE;QACvBqF,iBAAiB,EAAE;MACrB,CAAC,MAAM;QACLD,cAAc,EAAE;MAClB;IACF;IAEA,OAAO;MACLG,aAAa,EAAE,IAAI,CAAC/G,QAAQ,CAACgF,IAAI;MACjC4B,cAAc;MACdC,iBAAiB;MACjBG,UAAU,EAAE,IAAI,CAAC9G,mBAAmB,CAAC8E,IAAI;MACzCiC,OAAO,EAAE,IAAI,CAAC9G,eAAe,CAAC6E;IAChC,CAAC;EACH;EAEAkC,cAAcA,CAAA,EAA2B;IACvC,OAAO5D,KAAK,CAACC,IAAI,CAAC,IAAI,CAACvD,QAAQ,CAAC8G,MAAM,CAAC,CAAC,CAAC;EAC3C;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { hashPayload, stringifyPayload, truncatePayload } from "./computePayload.js";
|
|
18
|
+
import { createMonitorLogger } from "./logger.js";
|
|
19
|
+
const RID_PLACEHOLDER = "ri.compute.tools.rid.placeholder";
|
|
20
|
+
const COMPUTE_COST_ENDPOINTS = [`/api/v2/ontologies/${RID_PLACEHOLDER}/objectSets/loadObjects`, `/api/v2/ontologies/${RID_PLACEHOLDER}/objectSets/aggregate`, `/api/v2/ontologies/${RID_PLACEHOLDER}/objectSets/loadObjectsMultipleObjectTypes`];
|
|
21
|
+
const OSDK_URL_PREFIXES = ["/api/v2/ontologies/", "/multipass/", "/ontology-metadata/", "/object-set-watcher/", "/object-set-service/"];
|
|
22
|
+
function isOsdkUrl(pathname) {
|
|
23
|
+
return OSDK_URL_PREFIXES.some(prefix => pathname.startsWith(prefix));
|
|
24
|
+
}
|
|
25
|
+
const RID_REGEX = /ri\.([a-z][a-z0-9-]*)\.([a-z0-9][a-z0-9-]*)?\.([a-z][a-z0-9-]*)\.([a-zA-Z0-9\-._]+)/;
|
|
26
|
+
export class ComputeMonitor {
|
|
27
|
+
interceptedFetch = null;
|
|
28
|
+
constructor(computeStore, logger = createMonitorLogger(), originalFetch = globalThis.fetch, eventTimeline) {
|
|
29
|
+
this.computeStore = computeStore;
|
|
30
|
+
this.logger = logger;
|
|
31
|
+
this.eventTimeline = eventTimeline;
|
|
32
|
+
this.originalFetch = originalFetch.bind(globalThis);
|
|
33
|
+
}
|
|
34
|
+
createInterceptedFetch() {
|
|
35
|
+
if (this.interceptedFetch) {
|
|
36
|
+
return this.interceptedFetch;
|
|
37
|
+
}
|
|
38
|
+
this.logger.debug("Creating fetch interceptor");
|
|
39
|
+
const self = this;
|
|
40
|
+
this.interceptedFetch = async (input, init) => {
|
|
41
|
+
const pathname = self.extractPathnameFromRequest(input);
|
|
42
|
+
const isRecording = self.computeStore.isRecording();
|
|
43
|
+
const shouldTrack = self.doesEndpointTrackComputeCost(pathname);
|
|
44
|
+
const isPaused = self.computeStore.getIsNetworkPaused();
|
|
45
|
+
const isOsdk = isOsdkUrl(pathname);
|
|
46
|
+
self.logger.debug("Fetch intercepted:", {
|
|
47
|
+
pathname,
|
|
48
|
+
isRecording,
|
|
49
|
+
shouldTrack,
|
|
50
|
+
isPaused,
|
|
51
|
+
isOsdk,
|
|
52
|
+
hasBody: init?.body !== undefined,
|
|
53
|
+
bodyType: typeof init?.body
|
|
54
|
+
});
|
|
55
|
+
if (isPaused && isOsdk) {
|
|
56
|
+
self.logger.debug("Network paused, blocking OSDK request");
|
|
57
|
+
self.eventTimeline?.record({
|
|
58
|
+
type: "OSDK_PAUSE_BLOCK",
|
|
59
|
+
pathname,
|
|
60
|
+
timestamp: Date.now()
|
|
61
|
+
});
|
|
62
|
+
if (shouldTrack && isRecording && typeof init?.body === "string") {
|
|
63
|
+
let parsed;
|
|
64
|
+
try {
|
|
65
|
+
parsed = JSON.parse(init.body);
|
|
66
|
+
} catch {
|
|
67
|
+
parsed = undefined;
|
|
68
|
+
}
|
|
69
|
+
if (parsed !== undefined) {
|
|
70
|
+
const requestId = self.computeStore.createPendingRequest({
|
|
71
|
+
requestUrl: pathname,
|
|
72
|
+
requestTimestamp: new Date(),
|
|
73
|
+
requestPayload: truncatePayload(init.body),
|
|
74
|
+
requestPayloadHash: hashPayload(parsed)
|
|
75
|
+
});
|
|
76
|
+
self.computeStore.failRequest(requestId, {
|
|
77
|
+
type: "osdk-network-paused"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
throw new Error("OSDK network requests are paused by OSDK ComputeTools");
|
|
82
|
+
}
|
|
83
|
+
if (!shouldTrack || !isRecording || typeof init?.body !== "string") {
|
|
84
|
+
self.logger.debug("Skipping tracking:", {
|
|
85
|
+
reason: !shouldTrack ? "endpoint not tracked" : !isRecording ? "not recording" : "body not string"
|
|
86
|
+
});
|
|
87
|
+
return self.originalFetch(input, init);
|
|
88
|
+
}
|
|
89
|
+
self.logger.debug("Tracking request for:", pathname);
|
|
90
|
+
let json;
|
|
91
|
+
try {
|
|
92
|
+
json = JSON.parse(init.body);
|
|
93
|
+
} catch (e) {
|
|
94
|
+
self.logger.debug("Failed to parse request body", e);
|
|
95
|
+
return self.originalFetch(input, init);
|
|
96
|
+
}
|
|
97
|
+
const newBody = stringifyPayload({
|
|
98
|
+
...json,
|
|
99
|
+
includeComputeUsage: true
|
|
100
|
+
});
|
|
101
|
+
const requestId = self.computeStore.createPendingRequest({
|
|
102
|
+
requestUrl: pathname,
|
|
103
|
+
requestTimestamp: new Date(),
|
|
104
|
+
requestPayload: truncatePayload(newBody),
|
|
105
|
+
requestPayloadHash: hashPayload(json)
|
|
106
|
+
});
|
|
107
|
+
self.logger.debug("Created pending request:", requestId);
|
|
108
|
+
try {
|
|
109
|
+
const res = await self.originalFetch(input, {
|
|
110
|
+
...init,
|
|
111
|
+
body: newBody
|
|
112
|
+
});
|
|
113
|
+
const clonedRes = res.clone();
|
|
114
|
+
const arrayBuffer = await clonedRes.arrayBuffer();
|
|
115
|
+
let jsonRes;
|
|
116
|
+
try {
|
|
117
|
+
const text = new TextDecoder().decode(arrayBuffer);
|
|
118
|
+
jsonRes = JSON.parse(text);
|
|
119
|
+
} catch (parseError) {
|
|
120
|
+
self.logger.warn("Failed to parse response as JSON:", parseError);
|
|
121
|
+
self.computeStore.failRequest(requestId, {
|
|
122
|
+
type: "fetch-error",
|
|
123
|
+
message: "Failed to parse response JSON"
|
|
124
|
+
});
|
|
125
|
+
return res;
|
|
126
|
+
}
|
|
127
|
+
const computeUsage = jsonRes.computeUsage;
|
|
128
|
+
self.logger.debug("Response received:", {
|
|
129
|
+
status: res.status,
|
|
130
|
+
computeUsage,
|
|
131
|
+
hasComputeUsage: typeof computeUsage === "number"
|
|
132
|
+
});
|
|
133
|
+
if (typeof computeUsage === "number") {
|
|
134
|
+
self.logger.debug("Fulfilling request with compute usage:", computeUsage);
|
|
135
|
+
self.computeStore.fulfillRequest(requestId, {
|
|
136
|
+
computeUsage,
|
|
137
|
+
responsePayloadBytes: arrayBuffer.byteLength,
|
|
138
|
+
responsePayloadHash: hashPayload(jsonRes),
|
|
139
|
+
responsePayload: truncatePayload(stringifyPayload(jsonRes))
|
|
140
|
+
});
|
|
141
|
+
} else if (res.status === 200) {
|
|
142
|
+
self.logger.warn("Request succeeded but no computeUsage in response");
|
|
143
|
+
self.computeStore.fulfillWithoutUsage(requestId, {
|
|
144
|
+
responsePayloadBytes: arrayBuffer.byteLength,
|
|
145
|
+
responsePayloadHash: hashPayload(jsonRes),
|
|
146
|
+
responsePayload: truncatePayload(stringifyPayload(jsonRes))
|
|
147
|
+
});
|
|
148
|
+
} else if (typeof jsonRes.errorCode === "string" && typeof jsonRes.errorInstanceId === "string" && typeof jsonRes.errorName === "string") {
|
|
149
|
+
self.computeStore.failRequest(requestId, {
|
|
150
|
+
type: "api-gateway-error",
|
|
151
|
+
status: res.status,
|
|
152
|
+
errorCode: jsonRes.errorCode,
|
|
153
|
+
errorInstanceId: jsonRes.errorInstanceId,
|
|
154
|
+
errorName: jsonRes.errorName
|
|
155
|
+
});
|
|
156
|
+
} else {
|
|
157
|
+
self.computeStore.failRequest(requestId, {
|
|
158
|
+
type: "http-error",
|
|
159
|
+
status: res.status,
|
|
160
|
+
message: res.statusText.trim() === "" ? undefined : res.statusText
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return res;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
self.logger.error("Fetch error:", error);
|
|
166
|
+
self.computeStore.failRequest(requestId, error instanceof Error ? {
|
|
167
|
+
type: "fetch-error",
|
|
168
|
+
message: error.message
|
|
169
|
+
} : {
|
|
170
|
+
type: "unknown"
|
|
171
|
+
});
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
return this.interceptedFetch;
|
|
176
|
+
}
|
|
177
|
+
extractPathnameFromRequest(request) {
|
|
178
|
+
if (request instanceof URL) {
|
|
179
|
+
return request.pathname;
|
|
180
|
+
}
|
|
181
|
+
if (typeof request === "string") {
|
|
182
|
+
try {
|
|
183
|
+
return new URL(request).pathname;
|
|
184
|
+
} catch {
|
|
185
|
+
return request;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
return new URL(request.url).pathname;
|
|
190
|
+
} catch {
|
|
191
|
+
return request.url;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
doesEndpointTrackComputeCost(pathname) {
|
|
195
|
+
const normalized = pathname.replace(RID_REGEX, RID_PLACEHOLDER);
|
|
196
|
+
return COMPUTE_COST_ENDPOINTS.includes(normalized);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=ComputeMonitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComputeMonitor.js","names":["hashPayload","stringifyPayload","truncatePayload","createMonitorLogger","RID_PLACEHOLDER","COMPUTE_COST_ENDPOINTS","OSDK_URL_PREFIXES","isOsdkUrl","pathname","some","prefix","startsWith","RID_REGEX","ComputeMonitor","interceptedFetch","constructor","computeStore","logger","originalFetch","globalThis","fetch","eventTimeline","bind","createInterceptedFetch","debug","self","input","init","extractPathnameFromRequest","isRecording","shouldTrack","doesEndpointTrackComputeCost","isPaused","getIsNetworkPaused","isOsdk","hasBody","body","undefined","bodyType","record","type","timestamp","Date","now","parsed","JSON","parse","requestId","createPendingRequest","requestUrl","requestTimestamp","requestPayload","requestPayloadHash","failRequest","Error","reason","json","e","newBody","includeComputeUsage","res","clonedRes","clone","arrayBuffer","jsonRes","text","TextDecoder","decode","parseError","warn","message","computeUsage","status","hasComputeUsage","fulfillRequest","responsePayloadBytes","byteLength","responsePayloadHash","responsePayload","fulfillWithoutUsage","errorCode","errorInstanceId","errorName","statusText","trim","error","request","URL","url","normalized","replace","includes"],"sources":["ComputeMonitor.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport type { ComputeStore } from \"../store/ComputeStore.js\";\nimport {\n hashPayload,\n stringifyPayload,\n truncatePayload,\n} from \"./computePayload.js\";\nimport type { EventTimeline } from \"./EventTimeline.js\";\nimport { createMonitorLogger } from \"./logger.js\";\n\nconst RID_PLACEHOLDER = \"ri.compute.tools.rid.placeholder\";\nconst COMPUTE_COST_ENDPOINTS = [\n `/api/v2/ontologies/${RID_PLACEHOLDER}/objectSets/loadObjects`,\n `/api/v2/ontologies/${RID_PLACEHOLDER}/objectSets/aggregate`,\n `/api/v2/ontologies/${RID_PLACEHOLDER}/objectSets/loadObjectsMultipleObjectTypes`,\n];\n\nconst OSDK_URL_PREFIXES = [\n \"/api/v2/ontologies/\",\n \"/multipass/\",\n \"/ontology-metadata/\",\n \"/object-set-watcher/\",\n \"/object-set-service/\",\n];\n\nfunction isOsdkUrl(pathname: string): boolean {\n return OSDK_URL_PREFIXES.some((prefix) => pathname.startsWith(prefix));\n}\n\nconst RID_REGEX =\n /ri\\.([a-z][a-z0-9-]*)\\.([a-z0-9][a-z0-9-]*)?\\.([a-z][a-z0-9-]*)\\.([a-zA-Z0-9\\-._]+)/;\n\nexport class ComputeMonitor {\n private readonly originalFetch: typeof globalThis.fetch;\n private readonly computeStore: ComputeStore;\n private readonly logger: Logger;\n private readonly eventTimeline: EventTimeline | undefined;\n private interceptedFetch: typeof globalThis.fetch | null = null;\n\n constructor(\n computeStore: ComputeStore,\n logger: Logger = createMonitorLogger(),\n originalFetch: typeof globalThis.fetch = globalThis.fetch,\n eventTimeline?: EventTimeline,\n ) {\n this.computeStore = computeStore;\n this.logger = logger;\n this.eventTimeline = eventTimeline;\n this.originalFetch = originalFetch.bind(globalThis);\n }\n\n createInterceptedFetch(): typeof globalThis.fetch {\n if (this.interceptedFetch) {\n return this.interceptedFetch;\n }\n\n this.logger.debug(\"Creating fetch interceptor\");\n const self = this;\n\n this.interceptedFetch = async (\n input: RequestInfo | URL,\n init?: RequestInit,\n ): Promise<Response> => {\n const pathname = self.extractPathnameFromRequest(input);\n\n const isRecording = self.computeStore.isRecording();\n const shouldTrack = self.doesEndpointTrackComputeCost(pathname);\n const isPaused = self.computeStore.getIsNetworkPaused();\n const isOsdk = isOsdkUrl(pathname);\n\n self.logger.debug(\"Fetch intercepted:\", {\n pathname,\n isRecording,\n shouldTrack,\n isPaused,\n isOsdk,\n hasBody: init?.body !== undefined,\n bodyType: typeof init?.body,\n });\n\n if (isPaused && isOsdk) {\n self.logger.debug(\"Network paused, blocking OSDK request\");\n self.eventTimeline?.record({\n type: \"OSDK_PAUSE_BLOCK\",\n pathname,\n timestamp: Date.now(),\n });\n if (shouldTrack && isRecording && typeof init?.body === \"string\") {\n let parsed: unknown;\n try {\n parsed = JSON.parse(init.body);\n } catch {\n parsed = undefined;\n }\n if (parsed !== undefined) {\n const requestId = self.computeStore.createPendingRequest({\n requestUrl: pathname,\n requestTimestamp: new Date(),\n requestPayload: truncatePayload(init.body),\n requestPayloadHash: hashPayload(parsed),\n });\n self.computeStore.failRequest(requestId, {\n type: \"osdk-network-paused\",\n });\n }\n }\n throw new Error(\n \"OSDK network requests are paused by OSDK ComputeTools\",\n );\n }\n\n if (!shouldTrack || !isRecording || typeof init?.body !== \"string\") {\n self.logger.debug(\"Skipping tracking:\", {\n reason: !shouldTrack\n ? \"endpoint not tracked\"\n : !isRecording\n ? \"not recording\"\n : \"body not string\",\n });\n return self.originalFetch(input, init);\n }\n\n self.logger.debug(\"Tracking request for:\", pathname);\n\n let json;\n try {\n json = JSON.parse(init.body);\n } catch (e) {\n self.logger.debug(\"Failed to parse request body\", e);\n return self.originalFetch(input, init);\n }\n\n const newBody = stringifyPayload({ ...json, includeComputeUsage: true });\n\n const requestId = self.computeStore.createPendingRequest({\n requestUrl: pathname,\n requestTimestamp: new Date(),\n requestPayload: truncatePayload(newBody),\n requestPayloadHash: hashPayload(json),\n });\n\n self.logger.debug(\"Created pending request:\", requestId);\n\n try {\n const res = await self.originalFetch(input, { ...init, body: newBody });\n\n const clonedRes = res.clone();\n const arrayBuffer = await clonedRes.arrayBuffer();\n\n let jsonRes;\n try {\n const text = new TextDecoder().decode(arrayBuffer);\n jsonRes = JSON.parse(text);\n } catch (parseError) {\n self.logger.warn(\"Failed to parse response as JSON:\", parseError);\n self.computeStore.failRequest(requestId, {\n type: \"fetch-error\",\n message: \"Failed to parse response JSON\",\n });\n return res;\n }\n\n const computeUsage = jsonRes.computeUsage;\n\n self.logger.debug(\"Response received:\", {\n status: res.status,\n computeUsage,\n hasComputeUsage: typeof computeUsage === \"number\",\n });\n\n if (typeof computeUsage === \"number\") {\n self.logger.debug(\n \"Fulfilling request with compute usage:\",\n computeUsage,\n );\n self.computeStore.fulfillRequest(requestId, {\n computeUsage,\n responsePayloadBytes: arrayBuffer.byteLength,\n responsePayloadHash: hashPayload(jsonRes),\n responsePayload: truncatePayload(stringifyPayload(jsonRes)),\n });\n } else if (res.status === 200) {\n self.logger.warn(\n \"Request succeeded but no computeUsage in response\",\n );\n self.computeStore.fulfillWithoutUsage(requestId, {\n responsePayloadBytes: arrayBuffer.byteLength,\n responsePayloadHash: hashPayload(jsonRes),\n responsePayload: truncatePayload(stringifyPayload(jsonRes)),\n });\n } else if (\n typeof jsonRes.errorCode === \"string\"\n && typeof jsonRes.errorInstanceId === \"string\"\n && typeof jsonRes.errorName === \"string\"\n ) {\n self.computeStore.failRequest(requestId, {\n type: \"api-gateway-error\",\n status: res.status,\n errorCode: jsonRes.errorCode,\n errorInstanceId: jsonRes.errorInstanceId,\n errorName: jsonRes.errorName,\n });\n } else {\n self.computeStore.failRequest(requestId, {\n type: \"http-error\",\n status: res.status,\n message: res.statusText.trim() === \"\" ? undefined : res.statusText,\n });\n }\n\n return res;\n } catch (error) {\n self.logger.error(\"Fetch error:\", error);\n self.computeStore.failRequest(\n requestId,\n error instanceof Error\n ? {\n type: \"fetch-error\",\n message: error.message,\n }\n : { type: \"unknown\" },\n );\n throw error;\n }\n };\n\n return this.interceptedFetch;\n }\n\n private extractPathnameFromRequest(request: RequestInfo | URL): string {\n if (request instanceof URL) {\n return request.pathname;\n }\n\n if (typeof request === \"string\") {\n try {\n return new URL(request).pathname;\n } catch {\n return request;\n }\n }\n\n try {\n return new URL(request.url).pathname;\n } catch {\n return request.url;\n }\n }\n\n private doesEndpointTrackComputeCost(pathname: string): boolean {\n const normalized = pathname.replace(RID_REGEX, RID_PLACEHOLDER);\n return COMPUTE_COST_ENDPOINTS.includes(normalized);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SACEA,WAAW,EACXC,gBAAgB,EAChBC,eAAe,QACV,qBAAqB;AAE5B,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,MAAMC,eAAe,GAAG,kCAAkC;AAC1D,MAAMC,sBAAsB,GAAG,CAC7B,sBAAsBD,eAAe,yBAAyB,EAC9D,sBAAsBA,eAAe,uBAAuB,EAC5D,sBAAsBA,eAAe,4CAA4C,CAClF;AAED,MAAME,iBAAiB,GAAG,CACxB,qBAAqB,EACrB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,CACvB;AAED,SAASC,SAASA,CAACC,QAAgB,EAAW;EAC5C,OAAOF,iBAAiB,CAACG,IAAI,CAAEC,MAAM,IAAKF,QAAQ,CAACG,UAAU,CAACD,MAAM,CAAC,CAAC;AACxE;AAEA,MAAME,SAAS,GACb,qFAAqF;AAEvF,OAAO,MAAMC,cAAc,CAAC;EAKlBC,gBAAgB,GAAmC,IAAI;EAE/DC,WAAWA,CACTC,YAA0B,EAC1BC,M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