@yaakapp/api 0.2.6 → 0.2.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/bindings/events.d.ts +228 -0
- package/lib/bindings/events.js +2 -0
- package/lib/bindings/models.d.ts +109 -0
- package/lib/bindings/models.js +3 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/plugins/Context.d.ts +1 -1
- package/lib/plugins/HttpRequestActionPlugin.d.ts +1 -1
- package/lib/plugins/ImporterPlugin.d.ts +1 -1
- package/lib/plugins/TemplateFunctionPlugin.d.ts +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import type { Environment } from "./models";
|
|
2
|
+
import type { Folder } from "./models";
|
|
3
|
+
import type { GrpcRequest } from "./models";
|
|
4
|
+
import type { HttpRequest } from "./models";
|
|
5
|
+
import type { HttpResponse } from "./models";
|
|
6
|
+
import type { Workspace } from "./models";
|
|
7
|
+
export type BootRequest = {
|
|
8
|
+
dir: string;
|
|
9
|
+
};
|
|
10
|
+
export type BootResponse = {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
capabilities: Array<string>;
|
|
14
|
+
};
|
|
15
|
+
export type CallHttpRequestActionArgs = {
|
|
16
|
+
httpRequest: HttpRequest;
|
|
17
|
+
};
|
|
18
|
+
export type CallHttpRequestActionRequest = {
|
|
19
|
+
key: string;
|
|
20
|
+
pluginRefId: string;
|
|
21
|
+
args: CallHttpRequestActionArgs;
|
|
22
|
+
};
|
|
23
|
+
export type CallTemplateFunctionArgs = {
|
|
24
|
+
purpose: RenderPurpose;
|
|
25
|
+
values: {
|
|
26
|
+
[key in string]?: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type CallTemplateFunctionRequest = {
|
|
30
|
+
name: string;
|
|
31
|
+
args: CallTemplateFunctionArgs;
|
|
32
|
+
};
|
|
33
|
+
export type CallTemplateFunctionResponse = {
|
|
34
|
+
value: string | null;
|
|
35
|
+
};
|
|
36
|
+
export type Color = "custom" | "default" | "primary" | "secondary" | "info" | "success" | "notice" | "warning" | "danger";
|
|
37
|
+
export type CopyTextRequest = {
|
|
38
|
+
text: string;
|
|
39
|
+
};
|
|
40
|
+
export type ExportHttpRequestRequest = {
|
|
41
|
+
httpRequest: HttpRequest;
|
|
42
|
+
};
|
|
43
|
+
export type ExportHttpRequestResponse = {
|
|
44
|
+
content: string;
|
|
45
|
+
};
|
|
46
|
+
export type FilterRequest = {
|
|
47
|
+
content: string;
|
|
48
|
+
filter: string;
|
|
49
|
+
};
|
|
50
|
+
export type FilterResponse = {
|
|
51
|
+
content: string;
|
|
52
|
+
};
|
|
53
|
+
export type FindHttpResponsesRequest = {
|
|
54
|
+
requestId: string;
|
|
55
|
+
limit: number | null;
|
|
56
|
+
};
|
|
57
|
+
export type FindHttpResponsesResponse = {
|
|
58
|
+
httpResponses: Array<HttpResponse>;
|
|
59
|
+
};
|
|
60
|
+
export type GetHttpRequestActionsRequest = Record<string, never>;
|
|
61
|
+
export type GetHttpRequestActionsResponse = {
|
|
62
|
+
actions: Array<HttpRequestAction>;
|
|
63
|
+
pluginRefId: string;
|
|
64
|
+
};
|
|
65
|
+
export type GetHttpRequestByIdRequest = {
|
|
66
|
+
id: string;
|
|
67
|
+
};
|
|
68
|
+
export type GetHttpRequestByIdResponse = {
|
|
69
|
+
httpRequest: HttpRequest | null;
|
|
70
|
+
};
|
|
71
|
+
export type GetTemplateFunctionsResponse = {
|
|
72
|
+
functions: Array<TemplateFunction>;
|
|
73
|
+
pluginRefId: string;
|
|
74
|
+
};
|
|
75
|
+
export type HttpRequestAction = {
|
|
76
|
+
key: string;
|
|
77
|
+
label: string;
|
|
78
|
+
icon: string | null;
|
|
79
|
+
};
|
|
80
|
+
export type Icon = "copy" | "info" | "check_circle" | "alert_triangle";
|
|
81
|
+
export type ImportRequest = {
|
|
82
|
+
content: string;
|
|
83
|
+
};
|
|
84
|
+
export type ImportResources = {
|
|
85
|
+
workspaces: Array<Workspace>;
|
|
86
|
+
environments: Array<Environment>;
|
|
87
|
+
folders: Array<Folder>;
|
|
88
|
+
httpRequests: Array<HttpRequest>;
|
|
89
|
+
grpcRequests: Array<GrpcRequest>;
|
|
90
|
+
};
|
|
91
|
+
export type ImportResponse = {
|
|
92
|
+
resources: ImportResources;
|
|
93
|
+
};
|
|
94
|
+
export type InternalEvent = {
|
|
95
|
+
id: string;
|
|
96
|
+
pluginRefId: string;
|
|
97
|
+
replyId: string | null;
|
|
98
|
+
payload: InternalEventPayload;
|
|
99
|
+
};
|
|
100
|
+
export type InternalEventPayload = {
|
|
101
|
+
"type": "boot_request";
|
|
102
|
+
} & BootRequest | {
|
|
103
|
+
"type": "boot_response";
|
|
104
|
+
} & BootResponse | {
|
|
105
|
+
"type": "reload_request";
|
|
106
|
+
} | {
|
|
107
|
+
"type": "reload_response";
|
|
108
|
+
} | {
|
|
109
|
+
"type": "terminate_request";
|
|
110
|
+
} | {
|
|
111
|
+
"type": "terminate_response";
|
|
112
|
+
} | {
|
|
113
|
+
"type": "import_request";
|
|
114
|
+
} & ImportRequest | {
|
|
115
|
+
"type": "import_response";
|
|
116
|
+
} & ImportResponse | {
|
|
117
|
+
"type": "filter_request";
|
|
118
|
+
} & FilterRequest | {
|
|
119
|
+
"type": "filter_response";
|
|
120
|
+
} & FilterResponse | {
|
|
121
|
+
"type": "export_http_request_request";
|
|
122
|
+
} & ExportHttpRequestRequest | {
|
|
123
|
+
"type": "export_http_request_response";
|
|
124
|
+
} & ExportHttpRequestResponse | {
|
|
125
|
+
"type": "send_http_request_request";
|
|
126
|
+
} & SendHttpRequestRequest | {
|
|
127
|
+
"type": "send_http_request_response";
|
|
128
|
+
} & SendHttpRequestResponse | {
|
|
129
|
+
"type": "get_http_request_actions_request";
|
|
130
|
+
} & GetHttpRequestActionsRequest | {
|
|
131
|
+
"type": "get_http_request_actions_response";
|
|
132
|
+
} & GetHttpRequestActionsResponse | {
|
|
133
|
+
"type": "call_http_request_action_request";
|
|
134
|
+
} & CallHttpRequestActionRequest | {
|
|
135
|
+
"type": "get_template_functions_request";
|
|
136
|
+
} | {
|
|
137
|
+
"type": "get_template_functions_response";
|
|
138
|
+
} & GetTemplateFunctionsResponse | {
|
|
139
|
+
"type": "call_template_function_request";
|
|
140
|
+
} & CallTemplateFunctionRequest | {
|
|
141
|
+
"type": "call_template_function_response";
|
|
142
|
+
} & CallTemplateFunctionResponse | {
|
|
143
|
+
"type": "copy_text_request";
|
|
144
|
+
} & CopyTextRequest | {
|
|
145
|
+
"type": "render_http_request_request";
|
|
146
|
+
} & RenderHttpRequestRequest | {
|
|
147
|
+
"type": "render_http_request_response";
|
|
148
|
+
} & RenderHttpRequestResponse | {
|
|
149
|
+
"type": "show_toast_request";
|
|
150
|
+
} & ShowToastRequest | {
|
|
151
|
+
"type": "get_http_request_by_id_request";
|
|
152
|
+
} & GetHttpRequestByIdRequest | {
|
|
153
|
+
"type": "get_http_request_by_id_response";
|
|
154
|
+
} & GetHttpRequestByIdResponse | {
|
|
155
|
+
"type": "find_http_responses_request";
|
|
156
|
+
} & FindHttpResponsesRequest | {
|
|
157
|
+
"type": "find_http_responses_response";
|
|
158
|
+
} & FindHttpResponsesResponse | {
|
|
159
|
+
"type": "empty_response";
|
|
160
|
+
};
|
|
161
|
+
export type RenderHttpRequestRequest = {
|
|
162
|
+
httpRequest: HttpRequest;
|
|
163
|
+
purpose: RenderPurpose;
|
|
164
|
+
};
|
|
165
|
+
export type RenderHttpRequestResponse = {
|
|
166
|
+
httpRequest: HttpRequest;
|
|
167
|
+
};
|
|
168
|
+
export type RenderPurpose = "send" | "preview";
|
|
169
|
+
export type SendHttpRequestRequest = {
|
|
170
|
+
httpRequest: HttpRequest;
|
|
171
|
+
};
|
|
172
|
+
export type SendHttpRequestResponse = {
|
|
173
|
+
httpResponse: HttpResponse;
|
|
174
|
+
};
|
|
175
|
+
export type ShowToastRequest = {
|
|
176
|
+
message: string;
|
|
177
|
+
color?: Color | null;
|
|
178
|
+
icon?: Icon | null;
|
|
179
|
+
};
|
|
180
|
+
export type TemplateFunction = {
|
|
181
|
+
name: string;
|
|
182
|
+
args: Array<TemplateFunctionArg>;
|
|
183
|
+
};
|
|
184
|
+
export type TemplateFunctionArg = {
|
|
185
|
+
"type": "text";
|
|
186
|
+
} & TemplateFunctionTextArg | {
|
|
187
|
+
"type": "select";
|
|
188
|
+
} & TemplateFunctionSelectArg | {
|
|
189
|
+
"type": "checkbox";
|
|
190
|
+
} & TemplateFunctionCheckboxArg | {
|
|
191
|
+
"type": "http_request";
|
|
192
|
+
} & TemplateFunctionHttpRequestArg;
|
|
193
|
+
export type TemplateFunctionBaseArg = {
|
|
194
|
+
name: string;
|
|
195
|
+
optional?: boolean | null;
|
|
196
|
+
label?: string | null;
|
|
197
|
+
defaultValue?: string | null;
|
|
198
|
+
};
|
|
199
|
+
export type TemplateFunctionCheckboxArg = {
|
|
200
|
+
name: string;
|
|
201
|
+
optional?: boolean | null;
|
|
202
|
+
label?: string | null;
|
|
203
|
+
defaultValue?: string | null;
|
|
204
|
+
};
|
|
205
|
+
export type TemplateFunctionHttpRequestArg = {
|
|
206
|
+
name: string;
|
|
207
|
+
optional?: boolean | null;
|
|
208
|
+
label?: string | null;
|
|
209
|
+
defaultValue?: string | null;
|
|
210
|
+
};
|
|
211
|
+
export type TemplateFunctionSelectArg = {
|
|
212
|
+
options: Array<TemplateFunctionSelectOption>;
|
|
213
|
+
name: string;
|
|
214
|
+
optional?: boolean | null;
|
|
215
|
+
label?: string | null;
|
|
216
|
+
defaultValue?: string | null;
|
|
217
|
+
};
|
|
218
|
+
export type TemplateFunctionSelectOption = {
|
|
219
|
+
name: string;
|
|
220
|
+
value: string;
|
|
221
|
+
};
|
|
222
|
+
export type TemplateFunctionTextArg = {
|
|
223
|
+
placeholder?: string | null;
|
|
224
|
+
name: string;
|
|
225
|
+
optional?: boolean | null;
|
|
226
|
+
label?: string | null;
|
|
227
|
+
defaultValue?: string | null;
|
|
228
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export type Environment = {
|
|
2
|
+
model: "environment";
|
|
3
|
+
id: string;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
updatedAt: string;
|
|
7
|
+
name: string;
|
|
8
|
+
variables: Array<EnvironmentVariable>;
|
|
9
|
+
};
|
|
10
|
+
export type EnvironmentVariable = {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
name: string;
|
|
13
|
+
value: string;
|
|
14
|
+
};
|
|
15
|
+
export type Folder = {
|
|
16
|
+
model: "folder";
|
|
17
|
+
id: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
workspaceId: string;
|
|
21
|
+
folderId: string | null;
|
|
22
|
+
name: string;
|
|
23
|
+
sortPriority: number;
|
|
24
|
+
};
|
|
25
|
+
export type GrpcMetadataEntry = {
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
name: string;
|
|
28
|
+
value: string;
|
|
29
|
+
};
|
|
30
|
+
export type GrpcRequest = {
|
|
31
|
+
model: "grpc_request";
|
|
32
|
+
id: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
workspaceId: string;
|
|
36
|
+
folderId: string | null;
|
|
37
|
+
authenticationType: string | null;
|
|
38
|
+
authentication: Record<string, any>;
|
|
39
|
+
message: string;
|
|
40
|
+
metadata: Array<GrpcMetadataEntry>;
|
|
41
|
+
method: string | null;
|
|
42
|
+
name: string;
|
|
43
|
+
service: string | null;
|
|
44
|
+
sortPriority: number;
|
|
45
|
+
url: string;
|
|
46
|
+
};
|
|
47
|
+
export type HttpRequest = {
|
|
48
|
+
model: "http_request";
|
|
49
|
+
id: string;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
updatedAt: string;
|
|
52
|
+
workspaceId: string;
|
|
53
|
+
folderId: string | null;
|
|
54
|
+
authentication: Record<string, any>;
|
|
55
|
+
authenticationType: string | null;
|
|
56
|
+
body: Record<string, any>;
|
|
57
|
+
bodyType: string | null;
|
|
58
|
+
headers: Array<HttpRequestHeader>;
|
|
59
|
+
method: string;
|
|
60
|
+
name: string;
|
|
61
|
+
sortPriority: number;
|
|
62
|
+
url: string;
|
|
63
|
+
urlParameters: Array<HttpUrlParameter>;
|
|
64
|
+
};
|
|
65
|
+
export type HttpRequestHeader = {
|
|
66
|
+
enabled?: boolean;
|
|
67
|
+
name: string;
|
|
68
|
+
value: string;
|
|
69
|
+
};
|
|
70
|
+
export type HttpResponse = {
|
|
71
|
+
model: "http_response";
|
|
72
|
+
id: string;
|
|
73
|
+
createdAt: string;
|
|
74
|
+
updatedAt: string;
|
|
75
|
+
workspaceId: string;
|
|
76
|
+
requestId: string;
|
|
77
|
+
bodyPath: string | null;
|
|
78
|
+
contentLength: number | null;
|
|
79
|
+
elapsed: number;
|
|
80
|
+
elapsedHeaders: number;
|
|
81
|
+
error: string | null;
|
|
82
|
+
headers: Array<HttpResponseHeader>;
|
|
83
|
+
remoteAddr: string | null;
|
|
84
|
+
status: number;
|
|
85
|
+
statusReason: string | null;
|
|
86
|
+
url: string;
|
|
87
|
+
version: string | null;
|
|
88
|
+
};
|
|
89
|
+
export type HttpResponseHeader = {
|
|
90
|
+
name: string;
|
|
91
|
+
value: string;
|
|
92
|
+
};
|
|
93
|
+
export type HttpUrlParameter = {
|
|
94
|
+
enabled?: boolean;
|
|
95
|
+
name: string;
|
|
96
|
+
value: string;
|
|
97
|
+
};
|
|
98
|
+
export type Workspace = {
|
|
99
|
+
model: "workspace";
|
|
100
|
+
id: string;
|
|
101
|
+
createdAt: string;
|
|
102
|
+
updatedAt: string;
|
|
103
|
+
name: string;
|
|
104
|
+
description: string;
|
|
105
|
+
variables: Array<EnvironmentVariable>;
|
|
106
|
+
settingValidateCertificates: boolean;
|
|
107
|
+
settingFollowRedirects: boolean;
|
|
108
|
+
settingRequestTimeout: number;
|
|
109
|
+
};
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("
|
|
17
|
+
__exportStar(require("./bindings/models"), exports);
|
|
18
|
+
__exportStar(require("./bindings/events"), exports);
|
package/lib/plugins/Context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest } from '
|
|
1
|
+
import { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest } from '..';
|
|
2
2
|
export type Context = {
|
|
3
3
|
clipboard: {
|
|
4
4
|
copyText(text: string): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallHttpRequestActionArgs, HttpRequestAction } from '
|
|
1
|
+
import { CallHttpRequestActionArgs, HttpRequestAction } from '..';
|
|
2
2
|
import { Context } from './Context';
|
|
3
3
|
export type HttpRequestActionPlugin = HttpRequestAction & {
|
|
4
4
|
onSelect(ctx: Context, args: CallHttpRequestActionArgs): Promise<void> | void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Environment, Folder, HttpRequest, Workspace } from '
|
|
1
|
+
import { Environment, Folder, HttpRequest, Workspace } from '..';
|
|
2
2
|
import { AtLeast } from '../helpers';
|
|
3
3
|
import { Context } from './Context';
|
|
4
4
|
export type ImportPluginResponse = null | {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallTemplateFunctionArgs, TemplateFunction } from '
|
|
1
|
+
import { CallTemplateFunctionArgs, TemplateFunction } from '..';
|
|
2
2
|
import { Context } from './Context';
|
|
3
3
|
export type TemplateFunctionPlugin = TemplateFunction & {
|
|
4
4
|
onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null>;
|
package/package.json
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaakapp/api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "./lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
|
-
"lib"
|
|
7
|
+
"lib/**/*"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "tsc",
|
|
10
|
+
"build": "run-s build:copy-types build:tsc",
|
|
11
|
+
"build:tsc": "tsc",
|
|
12
|
+
"build:copy-types": "cpy --flat ../src-tauri/yaak_plugin_runtime/bindings/*.ts ./src/bindings/",
|
|
11
13
|
"prepublishOnly": "npm run build"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"@types/node": "^22.5.4"
|
|
15
17
|
},
|
|
16
18
|
"devDependencies": {
|
|
19
|
+
"cpy-cli": "^5.0.0",
|
|
20
|
+
"npm-run-all": "^4.1.5",
|
|
17
21
|
"typescript": "^5.6.2"
|
|
18
22
|
}
|
|
19
23
|
}
|