mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 18:31:16 +01:00
Run oxfmt across repo, add format script and docs
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,23 +3,23 @@
|
||||
"version": "0.8.0",
|
||||
"keywords": [
|
||||
"api-client",
|
||||
"insomnia-alternative",
|
||||
"bruno-alternative",
|
||||
"insomnia-alternative",
|
||||
"postman-alternative"
|
||||
],
|
||||
"homepage": "https://yaak.app",
|
||||
"bugs": {
|
||||
"url": "https://feedback.yaak.app"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mountain-loop/yaak"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://feedback.yaak.app"
|
||||
},
|
||||
"homepage": "https://yaak.app",
|
||||
"main": "lib/index.js",
|
||||
"typings": "./lib/index.d.ts",
|
||||
"files": [
|
||||
"lib/**/*"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"typings": "./lib/index.d.ts",
|
||||
"scripts": {
|
||||
"bootstrap": "npm run build",
|
||||
"build": "run-s build:copy-types build:tsc",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export type * from './plugins';
|
||||
export type * from './themes';
|
||||
export type * from "./plugins";
|
||||
export type * from "./themes";
|
||||
|
||||
export * from './bindings/gen_models';
|
||||
export * from './bindings/gen_events';
|
||||
export * from "./bindings/gen_models";
|
||||
export * from "./bindings/gen_events";
|
||||
|
||||
// Some extras for utility
|
||||
|
||||
export type { PartialImportResources } from './plugins/ImporterPlugin';
|
||||
export type { PartialImportResources } from "./plugins/ImporterPlugin";
|
||||
|
||||
@@ -5,9 +5,9 @@ import type {
|
||||
FormInput,
|
||||
GetHttpAuthenticationSummaryResponse,
|
||||
HttpAuthenticationAction,
|
||||
} from '../bindings/gen_events';
|
||||
import type { MaybePromise } from '../helpers';
|
||||
import type { Context } from './Context';
|
||||
} from "../bindings/gen_events";
|
||||
import type { MaybePromise } from "../helpers";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
type AddDynamicMethod<T> = {
|
||||
dynamic?: (
|
||||
@@ -19,13 +19,13 @@ type AddDynamicMethod<T> = {
|
||||
// oxlint-disable-next-line no-explicit-any -- distributive conditional type pattern
|
||||
type AddDynamic<T> = T extends any
|
||||
? T extends { inputs?: FormInput[] }
|
||||
? Omit<T, 'inputs'> & {
|
||||
? Omit<T, "inputs"> & {
|
||||
inputs: Array<AddDynamic<FormInput>>;
|
||||
dynamic?: (
|
||||
ctx: Context,
|
||||
args: CallHttpAuthenticationActionArgs,
|
||||
) => MaybePromise<
|
||||
Partial<Omit<T, 'inputs'> & { inputs: Array<AddDynamic<FormInput>> }> | null | undefined
|
||||
Partial<Omit<T, "inputs"> & { inputs: Array<AddDynamic<FormInput>> }> | null | undefined
|
||||
>;
|
||||
}
|
||||
: T & AddDynamicMethod<T>
|
||||
|
||||
@@ -26,10 +26,10 @@ import type {
|
||||
ShowToastRequest,
|
||||
TemplateRenderRequest,
|
||||
WorkspaceInfo,
|
||||
} from '../bindings/gen_events.ts';
|
||||
import type { Folder, HttpRequest } from '../bindings/gen_models.ts';
|
||||
import type { JsonValue } from '../bindings/serde_json/JsonValue';
|
||||
import type { MaybePromise } from '../helpers';
|
||||
} from "../bindings/gen_events.ts";
|
||||
import type { Folder, HttpRequest } from "../bindings/gen_models.ts";
|
||||
import type { JsonValue } from "../bindings/serde_json/JsonValue";
|
||||
import type { MaybePromise } from "../helpers";
|
||||
|
||||
export type CallPromptFormDynamicArgs = {
|
||||
values: { [key in string]?: JsonPrimitive };
|
||||
@@ -45,13 +45,13 @@ type AddDynamicMethod<T> = {
|
||||
// oxlint-disable-next-line no-explicit-any -- distributive conditional type pattern
|
||||
type AddDynamic<T> = T extends any
|
||||
? T extends { inputs?: FormInput[] }
|
||||
? Omit<T, 'inputs'> & {
|
||||
? Omit<T, "inputs"> & {
|
||||
inputs: Array<AddDynamic<FormInput>>;
|
||||
dynamic?: (
|
||||
ctx: Context,
|
||||
args: CallPromptFormDynamicArgs,
|
||||
) => MaybePromise<
|
||||
Partial<Omit<T, 'inputs'> & { inputs: Array<AddDynamic<FormInput>> }> | null | undefined
|
||||
Partial<Omit<T, "inputs"> & { inputs: Array<AddDynamic<FormInput>> }> | null | undefined
|
||||
>;
|
||||
}
|
||||
: T & AddDynamicMethod<T>
|
||||
@@ -59,11 +59,11 @@ type AddDynamic<T> = T extends any
|
||||
|
||||
export type DynamicPromptFormArg = AddDynamic<FormInput>;
|
||||
|
||||
type DynamicPromptFormRequest = Omit<PromptFormRequest, 'inputs'> & {
|
||||
type DynamicPromptFormRequest = Omit<PromptFormRequest, "inputs"> & {
|
||||
inputs: DynamicPromptFormArg[];
|
||||
};
|
||||
|
||||
export type WorkspaceHandle = Pick<WorkspaceInfo, 'id' | 'name'>;
|
||||
export type WorkspaceHandle = Pick<WorkspaceInfo, "id" | "name">;
|
||||
|
||||
export interface Context {
|
||||
clipboard: {
|
||||
@@ -73,8 +73,8 @@ export interface Context {
|
||||
show(args: ShowToastRequest): Promise<void>;
|
||||
};
|
||||
prompt: {
|
||||
text(args: PromptTextRequest): Promise<PromptTextResponse['value']>;
|
||||
form(args: DynamicPromptFormRequest): Promise<PromptFormResponse['values']>;
|
||||
text(args: PromptTextRequest): Promise<PromptTextResponse["value"]>;
|
||||
form(args: DynamicPromptFormRequest): Promise<PromptFormResponse["values"]>;
|
||||
};
|
||||
store: {
|
||||
set<T>(key: string, value: T): Promise<void>;
|
||||
@@ -94,41 +94,41 @@ export interface Context {
|
||||
openExternalUrl(url: string): Promise<void>;
|
||||
};
|
||||
cookies: {
|
||||
listNames(): Promise<ListCookieNamesResponse['names']>;
|
||||
getValue(args: GetCookieValueRequest): Promise<GetCookieValueResponse['value']>;
|
||||
listNames(): Promise<ListCookieNamesResponse["names"]>;
|
||||
getValue(args: GetCookieValueRequest): Promise<GetCookieValueResponse["value"]>;
|
||||
};
|
||||
grpcRequest: {
|
||||
render(args: RenderGrpcRequestRequest): Promise<RenderGrpcRequestResponse['grpcRequest']>;
|
||||
render(args: RenderGrpcRequestRequest): Promise<RenderGrpcRequestResponse["grpcRequest"]>;
|
||||
};
|
||||
httpRequest: {
|
||||
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
|
||||
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
|
||||
render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse['httpRequest']>;
|
||||
list(args?: ListHttpRequestsRequest): Promise<ListHttpRequestsResponse['httpRequests']>;
|
||||
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse["httpResponse"]>;
|
||||
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse["httpRequest"]>;
|
||||
render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse["httpRequest"]>;
|
||||
list(args?: ListHttpRequestsRequest): Promise<ListHttpRequestsResponse["httpRequests"]>;
|
||||
create(
|
||||
args: Omit<Partial<HttpRequest>, 'id' | 'model' | 'createdAt' | 'updatedAt'> &
|
||||
Pick<HttpRequest, 'workspaceId' | 'url'>,
|
||||
args: Omit<Partial<HttpRequest>, "id" | "model" | "createdAt" | "updatedAt"> &
|
||||
Pick<HttpRequest, "workspaceId" | "url">,
|
||||
): Promise<HttpRequest>;
|
||||
update(
|
||||
args: Omit<Partial<HttpRequest>, 'model' | 'createdAt' | 'updatedAt'> &
|
||||
Pick<HttpRequest, 'id'>,
|
||||
args: Omit<Partial<HttpRequest>, "model" | "createdAt" | "updatedAt"> &
|
||||
Pick<HttpRequest, "id">,
|
||||
): Promise<HttpRequest>;
|
||||
delete(args: { id: string }): Promise<HttpRequest>;
|
||||
};
|
||||
folder: {
|
||||
list(args?: ListFoldersRequest): Promise<ListFoldersResponse['folders']>;
|
||||
list(args?: ListFoldersRequest): Promise<ListFoldersResponse["folders"]>;
|
||||
getById(args: { id: string }): Promise<Folder | null>;
|
||||
create(
|
||||
args: Omit<Partial<Folder>, 'id' | 'model' | 'createdAt' | 'updatedAt'> &
|
||||
Pick<Folder, 'workspaceId' | 'name'>,
|
||||
args: Omit<Partial<Folder>, "id" | "model" | "createdAt" | "updatedAt"> &
|
||||
Pick<Folder, "workspaceId" | "name">,
|
||||
): Promise<Folder>;
|
||||
update(
|
||||
args: Omit<Partial<Folder>, 'model' | 'createdAt' | 'updatedAt'> & Pick<Folder, 'id'>,
|
||||
args: Omit<Partial<Folder>, "model" | "createdAt" | "updatedAt"> & Pick<Folder, "id">,
|
||||
): Promise<Folder>;
|
||||
delete(args: { id: string }): Promise<Folder>;
|
||||
};
|
||||
httpResponse: {
|
||||
find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse['httpResponses']>;
|
||||
find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse["httpResponses"]>;
|
||||
};
|
||||
templates: {
|
||||
render<T extends JsonValue>(args: TemplateRenderRequest & { data: T }): Promise<T>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { FilterResponse } from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
import type { FilterResponse } from "../bindings/gen_events";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
export type FilterPlugin = {
|
||||
name: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CallFolderActionArgs, FolderAction } from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
import type { CallFolderActionArgs, FolderAction } from "../bindings/gen_events";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
export type FolderActionPlugin = FolderAction & {
|
||||
onSelect(ctx: Context, args: CallFolderActionArgs): Promise<void> | void;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CallGrpcRequestActionArgs, GrpcRequestAction } from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
import type { CallGrpcRequestActionArgs, GrpcRequestAction } from "../bindings/gen_events";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
export type GrpcRequestActionPlugin = GrpcRequestAction & {
|
||||
onSelect(ctx: Context, args: CallGrpcRequestActionArgs): Promise<void> | void;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CallHttpRequestActionArgs, HttpRequestAction } from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
import type { CallHttpRequestActionArgs, HttpRequestAction } from "../bindings/gen_events";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
export type HttpRequestActionPlugin = HttpRequestAction & {
|
||||
onSelect(ctx: Context, args: CallHttpRequestActionArgs): Promise<void> | void;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { ImportResources } from '../bindings/gen_events';
|
||||
import type { AtLeast, MaybePromise } from '../helpers';
|
||||
import type { Context } from './Context';
|
||||
import type { ImportResources } from "../bindings/gen_events";
|
||||
import type { AtLeast, MaybePromise } from "../helpers";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
type RootFields = 'name' | 'id' | 'model';
|
||||
type CommonFields = RootFields | 'workspaceId';
|
||||
type RootFields = "name" | "id" | "model";
|
||||
type CommonFields = RootFields | "workspaceId";
|
||||
|
||||
export type PartialImportResources = {
|
||||
workspaces: Array<AtLeast<ImportResources['workspaces'][0], RootFields>>;
|
||||
environments: Array<AtLeast<ImportResources['environments'][0], CommonFields>>;
|
||||
folders: Array<AtLeast<ImportResources['folders'][0], CommonFields>>;
|
||||
httpRequests: Array<AtLeast<ImportResources['httpRequests'][0], CommonFields>>;
|
||||
grpcRequests: Array<AtLeast<ImportResources['grpcRequests'][0], CommonFields>>;
|
||||
websocketRequests: Array<AtLeast<ImportResources['websocketRequests'][0], CommonFields>>;
|
||||
workspaces: Array<AtLeast<ImportResources["workspaces"][0], RootFields>>;
|
||||
environments: Array<AtLeast<ImportResources["environments"][0], CommonFields>>;
|
||||
folders: Array<AtLeast<ImportResources["folders"][0], CommonFields>>;
|
||||
httpRequests: Array<AtLeast<ImportResources["httpRequests"][0], CommonFields>>;
|
||||
grpcRequests: Array<AtLeast<ImportResources["grpcRequests"][0], CommonFields>>;
|
||||
websocketRequests: Array<AtLeast<ImportResources["websocketRequests"][0], CommonFields>>;
|
||||
};
|
||||
|
||||
export type ImportPluginResponse = null | {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CallTemplateFunctionArgs, FormInput, TemplateFunction } from '../bindings/gen_events';
|
||||
import type { MaybePromise } from '../helpers';
|
||||
import type { Context } from './Context';
|
||||
import type { CallTemplateFunctionArgs, FormInput, TemplateFunction } from "../bindings/gen_events";
|
||||
import type { MaybePromise } from "../helpers";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
type AddDynamicMethod<T> = {
|
||||
dynamic?: (
|
||||
@@ -12,13 +12,13 @@ type AddDynamicMethod<T> = {
|
||||
// oxlint-disable-next-line no-explicit-any -- distributive conditional type pattern
|
||||
type AddDynamic<T> = T extends any
|
||||
? T extends { inputs?: FormInput[] }
|
||||
? Omit<T, 'inputs'> & {
|
||||
? Omit<T, "inputs"> & {
|
||||
inputs: Array<AddDynamic<FormInput>>;
|
||||
dynamic?: (
|
||||
ctx: Context,
|
||||
args: CallTemplateFunctionArgs,
|
||||
) => MaybePromise<
|
||||
Partial<Omit<T, 'inputs'> & { inputs: Array<AddDynamic<FormInput>> }> | null | undefined
|
||||
Partial<Omit<T, "inputs"> & { inputs: Array<AddDynamic<FormInput>> }> | null | undefined
|
||||
>;
|
||||
}
|
||||
: T & AddDynamicMethod<T>
|
||||
@@ -26,7 +26,7 @@ type AddDynamic<T> = T extends any
|
||||
|
||||
export type DynamicTemplateFunctionArg = AddDynamic<FormInput>;
|
||||
|
||||
export type TemplateFunctionPlugin = Omit<TemplateFunction, 'args'> & {
|
||||
export type TemplateFunctionPlugin = Omit<TemplateFunction, "args"> & {
|
||||
args: DynamicTemplateFunctionArg[];
|
||||
onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null>;
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import type { Theme } from '../bindings/gen_events';
|
||||
import type { Theme } from "../bindings/gen_events";
|
||||
|
||||
export type ThemePlugin = Theme;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type {
|
||||
CallWebsocketRequestActionArgs,
|
||||
WebsocketRequestAction,
|
||||
} from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
} from "../bindings/gen_events";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
export type WebsocketRequestActionPlugin = WebsocketRequestAction & {
|
||||
onSelect(ctx: Context, args: CallWebsocketRequestActionArgs): Promise<void> | void;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CallWorkspaceActionArgs, WorkspaceAction } from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
import type { CallWorkspaceActionArgs, WorkspaceAction } from "../bindings/gen_events";
|
||||
import type { Context } from "./Context";
|
||||
|
||||
export type WorkspaceActionPlugin = WorkspaceAction & {
|
||||
onSelect(ctx: Context, args: CallWorkspaceActionArgs): Promise<void> | void;
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import type { AuthenticationPlugin } from './AuthenticationPlugin';
|
||||
import type { AuthenticationPlugin } from "./AuthenticationPlugin";
|
||||
|
||||
import type { Context } from './Context';
|
||||
import type { FilterPlugin } from './FilterPlugin';
|
||||
import type { FolderActionPlugin } from './FolderActionPlugin';
|
||||
import type { GrpcRequestActionPlugin } from './GrpcRequestActionPlugin';
|
||||
import type { HttpRequestActionPlugin } from './HttpRequestActionPlugin';
|
||||
import type { ImporterPlugin } from './ImporterPlugin';
|
||||
import type { TemplateFunctionPlugin } from './TemplateFunctionPlugin';
|
||||
import type { ThemePlugin } from './ThemePlugin';
|
||||
import type { WebsocketRequestActionPlugin } from './WebsocketRequestActionPlugin';
|
||||
import type { WorkspaceActionPlugin } from './WorkspaceActionPlugin';
|
||||
import type { Context } from "./Context";
|
||||
import type { FilterPlugin } from "./FilterPlugin";
|
||||
import type { FolderActionPlugin } from "./FolderActionPlugin";
|
||||
import type { GrpcRequestActionPlugin } from "./GrpcRequestActionPlugin";
|
||||
import type { HttpRequestActionPlugin } from "./HttpRequestActionPlugin";
|
||||
import type { ImporterPlugin } from "./ImporterPlugin";
|
||||
import type { TemplateFunctionPlugin } from "./TemplateFunctionPlugin";
|
||||
import type { ThemePlugin } from "./ThemePlugin";
|
||||
import type { WebsocketRequestActionPlugin } from "./WebsocketRequestActionPlugin";
|
||||
import type { WorkspaceActionPlugin } from "./WorkspaceActionPlugin";
|
||||
|
||||
export type { Context };
|
||||
export type { DynamicAuthenticationArg } from './AuthenticationPlugin';
|
||||
export type { CallPromptFormDynamicArgs, DynamicPromptFormArg } from './Context';
|
||||
export type { DynamicTemplateFunctionArg } from './TemplateFunctionPlugin';
|
||||
export type { DynamicAuthenticationArg } from "./AuthenticationPlugin";
|
||||
export type { CallPromptFormDynamicArgs, DynamicPromptFormArg } from "./Context";
|
||||
export type { DynamicTemplateFunctionArg } from "./TemplateFunctionPlugin";
|
||||
export type { TemplateFunctionPlugin };
|
||||
export type { FolderActionPlugin } from './FolderActionPlugin';
|
||||
export type { WorkspaceActionPlugin } from './WorkspaceActionPlugin';
|
||||
export type { FolderActionPlugin } from "./FolderActionPlugin";
|
||||
export type { WorkspaceActionPlugin } from "./WorkspaceActionPlugin";
|
||||
|
||||
/**
|
||||
* The global structure of a Yaak plugin
|
||||
|
||||
Reference in New Issue
Block a user