@yaakapp/api 0.1.5 → 0.1.7
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/lib/gen/CallTemplateFunctionArgs.d.ts +7 -0
- package/lib/gen/CallTemplateFunctionArgs.js +2 -0
- package/lib/gen/CallTemplateFunctionPurpose.d.ts +5 -0
- package/lib/gen/CallTemplateFunctionPurpose.js +3 -0
- package/lib/gen/CallTemplateFunctionRequest.d.ts +5 -0
- package/lib/gen/CallTemplateFunctionRequest.js +2 -0
- package/lib/gen/CallTemplateFunctionResponse.d.ts +3 -0
- package/lib/gen/CallTemplateFunctionResponse.js +3 -0
- package/lib/gen/GetHttpRequestActionsRequest.d.ts +1 -3
- package/lib/gen/GetTemplateFunctionsResponse.d.ts +5 -0
- package/lib/gen/GetTemplateFunctionsResponse.js +2 -0
- package/lib/gen/HttpRequestAction.d.ts +1 -0
- package/lib/gen/InternalEventPayload.d.ts +22 -1
- package/lib/gen/RenderHttpRequestRequest.d.ts +4 -0
- package/lib/gen/RenderHttpRequestRequest.js +2 -0
- package/lib/gen/RenderHttpRequestResponse.d.ts +4 -0
- package/lib/gen/RenderHttpRequestResponse.js +2 -0
- package/lib/gen/ShowToastRequest.d.ts +5 -0
- package/lib/gen/ShowToastRequest.js +2 -0
- package/lib/gen/TemplateFunction.d.ts +5 -0
- package/lib/gen/TemplateFunction.js +2 -0
- package/lib/gen/TemplateFunctionArg.d.ts +10 -0
- package/lib/gen/TemplateFunctionArg.js +2 -0
- package/lib/gen/TemplateFunctionBaseArg.d.ts +6 -0
- package/lib/gen/TemplateFunctionBaseArg.js +3 -0
- package/lib/gen/TemplateFunctionHttpRequestArg.d.ts +6 -0
- package/lib/gen/TemplateFunctionHttpRequestArg.js +3 -0
- package/lib/gen/TemplateFunctionSelectArg.d.ts +8 -0
- package/lib/gen/TemplateFunctionSelectArg.js +2 -0
- package/lib/gen/TemplateFunctionSelectOption.d.ts +4 -0
- package/lib/gen/TemplateFunctionSelectOption.js +3 -0
- package/lib/gen/TemplateFunctionTextArg.d.ts +7 -0
- package/lib/gen/TemplateFunctionTextArg.js +3 -0
- package/lib/gen/ToastVariant.d.ts +1 -0
- package/lib/gen/ToastVariant.js +3 -0
- package/lib/index.d.ts +18 -2
- package/lib/index.js +18 -2
- package/lib/plugins/FilterPlugin.d.ts +13 -0
- package/lib/plugins/FilterPlugin.js +2 -0
- package/lib/plugins/HttpRequestActionPlugin.d.ts +6 -0
- package/lib/plugins/HttpRequestActionPlugin.js +2 -0
- package/lib/plugins/ImporterPlugin.d.ts +19 -0
- package/lib/plugins/ImporterPlugin.js +2 -0
- package/lib/plugins/TemplateFunctionPlugin.d.ts +6 -0
- package/lib/plugins/TemplateFunctionPlugin.js +2 -0
- package/lib/plugins/ThemePlugin.d.ts +7 -0
- package/lib/plugins/ThemePlugin.js +2 -0
- package/lib/plugins/context.d.ts +8 -1
- package/lib/plugins/index.d.ts +8 -6
- package/lib/plugins/templateTag.d.ts +6 -0
- package/lib/plugins/templateTag.js +2 -0
- package/package.json +1 -1
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import type { BootRequest } from "./BootRequest";
|
|
2
2
|
import type { BootResponse } from "./BootResponse";
|
|
3
3
|
import type { CallHttpRequestActionRequest } from "./CallHttpRequestActionRequest";
|
|
4
|
+
import type { CallTemplateFunctionRequest } from "./CallTemplateFunctionRequest";
|
|
5
|
+
import type { CallTemplateFunctionResponse } from "./CallTemplateFunctionResponse";
|
|
4
6
|
import type { CopyTextRequest } from "./CopyTextRequest";
|
|
5
7
|
import type { EmptyResponse } from "./EmptyResponse";
|
|
6
8
|
import type { ExportHttpRequestRequest } from "./ExportHttpRequestRequest";
|
|
7
9
|
import type { ExportHttpRequestResponse } from "./ExportHttpRequestResponse";
|
|
8
10
|
import type { FilterRequest } from "./FilterRequest";
|
|
9
11
|
import type { FilterResponse } from "./FilterResponse";
|
|
12
|
+
import type { GetHttpRequestActionsRequest } from "./GetHttpRequestActionsRequest";
|
|
10
13
|
import type { GetHttpRequestActionsResponse } from "./GetHttpRequestActionsResponse";
|
|
11
14
|
import type { GetHttpRequestByIdRequest } from "./GetHttpRequestByIdRequest";
|
|
12
15
|
import type { GetHttpRequestByIdResponse } from "./GetHttpRequestByIdResponse";
|
|
16
|
+
import type { GetTemplateFunctionsResponse } from "./GetTemplateFunctionsResponse";
|
|
13
17
|
import type { ImportRequest } from "./ImportRequest";
|
|
14
18
|
import type { ImportResponse } from "./ImportResponse";
|
|
19
|
+
import type { RenderHttpRequestRequest } from "./RenderHttpRequestRequest";
|
|
20
|
+
import type { RenderHttpRequestResponse } from "./RenderHttpRequestResponse";
|
|
15
21
|
import type { SendHttpRequestRequest } from "./SendHttpRequestRequest";
|
|
16
22
|
import type { SendHttpRequestResponse } from "./SendHttpRequestResponse";
|
|
23
|
+
import type { ShowToastRequest } from "./ShowToastRequest";
|
|
17
24
|
export type InternalEventPayload = {
|
|
18
25
|
"type": "boot_request";
|
|
19
26
|
} & BootRequest | {
|
|
@@ -36,13 +43,27 @@ export type InternalEventPayload = {
|
|
|
36
43
|
"type": "send_http_request_response";
|
|
37
44
|
} & SendHttpRequestResponse | {
|
|
38
45
|
"type": "get_http_request_actions_request";
|
|
39
|
-
} | {
|
|
46
|
+
} & GetHttpRequestActionsRequest | {
|
|
40
47
|
"type": "get_http_request_actions_response";
|
|
41
48
|
} & GetHttpRequestActionsResponse | {
|
|
42
49
|
"type": "call_http_request_action_request";
|
|
43
50
|
} & CallHttpRequestActionRequest | {
|
|
51
|
+
"type": "get_template_functions_request";
|
|
52
|
+
} | {
|
|
53
|
+
"type": "get_template_functions_response";
|
|
54
|
+
} & GetTemplateFunctionsResponse | {
|
|
55
|
+
"type": "call_template_function_request";
|
|
56
|
+
} & CallTemplateFunctionRequest | {
|
|
57
|
+
"type": "call_template_function_response";
|
|
58
|
+
} & CallTemplateFunctionResponse | {
|
|
44
59
|
"type": "copy_text_request";
|
|
45
60
|
} & CopyTextRequest | {
|
|
61
|
+
"type": "render_http_request_request";
|
|
62
|
+
} & RenderHttpRequestRequest | {
|
|
63
|
+
"type": "render_http_request_response";
|
|
64
|
+
} & RenderHttpRequestResponse | {
|
|
65
|
+
"type": "show_toast_request";
|
|
66
|
+
} & ShowToastRequest | {
|
|
46
67
|
"type": "get_http_request_by_id_request";
|
|
47
68
|
} & GetHttpRequestByIdRequest | {
|
|
48
69
|
"type": "get_http_request_by_id_response";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TemplateFunctionHttpRequestArg } from "./TemplateFunctionHttpRequestArg";
|
|
2
|
+
import type { TemplateFunctionSelectArg } from "./TemplateFunctionSelectArg";
|
|
3
|
+
import type { TemplateFunctionTextArg } from "./TemplateFunctionTextArg";
|
|
4
|
+
export type TemplateFunctionArg = {
|
|
5
|
+
"type": "text";
|
|
6
|
+
} & TemplateFunctionTextArg | {
|
|
7
|
+
"type": "select";
|
|
8
|
+
} & TemplateFunctionSelectArg | {
|
|
9
|
+
"type": "http_request";
|
|
10
|
+
} & TemplateFunctionHttpRequestArg;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TemplateFunctionSelectOption } from "./TemplateFunctionSelectOption";
|
|
2
|
+
export type TemplateFunctionSelectArg = {
|
|
3
|
+
options: Array<TemplateFunctionSelectOption>;
|
|
4
|
+
name: string;
|
|
5
|
+
optional?: boolean | null;
|
|
6
|
+
label?: string | null;
|
|
7
|
+
defaultValue?: string | null;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ToastVariant = "custom" | "copied" | "success" | "info" | "warning" | "error";
|
package/lib/index.d.ts
CHANGED
|
@@ -2,12 +2,17 @@ export type * from './plugins';
|
|
|
2
2
|
export type * from './themes';
|
|
3
3
|
export * from './gen/BootRequest';
|
|
4
4
|
export * from './gen/BootResponse';
|
|
5
|
-
export * from './gen/CallHttpRequestActionRequest';
|
|
6
5
|
export * from './gen/CallHttpRequestActionArgs';
|
|
6
|
+
export * from './gen/CallTemplateFunctionPurpose';
|
|
7
|
+
export * from './gen/CallHttpRequestActionRequest';
|
|
8
|
+
export * from './gen/CallTemplateFunctionRequest';
|
|
9
|
+
export * from './gen/CallTemplateFunctionResponse';
|
|
10
|
+
export * from './gen/CallTemplateFunctionArgs';
|
|
7
11
|
export * from './gen/Cookie';
|
|
8
12
|
export * from './gen/CookieDomain';
|
|
9
13
|
export * from './gen/CookieExpires';
|
|
10
14
|
export * from './gen/CookieJar';
|
|
15
|
+
export * from './gen/CopyTextRequest';
|
|
11
16
|
export * from './gen/EmptyResponse';
|
|
12
17
|
export * from './gen/Environment';
|
|
13
18
|
export * from './gen/EnvironmentVariable';
|
|
@@ -18,8 +23,8 @@ export * from './gen/FilterResponse';
|
|
|
18
23
|
export * from './gen/Folder';
|
|
19
24
|
export * from './gen/GetHttpRequestActionsResponse';
|
|
20
25
|
export * from './gen/GetHttpRequestByIdRequest';
|
|
21
|
-
export * from './gen/CopyTextRequest';
|
|
22
26
|
export * from './gen/GetHttpRequestByIdResponse';
|
|
27
|
+
export * from './gen/GetTemplateFunctionsResponse';
|
|
23
28
|
export * from './gen/GrpcConnection';
|
|
24
29
|
export * from './gen/GrpcEvent';
|
|
25
30
|
export * from './gen/GrpcMetadataEntry';
|
|
@@ -37,8 +42,19 @@ export * from './gen/InternalEvent';
|
|
|
37
42
|
export * from './gen/InternalEventPayload';
|
|
38
43
|
export * from './gen/KeyValue';
|
|
39
44
|
export * from './gen/Model';
|
|
45
|
+
export * from './gen/RenderHttpRequestRequest';
|
|
46
|
+
export * from './gen/RenderHttpRequestResponse';
|
|
40
47
|
export * from './gen/SendHttpRequestRequest';
|
|
41
48
|
export * from './gen/SendHttpRequestResponse';
|
|
42
49
|
export * from './gen/SendHttpRequestResponse';
|
|
43
50
|
export * from './gen/Settings';
|
|
51
|
+
export * from './gen/ShowToastRequest';
|
|
52
|
+
export * from './gen/TemplateFunction';
|
|
53
|
+
export * from './gen/TemplateFunctionArg';
|
|
54
|
+
export * from './gen/TemplateFunctionBaseArg';
|
|
55
|
+
export * from './gen/TemplateFunctionHttpRequestArg';
|
|
56
|
+
export * from './gen/TemplateFunctionSelectArg';
|
|
57
|
+
export * from './gen/TemplateFunctionSelectOption';
|
|
58
|
+
export * from './gen/TemplateFunctionTextArg';
|
|
59
|
+
export * from './gen/ToastVariant';
|
|
44
60
|
export * from './gen/Workspace';
|
package/lib/index.js
CHANGED
|
@@ -17,12 +17,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
// TODO: The next ts-rs release includes the ability to put everything in 1 file!
|
|
18
18
|
__exportStar(require("./gen/BootRequest"), exports);
|
|
19
19
|
__exportStar(require("./gen/BootResponse"), exports);
|
|
20
|
-
__exportStar(require("./gen/CallHttpRequestActionRequest"), exports);
|
|
21
20
|
__exportStar(require("./gen/CallHttpRequestActionArgs"), exports);
|
|
21
|
+
__exportStar(require("./gen/CallTemplateFunctionPurpose"), exports);
|
|
22
|
+
__exportStar(require("./gen/CallHttpRequestActionRequest"), exports);
|
|
23
|
+
__exportStar(require("./gen/CallTemplateFunctionRequest"), exports);
|
|
24
|
+
__exportStar(require("./gen/CallTemplateFunctionResponse"), exports);
|
|
25
|
+
__exportStar(require("./gen/CallTemplateFunctionArgs"), exports);
|
|
22
26
|
__exportStar(require("./gen/Cookie"), exports);
|
|
23
27
|
__exportStar(require("./gen/CookieDomain"), exports);
|
|
24
28
|
__exportStar(require("./gen/CookieExpires"), exports);
|
|
25
29
|
__exportStar(require("./gen/CookieJar"), exports);
|
|
30
|
+
__exportStar(require("./gen/CopyTextRequest"), exports);
|
|
26
31
|
__exportStar(require("./gen/EmptyResponse"), exports);
|
|
27
32
|
__exportStar(require("./gen/Environment"), exports);
|
|
28
33
|
__exportStar(require("./gen/EnvironmentVariable"), exports);
|
|
@@ -33,8 +38,8 @@ __exportStar(require("./gen/FilterResponse"), exports);
|
|
|
33
38
|
__exportStar(require("./gen/Folder"), exports);
|
|
34
39
|
__exportStar(require("./gen/GetHttpRequestActionsResponse"), exports);
|
|
35
40
|
__exportStar(require("./gen/GetHttpRequestByIdRequest"), exports);
|
|
36
|
-
__exportStar(require("./gen/CopyTextRequest"), exports);
|
|
37
41
|
__exportStar(require("./gen/GetHttpRequestByIdResponse"), exports);
|
|
42
|
+
__exportStar(require("./gen/GetTemplateFunctionsResponse"), exports);
|
|
38
43
|
__exportStar(require("./gen/GrpcConnection"), exports);
|
|
39
44
|
__exportStar(require("./gen/GrpcEvent"), exports);
|
|
40
45
|
__exportStar(require("./gen/GrpcMetadataEntry"), exports);
|
|
@@ -52,8 +57,19 @@ __exportStar(require("./gen/InternalEvent"), exports);
|
|
|
52
57
|
__exportStar(require("./gen/InternalEventPayload"), exports);
|
|
53
58
|
__exportStar(require("./gen/KeyValue"), exports);
|
|
54
59
|
__exportStar(require("./gen/Model"), exports);
|
|
60
|
+
__exportStar(require("./gen/RenderHttpRequestRequest"), exports);
|
|
61
|
+
__exportStar(require("./gen/RenderHttpRequestResponse"), exports);
|
|
55
62
|
__exportStar(require("./gen/SendHttpRequestRequest"), exports);
|
|
56
63
|
__exportStar(require("./gen/SendHttpRequestResponse"), exports);
|
|
57
64
|
__exportStar(require("./gen/SendHttpRequestResponse"), exports);
|
|
58
65
|
__exportStar(require("./gen/Settings"), exports);
|
|
66
|
+
__exportStar(require("./gen/ShowToastRequest"), exports);
|
|
67
|
+
__exportStar(require("./gen/TemplateFunction"), exports);
|
|
68
|
+
__exportStar(require("./gen/TemplateFunctionArg"), exports);
|
|
69
|
+
__exportStar(require("./gen/TemplateFunctionBaseArg"), exports);
|
|
70
|
+
__exportStar(require("./gen/TemplateFunctionHttpRequestArg"), exports);
|
|
71
|
+
__exportStar(require("./gen/TemplateFunctionSelectArg"), exports);
|
|
72
|
+
__exportStar(require("./gen/TemplateFunctionSelectOption"), exports);
|
|
73
|
+
__exportStar(require("./gen/TemplateFunctionTextArg"), exports);
|
|
74
|
+
__exportStar(require("./gen/ToastVariant"), exports);
|
|
59
75
|
__exportStar(require("./gen/Workspace"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Context } from './Context';
|
|
2
|
+
export type FilterPluginResponse = string[];
|
|
3
|
+
export type FilterPlugin = {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
canFilter(ctx: Context, args: {
|
|
7
|
+
mimeType: string;
|
|
8
|
+
}): Promise<boolean>;
|
|
9
|
+
onFilter(ctx: Context, args: {
|
|
10
|
+
payload: string;
|
|
11
|
+
mimeType: string;
|
|
12
|
+
}): Promise<FilterPluginResponse>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CallHttpRequestActionArgs } from '../gen/CallHttpRequestActionArgs';
|
|
2
|
+
import { HttpRequestAction } from '../gen/HttpRequestAction';
|
|
3
|
+
import { Context } from './Context';
|
|
4
|
+
export type HttpRequestActionPlugin = HttpRequestAction & {
|
|
5
|
+
onSelect(ctx: Context, args: CallHttpRequestActionArgs): Promise<void> | void;
|
|
6
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Environment } from '../gen/Environment';
|
|
2
|
+
import { Folder } from '../gen/Folder';
|
|
3
|
+
import { HttpRequest } from '../gen/HttpRequest';
|
|
4
|
+
import { Workspace } from '../gen/Workspace';
|
|
5
|
+
import { AtLeast } from '../helpers';
|
|
6
|
+
import { Context } from './Context';
|
|
7
|
+
export type ImportPluginResponse = null | {
|
|
8
|
+
workspaces: AtLeast<Workspace, 'name' | 'id' | 'model'>[];
|
|
9
|
+
environments: AtLeast<Environment, 'name' | 'id' | 'model' | 'workspaceId'>[];
|
|
10
|
+
httpRequests: AtLeast<HttpRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
|
|
11
|
+
folders: AtLeast<Folder, 'name' | 'id' | 'model' | 'workspaceId'>[];
|
|
12
|
+
};
|
|
13
|
+
export type ImporterPlugin = {
|
|
14
|
+
name: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
onImport(ctx: Context, args: {
|
|
17
|
+
text: string;
|
|
18
|
+
}): Promise<ImportPluginResponse>;
|
|
19
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CallTemplateFunctionArgs } from '../gen/CallTemplateFunctionArgs';
|
|
2
|
+
import { TemplateFunction } from '../gen/TemplateFunction';
|
|
3
|
+
import { Context } from './Context';
|
|
4
|
+
export type TemplateFunctionPlugin = TemplateFunction & {
|
|
5
|
+
onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string>;
|
|
6
|
+
};
|
package/lib/plugins/context.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { GetHttpRequestByIdRequest } from '../gen/GetHttpRequestByIdRequest';
|
|
2
2
|
import { GetHttpRequestByIdResponse } from '../gen/GetHttpRequestByIdResponse';
|
|
3
|
+
import { RenderHttpRequestRequest } from '../gen/RenderHttpRequestRequest';
|
|
4
|
+
import { RenderHttpRequestResponse } from '../gen/RenderHttpRequestResponse';
|
|
3
5
|
import { SendHttpRequestRequest } from '../gen/SendHttpRequestRequest';
|
|
4
6
|
import { SendHttpRequestResponse } from '../gen/SendHttpRequestResponse';
|
|
5
|
-
|
|
7
|
+
import { ShowToastRequest } from '../gen/ShowToastRequest';
|
|
8
|
+
export type Context = {
|
|
6
9
|
clipboard: {
|
|
7
10
|
copyText(text: string): void;
|
|
8
11
|
};
|
|
12
|
+
toast: {
|
|
13
|
+
show(args: ShowToastRequest): void;
|
|
14
|
+
};
|
|
9
15
|
httpRequest: {
|
|
10
16
|
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
|
|
11
17
|
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
|
|
18
|
+
render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse['httpRequest']>;
|
|
12
19
|
};
|
|
13
20
|
};
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { FilterPlugin } from './
|
|
2
|
-
import { HttpRequestActionPlugin } from './
|
|
3
|
-
import { ImporterPlugin } from './
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { FilterPlugin } from './FilterPlugin';
|
|
2
|
+
import { HttpRequestActionPlugin } from './HttpRequestActionPlugin';
|
|
3
|
+
import { ImporterPlugin } from './ImporterPlugin';
|
|
4
|
+
import { TemplateFunctionPlugin } from './TemplateFunctionPlugin';
|
|
5
|
+
import { ThemePlugin } from './ThemePlugin';
|
|
6
|
+
export type { Context } from './Context';
|
|
6
7
|
/**
|
|
7
8
|
* The global structure of a Yaak plugin
|
|
8
9
|
*/
|
|
9
|
-
export type
|
|
10
|
+
export type Plugin = {
|
|
10
11
|
importer?: ImporterPlugin;
|
|
11
12
|
theme?: ThemePlugin;
|
|
12
13
|
filter?: FilterPlugin;
|
|
13
14
|
httpRequestActions?: HttpRequestActionPlugin[];
|
|
15
|
+
templateFunctions?: TemplateFunctionPlugin[];
|
|
14
16
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CallTemplateFunctionArgs } from '../gen/CallTemplateFunctionArgs';
|
|
2
|
+
import { TemplateFunction } from '../gen/TemplateFunction';
|
|
3
|
+
import { YaakContext } from './context';
|
|
4
|
+
export type TemplateFunctionPlugin = TemplateFunction & {
|
|
5
|
+
onRender(ctx: YaakContext, args: CallTemplateFunctionArgs): Promise<string>;
|
|
6
|
+
};
|