@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.
@@ -0,0 +1,2 @@
1
+ export type AtLeast<T, K extends keyof T> = Partial<T> & Pick<T, K>;
2
+ export type SingleOrArray<T> = T[] | T;
package/lib/helpers.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
- import { PathOrFileDescriptor } from 'node:fs';
3
1
  export type * from './models';
4
- export declare function sayHi(name: PathOrFileDescriptor): void;
2
+ export type * from './plugins';
3
+ export type * from './themes';
package/lib/index.js CHANGED
@@ -1,9 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sayHi = void 0;
4
- const node_fs_1 = require("node:fs");
5
- function sayHi(name) {
6
- console.log('Hello', name);
7
- (0, node_fs_1.readFileSync)('');
8
- }
9
- exports.sayHi = sayHi;
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { HttpRequest, HttpResponse } from '../models';
2
+ export type YaakContext = {
3
+ metadata: {
4
+ getVersion(): Promise<string>;
5
+ };
6
+ httpRequest: {
7
+ send(id: string): Promise<HttpResponse>;
8
+ getById(id: string): Promise<HttpRequest | null>;
9
+ };
10
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { Theme } from '../themes';
2
+ export type ThemePlugin = {
3
+ theme: Theme;
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
+ };
@@ -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.0.4",
3
+ "version": "0.0.5",
4
4
  "main": "lib/index.js",
5
5
  "typings": "./lib/index.d.ts",
6
6
  "files": [