gristlabs_grist-core/app/server/lib/ISandbox.ts
Alex Hall 5d671bf0b3 (core) New type conversion in the backend
Summary: This is https://phab.getgrist.com/D3205 plus some changes (https://github.com/dsagal/grist/compare/type-convert...type-convert-server?expand=1) that move the conversion process to the backend. A new user action ConvertFromColumn uses `call_external` so that the data engine can delegate back to ActiveDoc. Code for creating formatters and parsers is significantly refactored so that most of the logic is in `common` and can be used in different ways.

Test Plan: The original diff adds plenty of tests.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3240
2022-02-04 20:28:13 +02:00

34 lines
1.1 KiB
TypeScript

import * as log from 'app/server/lib/log';
import {ISandboxOptions} from 'app/server/lib/NSandbox';
/**
* Starting to whittle down the options used when creating a sandbox, to leave more
* freedom in how the sandbox works.
*/
export interface ISandboxCreationOptions {
comment?: string; // an argument to add in command line when possible, so it shows in `ps`
logCalls?: boolean;
logMeta?: log.ILogMeta;
logTimes?: boolean;
// This batch of options is used by SafePythonComponent, so are important for importers.
entryPoint?: string; // main script to call - leave undefined for default
sandboxMount?: string; // if defined, make this path available read-only as "/sandbox"
importMount?: string; // if defined, make this path available read-only as "/importdir"
preferredPythonVersion?: '2' | '3';
sandboxOptions?: Partial<ISandboxOptions>;
}
export interface ISandbox {
shutdown(): Promise<unknown>; // TODO: tighten up this type.
pyCall(funcName: string, ...varArgs: unknown[]): Promise<any>;
reportMemoryUsage(): Promise<void>;
}
export interface ISandboxCreator {
create(options: ISandboxCreationOptions): ISandbox;
}