@curvenote/cli
Version:
CLI Client library for Curvenote
78 lines • 3.18 kB
TypeScript
import type { Store } from 'redux';
import { HttpsProxyAgent } from 'https-proxy-agent';
import type { RequestInfo, RequestInit, Response as FetchResponse } from 'node-fetch';
import type { Limit } from 'p-limit';
import { Semaphore } from 'async-mutex';
import type { ServerInfo, BuildWarning, ISession as IMystSession } from 'myst-cli';
import type { Logger } from 'myst-cli-utils';
import type { RuleId } from 'myst-common';
import type { PluginInfo } from 'myst-config';
import type { RootState } from '../store/index.js';
import type { ValidatedCurvenotePlugin, ISession, Response, TokenPair, Token, CLIConfigData, SessionOpts } from './types.js';
type JupyterSessionManager = Awaited<ReturnType<IMystSession['jupyterSessionManager']>>;
export type SessionOptions = {
logger?: Logger;
doiLimiter?: Limit;
executionSemaphore?: Semaphore;
configFiles?: string[];
};
export declare class Session implements ISession {
$config?: CLIConfigData;
$activeTokens: TokenPair;
$logger: Logger;
API_URL: string;
configFiles: string[];
store: Store<RootState>;
doiLimiter: Limit;
executionSemaphore: Semaphore;
plugins: ValidatedCurvenotePlugin | undefined;
server: ServerInfo | undefined;
proxyAgent?: HttpsProxyAgent<string>;
_shownUpgrade: boolean;
_latestVersion?: string;
_jupyterSessionManagerPromise?: Promise<JupyterSessionManager>;
get log(): Logger;
get isAnon(): boolean;
get config(): CLIConfigData;
get activeTokens(): TokenPair;
static create(token?: string, opts?: SessionOptions): Promise<Session>;
private constructor();
setLogger(logger: Logger): void;
setUserToken(token: Token): void;
refreshSessionToken(opts?: {
checkStatusOnFailure?: boolean;
}): Promise<void>;
getHeaders(): Promise<Record<string, string>>;
configure(): Promise<void>;
showUpgradeNotice(): void;
_clones: ISession[];
clone(): Promise<ISession>;
getAllWarnings(ruleId: RuleId): (BuildWarning & {
file: string;
})[];
reload(): Promise<ISession>;
fetch(url: URL | RequestInfo, init?: RequestInit): Promise<FetchResponse>;
_pluginPromise: Promise<ValidatedCurvenotePlugin> | undefined;
loadPlugins(plugins: PluginInfo[]): Promise<ValidatedCurvenotePlugin>;
get<T extends Record<string, any>>(url: string, query?: Record<string, string>): Response<T>;
patch<T extends Record<string, any>>(url: string, data: Record<string, any>): Promise<{
ok: boolean;
status: number;
json: T;
}>;
post<T extends Record<string, any>>(url: string, data: Record<string, any>, method?: 'post' | 'patch'): Response<T>;
sourcePath(): string;
buildPath(): string;
sitePath(): string;
contentPath(): string;
publicPath(): string;
jupyterSessionManager(): Promise<JupyterSessionManager>;
private createJupyterSessionManager;
dispose(): void;
}
export declare function anonSession(opts?: SessionOpts): Promise<ISession>;
export declare function getSession(opts?: SessionOpts & {
hideNoTokenWarning?: boolean;
}): Promise<ISession>;
export {};
//# sourceMappingURL=session.d.ts.map