ProcessDebugService
import { ProcessDebugService } from "@skipcheck/tm1-client"; Process debugging: a run of a process that stops at breakpoints and steps line by line,
held on the server as a ProcessDebugContext until deleted.
debug starts one, paused before the first line; resume runs to the
next breakpoint (or the end), and the step… methods move a line at a time. Each
returns the context as it then is. TM1 (11.8) answers a start, a resume or a step
without waiting for the run to stop again, so the status is RUNNING or
PAUSED depending on which came first; get reads it again. A step past
a procedure's last line either pauses with an empty call stack or completes the run.
TM1 (11.8) refuses to delete a debug context: a run ends by running to completion,
which finish does, and debugging does when its work is done. A
finished context stays readable until the session ends. ProcessDebugContexts
lists none, though each reads by ID.
Stop at a breakpoint and see where the run is, with debugging finishing the
run afterwards:
// Where the run stops at a breakpoint on line 3 of the prolog. debugging() runs it to
// the end afterwards.
const debug = tm1.processDebugging;
return debug
.debugging("Load Sales", { pVersion: "Forecast" }, async function* (context) {
const id = context.ID!;
const line3 = ProcessDebugContextLineBreakpointPatch.builder()
.id(1) // TM1 needs an ID chosen by the caller
.processName("Load Sales")
.procedure(ProcessProcedure.Prolog)
.lineNumber(3)
.enabled(true)
.build();
await debug.addBreakpoint(id, line3);
await debug.resume(id);
for await (const frame of debug.callStack(id)) yield `${frame.Procedure}, line ${frame.LineNumber}`;
})
.toArray();
Step through a run started with debug, and finish it:
// Without debugging(), end the run with finish(): TM1 can't delete it
const debug = tm1.processDebugging;
const context = await debug.debug("Load Sales");
const id = context.ID!;
await debug.stepOver(id);
await debug.stepOver(id);
return debug.finish(id);
Members
debug | Starts debugging a process, with its parameters by name, in order; returns the debug context, with its ID. |
debugging | Debugs a process for the length of work (given the context. |
list | GET ProcessDebugContexts, streamed. |
get | The context, or a Tm1NotFoundException if there's none. |
finish | Runs a debug run to its end. |
resume | Runs to the next breakpoint, or to the end; the context, paused or complete. |
stepIn | Runs one line, into a process it calls. |
stepOut | Runs to the end of the current procedure or called process. |
stepOver | Runs one line, over any process it calls. |
breakpoints | GET …/Breakpoints, streamed, each as its kind (line, data or lock. |
addBreakpoint | Adds a breakpoint, its kind given by the patch (ProcessDebugContextLineBreakpointPatch, …Data…, …Lock…); returns it as created.The caller chooses the breakpoint's ID, 0 or more and unique in the context. |
updateBreakpoint | Changes a breakpoint, such as enabling or disabling it, with a patch of its kind. |
removeBreakpoint | DELETE …/Breakpoints(n). |
currentBreakpoint | The breakpoint the run is paused at, or undefined if it isn't paused at one. |
callStack | GET …/CallStack, streamed. |
variables | GET …/CallStack('frame')/Variables, streamed. |
frameProcess | The process the frame runs. |
process | The process being debugged. |
thread | The server thread running the debug run. |
debug
debug(process: string, parameters?: Tm1Map<unknown> | null, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ProcessDebugContext>tm1.Debug: starts debugging a process, with its parameters by name, in order; returns the debug context, with its ID.
TM1 REST Action Process/Debug
debugging
debugging<R>( process: string, parameters: Tm1Map<unknown> | null | undefined, work: (context: ProcessDebugContext) => ProcessDebugWork<R>, options?: Tm1CallOptions, ): Tm1Stream<R>Debugs a process for the length of work (given the context: set breakpoints, step, read variables), then finishes the run (finish): when the work completes, fails, or the stream is left early. TM1 (11.8) refuses to delete a debug context, so finishing it is how the run ends. Streams what the work gives, as Java's Flux: an async iterable's items, or a promise's value (nothing for undefined or null); .first() reads a single answer.
TM1 REST Action Process/Debug EntitySet ProcessDebugContexts
list
list(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ProcessDebugContext>GET ProcessDebugContexts, streamed. TM1 (11.8) lists none, though each reads by ID with get.
TM1 REST EntitySet ProcessDebugContexts
get
get(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ProcessDebugContext>GET ProcessDebugContexts('id'): the context, or a Tm1NotFoundException if there's none.
TM1 REST EntitySet ProcessDebugContexts
finish
finish(id: string, options?: Tm1CallOptions): Promise<ProcessDebugContext>Runs a debug run to its end: removes its breakpoints, then resumes until it's Complete (at most a hundred times). TM1 (11.8) refuses to delete a debug context, so finishing the run is how to end one; the context stays readable, complete, until the session ends. Returns the context as the last resume left it: complete, with the run's Result.
TM1 REST Action ProcessDebugContext/Continue Navigation ProcessDebugContext/Breakpoints
resume
resume(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ProcessDebugContext>tm1.Continue: runs to the next breakpoint, or to the end; the context, paused or complete.
TM1 REST Action ProcessDebugContext/Continue
stepIn
stepIn(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ProcessDebugContext>tm1.StepIn: runs one line, into a process it calls.
TM1 REST Action ProcessDebugContext/StepIn
stepOut
stepOut(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ProcessDebugContext>tm1.StepOut: runs to the end of the current procedure or called process.
TM1 REST Action ProcessDebugContext/StepOut
stepOver
stepOver(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ProcessDebugContext>tm1.StepOver: runs one line, over any process it calls.
TM1 REST Action ProcessDebugContext/StepOver
breakpoints
breakpoints(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ProcessDebugContextBreakpoint>GET …/Breakpoints, streamed, each as its kind (line, data or lock: typeOf).
TM1 REST Navigation ProcessDebugContext/Breakpoints
addBreakpoint
addBreakpoint(id: string, breakpoint: ProcessDebugContextBreakpointPatch, options?: Tm1CallOptions): Promise<ProcessDebugContextBreakpoint>POST …/Breakpoints: adds a breakpoint, its kind given by the patch (ProcessDebugContextLineBreakpointPatch, …Data…, …Lock…); returns it as created.
The caller chooses the breakpoint's ID, 0 or more and unique in the context: TM1 (11.8) stores one sent without an ID as -1, which it then refuses in a path, so it can't be changed or removed, and a second one without an ID conflicts (409).
Throws
- RangeError if the patch has no
IDof 0 or more
TM1 REST Navigation ProcessDebugContext/Breakpoints
updateBreakpoint
updateBreakpoint(id: string, breakpoint: number, patch: ProcessDebugContextBreakpointPatch, options?: Tm1CallOptions): Promise<void>PATCH …/Breakpoints(n): changes a breakpoint, such as enabling or disabling it, with a patch of its kind.
TM1 REST Navigation ProcessDebugContext/Breakpoints
removeBreakpoint
removeBreakpoint(id: string, breakpoint: number, options?: Tm1CallOptions): Promise<void>DELETE …/Breakpoints(n).
TM1 REST Navigation ProcessDebugContext/Breakpoints
currentBreakpoint
currentBreakpoint(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ProcessDebugContextBreakpoint | undefined>GET …/CurrentBreakpoint: the breakpoint the run is paused at, or undefined if it isn't paused at one.
TM1 REST Navigation ProcessDebugContext/CurrentBreakpoint
callStack
callStack(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ProcessDebugContextStackFrame>GET …/CallStack, streamed: where the run is, innermost frame first; query can expand Variables.
TM1 REST Navigation ProcessDebugContext/CallStack
variables
variables(id: string, frame: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ProcessDebugContextVariable>GET …/CallStack('frame')/Variables, streamed: the frame's variables and their values. TM1 (11.8) lists TurboIntegrator's own variables (NVALUE, DATASOURCE…), not the process's local ones.
TM1 REST Navigation ProcessDebugContextStackFrame/Variables
frameProcess
frameProcess(id: string, frame: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<Process>GET …/CallStack('frame')/Process: the process the frame runs.
TM1 REST Navigation ProcessDebugContextStackFrame/Process
process
process(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<Process>GET …/Process: the process being debugged.
TM1 REST Navigation ProcessDebugContext/Process
thread
thread(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<Thread>GET …/Thread: the server thread running the debug run.
TM1 REST Navigation ProcessDebugContext/Thread