@yaakapp/api 0.1.6 → 0.1.8

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 (43) hide show
  1. package/lib/gen/CallTemplateFunctionArgs.d.ts +7 -0
  2. package/lib/gen/CallTemplateFunctionArgs.js +2 -0
  3. package/lib/gen/CallTemplateFunctionPurpose.d.ts +5 -0
  4. package/lib/gen/CallTemplateFunctionPurpose.js +3 -0
  5. package/lib/gen/CallTemplateFunctionRequest.d.ts +5 -0
  6. package/lib/gen/CallTemplateFunctionRequest.js +2 -0
  7. package/lib/gen/CallTemplateFunctionResponse.d.ts +3 -0
  8. package/lib/gen/CallTemplateFunctionResponse.js +3 -0
  9. package/lib/gen/GetHttpRequestActionsRequest.d.ts +1 -3
  10. package/lib/gen/GetTemplateFunctionsResponse.d.ts +5 -0
  11. package/lib/gen/GetTemplateFunctionsResponse.js +2 -0
  12. package/lib/gen/InternalEventPayload.d.ts +13 -1
  13. package/lib/gen/TemplateFunction.d.ts +5 -0
  14. package/lib/gen/TemplateFunction.js +2 -0
  15. package/lib/gen/TemplateFunctionArg.d.ts +10 -0
  16. package/lib/gen/TemplateFunctionArg.js +2 -0
  17. package/lib/gen/TemplateFunctionBaseArg.d.ts +6 -0
  18. package/lib/gen/TemplateFunctionBaseArg.js +3 -0
  19. package/lib/gen/TemplateFunctionHttpRequestArg.d.ts +6 -0
  20. package/lib/gen/TemplateFunctionHttpRequestArg.js +3 -0
  21. package/lib/gen/TemplateFunctionSelectArg.d.ts +8 -0
  22. package/lib/gen/TemplateFunctionSelectArg.js +2 -0
  23. package/lib/gen/TemplateFunctionSelectOption.d.ts +4 -0
  24. package/lib/gen/TemplateFunctionSelectOption.js +3 -0
  25. package/lib/gen/TemplateFunctionTextArg.d.ts +7 -0
  26. package/lib/gen/TemplateFunctionTextArg.js +3 -0
  27. package/lib/index.d.ts +17 -5
  28. package/lib/index.js +17 -5
  29. package/lib/plugins/FilterPlugin.d.ts +13 -0
  30. package/lib/plugins/FilterPlugin.js +2 -0
  31. package/lib/plugins/HttpRequestActionPlugin.d.ts +6 -0
  32. package/lib/plugins/HttpRequestActionPlugin.js +2 -0
  33. package/lib/plugins/ImporterPlugin.d.ts +19 -0
  34. package/lib/plugins/ImporterPlugin.js +2 -0
  35. package/lib/plugins/TemplateFunctionPlugin.d.ts +6 -0
  36. package/lib/plugins/TemplateFunctionPlugin.js +2 -0
  37. package/lib/plugins/ThemePlugin.d.ts +7 -0
  38. package/lib/plugins/ThemePlugin.js +2 -0
  39. package/lib/plugins/context.d.ts +1 -1
  40. package/lib/plugins/index.d.ts +8 -6
  41. package/lib/plugins/templateTag.d.ts +6 -0
  42. package/lib/plugins/templateTag.js +2 -0
  43. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ import type { CallTemplateFunctionPurpose } from "./CallTemplateFunctionPurpose";
