LCOV - code coverage report
Current view: top level - dashql-app/src/platform/hyperdb - hyperdb_web_support.ts Coverage Total Hit
Test: DashQL 915828b Lines: 100.0 % 22 22
Test Date: 2026-11-06 19:30:32

            Line data    Source code
       1              : export interface HyperDBWebCapabilities {
       2              :     readonly crossOriginIsolated: boolean;
       3              :     readonly hasSharedArrayBuffer: boolean;
       4              :     readonly maxTouchPoints: number;
       5              :     readonly platform: string;
       6              :     readonly userAgent: string;
       7              : }
       8              : 
       9            1 : function readWebCapabilities(): HyperDBWebCapabilities {
      10            1 :     return {
      11            1 :         crossOriginIsolated: globalThis.crossOriginIsolated === true,
      12            1 :         hasSharedArrayBuffer: typeof SharedArrayBuffer !== 'undefined',
      13            1 :         maxTouchPoints: navigator.maxTouchPoints,
      14            1 :         platform: navigator.platform,
      15            1 :         userAgent: navigator.userAgent,
      16            1 :     };
      17            1 : }
      18              : 
      19            1 : export function isIOS(capabilities: HyperDBWebCapabilities): boolean {
      20            1 :     return /iPad|iPhone|iPod/.test(capabilities.userAgent)
      21            1 :         || (capabilities.platform === 'MacIntel' && capabilities.maxTouchPoints > 1);
      22            1 : }
      23              : 
      24            1 : export function getHyperDBWebSupportError(
      25            1 :     capabilities: HyperDBWebCapabilities = readWebCapabilities(),
      26            1 : ): string | null {
      27            1 :     if (isIOS(capabilities)) {
      28            1 :         return 'HyperDB is not supported on iOS browsers. Open this shell from a desktop browser instead.';
      29              :     }
      30            1 :     if (!capabilities.hasSharedArrayBuffer || !capabilities.crossOriginIsolated) {
      31            1 :         return 'HyperDB requires SharedArrayBuffer and a cross-origin-isolated page.';
      32              :     }
      33            1 :     return null;
      34            1 : }
        

Generated by: LCOV version 2.0-1