@nteract/epics
Version:
Redux-Observable epics for nteract apps
90 lines (89 loc) • 3.9 kB
TypeScript
import { ImmutableNotebook } from "@nteract/commutable";
import { Channels } from "@nteract/messaging";
import { StateObservable } from "redux-observable";
import { Observable } from "rxjs";
import * as actions from "@nteract/actions";
import { AppState, ContentRef, KernelRef } from "@nteract/types";
/**
* Sets the execution state after a kernel has been launched.
*
* @oaram {ActionObservable} action$ ActionObservable for LAUNCH_KERNEL_SUCCESSFUL action
*/
export declare const watchExecutionStateEpic: (action$: Observable<actions.NewKernelAction | actions.KillKernelSuccessful>) => Observable<{
type: "EXECUTE_FAILED";
payload: import("@nteract/actions/lib/utils").MaybeHasContent & {
id?: string | undefined;
} & {
error: Error;
code?: string | undefined;
};
error: true;
} | {
type: "SET_EXECUTION_STATE";
payload: import("@nteract/actions/lib/utils").HasKernel & {
kernelStatus: string;
};
}>;
/**
* Send a kernel_info_request to the kernel.
*
* @param {Object} channels A object containing the kernel channels
* @returns {Observable} The reply from the server
*/
export declare function acquireKernelInfo(channels: Channels, kernelRef: KernelRef, contentRef: ContentRef, state: AppState, kernelSpecName?: string | null): any;
/**
* Gets information about newly launched kernel.
*
* @param {ActionObservable} The action type
*/
export declare const acquireKernelInfoEpic: (action$: Observable<actions.NewKernelAction>, state$: StateObservable<AppState>) => Observable<unknown>;
export declare const extractNewKernel: (filepath: string | null, notebook: ImmutableNotebook) => {
cwd: any;
kernelSpecName: any;
};
/**
* NOTE: This function is _exactly_ the same as the desktop loading.js version
* with one strong exception -- extractNewKernel
* Can they be combined without incurring a penalty on the web app?
* The native functions used are `path.dirname`, `path.resolve`, and `process.cwd()`
* We could always inject those dependencies separately...
*/
export declare const launchKernelWhenNotebookSetEpic: (action$: Observable<actions.FetchContentFulfilled>, state$: any) => Observable<{
type: "LAUNCH_KERNEL_BY_NAME";
payload: import("@nteract/actions/lib/utils").HasContent & import("@nteract/actions/lib/utils").HasKernel & {
kernelSpecName?: string | null | undefined;
cwd: string;
selectNextKernel: boolean;
};
}>;
/**
* Restarts a Jupyter kernel in the local scenario, where a restart requires
* killing the existing kernel process and starting an ew one.
*/
export declare const restartKernelEpic: (action$: Observable<actions.RestartKernel | actions.NewKernelAction>, state$: any) => Observable<import("@nteract/myths").MythicAction<"notifications", "sendNotification", import("@nteract/mythic-notifications").NotificationMessage> | {
type: "KILL_KERNEL";
payload: import("@nteract/actions/lib/utils").MaybeHasContent & import("@nteract/actions/lib/utils").MaybeHasKernel & {
restarting: boolean;
dispose?: boolean | undefined;
};
} | {
type: "LAUNCH_KERNEL_BY_NAME";
payload: import("@nteract/actions/lib/utils").HasContent & import("@nteract/actions/lib/utils").HasKernel & {
kernelSpecName?: string | null | undefined;
cwd: string;
selectNextKernel: boolean;
};
} | {
type: "RESTART_KERNEL_SUCCESSFUL";
payload: import("@nteract/actions/lib/utils").HasContent & import("@nteract/actions/lib/utils").HasKernel;
} | {
type: "EXECUTE_ALL_CELLS";
payload: import("@nteract/actions/lib/utils").HasContent;
} | {
type: "RESTART_KERNEL_FAILED";
payload: import("@nteract/actions/lib/utils").HasContent & import("@nteract/actions/lib/utils").HasKernel & {
error: Error;
code?: string | undefined;
};
error: true;
}>;