2
+ export type CallTemplateFunctionArgs = {
3
+ purpose: CallTemplateFunctionPurpose;
4
+ values: {
5
+ [key: string]: string;
6
+ };
7
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ export type CallTemplateFunctionPurpose = {
2
+ "type": "send";
3
+ } | {
4
+ "type": "preview";
5
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type { CallTemplateFunctionArgs } from "./CallTemplateFunctionArgs";
2
+ export type CallTemplateFunctionRequest = {
3
+ name: string;
4
+ args: CallTemplateFunctionArgs;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export type CallTemplateFunctionResponse = {
2
+ value: string | null;
3
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1 @@
1
- export type GetHttpRequestActionsRequest = {
2
- nothing: boolean;
3
- };
1
+ export type GetHttpRequestActionsRequest = Record<string, never>;
@@ -0,0 +1,5 @@
1
+ import type { TemplateFunction } from "./TemplateFunction";
2
+ export type GetTemplateFunctionsResponse = {
3
+ functions: Array<TemplateFunction>;
4
+ pluginRefId: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,15 +1,19 @@
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";
15
19
  import type { RenderHttpRequestRequest } from "./RenderHttpRequestRequest";
@@ -39,11 +43,19 @@ export type InternalEventPayload = {
39
43
  "type": "send_http_request_response";
40
44
  } & SendHttpRequestResponse | {
41
45
  "type": "get_http_request_actions_request";
42
- } | {
46
+ } & GetHttpRequestActionsRequest | {
43
47
  "type": "get_http_request_actions_response";
44
48
  } & GetHttpRequestActionsResponse | {
45
49
  "type": "call_http_request_action_request";
46
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 | {
47
59
  "type": "copy_text_request";
48
60
  } & CopyTextRequest | {
49
61
  "type": "render_http_request_request";
@@ -0,0 +1,5 @@
1
+ import type { TemplateFunctionArg } from "./TemplateFunctionArg";
2
+ export type TemplateFunction = {
3
+ name: string;
4
+ args: Array<TemplateFunctionArg>;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export type TemplateFunctionBaseArg = {
2
+ name: string;
3
+ optional?: boolean | null;
4
+ label?: string | null;
5
+ defaultValue?: string | null;
6
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export type TemplateFunctionHttpRequestArg = {
2
+ name: string;
3
+ optional?: boolean | null;
4
+ label?: string | null;
5
+ defaultValue?: string | null;
6
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type TemplateFunctionSelectOption = {
2
+ name: string;
3
+ value: string;
4
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export type TemplateFunctionTextArg = {
2
+ placeholder?: string | null;
3
+ name: string;
4
+ optional?: boolean | null;
5
+ label?: string | null;
6
+ defaultValue?: string | null;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
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,12 +42,19 @@ export * from './gen/InternalEvent';
37
42
  export * from './gen/InternalEventPayload';
38
43
  export * from './gen/KeyValue';
39
44
  export * from './gen/Model';
40
- export * from './gen/SendHttpRequestRequest';
41
- export * from './gen/ToastVariant';
42
- export * from './gen/ShowToastRequest';
43
45
  export * from './gen/RenderHttpRequestRequest';
44
46
  export * from './gen/RenderHttpRequestResponse';
47
+ export * from './gen/SendHttpRequestRequest';
45
48
  export * from './gen/SendHttpRequestResponse';
46
49
  export * from './gen/SendHttpRequestResponse';
47
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';
48
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,12 +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);
55
- __exportStar(require("./gen/SendHttpRequestRequest"), exports);
56
- __exportStar(require("./gen/ToastVariant"), exports);
57
- __exportStar(require("./gen/ShowToastRequest"), exports);
58
60
  __exportStar(require("./gen/RenderHttpRequestRequest"), exports);
59
61
  __exportStar(require("./gen/RenderHttpRequestResponse"), exports);
62
+ __exportStar(require("./gen/SendHttpRequestRequest"), exports);
60
63
  __exportStar(require("./gen/SendHttpRequestResponse"), exports);
61
64
  __exportStar(require("./gen/SendHttpRequestResponse"), exports);
62
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);
63
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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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 | null>;
6
+ };
@@ -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 });
@@ -5,7 +5,7 @@ import { RenderHttpRequestResponse } from '../gen/RenderHttpRequestResponse';
5
5
  import { SendHttpRequestRequest } from '../gen/SendHttpRequestRequest';
6
6
  import { SendHttpRequestResponse } from '../gen/SendHttpRequestResponse';
7
7
  import { ShowToastRequest } from '../gen/ShowToastRequest';
8
- export type YaakContext = {
8
+ export type Context = {
9
9
  clipboard: {
10
10
  copyText(text: string): void;
11
11
  };
@@ -1,14 +1,16 @@
1
- import { FilterPlugin } from './filter';
2
- import { HttpRequestActionPlugin } from './httpRequestAction';
3
- import { ImporterPlugin } from './import';
4
- import { ThemePlugin } from './theme';
5
- export { YaakContext } from './context';
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 YaakPlugin = {
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
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaakapp/api",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "main": "lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "files": [