@yaakapp/api 0.6.5 → 0.7.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 +136 -18
- package/lib/bindings/gen_models.d.ts +2 -1
- package/lib/plugins/Context.d.ts +11 -2
- package/lib/plugins/FilterPlugin.d.ts +2 -5
- package/lib/plugins/GrpcRequestActionPlugin.d.ts +5 -0
- package/lib/plugins/GrpcRequestActionPlugin.js +2 -0
- package/lib/plugins/ImporterPlugin.d.ts +2 -2
- package/lib/plugins/TemplateFunctionPlugin.d.ts +7 -2
- package/lib/plugins/ThemePlugin.d.ts +2 -7
- package/lib/plugins/index.d.ts +7 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,9 +4,14 @@ export type BootRequest = {
|
|
|
4
4
|
dir: string;
|
|
5
5
|
watch: boolean;
|
|
6
6
|
};
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export type CallGrpcRequestActionArgs = {
|
|
8
|
+
grpcRequest: GrpcRequest;
|
|
9
|
+
protoFiles: Array<string>;
|
|
10
|
+
};
|
|
11
|
+
export type CallGrpcRequestActionRequest = {
|
|
12
|
+
index: number;
|
|
13
|
+
pluginRefId: string;
|
|
14
|
+
args: CallGrpcRequestActionArgs;
|
|
10
15
|
};
|
|
11
16
|
export type CallHttpAuthenticationActionArgs = {
|
|
12
17
|
contextId: string;
|
|
@@ -33,7 +38,12 @@ export type CallHttpAuthenticationResponse = {
|
|
|
33
38
|
* HTTP headers to add to the request. Existing headers will be replaced, while
|
|
34
39
|
* new headers will be added.
|
|
35
40
|
*/
|
|
36
|
-
setHeaders
|
|
41
|
+
setHeaders?: Array<HttpHeader>;
|
|
42
|
+
/**
|
|
43
|
+
* Query parameters to add to the request. Existing params will be replaced, while
|
|
44
|
+
* new params will be added.
|
|
45
|
+
*/
|
|
46
|
+
setQueryParameters?: Array<HttpHeader>;
|
|
37
47
|
};
|
|
38
48
|
export type CallHttpRequestActionArgs = {
|
|
39
49
|
httpRequest: HttpRequest;
|
|
@@ -55,6 +65,7 @@ export type CallTemplateFunctionRequest = {
|
|
|
55
65
|
};
|
|
56
66
|
export type CallTemplateFunctionResponse = {
|
|
57
67
|
value: string | null;
|
|
68
|
+
error?: string;
|
|
58
69
|
};
|
|
59
70
|
export type CloseWindowRequest = {
|
|
60
71
|
label: string;
|
|
@@ -101,6 +112,7 @@ export type FilterRequest = {
|
|
|
101
112
|
};
|
|
102
113
|
export type FilterResponse = {
|
|
103
114
|
content: string;
|
|
115
|
+
error?: string;
|
|
104
116
|
};
|
|
105
117
|
export type FindHttpResponsesRequest = {
|
|
106
118
|
requestId: string;
|
|
@@ -425,6 +437,10 @@ export type GetCookieValueRequest = {
|
|
|
425
437
|
export type GetCookieValueResponse = {
|
|
426
438
|
value: string | null;
|
|
427
439
|
};
|
|
440
|
+
export type GetGrpcRequestActionsResponse = {
|
|
441
|
+
actions: Array<GrpcRequestAction>;
|
|
442
|
+
pluginRefId: string;
|
|
443
|
+
};
|
|
428
444
|
export type GetHttpAuthenticationConfigRequest = {
|
|
429
445
|
contextId: string;
|
|
430
446
|
values: {
|
|
@@ -441,7 +457,6 @@ export type GetHttpAuthenticationSummaryResponse = {
|
|
|
441
457
|
label: string;
|
|
442
458
|
shortLabel: string;
|
|
443
459
|
};
|
|
444
|
-
export type GetHttpRequestActionsRequest = Record<string, never>;
|
|
445
460
|
export type GetHttpRequestActionsResponse = {
|
|
446
461
|
actions: Array<HttpRequestAction>;
|
|
447
462
|
pluginRefId: string;
|
|
@@ -458,10 +473,29 @@ export type GetKeyValueRequest = {
|
|
|
458
473
|
export type GetKeyValueResponse = {
|
|
459
474
|
value?: string;
|
|
460
475
|
};
|
|
461
|
-
export type
|
|
476
|
+
export type GetTemplateFunctionConfigRequest = {
|
|
477
|
+
contextId: string;
|
|
478
|
+
name: string;
|
|
479
|
+
values: {
|
|
480
|
+
[key in string]?: JsonPrimitive;
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
export type GetTemplateFunctionConfigResponse = {
|
|
484
|
+
function: TemplateFunction;
|
|
485
|
+
pluginRefId: string;
|
|
486
|
+
};
|
|
487
|
+
export type GetTemplateFunctionSummaryResponse = {
|
|
462
488
|
functions: Array<TemplateFunction>;
|
|
463
489
|
pluginRefId: string;
|
|
464
490
|
};
|
|
491
|
+
export type GetThemesRequest = Record<string, never>;
|
|
492
|
+
export type GetThemesResponse = {
|
|
493
|
+
themes: Array<Theme>;
|
|
494
|
+
};
|
|
495
|
+
export type GrpcRequestAction = {
|
|
496
|
+
label: string;
|
|
497
|
+
icon?: Icon;
|
|
498
|
+
};
|
|
465
499
|
export type HttpAuthenticationAction = {
|
|
466
500
|
label: string;
|
|
467
501
|
icon?: Icon;
|
|
@@ -501,11 +535,9 @@ export type InternalEventPayload = {
|
|
|
501
535
|
"type": "boot_request";
|
|
502
536
|
} & BootRequest | {
|
|
503
537
|
"type": "boot_response";
|
|
504
|
-
}
|
|
505
|
-
"type": "reload_request";
|
|
506
|
-
} & EmptyPayload | {
|
|
538
|
+
} | {
|
|
507
539
|
"type": "reload_response";
|
|
508
|
-
} &
|
|
540
|
+
} & ReloadResponse | {
|
|
509
541
|
"type": "terminate_request";
|
|
510
542
|
} | {
|
|
511
543
|
"type": "terminate_response";
|
|
@@ -540,10 +572,20 @@ export type InternalEventPayload = {
|
|
|
540
572
|
} & GetHttpRequestActionsResponse | {
|
|
541
573
|
"type": "call_http_request_action_request";
|
|
542
574
|
} & CallHttpRequestActionRequest | {
|
|
543
|
-
"type": "
|
|
544
|
-
} | {
|
|
545
|
-
"type": "
|
|
546
|
-
} &
|
|
575
|
+
"type": "get_grpc_request_actions_request";
|
|
576
|
+
} & EmptyPayload | {
|
|
577
|
+
"type": "get_grpc_request_actions_response";
|
|
578
|
+
} & GetGrpcRequestActionsResponse | {
|
|
579
|
+
"type": "call_grpc_request_action_request";
|
|
580
|
+
} & CallGrpcRequestActionRequest | {
|
|
581
|
+
"type": "get_template_function_summary_request";
|
|
582
|
+
} & EmptyPayload | {
|
|
583
|
+
"type": "get_template_function_summary_response";
|
|
584
|
+
} & GetTemplateFunctionSummaryResponse | {
|
|
585
|
+
"type": "get_template_function_config_request";
|
|
586
|
+
} & GetTemplateFunctionConfigRequest | {
|
|
587
|
+
"type": "get_template_function_config_response";
|
|
588
|
+
} & GetTemplateFunctionConfigResponse | {
|
|
547
589
|
"type": "call_template_function_request";
|
|
548
590
|
} & CallTemplateFunctionRequest | {
|
|
549
591
|
"type": "call_template_function_response";
|
|
@@ -572,6 +614,14 @@ export type InternalEventPayload = {
|
|
|
572
614
|
} & RenderHttpRequestRequest | {
|
|
573
615
|
"type": "render_http_request_response";
|
|
574
616
|
} & RenderHttpRequestResponse | {
|
|
617
|
+
"type": "render_grpc_request_request";
|
|
618
|
+
} & RenderGrpcRequestRequest | {
|
|
619
|
+
"type": "render_grpc_request_response";
|
|
620
|
+
} & RenderGrpcRequestResponse | {
|
|
621
|
+
"type": "template_render_request";
|
|
622
|
+
} & TemplateRenderRequest | {
|
|
623
|
+
"type": "template_render_response";
|
|
624
|
+
} & TemplateRenderResponse | {
|
|
575
625
|
"type": "get_key_value_request";
|
|
576
626
|
} & GetKeyValueRequest | {
|
|
577
627
|
"type": "get_key_value_response";
|
|
@@ -592,10 +642,6 @@ export type InternalEventPayload = {
|
|
|
592
642
|
} | {
|
|
593
643
|
"type": "close_window_request";
|
|
594
644
|
} & CloseWindowRequest | {
|
|
595
|
-
"type": "template_render_request";
|
|
596
|
-
} & TemplateRenderRequest | {
|
|
597
|
-
"type": "template_render_response";
|
|
598
|
-
} & TemplateRenderResponse | {
|
|
599
645
|
"type": "show_toast_request";
|
|
600
646
|
} & ShowToastRequest | {
|
|
601
647
|
"type": "show_toast_response";
|
|
@@ -612,6 +658,10 @@ export type InternalEventPayload = {
|
|
|
612
658
|
} & FindHttpResponsesRequest | {
|
|
613
659
|
"type": "find_http_responses_response";
|
|
614
660
|
} & FindHttpResponsesResponse | {
|
|
661
|
+
"type": "get_themes_request";
|
|
662
|
+
} & GetThemesRequest | {
|
|
663
|
+
"type": "get_themes_response";
|
|
664
|
+
} & GetThemesResponse | {
|
|
615
665
|
"type": "empty_response";
|
|
616
666
|
} & EmptyPayload | {
|
|
617
667
|
"type": "error_response";
|
|
@@ -661,6 +711,16 @@ export type PromptTextRequest = {
|
|
|
661
711
|
export type PromptTextResponse = {
|
|
662
712
|
value: string | null;
|
|
663
713
|
};
|
|
714
|
+
export type ReloadResponse = {
|
|
715
|
+
silent: boolean;
|
|
716
|
+
};
|
|
717
|
+
export type RenderGrpcRequestRequest = {
|
|
718
|
+
grpcRequest: GrpcRequest;
|
|
719
|
+
purpose: RenderPurpose;
|
|
720
|
+
};
|
|
721
|
+
export type RenderGrpcRequestResponse = {
|
|
722
|
+
grpcRequest: GrpcRequest;
|
|
723
|
+
};
|
|
664
724
|
export type RenderHttpRequestRequest = {
|
|
665
725
|
httpRequest: HttpRequest;
|
|
666
726
|
purpose: RenderPurpose;
|
|
@@ -684,6 +744,7 @@ export type ShowToastRequest = {
|
|
|
684
744
|
message: string;
|
|
685
745
|
color?: Color;
|
|
686
746
|
icon?: Icon;
|
|
747
|
+
timeout?: number;
|
|
687
748
|
};
|
|
688
749
|
export type TemplateFunction = {
|
|
689
750
|
name: string;
|
|
@@ -706,6 +767,63 @@ export type TemplateRenderRequest = {
|
|
|
706
767
|
export type TemplateRenderResponse = {
|
|
707
768
|
data: JsonValue;
|
|
708
769
|
};
|
|
770
|
+
export type Theme = {
|
|
771
|
+
/**
|
|
772
|
+
* How the theme is identified. This should never be changed
|
|
773
|
+
*/
|
|
774
|
+
id: string;
|
|
775
|
+
/**
|
|
776
|
+
* The friendly name of the theme to be displayed to the user
|
|
777
|
+
*/
|
|
778
|
+
label: string;
|
|
779
|
+
/**
|
|
780
|
+
* Whether the theme will be used for dark or light appearance
|
|
781
|
+
*/
|
|
782
|
+
dark: boolean;
|
|
783
|
+
/**
|
|
784
|
+
* The default top-level colors for the theme
|
|
785
|
+
*/
|
|
786
|
+
base: ThemeComponentColors;
|
|
787
|
+
/**
|
|
788
|
+
* Optionally override theme for individual UI components for more control
|
|
789
|
+
*/
|
|
790
|
+
components?: ThemeComponents;
|
|
791
|
+
};
|
|
792
|
+
export type ThemeComponentColors = {
|
|
793
|
+
surface?: string;
|
|
794
|
+
surfaceHighlight?: string;
|
|
795
|
+
surfaceActive?: string;
|
|
796
|
+
text?: string;
|
|
797
|
+
textSubtle?: string;
|
|
798
|
+
textSubtlest?: string;
|
|
799
|
+
border?: string;
|
|
800
|
+
borderSubtle?: string;
|
|
801
|
+
borderFocus?: string;
|
|
802
|
+
shadow?: string;
|
|
803
|
+
backdrop?: string;
|
|
804
|
+
selection?: string;
|
|
805
|
+
primary?: string;
|
|
806
|
+
secondary?: string;
|
|
807
|
+
info?: string;
|
|
808
|
+
success?: string;
|
|
809
|
+
notice?: string;
|
|
810
|
+
warning?: string;
|
|
811
|
+
danger?: string;
|
|
812
|
+
};
|
|
813
|
+
export type ThemeComponents = {
|
|
814
|
+
dialog?: ThemeComponentColors;
|
|
815
|
+
menu?: ThemeComponentColors;
|
|
816
|
+
toast?: ThemeComponentColors;
|
|
817
|
+
sidebar?: ThemeComponentColors;
|
|
818
|
+
responsePane?: ThemeComponentColors;
|
|
819
|
+
appHeader?: ThemeComponentColors;
|
|
820
|
+
button?: ThemeComponentColors;
|
|
821
|
+
banner?: ThemeComponentColors;
|
|
822
|
+
templateTag?: ThemeComponentColors;
|
|
823
|
+
urlBar?: ThemeComponentColors;
|
|
824
|
+
editor?: ThemeComponentColors;
|
|
825
|
+
input?: ThemeComponentColors;
|
|
826
|
+
};
|
|
709
827
|
export type WindowNavigateEvent = {
|
|
710
828
|
url: string;
|
|
711
829
|
};
|
package/lib/plugins/Context.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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, OpenWindowRequest, PromptTextRequest, PromptTextResponse, RenderGrpcRequestRequest, RenderGrpcRequestResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest } from '../bindings/gen_events.ts';
|
|
2
|
+
import { JsonValue } from '../bindings/serde_json/JsonValue';
|
|
2
3
|
export interface Context {
|
|
3
4
|
clipboard: {
|
|
4
5
|
copyText(text: string): Promise<void>;
|
|
@@ -28,6 +29,9 @@ export interface Context {
|
|
|
28
29
|
listNames(): Promise<ListCookieNamesResponse['names']>;
|
|
29
30
|
getValue(args: GetCookieValueRequest): Promise<GetCookieValueResponse['value']>;
|
|
30
31
|
};
|
|
32
|
+
grpcRequest: {
|
|
33
|
+
render(args: RenderGrpcRequestRequest): Promise<RenderGrpcRequestResponse['grpcRequest']>;
|
|
34
|
+
};
|
|
31
35
|
httpRequest: {
|
|
32
36
|
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
|
|
33
37
|
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
|
|
@@ -37,6 +41,11 @@ export interface Context {
|
|
|
37
41
|
find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse['httpResponses']>;
|
|
38
42
|
};
|
|
39
43
|
templates: {
|
|
40
|
-
render(args: TemplateRenderRequest
|
|
44
|
+
render<T extends JsonValue>(args: TemplateRenderRequest & {
|
|
45
|
+
data: T;
|
|
46
|
+
}): Promise<T>;
|
|
47
|
+
};
|
|
48
|
+
plugin: {
|
|
49
|
+
reload(): void;
|
|
41
50
|
};
|
|
42
51
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { 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 { 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
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImportResources } from '../bindings/gen_events';
|
|
2
|
-
import { AtLeast } from '../helpers';
|
|
2
|
+
import { 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 {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { CallTemplateFunctionArgs, TemplateFunction } from
|
|
2
|
-
import {
|
|
1
|
+
import { CallTemplateFunctionArgs, FormInput, GetHttpAuthenticationConfigRequest, TemplateFunction, TemplateFunctionArg } from '../bindings/gen_events';
|
|
2
|
+
import { MaybePromise } from '../helpers';
|
|
3
|
+
import { Context } from './Context';
|
|
4
|
+
export type DynamicTemplateFunctionArg = FormInput & {
|
|
5
|
+
dynamic(ctx: Context, args: GetHttpAuthenticationConfigRequest): MaybePromise<Partial<FormInput> | undefined | null>;
|
|
6
|
+
};
|
|
3
7
|
export type TemplateFunctionPlugin = TemplateFunction & {
|
|
8
|
+
args: (TemplateFunctionArg | DynamicTemplateFunctionArg)[];
|
|
4
9
|
onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null>;
|
|
5
10
|
};
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export type ThemePlugin = {
|
|
4
|
-
name: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
getTheme(ctx: Context, fileContents: string): Promise<Index>;
|
|
7
|
-
};
|
|
1
|
+
import { Theme } from '../bindings/gen_events';
|
|
2
|
+
export type ThemePlugin = Theme;
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { AuthenticationPlugin } from './AuthenticationPlugin';
|
|
2
2
|
import type { FilterPlugin } from './FilterPlugin';
|
|
3
|
+
import { GrpcRequestActionPlugin } from './GrpcRequestActionPlugin';
|
|
3
4
|
import type { HttpRequestActionPlugin } from './HttpRequestActionPlugin';
|
|
4
5
|
import type { ImporterPlugin } from './ImporterPlugin';
|
|
5
6
|
import type { TemplateFunctionPlugin } from './TemplateFunctionPlugin';
|
|
6
7
|
import type { ThemePlugin } from './ThemePlugin';
|
|
7
|
-
|
|
8
|
+
import type { Context } from './Context';
|
|
9
|
+
export type { Context };
|
|
8
10
|
/**
|
|
9
11
|
* The global structure of a Yaak plugin
|
|
10
12
|
*/
|
|
11
13
|
export type PluginDefinition = {
|
|
14
|
+
init?: (ctx: Context) => void | Promise<void>;
|
|
15
|
+
dispose?: () => void | Promise<void>;
|
|
12
16
|
importer?: ImporterPlugin;
|
|
13
|
-
|
|
17
|
+
themes?: ThemePlugin[];
|
|
14
18
|
filter?: FilterPlugin;
|
|
15
19
|
authentication?: AuthenticationPlugin;
|
|
16
20
|
httpRequestActions?: HttpRequestActionPlugin[];
|
|
21
|
+
grpcRequestActions?: GrpcRequestActionPlugin[];
|
|
17
22
|
templateFunctions?: TemplateFunctionPlugin[];
|
|
18
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaakapp/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"api-client",
|
|
6
6
|
"insomnia-alternative",
|
|
@@ -31,7 +31,7 @@
|
|
|
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"
|