mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 09:18:30 +02:00
Start of plugin types refactor
This commit is contained in:
@@ -12,7 +12,13 @@ module.exports = {
|
|||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: ["./tsconfig.json"]
|
project: ["./tsconfig.json"]
|
||||||
},
|
},
|
||||||
ignorePatterns: ["scripts/**/*", "plugin-runtime/**/*", "src-tauri/**/*", "plugins/**/*"],
|
ignorePatterns: [
|
||||||
|
"scripts/**/*",
|
||||||
|
"plugin-runtime/**/*",
|
||||||
|
"plugin-runtime-types/**/*",
|
||||||
|
"src-tauri/**/*",
|
||||||
|
"plugins/**/*",
|
||||||
|
],
|
||||||
settings: {
|
settings: {
|
||||||
react: {
|
react: {
|
||||||
version: "detect"
|
version: "detect"
|
||||||
|
|||||||
2
plugin-runtime-types/.gitignore
vendored
Normal file
2
plugin-runtime-types/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
lib
|
||||||
|
node_modules
|
||||||
44
plugin-runtime-types/package-lock.json
generated
Normal file
44
plugin-runtime-types/package-lock.json
generated
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"name": "@yaakapp/api",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "@yaakapp/api",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^22.0.0",
|
||||||
|
"typescript": "^5.5.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "22.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.0.tgz",
|
||||||
|
"integrity": "sha512-VT7KSYudcPOzP5Q0wfbowyNLaVR8QWUdw+088uFWwfvpY6uCWaXpqV6ieLAu9WBcnTa7H4Z5RLK8I5t2FuOcqw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~6.11.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz",
|
||||||
|
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "6.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.11.1.tgz",
|
||||||
|
"integrity": "sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
plugin-runtime-types/package.json
Normal file
18
plugin-runtime-types/package.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "@yaakapp/api",
|
||||||
|
"version": "0.0.5",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"typings": "./lib/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"prepublish": "tsc"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "^22.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.5.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
2
plugin-runtime-types/src/helpers.ts
Normal file
2
plugin-runtime-types/src/helpers.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export type AtLeast<T, K extends keyof T> = Partial<T> & Pick<T, K>;
|
||||||
|
export type SingleOrArray<T> = T[] | T;
|
||||||
3
plugin-runtime-types/src/index.ts
Normal file
3
plugin-runtime-types/src/index.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export type * from './models';
|
||||||
|
export type * from './plugins';
|
||||||
|
export type * from './themes';
|
||||||
1
plugin-runtime-types/src/models/index.ts
Normal file
1
plugin-runtime-types/src/models/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from './types';
|
||||||
135
plugin-runtime-types/src/models/types.ts
Normal file
135
plugin-runtime-types/src/models/types.ts
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
export interface BaseModel {
|
||||||
|
readonly model: string;
|
||||||
|
readonly id: string;
|
||||||
|
readonly createdAt: string;
|
||||||
|
readonly updatedAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Workspace extends BaseModel {
|
||||||
|
readonly model: 'workspace';
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
variables: EnvironmentVariable[];
|
||||||
|
settingValidateCertificates: boolean;
|
||||||
|
settingFollowRedirects: boolean;
|
||||||
|
settingRequestTimeout: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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[];
|
||||||
|
}
|
||||||
11
plugin-runtime-types/src/plugins/context.ts
Normal file
11
plugin-runtime-types/src/plugins/context.ts
Normal file
@@ -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>;
|
||||||
|
};
|
||||||
|
};
|
||||||
16
plugin-runtime-types/src/plugins/import.ts
Normal file
16
plugin-runtime-types/src/plugins/import.ts
Normal file
@@ -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>;
|
||||||
|
};
|
||||||
13
plugin-runtime-types/src/plugins/index.ts
Normal file
13
plugin-runtime-types/src/plugins/index.ts
Normal file
@@ -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>;
|
||||||
|
};
|
||||||
5
plugin-runtime-types/src/plugins/theme.ts
Normal file
5
plugin-runtime-types/src/plugins/theme.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { Theme } from '../themes';
|
||||||
|
|
||||||
|
export type ThemePlugin = {
|
||||||
|
theme: Theme;
|
||||||
|
};
|
||||||
44
plugin-runtime-types/src/themes/index.ts
Normal file
44
plugin-runtime-types/src/themes/index.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
export type Colors = {
|
||||||
|
surface: string;
|
||||||
|
surfaceHighlight?: string;
|
||||||
|
surfaceActive?: string;
|
||||||
|
|
||||||
|
text: string;
|
||||||
|
textSubtle?: string;
|
||||||
|
textSubtlest?: string;
|
||||||
|
|
||||||
|
border?: string;
|
||||||
|
borderSubtle?: string;
|
||||||
|
borderFocus?: string;
|
||||||
|
|
||||||
|
shadow?: string;
|
||||||
|
backdrop?: string;
|
||||||
|
selection?: string;
|
||||||
|
|
||||||
|
primary?: string;
|
||||||
|
secondary?: string;
|
||||||
|
info?: string;
|
||||||
|
success?: string;
|
||||||
|
notice?: string;
|
||||||
|
warning?: string;
|
||||||
|
danger?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Theme = Colors & {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
components?: Partial<{
|
||||||
|
dialog: Partial<Colors>;
|
||||||
|
menu: Partial<Colors>;
|
||||||
|
toast: Partial<Colors>;
|
||||||
|
sidebar: Partial<Colors>;
|
||||||
|
responsePane: Partial<Colors>;
|
||||||
|
appHeader: Partial<Colors>;
|
||||||
|
button: Partial<Colors>;
|
||||||
|
banner: Partial<Colors>;
|
||||||
|
placeholder: Partial<Colors>;
|
||||||
|
urlBar: Partial<Colors>;
|
||||||
|
editor: Partial<Colors>;
|
||||||
|
input: Partial<Colors>;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
15
plugin-runtime-types/tsconfig.json
Normal file
15
plugin-runtime-types/tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "node16",
|
||||||
|
"target": "es6",
|
||||||
|
"lib": ["es2021"],
|
||||||
|
"declaration": true,
|
||||||
|
"declarationDir": "./lib",
|
||||||
|
"outDir": "./lib",
|
||||||
|
"strict": true,
|
||||||
|
"types": ["node"]
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src/index.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"skipLibCheck": true,
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"*": [
|
"*": [
|
||||||
"node_modules/*",
|
"node_modules/*",
|
||||||
|
|||||||
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_NONE = null;
|
||||||
export const BODY_TYPE_GRAPHQL = 'graphql';
|
export const BODY_TYPE_GRAPHQL = 'graphql';
|
||||||
export const BODY_TYPE_JSON = 'application/json';
|
export const BODY_TYPE_JSON = 'application/json';
|
||||||
@@ -24,12 +39,6 @@ export type Model =
|
|||||||
| Environment
|
| Environment
|
||||||
| CookieJar;
|
| CookieJar;
|
||||||
|
|
||||||
export interface BaseModel {
|
|
||||||
readonly id: string;
|
|
||||||
readonly createdAt: string;
|
|
||||||
readonly updatedAt: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Settings extends BaseModel {
|
export interface Settings extends BaseModel {
|
||||||
readonly model: 'settings';
|
readonly model: 'settings';
|
||||||
theme: string;
|
theme: string;
|
||||||
@@ -44,16 +53,6 @@ export interface Settings extends BaseModel {
|
|||||||
openWorkspaceNewWindow: boolean | null;
|
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 {
|
export interface CookieJar extends BaseModel {
|
||||||
readonly model: 'cookie_jar';
|
readonly model: 'cookie_jar';
|
||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
@@ -81,108 +80,6 @@ export function cookieDomain(cookie: Cookie): string {
|
|||||||
return 'unknown';
|
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'> {
|
export interface KeyValue extends Omit<BaseModel, 'id'> {
|
||||||
readonly model: 'key_value';
|
readonly model: 'key_value';
|
||||||
readonly key: string;
|
readonly key: string;
|
||||||
@@ -190,23 +87,6 @@ export interface KeyValue extends Omit<BaseModel, 'id'> {
|
|||||||
value: string;
|
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 {
|
export function isResponseLoading(response: HttpResponse | GrpcConnection): boolean {
|
||||||
return response.elapsed === 0;
|
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