@curvenote/cli
Version:
CLI Client library for Curvenote
70 lines • 2.82 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 type { BuildWarning } from 'myst-cli';
import type { Logger } from 'myst-cli-utils';
import type { RuleId } from 'myst-common';
import { SessionManager } from '@jupyterlab/services';
import type { RootState } from '../store/index.js';
import type { ValidatedCurvenotePlugin, ISession, Response, TokenPair, Token, CLIConfigData, SessionOpts } from './types.js';
export type SessionOptions = {
logger?: Logger;
doiLimiter?: Limit;
};
export declare class Session implements ISession {
$config?: CLIConfigData;
$activeTokens: TokenPair;
$logger: Logger;
API_URL: string;
configFiles: string[];
store: Store<RootState>;
doiLimiter: Limit;
plugins: ValidatedCurvenotePlugin | undefined;
proxyAgent?: HttpsProxyAgent<string>;
_shownUpgrade: boolean;
_latestVersion?: string;
_jupyterSessionManagerPromise?: Promise<SessionManager | undefined>;
get log(): Logger;
get isAnon(): boolean;
get config(): CLIConfigData;
get activeTokens(): TokenPair;
static create(token?: string, opts?: SessionOptions): Promise<Session>;
private constructor();
setUserToken(token: Token): void;
refreshSessionToken(opts?: {
checkStatusOnFailure?: boolean;
}): Promise<void>;
getHeaders(): Promise<Record<string, string>>;
configure(): Promise<void>;
showUpgradeNotice(): void;
_clones: ISession[];
clone(): Promise<Session>;
getAllWarnings(ruleId: RuleId): (BuildWarning & {
file: string;
})[];
reload(): Promise<this>;
fetch(url: URL | RequestInfo, init?: RequestInit): Promise<FetchResponse>;
_pluginPromise: Promise<ValidatedCurvenotePlugin> | undefined;
loadPlugins(): 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<SessionManager | undefined>;
private createJupyterSessionManager;
dispose(): void;
}
export declare function anonSession(opts?: SessionOpts): Promise<ISession>;
export declare function getSession(opts?: SessionOpts & {
hideNoTokenWarning?: boolean;
}): Promise<ISession>;
//# sourceMappingURL=session.d.ts.map