import { Observable, Subject } from 'rxjs'; import { AnyVirtualDOM } from '@youwol/rx-vdom'; import { Scope } from './state'; /** * Represents the minimal required interface from a backend's client provided by py-youwol. */ export interface BackendClient { /** * Standard `fetch` transformed to json. * * @param url URL. * @param options Fetch options. */ fetchJson(url: string, options: unknown): Promise; /** * Rxjs `fromFetch` transformed to json. * * @param url URL. * @param options Fetch options. */ fromFetchJson(url: string, options: unknown): Observable; } /** * Represents the body of the `/run` endpoint. */ export interface RunBody { /** * ID of the cell run. */ cellId: string; /** * IDs of the previous cell running in the same interpreter, it allows recovering the proper scope. */ previousCellIds: string[]; /** * The code to run. */ code: string; /** * Input variables to capture: * * keys are variable's name * * values are their associated value, they must be serializable as JSON object. */ capturedIn: { [k: string]: unknown; }; /** * Output variables to capture. */ capturedOut: string[]; } /** * Represents the response of the `/run` endpoint. */ export interface RunResponse { /** * Output variables captured: * * keys are variable's name * * values are their associated value, they must be serializable as JSON object. */ capturedOut: { [k: string]: unknown; }; /** * Error if any. */ error: string; /** * Standard output generated during the run. */ output: string; } export declare function executeInterpreter({ body, interpreter, scope, output$, }: { body: RunBody; interpreter: BackendClient; scope: Scope; output$: Subject; }): Promise<{ const: { [x: string]: unknown; }; let: { [k: string]: unknown; }; python: { [k: string]: unknown; }; }>; export declare function executeInterpreter$({ body, interpreter, scope, output$, invalidated$, }: { body: RunBody; interpreter: BackendClient; scope: Scope; output$: Subject; invalidated$: Observable; }): { const: {}; let: { [k: string]: unknown; }; python: { [k: string]: unknown; }; };