@yaakapp/api 0.0.5 → 0.0.6

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.
package/lib/helpers.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export type AtLeast<T, K extends keyof T> = Partial<T> & Pick<T, K>;
2
- export type SingleOrArray<T> = T[] | T;
2
+ export type OneOrMany<T> = T[] | T;
@@ -0,0 +1,13 @@
1
+ import { YaakContext } from './context';
2
+ export type FilterPluginResponse = string[];
3
+ export interface DataFilterPlugin {
4
+ name: string;
5
+ description?: string;
6
+ canFilter(ctx: YaakContext, args: {
7
+ mimeType: string;
8
+ }): Promise<boolean>;
9
+ onFilter(ctx: YaakContext, 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,9 @@
1
+ import { HttpRequest } from '../models';
2
+ import { YaakContext } from './context';
3
+ export interface HttpRequestActionPlugin {
4
+ key: string;
5
+ label: string;
6
+ onSelect(ctx: YaakContext, args: {
7
+ httpRequest: HttpRequest;
8
+ }): void;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +1,16 @@
1
1
  import { AtLeast } from '../helpers';
2
2
  import { Environment, Folder, HttpRequest, Workspace } from '../models';
3
3
  import { YaakContext } from './context';
4
- export type ImportPluginResponse = {
5
- resources: Partial<{
6
- workspaces: AtLeast<Workspace, 'name' | 'id' | 'model'>[];
7
- environments: AtLeast<Environment, 'name' | 'id' | 'model' | 'workspaceId'>[];
8
- httpRequests: AtLeast<HttpRequest, 'name' | 'id' | 'model' | 'workspaceId'>[];
9
- folders: AtLeast<Folder, 'name' | 'id' | 'model' | 'workspaceId'>[];
10
- }>;
11
- };
12
- export type ImporterPlugin = {
13
- onImport(ctx: YaakContext, fileContents: string): Promise<ImportPluginResponse>;
14
- };
4
+ export interface FileImportPluginResponse {
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 interface FileImportPlugin {
11
+ name: string;
12
+ description: string;
13
+ onImport: (ctx: YaakContext, args: {
14
+ text: string;
15
+ }) => Promise<null | FileImportPluginResponse>;
16
+ }
@@ -1,12 +1,14 @@
1
- import { SingleOrArray } from '../helpers';
2
- import { ImporterPlugin } from './import';
3
- import { ThemePlugin } from './theme';
1
+ export * from './filter';
2
+ export * from './httpRequestAction';
3
+ export * from './import';
4
+ import { DataFilterPlugin } from './filter';
5
+ import { HttpRequestActionPlugin } from './httpRequestAction';
6
+ import { FileImportPlugin } from './import';
4
7
  /**
5
8
  * The global structure of a Yaak plugin
6
9
  */
7
- export type YaakPlugin = {
8
- /** One or many plugins to import data into Yaak */
9
- importers: SingleOrArray<ImporterPlugin>;
10
- /** One or many themes to customize the Yaak UI */
11
- themes: SingleOrArray<ThemePlugin>;
12
- };
10
+ export interface YaakPlugin {
11
+ fileImport?: FileImportPlugin;
12
+ dataFilter?: DataFilterPlugin;
13
+ httpRequestAction?: HttpRequestActionPlugin;
14
+ }
@@ -1,2 +1,19 @@
1
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
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./filter"), exports);
18
+ __exportStar(require("./httpRequestAction"), exports);
19
+ __exportStar(require("./import"), exports);
@@ -1,4 +1,7 @@
1
1
  import { Theme } from '../themes';
2
- export type ThemePlugin = {
3
- theme: Theme;
4
- };
2
+ import { YaakContext } from './context';
3
+ export interface ThemePlugin {
4
+ name: string;
5
+ description?: string;
6
+ getTheme(ctx: YaakContext, fileContents: string): Promise<Theme>;
7
+ }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@yaakapp/api",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "main": "lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "files": [
7
7
  "lib"
8
8
  ],
9
9
  "scripts": {
10
- "prepublish": "tsc"
10
+ "build": "tsc",
11
+ "prepublish": "npm run build"
11
12
  },
12
13
  "dependencies": {
13
14
  "@types/node": "^22.0.0"