@yaakapp/api 0.6.6 → 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 +281 -29
- package/lib/bindings/gen_models.d.ts +263 -1
- package/lib/plugins/AuthenticationPlugin.d.ts +15 -6
- package/lib/plugins/Context.d.ts +39 -2
- package/lib/plugins/FilterPlugin.d.ts +2 -5
- package/lib/plugins/FolderActionPlugin.d.ts +5 -0
- package/lib/plugins/FolderActionPlugin.js +2 -0
- package/lib/plugins/GrpcRequestActionPlugin.d.ts +5 -0
- package/lib/plugins/GrpcRequestActionPlugin.js +2 -0
- package/lib/plugins/HttpCollectionActionPlugin.d.ts +14 -0
- package/lib/plugins/HttpCollectionActionPlugin.js +2 -0
- package/lib/plugins/ImporterPlugin.d.ts +3 -3
- package/lib/plugins/McpPlugin.d.ts +56 -0
- package/lib/plugins/McpPlugin.js +2 -0
- package/lib/plugins/TemplateFunctionPlugin.d.ts +18 -3
- 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 +18 -2
- package/package.json +4 -4
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,12 +1,25 @@
|
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export type CallFolderActionArgs = {
|
|
8
|
+
folder: Folder;
|
|
9
|
+
};
|
|
10
|
+
export type CallFolderActionRequest = {
|
|
11
|
+
index: number;
|
|
12
|
+
pluginRefId: string;
|
|
13
|
+
args: CallFolderActionArgs;
|
|
14
|
+
};
|
|
15
|
+
export type CallGrpcRequestActionArgs = {
|
|
16
|
+
grpcRequest: GrpcRequest;
|
|
17
|
+
protoFiles: Array<string>;
|
|
18
|
+
};
|
|
19
|
+
export type CallGrpcRequestActionRequest = {
|
|
20
|
+
index: number;
|
|
21
|
+
pluginRefId: string;
|
|
22
|
+
args: CallGrpcRequestActionArgs;
|
|
10
23
|
};
|
|
11
24
|
export type CallHttpAuthenticationActionArgs = {
|
|
12
25
|
contextId: string;
|
|
@@ -33,7 +46,12 @@ export type CallHttpAuthenticationResponse = {
|
|
|
33
46
|
* HTTP headers to add to the request. Existing headers will be replaced, while
|
|
34
47
|
* new headers will be added.
|
|
35
48
|
*/
|
|
36
|
-
setHeaders
|
|
49
|
+
setHeaders?: Array<HttpHeader>;
|
|
50
|
+
/**
|
|
51
|
+
* Query parameters to add to the request. Existing params will be replaced, while
|
|
52
|
+
* new params will be added.
|
|
53
|
+
*/
|
|
54
|
+
setQueryParameters?: Array<HttpHeader>;
|
|
37
55
|
};
|
|
38
56
|
export type CallHttpRequestActionArgs = {
|
|
39
57
|
httpRequest: HttpRequest;
|
|
@@ -46,7 +64,7 @@ export type CallHttpRequestActionRequest = {
|
|
|
46
64
|
export type CallTemplateFunctionArgs = {
|
|
47
65
|
purpose: RenderPurpose;
|
|
48
66
|
values: {
|
|
49
|
-
[key in string]?:
|
|
67
|
+
[key in string]?: JsonPrimitive;
|
|
50
68
|
};
|
|
51
69
|
};
|
|
52
70
|
export type CallTemplateFunctionRequest = {
|
|
@@ -55,6 +73,23 @@ export type CallTemplateFunctionRequest = {
|
|
|
55
73
|
};
|
|
56
74
|
export type CallTemplateFunctionResponse = {
|
|
57
75
|
value: string | null;
|
|
76
|
+
error?: string;
|
|
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;
|
|
58
93
|
};
|
|
59
94
|
export type CloseWindowRequest = {
|
|
60
95
|
label: string;
|
|
@@ -77,6 +112,13 @@ export type DeleteKeyValueRequest = {
|
|
|
77
112
|
export type DeleteKeyValueResponse = {
|
|
78
113
|
deleted: boolean;
|
|
79
114
|
};
|
|
115
|
+
export type DeleteModelRequest = {
|
|
116
|
+
model: string;
|
|
117
|
+
id: string;
|
|
118
|
+
};
|
|
119
|
+
export type DeleteModelResponse = {
|
|
120
|
+
model: AnyModel;
|
|
121
|
+
};
|
|
80
122
|
export type EditorLanguage = "text" | "javascript" | "json" | "html" | "xml" | "graphql" | "markdown";
|
|
81
123
|
export type EmptyPayload = {};
|
|
82
124
|
export type ErrorResponse = {
|
|
@@ -101,6 +143,7 @@ export type FilterRequest = {
|
|
|
101
143
|
};
|
|
102
144
|
export type FilterResponse = {
|
|
103
145
|
content: string;
|
|
146
|
+
error?: string;
|
|
104
147
|
};
|
|
105
148
|
export type FindHttpResponsesRequest = {
|
|
106
149
|
requestId: string;
|
|
@@ -109,6 +152,10 @@ export type FindHttpResponsesRequest = {
|
|
|
109
152
|
export type FindHttpResponsesResponse = {
|
|
110
153
|
httpResponses: Array<HttpResponse>;
|
|
111
154
|
};
|
|
155
|
+
export type FolderAction = {
|
|
156
|
+
label: string;
|
|
157
|
+
icon?: Icon;
|
|
158
|
+
};
|
|
112
159
|
export type FormInput = {
|
|
113
160
|
"type": "text";
|
|
114
161
|
} & FormInputText | {
|
|
@@ -124,10 +171,14 @@ export type FormInput = {
|
|
|
124
171
|
} & FormInputHttpRequest | {
|
|
125
172
|
"type": "accordion";
|
|
126
173
|
} & FormInputAccordion | {
|
|
174
|
+
"type": "h_stack";
|
|
175
|
+
} & FormInputHStack | {
|
|
127
176
|
"type": "banner";
|
|
128
177
|
} & FormInputBanner | {
|
|
129
178
|
"type": "markdown";
|
|
130
|
-
} & FormInputMarkdown
|
|
179
|
+
} & FormInputMarkdown | {
|
|
180
|
+
"type": "key_value";
|
|
181
|
+
} & FormInputKeyValue;
|
|
131
182
|
export type FormInputAccordion = {
|
|
132
183
|
label: string;
|
|
133
184
|
inputs?: Array<FormInput>;
|
|
@@ -291,6 +342,10 @@ export type FormInputFile = {
|
|
|
291
342
|
*/
|
|
292
343
|
description?: string;
|
|
293
344
|
};
|
|
345
|
+
export type FormInputHStack = {
|
|
346
|
+
inputs?: Array<FormInput>;
|
|
347
|
+
hidden?: boolean;
|
|
348
|
+
};
|
|
294
349
|
export type FormInputHttpRequest = {
|
|
295
350
|
/**
|
|
296
351
|
* The name of the input. The value will be stored at this object attribute in the resulting data
|
|
@@ -323,6 +378,38 @@ export type FormInputHttpRequest = {
|
|
|
323
378
|
*/
|
|
324
379
|
description?: string;
|
|
325
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
|
+
};
|
|
326
413
|
export type FormInputMarkdown = {
|
|
327
414
|
content: string;
|
|
328
415
|
hidden?: boolean;
|
|
@@ -425,6 +512,14 @@ export type GetCookieValueRequest = {
|
|
|
425
512
|
export type GetCookieValueResponse = {
|
|
426
513
|
value: string | null;
|
|
427
514
|
};
|
|
515
|
+
export type GetFolderActionsResponse = {
|
|
516
|
+
actions: Array<FolderAction>;
|
|
517
|
+
pluginRefId: string;
|
|
518
|
+
};
|
|
519
|
+
export type GetGrpcRequestActionsResponse = {
|
|
520
|
+
actions: Array<GrpcRequestAction>;
|
|
521
|
+
pluginRefId: string;
|
|
522
|
+
};
|
|
428
523
|
export type GetHttpAuthenticationConfigRequest = {
|
|
429
524
|
contextId: string;
|
|
430
525
|
values: {
|
|
@@ -441,7 +536,6 @@ export type GetHttpAuthenticationSummaryResponse = {
|
|
|
441
536
|
label: string;
|
|
442
537
|
shortLabel: string;
|
|
443
538
|
};
|
|
444
|
-
export type GetHttpRequestActionsRequest = Record<string, never>;
|
|
445
539
|
export type GetHttpRequestActionsResponse = {
|
|
446
540
|
actions: Array<HttpRequestAction>;
|
|
447
541
|
pluginRefId: string;
|
|
@@ -458,7 +552,18 @@ export type GetKeyValueRequest = {
|
|
|
458
552
|
export type GetKeyValueResponse = {
|
|
459
553
|
value?: string;
|
|
460
554
|
};
|
|
461
|
-
export type
|
|
555
|
+
export type GetTemplateFunctionConfigRequest = {
|
|
556
|
+
contextId: string;
|
|
557
|
+
name: string;
|
|
558
|
+
values: {
|
|
559
|
+
[key in string]?: JsonPrimitive;
|
|
560
|
+
};
|
|
561
|
+
};
|
|
562
|
+
export type GetTemplateFunctionConfigResponse = {
|
|
563
|
+
function: TemplateFunction;
|
|
564
|
+
pluginRefId: string;
|
|
565
|
+
};
|
|
566
|
+
export type GetTemplateFunctionSummaryResponse = {
|
|
462
567
|
functions: Array<TemplateFunction>;
|
|
463
568
|
pluginRefId: string;
|
|
464
569
|
};
|
|
@@ -466,6 +571,18 @@ export type GetThemesRequest = Record<string, never>;
|
|
|
466
571
|
export type GetThemesResponse = {
|
|
467
572
|
themes: Array<Theme>;
|
|
468
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
|
+
};
|
|
582
|
+
export type GrpcRequestAction = {
|
|
583
|
+
label: string;
|
|
584
|
+
icon?: Icon;
|
|
585
|
+
};
|
|
469
586
|
export type HttpAuthenticationAction = {
|
|
470
587
|
label: string;
|
|
471
588
|
icon?: Icon;
|
|
@@ -498,18 +615,16 @@ export type InternalEvent = {
|
|
|
498
615
|
pluginRefId: string;
|
|
499
616
|
pluginName: string;
|
|
500
617
|
replyId: string | null;
|
|
501
|
-
|
|
618
|
+
context: PluginContext;
|
|
502
619
|
payload: InternalEventPayload;
|
|
503
620
|
};
|
|
504
621
|
export type InternalEventPayload = {
|
|
505
622
|
"type": "boot_request";
|
|
506
623
|
} & BootRequest | {
|
|
507
624
|
"type": "boot_response";
|
|
508
|
-
}
|
|
509
|
-
"type": "reload_request";
|
|
510
|
-
} & EmptyPayload | {
|
|
625
|
+
} | {
|
|
511
626
|
"type": "reload_response";
|
|
512
|
-
} &
|
|
627
|
+
} & ReloadResponse | {
|
|
513
628
|
"type": "terminate_request";
|
|
514
629
|
} | {
|
|
515
630
|
"type": "terminate_response";
|
|
@@ -544,10 +659,38 @@ export type InternalEventPayload = {
|
|
|
544
659
|
} & GetHttpRequestActionsResponse | {
|
|
545
660
|
"type": "call_http_request_action_request";
|
|
546
661
|
} & CallHttpRequestActionRequest | {
|
|
547
|
-
"type": "
|
|
548
|
-
} | {
|
|
549
|
-
"type": "
|
|
550
|
-
} &
|
|
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 | {
|
|
680
|
+
"type": "get_grpc_request_actions_request";
|
|
681
|
+
} & EmptyPayload | {
|
|
682
|
+
"type": "get_grpc_request_actions_response";
|
|
683
|
+
} & GetGrpcRequestActionsResponse | {
|
|
684
|
+
"type": "call_grpc_request_action_request";
|
|
685
|
+
} & CallGrpcRequestActionRequest | {
|
|
686
|
+
"type": "get_template_function_summary_request";
|
|
687
|
+
} & EmptyPayload | {
|
|
688
|
+
"type": "get_template_function_summary_response";
|
|
689
|
+
} & GetTemplateFunctionSummaryResponse | {
|
|
690
|
+
"type": "get_template_function_config_request";
|
|
691
|
+
} & GetTemplateFunctionConfigRequest | {
|
|
692
|
+
"type": "get_template_function_config_response";
|
|
693
|
+
} & GetTemplateFunctionConfigResponse | {
|
|
551
694
|
"type": "call_template_function_request";
|
|
552
695
|
} & CallTemplateFunctionRequest | {
|
|
553
696
|
"type": "call_template_function_response";
|
|
@@ -576,6 +719,14 @@ export type InternalEventPayload = {
|
|
|
576
719
|
} & RenderHttpRequestRequest | {
|
|
577
720
|
"type": "render_http_request_response";
|
|
578
721
|
} & RenderHttpRequestResponse | {
|
|
722
|
+
"type": "render_grpc_request_request";
|
|
723
|
+
} & RenderGrpcRequestRequest | {
|
|
724
|
+
"type": "render_grpc_request_response";
|
|
725
|
+
} & RenderGrpcRequestResponse | {
|
|
726
|
+
"type": "template_render_request";
|
|
727
|
+
} & TemplateRenderRequest | {
|
|
728
|
+
"type": "template_render_response";
|
|
729
|
+
} & TemplateRenderResponse | {
|
|
579
730
|
"type": "get_key_value_request";
|
|
580
731
|
} & GetKeyValueRequest | {
|
|
581
732
|
"type": "get_key_value_response";
|
|
@@ -596,10 +747,10 @@ export type InternalEventPayload = {
|
|
|
596
747
|
} | {
|
|
597
748
|
"type": "close_window_request";
|
|
598
749
|
} & CloseWindowRequest | {
|
|
599
|
-
"type": "
|
|
600
|
-
} &
|
|
601
|
-
"type": "
|
|
602
|
-
} &
|
|
750
|
+
"type": "open_external_url_request";
|
|
751
|
+
} & OpenExternalUrlRequest | {
|
|
752
|
+
"type": "open_external_url_response";
|
|
753
|
+
} & EmptyPayload | {
|
|
603
754
|
"type": "show_toast_request";
|
|
604
755
|
} & ShowToastRequest | {
|
|
605
756
|
"type": "show_toast_response";
|
|
@@ -608,6 +759,18 @@ export type InternalEventPayload = {
|
|
|
608
759
|
} & PromptTextRequest | {
|
|
609
760
|
"type": "prompt_text_response";
|
|
610
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 | {
|
|
611
774
|
"type": "get_http_request_by_id_request";
|
|
612
775
|
} & GetHttpRequestByIdRequest | {
|
|
613
776
|
"type": "get_http_request_by_id_response";
|
|
@@ -616,6 +779,22 @@ export type InternalEventPayload = {
|
|
|
616
779
|
} & FindHttpResponsesRequest | {
|
|
617
780
|
"type": "find_http_responses_response";
|
|
618
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 | {
|
|
619
798
|
"type": "get_themes_request";
|
|
620
799
|
} & GetThemesRequest | {
|
|
621
800
|
"type": "get_themes_response";
|
|
@@ -629,6 +808,23 @@ export type ListCookieNamesRequest = {};
|
|
|
629
808
|
export type ListCookieNamesResponse = {
|
|
630
809
|
names: Array<string>;
|
|
631
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
|
+
};
|
|
632
828
|
export type OpenWindowRequest = {
|
|
633
829
|
url: string;
|
|
634
830
|
/**
|
|
@@ -639,12 +835,23 @@ export type OpenWindowRequest = {
|
|
|
639
835
|
size?: WindowSize;
|
|
640
836
|
dataDirKey?: string;
|
|
641
837
|
};
|
|
642
|
-
export type
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
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;
|
|
648
855
|
};
|
|
649
856
|
export type PromptTextRequest = {
|
|
650
857
|
id: string;
|
|
@@ -657,6 +864,7 @@ export type PromptTextRequest = {
|
|
|
657
864
|
* Text to add to the confirmation button
|
|
658
865
|
*/
|
|
659
866
|
confirmText?: string;
|
|
867
|
+
password?: boolean;
|
|
660
868
|
/**
|
|
661
869
|
* Text to add to the cancel button
|
|
662
870
|
*/
|
|
@@ -669,6 +877,16 @@ export type PromptTextRequest = {
|
|
|
669
877
|
export type PromptTextResponse = {
|
|
670
878
|
value: string | null;
|
|
671
879
|
};
|
|
880
|
+
export type ReloadResponse = {
|
|
881
|
+
silent: boolean;
|
|
882
|
+
};
|
|
883
|
+
export type RenderGrpcRequestRequest = {
|
|
884
|
+
grpcRequest: GrpcRequest;
|
|
885
|
+
purpose: RenderPurpose;
|
|
886
|
+
};
|
|
887
|
+
export type RenderGrpcRequestResponse = {
|
|
888
|
+
grpcRequest: GrpcRequest;
|
|
889
|
+
};
|
|
672
890
|
export type RenderHttpRequestRequest = {
|
|
673
891
|
httpRequest: HttpRequest;
|
|
674
892
|
purpose: RenderPurpose;
|
|
@@ -692,9 +910,11 @@ export type ShowToastRequest = {
|
|
|
692
910
|
message: string;
|
|
693
911
|
color?: Color;
|
|
694
912
|
icon?: Icon;
|
|
913
|
+
timeout?: number;
|
|
695
914
|
};
|
|
696
915
|
export type TemplateFunction = {
|
|
697
916
|
name: string;
|
|
917
|
+
previewType?: TemplateFunctionPreviewType;
|
|
698
918
|
description?: string;
|
|
699
919
|
/**
|
|
700
920
|
* Also support alternative names. This is useful for not breaking existing
|
|
@@ -702,11 +922,16 @@ export type TemplateFunction = {
|
|
|
702
922
|
*/
|
|
703
923
|
aliases?: Array<string>;
|
|
704
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>;
|
|
705
929
|
};
|
|
706
930
|
/**
|
|
707
931
|
* Similar to FormInput, but contains
|
|
708
932
|
*/
|
|
709
933
|
export type TemplateFunctionArg = FormInput;
|
|
934
|
+
export type TemplateFunctionPreviewType = "live" | "click" | "none";
|
|
710
935
|
export type TemplateRenderRequest = {
|
|
711
936
|
data: JsonValue;
|
|
712
937
|
purpose: RenderPurpose;
|
|
@@ -771,6 +996,25 @@ export type ThemeComponents = {
|
|
|
771
996
|
editor?: ThemeComponentColors;
|
|
772
997
|
input?: ThemeComponentColors;
|
|
773
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
|
+
};
|
|
774
1018
|
export type WindowNavigateEvent = {
|
|
775
1019
|
url: string;
|
|
776
1020
|
};
|
|
@@ -778,3 +1022,11 @@ export type WindowSize = {
|
|
|
778
1022
|
width: number;
|
|
779
1023
|
height: number;
|
|
780
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;
|
|
@@ -6,9 +49,11 @@ export type Environment = {
|
|
|
6
49
|
updatedAt: string;
|
|
7
50
|
name: string;
|
|
8
51
|
public: boolean;
|
|
9
|
-
|
|
52
|
+
parentModel: string;
|
|
53
|
+
parentId: string | null;
|
|
10
54
|
variables: Array<EnvironmentVariable>;
|
|
11
55
|
color: string | null;
|
|
56
|
+
sortPriority: number;
|
|
12
57
|
};
|
|
13
58
|
export type EnvironmentVariable = {
|
|
14
59
|
enabled?: boolean;
|
|
@@ -30,6 +75,51 @@ export type Folder = {
|
|
|
30
75
|
name: string;
|
|
31
76
|
sortPriority: number;
|
|
32
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";
|
|
33
123
|
export type GrpcRequest = {
|
|
34
124
|
model: "grpc_request";
|
|
35
125
|
id: string;
|
|
@@ -82,17 +172,76 @@ export type HttpResponse = {
|
|
|
82
172
|
requestId: string;
|
|
83
173
|
bodyPath: string | null;
|
|
84
174
|
contentLength: number | null;
|
|
175
|
+
contentLengthCompressed: number | null;
|
|
85
176
|
elapsed: number;
|
|
86
177
|
elapsedHeaders: number;
|
|
178
|
+
elapsedDns: number;
|
|
87
179
|
error: string | null;
|
|
88
180
|
headers: Array<HttpResponseHeader>;
|
|
89
181
|
remoteAddr: string | null;
|
|
182
|
+
requestContentLength: number | null;
|
|
183
|
+
requestHeaders: Array<HttpResponseHeader>;
|
|
90
184
|
status: number;
|
|
91
185
|
statusReason: string | null;
|
|
92
186
|
state: HttpResponseState;
|
|
93
187
|
url: string;
|
|
94
188
|
version: string | null;
|
|
95
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
|
+
};
|
|
96
245
|
export type HttpResponseHeader = {
|
|
97
246
|
name: string;
|
|
98
247
|
value: string;
|
|
@@ -104,6 +253,109 @@ export type HttpUrlParameter = {
|
|
|
104
253
|
value: string;
|
|
105
254
|
id?: string;
|
|
106
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";
|
|
107
359
|
export type WebsocketRequest = {
|
|
108
360
|
model: "websocket_request";
|
|
109
361
|
id: string;
|
|
@@ -135,4 +387,14 @@ export type Workspace = {
|
|
|
135
387
|
settingValidateCertificates: boolean;
|
|
136
388
|
settingFollowRedirects: boolean;
|
|
137
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;
|
|
138
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,4 +1,7 @@
|
|
|
1
|
-
import type { FindHttpResponsesRequest, FindHttpResponsesResponse, GetCookieValueRequest, GetCookieValueResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, ListCookieNamesResponse, OpenWindowRequest, PromptTextRequest, PromptTextResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest,
|
|
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'>;
|
|
2
5
|
export interface Context {
|
|
3
6
|
clipboard: {
|
|
4
7
|
copyText(text: string): Promise<void>;
|
|
@@ -8,6 +11,7 @@ export interface Context {
|
|
|
8
11
|
};
|
|
9
12
|
prompt: {
|
|
10
13
|
text(args: PromptTextRequest): Promise<PromptTextResponse['value']>;
|
|
14
|
+
form(args: PromptFormRequest): Promise<PromptFormResponse['values']>;
|
|
11
15
|
};
|
|
12
16
|
store: {
|
|
13
17
|
set<T>(key: string, value: T): Promise<void>;
|
|
@@ -15,6 +19,9 @@ export interface Context {
|
|
|
15
19
|
delete(key: string): Promise<boolean>;
|
|
16
20
|
};
|
|
17
21
|
window: {
|
|
22
|
+
requestId(): Promise<string | null>;
|
|
23
|
+
workspaceId(): Promise<string | null>;
|
|
24
|
+
environmentId(): Promise<string | null>;
|
|
18
25
|
openUrl(args: OpenWindowRequest & {
|
|
19
26
|
onNavigate?: (args: {
|
|
20
27
|
url: string;
|
|
@@ -23,20 +30,50 @@ export interface Context {
|
|
|
23
30
|
}): Promise<{
|
|
24
31
|
close: () => void;
|
|
25
32
|
}>;
|
|
33
|
+
openExternalUrl(url: string): Promise<void>;
|
|
26
34
|
};
|
|
27
35
|
cookies: {
|
|
28
36
|
listNames(): Promise<ListCookieNamesResponse['names']>;
|
|
29
37
|
getValue(args: GetCookieValueRequest): Promise<GetCookieValueResponse['value']>;
|
|
30
38
|
};
|
|
39
|
+
grpcRequest: {
|
|
40
|
+
render(args: RenderGrpcRequestRequest): Promise<RenderGrpcRequestResponse['grpcRequest']>;
|
|
41
|
+
};
|
|
31
42
|
httpRequest: {
|
|
32
43
|
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
|
|
33
44
|
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
|
|
34
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>;
|
|
35
63
|
};
|
|
36
64
|
httpResponse: {
|
|
37
65
|
find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse['httpResponses']>;
|
|
38
66
|
};
|
|
39
67
|
templates: {
|
|
40
|
-
render(args: TemplateRenderRequest
|
|
68
|
+
render<T extends JsonValue>(args: TemplateRenderRequest & {
|
|
69
|
+
data: T;
|
|
70
|
+
}): Promise<T>;
|
|
71
|
+
};
|
|
72
|
+
plugin: {
|
|
73
|
+
reload(): void;
|
|
74
|
+
};
|
|
75
|
+
workspace: {
|
|
76
|
+
list(): Promise<WorkspaceHandle[]>;
|
|
77
|
+
withContext(handle: WorkspaceHandle): Context;
|
|
41
78
|
};
|
|
42
79
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import type { FilterResponse } from '../bindings/gen_events';
|
|
1
2
|
import type { Context } from './Context';
|
|
2
|
-
type FilterPluginResponse = {
|
|
3
|
-
filtered: string;
|
|
4
|
-
};
|
|
5
3
|
export type FilterPlugin = {
|
|
6
4
|
name: string;
|
|
7
5
|
description?: string;
|
|
@@ -9,6 +7,5 @@ export type FilterPlugin = {
|
|
|
9
7
|
payload: string;
|
|
10
8
|
filter: string;
|
|
11
9
|
mimeType: string;
|
|
12
|
-
}): Promise<
|
|
10
|
+
}): Promise<FilterResponse> | FilterResponse;
|
|
13
11
|
};
|
|
14
|
-
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CallGrpcRequestActionArgs, GrpcRequestAction } from '../bindings/gen_events';
|
|
2
|
+
import type { Context } from './Context';
|
|
3
|
+
export type GrpcRequestActionPlugin = GrpcRequestAction & {
|
|
4
|
+
onSelect(ctx: Context, args: CallGrpcRequestActionArgs): Promise<void> | void;
|
|
5
|
+
};
|
|
@@ -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 } 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';
|
|
@@ -19,6 +19,6 @@ export type ImporterPlugin = {
|
|
|
19
19
|
description?: string;
|
|
20
20
|
onImport(ctx: Context, args: {
|
|
21
21
|
text: string;
|
|
22
|
-
}):
|
|
22
|
+
}): MaybePromise<ImportPluginResponse | null | undefined>;
|
|
23
23
|
};
|
|
24
24
|
export {};
|
|
@@ -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,5 +1,20 @@
|
|
|
1
|
-
import { CallTemplateFunctionArgs, TemplateFunction } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
+
};
|
|
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[];
|
|
4
18
|
onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null>;
|
|
5
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,18 +1,34 @@
|
|
|
1
|
-
import { AuthenticationPlugin } from './AuthenticationPlugin';
|
|
1
|
+
import type { AuthenticationPlugin } from './AuthenticationPlugin';
|
|
2
|
+
import type { Context } from './Context';
|
|
2
3
|
import type { FilterPlugin } from './FilterPlugin';
|
|
4
|
+
import type { GrpcRequestActionPlugin } from './GrpcRequestActionPlugin';
|
|
3
5
|
import type { HttpRequestActionPlugin } from './HttpRequestActionPlugin';
|
|
6
|
+
import type { WebsocketRequestActionPlugin } from './WebsocketRequestActionPlugin';
|
|
7
|
+
import type { WorkspaceActionPlugin } from './WorkspaceActionPlugin';
|
|
8
|
+
import type { FolderActionPlugin } from './FolderActionPlugin';
|
|
4
9
|
import type { ImporterPlugin } from './ImporterPlugin';
|
|
5
10
|
import type { TemplateFunctionPlugin } from './TemplateFunctionPlugin';
|
|
6
11
|
import type { ThemePlugin } from './ThemePlugin';
|
|
7
|
-
export type { Context }
|
|
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';
|
|
8
18
|
/**
|
|
9
19
|
* The global structure of a Yaak plugin
|
|
10
20
|
*/
|
|
11
21
|
export type PluginDefinition = {
|
|
22
|
+
init?: (ctx: Context) => void | Promise<void>;
|
|
23
|
+
dispose?: () => void | Promise<void>;
|
|
12
24
|
importer?: ImporterPlugin;
|
|
13
25
|
themes?: ThemePlugin[];
|
|
14
26
|
filter?: FilterPlugin;
|
|
15
27
|
authentication?: AuthenticationPlugin;
|
|
16
28
|
httpRequestActions?: HttpRequestActionPlugin[];
|
|
29
|
+
websocketRequestActions?: WebsocketRequestActionPlugin[];
|
|
30
|
+
workspaceActions?: WorkspaceActionPlugin[];
|
|
31
|
+
folderActions?: FolderActionPlugin[];
|
|
32
|
+
grpcRequestActions?: GrpcRequestActionPlugin[];
|
|
17
33
|
templateFunctions?: TemplateFunctionPlugin[];
|
|
18
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,13 +25,13 @@
|
|
|
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
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@types/node": "^
|
|
34
|
+
"@types/node": "^24.0.13"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"cpy-cli": "^5.0.0"
|