@nice2dev/ui-api 1.0.10
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/README.md +94 -0
- package/dist/NiceAPIDesigner.d.ts +8 -0
- package/dist/NiceAPITester.d.ts +8 -0
- package/dist/NiceIntegrationBuilder.d.ts +8 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +1820 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +403 -0
- package/package.json +63 -0
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.nice-api-designer{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #fff);color:var(--nice-text, #1a1a1a)}.nice-api-designer__toolbar{display:flex;justify-content:space-between;align-items:center;padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #e0e0e0);background:var(--nice-bg-secondary, #f8f9fa)}.nice-api-designer__tabs{display:flex;gap:.25rem}.nice-api-designer__tab{padding:.5rem 1rem;border:none;background:transparent;cursor:pointer;font-size:.875rem;border-radius:4px;transition:background .2s}.nice-api-designer__tab:hover{background:var(--nice-hover, #e9ecef)}.nice-api-designer__tab--active{background:var(--nice-primary, #0066cc);color:#fff}.nice-api-designer__save-btn{padding:.5rem 1rem;background:var(--nice-primary, #0066cc);color:#fff;border:none;border-radius:4px;cursor:pointer;font-weight:500}.nice-api-designer__save-btn:hover{background:var(--nice-primary-dark, #0052a3)}.nice-api-designer__errors{padding:.5rem 1rem;background:#fff3cd;border-bottom:1px solid #ffc107}.nice-api-designer__error{padding:.25rem 0;font-size:.875rem}.nice-api-designer__error--error{color:#dc3545}.nice-api-designer__error--warning{color:#856404}.nice-api-designer__content{flex:1;overflow:auto;padding:1rem}.nice-api-designer__info-editor,.nice-api-designer__paths-editor,.nice-api-designer__schemas-editor,.nice-api-designer__security-editor,.nice-api-designer__json-preview{max-width:1200px;margin:0 auto}.nice-api-designer__field{margin-bottom:1rem}.nice-api-designer__field label{display:block;margin-bottom:.25rem;font-weight:500;font-size:.875rem}.nice-api-designer__field input,.nice-api-designer__field textarea,.nice-api-designer__field select{width:100%;padding:.5rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.875rem;font-family:inherit}.nice-api-designer__code{font-family:Fira Code,Cascadia Code,monospace;font-size:.8125rem;background:var(--nice-bg-code, #f5f5f5)}.nice-api-designer__paths-editor{display:grid;grid-template-columns:300px 1fr;gap:1rem}.nice-api-designer__endpoints-list,.nice-api-designer__schemas-list{border:1px solid var(--nice-border, #ddd);border-radius:4px;overflow:hidden}.nice-api-designer__list-header{display:flex;justify-content:space-between;align-items:center;padding:.5rem;background:var(--nice-bg-secondary, #f8f9fa);border-bottom:1px solid var(--nice-border, #ddd)}.nice-api-designer__list-header h3{margin:0;font-size:.875rem}.nice-api-designer__list-header button{padding:.25rem .5rem;font-size:.75rem;background:var(--nice-primary, #0066cc);color:#fff;border:none;border-radius:3px;cursor:pointer}.nice-api-designer__endpoint{display:flex;gap:.5rem;padding:.5rem;cursor:pointer;border-bottom:1px solid var(--nice-border, #eee)}.nice-api-designer__endpoint:hover{background:var(--nice-hover, #f0f0f0)}.nice-api-designer__endpoint--selected{background:var(--nice-selected, #e8f4ff)}.nice-api-designer__method{padding:.125rem .375rem;border-radius:3px;font-size:.75rem;font-weight:600;text-transform:uppercase}.nice-api-designer__method--get{background:#61affe;color:#fff}.nice-api-designer__method--post{background:#49cc90;color:#fff}.nice-api-designer__method--put{background:#fca130;color:#fff}.nice-api-designer__method--patch{background:#50e3c2;color:#fff}.nice-api-designer__method--delete{background:#f93e3e;color:#fff}.nice-api-tester{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #fff)}.nice-api-tester__toolbar{padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-api-tester__env-selector select{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.875rem}.nice-api-tester__request-bar{display:flex;gap:.5rem;padding:.75rem 1rem;border-bottom:1px solid var(--nice-border, #ddd)}.nice-api-tester__method{padding:.5rem 1rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-weight:600;cursor:pointer;min-width:100px}.nice-api-tester__method--get{border-color:#61affe;color:#61affe}.nice-api-tester__method--post{border-color:#49cc90;color:#49cc90}.nice-api-tester__method--put{border-color:#fca130;color:#fca130}.nice-api-tester__method--patch{border-color:#50e3c2;color:#50e3c2}.nice-api-tester__method--delete{border-color:#f93e3e;color:#f93e3e}.nice-api-tester__url-input{flex:1;padding:.5rem 1rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.9375rem}.nice-api-tester__send-btn{padding:.5rem 1.5rem;background:var(--nice-primary, #0066cc);color:#fff;border:none;border-radius:4px;font-weight:600;cursor:pointer}.nice-api-tester__send-btn:hover{background:var(--nice-primary-dark, #0052a3)}.nice-api-tester__send-btn--loading{background:#dc3545}.nice-api-tester__save-btn{padding:.5rem 1rem;background:var(--nice-bg-secondary, #f0f0f0);border:1px solid var(--nice-border, #ddd);border-radius:4px;cursor:pointer}.nice-api-tester__main{display:grid;grid-template-columns:1fr 1fr;flex:1;overflow:hidden}.nice-api-tester__request-panel,.nice-api-tester__response-panel{display:flex;flex-direction:column;overflow:hidden;border-right:1px solid var(--nice-border, #ddd)}.nice-api-tester__response-panel{border-right:none}.nice-api-tester__tabs{display:flex;gap:.25rem;padding:.5rem;border-bottom:1px solid var(--nice-border, #ddd)}.nice-api-tester__tab{padding:.375rem .75rem;border:none;background:transparent;cursor:pointer;font-size:.875rem;border-radius:4px}.nice-api-tester__tab:hover{background:var(--nice-hover, #e9ecef)}.nice-api-tester__tab--active{background:var(--nice-primary, #0066cc);color:#fff}.nice-api-tester__tab-content{flex:1;overflow:auto;padding:1rem}.nice-api-tester__kv-editor{display:flex;flex-direction:column;gap:.5rem}.nice-api-tester__kv-row{display:flex;gap:.5rem}.nice-api-tester__kv-row input{flex:1;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.875rem}.nice-api-tester__kv-row button{padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);background:transparent;border-radius:4px;cursor:pointer}.nice-api-tester__add-btn{padding:.375rem .75rem;background:var(--nice-bg-secondary, #f0f0f0);border:1px solid var(--nice-border, #ddd);border-radius:4px;cursor:pointer;align-self:flex-start}.nice-api-tester__body-editor{display:flex;flex-direction:column;gap:.75rem}.nice-api-tester__body-tabs{display:flex;gap:1rem}.nice-api-tester__body-tabs label{display:flex;align-items:center;gap:.25rem;cursor:pointer}.nice-api-tester__body-textarea{width:100%;padding:.75rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-family:Fira Code,monospace;font-size:.875rem;resize:vertical}.nice-api-tester__response-meta{display:flex;gap:1rem;padding:.75rem 1rem;background:var(--nice-bg-secondary, #f8f9fa);border-bottom:1px solid var(--nice-border, #ddd)}.nice-api-tester__status{font-weight:600}.nice-api-tester__status--2{color:#28a745}.nice-api-tester__status--3{color:#ffc107}.nice-api-tester__status--4,.nice-api-tester__status--5{color:#dc3545}.nice-api-tester__time,.nice-api-tester__size{color:var(--nice-text-muted, #6c757d);font-size:.875rem}.nice-api-tester__response-content{flex:1;overflow:auto;padding:1rem}.nice-api-tester__response-body{margin:0;font-family:Fira Code,monospace;font-size:.8125rem;white-space:pre-wrap;word-break:break-word}.nice-api-tester__response-headers{display:flex;flex-direction:column;gap:.25rem}.nice-api-tester__header-row{display:flex;gap:.5rem;font-size:.875rem}.nice-api-tester__header-key{font-weight:500;color:var(--nice-primary, #0066cc)}.nice-api-tester__test-results{display:flex;flex-direction:column;gap:.5rem}.nice-api-tester__test-result{display:flex;align-items:center;gap:.5rem;padding:.5rem;border-radius:4px;font-size:.875rem}.nice-api-tester__test-result--pass{background:#d4edda;color:#155724}.nice-api-tester__test-result--fail{background:#f8d7da;color:#721c24}.nice-api-tester__test-icon{font-weight:700}.nice-api-tester__test-badge{margin-left:.25rem;padding:.125rem .375rem;background:#0000001a;border-radius:8px;font-size:.75rem}.nice-api-tester__empty-response{display:flex;align-items:center;justify-content:center;height:100%;color:var(--nice-text-muted, #6c757d)}.nice-api-tester__history{border-top:1px solid var(--nice-border, #ddd);padding:.5rem 1rem;max-height:150px;overflow:auto}.nice-api-tester__history h4{margin:0 0 .5rem;font-size:.875rem}.nice-api-tester__history-list{display:flex;flex-direction:column;gap:.25rem}.nice-api-tester__history-item{display:flex;align-items:center;gap:.5rem;padding:.25rem .5rem;cursor:pointer;border-radius:4px;font-size:.8125rem}.nice-api-tester__history-item:hover{background:var(--nice-hover, #f0f0f0)}.nice-api-tester__history-url{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nice-integration-builder{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #fff)}.nice-integration-builder__toolbar{display:flex;align-items:center;gap:1rem;padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-integration-builder__name-input{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.9375rem;font-weight:500}.nice-integration-builder__tabs{display:flex;gap:.25rem;flex:1}.nice-integration-builder__tab{padding:.375rem .75rem;border:none;background:transparent;cursor:pointer;font-size:.875rem;border-radius:4px}.nice-integration-builder__tab:hover{background:var(--nice-hover, #e9ecef)}.nice-integration-builder__tab--active{background:var(--nice-primary, #0066cc);color:#fff}.nice-integration-builder__actions{display:flex;gap:.5rem}.nice-integration-builder__run-btn{padding:.5rem 1rem;background:#28a745;color:#fff;border:none;border-radius:4px;cursor:pointer;font-weight:500}.nice-integration-builder__run-btn:disabled{background:#6c757d;cursor:not-allowed}.nice-integration-builder__save-btn{padding:.5rem 1rem;background:var(--nice-primary, #0066cc);color:#fff;border:none;border-radius:4px;cursor:pointer}.nice-integration-builder__main{display:flex;flex:1;overflow:hidden}.nice-integration-builder__palette{width:200px;border-right:1px solid var(--nice-border, #ddd);padding:.5rem;overflow-y:auto;background:var(--nice-bg-secondary, #f8f9fa)}.nice-integration-builder__palette h4{margin:0 0 .5rem;font-size:.875rem}.nice-integration-builder__category{margin-bottom:1rem}.nice-integration-builder__category h5{margin:0 0 .25rem;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-integration-builder__palette-item{display:flex;align-items:center;gap:.5rem;padding:.5rem;border-radius:4px;cursor:grab;font-size:.875rem;transition:background .2s}.nice-integration-builder__palette-item:hover{background:var(--nice-hover, #e9ecef)}.nice-integration-builder__palette-icon{font-size:1rem}.nice-integration-builder__canvas{flex:1;position:relative;overflow:auto;background:linear-gradient(90deg,var(--nice-grid, #f0f0f0) 1px,transparent 1px),linear-gradient(var(--nice-grid, #f0f0f0) 1px,transparent 1px);background-size:20px 20px}.nice-integration-builder__canvas--dragging{cursor:copy}.nice-integration-builder__connections{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.nice-integration-builder__connection{fill:none;stroke:var(--nice-primary, #0066cc);stroke-width:2;pointer-events:stroke;cursor:pointer}.nice-integration-builder__connection:hover{stroke:#dc3545;stroke-width:3}.nice-integration-builder__node{position:absolute;width:150px;background:#fff;border:2px solid var(--nice-border, #ddd);border-radius:8px;box-shadow:0 2px 8px #0000001a;cursor:move}.nice-integration-builder__node--selected{border-color:var(--nice-primary, #0066cc);box-shadow:0 0 0 3px #06c3}.nice-integration-builder__node-header{display:flex;align-items:center;gap:.5rem;padding:.5rem;background:var(--nice-bg-secondary, #f8f9fa);border-bottom:1px solid var(--nice-border, #ddd);border-radius:6px 6px 0 0}.nice-integration-builder__node-icon{font-size:1rem}.nice-integration-builder__node-name{flex:1;font-size:.8125rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.nice-integration-builder__node-delete{padding:0;width:20px;height:20px;border:none;background:transparent;cursor:pointer;font-size:1rem;opacity:.5}.nice-integration-builder__node-delete:hover{opacity:1;color:#dc3545}.nice-integration-builder__port{display:flex;align-items:center;gap:.25rem;padding:.25rem .5rem;font-size:.75rem;color:var(--nice-text-muted, #6c757d)}.nice-integration-builder__port--input{justify-content:flex-start}.nice-integration-builder__port--output{justify-content:flex-end}.nice-integration-builder__port-dot{width:10px;height:10px;background:var(--nice-primary, #0066cc);border:2px solid white;border-radius:50%;cursor:crosshair}.nice-integration-builder__empty{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--nice-text-muted, #6c757d);font-size:1rem}.nice-integration-builder__properties{width:300px;border-left:1px solid var(--nice-border, #ddd);display:flex;flex-direction:column;background:#fff}.nice-integration-builder__properties-header{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-integration-builder__properties-header h4{margin:0;font-size:.9375rem}.nice-integration-builder__properties-header button{padding:0;width:24px;height:24px;border:none;background:transparent;cursor:pointer;font-size:1.25rem}.nice-integration-builder__properties-content{flex:1;overflow-y:auto;padding:1rem}.nice-integration-builder__field{margin-bottom:1rem}.nice-integration-builder__field label{display:block;margin-bottom:.25rem;font-size:.8125rem;font-weight:500}.nice-integration-builder__field input,.nice-integration-builder__field select,.nice-integration-builder__field textarea{width:100%;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.875rem;font-family:inherit}.nice-integration-builder__code-input{font-family:Fira Code,monospace;font-size:.8125rem}.nice-integration-builder__code-view,.nice-integration-builder__variables,.nice-integration-builder__settings{flex:1;padding:1rem;overflow:auto}.nice-integration-builder__code-view pre{margin:0;font-family:Fira Code,monospace;font-size:.8125rem;white-space:pre-wrap}.nice-integration-builder__variables-list{display:flex;flex-direction:column;gap:.5rem;margin-bottom:1rem}.nice-integration-builder__variable-row{display:flex;gap:.5rem}.nice-integration-builder__variable-row input{flex:1;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:4px}.nice-integration-builder__variable-row button{padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);background:transparent;border-radius:4px;cursor:pointer}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @package @nice2dev/ui-api
|
|
3
|
+
* API & Integration Platform Types
|
|
4
|
+
*/
|
|
5
|
+
export interface OpenAPISchema {
|
|
6
|
+
openapi: string;
|
|
7
|
+
info: OpenAPIInfo;
|
|
8
|
+
servers?: OpenAPIServer[];
|
|
9
|
+
paths: Record<string, OpenAPIPathItem>;
|
|
10
|
+
components?: OpenAPIComponents;
|
|
11
|
+
tags?: OpenAPITag[];
|
|
12
|
+
}
|
|
13
|
+
export interface OpenAPIInfo {
|
|
14
|
+
title: string;
|
|
15
|
+
version: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
termsOfService?: string;
|
|
18
|
+
contact?: {
|
|
19
|
+
name?: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
email?: string;
|
|
22
|
+
};
|
|
23
|
+
license?: {
|
|
24
|
+
name: string;
|
|
25
|
+
url?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface OpenAPIServer {
|
|
29
|
+
url: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
variables?: Record<string, {
|
|
32
|
+
default: string;
|
|
33
|
+
enum?: string[];
|
|
34
|
+
description?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
export interface OpenAPIPathItem {
|
|
38
|
+
get?: OpenAPIOperation;
|
|
39
|
+
post?: OpenAPIOperation;
|
|
40
|
+
put?: OpenAPIOperation;
|
|
41
|
+
patch?: OpenAPIOperation;
|
|
42
|
+
delete?: OpenAPIOperation;
|
|
43
|
+
options?: OpenAPIOperation;
|
|
44
|
+
head?: OpenAPIOperation;
|
|
45
|
+
trace?: OpenAPIOperation;
|
|
46
|
+
summary?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
parameters?: OpenAPIParameter[];
|
|
49
|
+
}
|
|
50
|
+
export interface OpenAPIOperation {
|
|
51
|
+
operationId?: string;
|
|
52
|
+
summary?: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
tags?: string[];
|
|
55
|
+
parameters?: OpenAPIParameter[];
|
|
56
|
+
requestBody?: OpenAPIRequestBody;
|
|
57
|
+
responses: Record<string, OpenAPIResponse>;
|
|
58
|
+
security?: Array<Record<string, string[]>>;
|
|
59
|
+
deprecated?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface OpenAPIParameter {
|
|
62
|
+
name: string;
|
|
63
|
+
in: 'query' | 'header' | 'path' | 'cookie';
|
|
64
|
+
description?: string;
|
|
65
|
+
required?: boolean;
|
|
66
|
+
schema?: SchemaObject;
|
|
67
|
+
example?: unknown;
|
|
68
|
+
}
|
|
69
|
+
export interface OpenAPIRequestBody {
|
|
70
|
+
description?: string;
|
|
71
|
+
required?: boolean;
|
|
72
|
+
content: Record<string, {
|
|
73
|
+
schema?: SchemaObject;
|
|
74
|
+
example?: unknown;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
export interface OpenAPIResponse {
|
|
78
|
+
description: string;
|
|
79
|
+
headers?: Record<string, {
|
|
80
|
+
schema?: SchemaObject;
|
|
81
|
+
description?: string;
|
|
82
|
+
}>;
|
|
83
|
+
content?: Record<string, {
|
|
84
|
+
schema?: SchemaObject;
|
|
85
|
+
example?: unknown;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
export interface OpenAPIComponents {
|
|
89
|
+
schemas?: Record<string, SchemaObject>;
|
|
90
|
+
responses?: Record<string, OpenAPIResponse>;
|
|
91
|
+
parameters?: Record<string, OpenAPIParameter>;
|
|
92
|
+
requestBodies?: Record<string, OpenAPIRequestBody>;
|
|
93
|
+
securitySchemes?: Record<string, SecurityScheme>;
|
|
94
|
+
}
|
|
95
|
+
export interface SchemaObject {
|
|
96
|
+
type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
97
|
+
format?: string;
|
|
98
|
+
title?: string;
|
|
99
|
+
description?: string;
|
|
100
|
+
default?: unknown;
|
|
101
|
+
enum?: unknown[];
|
|
102
|
+
properties?: Record<string, SchemaObject>;
|
|
103
|
+
items?: SchemaObject;
|
|
104
|
+
required?: string[];
|
|
105
|
+
$ref?: string;
|
|
106
|
+
nullable?: boolean;
|
|
107
|
+
readOnly?: boolean;
|
|
108
|
+
writeOnly?: boolean;
|
|
109
|
+
minimum?: number;
|
|
110
|
+
maximum?: number;
|
|
111
|
+
minLength?: number;
|
|
112
|
+
maxLength?: number;
|
|
113
|
+
pattern?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface SecurityScheme {
|
|
116
|
+
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
117
|
+
name?: string;
|
|
118
|
+
in?: 'query' | 'header' | 'cookie';
|
|
119
|
+
scheme?: string;
|
|
120
|
+
bearerFormat?: string;
|
|
121
|
+
flows?: Record<string, OAuth2Flow>;
|
|
122
|
+
openIdConnectUrl?: string;
|
|
123
|
+
description?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface OAuth2Flow {
|
|
126
|
+
authorizationUrl?: string;
|
|
127
|
+
tokenUrl?: string;
|
|
128
|
+
refreshUrl?: string;
|
|
129
|
+
scopes: Record<string, string>;
|
|
130
|
+
}
|
|
131
|
+
export interface OpenAPITag {
|
|
132
|
+
name: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
externalDocs?: {
|
|
135
|
+
url: string;
|
|
136
|
+
description?: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export interface APIDesignerState {
|
|
140
|
+
schema: OpenAPISchema;
|
|
141
|
+
selectedPath?: string;
|
|
142
|
+
selectedMethod?: string;
|
|
143
|
+
validationErrors: ValidationError[];
|
|
144
|
+
isDirty: boolean;
|
|
145
|
+
}
|
|
146
|
+
export interface ValidationError {
|
|
147
|
+
path: string;
|
|
148
|
+
message: string;
|
|
149
|
+
severity: 'error' | 'warning' | 'info';
|
|
150
|
+
}
|
|
151
|
+
export interface EndpointDefinition {
|
|
152
|
+
path: string;
|
|
153
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
154
|
+
operation: OpenAPIOperation;
|
|
155
|
+
}
|
|
156
|
+
export interface APIRequest {
|
|
157
|
+
id: string;
|
|
158
|
+
name: string;
|
|
159
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
160
|
+
url: string;
|
|
161
|
+
headers: Record<string, string>;
|
|
162
|
+
queryParams: Record<string, string>;
|
|
163
|
+
body?: RequestBody;
|
|
164
|
+
auth?: AuthConfig;
|
|
165
|
+
}
|
|
166
|
+
export interface RequestBody {
|
|
167
|
+
type: 'none' | 'json' | 'form-data' | 'x-www-form-urlencoded' | 'raw' | 'binary';
|
|
168
|
+
content?: string | FormData | Record<string, unknown>;
|
|
169
|
+
}
|
|
170
|
+
export interface AuthConfig {
|
|
171
|
+
type: 'none' | 'api-key' | 'bearer' | 'basic' | 'oauth2';
|
|
172
|
+
apiKey?: {
|
|
173
|
+
key: string;
|
|
174
|
+
value: string;
|
|
175
|
+
in: 'header' | 'query';
|
|
176
|
+
};
|
|
177
|
+
bearer?: {
|
|
178
|
+
token: string;
|
|
179
|
+
prefix?: string;
|
|
180
|
+
};
|
|
181
|
+
basic?: {
|
|
182
|
+
username: string;
|
|
183
|
+
password: string;
|
|
184
|
+
};
|
|
185
|
+
oauth2?: {
|
|
186
|
+
accessToken: string;
|
|
187
|
+
tokenType?: string;
|
|
188
|
+
refreshToken?: string;
|
|
189
|
+
expiresIn?: number;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
export interface APIResponse {
|
|
193
|
+
status: number;
|
|
194
|
+
statusText: string;
|
|
195
|
+
headers: Record<string, string>;
|
|
196
|
+
body: unknown;
|
|
197
|
+
time: number;
|
|
198
|
+
size: number;
|
|
199
|
+
timestamp: Date;
|
|
200
|
+
}
|
|
201
|
+
export interface APIEnvironment {
|
|
202
|
+
id: string;
|
|
203
|
+
name: string;
|
|
204
|
+
variables: Record<string, EnvironmentVariable>;
|
|
205
|
+
isActive: boolean;
|
|
206
|
+
}
|
|
207
|
+
export interface EnvironmentVariable {
|
|
208
|
+
value: string;
|
|
209
|
+
type: 'default' | 'secret';
|
|
210
|
+
description?: string;
|
|
211
|
+
}
|
|
212
|
+
export interface APICollection {
|
|
213
|
+
id: string;
|
|
214
|
+
name: string;
|
|
215
|
+
description?: string;
|
|
216
|
+
requests: APIRequest[];
|
|
217
|
+
folders?: APIFolder[];
|
|
218
|
+
variables?: Record<string, string>;
|
|
219
|
+
}
|
|
220
|
+
export interface APIFolder {
|
|
221
|
+
id: string;
|
|
222
|
+
name: string;
|
|
223
|
+
requests: APIRequest[];
|
|
224
|
+
folders?: APIFolder[];
|
|
225
|
+
}
|
|
226
|
+
export interface TestScript {
|
|
227
|
+
id: string;
|
|
228
|
+
name: string;
|
|
229
|
+
code: string;
|
|
230
|
+
type: 'pre-request' | 'test';
|
|
231
|
+
}
|
|
232
|
+
export interface TestResult {
|
|
233
|
+
name: string;
|
|
234
|
+
passed: boolean;
|
|
235
|
+
message?: string;
|
|
236
|
+
duration: number;
|
|
237
|
+
}
|
|
238
|
+
export interface CollectionRunResult {
|
|
239
|
+
collectionId: string;
|
|
240
|
+
results: RequestRunResult[];
|
|
241
|
+
totalRequests: number;
|
|
242
|
+
passedRequests: number;
|
|
243
|
+
failedRequests: number;
|
|
244
|
+
totalTime: number;
|
|
245
|
+
}
|
|
246
|
+
export interface RequestRunResult {
|
|
247
|
+
requestId: string;
|
|
248
|
+
requestName: string;
|
|
249
|
+
response?: APIResponse;
|
|
250
|
+
testResults: TestResult[];
|
|
251
|
+
error?: string;
|
|
252
|
+
}
|
|
253
|
+
export interface IntegrationFlow {
|
|
254
|
+
id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
description?: string;
|
|
257
|
+
nodes: FlowNode[];
|
|
258
|
+
connections: FlowConnection[];
|
|
259
|
+
variables: Record<string, unknown>;
|
|
260
|
+
triggers: FlowTrigger[];
|
|
261
|
+
errorHandling: ErrorHandlingConfig;
|
|
262
|
+
schedule?: ScheduleConfig;
|
|
263
|
+
}
|
|
264
|
+
export interface FlowNode {
|
|
265
|
+
id: string;
|
|
266
|
+
type: FlowNodeType;
|
|
267
|
+
name: string;
|
|
268
|
+
position: {
|
|
269
|
+
x: number;
|
|
270
|
+
y: number;
|
|
271
|
+
};
|
|
272
|
+
config: Record<string, unknown>;
|
|
273
|
+
inputs: string[];
|
|
274
|
+
outputs: string[];
|
|
275
|
+
}
|
|
276
|
+
export type FlowNodeType = 'trigger' | 'http-request' | 'transform' | 'filter' | 'switch' | 'loop' | 'delay' | 'set-variable' | 'database' | 'email' | 'webhook' | 'function' | 'error-handler';
|
|
277
|
+
export interface FlowConnection {
|
|
278
|
+
id: string;
|
|
279
|
+
sourceNodeId: string;
|
|
280
|
+
sourceOutput: string;
|
|
281
|
+
targetNodeId: string;
|
|
282
|
+
targetInput: string;
|
|
283
|
+
condition?: string;
|
|
284
|
+
}
|
|
285
|
+
export interface FlowTrigger {
|
|
286
|
+
id: string;
|
|
287
|
+
type: 'webhook' | 'schedule' | 'manual' | 'event';
|
|
288
|
+
config: Record<string, unknown>;
|
|
289
|
+
}
|
|
290
|
+
export interface ErrorHandlingConfig {
|
|
291
|
+
strategy: 'stop' | 'continue' | 'retry';
|
|
292
|
+
maxRetries?: number;
|
|
293
|
+
retryDelay?: number;
|
|
294
|
+
notifyOnError?: boolean;
|
|
295
|
+
fallbackNodeId?: string;
|
|
296
|
+
}
|
|
297
|
+
export interface ScheduleConfig {
|
|
298
|
+
enabled: boolean;
|
|
299
|
+
cron?: string;
|
|
300
|
+
interval?: number;
|
|
301
|
+
timezone?: string;
|
|
302
|
+
}
|
|
303
|
+
export interface Connector {
|
|
304
|
+
id: string;
|
|
305
|
+
name: string;
|
|
306
|
+
type: string;
|
|
307
|
+
icon?: string;
|
|
308
|
+
description?: string;
|
|
309
|
+
authType: 'none' | 'api-key' | 'oauth2' | 'basic';
|
|
310
|
+
baseUrl?: string;
|
|
311
|
+
operations: ConnectorOperation[];
|
|
312
|
+
}
|
|
313
|
+
export interface ConnectorOperation {
|
|
314
|
+
id: string;
|
|
315
|
+
name: string;
|
|
316
|
+
description?: string;
|
|
317
|
+
method: string;
|
|
318
|
+
path: string;
|
|
319
|
+
parameters: ConnectorParameter[];
|
|
320
|
+
requestBody?: SchemaObject;
|
|
321
|
+
responseSchema?: SchemaObject;
|
|
322
|
+
}
|
|
323
|
+
export interface ConnectorParameter {
|
|
324
|
+
name: string;
|
|
325
|
+
type: string;
|
|
326
|
+
required: boolean;
|
|
327
|
+
description?: string;
|
|
328
|
+
default?: unknown;
|
|
329
|
+
}
|
|
330
|
+
export interface TransformMapping {
|
|
331
|
+
id: string;
|
|
332
|
+
source: string;
|
|
333
|
+
target: string;
|
|
334
|
+
transformation?: string;
|
|
335
|
+
}
|
|
336
|
+
export interface MockServer {
|
|
337
|
+
id: string;
|
|
338
|
+
name: string;
|
|
339
|
+
port: number;
|
|
340
|
+
isRunning: boolean;
|
|
341
|
+
endpoints: MockEndpoint[];
|
|
342
|
+
}
|
|
343
|
+
export interface MockEndpoint {
|
|
344
|
+
id: string;
|
|
345
|
+
path: string;
|
|
346
|
+
method: string;
|
|
347
|
+
response: MockResponse;
|
|
348
|
+
delay?: number;
|
|
349
|
+
conditions?: MockCondition[];
|
|
350
|
+
}
|
|
351
|
+
export interface MockResponse {
|
|
352
|
+
status: number;
|
|
353
|
+
headers: Record<string, string>;
|
|
354
|
+
body: unknown;
|
|
355
|
+
bodyType: 'json' | 'xml' | 'text' | 'binary';
|
|
356
|
+
}
|
|
357
|
+
export interface MockCondition {
|
|
358
|
+
field: string;
|
|
359
|
+
operator: 'equals' | 'contains' | 'matches' | 'exists';
|
|
360
|
+
value: string;
|
|
361
|
+
response: MockResponse;
|
|
362
|
+
}
|
|
363
|
+
export interface NiceAPIDesignerProps {
|
|
364
|
+
schema?: OpenAPISchema;
|
|
365
|
+
onChange?: (schema: OpenAPISchema) => void;
|
|
366
|
+
onSave?: (schema: OpenAPISchema) => void;
|
|
367
|
+
readOnly?: boolean;
|
|
368
|
+
className?: string;
|
|
369
|
+
}
|
|
370
|
+
export interface NiceAPITesterProps {
|
|
371
|
+
collections?: APICollection[];
|
|
372
|
+
environments?: APIEnvironment[];
|
|
373
|
+
onRequest?: (request: APIRequest) => Promise<APIResponse>;
|
|
374
|
+
onSaveCollection?: (collection: APICollection) => void;
|
|
375
|
+
className?: string;
|
|
376
|
+
}
|
|
377
|
+
export interface NiceIntegrationBuilderProps {
|
|
378
|
+
flow?: IntegrationFlow;
|
|
379
|
+
connectors?: Connector[];
|
|
380
|
+
onChange?: (flow: IntegrationFlow) => void;
|
|
381
|
+
onSave?: (flow: IntegrationFlow) => void;
|
|
382
|
+
onRun?: (flow: IntegrationFlow) => Promise<void>;
|
|
383
|
+
className?: string;
|
|
384
|
+
}
|
|
385
|
+
export interface NiceOpenAPIViewerProps {
|
|
386
|
+
schema: OpenAPISchema;
|
|
387
|
+
onTryIt?: (operation: OpenAPIOperation, path: string, method: string) => void;
|
|
388
|
+
baseUrl?: string;
|
|
389
|
+
className?: string;
|
|
390
|
+
}
|
|
391
|
+
export interface NiceMockServerProps {
|
|
392
|
+
server?: MockServer;
|
|
393
|
+
onStart?: (server: MockServer) => void;
|
|
394
|
+
onStop?: (serverId: string) => void;
|
|
395
|
+
onEndpointChange?: (endpoints: MockEndpoint[]) => void;
|
|
396
|
+
className?: string;
|
|
397
|
+
}
|
|
398
|
+
export interface NiceSchemaEditorProps {
|
|
399
|
+
schema?: SchemaObject;
|
|
400
|
+
onChange?: (schema: SchemaObject) => void;
|
|
401
|
+
readOnly?: boolean;
|
|
402
|
+
className?: string;
|
|
403
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nice2dev/ui-api",
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "Nice2Dev API & Integration Platform — OpenAPI editor, API testing, integration builder",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.mjs",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./style.css": "./dist/style.css"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"CHANGELOG.md",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"*.css"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"dev": "vite",
|
|
28
|
+
"build": "tsc -p tsconfig.build.json && vite build",
|
|
29
|
+
"test": "vitest run --passWithNoTests",
|
|
30
|
+
"test:watch": "vitest",
|
|
31
|
+
"test:coverage": "vitest run --coverage",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"prepublishOnly": "npm run build"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": ">=17.0.0",
|
|
37
|
+
"react-dom": ">=17.0.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
41
|
+
"@testing-library/react": "^14.0.0",
|
|
42
|
+
"@types/react": "^18.2.0",
|
|
43
|
+
"@types/react-dom": "^18.2.0",
|
|
44
|
+
"@vitejs/plugin-react": "^4.2.0",
|
|
45
|
+
"react": "^18.2.0",
|
|
46
|
+
"react-dom": "^18.2.0",
|
|
47
|
+
"typescript": "^5.3.0",
|
|
48
|
+
"vite": "^5.0.0",
|
|
49
|
+
"vite-plugin-dts": "^3.7.0",
|
|
50
|
+
"vitest": "^4.1.0"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"nice2dev",
|
|
54
|
+
"api",
|
|
55
|
+
"openapi",
|
|
56
|
+
"swagger",
|
|
57
|
+
"api-testing",
|
|
58
|
+
"integration",
|
|
59
|
+
"react"
|
|
60
|
+
],
|
|
61
|
+
"author": "Nice2Dev Team",
|
|
62
|
+
"license": "SEE LICENSE IN LICENSE"
|
|
63
|
+
}
|