@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,200 @@
|
|
|
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
|
+
export class WaterfallDetector {
|
|
18
|
+
constructor(registry, timeline) {
|
|
19
|
+
this.registry = registry;
|
|
20
|
+
this.timeline = timeline;
|
|
21
|
+
}
|
|
22
|
+
detectWaterfalls(timingThresholdMs = 50) {
|
|
23
|
+
const waterfalls = [];
|
|
24
|
+
waterfalls.push(...this.detectLinkWaterfalls(timingThresholdMs));
|
|
25
|
+
waterfalls.push(...this.detectMapWaterfalls());
|
|
26
|
+
waterfalls.push(...this.detectSequentialPatterns(timingThresholdMs));
|
|
27
|
+
return waterfalls.sort((a, b) => b.timeSaved - a.timeSaved);
|
|
28
|
+
}
|
|
29
|
+
detectLinkWaterfalls(timingThresholdMs) {
|
|
30
|
+
const waterfalls = [];
|
|
31
|
+
const emissions = this.timeline.getEventsByType("EMISSION");
|
|
32
|
+
const linkTraversals = this.timeline.getEventsByType("LINK_TRAVERSAL");
|
|
33
|
+
for (let i = 0; i < emissions.length - 1; i++) {
|
|
34
|
+
const emissionA = emissions[i];
|
|
35
|
+
const emissionB = emissions[i + 1];
|
|
36
|
+
const timeBetween = emissionB.timestamp - emissionA.timestamp;
|
|
37
|
+
if (timeBetween > 0 && timeBetween < timingThresholdMs) {
|
|
38
|
+
const linkInWindow = linkTraversals.find(link => link.timestamp > emissionA.timestamp && link.timestamp < emissionB.timestamp);
|
|
39
|
+
if (linkInWindow) {
|
|
40
|
+
const estimatedFetchTime = emissionB.timestamp - emissionA.timestamp;
|
|
41
|
+
waterfalls.push({
|
|
42
|
+
type: "LINK_WATERFALL",
|
|
43
|
+
priority: estimatedFetchTime > 200 ? "high" : "medium",
|
|
44
|
+
timeSaved: estimatedFetchTime,
|
|
45
|
+
suggestion: `Prefetch the "${linkInWindow.linkName}" relationship to run queries in parallel`,
|
|
46
|
+
code: this.generateLinkWaterfallCode(emissionA.subscriptionId, emissionB.subscriptionId, linkInWindow.linkName),
|
|
47
|
+
details: {
|
|
48
|
+
parentQuery: emissionA.subscriptionId,
|
|
49
|
+
childQuery: emissionB.subscriptionId
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return waterfalls;
|
|
56
|
+
}
|
|
57
|
+
detectMapWaterfalls() {
|
|
58
|
+
const waterfalls = [];
|
|
59
|
+
const components = this.registry.getActiveComponents();
|
|
60
|
+
for (const [componentId, bindings] of components) {
|
|
61
|
+
const objectQueries = bindings.filter(b => b.hookType === "useOsdkObject");
|
|
62
|
+
const grouped = new Map();
|
|
63
|
+
for (const query of objectQueries) {
|
|
64
|
+
if (query.queryParams.type === "object") {
|
|
65
|
+
const key = query.queryParams.objectType;
|
|
66
|
+
if (!grouped.has(key)) {
|
|
67
|
+
grouped.set(key, []);
|
|
68
|
+
}
|
|
69
|
+
const group = grouped.get(key);
|
|
70
|
+
if (group) {
|
|
71
|
+
group.push(query);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
for (const [objectType, queries] of grouped) {
|
|
76
|
+
if (queries.length > 3) {
|
|
77
|
+
const bindings = this.registry.getComponentBindings(componentId);
|
|
78
|
+
const binding = bindings.length > 0 ? bindings[0] : undefined;
|
|
79
|
+
waterfalls.push({
|
|
80
|
+
type: "MAP_WATERFALL",
|
|
81
|
+
priority: queries.length > 10 ? "high" : "medium",
|
|
82
|
+
timeSaved: queries.length * 100,
|
|
83
|
+
// Rough estimate
|
|
84
|
+
suggestion: `Replace ${queries.length} useOsdkObject calls with single useOsdkObjects batch query`,
|
|
85
|
+
code: this.generateMapWaterfallCode(objectType, queries.length),
|
|
86
|
+
details: {
|
|
87
|
+
component: binding ? binding.componentName : undefined,
|
|
88
|
+
count: queries.length,
|
|
89
|
+
objectType
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return waterfalls;
|
|
96
|
+
}
|
|
97
|
+
detectSequentialPatterns(timingThresholdMs) {
|
|
98
|
+
const waterfalls = [];
|
|
99
|
+
const emissions = this.timeline.getEventsByType("EMISSION");
|
|
100
|
+
let sequenceLength = 1;
|
|
101
|
+
let totalTime = 0;
|
|
102
|
+
for (let i = 1; i < emissions.length; i++) {
|
|
103
|
+
const timeBetween = emissions[i].timestamp - emissions[i - 1].timestamp;
|
|
104
|
+
if (timeBetween < timingThresholdMs) {
|
|
105
|
+
sequenceLength++;
|
|
106
|
+
totalTime += timeBetween;
|
|
107
|
+
} else {
|
|
108
|
+
if (sequenceLength > 3 && totalTime > 300) {
|
|
109
|
+
waterfalls.push({
|
|
110
|
+
type: "SEQUENTIAL_WATERFALL",
|
|
111
|
+
priority: totalTime > 500 ? "high" : "medium",
|
|
112
|
+
timeSaved: totalTime,
|
|
113
|
+
suggestion: "Consider parallelizing these queries or prefetching data",
|
|
114
|
+
code: "// Analyze the queries in this sequence and look for prefetching opportunities",
|
|
115
|
+
details: {}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
sequenceLength = 1;
|
|
119
|
+
totalTime = 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return waterfalls;
|
|
123
|
+
}
|
|
124
|
+
generateLinkWaterfallCode(parentQuery, childQuery, linkName) {
|
|
125
|
+
return `
|
|
126
|
+
// ⚠️ WATERFALL DETECTED
|
|
127
|
+
// ${parentQuery} loads → triggers ${childQuery} (linked via "${linkName}")
|
|
128
|
+
|
|
129
|
+
// Problem: Sequential loading adds latency
|
|
130
|
+
// Timeline:
|
|
131
|
+
// ━━━━ Parent query (t0-t200ms)
|
|
132
|
+
// ↓ gap
|
|
133
|
+
// ━━━━ Child/link query (t210-t260ms)
|
|
134
|
+
// Total: 260ms
|
|
135
|
+
|
|
136
|
+
// This is a known sequential pattern with useOsdkObject + useLinks.
|
|
137
|
+
// The link query cannot start until the parent object is loaded.
|
|
138
|
+
|
|
139
|
+
// Current pattern:
|
|
140
|
+
const { object: parent } = useOsdkObject(ParentType, id);
|
|
141
|
+
const { links } = useLinks(parent, "${linkName}");
|
|
142
|
+
|
|
143
|
+
// Option 1: If you have the linked IDs available upfront, load in parallel:
|
|
144
|
+
const [parentResult, childResult] = await Promise.all([
|
|
145
|
+
useOsdkObject(ParentType, parentId),
|
|
146
|
+
useOsdkObjects(ChildType, { where: { id: { $in: knownChildIds } } }),
|
|
147
|
+
]);
|
|
148
|
+
|
|
149
|
+
// Option 2: If data permits, restructure to load the parent object
|
|
150
|
+
// at a higher level so the link query starts sooner.
|
|
151
|
+
`.trim();
|
|
152
|
+
}
|
|
153
|
+
generateMapWaterfallCode(objectType, count) {
|
|
154
|
+
return `
|
|
155
|
+
// ⚠️ MAP WATERFALL DETECTED (N+1 Pattern)
|
|
156
|
+
// ${count} useOsdkObject calls for ${objectType} - each triggers separate fetch!
|
|
157
|
+
|
|
158
|
+
// Problem: Loads ${count} items sequentially instead of one batch request
|
|
159
|
+
// Timeline (Example):
|
|
160
|
+
// ━━ Item 1 (t0-t100ms)
|
|
161
|
+
// ━━ Item 2 (t100-t200ms)
|
|
162
|
+
// ━━ Item 3 (t200-t300ms)
|
|
163
|
+
// Total: 300ms for 3 items
|
|
164
|
+
|
|
165
|
+
// Solution: Use useOsdkObjects for batch loading
|
|
166
|
+
|
|
167
|
+
// Before (❌ N+1 pattern):
|
|
168
|
+
{items.map(item => (
|
|
169
|
+
<Item key={item.id} itemId={item.id} />
|
|
170
|
+
))}
|
|
171
|
+
|
|
172
|
+
// In Item component:
|
|
173
|
+
function Item({ itemId }) {
|
|
174
|
+
const { object } = useOsdkObject(${objectType}, itemId); // ❌ Runs ${count} times!
|
|
175
|
+
return <div>{object.name}</div>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// After (✅ Batch query):
|
|
179
|
+
function ItemList({ items }) {
|
|
180
|
+
const itemIds = items.map(item => item.id);
|
|
181
|
+
const { data } = useOsdkObjects(${objectType}, {
|
|
182
|
+
where: { id: { $in: itemIds } } // ✅ Single query!
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
return items.map(item => (
|
|
186
|
+
<Item key={item.id} data={data} />
|
|
187
|
+
));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function Item({ data }) {
|
|
191
|
+
// Just receive data as prop - no query needed!
|
|
192
|
+
return <div>{data.name}</div>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Result: 1 batch request instead of ${count} individual requests
|
|
196
|
+
// Time saved: ~${(count - 1) * 100}ms
|
|
197
|
+
`.trim();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=WaterfallDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WaterfallDetector.js","names":["WaterfallDetector","constructor","registry","timeline","detectWaterfalls","timingThresholdMs","waterfalls","push","detectLinkWaterfalls","detectMapWaterfalls","detectSequentialPatterns","sort","a","b","timeSaved","emissions","getEventsByType","linkTraversals","i","length","emissionA","emissionB","timeBetween","timestamp","linkInWindow","find","link","estimatedFetchTime","type","priority","suggestion","linkName","code","generateLinkWaterfallCode","subscriptionId","details","parentQuery","childQuery","components","getActiveComponents","componentId","bindings","objectQueries","filter","hookType","grouped","Map","query","queryParams","key","objectType","has","set","group","get","queries","getComponentBindings","binding","undefined","generateMapWaterfallCode","component","componentName","count","sequenceLength","totalTime","trim"],"sources":["WaterfallDetector.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 {\n ComponentHookBinding,\n ComponentQueryRegistry,\n} from \"./ComponentQueryRegistry.js\";\nimport type { EventTimeline } from \"./EventTimeline.js\";\n\nexport type WaterfallType =\n | \"LINK_WATERFALL\"\n | \"MAP_WATERFALL\"\n | \"SEQUENTIAL_WATERFALL\";\n\nexport interface Waterfall {\n type: WaterfallType;\n priority: \"high\" | \"medium\" | \"low\";\n timeSaved: number; // ms that could be saved\n suggestion: string;\n code: string;\n details: {\n parentQuery?: string;\n childQuery?: string;\n component?: string;\n count?: number;\n objectType?: string;\n };\n}\n\nexport class WaterfallDetector {\n constructor(\n private registry: ComponentQueryRegistry,\n private timeline: EventTimeline,\n ) {}\n\n detectWaterfalls(timingThresholdMs: number = 50): Waterfall[] {\n const waterfalls: Waterfall[] = [];\n\n waterfalls.push(...this.detectLinkWaterfalls(timingThresholdMs));\n waterfalls.push(...this.detectMapWaterfalls());\n waterfalls.push(...this.detectSequentialPatterns(timingThresholdMs));\n\n return waterfalls.sort((a, b) => b.timeSaved - a.timeSaved);\n }\n\n private detectLinkWaterfalls(timingThresholdMs: number): Waterfall[] {\n const waterfalls: Waterfall[] = [];\n\n const emissions = this.timeline.getEventsByType(\"EMISSION\");\n const linkTraversals = this.timeline.getEventsByType(\"LINK_TRAVERSAL\");\n\n for (let i = 0; i < emissions.length - 1; i++) {\n const emissionA = emissions[i];\n const emissionB = emissions[i + 1];\n\n const timeBetween = emissionB.timestamp - emissionA.timestamp;\n if (timeBetween > 0 && timeBetween < timingThresholdMs) {\n const linkInWindow = linkTraversals.find(link =>\n link.timestamp > emissionA.timestamp\n && link.timestamp < emissionB.timestamp\n );\n\n if (linkInWindow) {\n const estimatedFetchTime = emissionB.timestamp - emissionA.timestamp;\n\n waterfalls.push({\n type: \"LINK_WATERFALL\",\n priority: estimatedFetchTime > 200 ? \"high\" : \"medium\",\n timeSaved: estimatedFetchTime,\n suggestion:\n `Prefetch the \"${linkInWindow.linkName}\" relationship to run queries in parallel`,\n code: this.generateLinkWaterfallCode(\n emissionA.subscriptionId,\n emissionB.subscriptionId,\n linkInWindow.linkName,\n ),\n details: {\n parentQuery: emissionA.subscriptionId,\n childQuery: emissionB.subscriptionId,\n },\n });\n }\n }\n }\n\n return waterfalls;\n }\n\n private detectMapWaterfalls(): Waterfall[] {\n const waterfalls: Waterfall[] = [];\n const components = this.registry.getActiveComponents();\n\n for (const [componentId, bindings] of components) {\n const objectQueries = bindings.filter(b =>\n b.hookType === \"useOsdkObject\"\n );\n const grouped = new Map<string, ComponentHookBinding[]>();\n\n for (const query of objectQueries) {\n if (query.queryParams.type === \"object\") {\n const key = query.queryParams.objectType;\n if (!grouped.has(key)) {\n grouped.set(key, []);\n }\n const group = grouped.get(key);\n if (group) {\n group.push(query);\n }\n }\n }\n\n for (const [objectType, queries] of grouped) {\n if (queries.length > 3) {\n const bindings = this.registry.getComponentBindings(componentId);\n const binding = bindings.length > 0 ? bindings[0] : undefined;\n\n waterfalls.push({\n type: \"MAP_WATERFALL\",\n priority: queries.length > 10 ? \"high\" : \"medium\",\n timeSaved: queries.length * 100, // Rough estimate\n suggestion:\n `Replace ${queries.length} useOsdkObject calls with single useOsdkObjects batch query`,\n code: this.generateMapWaterfallCode(objectType, queries.length),\n details: {\n component: binding ? binding.componentName : undefined,\n count: queries.length,\n objectType,\n },\n });\n }\n }\n }\n\n return waterfalls;\n }\n\n private detectSequentialPatterns(timingThresholdMs: number): Waterfall[] {\n const waterfalls: Waterfall[] = [];\n const emissions = this.timeline.getEventsByType(\"EMISSION\");\n\n let sequenceStart = 0;\n let sequenceLength = 1;\n let totalTime = 0;\n\n for (let i = 1; i < emissions.length; i++) {\n const timeBetween = emissions[i].timestamp - emissions[i - 1].timestamp;\n\n if (timeBetween < timingThresholdMs) {\n sequenceLength++;\n totalTime += timeBetween;\n } else {\n if (sequenceLength > 3 && totalTime > 300) {\n waterfalls.push({\n type: \"SEQUENTIAL_WATERFALL\",\n priority: totalTime > 500 ? \"high\" : \"medium\",\n timeSaved: totalTime,\n suggestion:\n \"Consider parallelizing these queries or prefetching data\",\n code:\n \"// Analyze the queries in this sequence and look for prefetching opportunities\",\n details: {},\n });\n }\n\n sequenceStart = i;\n sequenceLength = 1;\n totalTime = 0;\n }\n }\n\n return waterfalls;\n }\n\n private generateLinkWaterfallCode(\n parentQuery: string,\n childQuery: string,\n linkName: string,\n ): string {\n return `\n// ⚠️ WATERFALL DETECTED\n// ${parentQuery} loads → triggers ${childQuery} (linked via \"${linkName}\")\n\n// Problem: Sequential loading adds latency\n// Timeline:\n// ━━━━ Parent query (t0-t200ms)\n// ↓ gap\n// ━━━━ Child/link query (t210-t260ms)\n// Total: 260ms\n\n// This is a known sequential pattern with useOsdkObject + useLinks.\n// The link query cannot start until the parent object is loaded.\n\n// Current pattern:\nconst { object: parent } = useOsdkObject(ParentType, id);\nconst { links } = useLinks(parent, \"${linkName}\");\n\n// Option 1: If you have the linked IDs available upfront, load in parallel:\nconst [parentResult, childResult] = await Promise.all([\n useOsdkObject(ParentType, parentId),\n useOsdkObjects(ChildType, { where: { id: { $in: knownChildIds } } }),\n]);\n\n// Option 2: If data permits, restructure to load the parent object\n// at a higher level so the link query starts sooner.\n `.trim();\n }\n\n private generateMapWaterfallCode(objectType: string, count: number): string {\n return `\n// ⚠️ MAP WATERFALL DETECTED (N+1 Pattern)\n// ${count} useOsdkObject calls for ${objectType} - each triggers separate fetch!\n\n// Problem: Loads ${count} items sequentially instead of one batch request\n// Timeline (Example):\n// ━━ Item 1 (t0-t100ms)\n// ━━ Item 2 (t100-t200ms)\n// ━━ Item 3 (t200-t300ms)\n// Total: 300ms for 3 items\n\n// Solution: Use useOsdkObjects for batch loading\n\n// Before (❌ N+1 pattern):\n{items.map(item => (\n <Item key={item.id} itemId={item.id} />\n))}\n\n// In Item component:\nfunction Item({ itemId }) {\n const { object } = useOsdkObject(${objectType}, itemId); // ❌ Runs ${count} times!\n return <div>{object.name}</div>;\n}\n\n// After (✅ Batch query):\nfunction ItemList({ items }) {\n const itemIds = items.map(item => item.id);\n const { data } = useOsdkObjects(${objectType}, {\n where: { id: { $in: itemIds } } // ✅ Single query!\n });\n\n return items.map(item => (\n <Item key={item.id} data={data} />\n ));\n}\n\nfunction Item({ data }) {\n // Just receive data as prop - no query needed!\n return <div>{data.name}</div>;\n}\n\n// Result: 1 batch request instead of ${count} individual requests\n// Time saved: ~${(count - 1) * 100}ms\n `.trim();\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4BA,OAAO,MAAMA,iBAAiB,CAAC;EAC7BC,WAAWA,CACDC,QAAgC,EAChCC,QAAuB,EAC/B;IAAA,KAFQD,QAAgC,GAAhCA,QAAgC;IAAA,KAChCC,QAAuB,GAAvBA,QAAuB;EAC9B;EAEHC,gBAAgBA,CAACC,iBAAyB,GAAG,EAAE,EAAe;IAC5D,MAAMC,UAAuB,GAAG,EAAE;IAElCA,UAAU,CAACC,IAAI,CAAC,GAAG,IAAI,CAACC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ACA;AACA;AACA,wCAAwCY,KAAK;AAC7C,kBAAkB,CAACA,KAAK,GAAG,CAAC,IAAI,GAAG;AACnC,KAAK,CAACG,IAAI,CAAC,CAAC;EACV;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 MAX_PAYLOAD_LENGTH = 10000;
|
|
18
|
+
export function stringifyPayload(payload) {
|
|
19
|
+
return JSON.stringify(payload);
|
|
20
|
+
}
|
|
21
|
+
export function truncatePayload(payload) {
|
|
22
|
+
if (payload.length <= MAX_PAYLOAD_LENGTH) {
|
|
23
|
+
return payload;
|
|
24
|
+
}
|
|
25
|
+
return payload.substring(0, MAX_PAYLOAD_LENGTH) + "...";
|
|
26
|
+
}
|
|
27
|
+
export function hashPayload(payload) {
|
|
28
|
+
const str = stringifyPayload(payload);
|
|
29
|
+
let hash = 0;
|
|
30
|
+
for (let i = 0; i < str.length; i++) {
|
|
31
|
+
const char = str.charCodeAt(i);
|
|
32
|
+
hash = (hash << 5) - hash + char;
|
|
33
|
+
hash = hash & hash;
|
|
34
|
+
}
|
|
35
|
+
return hash;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=computePayload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computePayload.js","names":["MAX_PAYLOAD_LENGTH","stringifyPayload","payload","JSON","stringify","truncatePayload","length","substring","hashPayload","str","hash","i","char","charCodeAt"],"sources":["computePayload.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\nconst MAX_PAYLOAD_LENGTH = 10000;\n\nexport function stringifyPayload(payload: unknown): string {\n return JSON.stringify(payload);\n}\n\nexport function truncatePayload(payload: string): string {\n if (payload.length <= MAX_PAYLOAD_LENGTH) {\n return payload;\n }\n return payload.substring(0, MAX_PAYLOAD_LENGTH) + \"...\";\n}\n\nexport function hashPayload(payload: unknown): number {\n const str = stringifyPayload(payload);\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash;\n }\n return hash;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,kBAAkB,GAAG,KAAK;AAEhC,OAAO,SAASC,gBAAgBA,CAACC,OAAgB,EAAU;EACzD,OAAOC,IAAI,CAACC,SAAS,CAACF,OAAO,CAAC;AAChC;AAEA,OAAO,SAASG,eAAeA,CAACH,OAAe,EAAU;EACvD,IAAIA,OAAO,CAACI,MAAM,IAAIN,kBAAkB,EAAE;IACxC,OAAOE,OAAO;EAChB;EACA,OAAOA,OAAO,CAACK,SAAS,CAAC,CAAC,EAAEP,kBAAkB,CAAC,GAAG,KAAK;AACzD;AAEA,OAAO,SAASQ,WAAWA,CAACN,OAAgB,EAAU;EACpD,MAAMO,GAAG,GAAGR,gBAAgB,CAACC,OAAO,CAAC;EACrC,IAAIQ,IAAI,GAAG,CAAC;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,GAAG,CAACH,MAAM,EAAEK,CAAC,EAAE,EAAE;IACnC,MAAMC,IAAI,GAAGH,GAAG,CAACI,UAAU,CAACF,CAAC,CAAC;IAC9BD,IAAI,GAAG,CAACA,IAAI,IAAI,CAAC,IAAIA,IAAI,GAAGE,IAAI;IAChCF,IAAI,GAAGA,IAAI,GAAGA,IAAI;EACpB;EACA,OAAOA,IAAI;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
export const visitComputeRequest = (request, visitor) => {
|
|
18
|
+
if (request.type === "pending") {
|
|
19
|
+
return visitor.pending(request);
|
|
20
|
+
}
|
|
21
|
+
if (request.type === "failed") {
|
|
22
|
+
return visitor.failed(request);
|
|
23
|
+
}
|
|
24
|
+
if (request.type === "fulfilled-without-usage") {
|
|
25
|
+
return visitor.fulfilledWithoutUsage(request);
|
|
26
|
+
}
|
|
27
|
+
return visitor.fulfilled(request);
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=computeRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeRequest.js","names":["visitComputeRequest","request","visitor","type","pending","failed","fulfilledWithoutUsage","fulfilled"],"sources":["computeRequest.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 { ComputeRequest } from \"../types/compute.js\";\n\ntype FulfilledComputeRequest = Extract<\n ComputeRequest,\n { type: \"fulfilled\" }\n>;\ntype FulfilledWithoutUsageComputeRequest = Extract<\n ComputeRequest,\n { type: \"fulfilled-without-usage\" }\n>;\ntype PendingComputeRequest = Extract<\n ComputeRequest,\n { type: \"pending\" }\n>;\ntype FailedComputeRequest = Extract<ComputeRequest, { type: \"failed\" }>;\n\nexport const visitComputeRequest = <T>(\n request: ComputeRequest,\n visitor: {\n pending: (request: PendingComputeRequest) => T;\n failed: (request: FailedComputeRequest) => T;\n fulfilled: (request: FulfilledComputeRequest) => T;\n fulfilledWithoutUsage: (request: FulfilledWithoutUsageComputeRequest) => T;\n },\n): T => {\n if (request.type === \"pending\") {\n return visitor.pending(request);\n }\n\n if (request.type === \"failed\") {\n return visitor.failed(request);\n }\n\n if (request.type === \"fulfilled-without-usage\") {\n return visitor.fulfilledWithoutUsage(request);\n }\n\n return visitor.fulfilled(request);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,OAAO,MAAMA,mBAAmB,GAAGA,CACjCC,OAAuB,EACvBC,OAKC,KACK;EACN,IAAID,OAAO,CAACE,IAAI,KAAK,SAAS,EAAE;IAC9B,OAAOD,OAAO,CAACE,OAAO,CAACH,OAAO,CAAC;EACjC;EAEA,IAAIA,OAAO,CAACE,IAAI,KAAK,QAAQ,EAAE;IAC7B,OAAOD,OAAO,CAACG,MAAM,CAACJ,OAAO,CAAC;EAChC;EAEA,IAAIA,OAAO,CAACE,IAAI,KAAK,yBAAyB,EAAE;IAC9C,OAAOD,OAAO,CAACI,qBAAqB,CAACL,OAAO,CAAC;EAC/C;EAEA,OAAOC,OAAO,CAACK,SAAS,CAACN,OAAO,CAAC;AACnC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
export function formatTime(ms) {
|
|
18
|
+
if (ms < 1) {
|
|
19
|
+
return "<1ms";
|
|
20
|
+
}
|
|
21
|
+
if (ms < 1000) {
|
|
22
|
+
return `${ms.toFixed(0)}ms`;
|
|
23
|
+
}
|
|
24
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
25
|
+
}
|
|
26
|
+
export function formatNumber(num) {
|
|
27
|
+
if (num >= 1000000) {
|
|
28
|
+
return `${(num / 1000000).toFixed(1)}M`;
|
|
29
|
+
}
|
|
30
|
+
if (num >= 1000) {
|
|
31
|
+
return `${(num / 1000).toFixed(1)}K`;
|
|
32
|
+
}
|
|
33
|
+
return num.toFixed(0);
|
|
34
|
+
}
|
|
35
|
+
export function formatBytes(bytes) {
|
|
36
|
+
if (bytes < 1024) {
|
|
37
|
+
return `${bytes}B`;
|
|
38
|
+
}
|
|
39
|
+
if (bytes < 1024 * 1024) {
|
|
40
|
+
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
41
|
+
}
|
|
42
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
43
|
+
}
|
|
44
|
+
export function formatRelativeTime(timestamp) {
|
|
45
|
+
const diff = Date.now() - timestamp;
|
|
46
|
+
if (diff < 1000) {
|
|
47
|
+
return "just now";
|
|
48
|
+
}
|
|
49
|
+
if (diff < 60000) {
|
|
50
|
+
return `${Math.floor(diff / 1000)}s ago`;
|
|
51
|
+
}
|
|
52
|
+
if (diff < 3600000) {
|
|
53
|
+
return `${Math.floor(diff / 60000)}m ago`;
|
|
54
|
+
}
|
|
55
|
+
return `${Math.floor(diff / 3600000)}h ago`;
|
|
56
|
+
}
|
|
57
|
+
export const formatMilliseconds = (value, includeSpace) => {
|
|
58
|
+
const space = includeSpace ? " " : "";
|
|
59
|
+
if (value < 1000) {
|
|
60
|
+
return `${value}${space}ms`;
|
|
61
|
+
}
|
|
62
|
+
if (value < 60 * 1000) {
|
|
63
|
+
const seconds = value / 1000;
|
|
64
|
+
return seconds % 1 === 0 ? `${seconds}${space}s` : `${seconds.toFixed(1)}${space}s`;
|
|
65
|
+
}
|
|
66
|
+
const minutes = value / 60_000;
|
|
67
|
+
return minutes % 1 === 0 ? `${minutes}${space}m` : `${minutes.toFixed(1)}${space}m`;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","names":["formatTime","ms","toFixed","formatNumber","num","formatBytes","bytes","formatRelativeTime","timestamp","diff","Date","now","Math","floor","formatMilliseconds","value","includeSpace","space","seconds","minutes"],"sources":["format.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\nexport function formatTime(ms: number): string {\n if (ms < 1) {\n return \"<1ms\";\n }\n if (ms < 1000) {\n return `${ms.toFixed(0)}ms`;\n }\n return `${(ms / 1000).toFixed(1)}s`;\n}\n\nexport function formatNumber(num: number): string {\n if (num >= 1000000) {\n return `${(num / 1000000).toFixed(1)}M`;\n }\n if (num >= 1000) {\n return `${(num / 1000).toFixed(1)}K`;\n }\n return num.toFixed(0);\n}\n\nexport function formatBytes(bytes: number): string {\n if (bytes < 1024) {\n return `${bytes}B`;\n }\n if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(1)}KB`;\n }\n return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n}\n\nexport function formatRelativeTime(timestamp: number): string {\n const diff = Date.now() - timestamp;\n if (diff < 1000) {\n return \"just now\";\n }\n if (diff < 60000) {\n return `${Math.floor(diff / 1000)}s ago`;\n }\n if (diff < 3600000) {\n return `${Math.floor(diff / 60000)}m ago`;\n }\n return `${Math.floor(diff / 3600000)}h ago`;\n}\n\nexport const formatMilliseconds = (\n value: number,\n includeSpace: boolean,\n): string => {\n const space = includeSpace ? \" \" : \"\";\n if (value < 1000) {\n return `${value}${space}ms`;\n }\n\n if (value < 60 * 1000) {\n const seconds = value / 1000;\n return seconds % 1 === 0\n ? `${seconds}${space}s`\n : `${seconds.toFixed(1)}${space}s`;\n }\n\n const minutes = value / 60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AG,CAAC,CAAC,GAAGH,SAAS;EACnC,IAAIC,IAAI,GAAG,IAAI,EAAE;IACf,OAAO,UAAU;EACnB;EACA,IAAIA,IAAI,GAAG,KAAK,EAAE;IAChB,OAAO,GAAGG,IAAI,CAACC,KAAK,CAACJ,IAAI,GAAG,IAAI,CAAC,OAAO;EAC1C;EACA,IAAIA,IAAI,GAAG,OAAO,EAAE;IAClB,OAAO,GAAGG,IAAI,CAACC,KAAK,CAACJ,IAAI,GAAG,KAAK,CAAC,OAAO;EAC3C;EACA,OAAO,GAAGG,IAAI,CAACC,KAAK,CAACJ,IAAI,GAAG,OAAO,CAAC,OAAO;AAC7C;AAEA,OAAO,MAAMK,kBAAkB,GAAGA,CAChCC,KAAa,EACbC,YAAqB,KACV;EACX,MAAMC,KAAK,GAAGD,YAAY,GAAG,GAAG,GAAG,EAAE;EACrC,IAAID,KAAK,GAAG,IAAI,EAAE;IAChB,OAAO,GAAGA,KAAK,GAAGE,KAAK,IAAI;EAC7B;EAEA,IAAIF,KAAK,GAAG,EAAE,GAAG,IAAI,EAAE;IACrB,MAAMG,OAAO,GAAGH,KAAK,GAAG,IAAI;IAC5B,OAAOG,OAAO,GAAG,CAAC,KAAK,CAAC,GACpB,GAAGA,OAAO,GAAGD,KAAK,GAAG,GACrB,GAAGC,OAAO,CAAChB,OAAO,CAAC,CAAC,CAAC,GAAGe,KAAK,GAAG;EACtC;EAEA,MAAME,OAAO,GAAGJ,KAAK,GAAG,MAAM;EAC9B,OAAOI,OAAO,GAAG,CAAC,KAAK,CAAC,GACpB,GAAGA,OAAO,GAAGF,KAAK,GAAG,GACrB,GAAGE,OAAO,CAACjB,OAAO,CAAC,CAAC,CAAC,GAAGe,KAAK,GAAG;AACtC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 noop = () => {};
|
|
18
|
+
const noopLogger = {
|
|
19
|
+
trace: noop,
|
|
20
|
+
debug: noop,
|
|
21
|
+
info: noop,
|
|
22
|
+
warn: noop,
|
|
23
|
+
error: noop,
|
|
24
|
+
fatal: noop,
|
|
25
|
+
isLevelEnabled: () => false,
|
|
26
|
+
child: () => noopLogger
|
|
27
|
+
};
|
|
28
|
+
export function createMonitorLogger() {
|
|
29
|
+
return noopLogger;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","names":["noop","noopLogger","trace","debug","info","warn","error","fatal","isLevelEnabled","child","createMonitorLogger"],"sources":["logger.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\";\n\nconst noop = () => {};\n\nconst noopLogger: Logger = {\n trace: noop,\n debug: noop,\n info: noop,\n warn: noop,\n error: noop,\n fatal: noop,\n isLevelEnabled: () => false,\n child: () => noopLogger,\n};\n\nexport function createMonitorLogger(_prefix?: string): Logger {\n return noopLogger;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,MAAMA,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,MAAMC,UAAkB,GAAG;EACzBC,KAAK,EAAEF,IAAI;EACXG,KAAK,EAAEH,IAAI;EACXI,IAAI,EAAEJ,IAAI;EACVK,IAAI,EAAEL,IAAI;EACVM,KAAK,EAAEN,IAAI;EACXO,KAAK,EAAEP,IAAI;EACXQ,cAAc,EAAEA,CAAA,KAAM,KAAK;EAC3BC,KAAK,EAAEA,CAAA,KAAMR;AACf,CAAC;AAED,OAAO,SAASS,mBAAmBA,CAAA,EAA2B;EAC5D,OAAOT,UAAU;AACnB","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
export const PLUGIN_NAME = "osdk-devtools";
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["PLUGIN_NAME"],"sources":["constants.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\nexport const PLUGIN_NAME = \"osdk-devtools\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,WAAW,GAAG,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
export function generateHookInstallationScript(verbose = false) {
|
|
18
|
+
return `
|
|
19
|
+
<script type="module">
|
|
20
|
+
// OSDK DevTools Hook Installer
|
|
21
|
+
// This script installs __REACT_DEVTOOLS_GLOBAL_HOOK__ before React initializes
|
|
22
|
+
|
|
23
|
+
(function installOsdkDevToolsHook() {
|
|
24
|
+
// Check if we're in a browser environment
|
|
25
|
+
if (typeof window === 'undefined') {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// If hook already exists (React DevTools extension), cooperate with it
|
|
30
|
+
if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
|
31
|
+
${verbose ? `console.log('[OSDK DevTools] Hook already exists (browser extension detected)');` : ""}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Store fiber roots per renderer ID
|
|
36
|
+
const fiberRootsByRenderer = new Map();
|
|
37
|
+
// Renderer registry (closure-scoped so inject() does not depend on \`this\`)
|
|
38
|
+
const renderers = new Map();
|
|
39
|
+
|
|
40
|
+
// Install our hook
|
|
41
|
+
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
|
|
42
|
+
// Renderer registry (same Map instance as the closure variable)
|
|
43
|
+
renderers,
|
|
44
|
+
|
|
45
|
+
// Indicate we support React Fiber architecture
|
|
46
|
+
supportsFiber: true,
|
|
47
|
+
|
|
48
|
+
// Called by React when a renderer initializes
|
|
49
|
+
inject(renderer) {
|
|
50
|
+
const id = renderers.size + 1;
|
|
51
|
+
renderers.set(id, renderer);
|
|
52
|
+
fiberRootsByRenderer.set(id, new Set());
|
|
53
|
+
|
|
54
|
+
${verbose ? `
|
|
55
|
+
console.log('[OSDK DevTools] React renderer injected:', {
|
|
56
|
+
id,
|
|
57
|
+
version: renderer.version,
|
|
58
|
+
package: renderer.rendererPackageName
|
|
59
|
+
});
|
|
60
|
+
` : ""}
|
|
61
|
+
|
|
62
|
+
return id;
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
// Called by React after each commit phase
|
|
66
|
+
onCommitFiberRoot(rendererID, root, priorityLevel) {
|
|
67
|
+
const roots = fiberRootsByRenderer.get(rendererID);
|
|
68
|
+
if (roots) {
|
|
69
|
+
roots.add(root);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// Called by React when a fiber unmounts
|
|
74
|
+
onCommitFiberUnmount(rendererID, fiber) {
|
|
75
|
+
// Optional: track unmounts if needed for GC
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// Custom method: Get roots for specific renderer
|
|
79
|
+
getFiberRoots(rendererID) {
|
|
80
|
+
return fiberRootsByRenderer.get(rendererID) || new Set();
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// Custom method: Get all roots across all renderers
|
|
84
|
+
getAllFiberRoots() {
|
|
85
|
+
const allRoots = new Set();
|
|
86
|
+
for (const roots of fiberRootsByRenderer.values()) {
|
|
87
|
+
for (const root of roots) {
|
|
88
|
+
allRoots.add(root);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return allRoots;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
${verbose ? `console.log('[OSDK DevTools] Hook installed successfully via Vite plugin');` : ""}
|
|
96
|
+
})();
|
|
97
|
+
</script>`;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=hookInstaller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hookInstaller.js","names":["generateHookInstallationScript","verbose"],"sources":["hookInstaller.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\nexport function generateHookInstallationScript(\n verbose: boolean = false,\n): string {\n return `\n<script type=\"module\">\n // OSDK DevTools Hook Installer\n // This script installs __REACT_DEVTOOLS_GLOBAL_HOOK__ before React initializes\n\n (function installOsdkDevToolsHook() {\n // Check if we're in a browser environment\n if (typeof window === 'undefined') {\n return;\n }\n\n // If hook already exists (React DevTools extension), cooperate with it\n if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {\n ${\n verbose\n ? `console.log('[OSDK DevTools] Hook already exists (browser extension detected)');`\n : \"\"\n }\n return;\n }\n\n // Store fiber roots per renderer ID\n const fiberRootsByRenderer = new Map();\n // Renderer registry (closure-scoped so inject() does not depend on \\`this\\`)\n const renderers = new Map();\n\n // Install our hook\n window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {\n // Renderer registry (same Map instance as the closure variable)\n renderers,\n\n // Indicate we support React Fiber architecture\n supportsFiber: true,\n\n // Called by React when a renderer initializes\n inject(renderer) {\n const id = renderers.size + 1;\n renderers.set(id, renderer);\n fiberRootsByRenderer.set(id, new Set());\n\n ${\n verbose\n ? `\n console.log('[OSDK DevTools] React renderer injected:', {\n id,\n version: renderer.version,\n package: renderer.rendererPackageName\n });\n `\n : \"\"\n }\n\n return id;\n },\n\n // Called by React after each commit phase\n onCommitFiberRoot(rendererID, root, priorityLevel) {\n const roots = fiberRootsByRenderer.get(rendererID);\n if (roots) {\n roots.add(root);\n }\n },\n\n // Called by React when a fiber unmounts\n onCommitFiberUnmount(rendererID, fiber) {\n // Optional: track unmounts if needed for GC\n },\n\n // Custom method: Get roots for specific renderer\n getFiberRoots(rendererID) {\n return fiberRootsByRenderer.get(rendererID) || new Set();\n },\n\n // Custom method: Get all roots across all renderers\n getAllFiberRoots() {\n const allRoots = new Set();\n for (const roots of fiberRootsByRenderer.values()) {\n for (const root of roots) {\n allRoots.add(root);\n }\n }\n return allRoots;\n }\n };\n\n ${\n verbose\n ? `console.log('[OSDK DevTools] Hook installed successfully via Vite plugin');`\n : \"\"\n }\n })();\n</script>`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,8BAA8BA,CAC5CC,OAAgB,GAAG,KAAK,EAChB;EACR,OAAO;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QACIA,OAAO,GACH,kFAAkF,GAClF,EAAE;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAEIA,OAAO,GACH;AACR;AACA;AACA;AACA;AACA;AACA,SAAS,GACD,EAAE;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAEIA,OAAO,GACH,6EAA6E,GAC7E,EAAE;AACV;AACA,UACU;AACV","ignoreList":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { dirname, resolve as resolvePath } from "node:path";
|
|
18
|
+
import { fileURLToPath } from "node:url";
|
|
19
|
+
import { PLUGIN_NAME } from "./constants.js";
|
|
20
|
+
import { generateHookInstallationScript } from "./hookInstaller.js";
|
|
21
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
const CSS_PATH = resolvePath(__dirname, "../styles.css");
|
|
23
|
+
export function osdkDevTools(options = {}) {
|
|
24
|
+
const {
|
|
25
|
+
enabled = process.env.NODE_ENV !== "production",
|
|
26
|
+
verbose = false,
|
|
27
|
+
injectCSS = true
|
|
28
|
+
} = options;
|
|
29
|
+
return {
|
|
30
|
+
name: PLUGIN_NAME,
|
|
31
|
+
enforce: "pre",
|
|
32
|
+
apply(config, {
|
|
33
|
+
command
|
|
34
|
+
}) {
|
|
35
|
+
if (config.mode === "production") {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (process.env.VITEST) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (!enabled) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
return command === "serve";
|
|
45
|
+
},
|
|
46
|
+
transformIndexHtml: {
|
|
47
|
+
order: "pre",
|
|
48
|
+
handler(html) {
|
|
49
|
+
if (!enabled) return html;
|
|
50
|
+
const hookScript = generateHookInstallationScript(verbose);
|
|
51
|
+
let cssTag = "";
|
|
52
|
+
if (injectCSS) {
|
|
53
|
+
cssTag = `\n <link rel="stylesheet" href="/@fs${CSS_PATH}" />`;
|
|
54
|
+
}
|
|
55
|
+
const injection = `${hookScript}${`\n <script type="module">import '@osdk/react-devtools';</script>`}${cssTag}\n`;
|
|
56
|
+
let transformed = html.replace("</head>", `${injection}</head>`);
|
|
57
|
+
if (transformed === html) {
|
|
58
|
+
transformed = html.replace("</body>", `${injection}</body>`);
|
|
59
|
+
}
|
|
60
|
+
if (transformed !== html) {
|
|
61
|
+
if (verbose) {
|
|
62
|
+
// eslint-disable-next-line no-console
|
|
63
|
+
console.log(`[${PLUGIN_NAME}] Injected devtools into HTML`);
|
|
64
|
+
}
|
|
65
|
+
} else if (verbose) {
|
|
66
|
+
// eslint-disable-next-line no-console
|
|
67
|
+
console.log(`[${PLUGIN_NAME}] Warning: Could not find </head> or </body> tag for injection`);
|
|
68
|
+
}
|
|
69
|
+
return transformed;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Default export for convenience
|
|
76
|
+
export default osdkDevTools;
|
|
77
|
+
//# sourceMappingURL=index.js.map
|