gristlabs_grist-core/app/common/plugin.ts
Paul Fitzpatrick 5ef889addd (core) move home server into core
Summary: This moves enough server material into core to run a home server.  The data engine is not yet incorporated (though in manual testing it works when ported).

Test Plan: existing tests pass

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2552
2020-07-21 20:39:10 -04:00

78 lines
1.5 KiB
TypeScript

/**
* Plugin's utilities common to server and client.
*/
import {BarePlugin, Implementation} from 'app/plugin/PluginManifest';
export type LocalPluginKind = "installed"|"builtIn";
export interface ImplDescription {
localPluginId: string;
implementation: Implementation;
}
export interface FileParser {
fileExtensions: string[];
parseOptions?: ImplDescription;
fileParser: ImplDescription;
}
// Deprecated, use FileParser or ImportSource instead.
export interface FileImporter {
id: string;
fileExtensions?: string[];
script?: string;
scriptFullPath?: string;
filePicker?: string;
filePickerFullPath?: string;
}
/**
* Manifest parsing error.
*/
export interface ManifestParsingError {
yamlError?: any;
jsonError?: any;
cannotReadError?: any;
missingEntryErrors?: string;
}
/**
* Whether the importer provides a file picker.
*/
export function isPicker(importer: FileImporter): boolean {
return importer.filePicker !== undefined;
}
/**
* A Plugin that was found in the system, either installed or builtin.
*/
export interface LocalPlugin {
/**
* the plugin's manifest
*/
manifest: BarePlugin;
/**
* The path to the plugin's folder.
*/
path: string;
/**
* A name to uniquely identify a LocalPlugin.
*/
readonly id: string;
}
export interface DirectoryScanEntry {
manifest?: BarePlugin;
/**
* User-friendly error messages.
*/
errors?: any[];
path: string;
id: string;
}
/**
* The contributions type.
*/
export type Contribution = "importSource" | "fileParser";