@yaakapp/api 0.2.20 → 0.2.23

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.
@@ -1,5 +1,10 @@
1
- import type { Environment, Folder, GrpcRequest, HttpRequest, HttpResponse, Workspace } from './models';
2
- import type { JsonValue } from './serde_json/JsonValue';
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 { JsonValue } from "./serde_json/JsonValue";
7
+ import type { Workspace } from "./models";
3
8
  export type BootRequest = {
4
9
  dir: string;
5
10
  watch: boolean;
@@ -9,6 +14,18 @@ export type BootResponse = {
9
14
  version: string;
10
15
  capabilities: Array<string>;
11
16
  };
17
+ export type CallHttpAuthenticationRequest = {
18
+ config: {
19
+ [key in string]?: JsonValue;
20
+ };
21
+ method: string;
22
+ url: string;
23
+ headers: Array<HttpHeader>;
24
+ };
25
+ export type CallHttpAuthenticationResponse = {
26
+ url: string;
27
+ headers: Array<HttpHeader>;
28
+ };
12
29
  export type CallHttpRequestActionArgs = {
13
30
  httpRequest: HttpRequest;
14
31
  };
@@ -30,16 +47,24 @@ export type CallTemplateFunctionRequest = {
30
47
  export type CallTemplateFunctionResponse = {
31
48
  value: string | null;
32
49
  };
33
- export type Color = 'custom' | 'default' | 'primary' | 'secondary' | 'info' | 'success' | 'notice' | 'warning' | 'danger';
50
+ export type Color = "custom" | "default" | "primary" | "secondary" | "info" | "success" | "notice" | "warning" | "danger";
34
51
  export type CopyTextRequest = {
35
52
  text: string;
36
53
  };
54
+ export type EmptyPayload = {};
37
55
  export type ExportHttpRequestRequest = {
38
56
  httpRequest: HttpRequest;
39
57
  };
40
58
  export type ExportHttpRequestResponse = {
41
59
  content: string;
42
60
  };
61
+ export type FileFilter = {
62
+ name: string;
63
+ /**
64
+ * File extensions to require
65
+ */
66
+ extensions: Array<string>;
67
+ };
43
68
  export type FilterRequest = {
44
69
  content: string;
45
70
  filter: string;
@@ -54,190 +79,18 @@ export type FindHttpResponsesRequest = {
54
79
  export type FindHttpResponsesResponse = {
55
80
  httpResponses: Array<HttpResponse>;
56
81
  };
57
- export type GetHttpRequestActionsRequest = Record<string, never>;
58
- export type GetHttpRequestActionsResponse = {
59
- actions: Array<HttpRequestAction>;
60
- pluginRefId: string;
61
- };
62
- export type GetHttpRequestByIdRequest = {
63
- id: string;
64
- };
65
- export type GetHttpRequestByIdResponse = {
66
- httpRequest: HttpRequest | null;
67
- };
68
- export type GetTemplateFunctionsResponse = {
69
- functions: Array<TemplateFunction>;
70
- pluginRefId: string;
71
- };
72
- export type HttpRequestAction = {
73
- key: string;
74
- label: string;
75
- icon?: Icon;
76
- };
77
- export type Icon = 'copy' | 'info' | 'check_circle' | 'alert_triangle' | '_unknown';
78
- export type ImportRequest = {
79
- content: string;
80
- };
81
- export type ImportResources = {
82
- workspaces: Array<Workspace>;
83
- environments: Array<Environment>;
84
- folders: Array<Folder>;
85
- httpRequests: Array<HttpRequest>;
86
- grpcRequests: Array<GrpcRequest>;
87
- };
88
- export type ImportResponse = {
89
- resources: ImportResources;
90
- };
91
- export type InternalEvent = {
92
- id: string;
93
- pluginRefId: string;
94
- replyId: string | null;
95
- payload: InternalEventPayload;
96
- windowContext: WindowContext;
97
- };
98
- export type InternalEventPayload = ({
99
- type: 'boot_request';
100
- } & BootRequest) | ({
101
- type: 'boot_response';
102
- } & BootResponse) | {
103
- type: 'reload_request';
104
- } | {
105
- type: 'reload_response';
106
- } | {
107
- type: 'terminate_request';
108
- } | {
109
- type: 'terminate_response';
110
- } | ({
111
- type: 'import_request';
112
- } & ImportRequest) | ({
113
- type: 'import_response';
114
- } & ImportResponse) | ({
115
- type: 'filter_request';
116
- } & FilterRequest) | ({
117
- type: 'filter_response';
118
- } & FilterResponse) | ({
119
- type: 'export_http_request_request';
120
- } & ExportHttpRequestRequest) | ({
121
- type: 'export_http_request_response';
122
- } & ExportHttpRequestResponse) | ({
123
- type: 'send_http_request_request';
124
- } & SendHttpRequestRequest) | ({
125
- type: 'send_http_request_response';
126
- } & SendHttpRequestResponse) | ({
127
- type: 'get_http_request_actions_request';
128
- } & GetHttpRequestActionsRequest) | ({
129
- type: 'get_http_request_actions_response';
130
- } & GetHttpRequestActionsResponse) | ({
131
- type: 'call_http_request_action_request';
132
- } & CallHttpRequestActionRequest) | {
133
- type: 'get_template_functions_request';
134
- } | ({
135
- type: 'get_template_functions_response';
136
- } & GetTemplateFunctionsResponse) | ({
137
- type: 'call_template_function_request';
138
- } & CallTemplateFunctionRequest) | ({
139
- type: 'call_template_function_response';
140
- } & CallTemplateFunctionResponse) | ({
141
- type: 'copy_text_request';
142
- } & CopyTextRequest) | ({
143
- type: 'render_http_request_request';
144
- } & RenderHttpRequestRequest) | ({
145
- type: 'render_http_request_response';
146
- } & RenderHttpRequestResponse) | ({
147
- type: 'template_render_request';
148
- } & TemplateRenderRequest) | ({
149
- type: 'template_render_response';
150
- } & TemplateRenderResponse) | ({
151
- type: 'show_toast_request';
152
- } & ShowToastRequest) | ({
153
- type: 'prompt_text_request';
154
- } & PromptTextRequest) | ({
155
- type: 'prompt_text_response';
156
- } & PromptTextResponse) | ({
157
- type: 'get_http_request_by_id_request';
158
- } & GetHttpRequestByIdRequest) | ({
159
- type: 'get_http_request_by_id_response';
160
- } & GetHttpRequestByIdResponse) | ({
161
- type: 'find_http_responses_request';
162
- } & FindHttpResponsesRequest) | ({
163
- type: 'find_http_responses_response';
164
- } & FindHttpResponsesResponse) | {
165
- type: 'empty_response';
166
- };
167
- export type OpenFileFilter = {
168
- name: string;
169
- /**
170
- * File extensions to require
171
- */
172
- extensions: Array<string>;
173
- };
174
- export type PromptTextRequest = {
175
- id: string;
176
- title: string;
177
- label: string;
178
- description?: string;
179
- defaultValue?: string;
180
- placeholder?: string;
181
- /**
182
- * Text to add to the confirmation button
183
- */
184
- confirmText?: string;
185
- /**
186
- * Text to add to the cancel button
187
- */
188
- cancelText?: string;
189
- /**
190
- * Require the user to enter a non-empty value
191
- */
192
- require?: boolean;
193
- };
194
- export type PromptTextResponse = {
195
- value: string | null;
196
- };
197
- export type RenderHttpRequestRequest = {
198
- httpRequest: HttpRequest;
199
- purpose: RenderPurpose;
200
- };
201
- export type RenderHttpRequestResponse = {
202
- httpRequest: HttpRequest;
203
- };
204
- export type RenderPurpose = 'send' | 'preview';
205
- export type SendHttpRequestRequest = {
206
- httpRequest: HttpRequest;
207
- };
208
- export type SendHttpRequestResponse = {
209
- httpResponse: HttpResponse;
210
- };
211
- export type ShowToastRequest = {
212
- message: string;
213
- color?: Color;
214
- icon?: Icon;
215
- };
216
- export type TemplateFunction = {
217
- name: string;
218
- description?: string;
219
- /**
220
- * Also support alternative names. This is useful for not breaking existing
221
- * tags when changing the `name` property
222
- */
223
- aliases?: Array<string>;
224
- args: Array<TemplateFunctionArg>;
225
- };
226
- export type TemplateFunctionArg = ({
227
- type: 'text';
228
- } & TemplateFunctionTextArg) | ({
229
- type: 'select';
230
- } & TemplateFunctionSelectArg) | ({
231
- type: 'checkbox';
232
- } & TemplateFunctionCheckboxArg) | ({
233
- type: 'http_request';
234
- } & TemplateFunctionHttpRequestArg) | ({
235
- type: 'file';
236
- } & TemplateFunctionFileArg);
237
- export type TemplateFunctionBaseArg = {
238
- /**
239
- * The name of the argument. Should be `camelCase` format
240
- */
82
+ export type FormInput = {
83
+ "type": "text";
84
+ } & FormInputText | {
85
+ "type": "select";
86
+ } & FormInputSelect | {
87
+ "type": "checkbox";
88
+ } & FormInputCheckbox | {
89
+ "type": "file";
90
+ } & FormInputFile | {
91
+ "type": "http_request";
92
+ } & FormInputHttpRequest;
93
+ export type FormInputBase = {
241
94
  name: string;
242
95
  /**
243
96
  * Whether the user must fill in the argument
@@ -252,10 +105,7 @@ export type TemplateFunctionBaseArg = {
252
105
  */
253
106
  defaultValue?: string;
254
107
  };
255
- export type TemplateFunctionCheckboxArg = {
256
- /**
257
- * The name of the argument. Should be `camelCase` format
258
- */
108
+ export type FormInputCheckbox = {
259
109
  name: string;
260
110
  /**
261
111
  * Whether the user must fill in the argument
@@ -270,7 +120,7 @@ export type TemplateFunctionCheckboxArg = {
270
120
  */
271
121
  defaultValue?: string;
272
122
  };
273
- export type TemplateFunctionFileArg = {
123
+ export type FormInputFile = {
274
124
  /**
275
125
  * The title of the file selection window
276
126
  */
@@ -281,10 +131,7 @@ export type TemplateFunctionFileArg = {
281
131
  multiple?: boolean;
282
132
  directory?: boolean;
283
133
  defaultPath?: string;
284
- filters?: Array<OpenFileFilter>;
285
- /**
286
- * The name of the argument. Should be `camelCase` format
287
- */
134
+ filters?: Array<FileFilter>;
288
135
  name: string;
289
136
  /**
290
137
  * Whether the user must fill in the argument
@@ -299,10 +146,7 @@ export type TemplateFunctionFileArg = {
299
146
  */
300
147
  defaultValue?: string;
301
148
  };
302
- export type TemplateFunctionHttpRequestArg = {
303
- /**
304
- * The name of the argument. Should be `camelCase` format
305
- */
149
+ export type FormInputHttpRequest = {
306
150
  name: string;
307
151
  /**
308
152
  * Whether the user must fill in the argument
@@ -317,14 +161,11 @@ export type TemplateFunctionHttpRequestArg = {
317
161
  */
318
162
  defaultValue?: string;
319
163
  };
320
- export type TemplateFunctionSelectArg = {
164
+ export type FormInputSelect = {
321
165
  /**
322
166
  * The options that will be available in the select input
323
167
  */
324
- options: Array<TemplateFunctionSelectOption>;
325
- /**
326
- * The name of the argument. Should be `camelCase` format
327
- */
168
+ options: Array<FormInputSelectOption>;
328
169
  name: string;
329
170
  /**
330
171
  * Whether the user must fill in the argument
@@ -339,18 +180,15 @@ export type TemplateFunctionSelectArg = {
339
180
  */
340
181
  defaultValue?: string;
341
182
  };
342
- export type TemplateFunctionSelectOption = {
343
- label: string;
183
+ export type FormInputSelectOption = {
184
+ name: string;
344
185
  value: string;
345
186
  };
346
- export type TemplateFunctionTextArg = {
187
+ export type FormInputText = {
347
188
  /**
348
189
  * Placeholder for the text input
349
190
  */
350
- placeholder?: string;
351
- /**
352
- * The name of the argument. Should be `camelCase` format
353
- */
191
+ placeholder?: string | null;
354
192
  name: string;
355
193
  /**
356
194
  * Whether the user must fill in the argument
@@ -365,6 +203,188 @@ export type TemplateFunctionTextArg = {
365
203
  */
366
204
  defaultValue?: string;
367
205
  };
206
+ export type GetHttpAuthenticationResponse = {
207
+ name: string;
208
+ config: Array<HttpAuthenticationConfigInput>;
209
+ };
210
+ export type GetHttpRequestActionsRequest = Record<string, never>;
211
+ export type GetHttpRequestActionsResponse = {
212
+ actions: Array<HttpRequestAction>;
213
+ pluginRefId: string;
214
+ };
215
+ export type GetHttpRequestByIdRequest = {
216
+ id: string;
217
+ };
218
+ export type GetHttpRequestByIdResponse = {
219
+ httpRequest: HttpRequest | null;
220
+ };
221
+ export type GetTemplateFunctionsResponse = {
222
+ functions: Array<TemplateFunction>;
223
+ pluginRefId: string;
224
+ };
225
+ export type HttpAuthenticationConfigInput = {
226
+ name: string;
227
+ args: Array<FormInput>;
228
+ };
229
+ export type HttpHeader = {
230
+ name: string;
231
+ value: string;
232
+ };
233
+ export type HttpRequestAction = {
234
+ key: string;
235
+ label: string;
236
+ icon?: Icon;
237
+ };
238
+ export type Icon = "copy" | "info" | "check_circle" | "alert_triangle" | "_unknown";
239
+ export type ImportRequest = {
240
+ content: string;
241
+ };
242
+ export type ImportResources = {
243
+ workspaces: Array<Workspace>;
244
+ environments: Array<Environment>;
245
+ folders: Array<Folder>;
246
+ httpRequests: Array<HttpRequest>;
247
+ grpcRequests: Array<GrpcRequest>;
248
+ };
249
+ export type ImportResponse = {
250
+ resources: ImportResources;
251
+ };
252
+ export type InternalEvent = {
253
+ id: string;
254
+ pluginRefId: string;
255
+ replyId: string | null;
256
+ payload: InternalEventPayload;
257
+ windowContext: WindowContext;
258
+ };
259
+ export type InternalEventPayload = {
260
+ "type": "boot_request";
261
+ } & BootRequest | {
262
+ "type": "boot_response";
263
+ } & BootResponse | {
264
+ "type": "reload_request";
265
+ } & EmptyPayload | {
266
+ "type": "reload_response";
267
+ } & EmptyPayload | {
268
+ "type": "terminate_request";
269
+ } | {
270
+ "type": "terminate_response";
271
+ } | {
272
+ "type": "import_request";
273
+ } & ImportRequest | {
274
+ "type": "import_response";
275
+ } & ImportResponse | {
276
+ "type": "filter_request";
277
+ } & FilterRequest | {
278
+ "type": "filter_response";
279
+ } & FilterResponse | {
280
+ "type": "export_http_request_request";
281
+ } & ExportHttpRequestRequest | {
282
+ "type": "export_http_request_response";
283
+ } & ExportHttpRequestResponse | {
284
+ "type": "send_http_request_request";
285
+ } & SendHttpRequestRequest | {
286
+ "type": "send_http_request_response";
287
+ } & SendHttpRequestResponse | {
288
+ "type": "get_http_request_actions_request";
289
+ } & EmptyPayload | {
290
+ "type": "get_http_request_actions_response";
291
+ } & GetHttpRequestActionsResponse | {
292
+ "type": "call_http_request_action_request";
293
+ } & CallHttpRequestActionRequest | {
294
+ "type": "get_template_functions_request";
295
+ } | {
296
+ "type": "get_template_functions_response";
297
+ } & GetTemplateFunctionsResponse | {
298
+ "type": "call_template_function_request";
299
+ } & CallTemplateFunctionRequest | {
300
+ "type": "call_template_function_response";
301
+ } & CallTemplateFunctionResponse | {
302
+ "type": "get_http_authentication_request";
303
+ } & EmptyPayload | {
304
+ "type": "get_http_authentication_response";
305
+ } & GetHttpAuthenticationResponse | {
306
+ "type": "call_http_authentication_request";
307
+ } & CallHttpAuthenticationRequest | {
308
+ "type": "call_http_authentication_response";
309
+ } & CallHttpAuthenticationResponse | {
310
+ "type": "copy_text_request";
311
+ } & CopyTextRequest | {
312
+ "type": "render_http_request_request";
313
+ } & RenderHttpRequestRequest | {
314
+ "type": "render_http_request_response";
315
+ } & RenderHttpRequestResponse | {
316
+ "type": "template_render_request";
317
+ } & TemplateRenderRequest | {
318
+ "type": "template_render_response";
319
+ } & TemplateRenderResponse | {
320
+ "type": "show_toast_request";
321
+ } & ShowToastRequest | {
322
+ "type": "prompt_text_request";
323
+ } & PromptTextRequest | {
324
+ "type": "prompt_text_response";
325
+ } & PromptTextResponse | {
326
+ "type": "get_http_request_by_id_request";
327
+ } & GetHttpRequestByIdRequest | {
328
+ "type": "get_http_request_by_id_response";
329
+ } & GetHttpRequestByIdResponse | {
330
+ "type": "find_http_responses_request";
331
+ } & FindHttpResponsesRequest | {
332
+ "type": "find_http_responses_response";
333
+ } & FindHttpResponsesResponse | {
334
+ "type": "empty_response";
335
+ } & EmptyPayload;
336
+ export type PromptTextRequest = {
337
+ id: string;
338
+ title: string;
339
+ label: string;
340
+ description?: string;
341
+ defaultValue?: string;
342
+ placeholder?: string;
343
+ /**
344
+ * Text to add to the confirmation button
345
+ */
346
+ confirmText?: string;
347
+ /**
348
+ * Text to add to the cancel button
349
+ */
350
+ cancelText?: string;
351
+ /**
352
+ * Require the user to enter a non-empty value
353
+ */
354
+ require?: boolean;
355
+ };
356
+ export type PromptTextResponse = {
357
+ value: string | null;
358
+ };
359
+ export type RenderHttpRequestRequest = {
360
+ httpRequest: HttpRequest;
361
+ purpose: RenderPurpose;
362
+ };
363
+ export type RenderHttpRequestResponse = {
364
+ httpRequest: HttpRequest;
365
+ };
366
+ export type RenderPurpose = "send" | "preview";
367
+ export type SendHttpRequestRequest = {
368
+ httpRequest: HttpRequest;
369
+ };
370
+ export type SendHttpRequestResponse = {
371
+ httpResponse: HttpResponse;
372
+ };
373
+ export type ShowToastRequest = {
374
+ message: string;
375
+ color?: Color;
376
+ icon?: Icon;
377
+ };
378
+ export type TemplateFunction = {
379
+ name: string;
380
+ description?: string;
381
+ /**
382
+ * Also support alternative names. This is useful for not breaking existing
383
+ * tags when changing the `name` property
384
+ */
385
+ aliases?: Array<string>;
386
+ args: Array<FormInput>;
387
+ };
368
388
  export type TemplateRenderRequest = {
369
389
  data: JsonValue;
370
390
  purpose: RenderPurpose;
@@ -373,8 +393,8 @@ export type TemplateRenderResponse = {
373
393
  data: JsonValue;
374
394
  };
375
395
  export type WindowContext = {
376
- type: 'none';
396
+ "type": "none";
377
397
  } | {
378
- type: 'label';
398
+ "type": "label";
379
399
  label: string;
380
400
  };
@@ -12,6 +12,7 @@ export type EnvironmentVariable = {
12
12
  enabled?: boolean;
13
13
  name: string;
14
14
  value: string;
15
+ id: string;
15
16
  };
16
17
  export type Folder = {
17
18
  model: "folder";
@@ -28,6 +29,7 @@ export type GrpcMetadataEntry = {
28
29
  enabled?: boolean;
29
30
  name: string;
30
31
  value: string;
32
+ id: string;
31
33
  };
32
34
  export type GrpcRequest = {
33
35
  model: "grpc_request";
@@ -70,6 +72,7 @@ export type HttpRequestHeader = {
70
72
  enabled?: boolean;
71
73
  name: string;
72
74
  value: string;
75
+ id: string;
73
76
  };
74
77
  export type HttpResponse = {
75
78
  model: "http_response";
@@ -100,6 +103,7 @@ export type HttpUrlParameter = {
100
103
  enabled?: boolean;
101
104
  name: string;
102
105
  value: string;
106
+ id: string;
103
107
  };
104
108
  export type Workspace = {
105
109
  model: "workspace";
@@ -1,5 +1,5 @@
1
- import { CallAuthMiddlewareRequest, CallAuthMiddlewareResponse, GetAuthMiddlewareResponse } from '@yaakapp-internal/plugins';
1
+ import { CallHttpAuthenticationRequest, CallHttpAuthenticationResponse, GetHttpAuthenticationResponse } from '..';
2
2
  import type { Context } from './Context';
3
- export type AuthenticationPlugin = GetAuthMiddlewareResponse & {
4
- onApply(ctx: Context, args: CallAuthMiddlewareRequest): Promise<CallAuthMiddlewareResponse> | CallAuthMiddlewareResponse;
3
+ export type AuthenticationPlugin = GetHttpAuthenticationResponse & {
4
+ onApply(ctx: Context, args: CallHttpAuthenticationRequest): Promise<CallHttpAuthenticationResponse> | CallHttpAuthenticationResponse;
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaakapp/api",
3
- "version": "0.2.20",
3
+ "version": "0.2.23",
4
4
  "main": "lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "files": [
@@ -11,8 +11,9 @@
11
11
  "build": "run-s build:copy-types build:tsc",
12
12
  "build:tsc": "tsc",
13
13
  "build:copy-types": "run-p build:copy-types:*",
14
- "build:copy-types:root": "cpy --flat ../../src-tauri/yaak-plugin-runtime/bindings/*.ts ./src/bindings",
15
- "build:copy-types:next": "cpy --flat ../../src-tauri/yaak-plugin-runtime/bindings/serde_json/*.ts ./src/bindings/serde_json",
14
+ "build:copy-types:root": "cpy --flat ../../src-tauri/yaak-plugins/bindings/*.ts ./src/bindings",
15
+ "build:copy-types:next": "cpy --flat ../../src-tauri/yaak-plugins/bindings/serde_json/*.ts ./src/bindings/serde_json",
16
+ "publish": "npm publish",
16
17
  "prepublishOnly": "npm run build"
17
18
  },
18
19
  "dependencies": {