mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-17 23:13:51 +01:00
Start of plugin types refactor
This commit is contained in:
7
src-web/index.d.ts
vendored
7
src-web/index.d.ts
vendored
@@ -1,7 +0,0 @@
|
||||
declare module 'format-graphql' {
|
||||
export function formatSdl(query: string): string;
|
||||
}
|
||||
|
||||
declare module '*.svg' {
|
||||
export const ReactComponent: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
|
||||
}
|
||||
@@ -1,3 +1,18 @@
|
||||
import type {
|
||||
BaseModel,
|
||||
Workspace,
|
||||
HttpResponse,
|
||||
HttpRequest,
|
||||
HttpHeader,
|
||||
Folder,
|
||||
GrpcRequest,
|
||||
GrpcEvent,
|
||||
GrpcConnection,
|
||||
Environment,
|
||||
} from '../../plugin-runtime-types';
|
||||
|
||||
export * from '../../plugin-runtime-types';
|
||||
|
||||
export const BODY_TYPE_NONE = null;
|
||||
export const BODY_TYPE_GRAPHQL = 'graphql';
|
||||
export const BODY_TYPE_JSON = 'application/json';
|
||||
@@ -24,12 +39,6 @@ export type Model =
|
||||
| Environment
|
||||
| CookieJar;
|
||||
|
||||
export interface BaseModel {
|
||||
readonly id: string;
|
||||
readonly createdAt: string;
|
||||
readonly updatedAt: string;
|
||||
}
|
||||
|
||||
export interface Settings extends BaseModel {
|
||||
readonly model: 'settings';
|
||||
theme: string;
|
||||
@@ -44,16 +53,6 @@ export interface Settings extends BaseModel {
|
||||
openWorkspaceNewWindow: boolean | null;
|
||||
}
|
||||
|
||||
export interface Workspace extends BaseModel {
|
||||
readonly model: 'workspace';
|
||||
name: string;
|
||||
description: string;
|
||||
variables: EnvironmentVariable[];
|
||||
settingValidateCertificates: boolean;
|
||||
settingFollowRedirects: boolean;
|
||||
settingRequestTimeout: number;
|
||||
}
|
||||
|
||||
export interface CookieJar extends BaseModel {
|
||||
readonly model: 'cookie_jar';
|
||||
workspaceId: string;
|
||||
@@ -81,108 +80,6 @@ export function cookieDomain(cookie: Cookie): string {
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
export interface EnvironmentVariable {
|
||||
name: string;
|
||||
value: string;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export interface Folder extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly model: 'folder';
|
||||
folderId: string | null;
|
||||
sortPriority: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface Environment extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly model: 'environment';
|
||||
name: string;
|
||||
variables: EnvironmentVariable[];
|
||||
}
|
||||
|
||||
export interface HttpHeader {
|
||||
name: string;
|
||||
value: string;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export interface HttpUrlParameter {
|
||||
name: string;
|
||||
value: string;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export interface GrpcMetadataEntry {
|
||||
name: string;
|
||||
value: string;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export interface GrpcRequest extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly model: 'grpc_request';
|
||||
folderId: string | null;
|
||||
sortPriority: number;
|
||||
name: string;
|
||||
url: string;
|
||||
service: string | null;
|
||||
method: string | null;
|
||||
message: string;
|
||||
authentication: Record<string, string | number | boolean | null | undefined>;
|
||||
authenticationType: string | null;
|
||||
metadata: GrpcMetadataEntry[];
|
||||
}
|
||||
|
||||
export interface GrpcEvent extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly requestId: string;
|
||||
readonly connectionId: string;
|
||||
readonly model: 'grpc_event';
|
||||
content: string;
|
||||
status: number | null;
|
||||
error: string | null;
|
||||
eventType:
|
||||
| 'info'
|
||||
| 'error'
|
||||
| 'client_message'
|
||||
| 'server_message'
|
||||
| 'connection_start'
|
||||
| 'connection_end';
|
||||
metadata: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface GrpcConnection extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly requestId: string;
|
||||
readonly model: 'grpc_connection';
|
||||
service: string;
|
||||
method: string;
|
||||
elapsed: number;
|
||||
elapsedConnection: number;
|
||||
status: number;
|
||||
url: string;
|
||||
error: string | null;
|
||||
trailers: Record<string, string>;
|
||||
}
|
||||
|
||||
export interface HttpRequest extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly model: 'http_request';
|
||||
folderId: string | null;
|
||||
sortPriority: number;
|
||||
name: string;
|
||||
url: string;
|
||||
urlParameters: HttpUrlParameter[];
|
||||
body: Record<string, unknown>;
|
||||
bodyType: string | null;
|
||||
authentication: Record<string, string | number | boolean | null | undefined>;
|
||||
authenticationType: string | null;
|
||||
method: string;
|
||||
headers: HttpHeader[];
|
||||
}
|
||||
|
||||
export interface KeyValue extends Omit<BaseModel, 'id'> {
|
||||
readonly model: 'key_value';
|
||||
readonly key: string;
|
||||
@@ -190,23 +87,6 @@ export interface KeyValue extends Omit<BaseModel, 'id'> {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface HttpResponse extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly model: 'http_response';
|
||||
readonly requestId: string;
|
||||
readonly bodyPath: string | null;
|
||||
readonly contentLength: number | null;
|
||||
readonly error: string;
|
||||
readonly status: number;
|
||||
readonly elapsed: number;
|
||||
readonly elapsedHeaders: number;
|
||||
readonly statusReason: string;
|
||||
readonly version: string;
|
||||
readonly remoteAddr: string;
|
||||
readonly url: string;
|
||||
readonly headers: HttpHeader[];
|
||||
}
|
||||
|
||||
export function isResponseLoading(response: HttpResponse | GrpcConnection): boolean {
|
||||
return response.elapsed === 0;
|
||||
}
|
||||
|
||||
10
src-web/plugin/runtime.d.ts
vendored
10
src-web/plugin/runtime.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
declare global {
|
||||
const YAML: {
|
||||
parse: (yml: string) => unknown;
|
||||
};
|
||||
interface YaakContext {
|
||||
foo: string;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
Reference in New Issue
Block a user