appium-remote-debugger
Version:
Appium proxy for Remote Debugger protocol
82 lines • 3.84 kB
TypeScript
import _ from 'lodash';
import type { StringRecord } from '@appium/types';
import type { AppInfo, AppDict, Page } from './types';
export declare const WEB_CONTENT_BUNDLE_ID = "com.apple.WebKit.WebContent";
export declare const RESPONSE_LOG_LENGTH = 100;
/**
* Takes a dictionary from the remote debugger and converts it into a more
* manageable AppInfo object with understandable keys.
*
* @param dict - Dictionary from the remote debugger containing application information.
* @returns A tuple containing the application ID and the AppInfo object.
*/
export declare function appInfoFromDict(dict: Record<string, any>): [string, AppInfo];
/**
* Takes a dictionary from the remote debugger and converts it into an array
* of Page objects with understandable keys. Filters out non-web pages.
*
* @param pageDict - Dictionary from the remote debugger containing page information.
* @returns An array of Page objects representing the available pages.
*/
export declare function pageArrayFromDict(pageDict: StringRecord): Page[];
/**
* Finds all application identifier keys that match the given bundle ID.
* If no matches are found and the bundle ID is not WEB_CONTENT_BUNDLE_ID,
* falls back to searching for WEB_CONTENT_BUNDLE_ID.
*
* @param bundleId - The bundle identifier to search for.
* @param appDict - The application dictionary to search in.
* @returns An array of unique application identifier keys matching the bundle ID.
*/
export declare function appIdsForBundle(bundleId: string, appDict: AppDict): string[];
/**
* Validates that all parameters in the provided object have non-nil values.
* Throws an error if any parameters are missing (null or undefined).
*
* @template T - The type of the parameters object.
* @param params - An object containing parameters to validate.
* @returns The same parameters object if all values are valid.
* @throws Error if any parameters are missing, listing all missing parameter names.
*/
export declare function checkParams<T extends StringRecord>(params: T): T;
/**
* Converts a value to a JSON string, removing noisy function properties
* that can muddy the logs.
*
* @param value - The value to stringify.
* @param multiline - If true, formats the JSON with indentation. Defaults to false.
* @returns A JSON string representation of the value with noisy properties removed.
*/
export declare function simpleStringify(value: any, multiline?: boolean): string;
/**
* Converts the result from a JavaScript evaluation in the remote debugger
* into a usable format. Handles errors, serialization, and cleans up noisy
* function properties.
*
* @param res - The raw result from the remote debugger's JavaScript evaluation.
* @returns The cleaned and converted result value.
* @throws Error if the result is undefined, has an unexpected type, or contains
* an error status code.
*/
export declare function convertJavascriptEvaluationResult(res: any): any;
/**
* Calculates the path to the current module's root folder.
* The result is memoized for performance.
*
* @returns The full path to the module root directory.
* @throws Error if the module root folder cannot be determined.
*/
export declare const getModuleRoot: (() => string) & _.MemoizedFunction;
/**
* Reads and parses the package.json file from the module root.
*
* @returns The parsed package.json contents as a StringRecord.
*/
export declare function getModuleProperties(): StringRecord;
/**
* Determines if the WebInspector shim can be used based on the provided iOS platform version.
* @param platformVersion - The iOS platform version string (e.g., "18.0", "17.5.1")
* @returns true if the WebInspector shim can be used, false otherwise
*/
export declare function canUseWebInspectorShim(platformVersion: string): boolean;
//# sourceMappingURL=utils.d.ts.map