@yaakapp/api 0.3.2 → 0.3.4

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,10 @@
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 } from "./models.js";
2
+ import type { Folder } from "./models.js";
3
+ import type { GrpcRequest } from "./models.js";
4
+ import type { HttpRequest } from "./models.js";
5
+ import type { HttpResponse } from "./models.js";
6
+ import type { JsonValue } from "./serde_json/JsonValue.js";
7
+ import type { Workspace } from "./models.js";
8
8
  export type BootRequest = {
9
9
  dir: string;
10
10
  watch: boolean;
@@ -12,7 +12,6 @@ export type BootRequest = {
12
12
  export type BootResponse = {
13
13
  name: string;
14
14
  version: string;
15
- capabilities: Array<string>;
16
15
  };
17
16
  export type CallHttpAuthenticationRequest = {
18
17
  config: {
@@ -56,6 +55,9 @@ export type CopyTextRequest = {
56
55
  };
57
56
  export type EditorLanguage = "text" | "javascript" | "json" | "html" | "xml" | "graphql" | "markdown";
58
57
  export type EmptyPayload = {};
58
+ export type ErrorResponse = {
59
+ error: string;
60
+ };
59
61
  export type ExportHttpRequestRequest = {
60
62
  httpRequest: HttpRequest;
61
63
  };
@@ -315,9 +317,10 @@ export type ImportResponse = {
315
317
  export type InternalEvent = {
316
318
  id: string;
317
319
  pluginRefId: string;
320
+ pluginName: string;
318
321
  replyId: string | null;
319
- payload: InternalEventPayload;
320
322
  windowContext: WindowContext;
323
+ payload: InternalEventPayload;
321
324
  };
322
325
  export type InternalEventPayload = {
323
326
  "type": "boot_request";
@@ -395,7 +398,9 @@ export type InternalEventPayload = {
395
398
  "type": "find_http_responses_response";
396
399
  } & FindHttpResponsesResponse | {
397
400
  "type": "empty_response";
398
- } & EmptyPayload;
401
+ } & EmptyPayload | {
402
+ "type": "error_response";
403
+ } & ErrorResponse;
399
404
  export type PromptTextRequest = {
400
405
  id: string;
401
406
  title: string;
@@ -1,5 +1,5 @@
1
- import { CallHttpAuthenticationRequest, CallHttpAuthenticationResponse, GetHttpAuthenticationResponse } from '..';
2
- import type { Context } from './Context';
1
+ import { CallHttpAuthenticationRequest, CallHttpAuthenticationResponse, GetHttpAuthenticationResponse } from '../bindings/events';
2
+ import { Context } from './Context';
3
3
  export type AuthenticationPlugin = Omit<GetHttpAuthenticationResponse, 'pluginName'> & {
4
4
  onApply(ctx: Context, args: CallHttpAuthenticationRequest): Promise<CallHttpAuthenticationResponse> | CallHttpAuthenticationResponse;
5
5
  };
@@ -1,23 +1,23 @@
1
- import type { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, PromptTextRequest, PromptTextResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest, TemplateRenderResponse } from '..';
2
- export type Context = {
1
+ import type { FindHttpResponsesRequest, FindHttpResponsesResponse, GetHttpRequestByIdRequest, GetHttpRequestByIdResponse, PromptTextRequest, PromptTextResponse, RenderHttpRequestRequest, RenderHttpRequestResponse, SendHttpRequestRequest, SendHttpRequestResponse, ShowToastRequest, TemplateRenderRequest, TemplateRenderResponse } from "../bindings/events.ts";
2
+ export interface Context {
3
3
  clipboard: {
4
- copyText(text: string): void;
4
+ copyText(text: string): Promise<void>;
5
5
  };
6
6
  toast: {
7
- show(args: ShowToastRequest): void;
7
+ show(args: ShowToastRequest): Promise<void>;
8
8
  };
9
9
  prompt: {
10
- text(args: PromptTextRequest): Promise<PromptTextResponse['value']>;
10
+ text(args: PromptTextRequest): Promise<PromptTextResponse["value"]>;
11
11
  };
12
12
  httpRequest: {
13
- send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
14
- getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
15
- render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse['httpRequest']>;
13
+ send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse["httpResponse"]>;
14
+ getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse["httpRequest"]>;
15
+ render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse["httpRequest"]>;
16
16
  };
17
17
  httpResponse: {
18
- find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse['httpResponses']>;
18
+ find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse["httpResponses"]>;
19
19
  };
20
20
  templates: {
21
- render(args: TemplateRenderRequest): Promise<TemplateRenderResponse['data']>;
21
+ render(args: TemplateRenderRequest): Promise<TemplateRenderResponse["data"]>;
22
22
  };
23
- };
23
+ }
@@ -1,13 +1,13 @@
1
1
  import type { Context } from './Context';
2
- export type FilterPluginResponse = string[];
2
+ export type FilterPluginResponse = {
3
+ filtered: string;
4
+ };
3
5
  export type FilterPlugin = {
4
6
  name: string;
5
7
  description?: string;
6
- canFilter(ctx: Context, args: {
7
- mimeType: string;
8
- }): Promise<boolean>;
9
8
  onFilter(ctx: Context, args: {
10
9
  payload: string;
10
+ filter: string;
11
11
  mimeType: string;
12
- }): Promise<FilterPluginResponse>;
12
+ }): Promise<FilterPluginResponse> | FilterPluginResponse;
13
13
  };
@@ -1,4 +1,4 @@
1
- import type { CallHttpRequestActionArgs, HttpRequestAction } from '..';
1
+ import type { CallHttpRequestActionArgs, HttpRequestAction } from '../bindings/events';
2
2
  import type { Context } from './Context';
3
3
  export type HttpRequestActionPlugin = HttpRequestAction & {
4
4
  onSelect(ctx: Context, args: CallHttpRequestActionArgs): Promise<void> | void;
@@ -1,12 +1,14 @@
1
- import type { Environment, Folder, GrpcRequest, HttpRequest, Workspace } from '..';
2
- import type { AtLeast } from '../helpers';
3
- import type { Context } from './Context';
4
- export type ImportPluginResponse = null | {
5
- workspaces: AtLeast<Workspace, 'name' | 'id' | 'model'>[];
6
- environments: AtLeast<Environment, 'name' | 'id' | 'model' | 'workspaceId'>[];
7
- folders: AtLeast<Folder, 'name' | 'id' | 'model' | 'workspaceId'>[];
8
- httpRequests: AtLeast<HttpRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
9
- grpcRequests: AtLeast<GrpcRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
1
+ import { Environment, Folder, GrpcRequest, HttpRequest, Workspace } from "../bindings/models";
2
+ import type { AtLeast } from "../helpers";
3
+ import type { Context } from "./Context";
4
+ type ImportPluginResponse = null | {
5
+ resources: {
6
+ workspaces: AtLeast<Workspace, "name" | "id" | "model">[];
7
+ environments: AtLeast<Environment, "name" | "id" | "model" | "workspaceId">[];
8
+ folders: AtLeast<Folder, "name" | "id" | "model" | "workspaceId">[];
9
+ httpRequests: AtLeast<HttpRequest, "name" | "id" | "model" | "workspaceId">[];
10
+ grpcRequests: AtLeast<GrpcRequest, "name" | "id" | "model" | "workspaceId">[];
11
+ };
10
12
  };
11
13
  export type ImporterPlugin = {
12
14
  name: string;
@@ -15,3 +17,4 @@ export type ImporterPlugin = {
15
17
  text: string;
16
18
  }): Promise<ImportPluginResponse>;
17
19
  };
20
+ export {};
@@ -1,5 +1,5 @@
1
- import type { CallTemplateFunctionArgs, TemplateFunction } from '..';
2
- import type { Context } from './Context';
1
+ import { CallTemplateFunctionArgs, TemplateFunction } from "../bindings/events";
2
+ import { Context } from "./Context";
3
3
  export type TemplateFunctionPlugin = TemplateFunction & {
4
4
  onRender(ctx: Context, args: CallTemplateFunctionArgs): Promise<string | null>;
5
5
  };
@@ -1,7 +1,7 @@
1
- import type { Theme } from '../themes';
2
- import type { Context } from './Context';
1
+ import { Index } from "../themes";
2
+ import { Context } from "./Context";
3
3
  export type ThemePlugin = {
4
4
  name: string;
5
5
  description?: string;
6
- getTheme(ctx: Context, fileContents: string): Promise<Theme>;
6
+ getTheme(ctx: Context, fileContents: string): Promise<Index>;
7
7
  };
@@ -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
+ };
@@ -19,7 +19,7 @@ export type Colors = {
19
19
  warning?: string;
20
20
  danger?: string;
21
21
  };
22
- export type Theme = Colors & {
22
+ export type Index = Colors & {
23
23
  id: string;
24
24
  name: string;
25
25
  components?: Partial<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaakapp/api",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "main": "lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "files": [