catalyst-core 0.3.0-beta.5 → 0.3.0-canary.1
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 +80 -0
- package/dist/errors/generateDocs.js +100 -0
- package/dist/errors/index.js +243 -0
- package/dist/errors/registry.js +483 -0
- package/dist/errors-index.json +506 -0
- package/dist/globals.d.ts +62 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.jsx +5 -8
- package/dist/logger.js +1 -1
- package/dist/native/androidProject/app/build.gradle.kts +142 -7
- package/dist/native/androidProject/app/src/main/AndroidManifest.xml +4 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +2 -2
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/BarcodeDetector.kt +3 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/CameraSessionManager.kt +3 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +43 -8
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/BridgeUtilsTest.kt +181 -1
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/CameraUtilsTest.kt +156 -236
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileSizeRouterUtilsTest.kt +471 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileUtilsTest.kt +222 -226
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FrameworkServerUtilsTest.kt +300 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/IntentUtilsTest.kt +244 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/MetricsMonitorTest.kt +359 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NativeBridgeTest.kt +108 -63
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NotificationUtilsTest.kt +329 -385
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/OfflineCacheServiceTest.kt +302 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/PerfEventBufferTest.kt +133 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/UtilsKtTest.kt +152 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/WebCacheManagerTest.kt +145 -324
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/BarcodeDetectorTest.kt +132 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/HoldControllerTest.kt +155 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/TorchControllerTest.kt +150 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateMachineTest.kt +120 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateTest.kt +62 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ViewfinderMapperTest.kt +143 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ZoomControllerTest.kt +421 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/design/DesignTokensTest.kt +207 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/plugins/PluginBridgeTest.kt +368 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/FridaDetectorTest.kt +193 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckManagerTest.kt +260 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckSchedulerTest.kt +166 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DeviceInfoUtilsTest.kt +167 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DownloadUtilsTest.kt +197 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/NetworkMonitorTest.kt +271 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/PushNotificationUtilsTest.kt +119 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/SafeAreaUtilsTest.kt +108 -0
- package/dist/native/androidProject/build.gradle.kts +1 -0
- package/dist/native/androidProject/gradle/libs.versions.toml +26 -0
- package/dist/native/androidProject/settings.gradle.kts +11 -8
- package/dist/native/androidSetup.js +2 -2
- package/dist/native/bridge/WebBridge.d.ts +98 -0
- package/dist/native/bridge/WebBridge.js +40 -6
- package/dist/native/bridge/constants/NativeInterfaces.d.ts +391 -0
- package/dist/native/bridge/errors.d.ts +67 -0
- package/dist/native/bridge/errors.js +66 -151
- package/dist/native/bridge/hooks/index.d.ts +13 -0
- package/dist/native/bridge/hooks/index.js +0 -6
- package/dist/native/bridge/hooks/useAI.d.ts +1 -0
- package/dist/native/bridge/hooks/useAI.js +3 -1
- package/dist/native/bridge/hooks/useCamera.d.ts +86 -0
- package/dist/native/bridge/hooks/useCamera.js +35 -6
- package/dist/native/bridge/hooks/useDataProtection.d.ts +17 -0
- package/dist/native/bridge/hooks/useDeviceInfo.d.ts +34 -0
- package/dist/native/bridge/hooks/useDeviceInfo.js +5 -0
- package/dist/native/bridge/hooks/useFilePicker.d.ts +53 -0
- package/dist/native/bridge/hooks/useFilePicker.js +13 -0
- package/dist/native/bridge/hooks/useGoogleSignIn.d.ts +12 -0
- package/dist/native/bridge/hooks/useHapticFeedback.d.ts +76 -0
- package/dist/native/bridge/hooks/useHapticFeedback.js +6 -1
- package/dist/native/bridge/hooks/useIntent.d.ts +33 -0
- package/dist/native/bridge/hooks/useIntent.js +2 -0
- package/dist/native/bridge/hooks/useNativeTransition.d.ts +53 -0
- package/dist/native/bridge/hooks/useNativeTransition.js +12 -5
- package/dist/native/bridge/hooks/useNetworkStatus.d.ts +22 -0
- package/dist/native/bridge/hooks/useNetworkStatus.js +7 -0
- package/dist/native/bridge/hooks/useNotification.d.ts +83 -0
- package/dist/native/bridge/hooks/useNotification.js +81 -34
- package/dist/native/bridge/hooks/useSafeArea.d.ts +12 -0
- package/dist/native/bridge/hooks/useSafeArea.js +8 -0
- package/dist/native/bridge/hooks/useVideoStream.d.ts +67 -0
- package/dist/native/bridge/hooks/useVideoStream.js +38 -52
- package/dist/native/bridge/hooks/utils.d.ts +4 -0
- package/dist/native/bridge/hooks.d.ts +1 -0
- package/dist/native/bridge/perf/collectors/ApiCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/ApiCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/CacheCollector.d.ts +43 -0
- package/dist/native/bridge/perf/collectors/CacheCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/HookCollector.d.ts +37 -0
- package/dist/native/bridge/perf/collectors/HookCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/InsightsCollector.d.ts +103 -0
- package/dist/native/bridge/perf/collectors/InsightsCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/InteractionCollector.d.ts +53 -0
- package/dist/native/bridge/perf/collectors/InteractionCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/KeyboardCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/KeyboardCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/NavigationCollector.d.ts +37 -0
- package/dist/native/bridge/perf/collectors/NavigationCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/RenderCollector.d.ts +47 -0
- package/dist/native/bridge/perf/collectors/RenderCollector.js +8 -0
- package/dist/native/bridge/perf/collectors/ScrollCollector.d.ts +29 -0
- package/dist/native/bridge/perf/collectors/ScrollCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/ThreadCollector.d.ts +31 -0
- package/dist/native/bridge/perf/collectors/ThreadCollector.js +4 -0
- package/dist/native/bridge/perf/core/constants.d.ts +76 -0
- package/dist/native/bridge/perf/core/measure.d.ts +39 -0
- package/dist/native/bridge/perf/core/measure.js +4 -0
- package/dist/native/bridge/perf/core/session.d.ts +49 -0
- package/dist/native/bridge/perf/core/session.js +4 -0
- package/dist/native/bridge/perf/core/store.d.ts +37 -0
- package/dist/native/bridge/perf/core/store.js +4 -0
- package/dist/native/bridge/perf/core/summary.d.ts +60 -0
- package/dist/native/bridge/perf/core/traceExport.d.ts +10 -0
- package/dist/native/bridge/perf/core/waterfalls.d.ts +2 -0
- package/dist/native/bridge/perf/index.d.ts +63 -0
- package/dist/native/bridge/perf/index.js +4 -0
- package/dist/native/bridge/safeArea.d.ts +11 -0
- package/dist/native/bridge/safeArea.js +2 -0
- package/dist/native/bridge/useBaseHook.d.ts +137 -0
- package/dist/native/bridge/useBaseHook.js +34 -4
- package/dist/native/bridge/utils/CameraUtils.d.ts +94 -0
- package/dist/native/bridge/utils/CameraUtils.js +4 -0
- package/dist/native/bridge/utils/FileObjectConverter.d.ts +36 -0
- package/dist/native/bridge/utils/NativeBridge.d.ts +270 -0
- package/dist/native/bridge/utils/NativeBridge.js +10 -0
- package/dist/native/buildAndroid/index.js +1 -1
- package/dist/native/buildAppAndroid.js +9 -0
- package/dist/native/buildAppIos.js +16 -1
- package/dist/native/buildErrorFormat.js +57 -0
- package/dist/native/buildIos/config.js +15 -1
- package/dist/native/buildIos/index.js +1 -1
- package/dist/native/buildIos/plugins.js +10 -1
- package/dist/native/iosnativeWebView/CoreLogic/Package.swift +36 -0
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamState.swift +1 -1
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamStateMachine.swift +6 -4
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/BootTimingUtility.swift +3 -3
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/FrameworkServerUtils.swift +14 -9
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NetworkMonitor.swift +11 -9
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NotificationHandlerProvider.swift +1 -1
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/URLWhitelistManager.swift +7 -7
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/AnyCodableTests.swift +154 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/BootTimingUtilityTests.swift +23 -5
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/CatalystConstantsTests.swift +192 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/ConfigMappingTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsErrorPathTests.swift +106 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsLoopbackTests.swift +243 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/FrameworkServerUtilsTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NetworkMonitorTests.swift +119 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NotificationHandlerProviderTests.swift +59 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/NotificationHandlerTests.swift +1 -1
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/URLWhitelistManagerTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateMachineTests.swift +171 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateTests.swift +91 -0
- package/dist/native/iosnativeWebView/Package.swift +10 -9
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift +7 -2
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift +1 -2
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift +5 -4
- package/dist/native/iosnativeWebView/Sources/Core/Camera/CameraSessionManager.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/HoldController.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/NativeCameraManager.swift +6 -5
- package/dist/native/iosnativeWebView/Sources/Core/Camera/ZoomController.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Plugins/PluginBridge.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CacheManager.swift +31 -30
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CameraTransportUtils.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/Utils/DeviceInfoUtils.swift +1 -1
- package/dist/native/iosnativeWebView/Sources/Core/Utils/FilePickerHandler.swift +22 -19
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ImageHandler.swift +40 -39
- package/dist/native/iosnativeWebView/Sources/Core/Utils/PerfEventBuffer.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ResourceURLProtocol.swift +15 -15
- package/dist/native/iosnativeWebView/Sources/Core/Utils/WebKitConfig.swift +4 -3
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +6 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeDelegateHandler.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeFileHandler.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeJavaScriptInterface.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +3 -5
- package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +20 -13
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashView.swift +6 -5
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashViewModel.swift +14 -13
- package/dist/native/iosnativeWebView/Sources/Core/WebView/TransitionManager.swift +3 -3
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +9 -8
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewModel.swift +7 -6
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +24 -25
- package/dist/native/iosnativeWebView/iosnativeWebView/AppDelegate.swift +6 -1
- package/dist/native/iosnativeWebView/iosnativeWebView/ContentView.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebViewApp.swift +4 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +2 -22
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/BridgeMessageValidatorTests.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/CacheManagerTests.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/FilePickerHandlerTests.swift +2 -1
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/NativeBridgeTests.swift +15 -9
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/WebViewTests.swift +1 -0
- package/dist/native/setupEmulatorIos.js +2 -2
- package/dist/native/terminalProgress.js +17 -17
- package/dist/router/ClientRouter.d.ts +8 -0
- package/dist/router/ClientRouter.js +13 -11
- package/dist/router/ServerRouter.d.ts +13 -0
- package/dist/router/ServerRouter.js +19 -7
- package/dist/scripts/build.js +14 -2
- package/dist/scripts/loadEnvironmentVariables.js +3 -2
- package/dist/scripts/plugins.js +1 -1
- package/dist/scripts/preServerInit.js +49 -3
- package/dist/scripts/preflight.js +111 -0
- package/dist/scripts/scriptUtils.js +46 -1
- package/dist/scripts/serve.js +7 -1
- package/dist/scripts/start.js +8 -1
- package/dist/server/expressServer.d.ts +1 -0
- package/dist/server/expressServer.js +247 -271
- package/dist/server/manifestCache.d.ts +2 -0
- package/dist/server/manifestCache.js +25 -33
- package/dist/server/renderer/ChunkExtractor.d.ts +44 -0
- package/dist/server/renderer/ChunkExtractor.js +113 -125
- package/dist/server/renderer/document/Body.d.ts +21 -0
- package/dist/server/renderer/document/Body.jsx +45 -45
- package/dist/server/renderer/document/FastRefresh.d.ts +3 -0
- package/dist/server/renderer/document/FastRefresh.jsx +7 -13
- package/dist/server/renderer/document/Head.d.ts +20 -0
- package/dist/server/renderer/document/Head.jsx +32 -32
- package/dist/server/renderer/document/index.d.ts +2 -0
- package/dist/server/renderer/document/index.jsx +2 -2
- package/dist/server/renderer/extract.d.ts +67 -0
- package/dist/server/renderer/extract.js +92 -89
- package/dist/server/renderer/handler.d.ts +2 -0
- package/dist/server/renderer/handler.jsx +401 -404
- package/dist/server/renderer/index.d.ts +2 -0
- package/dist/server/renderer/index.js +5 -8
- package/dist/server/renderer/render.d.ts +35 -0
- package/dist/server/renderer/render.js +33 -32
- package/dist/server/utils/botDetectionMiddleware.d.ts +1 -0
- package/dist/server/utils/botDetectionMiddleware.js +33 -23
- package/dist/server/utils/cjsRequire.d.ts +8 -0
- package/dist/server/utils/cjsRequire.js +2 -2
- package/dist/server/utils/userAgentUtil.d.ts +7 -0
- package/dist/server/utils/userAgentUtil.js +68 -71
- package/dist/server/utils/validator.d.ts +31 -0
- package/dist/server/utils/validator.js +133 -158
- package/dist/vite/inject-cache-key-plugin.js +3 -27
- package/dist/vite/moduleAliases.js +36 -0
- package/dist/vite/node-loader.mjs +2 -29
- package/dist/vite/resolveDevServerConfig.js +4 -1
- package/dist/vite/vite.config.js +2 -29
- package/dist/web-router/components/MetaTag.d.ts +4 -0
- package/dist/web-router/components/MetaTag.jsx +26 -28
- package/dist/web-router/components/MetaTag.test.jsx +100 -0
- package/dist/web-router/components/RouterDataProvider.d.ts +96 -0
- package/dist/web-router/components/RouterDataProvider.jsx +260 -259
- package/dist/web-router/components/RouterDataProvider.server.test.jsx +98 -0
- package/dist/web-router/components/RouterDataProvider.test.jsx +310 -0
- package/dist/web-router/components/Split.d.ts +74 -0
- package/dist/web-router/components/Split.jsx +147 -156
- package/dist/web-router/components/Split.server.test.jsx +52 -0
- package/dist/web-router/components/Split.test.jsx +167 -0
- package/dist/web-router/components/SplitInview.d.ts +22 -0
- package/dist/web-router/components/SplitInview.jsx +78 -89
- package/dist/web-router/components/SplitInview.test.jsx +112 -0
- package/dist/web-router/components/SsrRequestContext.d.ts +20 -0
- package/dist/web-router/components/SsrRequestContext.jsx +17 -7
- package/dist/web-router/components/SsrRequestContext.test.jsx +53 -0
- package/dist/web-router/context.d.ts +15 -0
- package/dist/web-router/context.jsx +5 -5
- package/dist/web-router/context.test.jsx +10 -0
- package/dist/web-router/utils/metaDataUtils.d.ts +24 -0
- package/dist/web-router/utils/metaDataUtils.jsx +86 -86
- package/dist/web-router/utils/metaDataUtils.test.jsx +188 -0
- package/dist/web-router/vitest.setup.js +12 -0
- package/mcp_v2/knowledge-base.json +52 -8
- package/mcp_v2/mcp.js +140 -3
- package/mcp_v2/package-lock.json +2031 -0
- package/mcp_v2/package.json +13 -2
- package/mcp_v2/scripts/copyErrorsIndex.cjs +34 -0
- package/mcp_v2/test/errors.test.ts +123 -0
- package/mcp_v2/test/github.test.ts +177 -0
- package/mcp_v2/tools/errors.d.ts +20 -0
- package/mcp_v2/tools/errors.js +63 -0
- package/mcp_v2/tools/github.d.ts +41 -0
- package/mcp_v2/tools/github.js +231 -0
- package/mcp_v2/vitest.config.mjs +22 -0
- package/package.json +60 -11
- package/test/errors/docsDrift.test.ts +113 -0
- package/test/errors/index.test.ts +200 -0
- package/test/errors/registry.test.ts +108 -0
- package/test/scripts/preflight.test.ts +121 -0
- package/test/server/ChunkExtractor.test.ts +97 -0
- package/test/server/extract.test.ts +128 -0
- package/test/server/fixtures/template/server/document.jsx +19 -0
- package/test/server/fixtures/template/server/index.js +10 -0
- package/test/server/fixtures/template/src/js/containers/App/index.jsx +33 -0
- package/test/server/fixtures/template/src/js/routes/index.jsx +72 -0
- package/test/server/fixtures/template/src/js/routes/utils.jsx +39 -0
- package/test/server/fixtures/template/src/js/store/index.js +19 -0
- package/test/server/handler.assets.test.ts +331 -0
- package/test/server/handler.test.ts +210 -0
- package/test/server/manifestCache.test.ts +71 -0
- package/test/server/render.test.ts +90 -0
- package/test/server/scriptUtils.test.ts +103 -0
- package/test/server/userAgentUtil.test.ts +48 -0
- package/test/server/validator.test.ts +228 -0
- package/test/vite/resolveDevServerConfig.test.js +4 -1
- package/tsconfig.test.json +23 -0
- package/vitest.config.ts +93 -0
- package/dist/caching.js +0 -1
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/DeviceInfoUtilsTest.kt +0 -187
- package/dist/native/bridge/standardizedHooks.js +0 -611
- package/dist/router.js +0 -1
- package/dist/scripts/validator.js +0 -149
- package/dist/web-router/hooks.jsx +0 -72
- package/dist/web-router/types/components/MetaTag.d.ts +0 -2
- package/dist/web-router/types/components/RouterDataProvider.d.ts +0 -95
- package/dist/web-router/types/context.d.ts +0 -14
- package/dist/web-router/types/hooks.d.ts +0 -1
- package/dist/web-router/types/index.d.ts +0 -3
- package/dist/web-router/types/utils/metaDataUtils.d.ts +0 -40
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/CatalystConstants.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/ConfigConstants.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Notifications/NotificationModels.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Protocols/NotificationHandlerProtocol.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NullNotificationHandler.swift +0 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
const REPO_BLOB_BASE = "https://github.com/tata1mg/catalyst-core/blob/main/errors"
|
|
2
|
+
|
|
3
|
+
export const ERROR_CODES = {
|
|
4
|
+
PREFLIGHT_CONFIG_MISSING: "PREFLIGHT-001",
|
|
5
|
+
PREFLIGHT_CONFIG_NOT_OBJECT: "PREFLIGHT-002",
|
|
6
|
+
PREFLIGHT_CONFIG_KEY_MISSING: "PREFLIGHT-003",
|
|
7
|
+
PREFLIGHT_PACKAGE_JSON_MISSING: "PREFLIGHT-004",
|
|
8
|
+
PREFLIGHT_PACKAGE_JSON_INVALID: "PREFLIGHT-005",
|
|
9
|
+
PREFLIGHT_MODULE_ALIAS_MISSING: "PREFLIGHT-006",
|
|
10
|
+
PREFLIGHT_MODULE_ALIAS_NOT_OBJECT: "PREFLIGHT-007",
|
|
11
|
+
PREFLIGHT_MODULE_ALIAS_RESTRICTED: "PREFLIGHT-008",
|
|
12
|
+
PREFLIGHT_MODULE_ALIAS_KEY_MISSING: "PREFLIGHT-009",
|
|
13
|
+
PREFLIGHT_PRE_SERVER_INIT_MISSING: "PREFLIGHT-010",
|
|
14
|
+
PREFLIGHT_PRE_SERVER_INIT_NOT_FUNCTION: "PREFLIGHT-011",
|
|
15
|
+
PREFLIGHT_MIDDLEWARE_MISSING: "PREFLIGHT-012",
|
|
16
|
+
PREFLIGHT_MIDDLEWARE_NOT_FUNCTION: "PREFLIGHT-013",
|
|
17
|
+
PREFLIGHT_REDUCER_MISSING: "PREFLIGHT-014",
|
|
18
|
+
PREFLIGHT_REDUCER_NOT_FUNCTION: "PREFLIGHT-015",
|
|
19
|
+
PREFLIGHT_CONFIGURE_STORE_MISSING: "PREFLIGHT-016",
|
|
20
|
+
PREFLIGHT_CONFIGURE_STORE_NOT_FUNCTION: "PREFLIGHT-017",
|
|
21
|
+
PREFLIGHT_GET_ROUTES_MISSING: "PREFLIGHT-018",
|
|
22
|
+
PREFLIGHT_GET_ROUTES_NOT_FUNCTION: "PREFLIGHT-019",
|
|
23
|
+
PREFLIGHT_CUSTOM_DOCUMENT_MISSING: "PREFLIGHT-020",
|
|
24
|
+
PREFLIGHT_CUSTOM_DOCUMENT_NOT_FUNCTION: "PREFLIGHT-021",
|
|
25
|
+
|
|
26
|
+
PROCESS_SERVER_INIT_FAILED: "PROCESS-001",
|
|
27
|
+
PROCESS_USER_HOOK_FAILED: "PROCESS-002",
|
|
28
|
+
|
|
29
|
+
BUNDLE_UPSTREAM_ERROR: "BUNDLE-000",
|
|
30
|
+
IOS_UPSTREAM_ERROR: "IOS-000",
|
|
31
|
+
ANDROID_UPSTREAM_ERROR: "ANDROID-000",
|
|
32
|
+
|
|
33
|
+
RUNTIME_NATIVE_PERMISSION_DENIED: "RUNTIME-NATIVE-001",
|
|
34
|
+
RUNTIME_NATIVE_PERMISSION_REQUIRED: "RUNTIME-NATIVE-002",
|
|
35
|
+
RUNTIME_NATIVE_NETWORK_UNAVAILABLE: "RUNTIME-NATIVE-003",
|
|
36
|
+
RUNTIME_NATIVE_DOWNLOAD_FAILED: "RUNTIME-NATIVE-004",
|
|
37
|
+
RUNTIME_NATIVE_FILE_NOT_FOUND: "RUNTIME-NATIVE-005",
|
|
38
|
+
RUNTIME_NATIVE_FILE_TOO_LARGE: "RUNTIME-NATIVE-006",
|
|
39
|
+
RUNTIME_NATIVE_STORAGE_FULL: "RUNTIME-NATIVE-007",
|
|
40
|
+
RUNTIME_NATIVE_FILE_CORRUPTED: "RUNTIME-NATIVE-008",
|
|
41
|
+
RUNTIME_NATIVE_OPERATION_CANCELLED: "RUNTIME-NATIVE-009",
|
|
42
|
+
RUNTIME_NATIVE_NO_FILE_SELECTED: "RUNTIME-NATIVE-010",
|
|
43
|
+
RUNTIME_NATIVE_INVALID_FILE_TYPE: "RUNTIME-NATIVE-011",
|
|
44
|
+
RUNTIME_NATIVE_INVALID_PARAMETERS: "RUNTIME-NATIVE-012",
|
|
45
|
+
RUNTIME_NATIVE_BRIDGE_UNAVAILABLE: "RUNTIME-NATIVE-013",
|
|
46
|
+
RUNTIME_NATIVE_FEATURE_UNSUPPORTED: "RUNTIME-NATIVE-014",
|
|
47
|
+
RUNTIME_NATIVE_INTERNAL_ERROR: "RUNTIME-NATIVE-015",
|
|
48
|
+
RUNTIME_NATIVE_CAMERA_UNAVAILABLE: "RUNTIME-NATIVE-016",
|
|
49
|
+
RUNTIME_NATIVE_CAMERA_IN_USE: "RUNTIME-NATIVE-017",
|
|
50
|
+
|
|
51
|
+
RUNTIME_NATIVE_BRIDGE_INVALID_CALLBACK: "RUNTIME-NATIVE-018",
|
|
52
|
+
RUNTIME_NATIVE_BRIDGE_HANDLER_NOT_REGISTERED: "RUNTIME-NATIVE-019",
|
|
53
|
+
RUNTIME_NATIVE_BRIDGE_HANDLER_THREW: "RUNTIME-NATIVE-020",
|
|
54
|
+
RUNTIME_NATIVE_BRIDGE_INVALID_REGISTRATION: "RUNTIME-NATIVE-021",
|
|
55
|
+
RUNTIME_NATIVE_BRIDGE_INIT_FAILED: "RUNTIME-NATIVE-022",
|
|
56
|
+
|
|
57
|
+
RUNTIME_WEB_RENDER_FAILED: "RUNTIME-WEB-001",
|
|
58
|
+
RUNTIME_WEB_FETCHER_FAILED: "RUNTIME-WEB-002",
|
|
59
|
+
RUNTIME_WEB_SERVER_SIDE_FUNCTION_FAILED: "RUNTIME-WEB-003",
|
|
60
|
+
RUNTIME_WEB_REQUEST_HANDLING_FAILED: "RUNTIME-WEB-004",
|
|
61
|
+
|
|
62
|
+
AI_UPSTREAM_ERROR: "AI-000",
|
|
63
|
+
AI_DISABLED: "AI-001",
|
|
64
|
+
AI_PROVIDER_NOT_CONFIGURED: "AI-002",
|
|
65
|
+
AI_INVALID_REQUEST_BODY: "AI-003",
|
|
66
|
+
AI_NATIVE_BRIDGE_UNAVAILABLE: "AI-004",
|
|
67
|
+
AI_NATIVE_STREAM_NOT_READY: "AI-005",
|
|
68
|
+
AI_NATIVE_REQUEST_FAILED: "AI-006",
|
|
69
|
+
AI_NATIVE_CALLBACK_ERROR: "AI-007",
|
|
70
|
+
AI_WEB_WORKER_UNAVAILABLE: "AI-008",
|
|
71
|
+
AI_WEB_WORKER_CRASHED: "AI-009",
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// One entry per catalyst-owned code. Foreign/wrapped errors (see wrapForeignError)
|
|
75
|
+
// intentionally do not get an entry here beyond their per-stage wrapper code —
|
|
76
|
+
// we don't author docs or specific meanings for errors we don't originate.
|
|
77
|
+
export const ERROR_DEFINITIONS = {
|
|
78
|
+
[ERROR_CODES.PREFLIGHT_CONFIG_MISSING]: {
|
|
79
|
+
category: "PREFLIGHT",
|
|
80
|
+
defaultMessage: "config not found in config folder",
|
|
81
|
+
defaultDetails: "A config object must be exported from the config folder in your project root.",
|
|
82
|
+
suggestedAction: "Create config/config.json (or config/index.js) exporting the required config object.",
|
|
83
|
+
},
|
|
84
|
+
[ERROR_CODES.PREFLIGHT_CONFIG_NOT_OBJECT]: {
|
|
85
|
+
category: "PREFLIGHT",
|
|
86
|
+
defaultMessage: "config export is not an object",
|
|
87
|
+
defaultDetails: "The config folder must export a plain object.",
|
|
88
|
+
suggestedAction: "Ensure config/config.json exports an object, not a string, array, or function.",
|
|
89
|
+
},
|
|
90
|
+
[ERROR_CODES.PREFLIGHT_CONFIG_KEY_MISSING]: {
|
|
91
|
+
category: "PREFLIGHT",
|
|
92
|
+
defaultMessage: "required key missing inside config.json",
|
|
93
|
+
defaultDetails: "config.json is missing one or more required keys.",
|
|
94
|
+
suggestedAction:
|
|
95
|
+
"Add the missing key to config.json. See the config.json reference in the framework docs.",
|
|
96
|
+
},
|
|
97
|
+
[ERROR_CODES.PREFLIGHT_PACKAGE_JSON_MISSING]: {
|
|
98
|
+
category: "PREFLIGHT",
|
|
99
|
+
defaultMessage: "package.json not found in the project",
|
|
100
|
+
defaultDetails: "A package.json must exist in the project root directory.",
|
|
101
|
+
suggestedAction: "Run this command from the project root, or restore package.json.",
|
|
102
|
+
},
|
|
103
|
+
[ERROR_CODES.PREFLIGHT_PACKAGE_JSON_INVALID]: {
|
|
104
|
+
category: "PREFLIGHT",
|
|
105
|
+
defaultMessage: "package.json should be defined in project root directory",
|
|
106
|
+
defaultDetails: "package.json exists but could not be parsed as an object.",
|
|
107
|
+
suggestedAction: "Check package.json for valid JSON syntax.",
|
|
108
|
+
},
|
|
109
|
+
[ERROR_CODES.PREFLIGHT_MODULE_ALIAS_MISSING]: {
|
|
110
|
+
category: "PREFLIGHT",
|
|
111
|
+
defaultMessage: "moduleAliases not found in package.json",
|
|
112
|
+
defaultDetails: "package.json must export a moduleAliases object.",
|
|
113
|
+
suggestedAction: "Add a moduleAliases object to package.json.",
|
|
114
|
+
},
|
|
115
|
+
[ERROR_CODES.PREFLIGHT_MODULE_ALIAS_NOT_OBJECT]: {
|
|
116
|
+
category: "PREFLIGHT",
|
|
117
|
+
defaultMessage: "moduleAliases named object should be exported from package.json",
|
|
118
|
+
defaultDetails: "moduleAliases was found in package.json but is not an object.",
|
|
119
|
+
suggestedAction: "Ensure moduleAliases is exported as an object in package.json.",
|
|
120
|
+
},
|
|
121
|
+
[ERROR_CODES.PREFLIGHT_MODULE_ALIAS_RESTRICTED]: {
|
|
122
|
+
category: "PREFLIGHT",
|
|
123
|
+
defaultMessage: "catalyst keyword is restricted for defining aliases",
|
|
124
|
+
defaultDetails: "Module alias keys containing 'catalyst' are reserved by the framework.",
|
|
125
|
+
suggestedAction: "Rename the alias to something that does not contain 'catalyst'.",
|
|
126
|
+
},
|
|
127
|
+
[ERROR_CODES.PREFLIGHT_MODULE_ALIAS_KEY_MISSING]: {
|
|
128
|
+
category: "PREFLIGHT",
|
|
129
|
+
defaultMessage: "required module alias not defined inside package.json",
|
|
130
|
+
defaultDetails: "One or more required module aliases are missing from moduleAliases.",
|
|
131
|
+
suggestedAction: "Add the missing alias to the moduleAliases object in package.json.",
|
|
132
|
+
},
|
|
133
|
+
[ERROR_CODES.PREFLIGHT_PRE_SERVER_INIT_MISSING]: {
|
|
134
|
+
category: "PREFLIGHT",
|
|
135
|
+
defaultMessage: "preServerInit named function should be defined in server/index.js",
|
|
136
|
+
defaultDetails: "server/index.js must export a preServerInit function.",
|
|
137
|
+
suggestedAction: "Export a preServerInit function from server/index.js, or remove the reference to it.",
|
|
138
|
+
},
|
|
139
|
+
[ERROR_CODES.PREFLIGHT_PRE_SERVER_INIT_NOT_FUNCTION]: {
|
|
140
|
+
category: "PREFLIGHT",
|
|
141
|
+
defaultMessage: "preServerInit should be a function present in server/index.js",
|
|
142
|
+
defaultDetails: "preServerInit was found but is not a function.",
|
|
143
|
+
suggestedAction: "Ensure preServerInit is exported as a function.",
|
|
144
|
+
},
|
|
145
|
+
[ERROR_CODES.PREFLIGHT_MIDDLEWARE_MISSING]: {
|
|
146
|
+
category: "PREFLIGHT",
|
|
147
|
+
defaultMessage: "addMiddlewares named function not found in server/server.js",
|
|
148
|
+
defaultDetails: "server/server.js must export an addMiddlewares function.",
|
|
149
|
+
suggestedAction: "Export an addMiddlewares function from server/server.js.",
|
|
150
|
+
},
|
|
151
|
+
[ERROR_CODES.PREFLIGHT_MIDDLEWARE_NOT_FUNCTION]: {
|
|
152
|
+
category: "PREFLIGHT",
|
|
153
|
+
defaultMessage: "addMiddlewares should be a function present in server/server.js",
|
|
154
|
+
defaultDetails: "addMiddlewares was found but is not a function.",
|
|
155
|
+
suggestedAction: "Ensure addMiddlewares is exported as a function.",
|
|
156
|
+
},
|
|
157
|
+
[ERROR_CODES.PREFLIGHT_REDUCER_MISSING]: {
|
|
158
|
+
category: "PREFLIGHT",
|
|
159
|
+
defaultMessage: "reducer not found in src/js/containers/App/reducer",
|
|
160
|
+
defaultDetails: "A reducer must be exported from src/js/containers/App/reducer.",
|
|
161
|
+
suggestedAction: "Export a reducer from src/js/containers/App/reducer.",
|
|
162
|
+
},
|
|
163
|
+
[ERROR_CODES.PREFLIGHT_REDUCER_NOT_FUNCTION]: {
|
|
164
|
+
category: "PREFLIGHT",
|
|
165
|
+
defaultMessage: "reducer should be present in src/js/containers/App/reducer",
|
|
166
|
+
defaultDetails: "The reducer export was found but is not a function.",
|
|
167
|
+
suggestedAction: "Ensure the reducer is exported as a function.",
|
|
168
|
+
},
|
|
169
|
+
[ERROR_CODES.PREFLIGHT_CONFIGURE_STORE_MISSING]: {
|
|
170
|
+
category: "PREFLIGHT",
|
|
171
|
+
defaultMessage: "configureStore not found in file src/js/store/index.js",
|
|
172
|
+
defaultDetails: "src/js/store/index.js must export a configureStore function.",
|
|
173
|
+
suggestedAction: "Export a configureStore function from src/js/store/index.js.",
|
|
174
|
+
},
|
|
175
|
+
[ERROR_CODES.PREFLIGHT_CONFIGURE_STORE_NOT_FUNCTION]: {
|
|
176
|
+
category: "PREFLIGHT",
|
|
177
|
+
defaultMessage: "configureStore should be a function exported from src/js/store/index.js",
|
|
178
|
+
defaultDetails: "configureStore was found but is not a function.",
|
|
179
|
+
suggestedAction: "Ensure configureStore is exported as a function.",
|
|
180
|
+
},
|
|
181
|
+
[ERROR_CODES.PREFLIGHT_GET_ROUTES_MISSING]: {
|
|
182
|
+
category: "PREFLIGHT",
|
|
183
|
+
defaultMessage: "getRoutes not found in file src/js/routes/utils.js",
|
|
184
|
+
defaultDetails: "src/js/routes/utils.js must export a getRoutes function.",
|
|
185
|
+
suggestedAction: "Export a getRoutes function from src/js/routes/utils.js.",
|
|
186
|
+
},
|
|
187
|
+
[ERROR_CODES.PREFLIGHT_GET_ROUTES_NOT_FUNCTION]: {
|
|
188
|
+
category: "PREFLIGHT",
|
|
189
|
+
defaultMessage: "getRoutes should be a function exported from src/js/routers/index.js",
|
|
190
|
+
defaultDetails: "getRoutes was found but is not a function.",
|
|
191
|
+
suggestedAction: "Ensure getRoutes is exported as a function.",
|
|
192
|
+
},
|
|
193
|
+
[ERROR_CODES.PREFLIGHT_CUSTOM_DOCUMENT_MISSING]: {
|
|
194
|
+
category: "PREFLIGHT",
|
|
195
|
+
defaultMessage: "document not found in file server/document.js",
|
|
196
|
+
defaultDetails: "server/document.js must export a document component.",
|
|
197
|
+
suggestedAction: "Export a document React component from server/document.js.",
|
|
198
|
+
},
|
|
199
|
+
[ERROR_CODES.PREFLIGHT_CUSTOM_DOCUMENT_NOT_FUNCTION]: {
|
|
200
|
+
category: "PREFLIGHT",
|
|
201
|
+
defaultMessage: "document should be a react component exported from server/document.js",
|
|
202
|
+
defaultDetails: "document was found but is not a function/component.",
|
|
203
|
+
suggestedAction: "Ensure document is exported as a React component (function).",
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
[ERROR_CODES.PROCESS_SERVER_INIT_FAILED]: {
|
|
207
|
+
category: "PROCESS",
|
|
208
|
+
defaultMessage: "preServerInit threw an error during server startup",
|
|
209
|
+
defaultDetails:
|
|
210
|
+
"The preServerInit hook failed. Note: server startup currently continues despite this error (tracked separately as a fix — see issue #298); this code only identifies which hook failed.",
|
|
211
|
+
suggestedAction: "Fix the error thrown inside your preServerInit hook (see the cause above).",
|
|
212
|
+
},
|
|
213
|
+
[ERROR_CODES.PROCESS_USER_HOOK_FAILED]: {
|
|
214
|
+
category: "PROCESS",
|
|
215
|
+
defaultMessage: "A user-defined hook threw an error",
|
|
216
|
+
defaultDetails:
|
|
217
|
+
"A user-defined hook (e.g. onRouteMatch, onFetcherError, onServerError) threw. It was caught so the SSR pipeline keeps running; see the cause above for which hook and why.",
|
|
218
|
+
suggestedAction: "Fix the error thrown inside the hook (see the cause above).",
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
[ERROR_CODES.BUNDLE_UPSTREAM_ERROR]: {
|
|
222
|
+
category: "BUNDLE",
|
|
223
|
+
defaultMessage: "Build failed in an upstream bundler step",
|
|
224
|
+
defaultDetails:
|
|
225
|
+
"This is a wrapper around an error from Vite/Rollup or another upstream build tool. See the printed upstream code/message for the actual cause — catalyst-core does not reinterpret it.",
|
|
226
|
+
suggestedAction: "Read the upstream error message/code printed above and fix the underlying issue.",
|
|
227
|
+
},
|
|
228
|
+
[ERROR_CODES.IOS_UPSTREAM_ERROR]: {
|
|
229
|
+
category: "IOS",
|
|
230
|
+
defaultMessage: "iOS build failed in an upstream toolchain step",
|
|
231
|
+
defaultDetails: "This wraps an error from Xcode/CocoaPods. See the printed upstream output for the cause.",
|
|
232
|
+
suggestedAction: "Read the upstream Xcode/CocoaPods error printed above and fix the underlying issue.",
|
|
233
|
+
},
|
|
234
|
+
[ERROR_CODES.ANDROID_UPSTREAM_ERROR]: {
|
|
235
|
+
category: "ANDROID",
|
|
236
|
+
defaultMessage: "Android build failed in an upstream toolchain step",
|
|
237
|
+
defaultDetails: "This wraps an error from Gradle. See the printed upstream output for the cause.",
|
|
238
|
+
suggestedAction: "Read the upstream Gradle error printed above and fix the underlying issue.",
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
[ERROR_CODES.RUNTIME_NATIVE_PERMISSION_DENIED]: {
|
|
242
|
+
category: "RUNTIME-NATIVE",
|
|
243
|
+
defaultMessage: "Permission denied",
|
|
244
|
+
defaultDetails: "Required permission was not granted by the user",
|
|
245
|
+
suggestedAction: "Grant permission in device settings and try again",
|
|
246
|
+
},
|
|
247
|
+
[ERROR_CODES.RUNTIME_NATIVE_PERMISSION_REQUIRED]: {
|
|
248
|
+
category: "RUNTIME-NATIVE",
|
|
249
|
+
defaultMessage: "Permission required",
|
|
250
|
+
defaultDetails: "This operation requires additional permissions",
|
|
251
|
+
suggestedAction: "Grant the required permission to continue",
|
|
252
|
+
},
|
|
253
|
+
[ERROR_CODES.RUNTIME_NATIVE_NETWORK_UNAVAILABLE]: {
|
|
254
|
+
category: "RUNTIME-NATIVE",
|
|
255
|
+
defaultMessage: "No internet connection",
|
|
256
|
+
defaultDetails: "Network connection is required for this operation",
|
|
257
|
+
suggestedAction: "Check your internet connection and try again",
|
|
258
|
+
},
|
|
259
|
+
[ERROR_CODES.RUNTIME_NATIVE_DOWNLOAD_FAILED]: {
|
|
260
|
+
category: "RUNTIME-NATIVE",
|
|
261
|
+
defaultMessage: "Download failed",
|
|
262
|
+
defaultDetails: "The download could not be completed",
|
|
263
|
+
suggestedAction: "Check your connection and try again",
|
|
264
|
+
},
|
|
265
|
+
[ERROR_CODES.RUNTIME_NATIVE_FILE_NOT_FOUND]: {
|
|
266
|
+
category: "RUNTIME-NATIVE",
|
|
267
|
+
defaultMessage: "File not found",
|
|
268
|
+
defaultDetails: "The requested file could not be located",
|
|
269
|
+
suggestedAction: "The file may have been moved or deleted",
|
|
270
|
+
},
|
|
271
|
+
[ERROR_CODES.RUNTIME_NATIVE_FILE_TOO_LARGE]: {
|
|
272
|
+
category: "RUNTIME-NATIVE",
|
|
273
|
+
defaultMessage: "File too large",
|
|
274
|
+
defaultDetails: "File exceeds the maximum size limit",
|
|
275
|
+
suggestedAction: "Choose a smaller file or compress the current file",
|
|
276
|
+
},
|
|
277
|
+
[ERROR_CODES.RUNTIME_NATIVE_STORAGE_FULL]: {
|
|
278
|
+
category: "RUNTIME-NATIVE",
|
|
279
|
+
defaultMessage: "Storage full",
|
|
280
|
+
defaultDetails: "Device storage is full and cannot save the file",
|
|
281
|
+
suggestedAction: "Free up some storage space and try again",
|
|
282
|
+
},
|
|
283
|
+
[ERROR_CODES.RUNTIME_NATIVE_FILE_CORRUPTED]: {
|
|
284
|
+
category: "RUNTIME-NATIVE",
|
|
285
|
+
defaultMessage: "File corrupted",
|
|
286
|
+
defaultDetails: "The file could not be read or is corrupted",
|
|
287
|
+
suggestedAction: "Try selecting a different file",
|
|
288
|
+
},
|
|
289
|
+
[ERROR_CODES.RUNTIME_NATIVE_OPERATION_CANCELLED]: {
|
|
290
|
+
category: "RUNTIME-NATIVE",
|
|
291
|
+
defaultMessage: "Operation cancelled",
|
|
292
|
+
defaultDetails: "The operation was cancelled by the user",
|
|
293
|
+
suggestedAction: "Try again if you want to complete the operation",
|
|
294
|
+
},
|
|
295
|
+
[ERROR_CODES.RUNTIME_NATIVE_NO_FILE_SELECTED]: {
|
|
296
|
+
category: "RUNTIME-NATIVE",
|
|
297
|
+
defaultMessage: "No file selected",
|
|
298
|
+
defaultDetails: "No file was selected by the user",
|
|
299
|
+
suggestedAction: "Select a file and try again",
|
|
300
|
+
},
|
|
301
|
+
[ERROR_CODES.RUNTIME_NATIVE_INVALID_FILE_TYPE]: {
|
|
302
|
+
category: "RUNTIME-NATIVE",
|
|
303
|
+
defaultMessage: "Invalid file type",
|
|
304
|
+
defaultDetails: "The selected file type is not supported",
|
|
305
|
+
suggestedAction: "Choose a file with a supported format",
|
|
306
|
+
},
|
|
307
|
+
[ERROR_CODES.RUNTIME_NATIVE_INVALID_PARAMETERS]: {
|
|
308
|
+
category: "RUNTIME-NATIVE",
|
|
309
|
+
defaultMessage: "Invalid parameters",
|
|
310
|
+
defaultDetails: "One or more parameters passed to the native call were invalid",
|
|
311
|
+
suggestedAction: "Check the parameters passed to the native API call",
|
|
312
|
+
},
|
|
313
|
+
[ERROR_CODES.RUNTIME_NATIVE_BRIDGE_UNAVAILABLE]: {
|
|
314
|
+
category: "RUNTIME-NATIVE",
|
|
315
|
+
defaultMessage: "Native feature unavailable",
|
|
316
|
+
defaultDetails: "The native bridge is not available or not initialized",
|
|
317
|
+
suggestedAction: "Use web fallback if available",
|
|
318
|
+
},
|
|
319
|
+
[ERROR_CODES.RUNTIME_NATIVE_FEATURE_UNSUPPORTED]: {
|
|
320
|
+
category: "RUNTIME-NATIVE",
|
|
321
|
+
defaultMessage: "Feature not supported",
|
|
322
|
+
defaultDetails: "This feature is not supported on the current platform",
|
|
323
|
+
suggestedAction: "Try using an alternative method or device",
|
|
324
|
+
},
|
|
325
|
+
[ERROR_CODES.RUNTIME_NATIVE_INTERNAL_ERROR]: {
|
|
326
|
+
category: "RUNTIME-NATIVE",
|
|
327
|
+
defaultMessage: "An unexpected error occurred",
|
|
328
|
+
defaultDetails: "An internal error occurred while processing the request",
|
|
329
|
+
suggestedAction: "Try again or contact support if the problem persists",
|
|
330
|
+
},
|
|
331
|
+
[ERROR_CODES.RUNTIME_NATIVE_CAMERA_UNAVAILABLE]: {
|
|
332
|
+
category: "RUNTIME-NATIVE",
|
|
333
|
+
defaultMessage: "Camera unavailable",
|
|
334
|
+
defaultDetails: "Camera hardware is not available or accessible",
|
|
335
|
+
suggestedAction: "Check if your device has a camera and try again",
|
|
336
|
+
},
|
|
337
|
+
[ERROR_CODES.RUNTIME_NATIVE_CAMERA_IN_USE]: {
|
|
338
|
+
category: "RUNTIME-NATIVE",
|
|
339
|
+
defaultMessage: "Camera in use",
|
|
340
|
+
defaultDetails: "Camera is being used by another application",
|
|
341
|
+
suggestedAction: "Close other camera apps and try again",
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
[ERROR_CODES.RUNTIME_NATIVE_BRIDGE_INVALID_CALLBACK]: {
|
|
345
|
+
category: "RUNTIME-NATIVE",
|
|
346
|
+
defaultMessage: "Invalid callback interface",
|
|
347
|
+
defaultDetails: "The native platform invoked WebBridge.callback() with an interface name that isn't recognized.",
|
|
348
|
+
suggestedAction: "Check the interface name against the registered NATIVE_CALLBACKS list; this usually indicates a native/JS version mismatch.",
|
|
349
|
+
},
|
|
350
|
+
[ERROR_CODES.RUNTIME_NATIVE_BRIDGE_HANDLER_NOT_REGISTERED]: {
|
|
351
|
+
category: "RUNTIME-NATIVE",
|
|
352
|
+
defaultMessage: "No handler registered for this bridge interface",
|
|
353
|
+
defaultDetails:
|
|
354
|
+
"Native sent a callback for this interface, but your webview hasn't registered a handler for it yet.",
|
|
355
|
+
suggestedAction: "Call WebBridge.register() for this interface before native calls arrive.",
|
|
356
|
+
},
|
|
357
|
+
[ERROR_CODES.RUNTIME_NATIVE_BRIDGE_HANDLER_THREW]: {
|
|
358
|
+
category: "RUNTIME-NATIVE",
|
|
359
|
+
defaultMessage: "A registered bridge callback handler threw",
|
|
360
|
+
defaultDetails: "The JS handler registered for this native callback interface threw an error while processing the callback.",
|
|
361
|
+
suggestedAction: "Fix the error thrown inside the registered handler (see the cause above).",
|
|
362
|
+
},
|
|
363
|
+
[ERROR_CODES.RUNTIME_NATIVE_BRIDGE_INVALID_REGISTRATION]: {
|
|
364
|
+
category: "RUNTIME-NATIVE",
|
|
365
|
+
defaultMessage: "Invalid bridge callback registration",
|
|
366
|
+
defaultDetails: "WebBridge.register() was called with a non-function callback or an unrecognized interface name.",
|
|
367
|
+
suggestedAction: "Pass a function as the callback and a valid interface name from NATIVE_CALLBACKS.",
|
|
368
|
+
},
|
|
369
|
+
[ERROR_CODES.RUNTIME_NATIVE_BRIDGE_INIT_FAILED]: {
|
|
370
|
+
category: "RUNTIME-NATIVE",
|
|
371
|
+
defaultMessage: "WebBridge could not be initialized",
|
|
372
|
+
defaultDetails: "WebBridge.init() was called outside a browser environment (no `window` available).",
|
|
373
|
+
suggestedAction: "Call WebBridge.init() in a browser environment, before using bridge features.",
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
[ERROR_CODES.AI_UPSTREAM_ERROR]: {
|
|
377
|
+
category: "AI",
|
|
378
|
+
defaultMessage: "AI provider request failed",
|
|
379
|
+
defaultDetails:
|
|
380
|
+
"This is a wrapper around a non-2xx response or thrown error from the upstream AI provider (OpenAI/Gemini). See the printed upstream status/message for the actual cause — catalyst-ai does not reinterpret it.",
|
|
381
|
+
suggestedAction: "Read the upstream provider error printed above and fix the underlying issue (auth, rate limit, invalid request).",
|
|
382
|
+
},
|
|
383
|
+
[ERROR_CODES.AI_DISABLED]: {
|
|
384
|
+
category: "AI",
|
|
385
|
+
defaultMessage: "AI is disabled",
|
|
386
|
+
defaultDetails: "AI_CONFIG.enabled is not set to true.",
|
|
387
|
+
suggestedAction: "Set AI_CONFIG.enabled=true in your environment configuration.",
|
|
388
|
+
},
|
|
389
|
+
[ERROR_CODES.AI_PROVIDER_NOT_CONFIGURED]: {
|
|
390
|
+
category: "AI",
|
|
391
|
+
defaultMessage: "AI provider not configured",
|
|
392
|
+
defaultDetails: "The requested provider is unknown, or has no apiKey configured in AI_CONFIG.providers.",
|
|
393
|
+
suggestedAction: "Add the provider's apiKey to AI_CONFIG.providers, or use a configured provider.",
|
|
394
|
+
},
|
|
395
|
+
[ERROR_CODES.AI_INVALID_REQUEST_BODY]: {
|
|
396
|
+
category: "AI",
|
|
397
|
+
defaultMessage: "Invalid AI request body",
|
|
398
|
+
defaultDetails: "The request body is missing a non-empty messages array, or no model could be resolved.",
|
|
399
|
+
suggestedAction: "Pass a non-empty messages array, and either a model or a provider defaultModel.",
|
|
400
|
+
},
|
|
401
|
+
[ERROR_CODES.AI_NATIVE_BRIDGE_UNAVAILABLE]: {
|
|
402
|
+
category: "AI",
|
|
403
|
+
defaultMessage: "Native AI bridge unavailable",
|
|
404
|
+
defaultDetails: "window.NativeBridge.initAI or window.WebBridge was not found when useNativeAI mounted.",
|
|
405
|
+
suggestedAction: "Update catalyst-core to >=0.2.0, add the native AI module, and call WebBridge.init() before mounting useNativeAI.",
|
|
406
|
+
},
|
|
407
|
+
[ERROR_CODES.AI_NATIVE_STREAM_NOT_READY]: {
|
|
408
|
+
category: "AI",
|
|
409
|
+
defaultMessage: "Native AI stream not ready",
|
|
410
|
+
defaultDetails: "generate() was called before the native side reported a ready stream URL (initAI has not fired ON_AI_READY yet).",
|
|
411
|
+
suggestedAction: "Wait for modelReady to become true before calling generate().",
|
|
412
|
+
},
|
|
413
|
+
[ERROR_CODES.AI_NATIVE_REQUEST_FAILED]: {
|
|
414
|
+
category: "AI",
|
|
415
|
+
defaultMessage: "Native AI request failed",
|
|
416
|
+
defaultDetails: "The native AI HTTP endpoint returned a non-ok status or reported an error in its response body.",
|
|
417
|
+
suggestedAction: "See the cause above for the native-reported status/message.",
|
|
418
|
+
},
|
|
419
|
+
[ERROR_CODES.AI_NATIVE_CALLBACK_ERROR]: {
|
|
420
|
+
category: "AI",
|
|
421
|
+
defaultMessage: "Native AI reported an error",
|
|
422
|
+
defaultDetails:
|
|
423
|
+
"The native platform invoked ON_AI_ERROR — a failure during model load, init, or inference on the native side, not an HTTP request made by this JS code.",
|
|
424
|
+
suggestedAction: "See the cause above for the native-reported message.",
|
|
425
|
+
},
|
|
426
|
+
[ERROR_CODES.AI_WEB_WORKER_UNAVAILABLE]: {
|
|
427
|
+
category: "AI",
|
|
428
|
+
defaultMessage: "Web AI worker unavailable",
|
|
429
|
+
defaultDetails: "Constructing the module Worker for in-browser AI failed — module workers may be unsupported in this browser.",
|
|
430
|
+
suggestedAction: "Use a browser with module Worker support, or fall back to useCloudAI/useNativeAI.",
|
|
431
|
+
},
|
|
432
|
+
[ERROR_CODES.AI_WEB_WORKER_CRASHED]: {
|
|
433
|
+
category: "AI",
|
|
434
|
+
defaultMessage: "Web AI worker crashed",
|
|
435
|
+
defaultDetails:
|
|
436
|
+
"The in-browser AI worker threw during model load or generation (e.g. all device backends failed, or an uncaught exception). See the cause above for the worker's reported message.",
|
|
437
|
+
suggestedAction: "Check that the model is compatible with this browser/device, or use useCloudAI/useNativeAI instead.",
|
|
438
|
+
},
|
|
439
|
+
|
|
440
|
+
[ERROR_CODES.RUNTIME_WEB_RENDER_FAILED]: {
|
|
441
|
+
category: "RUNTIME-WEB",
|
|
442
|
+
defaultMessage: "Rendering failed on the server",
|
|
443
|
+
defaultDetails:
|
|
444
|
+
"An error was thrown while streaming or rendering the document on the server. This may originate from app code, a third-party dependency, or catalyst-core itself — see the cause above for the actual error.",
|
|
445
|
+
suggestedAction: "See the cause above for the error thrown during rendering.",
|
|
446
|
+
},
|
|
447
|
+
[ERROR_CODES.RUNTIME_WEB_FETCHER_FAILED]: {
|
|
448
|
+
category: "RUNTIME-WEB",
|
|
449
|
+
defaultMessage: "serverFetcher failed",
|
|
450
|
+
defaultDetails:
|
|
451
|
+
"An error was thrown while executing a route's serverFetcher function(s). This may originate from app code, a third-party dependency, or catalyst-core itself — see the cause above for the actual error.",
|
|
452
|
+
suggestedAction: "See the cause above for the error thrown inside serverFetcher.",
|
|
453
|
+
},
|
|
454
|
+
[ERROR_CODES.RUNTIME_WEB_SERVER_SIDE_FUNCTION_FAILED]: {
|
|
455
|
+
category: "RUNTIME-WEB",
|
|
456
|
+
defaultMessage: "App.serverSideFunction failed",
|
|
457
|
+
defaultDetails:
|
|
458
|
+
"An error was thrown while executing the app-level serverSideFunction hook. This may originate from app code, a third-party dependency, or catalyst-core itself — see the cause above for the actual error.",
|
|
459
|
+
suggestedAction: "See the cause above for the error thrown inside serverSideFunction.",
|
|
460
|
+
},
|
|
461
|
+
[ERROR_CODES.RUNTIME_WEB_REQUEST_HANDLING_FAILED]: {
|
|
462
|
+
category: "RUNTIME-WEB",
|
|
463
|
+
defaultMessage: "Failed to handle document request",
|
|
464
|
+
defaultDetails:
|
|
465
|
+
"An unhandled error reached the top level of the SSR request handler. This may originate from app code, a third-party dependency, or catalyst-core itself — see the cause above for the actual error.",
|
|
466
|
+
suggestedAction: "See the cause above for the underlying error.",
|
|
467
|
+
},
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export function getDefinition(code) {
|
|
471
|
+
if (ERROR_DEFINITIONS[code]) return ERROR_DEFINITIONS[code]
|
|
472
|
+
// Fall back to a generic definition for unrecognized codes, but never
|
|
473
|
+
// inherit the fallback's own category — that would mislabel an unknown
|
|
474
|
+
// code as RUNTIME-NATIVE in verbose/debug output, which is misleading
|
|
475
|
+
// rather than merely imprecise.
|
|
476
|
+
return { ...ERROR_DEFINITIONS[ERROR_CODES.RUNTIME_NATIVE_INTERNAL_ERROR], category: "UNKNOWN" }
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export function getDocUrl(code) {
|
|
480
|
+
const def = ERROR_DEFINITIONS[code]
|
|
481
|
+
if (!def) return null
|
|
482
|
+
return `${REPO_BLOB_BASE}/${def.category}/${code}.md`
|
|
483
|
+
}
|