import type { Command } from "./types"; /** * Type-safe helper to create a command definition. * * @param command The command definition * @returns The command object */ export function createCommand(command: Command): Command { return command; } /** * JSON Replacer function for serialization * Handles safe serialization of BigInt values to strings */ export const jsonReplacer = (_key: string, value: unknown): unknown => { if (typeof value === 'bigint') { return value.toString(); } return value; }; /** * Deep merge utility */ export function deepMerge(target: any, source: any): any { if (typeof target !== 'object' || target === null) { return source; } if (typeof source !== 'object' || source === null) { return source; } const output = { ...target }; Object.keys(source).forEach(key => { if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) { if (!(key in target)) { Object.assign(output, { [key]: source[key] }); } else { output[key] = deepMerge(target[key], source[key]); } } else { Object.assign(output, { [key]: source[key] }); } }); return output; }