@datalayer/core
Version:
[](https://datalayer.io)
106 lines (105 loc) • 2.94 kB
TypeScript
/**
* Runtime snippets.
*/
export interface IRuntimeSnippets {
/**
* Code snippet to change the current working directory.
*
* @param path New current directory
* @returns The code snippet
*/
changeCurrentWorkingDirectory(path: string): string;
/**
* Code snippet to list the transferable kernel variables.
*
* @returns The code snippet
*/
listVariables(): string;
/**
* Code snippet to load kernel variables.
*
* @param variables Serialized-JSON dictionary (<variable name>, <variable value blob>)
* @returns The code snippet
*/
loadVariables(variables: string): string;
/**
* Code snippet to save kernel variables.
*
* @param variables Variable names.
* @returns The code snippet
*/
saveVariables(variables: string[]): string;
/**
* Extract output variables candidates by parsing the cell content.
*
* @param code Cell code source
* @returns The output variable candidates
*/
getOutputCandidates(code: string): string[];
}
/**
* Facade to interact with kernels by requesting code execution.
*/
export declare class RuntimeSnippetsFacade {
private static $language;
/**
* Register a facade for a given language
*
* @param language Kernel language
* @param API Kernel API
*/
static register(language: string, API: IRuntimeSnippets): void;
/**
* Whether there is an API for the given kernel language
*
* @param language Kernel language
*/
static supports(language: string): boolean;
private _language;
/**
* Create a kernel snippet generator for a given kernel language.
*
* @param language Kernel language
*/
constructor(language: string);
/**
* Kernel language
*/
get language(): string;
/**
* Code snippet to change the current working directory.
*
* The code snippet has no returned value.
*
* @param path New current directory
* @returns The code snippet
*/
changeCurrentWorkingDirectory(path: string): string;
/**
* Code snippet to list the transferable kernel variables.
*
* @returns The code snippet
*/
listVariables(): string;
/**
* Code snippet to load kernel variables.
*
* @param variables Serialized-JSON dictionary (<variable name>, <variable value blob>)
* @returns The code snippet
*/
loadVariables(variables: string): string;
/**
* Code snippet to save kernel variables.
*
* @param variables Variable names.
* @returns The code snippet
*/
saveVariables(variables: string[]): string;
/**
* Extract output variables candidates by parsing the cell content.
*
* @param code Cell code source
* @returns The output variable candidates
*/
getOutputCandidates(code: string): string[];
}