@yaakapp/api 0.2.5 → 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.
Files changed (36) hide show
  1. package/lib/bindings/events.d.ts +228 -0
  2. package/lib/bindings/models.d.ts +109 -0
  3. package/lib/helpers.d.ts +0 -1
  4. package/lib/index.d.ts +2 -2
  5. package/lib/index.js +2 -2
  6. package/lib/plugin-runtime-types/src/helpers.d.ts +2 -0
  7. package/lib/plugin-runtime-types/src/helpers.js +2 -0
  8. package/lib/plugin-runtime-types/src/index.d.ts +4 -0
  9. package/lib/plugin-runtime-types/src/index.js +18 -0
  10. package/lib/plugin-runtime-types/src/plugins/Context.d.ts +17 -0
  11. package/lib/plugin-runtime-types/src/plugins/Context.js +2 -0
  12. package/lib/plugin-runtime-types/src/plugins/FilterPlugin.d.ts +13 -0
  13. package/lib/plugin-runtime-types/src/plugins/FilterPlugin.js +2 -0
  14. package/lib/plugin-runtime-types/src/plugins/HttpRequestActionPlugin.d.ts +5 -0
  15. package/lib/plugin-runtime-types/src/plugins/HttpRequestActionPlugin.js +2 -0
  16. package/lib/plugin-runtime-types/src/plugins/ImporterPlugin.d.ts +16 -0
  17. package/lib/plugin-runtime-types/src/plugins/ImporterPlugin.js +2 -0
  18. package/lib/plugin-runtime-types/src/plugins/TemplateFunctionPlugin.d.ts +5 -0
  19. package/lib/plugin-runtime-types/src/plugins/TemplateFunctionPlugin.js +2 -0
  20. package/lib/plugin-runtime-types/src/plugins/ThemePlugin.d.ts +7 -0
  21. package/lib/plugin-runtime-types/src/plugins/ThemePlugin.js +2 -0
  22. package/lib/plugin-runtime-types/src/plugins/index.d.ts +16 -0
  23. package/lib/plugin-runtime-types/src/plugins/index.js +2 -0
  24. package/lib/plugin-runtime-types/src/themes/index.d.ts +39 -0
  25. package/lib/plugin-runtime-types/src/themes/index.js +2 -0
  26. package/lib/plugins/Context.d.ts +1 -1
  27. package/lib/plugins/HttpRequestActionPlugin.d.ts +1 -1
  28. package/lib/plugins/ImporterPlugin.d.ts +1 -1
  29. package/lib/plugins/TemplateFunctionPlugin.d.ts +1 -1
  30. package/lib/{gen → src-tauri/yaak_plugin_runtime/bindings}/events.d.ts +1 -4
  31. package/lib/src-tauri/yaak_plugin_runtime/bindings/events.js +1 -0
  32. package/lib/{gen → src-tauri/yaak_plugin_runtime/bindings}/models.d.ts +41 -91
  33. package/lib/src-tauri/yaak_plugin_runtime/bindings/models.js +2 -0
  34. package/package.json +7 -3
  35. /package/lib/{gen → bindings}/events.js +0 -0
  36. /package/lib/{gen → bindings}/models.js +0 -0
@@ -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/helpers.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export type AtLeast<T, K extends keyof T> = Partial<T> & Pick<T, K>;
2
- export type OneOrMany<T> = T[] | T;
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export type * from './plugins';
2
2
  export type * from './themes';
