@yaakapp/api 0.5.3 → 0.6.1
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 +23 -0
- package/lib/bindings/gen_events.d.ts +48 -8
- package/lib/bindings/gen_models.d.ts +10 -9
- package/lib/plugins/Context.d.ts +5 -1
- package/package.json +7 -1
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Yaak Plugin API
|
|
2
|
+
|
|
3
|
+
Yaak is a desktop API client for interacting with REST, GraphQL, Server Sent Events (SSE),
|
|
4
|
+
WebSocket, and gRPC APIs. It's built using Tauri, Rust, and ReactJS.
|
|
5
|
+
|
|
6
|
+
Yaak plugins are written in TypeScript and executed within a NodeJS runtime. This package
|
|
7
|
+
contains the TypeScript type definitions required to make building Yaak plugins a breeze.
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
The easiest way to get started is by generating a plugin with the Yaak CLI:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
npx @yaakapp/cli generate
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
If you prefer starting from scratch, manually install the types package:
|
|
20
|
+
|
|
21
|
+
```shell
|
|
22
|
+
npm install @yaakapp/api
|
|
23
|
+
```
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type { Environment } from "./gen_models.js";
|
|
2
|
-
import type { Folder } from "./gen_models.js";
|
|
3
|
-
import type { GrpcRequest } from "./gen_models.js";
|
|
4
|
-
import type { HttpRequest } from "./gen_models.js";
|
|
5
|
-
import type { HttpResponse } from "./gen_models.js";
|
|
1
|
+
import type { Environment, Folder, GrpcRequest, HttpRequest, HttpResponse, WebsocketRequest, Workspace } from "./gen_models.js";
|
|
6
2
|
import type { JsonValue } from "./serde_json/JsonValue.js";
|
|
7
|
-
import type { WebsocketRequest } from "./gen_models.js";
|
|
8
|
-
import type { Workspace } from "./gen_models.js";
|
|
9
3
|
export type BootRequest = {
|
|
10
4
|
dir: string;
|
|
11
5
|
watch: boolean;
|
|
@@ -52,7 +46,7 @@ export type CallHttpRequestActionRequest = {
|
|
|
52
46
|
export type CallTemplateFunctionArgs = {
|
|
53
47
|
purpose: RenderPurpose;
|
|
54
48
|
values: {
|
|
55
|
-
[key in string]?:
|
|
49
|
+
[key in string]?: JsonValue;
|
|
56
50
|
};
|
|
57
51
|
};
|
|
58
52
|
export type CallTemplateFunctionRequest = {
|
|
@@ -171,6 +165,10 @@ export type FormInputBase = {
|
|
|
171
165
|
*/
|
|
172
166
|
defaultValue?: string;
|
|
173
167
|
disabled?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Longer description of the input, likely shown in a tooltip
|
|
170
|
+
*/
|
|
171
|
+
description?: string;
|
|
174
172
|
};
|
|
175
173
|
export type FormInputCheckbox = {
|
|
176
174
|
/**
|
|
@@ -199,6 +197,10 @@ export type FormInputCheckbox = {
|
|
|
199
197
|
*/
|
|
200
198
|
defaultValue?: string;
|
|
201
199
|
disabled?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Longer description of the input, likely shown in a tooltip
|
|
202
|
+
*/
|
|
203
|
+
description?: string;
|
|
202
204
|
};
|
|
203
205
|
export type FormInputEditor = {
|
|
204
206
|
/**
|
|
@@ -241,6 +243,10 @@ export type FormInputEditor = {
|
|
|
241
243
|
*/
|
|
242
244
|
defaultValue?: string;
|
|
243
245
|
disabled?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Longer description of the input, likely shown in a tooltip
|
|
248
|
+
*/
|
|
249
|
+
description?: string;
|
|
244
250
|
};
|
|
245
251
|
export type FormInputFile = {
|
|
246
252
|
/**
|
|
@@ -280,6 +286,10 @@ export type FormInputFile = {
|
|
|
280
286
|
*/
|
|
281
287
|
defaultValue?: string;
|
|
282
288
|
disabled?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Longer description of the input, likely shown in a tooltip
|
|
291
|
+
*/
|
|
292
|
+
description?: string;
|
|
283
293
|
};
|
|
284
294
|
export type FormInputHttpRequest = {
|
|
285
295
|
/**
|
|
@@ -308,6 +318,10 @@ export type FormInputHttpRequest = {
|
|
|
308
318
|
*/
|
|
309
319
|
defaultValue?: string;
|
|
310
320
|
disabled?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Longer description of the input, likely shown in a tooltip
|
|
323
|
+
*/
|
|
324
|
+
description?: string;
|
|
311
325
|
};
|
|
312
326
|
export type FormInputMarkdown = {
|
|
313
327
|
content: string;
|
|
@@ -344,6 +358,10 @@ export type FormInputSelect = {
|
|
|
344
358
|
*/
|
|
345
359
|
defaultValue?: string;
|
|
346
360
|
disabled?: boolean;
|
|
361
|
+
/**
|
|
362
|
+
* Longer description of the input, likely shown in a tooltip
|
|
363
|
+
*/
|
|
364
|
+
description?: string;
|
|
347
365
|
};
|
|
348
366
|
export type FormInputSelectOption = {
|
|
349
367
|
label: string;
|
|
@@ -389,6 +407,10 @@ export type FormInputText = {
|
|
|
389
407
|
*/
|
|
390
408
|
defaultValue?: string;
|
|
391
409
|
disabled?: boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Longer description of the input, likely shown in a tooltip
|
|
412
|
+
*/
|
|
413
|
+
description?: string;
|
|
392
414
|
};
|
|
393
415
|
export type GenericCompletionOption = {
|
|
394
416
|
label: string;
|
|
@@ -397,6 +419,12 @@ export type GenericCompletionOption = {
|
|
|
397
419
|
type?: CompletionOptionType;
|
|
398
420
|
boost?: number;
|
|
399
421
|
};
|
|
422
|
+
export type GetCookieValueRequest = {
|
|
423
|
+
name: string;
|
|
424
|
+
};
|
|
425
|
+
export type GetCookieValueResponse = {
|
|
426
|
+
value: string | null;
|
|
427
|
+
};
|
|
400
428
|
export type GetHttpAuthenticationConfigRequest = {
|
|
401
429
|
contextId: string;
|
|
402
430
|
values: {
|
|
@@ -498,6 +526,14 @@ export type InternalEventPayload = {
|
|
|
498
526
|
} & SendHttpRequestRequest | {
|
|
499
527
|
"type": "send_http_request_response";
|
|
500
528
|
} & SendHttpRequestResponse | {
|
|
529
|
+
"type": "list_cookie_names_request";
|
|
530
|
+
} & ListCookieNamesRequest | {
|
|
531
|
+
"type": "list_cookie_names_response";
|
|
532
|
+
} & ListCookieNamesResponse | {
|
|
533
|
+
"type": "get_cookie_value_request";
|
|
534
|
+
} & GetCookieValueRequest | {
|
|
535
|
+
"type": "get_cookie_value_response";
|
|
536
|
+
} & GetCookieValueResponse | {
|
|
501
537
|
"type": "get_http_request_actions_request";
|
|
502
538
|
} & EmptyPayload | {
|
|
503
539
|
"type": "get_http_request_actions_response";
|
|
@@ -581,6 +617,10 @@ export type InternalEventPayload = {
|
|
|
581
617
|
"type": "error_response";
|
|
582
618
|
} & ErrorResponse;
|
|
583
619
|
export type JsonPrimitive = string | number | boolean | null;
|
|
620
|
+
export type ListCookieNamesRequest = {};
|
|
621
|
+
export type ListCookieNamesResponse = {
|
|
622
|
+
names: Array<string>;
|
|
623
|
+
};
|
|
584
624
|
export type OpenWindowRequest = {
|
|
585
625
|
url: string;
|
|
586
626
|
/**
|
|
@@ -8,6 +8,7 @@ export type Environment = {
|
|
|
8
8
|
public: boolean;
|
|
9
9
|
base: boolean;
|
|
10
10
|
variables: Array<EnvironmentVariable>;
|
|
11
|
+
color: string | null;
|
|
11
12
|
};
|
|
12
13
|
export type EnvironmentVariable = {
|
|
13
14
|
enabled?: boolean;
|
|
@@ -22,15 +23,12 @@ export type Folder = {
|
|
|
22
23
|
updatedAt: string;
|
|
23
24
|
workspaceId: string;
|
|
24
25
|
folderId: string | null;
|
|
25
|
-
|
|
26
|
+
authentication: Record<string, any>;
|
|
27
|
+
authenticationType: string | null;
|
|
26
28
|
description: string;
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
export type GrpcMetadataEntry = {
|
|
30
|
-
enabled?: boolean;
|
|
29
|
+
headers: Array<HttpRequestHeader>;
|
|
31
30
|
name: string;
|
|
32
|
-
|
|
33
|
-
id?: string;
|
|
31
|
+
sortPriority: number;
|
|
34
32
|
};
|
|
35
33
|
export type GrpcRequest = {
|
|
36
34
|
model: "grpc_request";
|
|
@@ -43,7 +41,7 @@ export type GrpcRequest = {
|
|
|
43
41
|
authentication: Record<string, any>;
|
|
44
42
|
description: string;
|
|
45
43
|
message: string;
|
|
46
|
-
metadata: Array<
|
|
44
|
+
metadata: Array<HttpRequestHeader>;
|
|
47
45
|
method: string | null;
|
|
48
46
|
name: string;
|
|
49
47
|
service: string | null;
|
|
@@ -128,8 +126,11 @@ export type Workspace = {
|
|
|
128
126
|
id: string;
|
|
129
127
|
createdAt: string;
|
|
130
128
|
updatedAt: string;
|
|
131
|
-
|
|
129
|
+
authentication: Record<string, any>;
|
|
130
|
+
authenticationType: string | null;
|
|
132
131
|
description: string;
|
|
132
|
+
headers: Array<HttpRequestHeader>;
|
|
133
|
+
name: string;
|
|
133
134
|
encryptionKeyChallenge: string | null;
|
|
134
135
|
settingValidateCertificates: boolean;
|
|
135
136
|
settingFollowRedirects: boolean;
|
package/lib/plugins/Context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, 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, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest, TemplateRenderResponse } from '../bindings/gen_events.ts';
|
|
2
2
|
export interface Context {
|
|
3
3
|
clipboard: {
|
|
4
4
|
copyText(text: string): Promise<void>;
|
|
@@ -24,6 +24,10 @@ export interface Context {
|
|
|
24
24
|
close: () => void;
|
|
25
25
|
}>;
|
|
26
26
|
};
|
|
27
|
+
cookies: {
|
|
28
|
+
listNames(): Promise<ListCookieNamesResponse['names']>;
|
|
29
|
+
getValue(args: GetCookieValueRequest): Promise<GetCookieValueResponse['value']>;
|
|
30
|
+
};
|
|
27
31
|
httpRequest: {
|
|
28
32
|
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
|
|
29
33
|
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaakapp/api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"api-client",
|
|
6
|
+
"insomnia-alternative",
|
|
7
|
+
"bruno-alternative",
|
|
8
|
+
"postman-alternative"
|
|
9
|
+
],
|
|
4
10
|
"main": "lib/index.js",
|
|
5
11
|
"typings": "./lib/index.d.ts",
|
|
6
12
|
"files": [
|