mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-16 13:41:15 +01:00
Start of plugin types refactor
This commit is contained in:
1 parent
a3988188f3
commit
5639e358bc
18 files changed
+331
-154
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import { HttpRequest, HttpResponse } from '../models';
|
||||
|
||||
export type YaakContext = {
|
||||
metadata: {
|
||||
getVersion(): Promise<string>;
|
||||
};
|
||||
httpRequest: {
|
||||
send(id: string): Promise<HttpResponse>;
|
||||
getById(id: string): Promise<HttpRequest | null>;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,16 @@
|
||||
import { AtLeast } from '../helpers';
|
||||
import { Environment, Folder, HttpRequest, Workspace } from '../models';
|
||||
import { YaakContext } from './context';
|
||||
|
||||
export type ImportPluginResponse = null | {
|
||||
resources: Partial<{
|
||||
workspaces: AtLeast<Workspace, 'name' | 'id' | 'model'>[];
|
||||
environments: AtLeast<Environment, 'name' | 'id' | 'model' | 'workspaceId'>[];
|
||||
httpRequests: AtLeast<HttpRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
|
||||
folders: AtLeast<Folder, 'name' | 'id' | 'model' | 'workspaceId'>[];
|
||||
}>;
|
||||
};
|
||||
|
||||
export type ImporterPlugin = {
|
||||
onImport(ctx: YaakContext, fileContents: string): Promise<ImportPluginResponse>;
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import { SingleOrArray } from '../helpers';
|
||||
import { ImporterPlugin } from './import';
|
||||
import { ThemePlugin } from './theme';
|
||||
|
||||
/**
|
||||
* The global structure of a Yaak plugin
|
||||
*/
|
||||
export type YaakPlugin = {
|
||||
/** One or many plugins to import data into Yaak */
|
||||
importers?: SingleOrArray<ImporterPlugin>;
|
||||
/** One or many themes to customize the Yaak UI */
|
||||
themes?: SingleOrArray<ThemePlugin>;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Theme } from '../themes';
|
||||
|
||||
export type ThemePlugin = {
|
||||
theme: Theme;
|
||||
};
|
||||
Reference in new issue
Block a user