3
- export * from './gen/models';
4
- export * from './gen/events';
3
+ export * from './bindings/models';
4
+ export * from './bindings/events';
package/lib/index.js CHANGED
@@ -14,5 +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("./gen/models"), exports);
18
- __exportStar(require("./gen/events"), exports);
17
+ __exportStar(require("./bindings/models"), exports);
18
+ __exportStar(require("./bindings/events"), exports);
@@ -0,0 +1,2 @@
1
+ export type AtLeast<T, K extends keyof T> = Partial<T> & Pick<T, K>;
2
+ export type OneOrMany<T> = T[] | T;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type * from './plugins';
2
+ export type * from './themes';
3
+ export * from '../../src-tauri/yaak_plugin_runtime/bindings/models.ts';
4
+ export * from '../../src-tauri/yaak_plugin_runtime/bindings/events.ts';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../src-tauri/yaak_plugin_runtime/bindings/models.ts"), exports);
18
+ __exportStar(require("../../src-tauri/yaak_plugin_runtime/bindings/events.ts"), exports);
@@ -0,0 +1,17 @@
1
+ import { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest } from '../gen/events';
2
+ export type Context = {
3
+ clipboard: {
4
+ copyText(text: string): void;
5
+ };
6
+ toast: {
7
+ show(args: ShowToastRequest): void;
8
+ };
9
+ httpRequest: {
10
+ send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
11
+ getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
12
+ render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse['httpRequest']>;
13
+ };
14
+ httpResponse: {
15
+ find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse['httpResponses']>;
16
+ };
17
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { CallHttpRequestActionArgs, HttpRequestAction } from '../gen/events';
2
+ import { Context } from './Context';
3
+ export type HttpRequestActionPlugin = HttpRequestAction & {
4
+ onSelect(ctx: Context, args: CallHttpRequestActionArgs): Promise<void> | void;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import { Environment, Folder, HttpRequest, Workspace } from '../gen/model_util';
2
+ import { AtLeast } from '../helpers';
3
+ import { Context } from './Context';
4
+ export type ImportPluginResponse = null | {
5
+ workspaces: AtLeast<Workspace, 'name' | 'id' | 'model'>[];
6
+ environments: AtLeast<Environment, 'name' | 'id' | 'model' | 'workspaceId'>[];
7
+ httpRequests: AtLeast<HttpRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
8
+ folders: AtLeast<Folder, 'name' | 'id' | 'model' | 'workspaceId'>[];
9
+ };
10
+ export type ImporterPlugin = {
11
+ name: string;
12
+ description?: string;
13
+ onImport(ctx: Context, args: {
14
+ text: string;
15
+ }): Promise<ImportPluginResponse>;
16
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { CallTemplateFunctionArgs, TemplateFunction } from '../gen/events';
2
+ import { Context } from './Context';
3
+ export type TemplateFunctionPlugin = TemplateFunction & {
4
+ onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null>;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { Theme } from '../themes';
2
+ import { Context } from './Context';
3
+ export type ThemePlugin = {
4
+ name: string;
5
+ description?: string;
6
+ getTheme(ctx: Context, fileContents: string): Promise<Theme>;
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
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';
7
+ /**
8
+ * The global structure of a Yaak plugin
9
+ */
10
+ export type PluginDefinition = {
11
+ importer?: ImporterPlugin;
12
+ theme?: ThemePlugin;
13
+ filter?: FilterPlugin;
14
+ httpRequestActions?: HttpRequestActionPlugin[];
15
+ templateFunctions?: TemplateFunctionPlugin[];
16
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,39 @@
1
+ export type Colors = {
2
+ surface: string;
3
+ surfaceHighlight?: string;
4
+ surfaceActive?: string;
5
+ text: string;
6
+ textSubtle?: string;
7
+ textSubtlest?: string;
8
+ border?: string;
9
+ borderSubtle?: string;
10
+ borderFocus?: string;
11
+ shadow?: string;
12
+ backdrop?: string;
13
+ selection?: string;
14
+ primary?: string;
15
+ secondary?: string;
16
+ info?: string;
17
+ success?: string;
18
+ notice?: string;
19
+ warning?: string;
20
+ danger?: string;
21
+ };
22
+ export type Theme = Colors & {
23
+ id: string;
24
+ name: string;
25
+ components?: Partial<{
26
+ dialog: Partial<Colors>;
27
+ menu: Partial<Colors>;
28
+ toast: Partial<Colors>;
29
+ sidebar: Partial<Colors>;
30
+ responsePane: Partial<Colors>;
31
+ appHeader: Partial<Colors>;
32
+ button: Partial<Colors>;
33
+ banner: Partial<Colors>;
34
+ placeholder: Partial<Colors>;
35
+ urlBar: Partial<Colors>;
36
+ editor: Partial<Colors>;
37
+ input: Partial<Colors>;
38
+ }>;
39
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest } from '../gen/events';
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 '../gen/events';
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 '../gen/models';
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 '../gen/events';
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>;
@@ -1,4 +1,3 @@
1
- import type { CookieJar } from "./models";
2
1
  import type { Environment } from "./models";
3
2
  import type { Folder } from "./models";
4
3
  import type { GrpcConnection } from "./models";
@@ -7,8 +6,6 @@ import type { GrpcRequest } from "./models";
7
6
  import type { HttpRequest } from "./models";
8
7
  import type { HttpResponse } from "./models";
9
8
  import type { KeyValue } from "./models";
10
- import type { Plugin } from "./models";
11
- import type { Settings } from "./models";
12
9
  import type { Workspace } from "./models";
13
10
  export type BootRequest = {
14
11
  dir: string;
@@ -164,7 +161,7 @@ export type InternalEventPayload = {
164
161
  } & FindHttpResponsesResponse | {
165
162
  "type": "empty_response";
166
163
  };
167
- export type Model = Environment | Folder | GrpcConnection | GrpcEvent | GrpcRequest | HttpRequest | HttpResponse | KeyValue | Workspace | CookieJar | Settings | Plugin;
164
+ export type Model = Environment | Folder | GrpcConnection | GrpcEvent | GrpcRequest | HttpRequest | HttpResponse | KeyValue | Workspace;
168
165
  export type RenderHttpRequestRequest = {
169
166
  httpRequest: HttpRequest;
170
167
  purpose: RenderPurpose;
@@ -1,30 +1,7 @@
1
- export type Cookie = {
2
- raw_cookie: string;
3
- domain: CookieDomain;
4
- expires: CookieExpires;
5
- path: [string, boolean];
6
- };
7
- export type CookieDomain = {
8
- "HostOnly": string;
9
- } | {
10
- "Suffix": string;
11
- } | "NotPresent" | "Empty";
12
- export type CookieExpires = {
13
- "AtUtc": string;
14
- } | "SessionEnd";
15
- export type CookieJar = {
16
- id: string;
17
- model: "cookie_jar";
18
- createdAt: string;
19
- updatedAt: string;
20
- workspaceId: string;
21
- name: string;
22
- cookies: Array<Cookie>;
23
- };
24
1
  export type Environment = {
2
+ model: "environment";
25
3
  id: string;
26
4
  workspaceId: string;
27
- model: "environment";
28
5
  createdAt: string;
29
6
  updatedAt: string;
30
7
  name: string;
@@ -36,47 +13,47 @@ export type EnvironmentVariable = {
36
13
  value: string;
37
14
  };
38
15
  export type Folder = {
16
+ model: "folder";
17
+ id: string;
39
18
  createdAt: string;
40
19
  updatedAt: string;
41
- id: string;
42
20
  workspaceId: string;
43
21
  folderId: string | null;
44
- model: "folder";
45
22
  name: string;
46
23
  sortPriority: number;
47
24
  };
48
25
  export type GrpcConnection = {
49
- id: string;
50
26
  model: "grpc_connection";
51
- workspaceId: string;
52
- requestId: string;
27
+ id: string;
53
28
  createdAt: string;
54
29
  updatedAt: string;
55
- service: string;
56
- method: string;
30
+ workspaceId: string;
31
+ requestId: string;
57
32
  elapsed: number;
58
- status: number;
59
- url: string;
60
33
  error: string | null;
34
+ method: string;
35
+ service: string;
36
+ status: number;
61
37
  trailers: {
62
38
  [key in string]?: string;
63
39
  };
40
+ url: string;
64
41
  };
65
42
  export type GrpcEvent = {
66
- id: string;
67
43
  model: "grpc_event";
44
+ id: string;
45
+ createdAt: string;
46
+ updatedAt: string;
68
47
  workspaceId: string;
69
48
  requestId: string;
70
49
  connectionId: string;
71
- createdAt: string;
72
- updatedAt: string;
73
50
  content: string;
51
+ error: string | null;
74
52
  eventType: GrpcEventType;
75
53
  metadata: {
76
54
  [key in string]?: string;
77
55
  };
78
56
  status: number | null;
79
- error: string | null;
80
57
  };
81
58
  export type GrpcEventType = "info" | "error" | "client_message" | "server_message" | "connection_start" | "connection_end";
82
59
  export type GrpcMetadataEntry = {
@@ -85,39 +62,39 @@ export type GrpcMetadataEntry = {
85
62
  value: string;
86
63
  };
87
64
  export type GrpcRequest = {
88
- id: string;
89
65
  model: "grpc_request";
90
- workspaceId: string;
66
+ id: string;
91
67
  createdAt: string;
92
68
  updatedAt: string;
69
+ workspaceId: string;
93
70
  folderId: string | null;
94
- name: string;
95
- sortPriority: number;
96
- url: string;
97
- service: string | null;
98
- method: string | null;
99
- message: string;
100
71
  authenticationType: string | null;
101
72
  authentication: Record<string, any>;
73
+ message: string;
102
74
  metadata: Array<GrpcMetadataEntry>;
75
+ method: string | null;
76
+ name: string;
77
+ service: string | null;
78
+ sortPriority: number;
79
+ url: string;
103
80
  };
104
81
  export type HttpRequest = {
82
+ model: "http_request";
83
+ id: string;
105
84
  createdAt: string;
106
85
  updatedAt: string;
107
- id: string;
108
86
  workspaceId: string;
109
87
  folderId: string | null;
110
- model: "http_request";
111
- sortPriority: number;
112
- name: string;
113
- url: string;
114
- urlParameters: Array<HttpUrlParameter>;
115
- method: string;
116
- body: Record<string, any>;
117
- bodyType: string | null;
118
88
  authentication: Record<string, any>;
119
89
  authenticationType: string | null;
90
+ body: Record<string, any>;
91
+ bodyType: string | null;
120
92
  headers: Array<HttpRequestHeader>;
93
+ method: string;
94
+ name: string;
95
+ sortPriority: number;
96
+ url: string;
97
+ urlParameters: Array<HttpUrlParameter>;
121
98
  };
122
99
  export type HttpRequestHeader = {
123
100
  enabled?: boolean;
@@ -125,23 +102,23 @@ export type HttpRequestHeader = {
125
102
  value: string;
126
103
  };
127
104
  export type HttpResponse = {
128
- id: string;
129
105
  model: "http_response";
130
- workspaceId: string;
131
- requestId: string;
106
+ id: string;
132
107
  createdAt: string;
133
108
  updatedAt: string;
134
- error: string | null;
135
- url: string;
109
+ workspaceId: string;
110
+ requestId: string;
111
+ bodyPath: string | null;
136
112
  contentLength: number | null;
137
- version: string | null;
138
113
  elapsed: number;
139
114
  elapsedHeaders: number;
115
+ error: string | null;
116
+ headers: Array<HttpResponseHeader>;
140
117
  remoteAddr: string | null;
141
118
  status: number;
142
119
  statusReason: string | null;
143
- bodyPath: string | null;
144
- headers: Array<HttpResponseHeader>;
120
+ url: string;
121
+ version: string | null;
145
122
  };
146
123
  export type HttpResponseHeader = {
147
124
  name: string;
@@ -156,40 +133,13 @@ export type KeyValue = {
156
133
  model: "key_value";
157
134
  createdAt: string;
158
135
  updatedAt: string;
159
- namespace: string;
160
136
  key: string;
137
+ namespace: string;
161
138
  value: string;
162
139
  };
163
- export type Plugin = {
164
- id: string;
165
- model: "plugin";
166
- createdAt: string;
167
- updatedAt: string;
168
- checkedAt: string | null;
169
- directory: string;
170
- url: string | null;
171
- enabled: boolean;
172
- };
173
- export type Settings = {
174
- id: string;
175
- model: "settings";
176
- createdAt: string;
177
- updatedAt: string;
178
- theme: string;
179
- appearance: string;
180
- themeDark: string;
181
- themeLight: string;
182
- updateChannel: string;
183
- interfaceFontSize: number;
184
- interfaceScale: number;
185
- editorFontSize: number;
186
- editorSoftWrap: boolean;
187
- telemetry: boolean;
188
- openWorkspaceNewWindow: boolean | null;
189
- };
190
140
  export type Workspace = {
191
- id: string;
192
141
  model: "workspace";
142
+ id: string;
193
143
  createdAt: string;
194
144
  updatedAt: string;
195
145
  name: string;
@@ -0,0 +1,2 @@
1
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
2
+ export {};
package/package.json CHANGED
@@ -1,19 +1,23 @@
1
1
  {
2
2
  "name": "@yaakapp/api",
3
- "version": "0.2.5",
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
  }
File without changes
File without changes