@yaakapp/api 0.6.6 → 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.
@@ -4,9 +4,14 @@ export type BootRequest = {
4
4
  dir: string;
5
5
  watch: boolean;
6
6
  };
7
- export type BootResponse = {
8
- name: string;
9
- version: string;
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: Array<HttpHeader>;
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,7 +473,18 @@ export type GetKeyValueRequest = {
458
473
  export type GetKeyValueResponse = {
459
474
  value?: string;
460
475
  };
461
- export type GetTemplateFunctionsResponse = {
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
  };
@@ -466,6 +492,10 @@ export type GetThemesRequest = Record<string, never>;
466
492
  export type GetThemesResponse = {
467
493
  themes: Array<Theme>;
468
494
  };
495
+ export type GrpcRequestAction = {
496
+ label: string;
497
+ icon?: Icon;
498
+ };
469
499
  export type HttpAuthenticationAction = {
470
500
  label: string;
471
501
  icon?: Icon;
@@ -505,11 +535,9 @@ export type InternalEventPayload = {
505
535
  "type": "boot_request";
506
536
  } & BootRequest | {
507
537
  "type": "boot_response";
508
- } & BootResponse | {
509
- "type": "reload_request";
510
- } & EmptyPayload | {
538
+ } | {
511
539
  "type": "reload_response";
512
- } & BootResponse | {
540
+ } & ReloadResponse | {
513
541
  "type": "terminate_request";
514
542
  } | {
515
543
  "type": "terminate_response";
@@ -544,10 +572,20 @@ export type InternalEventPayload = {
544
572
  } & GetHttpRequestActionsResponse | {
545
573
  "type": "call_http_request_action_request";
546
574
  } & CallHttpRequestActionRequest | {
547
- "type": "get_template_functions_request";
548
- } | {
549
- "type": "get_template_functions_response";
550
- } & GetTemplateFunctionsResponse | {
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 | {
551
589
  "type": "call_template_function_request";
552
590
  } & CallTemplateFunctionRequest | {
553
591
  "type": "call_template_function_response";
@@ -576,6 +614,14 @@ export type InternalEventPayload = {
576
614
  } & RenderHttpRequestRequest | {
577
615
  "type": "render_http_request_response";
578
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 | {
579
625
  "type": "get_key_value_request";
580
626
  } & GetKeyValueRequest | {
581
627
  "type": "get_key_value_response";
@@ -596,10 +642,6 @@ export type InternalEventPayload = {
596
642
  } | {
597
643
  "type": "close_window_request";
598
644
  } & CloseWindowRequest | {
599
- "type": "template_render_request";
600
- } & TemplateRenderRequest | {
601
- "type": "template_render_response";
602
- } & TemplateRenderResponse | {
603
645
  "type": "show_toast_request";
604
646
  } & ShowToastRequest | {
605
647
  "type": "show_toast_response";
@@ -669,6 +711,16 @@ export type PromptTextRequest = {
669
711
  export type PromptTextResponse = {
670
712
  value: string | null;
671
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
+ };
672
724
  export type RenderHttpRequestRequest = {
673
725
  httpRequest: HttpRequest;
674
726
  purpose: RenderPurpose;
@@ -692,6 +744,7 @@ export type ShowToastRequest = {
692
744
  message: string;
693
745
  color?: Color;
694
746
  icon?: Icon;
747
+ timeout?: number;
695
748
  };
696
749
  export type TemplateFunction = {
697
750
  name: string;
@@ -6,7 +6,8 @@ export type Environment = {
6
6
  updatedAt: string;
7
7
  name: string;
8
8
  public: boolean;
9
- base: boolean;
9
+ parentModel: string;
10
+ parentId: string | null;
10
11
  variables: Array<EnvironmentVariable>;
11
12
  color: string | null;
12
13
  };
@@ -1,4 +1,5 @@
1
- import type { FindHttpResponsesRequest, FindHttpResponsesResponse, GetCookieValueRequest, GetCookieValueResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, ListCookieNamesResponse, OpenWindowRequest, PromptTextRequest, PromptTextResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest, TemplateRenderResponse } from '../bindings/gen_events.ts';
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): Promise<TemplateRenderResponse['data']>;
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<FilterPluginResponse> | FilterPluginResponse;
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
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
- }): Promise<ImportPluginResponse>;
22
+ }): MaybePromise<ImportPluginResponse | null | undefined>;
23
23
  };
24
24
  export {};
@@ -1,5 +1,10 @@
1
- import { CallTemplateFunctionArgs, TemplateFunction } from "../bindings/gen_events";
2
- import { Context } from "./Context";
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,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
- export type { Context } from './Context';
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.6.6",
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": "^22.5.4"
34
+ "@types/node": "^24.0.13"
35
35
  },
36
36
  "devDependencies": {
37
37
  "cpy-cli": "^5.0.0"