@yaakapp/api 0.2.17 → 0.2.18

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,10 +1,5 @@
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";
1
+ import type { Environment, Folder, GrpcRequest, HttpRequest, HttpResponse, Workspace } from './models';
2
+ import type { JsonValue } from './serde_json/JsonValue';
8
3
  export type BootRequest = {
9
4
  dir: string;
10
5
  watch: boolean;
@@ -35,7 +30,7 @@ export type CallTemplateFunctionRequest = {
35
30
  export type CallTemplateFunctionResponse = {
36
31
  value: string | null;
37
32
  };
38
- export type Color = "custom" | "default" | "primary" | "secondary" | "info" | "success" | "notice" | "warning" | "danger";
33
+ export type Color = 'custom' | 'default' | 'primary' | 'secondary' | 'info' | 'success' | 'notice' | 'warning' | 'danger';
39
34
  export type CopyTextRequest = {
40
35
  text: string;
41
36
  };
@@ -79,7 +74,7 @@ export type HttpRequestAction = {
79
74
  label: string;
80
75
  icon?: Icon;
81
76
  };
82
- export type Icon = "copy" | "info" | "check_circle" | "alert_triangle" | "_unknown";
77
+ export type Icon = 'copy' | 'info' | 'check_circle' | 'alert_triangle' | '_unknown';
83
78
  export type ImportRequest = {
84
79
  content: string;
85
80
  };
@@ -100,74 +95,74 @@ export type InternalEvent = {
100
95
  payload: InternalEventPayload;
101
96
  windowContext: WindowContext;
102
97
  };
103
- export type InternalEventPayload = {
104
- "type": "boot_request";
105
- } & BootRequest | {
106
- "type": "boot_response";
107
- } & BootResponse | {
108
- "type": "reload_request";
98
+ export type InternalEventPayload = ({
99
+ type: 'boot_request';
100
+ } & BootRequest) | ({
101
+ type: 'boot_response';
102
+ } & BootResponse) | {
103
+ type: 'reload_request';
109
104
  } | {
110
- "type": "reload_response";
105
+ type: 'reload_response';
111
106
  } | {
112
- "type": "terminate_request";
107
+ type: 'terminate_request';
113
108
  } | {
114
- "type": "terminate_response";
115
- } | {
116
- "type": "import_request";
117
- } & ImportRequest | {
118
- "type": "import_response";
119
- } & ImportResponse | {
120
- "type": "filter_request";
121
- } & FilterRequest | {
122
- "type": "filter_response";
123
- } & FilterResponse | {
124
- "type": "export_http_request_request";
125
- } & ExportHttpRequestRequest | {
126
- "type": "export_http_request_response";
127
- } & ExportHttpRequestResponse | {
128
- "type": "send_http_request_request";
129
- } & SendHttpRequestRequest | {
130
- "type": "send_http_request_response";
131
- } & SendHttpRequestResponse | {
132
- "type": "get_http_request_actions_request";
133
- } & GetHttpRequestActionsRequest | {
134
- "type": "get_http_request_actions_response";
135
- } & GetHttpRequestActionsResponse | {
136
- "type": "call_http_request_action_request";
137
- } & CallHttpRequestActionRequest | {
138
- "type": "get_template_functions_request";
139
- } | {
140
- "type": "get_template_functions_response";
141
- } & GetTemplateFunctionsResponse | {
142
- "type": "call_template_function_request";
143
- } & CallTemplateFunctionRequest | {
144
- "type": "call_template_function_response";
145
- } & CallTemplateFunctionResponse | {
146
- "type": "copy_text_request";
147
- } & CopyTextRequest | {
148
- "type": "render_http_request_request";
149
- } & RenderHttpRequestRequest | {
150
- "type": "render_http_request_response";
151
- } & RenderHttpRequestResponse | {
152
- "type": "template_render_request";
153
- } & TemplateRenderRequest | {
154
- "type": "template_render_response";
155
- } & TemplateRenderResponse | {
156
- "type": "show_toast_request";
157
- } & ShowToastRequest | {
158
- "type": "prompt_text_request";
159
- } & PromptTextRequest | {
160
- "type": "prompt_text_response";
161
- } & PromptTextResponse | {
162
- "type": "get_http_request_by_id_request";
163
- } & GetHttpRequestByIdRequest | {
164
- "type": "get_http_request_by_id_response";
165
- } & GetHttpRequestByIdResponse | {
166
- "type": "find_http_responses_request";
167
- } & FindHttpResponsesRequest | {
168
- "type": "find_http_responses_response";
169
- } & FindHttpResponsesResponse | {
170
- "type": "empty_response";
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';
171
166
  };
172
167
  export type OpenFileFilter = {
173
168
  name: string;
@@ -206,7 +201,7 @@ export type RenderHttpRequestRequest = {
206
201
  export type RenderHttpRequestResponse = {
207
202
  httpRequest: HttpRequest;
208
203
  };
209
- export type RenderPurpose = "send" | "preview";
204
+ export type RenderPurpose = 'send' | 'preview';
210
205
  export type SendHttpRequestRequest = {
211
206
  httpRequest: HttpRequest;
212
207
  };
@@ -228,17 +223,17 @@ export type TemplateFunction = {
228
223
  aliases?: Array<string>;
229
224
  args: Array<TemplateFunctionArg>;
230
225
  };
231
- export type TemplateFunctionArg = {
232
- "type": "text";
233
- } & TemplateFunctionTextArg | {
234
- "type": "select";
235
- } & TemplateFunctionSelectArg | {
236
- "type": "checkbox";
237
- } & TemplateFunctionCheckboxArg | {
238
- "type": "http_request";
239
- } & TemplateFunctionHttpRequestArg | {
240
- "type": "file";
241
- } & TemplateFunctionFileArg;
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);
242
237
  export type TemplateFunctionBaseArg = {
243
238
  /**
244
239
  * The name of the argument. Should be `camelCase` format
@@ -378,8 +373,8 @@ export type TemplateRenderResponse = {
378
373
  data: JsonValue;
379
374
  };
380
375
  export type WindowContext = {
381
- "type": "none";
376
+ type: 'none';
382
377
  } | {
383
- "type": "label";
378
+ type: 'label';
384
379
  label: string;
385
380
  };
@@ -1,4 +1,4 @@
1
- import { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, PromptTextRequest, PromptTextResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest, TemplateRenderResponse } from '..';
1
+ import type { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, PromptTextRequest, PromptTextResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest, TemplateRenderResponse } from '..';
2
2
  export type Context = {
3
3
  clipboard: {
4
4
  copyText(text: string): void;
@@ -1,4 +1,4 @@
1
- import { Context } from './Context';
1
+ import type { Context } from './Context';
2
2
  export type FilterPluginResponse = string[];
3
3
  export type FilterPlugin = {
4
4
  name: string;
@@ -1,5 +1,5 @@
1
- import { CallHttpRequestActionArgs, HttpRequestAction } from '..';
2
- import { Context } from './Context';
1
+ import type { CallHttpRequestActionArgs, HttpRequestAction } from '..';
2
+ import type { Context } from './Context';
3
3
  export type HttpRequestActionPlugin = HttpRequestAction & {
4
4
  onSelect(ctx: Context, args: CallHttpRequestActionArgs): Promise<void> | void;
5
5
  };
@@ -1,11 +1,12 @@
1
- import { Environment, Folder, HttpRequest, Workspace } from '..';
2
- import { AtLeast } from '../helpers';
3
- import { Context } from './Context';
1
+ import type { Environment, Folder, GrpcRequest, HttpRequest, Workspace } from '..';
2
+ import type { AtLeast } from '../helpers';
3
+ import type { Context } from './Context';
4
4
  export type ImportPluginResponse = null | {
5
5
  workspaces: AtLeast<Workspace, 'name' | 'id' | 'model'>[];
6
6
  environments: AtLeast<Environment, 'name' | 'id' | 'model' | 'workspaceId'>[];
7
- httpRequests: AtLeast<HttpRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
8
7
  folders: AtLeast<Folder, 'name' | 'id' | 'model' | 'workspaceId'>[];
8
+ httpRequests: AtLeast<HttpRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
9
+ grpcRequests: AtLeast<GrpcRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
9
10
  };
10
11
  export type ImporterPlugin = {
11
12
  name: string;
@@ -1,5 +1,5 @@
1
- import { CallTemplateFunctionArgs, TemplateFunction } from '..';
2
- import { Context } from './Context';
1
+ import type { CallTemplateFunctionArgs, TemplateFunction } from '..';
2
+ import type { Context } from './Context';
3
3
  export type TemplateFunctionPlugin = TemplateFunction & {
4
4
  onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null>;
5
5
  };
@@ -1,5 +1,5 @@
1
- import { Theme } from '../themes';
2
- import { Context } from './Context';
1
+ import type { Theme } from '../themes';
2
+ import type { Context } from './Context';
3
3
  export type ThemePlugin = {
4
4
  name: string;
5
5
  description?: string;
@@ -1,8 +1,8 @@
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';
1
+ import type { FilterPlugin } from './FilterPlugin';
2
+ import type { HttpRequestActionPlugin } from './HttpRequestActionPlugin';
3
+ import type { ImporterPlugin } from './ImporterPlugin';
4
+ import type { TemplateFunctionPlugin } from './TemplateFunctionPlugin';
5
+ import type { ThemePlugin } from './ThemePlugin';
6
6
  export type { Context } from './Context';
7
7
  /**
8
8
  * The global structure of a Yaak plugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaakapp/api",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "main": "lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "files": [
@@ -11,8 +11,8 @@
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-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",
16
16
  "prepublishOnly": "npm run build"
17
17
  },
18
18
  "dependencies": {