@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,768 @@
|
|
|
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 { MetricsStore } from "../store/MetricsStore.js";
|
|
18
|
+
import { ActionLifecycleTracker } from "./ActionLifecycleTracker.js";
|
|
19
|
+
import { componentContextCapture } from "./ComponentContextCapture.js";
|
|
20
|
+
import { SubscriptionTracker } from "./SubscriptionTracker.js";
|
|
21
|
+
function getDebugMetadata(value) {
|
|
22
|
+
if (typeof value === "object" && value != null && "__debugMetadata" in value) {
|
|
23
|
+
return value.__debugMetadata;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
function isMockActionEdits(value) {
|
|
28
|
+
return typeof value === "object" && value != null && "type" in value && value.type === "edits";
|
|
29
|
+
}
|
|
30
|
+
function hasExperimentalStore(client) {
|
|
31
|
+
return "__experimentalStore" in client && typeof client.__experimentalStore === "object" && client.__experimentalStore != null;
|
|
32
|
+
}
|
|
33
|
+
export class ObservableClientMonitor {
|
|
34
|
+
signatureLastRecorded = new Map();
|
|
35
|
+
subscriptionHasLoaded = new Map();
|
|
36
|
+
DEDUP_WINDOW_MS = 100;
|
|
37
|
+
cleanupIntervalId = null;
|
|
38
|
+
wrappedClient = null;
|
|
39
|
+
constructor(config) {
|
|
40
|
+
this.metricsStore = config.metricsStore ?? new MetricsStore();
|
|
41
|
+
this.subscriptionTracker = new SubscriptionTracker(config.cacheThresholdMs ?? 10);
|
|
42
|
+
this.actionTracker = new ActionLifecycleTracker(this.metricsStore, config.eventTimeline);
|
|
43
|
+
this.cleanupIntervalMs = config.cleanupIntervalMs ?? 60000;
|
|
44
|
+
this.cleanupIntervalId = setInterval(() => {
|
|
45
|
+
this.subscriptionTracker.cleanup();
|
|
46
|
+
this.pruneSignatureLastRecorded();
|
|
47
|
+
}, this.cleanupIntervalMs);
|
|
48
|
+
this.componentRegistry = config.componentRegistry;
|
|
49
|
+
this.linkTraversalTracker = config.linkTraversalTracker;
|
|
50
|
+
this.propertyAccessTracker = config.propertyAccessTracker;
|
|
51
|
+
this.eventTimeline = config.eventTimeline ?? null;
|
|
52
|
+
this.captureComponentContext = config.captureComponentContext ?? true;
|
|
53
|
+
this.captureQueryParams = config.captureQueryParams ?? true;
|
|
54
|
+
this.mockManager = config.mockManager ?? null;
|
|
55
|
+
}
|
|
56
|
+
wrapClient(client) {
|
|
57
|
+
this.wrappedClient = client;
|
|
58
|
+
|
|
59
|
+
// Suppress the client's internal BrowserLogger. It writes to console.*
|
|
60
|
+
// which our ConsoleLogStore intercepts, flooding the devtools console tab
|
|
61
|
+
// with hundreds of internal debug logs. The devtools monitoring proxy
|
|
62
|
+
// already captures all the same operations through its own instrumentation.
|
|
63
|
+
if (hasExperimentalStore(client)) {
|
|
64
|
+
client.__experimentalStore.logger = undefined;
|
|
65
|
+
}
|
|
66
|
+
const methodCache = new Map();
|
|
67
|
+
return new Proxy(client, {
|
|
68
|
+
get: (target, prop) => {
|
|
69
|
+
const cached = methodCache.get(prop);
|
|
70
|
+
if (cached !== undefined) {
|
|
71
|
+
return cached;
|
|
72
|
+
}
|
|
73
|
+
const ext = target;
|
|
74
|
+
let wrapped;
|
|
75
|
+
if (prop === "observeObject") {
|
|
76
|
+
wrapped = this.wrapObserveObject(target.observeObject.bind(target));
|
|
77
|
+
} else if (prop === "observeList") {
|
|
78
|
+
wrapped = this.wrapObserveList(target.observeList.bind(target));
|
|
79
|
+
} else if (prop === "observeAggregation") {
|
|
80
|
+
wrapped = this.wrapObserveAggregation(
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
82
|
+
target.observeAggregation.bind(target));
|
|
83
|
+
} else if (prop === "observeLinks" && ext.observeLinks) {
|
|
84
|
+
wrapped = this.wrapObserveLinks(ext.observeLinks.bind(ext));
|
|
85
|
+
} else if (prop === "applyAction") {
|
|
86
|
+
wrapped = this.wrapApplyAction(target.applyAction.bind(target));
|
|
87
|
+
} else if (prop === "validateAction") {
|
|
88
|
+
wrapped = this.wrapValidateAction(target.validateAction.bind(target));
|
|
89
|
+
} else if (prop === "getCacheSnapshot") {
|
|
90
|
+
wrapped = ext.getCacheSnapshot?.bind(ext);
|
|
91
|
+
} else if (prop === "invalidateAll") {
|
|
92
|
+
wrapped = ext.invalidateAll?.bind(ext);
|
|
93
|
+
} else if (prop === "invalidateObjects") {
|
|
94
|
+
wrapped = ext.invalidateObjects?.bind(ext);
|
|
95
|
+
} else if (prop === "invalidateObjectType") {
|
|
96
|
+
wrapped = ext.invalidateObjectType?.bind(ext);
|
|
97
|
+
}
|
|
98
|
+
if (wrapped !== undefined) {
|
|
99
|
+
methodCache.set(prop, wrapped);
|
|
100
|
+
return wrapped;
|
|
101
|
+
}
|
|
102
|
+
const value = Reflect.get(target, prop);
|
|
103
|
+
if (typeof value === "function") {
|
|
104
|
+
const bound = value.bind(target);
|
|
105
|
+
methodCache.set(prop, bound);
|
|
106
|
+
return bound;
|
|
107
|
+
}
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
recordMockHitIfNeeded(value, signature) {
|
|
113
|
+
const metadata = getDebugMetadata(value);
|
|
114
|
+
if (metadata?.servedFromMock && this.eventTimeline) {
|
|
115
|
+
this.eventTimeline.record({
|
|
116
|
+
type: "MOCK_HIT",
|
|
117
|
+
subscriptionId: signature,
|
|
118
|
+
timestamp: Date.now(),
|
|
119
|
+
mockId: metadata.mockId
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
recordEmissionEvent(signature, objectKey) {
|
|
124
|
+
if (this.eventTimeline) {
|
|
125
|
+
this.eventTimeline.record({
|
|
126
|
+
type: "EMISSION",
|
|
127
|
+
subscriptionId: signature,
|
|
128
|
+
objectKey,
|
|
129
|
+
timestamp: Date.now(),
|
|
130
|
+
isOptimistic: false
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
classifyCacheEvent(signature, subscriptionId, servedFromCache) {
|
|
135
|
+
const lastRecorded = this.signatureLastRecorded.get(signature) ?? 0;
|
|
136
|
+
const now = Date.now();
|
|
137
|
+
if (now - lastRecorded <= this.DEDUP_WINDOW_MS) {
|
|
138
|
+
return "skip";
|
|
139
|
+
}
|
|
140
|
+
this.signatureLastRecorded.set(signature, now);
|
|
141
|
+
if (servedFromCache) {
|
|
142
|
+
return "hit";
|
|
143
|
+
}
|
|
144
|
+
if (this.subscriptionHasLoaded.has(subscriptionId)) {
|
|
145
|
+
return "revalidation";
|
|
146
|
+
}
|
|
147
|
+
return "miss";
|
|
148
|
+
}
|
|
149
|
+
processEmission(subscriptionId, signature, metadata, status, hasData, isOptimistic, objectCount, value, objectKey) {
|
|
150
|
+
const timestamp = Date.now();
|
|
151
|
+
const debugMetadata = getDebugMetadata(value);
|
|
152
|
+
this.subscriptionTracker.recordEmission(subscriptionId, status, hasData, isOptimistic, debugMetadata?.optimisticId, timestamp);
|
|
153
|
+
this.actionTracker.noteEmission({
|
|
154
|
+
subscriptionId,
|
|
155
|
+
optimisticId: debugMetadata?.optimisticId,
|
|
156
|
+
isOptimistic,
|
|
157
|
+
timestamp,
|
|
158
|
+
objectCount
|
|
159
|
+
});
|
|
160
|
+
if (isOptimistic) {
|
|
161
|
+
this.metricsStore.recordOptimisticUpdate(signature, metadata);
|
|
162
|
+
}
|
|
163
|
+
if (status === "loaded") {
|
|
164
|
+
const classification = this.classifyCacheEvent(signature, subscriptionId, debugMetadata?.servedFromCache ?? false);
|
|
165
|
+
if (classification !== "skip") {
|
|
166
|
+
const analysis = this.subscriptionTracker.analyzeEmissions(subscriptionId);
|
|
167
|
+
const responseTime = analysis?.loadTime ?? 0;
|
|
168
|
+
const effectiveClassification = analysis?.wasCached ? "hit" : classification;
|
|
169
|
+
if (effectiveClassification === "hit") {
|
|
170
|
+
this.metricsStore.recordCacheHit(signature, responseTime, metadata, objectCount);
|
|
171
|
+
} else if (effectiveClassification === "revalidation") {
|
|
172
|
+
this.metricsStore.recordRevalidation(signature, responseTime, metadata, objectCount);
|
|
173
|
+
} else {
|
|
174
|
+
this.metricsStore.recordCacheMiss(signature, responseTime, metadata, objectCount);
|
|
175
|
+
}
|
|
176
|
+
this.subscriptionHasLoaded.set(subscriptionId, true);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
this.recordMockHitIfNeeded(value, signature);
|
|
180
|
+
this.recordEmissionEvent(signature, objectKey);
|
|
181
|
+
}
|
|
182
|
+
cleanupSubscription(subscriptionId) {
|
|
183
|
+
this.subscriptionTracker.endSubscription(subscriptionId);
|
|
184
|
+
this.actionTracker.clearSubscription(subscriptionId);
|
|
185
|
+
this.subscriptionHasLoaded.delete(subscriptionId);
|
|
186
|
+
}
|
|
187
|
+
createCleanupUnsubscribable(original, subscriptionId) {
|
|
188
|
+
return {
|
|
189
|
+
unsubscribe: () => {
|
|
190
|
+
try {
|
|
191
|
+
original.unsubscribe();
|
|
192
|
+
} finally {
|
|
193
|
+
this.cleanupSubscription(subscriptionId);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
setupObservation(params) {
|
|
199
|
+
const componentContext = this.captureComponentContext ? componentContextCapture.captureNow() : null;
|
|
200
|
+
if (componentContext && this.captureQueryParams) {
|
|
201
|
+
this.componentRegistry.registerBinding({
|
|
202
|
+
componentId: componentContext.id,
|
|
203
|
+
componentName: componentContext.name,
|
|
204
|
+
componentDisplayName: componentContext.displayName,
|
|
205
|
+
hookType: params.hookType,
|
|
206
|
+
hookIndex: 0,
|
|
207
|
+
querySignature: params.signature,
|
|
208
|
+
queryParams: params.queryParams
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
const isDeduplicated = this.subscriptionTracker.isDeduplicatedSubscription(params.signature);
|
|
212
|
+
if (isDeduplicated) {
|
|
213
|
+
this.metricsStore.recordDeduplication(params.signature, params.metadata);
|
|
214
|
+
}
|
|
215
|
+
const subscriptionId = this.subscriptionTracker.startSubscription(params.signature);
|
|
216
|
+
return {
|
|
217
|
+
componentContext,
|
|
218
|
+
subscriptionId
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
createCleanupObserverCallbacks(subscriptionId, componentContext, observer) {
|
|
222
|
+
return {
|
|
223
|
+
error: err => {
|
|
224
|
+
try {
|
|
225
|
+
this.cleanupSubscription(subscriptionId);
|
|
226
|
+
} catch (_cleanupError) {}
|
|
227
|
+
if (componentContext) {
|
|
228
|
+
this.componentRegistry.unregisterComponent(componentContext.id);
|
|
229
|
+
}
|
|
230
|
+
observer.error(err);
|
|
231
|
+
},
|
|
232
|
+
complete: () => {
|
|
233
|
+
this.cleanupSubscription(subscriptionId);
|
|
234
|
+
if (componentContext) {
|
|
235
|
+
this.componentRegistry.unregisterComponent(componentContext.id);
|
|
236
|
+
}
|
|
237
|
+
observer.complete();
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
wrapObserveObject(original) {
|
|
242
|
+
return (apiName, primaryKey, options, observer) => {
|
|
243
|
+
const apiNameStr = typeof apiName === "string" ? apiName : apiName.apiName;
|
|
244
|
+
const signature = `object:${apiNameStr}:${String(primaryKey)}`;
|
|
245
|
+
const metadata = {
|
|
246
|
+
apiName: apiNameStr,
|
|
247
|
+
primaryKey: String(primaryKey)
|
|
248
|
+
};
|
|
249
|
+
const {
|
|
250
|
+
componentContext,
|
|
251
|
+
subscriptionId
|
|
252
|
+
} = this.setupObservation({
|
|
253
|
+
signature,
|
|
254
|
+
metadata,
|
|
255
|
+
hookType: "useOsdkObject",
|
|
256
|
+
queryParams: {
|
|
257
|
+
type: "object",
|
|
258
|
+
objectType: apiNameStr,
|
|
259
|
+
primaryKey: String(primaryKey)
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
const objectKey = `${apiNameStr}:${primaryKey}`;
|
|
263
|
+
const mockManager = this.mockManager;
|
|
264
|
+
const cleanupCallbacks = this.createCleanupObserverCallbacks(subscriptionId, componentContext, observer);
|
|
265
|
+
const wrappedObserver = {
|
|
266
|
+
next: value => {
|
|
267
|
+
if (mockManager) {
|
|
268
|
+
const mock = mockManager.findMock({
|
|
269
|
+
type: "object",
|
|
270
|
+
objectType: apiNameStr,
|
|
271
|
+
primaryKey: String(primaryKey)
|
|
272
|
+
});
|
|
273
|
+
if (mock) {
|
|
274
|
+
if (mock.response.type === "error") {
|
|
275
|
+
observer.next({
|
|
276
|
+
...value,
|
|
277
|
+
status: "error",
|
|
278
|
+
object: undefined,
|
|
279
|
+
isOptimistic: false,
|
|
280
|
+
error: new Error(mock.response.error)
|
|
281
|
+
});
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (mock.response.type === "object") {
|
|
285
|
+
observer.next({
|
|
286
|
+
...value,
|
|
287
|
+
status: "loaded",
|
|
288
|
+
object: mock.response.object,
|
|
289
|
+
isOptimistic: false
|
|
290
|
+
});
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
this.processEmission(subscriptionId, signature, metadata, value.status, value.object !== undefined, value.isOptimistic, value.object !== undefined ? 1 : 0, value, objectKey);
|
|
296
|
+
if (value.object && componentContext) {
|
|
297
|
+
const wrapped = this.propertyAccessTracker.wrapObject(value.object, objectKey, componentContext.id);
|
|
298
|
+
value.object = wrapped;
|
|
299
|
+
}
|
|
300
|
+
observer.next(value);
|
|
301
|
+
},
|
|
302
|
+
...cleanupCallbacks
|
|
303
|
+
};
|
|
304
|
+
const unsubscribable = original(apiName, primaryKey, options, wrappedObserver);
|
|
305
|
+
return this.createCleanupUnsubscribable(unsubscribable, subscriptionId);
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
wrapObserveList(original) {
|
|
309
|
+
return (options, observer) => {
|
|
310
|
+
const apiNameStr = typeof options.type === "string" ? options.type : options.type.apiName;
|
|
311
|
+
const canonicalWhere = this.wrappedClient ? this.wrappedClient.canonicalizeWhereClause(options.where ?? {}) : options.where ?? {};
|
|
312
|
+
const whereClause = JSON.stringify(canonicalWhere);
|
|
313
|
+
const signature = options.__devtoolsSignature ?? `useOsdkObjects:${apiNameStr}:${whereClause}:${JSON.stringify(options.orderBy)}`;
|
|
314
|
+
const metadata = {
|
|
315
|
+
objectType: apiNameStr,
|
|
316
|
+
whereClause,
|
|
317
|
+
pageSize: options.pageSize
|
|
318
|
+
};
|
|
319
|
+
const {
|
|
320
|
+
componentContext,
|
|
321
|
+
subscriptionId
|
|
322
|
+
} = this.setupObservation({
|
|
323
|
+
signature,
|
|
324
|
+
metadata,
|
|
325
|
+
hookType: "useOsdkObjects",
|
|
326
|
+
queryParams: {
|
|
327
|
+
type: "list",
|
|
328
|
+
objectType: apiNameStr,
|
|
329
|
+
where: options.where,
|
|
330
|
+
orderBy: options.orderBy,
|
|
331
|
+
pageSize: options.pageSize
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
const mockManager = this.mockManager;
|
|
335
|
+
const cleanupCallbacks = this.createCleanupObserverCallbacks(subscriptionId, componentContext, observer);
|
|
336
|
+
const wrappedObserver = {
|
|
337
|
+
next: value => {
|
|
338
|
+
if (mockManager) {
|
|
339
|
+
const mock = mockManager.findMock({
|
|
340
|
+
type: "list",
|
|
341
|
+
objectType: apiNameStr,
|
|
342
|
+
whereClause: options.where
|
|
343
|
+
});
|
|
344
|
+
if (mock) {
|
|
345
|
+
if (mock.response.type === "error") {
|
|
346
|
+
observer.next({
|
|
347
|
+
...value,
|
|
348
|
+
status: "error",
|
|
349
|
+
resolvedList: [],
|
|
350
|
+
isOptimistic: false,
|
|
351
|
+
error: new Error(mock.response.error)
|
|
352
|
+
});
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (mock.response.type === "list") {
|
|
356
|
+
observer.next({
|
|
357
|
+
...value,
|
|
358
|
+
status: "loaded",
|
|
359
|
+
resolvedList: mock.response.list,
|
|
360
|
+
isOptimistic: false
|
|
361
|
+
});
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
this.processEmission(subscriptionId, signature, metadata, value.status, value.resolvedList !== undefined, value.isOptimistic, value.resolvedList ? value.resolvedList.length : 0, value);
|
|
367
|
+
if (value.resolvedList && componentContext) {
|
|
368
|
+
const wrappedList = value.resolvedList.map((obj, index) => {
|
|
369
|
+
const objectKey = `${apiNameStr}:${obj.$primaryKey || index}`;
|
|
370
|
+
return this.propertyAccessTracker.wrapObject(obj, objectKey, componentContext.id);
|
|
371
|
+
});
|
|
372
|
+
value.resolvedList = wrappedList;
|
|
373
|
+
}
|
|
374
|
+
observer.next(value);
|
|
375
|
+
},
|
|
376
|
+
...cleanupCallbacks
|
|
377
|
+
};
|
|
378
|
+
const unsubscribable = original(options, wrappedObserver);
|
|
379
|
+
return this.createCleanupUnsubscribable(unsubscribable, subscriptionId);
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
wrapObserveAggregation(original) {
|
|
383
|
+
return (options, observer) => {
|
|
384
|
+
const apiNameStr = typeof options.type === "string" ? options.type : options.type.apiName;
|
|
385
|
+
const signature = `useOsdkAggregation:${apiNameStr}:${JSON.stringify(options.where)}:${JSON.stringify(options.aggregate)}`;
|
|
386
|
+
const metadata = {
|
|
387
|
+
objectType: apiNameStr,
|
|
388
|
+
whereClause: JSON.stringify(options.where ?? {})
|
|
389
|
+
};
|
|
390
|
+
const {
|
|
391
|
+
componentContext,
|
|
392
|
+
subscriptionId
|
|
393
|
+
} = this.setupObservation({
|
|
394
|
+
signature,
|
|
395
|
+
metadata,
|
|
396
|
+
hookType: "useOsdkAggregation",
|
|
397
|
+
queryParams: {
|
|
398
|
+
type: "aggregation",
|
|
399
|
+
objectType: apiNameStr,
|
|
400
|
+
where: options.where,
|
|
401
|
+
aggregate: options.aggregate
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
const mockManager = this.mockManager;
|
|
405
|
+
const cleanupCallbacks = this.createCleanupObserverCallbacks(subscriptionId, componentContext, observer);
|
|
406
|
+
const wrappedObserver = {
|
|
407
|
+
next: value => {
|
|
408
|
+
if (mockManager) {
|
|
409
|
+
const mock = mockManager.findMock({
|
|
410
|
+
type: "list",
|
|
411
|
+
objectType: apiNameStr,
|
|
412
|
+
whereClause: options.where
|
|
413
|
+
});
|
|
414
|
+
if (mock) {
|
|
415
|
+
if (mock.response.type === "error") {
|
|
416
|
+
observer.next({
|
|
417
|
+
result: undefined,
|
|
418
|
+
status: "error",
|
|
419
|
+
lastUpdated: Date.now(),
|
|
420
|
+
error: new Error(mock.response.error)
|
|
421
|
+
});
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (mock.response.type === "list" || mock.response.type === "object") {
|
|
425
|
+
const mockData = mock.response.type === "list" ? mock.response.list : mock.response.object;
|
|
426
|
+
observer.next({
|
|
427
|
+
result: mockData,
|
|
428
|
+
status: "loaded",
|
|
429
|
+
lastUpdated: Date.now()
|
|
430
|
+
});
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
this.processEmission(subscriptionId, signature, metadata, value.status, value.result !== undefined, false, value.result !== undefined ? 1 : 0, value);
|
|
436
|
+
observer.next(value);
|
|
437
|
+
},
|
|
438
|
+
...cleanupCallbacks
|
|
439
|
+
};
|
|
440
|
+
const result = original(options, wrappedObserver);
|
|
441
|
+
if (result instanceof Promise) {
|
|
442
|
+
return result.then(unsub => this.createCleanupUnsubscribable(unsub, subscriptionId));
|
|
443
|
+
}
|
|
444
|
+
return this.createCleanupUnsubscribable(result, subscriptionId);
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
wrapObserveLinks(original) {
|
|
448
|
+
return (sourceObject, linkName, options, observer) => {
|
|
449
|
+
const componentContext = this.captureComponentContext ? componentContextCapture.captureNow() : null;
|
|
450
|
+
const sourceObjectKey = `${sourceObject.$apiName}:${sourceObject.$primaryKey}`;
|
|
451
|
+
const signature = `links:${sourceObjectKey}:${linkName}`;
|
|
452
|
+
if (componentContext && this.captureQueryParams) {
|
|
453
|
+
this.componentRegistry.registerBinding({
|
|
454
|
+
componentId: componentContext.id,
|
|
455
|
+
componentName: componentContext.name,
|
|
456
|
+
componentDisplayName: componentContext.displayName,
|
|
457
|
+
hookType: "useLinks",
|
|
458
|
+
hookIndex: 0,
|
|
459
|
+
querySignature: signature,
|
|
460
|
+
queryParams: {
|
|
461
|
+
type: "links",
|
|
462
|
+
sourceObject: sourceObjectKey,
|
|
463
|
+
linkName
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
this.linkTraversalTracker.recordTraversal({
|
|
468
|
+
sourceObjectType: sourceObject.$apiName,
|
|
469
|
+
sourceObjectKey: String(sourceObject.$primaryKey),
|
|
470
|
+
linkName,
|
|
471
|
+
timestamp: Date.now(),
|
|
472
|
+
componentId: componentContext?.id,
|
|
473
|
+
subscriptionId: signature
|
|
474
|
+
});
|
|
475
|
+
return original(sourceObject, linkName, options, {
|
|
476
|
+
next: value => {
|
|
477
|
+
this.recordMockHitIfNeeded(value, signature);
|
|
478
|
+
this.recordEmissionEvent(signature);
|
|
479
|
+
if (value.resolvedList && componentContext) {
|
|
480
|
+
const linkedObjects = [];
|
|
481
|
+
const wrappedList = value.resolvedList.map(obj => {
|
|
482
|
+
const osdkObj = obj;
|
|
483
|
+
linkedObjects.push({
|
|
484
|
+
objectType: osdkObj.$apiName,
|
|
485
|
+
primaryKey: String(osdkObj.$primaryKey)
|
|
486
|
+
});
|
|
487
|
+
return this.propertyAccessTracker.wrapObject(obj, `${osdkObj.$apiName}:${osdkObj.$primaryKey}`, componentContext.id);
|
|
488
|
+
});
|
|
489
|
+
this.linkTraversalTracker.recordLinkedObjects({
|
|
490
|
+
subscriptionId: signature,
|
|
491
|
+
linkName,
|
|
492
|
+
objects: linkedObjects
|
|
493
|
+
});
|
|
494
|
+
value.resolvedList = wrappedList;
|
|
495
|
+
}
|
|
496
|
+
observer.next(value);
|
|
497
|
+
},
|
|
498
|
+
error: err => observer.error(err),
|
|
499
|
+
complete: () => observer.complete()
|
|
500
|
+
});
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
wrapApplyAction(original) {
|
|
504
|
+
return async (actionDef, args, options) => {
|
|
505
|
+
const actionName = typeof actionDef === "string" ? actionDef : actionDef.apiName;
|
|
506
|
+
const signature = `action:${actionName}`;
|
|
507
|
+
const metadata = {
|
|
508
|
+
actionName
|
|
509
|
+
};
|
|
510
|
+
if (this.mockManager) {
|
|
511
|
+
const mock = this.mockManager.findMock({
|
|
512
|
+
type: "action",
|
|
513
|
+
actionName
|
|
514
|
+
});
|
|
515
|
+
if (mock) {
|
|
516
|
+
if (mock.delay) {
|
|
517
|
+
await new Promise(resolve => setTimeout(resolve, mock.delay));
|
|
518
|
+
}
|
|
519
|
+
if (mock.response.type === "passthrough") {
|
|
520
|
+
let actualArgs = args;
|
|
521
|
+
if (mock.usePayload && mock.payload) {
|
|
522
|
+
try {
|
|
523
|
+
const payloadData = JSON.parse(mock.payload);
|
|
524
|
+
actualArgs = payloadData.parameters || args;
|
|
525
|
+
} catch {}
|
|
526
|
+
}
|
|
527
|
+
try {
|
|
528
|
+
const result = await original(actionDef, actualArgs, options);
|
|
529
|
+
return result;
|
|
530
|
+
} catch (error) {
|
|
531
|
+
this.captureActionError(actionName, error, actualArgs);
|
|
532
|
+
throw error;
|
|
533
|
+
}
|
|
534
|
+
} else if (mock.response.type === "error") {
|
|
535
|
+
throw new Error(mock.response.error);
|
|
536
|
+
} else if (mock.response.type === "action") {
|
|
537
|
+
const mockResult = mock.response.result;
|
|
538
|
+
this.injectMockedObjectsFromActionResult(mock.id, mockResult);
|
|
539
|
+
const store = this.wrappedClient && hasExperimentalStore(this.wrappedClient) ? this.wrappedClient.__experimentalStore : undefined;
|
|
540
|
+
if (store && isMockActionEdits(mockResult)) {
|
|
541
|
+
const promises = [];
|
|
542
|
+
const allObjects = [...(mockResult.addedObjects || []), ...(mockResult.modifiedObjects || []), ...(mockResult.deletedObjects || [])];
|
|
543
|
+
for (const obj of allObjects) {
|
|
544
|
+
if (store.invalidateObject) {
|
|
545
|
+
promises.push(store.invalidateObject(obj.objectType, obj.primaryKey));
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
for (const objectType of mockResult.editedObjectTypes || []) {
|
|
549
|
+
if (store.invalidateObjectType) {
|
|
550
|
+
promises.push(store.invalidateObjectType(objectType));
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
await Promise.allSettled(promises);
|
|
554
|
+
}
|
|
555
|
+
return mockResult;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
const componentContext = componentContextCapture.captureNow();
|
|
560
|
+
const hasOptimisticUpdate = Boolean(options?.optimisticUpdate);
|
|
561
|
+
const actionId = this.actionTracker.startAction({
|
|
562
|
+
signature,
|
|
563
|
+
actionName,
|
|
564
|
+
metadata,
|
|
565
|
+
optimisticConfigured: hasOptimisticUpdate,
|
|
566
|
+
componentId: componentContext?.id
|
|
567
|
+
});
|
|
568
|
+
const existingListeners = options?.__debugListeners;
|
|
569
|
+
if (hasOptimisticUpdate) {
|
|
570
|
+
this.metricsStore.recordOptimisticUpdate(signature, metadata);
|
|
571
|
+
}
|
|
572
|
+
const instrumentedOptions = {
|
|
573
|
+
...(options ?? {}),
|
|
574
|
+
__debugListeners: {
|
|
575
|
+
onLayerCreated: id => {
|
|
576
|
+
this.actionTracker.registerOptimisticLayer(actionId, id);
|
|
577
|
+
existingListeners?.onLayerCreated?.(id);
|
|
578
|
+
},
|
|
579
|
+
onLayerCleared: id => {
|
|
580
|
+
this.actionTracker.handleLayerCleared(id, Date.now());
|
|
581
|
+
existingListeners?.onLayerCleared?.(id);
|
|
582
|
+
},
|
|
583
|
+
onObjectModified: (objectType, primaryKey, operation) => {
|
|
584
|
+
if (this.eventTimeline) {
|
|
585
|
+
this.eventTimeline.record({
|
|
586
|
+
type: "OBJECT_MODIFIED",
|
|
587
|
+
actionId,
|
|
588
|
+
objectType,
|
|
589
|
+
primaryKey,
|
|
590
|
+
modifiedBy: "optimistic",
|
|
591
|
+
timestamp: Date.now()
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
existingListeners?.onObjectModified?.(objectType, primaryKey, operation);
|
|
595
|
+
},
|
|
596
|
+
onServerObjectsModified: objects => {
|
|
597
|
+
if (this.eventTimeline) {
|
|
598
|
+
const timestamp = Date.now();
|
|
599
|
+
for (const obj of objects) {
|
|
600
|
+
this.eventTimeline.record({
|
|
601
|
+
type: "OBJECT_MODIFIED",
|
|
602
|
+
actionId,
|
|
603
|
+
objectType: obj.objectType,
|
|
604
|
+
primaryKey: obj.primaryKey,
|
|
605
|
+
modifiedBy: "server",
|
|
606
|
+
timestamp
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
existingListeners?.onServerObjectsModified?.(objects);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
try {
|
|
615
|
+
const result = await original(actionDef, args, instrumentedOptions);
|
|
616
|
+
this.actionTracker.markActionSettled({
|
|
617
|
+
actionId,
|
|
618
|
+
succeeded: true,
|
|
619
|
+
completedAt: Date.now()
|
|
620
|
+
});
|
|
621
|
+
return result;
|
|
622
|
+
} catch (error) {
|
|
623
|
+
this.actionTracker.markActionSettled({
|
|
624
|
+
actionId,
|
|
625
|
+
succeeded: false,
|
|
626
|
+
completedAt: Date.now()
|
|
627
|
+
});
|
|
628
|
+
this.captureActionError(actionName, error, args);
|
|
629
|
+
throw error;
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
wrapValidateAction(original) {
|
|
634
|
+
return async (actionDef, args) => {
|
|
635
|
+
const actionName = typeof actionDef === "string" ? actionDef : actionDef.apiName;
|
|
636
|
+
const start = Date.now();
|
|
637
|
+
try {
|
|
638
|
+
return await original(actionDef, args);
|
|
639
|
+
} finally {
|
|
640
|
+
const duration = Date.now() - start;
|
|
641
|
+
this.metricsStore.recordActionValidation(`validate:${actionName}`, duration, {
|
|
642
|
+
actionName
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
captureActionError(actionName, error, args) {
|
|
648
|
+
this.metricsStore.recordActionError({
|
|
649
|
+
id: `${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
650
|
+
actionType: actionName,
|
|
651
|
+
timestamp: Date.now(),
|
|
652
|
+
message: error instanceof Error ? error.message : String(error),
|
|
653
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
654
|
+
parameters: args,
|
|
655
|
+
validationErrors: error?.validationErrors
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
injectMockedObjectsFromActionResult(mockId, mockResult) {
|
|
659
|
+
if (!this.mockManager || !mockResult) {
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
const objects = this.extractObjectsFromMockResult(mockResult);
|
|
663
|
+
for (const obj of objects) {
|
|
664
|
+
const objectType = obj.$objectType ?? obj.$apiName;
|
|
665
|
+
const primaryKey = obj.$primaryKey ?? obj.id;
|
|
666
|
+
if (typeof objectType === "string" && (typeof primaryKey === "string" || typeof primaryKey === "number")) {
|
|
667
|
+
this.mockManager.injectMockedObjectToCache(mockId, objectType, primaryKey, obj);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
extractObjectsFromMockResult(mockResult) {
|
|
672
|
+
const objects = [];
|
|
673
|
+
if (!mockResult || typeof mockResult !== "object") {
|
|
674
|
+
return objects;
|
|
675
|
+
}
|
|
676
|
+
const result = mockResult;
|
|
677
|
+
if (result.$objectType || result.$apiName) {
|
|
678
|
+
objects.push(result);
|
|
679
|
+
return objects;
|
|
680
|
+
}
|
|
681
|
+
if (Array.isArray(mockResult)) {
|
|
682
|
+
for (const item of mockResult) {
|
|
683
|
+
if (item && typeof item === "object" && (item.$objectType || item.$apiName)) {
|
|
684
|
+
objects.push(item);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return objects;
|
|
688
|
+
}
|
|
689
|
+
if (Array.isArray(result.addedObjects)) {
|
|
690
|
+
for (const item of result.addedObjects) {
|
|
691
|
+
if (item && typeof item === "object") {
|
|
692
|
+
objects.push(item);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
if (Array.isArray(result.modifiedObjects)) {
|
|
697
|
+
for (const item of result.modifiedObjects) {
|
|
698
|
+
if (item && typeof item === "object") {
|
|
699
|
+
objects.push(item);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return objects;
|
|
704
|
+
}
|
|
705
|
+
getCacheSnapshot() {
|
|
706
|
+
if (!this.wrappedClient) {
|
|
707
|
+
return Promise.reject(new Error("No wrapped client available"));
|
|
708
|
+
}
|
|
709
|
+
const ext = this.wrappedClient;
|
|
710
|
+
if (!ext.getCacheSnapshot) {
|
|
711
|
+
return Promise.reject(new Error("getCacheSnapshot not available on client"));
|
|
712
|
+
}
|
|
713
|
+
return ext.getCacheSnapshot();
|
|
714
|
+
}
|
|
715
|
+
invalidateObjects(objects) {
|
|
716
|
+
if (!this.wrappedClient) {
|
|
717
|
+
return Promise.reject(new Error("No wrapped client available"));
|
|
718
|
+
}
|
|
719
|
+
const ext = this.wrappedClient;
|
|
720
|
+
if (!ext.invalidateObjects) {
|
|
721
|
+
return Promise.reject(new Error("invalidateObjects not available on client"));
|
|
722
|
+
}
|
|
723
|
+
return ext.invalidateObjects(objects);
|
|
724
|
+
}
|
|
725
|
+
invalidateObjectType(objectType) {
|
|
726
|
+
if (!this.wrappedClient) {
|
|
727
|
+
return Promise.reject(new Error("No wrapped client available"));
|
|
728
|
+
}
|
|
729
|
+
const ext = this.wrappedClient;
|
|
730
|
+
if (!ext.invalidateObjectType) {
|
|
731
|
+
return Promise.reject(new Error("invalidateObjectType not available on client"));
|
|
732
|
+
}
|
|
733
|
+
return ext.invalidateObjectType(objectType);
|
|
734
|
+
}
|
|
735
|
+
invalidateAll() {
|
|
736
|
+
if (!this.wrappedClient) {
|
|
737
|
+
return Promise.reject(new Error("No wrapped client available"));
|
|
738
|
+
}
|
|
739
|
+
const ext = this.wrappedClient;
|
|
740
|
+
if (!ext.invalidateAll) {
|
|
741
|
+
return Promise.reject(new Error("invalidateAll not available on client"));
|
|
742
|
+
}
|
|
743
|
+
return ext.invalidateAll();
|
|
744
|
+
}
|
|
745
|
+
pruneSignatureLastRecorded() {
|
|
746
|
+
const now = Date.now();
|
|
747
|
+
for (const [key, timestamp] of this.signatureLastRecorded) {
|
|
748
|
+
if (now - timestamp > this.cleanupIntervalMs) {
|
|
749
|
+
this.signatureLastRecorded.delete(key);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
dispose() {
|
|
754
|
+
try {
|
|
755
|
+
this.signatureLastRecorded.clear();
|
|
756
|
+
if ("dispose" in this.metricsStore && typeof this.metricsStore.dispose === "function") {
|
|
757
|
+
this.metricsStore.dispose();
|
|
758
|
+
}
|
|
759
|
+
this.actionTracker.dispose();
|
|
760
|
+
} finally {
|
|
761
|
+
if (this.cleanupIntervalId) {
|
|
762
|
+
clearInterval(this.cleanupIntervalId);
|
|
763
|
+
this.cleanupIntervalId = null;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
//# sourceMappingURL=ObservableClientMonitor.js.map
|