@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 +1 -1
- package/lib/plugins/filter.d.ts +13 -0
- package/lib/plugins/filter.js +2 -0
- package/lib/plugins/httpRequestAction.d.ts +9 -0
- package/lib/plugins/httpRequestAction.js +2 -0
- package/lib/plugins/import.d.ts +13 -11
- package/lib/plugins/index.d.ts +11 -9
- package/lib/plugins/index.js +17 -0
- package/lib/plugins/theme.d.ts +6 -3
- package/package.json +3 -2
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
|
|
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
|
+
}
|
package/lib/plugins/import.d.ts
CHANGED
|
@@ -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
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
onImport(ctx: YaakContext,
|
|
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
|
+
}
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
10
|
+
export interface YaakPlugin {
|
|
11
|
+
fileImport?: FileImportPlugin;
|
|
12
|
+
dataFilter?: DataFilterPlugin;
|
|
13
|
+
httpRequestAction?: HttpRequestActionPlugin;
|
|
14
|
+
}
|
package/lib/plugins/index.js
CHANGED
|
@@ -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);
|
package/lib/plugins/theme.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Theme } from '../themes';
|
|
2
|
-
|
|
3
|
-
|
|
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.
|
|
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
|
-
"
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"prepublish": "npm run build"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
13
14
|
"@types/node": "^22.0.0"
|