/** * This is the variable id that is used to identify a variable in the var lookup */ export interface IVarId { /** * The id of the variable will reference the full data in the var lookup */ id: number; /** * The name used for this variable at this point in the code, multiple names can be * used of the the same variable id in the var cache */ name: string; /** * The string value of the variable, this is optional and really only used for watchers. */ value?: string; } /** * This indicates that the type supports having flags attached to it. * * A full list of currently expected flags is here: https://gitlab.com/groups/intergral/nerdvision/-/wikis/Tracepoints/Variable-Flags */ export interface IFlagable { /** * A list of flags that indicate various scenarios */ flags?: string[]; } /** * This is a variable that is defined within the var lookup, this extends the IVarId to include the first seen name and the id. * * This type is flagable to indicate truncation, list truncation, depth or redaction */ export interface IVariable extends IVarId, IFlagable { /** * The string representation of the type, e.g. 'Map' or 'String' * * This is normally the class name of the object. */ type: string; /** * This is a string representation of the object, e.g. '1', 'Ben Donnelly', 'undefined' all values * are converted to string, use the type to determine the type at the point of collection. */ value: string; /** * This is the hash of the object, this is primarily of use in Java/Python, node does * not really have global object ids, so this is less useful. However using the debugger * apis we are exposed the object id at the time of collection. This can change depending * on the script location as well (e.g. the stack frame). We send this object id hashed to * obfuscate any data. For non object values (that do not have an object id) we hash the value. */ hash: string; /** * This is a list of children of this variable, using the var ids, requiring them to be looked up in the var lookup */ children?: IVarId[]; } /** * This is the representation of a frame, from either an error or a tracepoint. */ export interface IFrame { /** * This is the full path of the file where the line of code is paused. */ filename: string; /** * This is the method or function name that is being called. */ methodname: string; /** * This is the line number where the program is paused. */ linenumber: number; /** * The class name of where the function is defined, if there is no class then the file name is used. */ classname?: string; /** * This indicates that the frame is an async frame */ async?: boolean; /** * This is the column number for the line, primarily used in node. */ columnnumber?: number; /** * The name of the transpiled file. If we have mappings available we can map the file 'something.js' to the * original typescript. This will be the transpiled file name e.g. something.js */ transpiledFileName?: string; /** * The transpiled line number */ transpiledLineNumber?: number; /** * The transpiled column number */ transpiledColumnNumber?: number; } /** * This is a stack frame from the point the tracepoint was triggered. */ export interface IStackFrame extends IFrame { /** * This is an optional value that is used primarily in Java/CF to change the file name in cases * on native of CFML code. Can be used by node to apply code mappings to change js to ts files */ file_override?: string; /** * This is the list of variables (using var ids) that are present at this point in the code. */ variables?: IVarId[]; /** * This indicates if the frame should be hidden by default. This is used to hide frames from intermediate processing steps. * Such as Java frames in a CF application. */ hidden?: boolean; } /** * This represents the result of a watch statement */ export interface IWatcherResult { /** * This is the list of variable results from the watch statement, although this is a * list we only support a single response in the UI e.g. variables[0]. * * All other response in the list are ignored currently. */ variables: IVarId[]; /** * This is the expression that was entered by the user to trigger the result */ expression: string; /** * This is the name of the watcher, this is here to match to the exact expression entered, although it is not used. */ name: string; } /** * This is the tracepoint that triggered the snapshot, and represents the tracepoint received form the NV services. * * NOTE: the naming between breakpoint and tracepoint * NOTE: named_watchers vs named_watches */ export interface IBreakpoint { /** * The id of the tracepoint */ breakpoint_id: string; /** * The id of the workspace this tracepoint was created in */ workspace_id: string; /** * This is the relative path from the repo root to the file we want to debug */ rel_path: string; /** * This is the line number we want to debug */ line_no: number; /** * This is the string expression that must be true to pause on the this tracepoint. */ condition: string; /** * This is the type of source the tracepoint originated from. * * @deprecated This is always 'JAVA' */ src_type: string; /** * This is the list of user configured watch statements, the key is the 'name' (a uuid) and the * value is the expression to evaluate when the tracepoint is paused. */ named_watchers: { [key: string]: string; }; /** * This is a collection of key value pairs that include additional configurations used by the client or apis. */ args: { [key: string]: string; }; /** * This is the maximum number of times this tracepoint should fire, if this is exceeded on other agents * it will be removed by the NV services. */ fire_count: number; /** * This is the type of breakpoint. These include: * * - 'stack' - collect all frames with variables * - 'frame' - collect all frames with variables only on the first frame * - 'log_point' - acts like a 'frame' and is for supporting old clients only * - 'no_frame' - collects no frames or variables, but includes watchers and logs * - 'trace' - collects the frames but no variables, includes watchers and logs * - 'profile' - acts like a 'trace' but starts a profile */ type: string; } /** * This is the data that is returned to the NV service on a completed data collection */ export interface IEventSnapshot extends IFlagable, IAttributable, ITaggable { /** * The version of the snapshot, only changed when breaking changes are needed. * * Current version: 2 */ version: number; /** * The full breakpoint that triggered the snapshot */ breakpoint: IBreakpoint; /** * The var lookup of any variables or watch data that is collected */ var_lookup: { [key: string]: IVariable; }; /** * The ts (ms epoch) when the tracepoint was collected */ ts: number; /** * The stack frames when the tracepoint was collected */ stacktrace: IStackFrame[]; /** * The watch results */ named_watches?: IWatcherResult[]; /** * The log messsage */ log_msg?: string; /** * The ts (ms epoch) when the line ended */ end_ts?: number; /** * This is the exception that happened on the line where the tracepoint was installed */ exception?: INVError; /** * This is the client generated id */ id?: string; } /** * This type indicates that object has optional attributes */ export interface IAttributable { /** * A set of attributes that are contributed to the snapshot from integrations, or decorators */ attributes?: Record>; } /** * This type indicates that object has optional tags */ export interface ITaggable { /** * A set of key value pairs that are used for indexing */ tags?: Record; } /** * This is the error that is capture. */ export interface INVError extends IAttributable, ITaggable { /** * The id of the error, this is made up of the type and location it was thrown from */ id: string; /** * This is the trace of the error */ trace: IFrame[]; /** * The type of the error. */ type: string; /** * The message that is part of the error */ message: string; /** * The time the error was reported */ timestamp: number; }