@yaakapp/api 0.0.4 → 0.0.5
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 +2 -0
- package/lib/helpers.js +2 -0
- package/lib/index.d.ts +2 -3
- package/lib/index.js +0 -7
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.js +17 -0
- package/lib/models/types.d.ts +117 -0
- package/lib/models/types.js +2 -0
- package/lib/plugins/context.d.ts +10 -0
- package/lib/plugins/context.js +2 -0
- package/lib/plugins/import.d.ts +14 -0
- package/lib/plugins/import.js +2 -0
- package/lib/plugins/index.d.ts +12 -0
- package/lib/plugins/index.js +2 -0
- package/lib/plugins/theme.d.ts +4 -0
- package/lib/plugins/theme.js +2 -0
- package/lib/themes/index.d.ts +39 -0
- package/lib/themes/index.js +2 -0
- package/package.json +1 -1
package/lib/helpers.d.ts
ADDED
package/lib/helpers.js
ADDED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./types"), exports);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export interface BaseModel {
|
|
2
|
+
readonly model: string;
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly createdAt: string;
|
|
5
|
+
readonly updatedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Workspace extends BaseModel {
|
|
8
|
+
readonly model: 'workspace';
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
variables: EnvironmentVariable[];
|
|
12
|
+
settingValidateCertificates: boolean;
|
|
13
|
+
settingFollowRedirects: boolean;
|
|
14
|
+
settingRequestTimeout: number;
|
|
15
|
+
}
|
|
16
|
+
export interface EnvironmentVariable {
|
|
17
|
+
name: string;
|
|
18
|
+
value: string;
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface Folder extends BaseModel {
|
|
22
|
+
readonly workspaceId: string;
|
|
23
|
+
readonly model: 'folder';
|
|
24
|
+
folderId: string | null;
|
|
25
|
+
sortPriority: number;
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
export interface Environment extends BaseModel {
|
|
29
|
+
readonly workspaceId: string;
|
|
30
|
+
readonly model: 'environment';
|
|
31
|
+
name: string;
|
|
32
|
+
variables: EnvironmentVariable[];
|
|
33
|
+
}
|
|
34
|
+
export interface HttpHeader {
|
|
35
|
+
name: string;
|
|
36
|
+
value: string;
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface HttpUrlParameter {
|
|
40
|
+
name: string;
|
|
41
|
+
value: string;
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface GrpcMetadataEntry {
|
|
45
|
+
name: string;
|
|
46
|
+
value: string;
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface GrpcRequest extends BaseModel {
|
|
50
|
+
readonly workspaceId: string;
|
|
51
|
+
readonly model: 'grpc_request';
|
|
52
|
+
folderId: string | null;
|
|
53
|
+
sortPriority: number;
|
|
54
|
+
name: string;
|
|
55
|
+
url: string;
|
|
56
|
+
service: string | null;
|
|
57
|
+
method: string | null;
|
|
58
|
+
message: string;
|
|
59
|
+
authentication: Record<string, string | number | boolean | null | undefined>;
|
|
60
|
+
authenticationType: string | null;
|
|
61
|
+
metadata: GrpcMetadataEntry[];
|
|
62
|
+
}
|
|
63
|
+
export interface GrpcEvent extends BaseModel {
|
|
64
|
+
readonly workspaceId: string;
|
|
65
|
+
readonly requestId: string;
|
|
66
|
+
readonly connectionId: string;
|
|
67
|
+
readonly model: 'grpc_event';
|
|
68
|
+
content: string;
|
|
69
|
+
status: number | null;
|
|
70
|
+
error: string | null;
|
|
71
|
+
eventType: 'info' | 'error' | 'client_message' | 'server_message' | 'connection_start' | 'connection_end';
|
|
72
|
+
metadata: Record<string, string>;
|
|
73
|
+
}
|
|
74
|
+
export interface GrpcConnection extends BaseModel {
|
|
75
|
+
readonly workspaceId: string;
|
|
76
|
+
readonly requestId: string;
|
|
77
|
+
readonly model: 'grpc_connection';
|
|
78
|
+
service: string;
|
|
79
|
+
method: string;
|
|
80
|
+
elapsed: number;
|
|
81
|
+
elapsedConnection: number;
|
|
82
|
+
status: number;
|
|
83
|
+
url: string;
|
|
84
|
+
error: string | null;
|
|
85
|
+
trailers: Record<string, string>;
|
|
86
|
+
}
|
|
87
|
+
export interface HttpRequest extends BaseModel {
|
|
88
|
+
readonly workspaceId: string;
|
|
89
|
+
readonly model: 'http_request';
|
|
90
|
+
folderId: string | null;
|
|
91
|
+
sortPriority: number;
|
|
92
|
+
name: string;
|
|
93
|
+
url: string;
|
|
94
|
+
urlParameters: HttpUrlParameter[];
|
|
95
|
+
body: Record<string, unknown>;
|
|
96
|
+
bodyType: string | null;
|
|
97
|
+
authentication: Record<string, string | number | boolean | null | undefined>;
|
|
98
|
+
authenticationType: string | null;
|
|
99
|
+
method: string;
|
|
100
|
+
headers: HttpHeader[];
|
|
101
|
+
}
|
|
102
|
+
export interface HttpResponse extends BaseModel {
|
|
103
|
+
readonly workspaceId: string;
|
|
104
|
+
readonly model: 'http_response';
|
|
105
|
+
readonly requestId: string;
|
|
106
|
+
readonly bodyPath: string | null;
|
|
107
|
+
readonly contentLength: number | null;
|
|
108
|
+
readonly error: string;
|
|
109
|
+
readonly status: number;
|
|
110
|
+
readonly elapsed: number;
|
|
111
|
+
readonly elapsedHeaders: number;
|
|
112
|
+
readonly statusReason: string;
|
|
113
|
+
readonly version: string;
|
|
114
|
+
readonly remoteAddr: string;
|
|
115
|
+
readonly url: string;
|
|
116
|
+
readonly headers: HttpHeader[];
|
|
117
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AtLeast } from '../helpers';
|
|
2
|
+
import { Environment, Folder, HttpRequest, Workspace } from '../models';
|
|
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
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SingleOrArray } from '../helpers';
|
|
2
|
+
import { ImporterPlugin } from './import';
|
|
3
|
+
import { ThemePlugin } from './theme';
|
|
4
|
+
/**
|
|
5
|
+
* The global structure of a Yaak plugin
|
|
6
|
+
*/
|
|
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
|
+
};
|
|
@@ -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
|
+
};
|