import type * as d from '../../declarations' ; export const tryFn = async < T extends ( ... args : any [ ] ) => Promise < R > , R > ( fn , ... args ) : Promise < R | null > => { try { return await fn ( ... args ) ; } catch { } return null ; } ; export declare const TERMINAL_INFO ; export const isInteractive = ( sys , config , object ? ) : boolean => { const terminalInfo = object || Object . freeze ( { tty : sys . isTTY ( ) ? true : false , ci : [ 'CI' , 'BUILD_ID' , 'BUILD_NUMBER' , 'BITBUCKET_COMMIT' , 'CODEBUILD_BUILD_ARN' ] . filter ( ( v ) => ! ! sys . getEnvironmentVar ( v ) ) . length > 0 || ! ! config . flags ?. ci , } ) ; return terminalInfo . tty && ! terminalInfo . ci ; } ; export const UUID_REGEX = new RegExp ( /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i ) ; export function uuidv4 ( ) { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' . replace ( /[xy]/g , ( c ) => { const r = ( Math . random ( ) * 16 ) | 0 ; const v = c == 'x' ? r : ( r & 0x3 ) | 0x8 ; return v . toString ( 16 ) ; } ) ; } param sys param path returns export async function readJson ( sys , path ) { const file = await sys . readFile ( path ) ; return ! ! file && JSON . parse ( file ) ; } param config returns export function hasDebug ( config ) { return config . flags . debug ; } param config returns export function hasVerbose ( config ) { return config . flags . verbose && hasDebug ( config ) ; }