Dynamic plugins (#68)

This commit is contained in:
Gregory Schier
2024-09-06 10:43:25 -07:00
committed by GitHub
parent f7949c9909
commit b3adbc1860
37 changed files with 533 additions and 184 deletions

View File

@@ -13,6 +13,7 @@ export type TrackResource =
| 'http_request'
| 'http_response'
| 'key_value'
| 'plugin'
| 'setting'
| 'sidebar'
| 'theme'

View File

@@ -1,7 +1,7 @@
import { sleep } from './sleep';
/** Ensures a promise takes at least a certain number of milliseconds to resolve */
export async function minPromiseMillis<T>(promise: Promise<T>, millis: number) {
export async function minPromiseMillis<T>(promise: Promise<T>, millis = 300) {
const start = Date.now();
let result;
let err;

View File

@@ -4,6 +4,7 @@ import type {
Folder,
GrpcRequest,
HttpRequest,
Plugin,
Settings,
Workspace,
} from '@yaakapp/api';
@@ -63,6 +64,11 @@ export async function listWorkspaces(): Promise<Workspace[]> {
return workspaces;
}
export async function listPlugins(): Promise<Plugin[]> {
const plugins: Plugin[] = (await invokeCmd('cmd_list_plugins')) ?? [];
return plugins;
}
export async function getCookieJar(id: string | null): Promise<CookieJar | null> {
if (id === null) return null;
const cookieJar: CookieJar = (await invokeCmd('cmd_get_cookie_jar', { id })) ?? null;

View File

@@ -6,6 +6,7 @@ type TauriCmd =
| 'cmd_check_for_updates'
| 'cmd_create_cookie_jar'
| 'cmd_create_environment'
| 'cmd_create_plugin'
| 'cmd_template_tokens_to_string'
| 'cmd_create_folder'
| 'cmd_create_grpc_request'
@@ -47,11 +48,13 @@ type TauriCmd =
| 'cmd_list_grpc_requests'
| 'cmd_list_http_requests'
| 'cmd_list_http_responses'
| 'cmd_list_plugins'
| 'cmd_list_workspaces'
| 'cmd_metadata'
| 'cmd_new_nested_window'
| 'cmd_new_window'
| 'cmd_parse_template'
| 'cmd_plugin_info'
| 'cmd_render_template'
| 'cmd_save_response'
| 'cmd_send_ephemeral_request'