@yaakapp/api 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/bindings/gen_events.d.ts +210 -11
- package/lib/bindings/gen_models.d.ts +261 -0
- package/lib/plugins/AuthenticationPlugin.d.ts +15 -6
- package/lib/plugins/Context.d.ts +30 -2
- package/lib/plugins/FilterPlugin.d.ts +1 -1
- package/lib/plugins/FolderActionPlugin.d.ts +5 -0
- package/lib/plugins/FolderActionPlugin.js +2 -0
- package/lib/plugins/GrpcRequestActionPlugin.d.ts +1 -1
- package/lib/plugins/HttpCollectionActionPlugin.d.ts +14 -0
- package/lib/plugins/HttpCollectionActionPlugin.js +2 -0
- package/lib/plugins/ImporterPlugin.d.ts +2 -2
- package/lib/plugins/McpPlugin.d.ts +56 -0
- package/lib/plugins/McpPlugin.js +2 -0
- package/lib/plugins/TemplateFunctionPlugin.d.ts +17 -7
- package/lib/plugins/ThemePlugin.d.ts +1 -1
- package/lib/plugins/WebSocketRequestActionPlugin.d.ts +5 -0
- package/lib/plugins/WebSocketRequestActionPlugin.js +2 -0
- package/lib/plugins/WorkspaceActionPlugin.d.ts +5 -0
- package/lib/plugins/WorkspaceActionPlugin.js +2 -0
- package/lib/plugins/index.d.ts +14 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npx @yaakapp/cli generate
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
For more details on creating plugins, check out
|
|
20
|
-
the [Quick Start Guide](https://
|
|
20
|
+
the [Quick Start Guide](https://yaak.app/docs/plugin-development/plugins-quick-start)
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import type { Environment, Folder, GrpcRequest, HttpRequest, HttpResponse, WebsocketRequest, Workspace } from "./gen_models
|
|
2
|
-
import type { JsonValue } from "./serde_json/JsonValue
|
|
1
|
+
import type { AnyModel, Environment, Folder, GrpcRequest, HttpRequest, HttpResponse, WebsocketRequest, Workspace } from "./gen_models";
|
|
2
|
+
import type { JsonValue } from "./serde_json/JsonValue";
|
|
3
3
|
export type BootRequest = {
|
|
4
4
|
dir: string;
|
|
5
5
|
watch: boolean;
|
|
6
6
|
};
|
|
7
|
+
export type CallFolderActionArgs = {
|
|
8
|
+
folder: Folder;
|
|
9
|
+
};
|
|
10
|
+
export type CallFolderActionRequest = {
|
|
11
|
+
index: number;
|
|
12
|
+
pluginRefId: string;
|
|
13
|
+
args: CallFolderActionArgs;
|
|
14
|
+
};
|
|
7
15
|
export type CallGrpcRequestActionArgs = {
|
|
8
16
|
grpcRequest: GrpcRequest;
|
|
9
17
|
protoFiles: Array<string>;
|
|
@@ -56,7 +64,7 @@ export type CallHttpRequestActionRequest = {
|
|
|
56
64
|
export type CallTemplateFunctionArgs = {
|
|
57
65
|
purpose: RenderPurpose;
|
|
58
66
|
values: {
|
|
59
|
-
[key in string]?:
|
|
67
|
+
[key in string]?: JsonPrimitive;
|
|
60
68
|
};
|
|
61
69
|
};
|
|
62
70
|
export type CallTemplateFunctionRequest = {
|
|
@@ -67,6 +75,22 @@ export type CallTemplateFunctionResponse = {
|
|
|
67
75
|
value: string | null;
|
|
68
76
|
error?: string;
|
|
69
77
|
};
|
|
78
|
+
export type CallWebsocketRequestActionArgs = {
|
|
79
|
+
websocketRequest: WebsocketRequest;
|
|
80
|
+
};
|
|
81
|
+
export type CallWebsocketRequestActionRequest = {
|
|
82
|
+
index: number;
|
|
83
|
+
pluginRefId: string;
|
|
84
|
+
args: CallWebsocketRequestActionArgs;
|
|
85
|
+
};
|
|
86
|
+
export type CallWorkspaceActionArgs = {
|
|
87
|
+
workspace: Workspace;
|
|
88
|
+
};
|
|
89
|
+
export type CallWorkspaceActionRequest = {
|
|
90
|
+
index: number;
|
|
91
|
+
pluginRefId: string;
|
|
92
|
+
args: CallWorkspaceActionArgs;
|
|
93
|
+
};
|
|
70
94
|
export type CloseWindowRequest = {
|
|
71
95
|
label: string;
|
|
72
96
|
};
|
|
@@ -88,6 +112,13 @@ export type DeleteKeyValueRequest = {
|
|
|
88
112
|
export type DeleteKeyValueResponse = {
|
|
89
113
|
deleted: boolean;
|
|
90
114
|
};
|
|
115
|
+
export type DeleteModelRequest = {
|
|
116
|
+
model: string;
|
|
117
|
+
id: string;
|
|
118
|
+
};
|
|
119
|
+
export type DeleteModelResponse = {
|
|
120
|
+
model: AnyModel;
|
|
121
|
+
};
|
|
91
122
|
export type EditorLanguage = "text" | "javascript" | "json" | "html" | "xml" | "graphql" | "markdown";
|
|
92
123
|
export type EmptyPayload = {};
|
|
93
124
|
export type ErrorResponse = {
|
|
@@ -121,6 +152,10 @@ export type FindHttpResponsesRequest = {
|
|
|
121
152
|
export type FindHttpResponsesResponse = {
|
|
122
153
|
httpResponses: Array<HttpResponse>;
|
|
123
154
|
};
|
|
155
|
+
export type FolderAction = {
|
|
156
|
+
label: string;
|
|
157
|
+
icon?: Icon;
|
|
158
|
+
};
|
|
124
159
|
export type FormInput = {
|
|
125
160
|
"type": "text";
|
|
126
161
|
} & FormInputText | {
|
|
@@ -136,10 +171,14 @@ export type FormInput = {
|
|
|
136
171
|
} & FormInputHttpRequest | {
|
|
137
172
|
"type": "accordion";
|
|
138
173
|
} & FormInputAccordion | {
|
|
174
|
+
"type": "h_stack";
|
|
175
|
+
} & FormInputHStack | {
|
|
139
176
|
"type": "banner";
|
|
140
177
|
} & FormInputBanner | {
|
|
141
178
|
"type": "markdown";
|
|
142
|
-
} & FormInputMarkdown
|
|
179
|
+
} & FormInputMarkdown | {
|
|
180
|
+
"type": "key_value";
|
|
181
|
+
} & FormInputKeyValue;
|
|
143
182
|
export type FormInputAccordion = {
|
|
144
183
|
label: string;
|
|
145
184
|
inputs?: Array<FormInput>;
|
|
@@ -303,6 +342,10 @@ export type FormInputFile = {
|
|
|
303
342
|
*/
|
|
304
343
|
description?: string;
|
|
305
344
|
};
|
|
345
|
+
export type FormInputHStack = {
|
|
346
|
+
inputs?: Array<FormInput>;
|
|
347
|
+
hidden?: boolean;
|
|
348
|
+
};
|
|
306
349
|
export type FormInputHttpRequest = {
|
|
307
350
|
/**
|
|
308
351
|
* The name of the input. The value will be stored at this object attribute in the resulting data
|
|
@@ -335,6 +378,38 @@ export type FormInputHttpRequest = {
|
|
|
335
378
|
*/
|
|
336
379
|
description?: string;
|
|
337
380
|
};
|
|
381
|
+
export type FormInputKeyValue = {
|
|
382
|
+
/**
|
|
383
|
+
* The name of the input. The value will be stored at this object attribute in the resulting data
|
|
384
|
+
*/
|
|
385
|
+
name: string;
|
|
386
|
+
/**
|
|
387
|
+
* Whether this input is visible for the given configuration. Use this to
|
|
388
|
+
* make branching forms.
|
|
389
|
+
*/
|
|
390
|
+
hidden?: boolean;
|
|
391
|
+
/**
|
|
392
|
+
* Whether the user must fill in the argument
|
|
393
|
+
*/
|
|
394
|
+
optional?: boolean;
|
|
395
|
+
/**
|
|
396
|
+
* The label of the input
|
|
397
|
+
*/
|
|
398
|
+
label?: string;
|
|
399
|
+
/**
|
|
400
|
+
* Visually hide the label of the input
|
|
401
|
+
*/
|
|
402
|
+
hideLabel?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* The default value
|
|
405
|
+
*/
|
|
406
|
+
defaultValue?: string;
|
|
407
|
+
disabled?: boolean;
|
|
408
|
+
/**
|
|
409
|
+
* Longer description of the input, likely shown in a tooltip
|
|
410
|
+
*/
|
|
411
|
+
description?: string;
|
|
412
|
+
};
|
|
338
413
|
export type FormInputMarkdown = {
|
|
339
414
|
content: string;
|
|
340
415
|
hidden?: boolean;
|
|
@@ -437,6 +512,10 @@ export type GetCookieValueRequest = {
|
|
|
437
512
|
export type GetCookieValueResponse = {
|
|
438
513
|
value: string | null;
|
|
439
514
|
};
|
|
515
|
+
export type GetFolderActionsResponse = {
|
|
516
|
+
actions: Array<FolderAction>;
|
|
517
|
+
pluginRefId: string;
|
|
518
|
+
};
|
|
440
519
|
export type GetGrpcRequestActionsResponse = {
|
|
441
520
|
actions: Array<GrpcRequestAction>;
|
|
442
521
|
pluginRefId: string;
|
|
@@ -492,6 +571,14 @@ export type GetThemesRequest = Record<string, never>;
|
|
|
492
571
|
export type GetThemesResponse = {
|
|
493
572
|
themes: Array<Theme>;
|
|
494
573
|
};
|
|
574
|
+
export type GetWebsocketRequestActionsResponse = {
|
|
575
|
+
actions: Array<WebsocketRequestAction>;
|
|
576
|
+
pluginRefId: string;
|
|
577
|
+
};
|
|
578
|
+
export type GetWorkspaceActionsResponse = {
|
|
579
|
+
actions: Array<WorkspaceAction>;
|
|
580
|
+
pluginRefId: string;
|
|
581
|
+
};
|
|
495
582
|
export type GrpcRequestAction = {
|
|
496
583
|
label: string;
|
|
497
584
|
icon?: Icon;
|
|
@@ -528,7 +615,7 @@ export type InternalEvent = {
|
|
|
528
615
|
pluginRefId: string;
|
|
529
616
|
pluginName: string;
|
|
530
617
|
replyId: string | null;
|
|
531
|
-
|
|
618
|
+
context: PluginContext;
|
|
532
619
|
payload: InternalEventPayload;
|
|
533
620
|
};
|
|
534
621
|
export type InternalEventPayload = {
|
|
@@ -572,6 +659,24 @@ export type InternalEventPayload = {
|
|
|
572
659
|
} & GetHttpRequestActionsResponse | {
|
|
573
660
|
"type": "call_http_request_action_request";
|
|
574
661
|
} & CallHttpRequestActionRequest | {
|
|
662
|
+
"type": "get_websocket_request_actions_request";
|
|
663
|
+
} & EmptyPayload | {
|
|
664
|
+
"type": "get_websocket_request_actions_response";
|
|
665
|
+
} & GetWebsocketRequestActionsResponse | {
|
|
666
|
+
"type": "call_websocket_request_action_request";
|
|
667
|
+
} & CallWebsocketRequestActionRequest | {
|
|
668
|
+
"type": "get_workspace_actions_request";
|
|
669
|
+
} & EmptyPayload | {
|
|
670
|
+
"type": "get_workspace_actions_response";
|
|
671
|
+
} & GetWorkspaceActionsResponse | {
|
|
672
|
+
"type": "call_workspace_action_request";
|
|
673
|
+
} & CallWorkspaceActionRequest | {
|
|
674
|
+
"type": "get_folder_actions_request";
|
|
675
|
+
} & EmptyPayload | {
|
|
676
|
+
"type": "get_folder_actions_response";
|
|
677
|
+
} & GetFolderActionsResponse | {
|
|
678
|
+
"type": "call_folder_action_request";
|
|
679
|
+
} & CallFolderActionRequest | {
|
|
575
680
|
"type": "get_grpc_request_actions_request";
|
|
576
681
|
} & EmptyPayload | {
|
|
577
682
|
"type": "get_grpc_request_actions_response";
|
|
@@ -642,6 +747,10 @@ export type InternalEventPayload = {
|
|
|
642
747
|
} | {
|
|
643
748
|
"type": "close_window_request";
|
|
644
749
|
} & CloseWindowRequest | {
|
|
750
|
+
"type": "open_external_url_request";
|
|
751
|
+
} & OpenExternalUrlRequest | {
|
|
752
|
+
"type": "open_external_url_response";
|
|
753
|
+
} & EmptyPayload | {
|
|
645
754
|
"type": "show_toast_request";
|
|
646
755
|
} & ShowToastRequest | {
|
|
647
756
|
"type": "show_toast_response";
|
|
@@ -650,6 +759,18 @@ export type InternalEventPayload = {
|
|
|
650
759
|
} & PromptTextRequest | {
|
|
651
760
|
"type": "prompt_text_response";
|
|
652
761
|
} & PromptTextResponse | {
|
|
762
|
+
"type": "prompt_form_request";
|
|
763
|
+
} & PromptFormRequest | {
|
|
764
|
+
"type": "prompt_form_response";
|
|
765
|
+
} & PromptFormResponse | {
|
|
766
|
+
"type": "window_info_request";
|
|
767
|
+
} & WindowInfoRequest | {
|
|
768
|
+
"type": "window_info_response";
|
|
769
|
+
} & WindowInfoResponse | {
|
|
770
|
+
"type": "list_workspaces_request";
|
|
771
|
+
} & ListWorkspacesRequest | {
|
|
772
|
+
"type": "list_workspaces_response";
|
|
773
|
+
} & ListWorkspacesResponse | {
|
|
653
774
|
"type": "get_http_request_by_id_request";
|
|
654
775
|
} & GetHttpRequestByIdRequest | {
|
|
655
776
|
"type": "get_http_request_by_id_response";
|
|
@@ -658,6 +779,22 @@ export type InternalEventPayload = {
|
|
|
658
779
|
} & FindHttpResponsesRequest | {
|
|
659
780
|
"type": "find_http_responses_response";
|
|
660
781
|
} & FindHttpResponsesResponse | {
|
|
782
|
+
"type": "list_http_requests_request";
|
|
783
|
+
} & ListHttpRequestsRequest | {
|
|
784
|
+
"type": "list_http_requests_response";
|
|
785
|
+
} & ListHttpRequestsResponse | {
|
|
786
|
+
"type": "list_folders_request";
|
|
787
|
+
} & ListFoldersRequest | {
|
|
788
|
+
"type": "list_folders_response";
|
|
789
|
+
} & ListFoldersResponse | {
|
|
790
|
+
"type": "upsert_model_request";
|
|
791
|
+
} & UpsertModelRequest | {
|
|
792
|
+
"type": "upsert_model_response";
|
|
793
|
+
} & UpsertModelResponse | {
|
|
794
|
+
"type": "delete_model_request";
|
|
795
|
+
} & DeleteModelRequest | {
|
|
796
|
+
"type": "delete_model_response";
|
|
797
|
+
} & DeleteModelResponse | {
|
|
661
798
|
"type": "get_themes_request";
|
|
662
799
|
} & GetThemesRequest | {
|
|
663
800
|
"type": "get_themes_response";
|
|
@@ -671,6 +808,23 @@ export type ListCookieNamesRequest = {};
|
|
|
671
808
|
export type ListCookieNamesResponse = {
|
|
672
809
|
names: Array<string>;
|
|
673
810
|
};
|
|
811
|
+
export type ListFoldersRequest = {};
|
|
812
|
+
export type ListFoldersResponse = {
|
|
813
|
+
folders: Array<Folder>;
|
|
814
|
+
};
|
|
815
|
+
export type ListHttpRequestsRequest = {
|
|
816
|
+
folderId?: string;
|
|
817
|
+
};
|
|
818
|
+
export type ListHttpRequestsResponse = {
|
|
819
|
+
httpRequests: Array<HttpRequest>;
|
|
820
|
+
};
|
|
821
|
+
export type ListWorkspacesRequest = Record<string, never>;
|
|
822
|
+
export type ListWorkspacesResponse = {
|
|
823
|
+
workspaces: Array<WorkspaceInfo>;
|
|
824
|
+
};
|
|
825
|
+
export type OpenExternalUrlRequest = {
|
|
826
|
+
url: string;
|
|
827
|
+
};
|
|
674
828
|
export type OpenWindowRequest = {
|
|
675
829
|
url: string;
|
|
676
830
|
/**
|
|
@@ -681,12 +835,23 @@ export type OpenWindowRequest = {
|
|
|
681
835
|
size?: WindowSize;
|
|
682
836
|
dataDirKey?: string;
|
|
683
837
|
};
|
|
684
|
-
export type
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
838
|
+
export type PluginContext = {
|
|
839
|
+
id: string;
|
|
840
|
+
label: string | null;
|
|
841
|
+
workspaceId: string | null;
|
|
842
|
+
};
|
|
843
|
+
export type PromptFormRequest = {
|
|
844
|
+
id: string;
|
|
845
|
+
title: string;
|
|
846
|
+
description?: string;
|
|
847
|
+
inputs: Array<FormInput>;
|
|
848
|
+
confirmText?: string;
|
|
849
|
+
cancelText?: string;
|
|
850
|
+
};
|
|
851
|
+
export type PromptFormResponse = {
|
|
852
|
+
values: {
|
|
853
|
+
[key in string]?: JsonPrimitive;
|
|
854
|
+
} | null;
|
|
690
855
|
};
|
|
691
856
|
export type PromptTextRequest = {
|
|
692
857
|
id: string;
|
|
@@ -699,6 +864,7 @@ export type PromptTextRequest = {
|
|
|
699
864
|
* Text to add to the confirmation button
|
|
700
865
|
*/
|
|
701
866
|
confirmText?: string;
|
|
867
|
+
password?: boolean;
|
|
702
868
|
/**
|
|
703
869
|
* Text to add to the cancel button
|
|
704
870
|
*/
|
|
@@ -748,6 +914,7 @@ export type ShowToastRequest = {
|
|
|
748
914
|
};
|
|
749
915
|
export type TemplateFunction = {
|
|
750
916
|
name: string;
|
|
917
|
+
previewType?: TemplateFunctionPreviewType;
|
|
751
918
|
description?: string;
|
|
752
919
|
/**
|
|
753
920
|
* Also support alternative names. This is useful for not breaking existing
|
|
@@ -755,11 +922,16 @@ export type TemplateFunction = {
|
|
|
755
922
|
*/
|
|
756
923
|
aliases?: Array<string>;
|
|
757
924
|
args: Array<TemplateFunctionArg>;
|
|
925
|
+
/**
|
|
926
|
+
* A list of arg names to show in the inline preview. If not provided, none will be shown (for privacy reasons).
|
|
927
|
+
*/
|
|
928
|
+
previewArgs?: Array<string>;
|
|
758
929
|
};
|
|
759
930
|
/**
|
|
760
931
|
* Similar to FormInput, but contains
|
|
761
932
|
*/
|
|
762
933
|
export type TemplateFunctionArg = FormInput;
|
|
934
|
+
export type TemplateFunctionPreviewType = "live" | "click" | "none";
|
|
763
935
|
export type TemplateRenderRequest = {
|
|
764
936
|
data: JsonValue;
|
|
765
937
|
purpose: RenderPurpose;
|
|
@@ -824,6 +996,25 @@ export type ThemeComponents = {
|
|
|
824
996
|
editor?: ThemeComponentColors;
|
|
825
997
|
input?: ThemeComponentColors;
|
|
826
998
|
};
|
|
999
|
+
export type UpsertModelRequest = {
|
|
1000
|
+
model: AnyModel;
|
|
1001
|
+
};
|
|
1002
|
+
export type UpsertModelResponse = {
|
|
1003
|
+
model: AnyModel;
|
|
1004
|
+
};
|
|
1005
|
+
export type WebsocketRequestAction = {
|
|
1006
|
+
label: string;
|
|
1007
|
+
icon?: Icon;
|
|
1008
|
+
};
|
|
1009
|
+
export type WindowInfoRequest = {
|
|
1010
|
+
label: string;
|
|
1011
|
+
};
|
|
1012
|
+
export type WindowInfoResponse = {
|
|
1013
|
+
requestId: string | null;
|
|
1014
|
+
environmentId: string | null;
|
|
1015
|
+
workspaceId: string | null;
|
|
1016
|
+
label: string;
|
|
1017
|
+
};
|
|
827
1018
|
export type WindowNavigateEvent = {
|
|
828
1019
|
url: string;
|
|
829
1020
|
};
|
|
@@ -831,3 +1022,11 @@ export type WindowSize = {
|
|
|
831
1022
|
width: number;
|
|
832
1023
|
height: number;
|
|
833
1024
|
};
|
|
1025
|
+
export type WorkspaceAction = {
|
|
1026
|
+
label: string;
|
|
1027
|
+
icon?: Icon;
|
|
1028
|
+
};
|
|
1029
|
+
export type WorkspaceInfo = {
|
|
1030
|
+
id: string;
|
|
1031
|
+
name: string;
|
|
1032
|
+
};
|
|
@@ -1,3 +1,46 @@
|
|
|
1
|
+
export type AnyModel = CookieJar | Environment | Folder | GraphQlIntrospection | GrpcConnection | GrpcEvent | GrpcRequest | HttpRequest | HttpResponse | HttpResponseEvent | KeyValue | Plugin | Settings | SyncState | WebsocketConnection | WebsocketEvent | WebsocketRequest | Workspace | WorkspaceMeta;
|
|
2
|
+
export type ClientCertificate = {
|
|
3
|
+
host: string;
|
|
4
|
+
port: number | null;
|
|
5
|
+
crtFile: string | null;
|
|
6
|
+
keyFile: string | null;
|
|
7
|
+
pfxFile: string | null;
|
|
8
|
+
passphrase: string | null;
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type Cookie = {
|
|
12
|
+
raw_cookie: string;
|
|
13
|
+
domain: CookieDomain;
|
|
14
|
+
expires: CookieExpires;
|
|
15
|
+
path: [string, boolean];
|
|
16
|
+
};
|
|
17
|
+
export type CookieDomain = {
|
|
18
|
+
"HostOnly": string;
|
|
19
|
+
} | {
|
|
20
|
+
"Suffix": string;
|
|
21
|
+
} | "NotPresent" | "Empty";
|
|
22
|
+
export type CookieExpires = {
|
|
23
|
+
"AtUtc": string;
|
|
24
|
+
} | "SessionEnd";
|
|
25
|
+
export type CookieJar = {
|
|
26
|
+
model: "cookie_jar";
|
|
27
|
+
id: string;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
workspaceId: string;
|
|
31
|
+
cookies: Array<Cookie>;
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
export type DnsOverride = {
|
|
35
|
+
hostname: string;
|
|
36
|
+
ipv4: Array<string>;
|
|
37
|
+
ipv6: Array<string>;
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
};
|
|
40
|
+
export type EditorKeymap = "default" | "vim" | "vscode" | "emacs";
|
|
41
|
+
export type EncryptedKey = {
|
|
42
|
+
encryptedKey: string;
|
|
43
|
+
};
|
|
1
44
|
export type Environment = {
|
|
2
45
|
model: "environment";
|
|
3
46
|
id: string;
|
|
@@ -10,6 +53,7 @@ export type Environment = {
|
|
|
10
53
|
parentId: string | null;
|
|
11
54
|
variables: Array<EnvironmentVariable>;
|
|
12
55
|
color: string | null;
|
|
56
|
+
sortPriority: number;
|
|
13
57
|
};
|
|
14
58
|
export type EnvironmentVariable = {
|
|
15
59
|
enabled?: boolean;
|
|
@@ -31,6 +75,51 @@ export type Folder = {
|
|
|
31
75
|
name: string;
|
|
32
76
|
sortPriority: number;
|
|
33
77
|
};
|
|
78
|
+
export type GraphQlIntrospection = {
|
|
79
|
+
model: "graphql_introspection";
|
|
80
|
+
id: string;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
updatedAt: string;
|
|
83
|
+
workspaceId: string;
|
|
84
|
+
requestId: string;
|
|
85
|
+
content: string | null;
|
|
86
|
+
};
|
|
87
|
+
export type GrpcConnection = {
|
|
88
|
+
model: "grpc_connection";
|
|
89
|
+
id: string;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
updatedAt: string;
|
|
92
|
+
workspaceId: string;
|
|
93
|
+
requestId: string;
|
|
94
|
+
elapsed: number;
|
|
95
|
+
error: string | null;
|
|
96
|
+
method: string;
|
|
97
|
+
service: string;
|
|
98
|
+
status: number;
|
|
99
|
+
state: GrpcConnectionState;
|
|
100
|
+
trailers: {
|
|
101
|
+
[key in string]?: string;
|
|
102
|
+
};
|
|
103
|
+
url: string;
|
|
104
|
+
};
|
|
105
|
+
export type GrpcConnectionState = "initialized" | "connected" | "closed";
|
|
106
|
+
export type GrpcEvent = {
|
|
107
|
+
model: "grpc_event";
|
|
108
|
+
id: string;
|
|
109
|
+
createdAt: string;
|
|
110
|
+
updatedAt: string;
|
|
111
|
+
workspaceId: string;
|
|
112
|
+
requestId: string;
|
|
113
|
+
connectionId: string;
|
|
114
|
+
content: string;
|
|
115
|
+
error: string | null;
|
|
116
|
+
eventType: GrpcEventType;
|
|
117
|
+
metadata: {
|
|
118
|
+
[key in string]?: string;
|
|
119
|
+
};
|
|
120
|
+
status: number | null;
|
|
121
|
+
};
|
|
122
|
+
export type GrpcEventType = "info" | "error" | "client_message" | "server_message" | "connection_start" | "connection_end";
|
|
34
123
|
export type GrpcRequest = {
|
|
35
124
|
model: "grpc_request";
|
|
36
125
|
id: string;
|
|
@@ -83,17 +172,76 @@ export type HttpResponse = {
|
|
|
83
172
|
requestId: string;
|
|
84
173
|
bodyPath: string | null;
|
|
85
174
|
contentLength: number | null;
|
|
175
|
+
contentLengthCompressed: number | null;
|
|
86
176
|
elapsed: number;
|
|
87
177
|
elapsedHeaders: number;
|
|
178
|
+
elapsedDns: number;
|
|
88
179
|
error: string | null;
|
|
89
180
|
headers: Array<HttpResponseHeader>;
|
|
90
181
|
remoteAddr: string | null;
|
|
182
|
+
requestContentLength: number | null;
|
|
183
|
+
requestHeaders: Array<HttpResponseHeader>;
|
|
91
184
|
status: number;
|
|
92
185
|
statusReason: string | null;
|
|
93
186
|
state: HttpResponseState;
|
|
94
187
|
url: string;
|
|
95
188
|
version: string | null;
|
|
96
189
|
};
|
|
190
|
+
export type HttpResponseEvent = {
|
|
191
|
+
model: "http_response_event";
|
|
192
|
+
id: string;
|
|
193
|
+
createdAt: string;
|
|
194
|
+
updatedAt: string;
|
|
195
|
+
workspaceId: string;
|
|
196
|
+
responseId: string;
|
|
197
|
+
event: HttpResponseEventData;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Serializable representation of HTTP response events for DB storage.
|
|
201
|
+
* This mirrors `yaak_http::sender::HttpResponseEvent` but with serde support.
|
|
202
|
+
* The `From` impl is in yaak-http to avoid circular dependencies.
|
|
203
|
+
*/
|
|
204
|
+
export type HttpResponseEventData = {
|
|
205
|
+
"type": "setting";
|
|
206
|
+
name: string;
|
|
207
|
+
value: string;
|
|
208
|
+
} | {
|
|
209
|
+
"type": "info";
|
|
210
|
+
message: string;
|
|
211
|
+
} | {
|
|
212
|
+
"type": "redirect";
|
|
213
|
+
url: string;
|
|
214
|
+
status: number;
|
|
215
|
+
behavior: string;
|
|
216
|
+
} | {
|
|
217
|
+
"type": "send_url";
|
|
218
|
+
method: string;
|
|
219
|
+
path: string;
|
|
220
|
+
} | {
|
|
221
|
+
"type": "receive_url";
|
|
222
|
+
version: string;
|
|
223
|
+
status: string;
|
|
224
|
+
} | {
|
|
225
|
+
"type": "header_up";
|
|
226
|
+
name: string;
|
|
227
|
+
value: string;
|
|
228
|
+
} | {
|
|
229
|
+
"type": "header_down";
|
|
230
|
+
name: string;
|
|
231
|
+
value: string;
|
|
232
|
+
} | {
|
|
233
|
+
"type": "chunk_sent";
|
|
234
|
+
bytes: number;
|
|
235
|
+
} | {
|
|
236
|
+
"type": "chunk_received";
|
|
237
|
+
bytes: number;
|
|
238
|
+
} | {
|
|
239
|
+
"type": "dns_resolved";
|
|
240
|
+
hostname: string;
|
|
241
|
+
addresses: Array<string>;
|
|
242
|
+
duration: bigint;
|
|
243
|
+
overridden: boolean;
|
|
244
|
+
};
|
|
97
245
|
export type HttpResponseHeader = {
|
|
98
246
|
name: string;
|
|
99
247
|
value: string;
|
|
@@ -105,6 +253,109 @@ export type HttpUrlParameter = {
|
|
|
105
253
|
value: string;
|
|
106
254
|
id?: string;
|
|
107
255
|
};
|
|
256
|
+
export type KeyValue = {
|
|
257
|
+
model: "key_value";
|
|
258
|
+
id: string;
|
|
259
|
+
createdAt: string;
|
|
260
|
+
updatedAt: string;
|
|
261
|
+
key: string;
|
|
262
|
+
namespace: string;
|
|
263
|
+
value: string;
|
|
264
|
+
};
|
|
265
|
+
export type Plugin = {
|
|
266
|
+
model: "plugin";
|
|
267
|
+
id: string;
|
|
268
|
+
createdAt: string;
|
|
269
|
+
updatedAt: string;
|
|
270
|
+
checkedAt: string | null;
|
|
271
|
+
directory: string;
|
|
272
|
+
enabled: boolean;
|
|
273
|
+
url: string | null;
|
|
274
|
+
};
|
|
275
|
+
export type ProxySetting = {
|
|
276
|
+
"type": "enabled";
|
|
277
|
+
http: string;
|
|
278
|
+
https: string;
|
|
279
|
+
auth: ProxySettingAuth | null;
|
|
280
|
+
bypass: string;
|
|
281
|
+
disabled: boolean;
|
|
282
|
+
} | {
|
|
283
|
+
"type": "disabled";
|
|
284
|
+
};
|
|
285
|
+
export type ProxySettingAuth = {
|
|
286
|
+
user: string;
|
|
287
|
+
password: string;
|
|
288
|
+
};
|
|
289
|
+
export type Settings = {
|
|
290
|
+
model: "settings";
|
|
291
|
+
id: string;
|
|
292
|
+
createdAt: string;
|
|
293
|
+
updatedAt: string;
|
|
294
|
+
appearance: string;
|
|
295
|
+
clientCertificates: Array<ClientCertificate>;
|
|
296
|
+
coloredMethods: boolean;
|
|
297
|
+
editorFont: string | null;
|
|
298
|
+
editorFontSize: number;
|
|
299
|
+
editorKeymap: EditorKeymap;
|
|
300
|
+
editorSoftWrap: boolean;
|
|
301
|
+
hideWindowControls: boolean;
|
|
302
|
+
useNativeTitlebar: boolean;
|
|
303
|
+
interfaceFont: string | null;
|
|
304
|
+
interfaceFontSize: number;
|
|
305
|
+
interfaceScale: number;
|
|
306
|
+
openWorkspaceNewWindow: boolean | null;
|
|
307
|
+
proxy: ProxySetting | null;
|
|
308
|
+
themeDark: string;
|
|
309
|
+
themeLight: string;
|
|
310
|
+
updateChannel: string;
|
|
311
|
+
hideLicenseBadge: boolean;
|
|
312
|
+
autoupdate: boolean;
|
|
313
|
+
autoDownloadUpdates: boolean;
|
|
314
|
+
checkNotifications: boolean;
|
|
315
|
+
hotkeys: {
|
|
316
|
+
[key in string]?: Array<string>;
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
export type SyncState = {
|
|
320
|
+
model: "sync_state";
|
|
321
|
+
id: string;
|
|
322
|
+
workspaceId: string;
|
|
323
|
+
createdAt: string;
|
|
324
|
+
updatedAt: string;
|
|
325
|
+
flushedAt: string;
|
|
326
|
+
modelId: string;
|
|
327
|
+
checksum: string;
|
|
328
|
+
relPath: string;
|
|
329
|
+
syncDir: string;
|
|
330
|
+
};
|
|
331
|
+
export type WebsocketConnection = {
|
|
332
|
+
model: "websocket_connection";
|
|
333
|
+
id: string;
|
|
334
|
+
createdAt: string;
|
|
335
|
+
updatedAt: string;
|
|
336
|
+
workspaceId: string;
|
|
337
|
+
requestId: string;
|
|
338
|
+
elapsed: number;
|
|
339
|
+
error: string | null;
|
|
340
|
+
headers: Array<HttpResponseHeader>;
|
|
341
|
+
state: WebsocketConnectionState;
|
|
342
|
+
status: number;
|
|
343
|
+
url: string;
|
|
344
|
+
};
|
|
345
|
+
export type WebsocketConnectionState = "initialized" | "connected" | "closing" | "closed";
|
|
346
|
+
export type WebsocketEvent = {
|
|
347
|
+
model: "websocket_event";
|
|
348
|
+
id: string;
|
|
349
|
+
createdAt: string;
|
|
350
|
+
updatedAt: string;
|
|
351
|
+
workspaceId: string;
|
|
352
|
+
requestId: string;
|
|
353
|
+
connectionId: string;
|
|
354
|
+
isServer: boolean;
|
|
355
|
+
message: Array<number>;
|
|
356
|
+
messageType: WebsocketEventType;
|
|
357
|
+
};
|
|
358
|
+
export type WebsocketEventType = "binary" | "close" | "frame" | "open" | "ping" | "pong" | "text";
|
|
108
359
|
export type WebsocketRequest = {
|
|
109
360
|
model: "websocket_request";
|
|
110
361
|
id: string;
|
|
@@ -136,4 +387,14 @@ export type Workspace = {
|
|
|
136
387
|
settingValidateCertificates: boolean;
|
|
137
388
|
settingFollowRedirects: boolean;
|
|
138
389
|
settingRequestTimeout: number;
|
|
390
|
+
settingDnsOverrides: Array<DnsOverride>;
|
|
391
|
+
};
|
|
392
|
+
export type WorkspaceMeta = {
|
|
393
|
+
model: "workspace_meta";
|
|
394
|
+
id: string;
|
|
395
|
+
workspaceId: string;
|
|
396
|
+
createdAt: string;
|
|
397
|
+
updatedAt: string;
|
|
398
|
+
encryptionKey: EncryptedKey | null;
|
|
399
|
+
settingSyncDir: string | null;
|
|
139
400
|
};
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import { CallHttpAuthenticationActionArgs, CallHttpAuthenticationRequest, CallHttpAuthenticationResponse, FormInput,
|
|
2
|
-
import { MaybePromise } from '../helpers';
|
|
3
|
-
import { Context } from './Context';
|
|
4
|
-
type
|
|
5
|
-
dynamic(ctx: Context, args:
|
|
1
|
+
import type { CallHttpAuthenticationActionArgs, CallHttpAuthenticationRequest, CallHttpAuthenticationResponse, FormInput, GetHttpAuthenticationSummaryResponse, HttpAuthenticationAction } from '../bindings/gen_events';
|
|
2
|
+
import type { MaybePromise } from '../helpers';
|
|
3
|
+
import type { Context } from './Context';
|
|
4
|
+
type AddDynamicMethod<T> = {
|
|
5
|
+
dynamic?: (ctx: Context, args: CallHttpAuthenticationActionArgs) => MaybePromise<Partial<T> | null | undefined>;
|
|
6
6
|
};
|
|
7
|
+
type AddDynamic<T> = T extends any ? T extends {
|
|
8
|
+
inputs?: FormInput[];
|
|
9
|
+
} ? Omit<T, 'inputs'> & {
|
|
10
|
+
inputs: Array<AddDynamic<FormInput>>;
|
|
11
|
+
dynamic?: (ctx: Context, args: CallHttpAuthenticationActionArgs) => MaybePromise<Partial<Omit<T, 'inputs'> & {
|
|
12
|
+
inputs: Array<AddDynamic<FormInput>>;
|
|
13
|
+
}> | null | undefined>;
|
|
14
|
+
} : T & AddDynamicMethod<T> : never;
|
|
15
|
+
export type DynamicAuthenticationArg = AddDynamic<FormInput>;
|
|
7
16
|
export type AuthenticationPlugin = GetHttpAuthenticationSummaryResponse & {
|
|
8
|
-
args:
|
|
17
|
+
args: DynamicAuthenticationArg[];
|
|
9
18
|
onApply(ctx: Context, args: CallHttpAuthenticationRequest): MaybePromise<CallHttpAuthenticationResponse>;
|
|
10
19
|
actions?: (HttpAuthenticationAction & {
|
|
11
20
|
onSelect(ctx: Context, args: CallHttpAuthenticationActionArgs): Promise<void> | void;
|
package/lib/plugins/Context.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { FindHttpResponsesRequest, FindHttpResponsesResponse, GetCookieValueRequest, GetCookieValueResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, ListCookieNamesResponse, OpenWindowRequest, PromptTextRequest, PromptTextResponse, RenderGrpcRequestRequest, RenderGrpcRequestResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest } from '../bindings/gen_events.ts';
|
|
2
|
-
import {
|
|
1
|
+
import type { FindHttpResponsesRequest, FindHttpResponsesResponse, GetCookieValueRequest, GetCookieValueResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, ListCookieNamesResponse, ListFoldersRequest, ListFoldersResponse, ListHttpRequestsRequest, ListHttpRequestsResponse, OpenWindowRequest, PromptFormRequest, PromptFormResponse, PromptTextRequest, PromptTextResponse, RenderGrpcRequestRequest, RenderGrpcRequestResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest, WorkspaceInfo } from '../bindings/gen_events.ts';
|
|
2
|
+
import type { Folder, HttpRequest } from '../bindings/gen_models.ts';
|
|
3
|
+
import type { JsonValue } from '../bindings/serde_json/JsonValue';
|
|
4
|
+
export type WorkspaceHandle = Pick<WorkspaceInfo, 'id' | 'name'>;
|
|
3
5
|
export interface Context {
|
|
4
6
|
clipboard: {
|
|
5
7
|
copyText(text: string): Promise<void>;
|
|
@@ -9,6 +11,7 @@ export interface Context {
|
|
|
9
11
|
};
|
|
10
12
|
prompt: {
|
|
11
13
|
text(args: PromptTextRequest): Promise<PromptTextResponse['value']>;
|
|
14
|
+
form(args: PromptFormRequest): Promise<PromptFormResponse['values']>;
|
|
12
15
|
};
|
|
13
16
|
store: {
|
|
14
17
|
set<T>(key: string, value: T): Promise<void>;
|
|
@@ -16,6 +19,9 @@ export interface Context {
|
|
|
16
19
|
delete(key: string): Promise<boolean>;
|
|
17
20
|
};
|
|
18
21
|
window: {
|
|
22
|
+
requestId(): Promise<string | null>;
|
|
23
|
+
workspaceId(): Promise<string | null>;
|
|
24
|
+
environmentId(): Promise<string | null>;
|
|
19
25
|
openUrl(args: OpenWindowRequest & {
|
|
20
26
|
onNavigate?: (args: {
|
|
21
27
|
url: string;
|
|
@@ -24,6 +30,7 @@ export interface Context {
|
|
|
24
30
|
}): Promise<{
|
|
25
31
|
close: () => void;
|
|
26
32
|
}>;
|
|
33
|
+
openExternalUrl(url: string): Promise<void>;
|
|
27
34
|
};
|
|
28
35
|
cookies: {
|
|
29
36
|
listNames(): Promise<ListCookieNamesResponse['names']>;
|
|
@@ -36,6 +43,23 @@ export interface Context {
|
|
|
36
43
|
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
|
|
37
44
|
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
|
|
38
45
|
render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse['httpRequest']>;
|
|
46
|
+
list(args?: ListHttpRequestsRequest): Promise<ListHttpRequestsResponse['httpRequests']>;
|
|
47
|
+
create(args: Omit<Partial<HttpRequest>, 'id' | 'model' | 'createdAt' | 'updatedAt'> & Pick<HttpRequest, 'workspaceId' | 'url'>): Promise<HttpRequest>;
|
|
48
|
+
update(args: Omit<Partial<HttpRequest>, 'model' | 'createdAt' | 'updatedAt'> & Pick<HttpRequest, 'id'>): Promise<HttpRequest>;
|
|
49
|
+
delete(args: {
|
|
50
|
+
id: string;
|
|
51
|
+
}): Promise<HttpRequest>;
|
|
52
|
+
};
|
|
53
|
+
folder: {
|
|
54
|
+
list(args?: ListFoldersRequest): Promise<ListFoldersResponse['folders']>;
|
|
55
|
+
getById(args: {
|
|
56
|
+
id: string;
|
|
57
|
+
}): Promise<Folder | null>;
|
|
58
|
+
create(args: Omit<Partial<Folder>, 'id' | 'model' | 'createdAt' | 'updatedAt'> & Pick<Folder, 'workspaceId' | 'name'>): Promise<Folder>;
|
|
59
|
+
update(args: Omit<Partial<Folder>, 'model' | 'createdAt' | 'updatedAt'> & Pick<Folder, 'id'>): Promise<Folder>;
|
|
60
|
+
delete(args: {
|
|
61
|
+
id: string;
|
|
62
|
+
}): Promise<Folder>;
|
|
39
63
|
};
|
|
40
64
|
httpResponse: {
|
|
41
65
|
find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse['httpResponses']>;
|
|
@@ -48,4 +72,8 @@ export interface Context {
|
|
|
48
72
|
plugin: {
|
|
49
73
|
reload(): void;
|
|
50
74
|
};
|
|
75
|
+
workspace: {
|
|
76
|
+
list(): Promise<WorkspaceHandle[]>;
|
|
77
|
+
withContext(handle: WorkspaceHandle): Context;
|
|
78
|
+
};
|
|
51
79
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallGrpcRequestActionArgs, GrpcRequestAction } from '../bindings/gen_events';
|
|
1
|
+
import type { CallGrpcRequestActionArgs, GrpcRequestAction } from '../bindings/gen_events';
|
|
2
2
|
import type { Context } from './Context';
|
|
3
3
|
export type GrpcRequestActionPlugin = GrpcRequestAction & {
|
|
4
4
|
onSelect(ctx: Context, args: CallGrpcRequestActionArgs): Promise<void> | void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Context } from './Context';
|
|
2
|
+
import type { Folder, Workspace } from '../bindings/gen_models';
|
|
3
|
+
import type { Icon } from '../bindings/gen_events';
|
|
4
|
+
export type HttpCollectionAction = {
|
|
5
|
+
label: string;
|
|
6
|
+
icon?: Icon;
|
|
7
|
+
};
|
|
8
|
+
export type CallHttpCollectionActionArgs = {
|
|
9
|
+
folder?: Folder;
|
|
10
|
+
workspace?: Workspace;
|
|
11
|
+
};
|
|
12
|
+
export type HttpCollectionActionPlugin = HttpCollectionAction & {
|
|
13
|
+
onSelect(ctx: Context, args: CallHttpCollectionActionArgs): Promise<void> | void;
|
|
14
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ImportResources } from '../bindings/gen_events';
|
|
2
|
-
import { AtLeast, MaybePromise } from '../helpers';
|
|
1
|
+
import type { ImportResources } from '../bindings/gen_events';
|
|
2
|
+
import type { AtLeast, MaybePromise } from '../helpers';
|
|
3
3
|
import type { Context } from './Context';
|
|
4
4
|
type RootFields = 'name' | 'id' | 'model';
|
|
5
5
|
type CommonFields = RootFields | 'workspaceId';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { MaybePromise } from '../helpers';
|
|
2
|
+
import type { Context } from './Context';
|
|
3
|
+
/**
|
|
4
|
+
* JSON-RPC 2.0 message types for MCP
|
|
5
|
+
*/
|
|
6
|
+
export type JsonRpcRequest = {
|
|
7
|
+
jsonrpc: '2.0';
|
|
8
|
+
id: string | number;
|
|
9
|
+
method: string;
|
|
10
|
+
params?: unknown;
|
|
11
|
+
};
|
|
12
|
+
export type JsonRpcNotification = {
|
|
13
|
+
jsonrpc: '2.0';
|
|
14
|
+
method: string;
|
|
15
|
+
params?: unknown;
|
|
16
|
+
};
|
|
17
|
+
export type JsonRpcResponse = {
|
|
18
|
+
jsonrpc: '2.0';
|
|
19
|
+
id: string | number;
|
|
20
|
+
result?: unknown;
|
|
21
|
+
error?: {
|
|
22
|
+
code: number;
|
|
23
|
+
message: string;
|
|
24
|
+
data?: unknown;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
|
|
28
|
+
/**
|
|
29
|
+
* MCP Plugin type
|
|
30
|
+
*
|
|
31
|
+
* Plugins that implement this interface can handle MCP protocol messages
|
|
32
|
+
* via stdio transport, allowing external tools like Claude Desktop to
|
|
33
|
+
* interact with Yaak programmatically.
|
|
34
|
+
*/
|
|
35
|
+
export type McpPlugin = {
|
|
36
|
+
/**
|
|
37
|
+
* Display name for the MCP server
|
|
38
|
+
*/
|
|
39
|
+
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* Version of the MCP server
|
|
42
|
+
*/
|
|
43
|
+
version: string;
|
|
44
|
+
/**
|
|
45
|
+
* Handle an incoming JSON-RPC message from the MCP client
|
|
46
|
+
*
|
|
47
|
+
* This method receives messages from stdin and should return
|
|
48
|
+
* appropriate JSON-RPC responses. Notifications (messages without id)
|
|
49
|
+
* should return null or undefined.
|
|
50
|
+
*
|
|
51
|
+
* @param ctx - Plugin context for accessing Yaak APIs
|
|
52
|
+
* @param message - The JSON-RPC message from the client
|
|
53
|
+
* @returns JSON-RPC response, or null/undefined for notifications
|
|
54
|
+
*/
|
|
55
|
+
onMessage(ctx: Context, message: JsonRpcMessage): MaybePromise<JsonRpcResponse | null | undefined>;
|
|
56
|
+
};
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { CallTemplateFunctionArgs, FormInput,
|
|
2
|
-
import { MaybePromise } from '../helpers';
|
|
3
|
-
import { Context } from './Context';
|
|
4
|
-
|
|
5
|
-
dynamic(ctx: Context, args:
|
|
1
|
+
import type { CallTemplateFunctionArgs, FormInput, TemplateFunction } from '../bindings/gen_events';
|
|
2
|
+
import type { MaybePromise } from '../helpers';
|
|
3
|
+
import type { Context } from './Context';
|
|
4
|
+
type AddDynamicMethod<T> = {
|
|
5
|
+
dynamic?: (ctx: Context, args: CallTemplateFunctionArgs) => MaybePromise<Partial<T> | null | undefined>;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
type AddDynamic<T> = T extends any ? T extends {
|
|
8
|
+
inputs?: FormInput[];
|
|
9
|
+
} ? Omit<T, 'inputs'> & {
|
|
10
|
+
inputs: Array<AddDynamic<FormInput>>;
|
|
11
|
+
dynamic?: (ctx: Context, args: CallTemplateFunctionArgs) => MaybePromise<Partial<Omit<T, 'inputs'> & {
|
|
12
|
+
inputs: Array<AddDynamic<FormInput>>;
|
|
13
|
+
}> | null | undefined>;
|
|
14
|
+
} : T & AddDynamicMethod<T> : never;
|
|
15
|
+
export type DynamicTemplateFunctionArg = AddDynamic<FormInput>;
|
|
16
|
+
export type TemplateFunctionPlugin = Omit<TemplateFunction, 'args'> & {
|
|
17
|
+
args: DynamicTemplateFunctionArg[];
|
|
9
18
|
onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null>;
|
|
10
19
|
};
|
|
20
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Theme } from '../bindings/gen_events';
|
|
1
|
+
import type { Theme } from '../bindings/gen_events';
|
|
2
2
|
export type ThemePlugin = Theme;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CallWebsocketRequestActionArgs, WebsocketRequestAction } from '../bindings/gen_events';
|
|
2
|
+
import type { Context } from './Context';
|
|
3
|
+
export type WebsocketRequestActionPlugin = WebsocketRequestAction & {
|
|
4
|
+
onSelect(ctx: Context, args: CallWebsocketRequestActionArgs): Promise<void> | void;
|
|
5
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CallWorkspaceActionArgs, WorkspaceAction } from '../bindings/gen_events';
|
|
2
|
+
import type { Context } from './Context';
|
|
3
|
+
export type WorkspaceActionPlugin = WorkspaceAction & {
|
|
4
|
+
onSelect(ctx: Context, args: CallWorkspaceActionArgs): Promise<void> | void;
|
|
5
|
+
};
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import { AuthenticationPlugin } from './AuthenticationPlugin';
|
|
1
|
+
import type { AuthenticationPlugin } from './AuthenticationPlugin';
|
|
2
|
+
import type { Context } from './Context';
|
|
2
3
|
import type { FilterPlugin } from './FilterPlugin';
|
|
3
|
-
import { GrpcRequestActionPlugin } from './GrpcRequestActionPlugin';
|
|
4
|
+
import type { GrpcRequestActionPlugin } from './GrpcRequestActionPlugin';
|
|
4
5
|
import type { HttpRequestActionPlugin } from './HttpRequestActionPlugin';
|
|
6
|
+
import type { WebsocketRequestActionPlugin } from './WebsocketRequestActionPlugin';
|
|
7
|
+
import type { WorkspaceActionPlugin } from './WorkspaceActionPlugin';
|
|
8
|
+
import type { FolderActionPlugin } from './FolderActionPlugin';
|
|
5
9
|
import type { ImporterPlugin } from './ImporterPlugin';
|
|
6
10
|
import type { TemplateFunctionPlugin } from './TemplateFunctionPlugin';
|
|
7
11
|
import type { ThemePlugin } from './ThemePlugin';
|
|
8
|
-
import type { Context } from './Context';
|
|
9
12
|
export type { Context };
|
|
13
|
+
export type { DynamicTemplateFunctionArg } from './TemplateFunctionPlugin';
|
|
14
|
+
export type { DynamicAuthenticationArg } from './AuthenticationPlugin';
|
|
15
|
+
export type { TemplateFunctionPlugin };
|
|
16
|
+
export type { WorkspaceActionPlugin } from './WorkspaceActionPlugin';
|
|
17
|
+
export type { FolderActionPlugin } from './FolderActionPlugin';
|
|
10
18
|
/**
|
|
11
19
|
* The global structure of a Yaak plugin
|
|
12
20
|
*/
|
|
@@ -18,6 +26,9 @@ export type PluginDefinition = {
|
|
|
18
26
|
filter?: FilterPlugin;
|
|
19
27
|
authentication?: AuthenticationPlugin;
|
|
20
28
|
httpRequestActions?: HttpRequestActionPlugin[];
|
|
29
|
+
websocketRequestActions?: WebsocketRequestActionPlugin[];
|
|
30
|
+
workspaceActions?: WorkspaceActionPlugin[];
|
|
31
|
+
folderActions?: FolderActionPlugin[];
|
|
21
32
|
grpcRequestActions?: GrpcRequestActionPlugin[];
|
|
22
33
|
templateFunctions?: TemplateFunctionPlugin[];
|
|
23
34
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaakapp/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"api-client",
|
|
6
6
|
"insomnia-alternative",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"build": "run-s build:copy-types build:tsc",
|
|
26
26
|
"build:tsc": "tsc",
|
|
27
27
|
"build:copy-types": "run-p build:copy-types:*",
|
|
28
|
-
"build:copy-types:root": "cpy --flat ../../
|
|
29
|
-
"build:copy-types:next": "cpy --flat ../../
|
|
28
|
+
"build:copy-types:root": "cpy --flat ../../crates/yaak-plugins/bindings/*.ts ./src/bindings",
|
|
29
|
+
"build:copy-types:next": "cpy --flat ../../crates/yaak-plugins/bindings/serde_json/*.ts ./src/bindings/serde_json",
|
|
30
30
|
"publish": "npm publish",
|
|
31
31
|
"prepublishOnly": "npm run build"
|
|
32
32
|
},
|