@mcp-consultant-tools/rest-api 32.0.0 → 33.0.0

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/build/cli.js CHANGED
File without changes
package/build/index.js CHANGED
File without changes
@@ -5,7 +5,7 @@
5
5
  * Endpoint definition for API discovery
6
6
  */
7
7
  export interface EndpointDefinition {
8
- /** Endpoint path (e.g., "/users", "/sic_exams") */
8
+ /** Endpoint path (e.g., "/users", "/new_exams") */
9
9
  path: string;
10
10
  /** Supported HTTP methods */
11
11
  methods: ("GET" | "POST" | "PUT" | "DELETE" | "PATCH")[];
@@ -56,7 +56,7 @@ export const HOST_OVERRIDE_EXAMPLES = [
56
56
  export const ENTITY_EXAMPLES = [
57
57
  { label: "User entity", value: "users" },
58
58
  { label: "Singular form", value: "contact" },
59
- { label: "Custom entity", value: "sic_exam" },
59
+ { label: "Custom entity", value: "new_exam" },
60
60
  ];
61
61
  // ========================================
62
62
  // Filter Examples (for list-endpoints)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-consultant-tools/rest-api",
3
- "version": "32.0.0",
3
+ "version": "33.0.0",
4
4
  "description": "MCP server for REST API testing with OAuth2 client credentials support - test HTTP endpoints with automatic JWT token generation",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -45,7 +45,7 @@
45
45
  "node": ">=18.0.0"
46
46
  },
47
47
  "dependencies": {
48
- "@mcp-consultant-tools/core": "32.0.0",
48
+ "@mcp-consultant-tools/core": "33.0.0",
49
49
  "@modelcontextprotocol/sdk": "^1.0.4",
50
50
  "commander": "^14.0.3",
51
51
  "zod": "^3.24.1"
@@ -1,226 +0,0 @@
1
- /**
2
- * REST API Service
3
- *
4
- * Provides HTTP request functionality with multiple authentication methods:
5
- * - Static Bearer Token
6
- * - Basic Authentication
7
- * - API Key (custom header)
8
- * - OAuth2 Client Credentials Flow (JWT generation)
9
- */
10
- /**
11
- * Endpoint definition for API discovery
12
- */
13
- export interface EndpointDefinition {
14
- /** Endpoint path (e.g., "/users", "/sic_exams") */
15
- path: string;
16
- /** Supported HTTP methods */
17
- methods: ("GET" | "POST" | "PUT" | "DELETE" | "PATCH")[];
18
- /** Entity name (singular) if applicable */
19
- entityName?: string;
20
- /** Human-readable description */
21
- description?: string;
22
- }
23
- /**
24
- * Field definition for entity schema
25
- */
26
- export interface FieldDefinition {
27
- /** Field name */
28
- name: string;
29
- /** Data type (e.g., "string", "Guid", "int", "datetime", "decimal") */
30
- type: string;
31
- /** Whether the field is required for creation */
32
- required: boolean;
33
- /** Whether the field can be null */
34
- nullable: boolean;
35
- /** Maximum length for string fields */
36
- maxLength?: number;
37
- /** Human-readable description */
38
- description?: string;
39
- /** Foreign key reference */
40
- foreignKey?: {
41
- entity: string;
42
- field: string;
43
- };
44
- /** Enum/option set values */
45
- enumValues?: string[];
46
- }
47
- /**
48
- * Entity schema definition
49
- */
50
- export interface EntitySchema {
51
- /** Entity name (singular) */
52
- entityName: string;
53
- /** Plural name for the endpoint */
54
- pluralName: string;
55
- /** Endpoint path */
56
- endpoint: string;
57
- /** Primary key field name */
58
- primaryKey: string;
59
- /** Field definitions */
60
- fields: FieldDefinition[];
61
- /** Example object for creating/updating */
62
- example?: Record<string, any>;
63
- }
64
- export interface RestApiConfig {
65
- /** Base URL for all requests (e.g., "https://api.example.com/v1") */
66
- baseUrl: string;
67
- /** Response size limit in bytes (default: 10000) */
68
- responseSizeLimit?: number;
69
- /** Enable SSL certificate verification (default: true) */
70
- enableSslVerify?: boolean;
71
- /** Static bearer token (mutually exclusive with oauth2) */
72
- bearerToken?: string;
73
- /** Basic auth credentials */
74
- basicAuth?: {
75
- username: string;
76
- password: string;
77
- };
78
- /** API key authentication */
79
- apiKey?: {
80
- headerName: string;
81
- value: string;
82
- };
83
- /** OAuth2 client credentials configuration */
84
- oauth2?: {
85
- /** Token endpoint URL (e.g., "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token") */
86
- tokenUrl: string;
87
- /** OAuth2 Client ID */
88
- clientId: string;
89
- /** OAuth2 Client Secret */
90
- clientSecret: string;
91
- /** OAuth2 Scope (e.g., "https://api.example.com/.default") */
92
- scope: string;
93
- /** Optional grant type (defaults to "client_credentials") */
94
- grantType?: string;
95
- /** Optional additional token request parameters */
96
- additionalParams?: Record<string, string>;
97
- };
98
- /** Custom headers to include in all requests */
99
- customHeaders?: Record<string, string>;
100
- /** Request timeout in milliseconds (default: 30000) */
101
- timeout?: number;
102
- /** URL to fetch OpenAPI/Swagger spec for dynamic discovery */
103
- openApiUrl?: string;
104
- }
105
- export interface RequestOptions {
106
- method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
107
- endpoint: string;
108
- body?: any;
109
- headers?: Record<string, string>;
110
- /** Override base URL for this request only */
111
- host?: string;
112
- }
113
- export interface RequestResult {
114
- request: {
115
- url: string;
116
- method: string;
117
- headers: Record<string, string>;
118
- body?: any;
119
- authMethod: string;
120
- };
121
- response: {
122
- statusCode: number;
123
- statusText: string;
124
- timing: string;
125
- headers: Record<string, any>;
126
- body: any;
127
- };
128
- validation: {
129
- isError: boolean;
130
- messages: string[];
131
- truncated?: {
132
- originalSize: number;
133
- returnedSize: number;
134
- truncationPoint: number;
135
- sizeLimit: number;
136
- };
137
- };
138
- }
139
- export declare class RestApiService {
140
- private config;
141
- private cachedToken;
142
- private httpsAgent;
143
- private cachedOpenApi;
144
- private openApiFetchPromise;
145
- /** OpenAPI cache TTL in milliseconds (default: 5 minutes) */
146
- private static readonly OPENAPI_CACHE_TTL;
147
- constructor(config: RestApiConfig);
148
- /**
149
- * Get the current authentication method name
150
- */
151
- getAuthMethod(): string;
152
- /**
153
- * Get OAuth2 access token using client credentials flow
154
- * Caches token and refreshes when expired
155
- */
156
- private getOAuth2Token;
157
- /**
158
- * Get the Authorization header value based on configured auth method
159
- */
160
- private getAuthHeader;
161
- /**
162
- * Sanitize headers for display (redact sensitive values)
163
- */
164
- private sanitizeHeaders;
165
- /**
166
- * Execute an HTTP request
167
- */
168
- request(options: RequestOptions): Promise<RequestResult>;
169
- /**
170
- * Force refresh the OAuth2 token (clears cache)
171
- */
172
- clearTokenCache(): void;
173
- /**
174
- * Get configuration summary (safe to display)
175
- */
176
- getConfigSummary(): {
177
- baseUrl: string;
178
- authMethod: string;
179
- sslVerification: boolean;
180
- responseSizeLimit: number;
181
- customHeaderCount: number;
182
- oauth2TokenUrl?: string;
183
- openApiUrl?: string;
184
- };
185
- /**
186
- * Check if OpenAPI URL is configured
187
- */
188
- hasOpenApiConfig(): boolean;
189
- /**
190
- * Fetch and parse OpenAPI spec from configured URL
191
- * Results are cached for OPENAPI_CACHE_TTL
192
- */
193
- private fetchOpenApiSpec;
194
- /**
195
- * Actually fetch and parse the OpenAPI spec
196
- */
197
- private doFetchOpenApiSpec;
198
- /**
199
- * Parse OpenAPI 3.x spec into our internal format
200
- */
201
- private parseOpenApiSpec;
202
- /**
203
- * Map OpenAPI type to simplified type string
204
- */
205
- private mapOpenApiType;
206
- /**
207
- * Clear OpenAPI cache (forces re-fetch on next call)
208
- */
209
- clearOpenApiCache(): void;
210
- /**
211
- * List all available API endpoints from OpenAPI spec
212
- * @param filter Optional filter to match endpoint paths (case-insensitive contains match)
213
- */
214
- listEndpointsAsync(filter?: string): Promise<{
215
- baseUrl: string;
216
- endpointCount: number;
217
- endpoints: EndpointDefinition[];
218
- source: string;
219
- }>;
220
- /**
221
- * Get schema for a specific entity from OpenAPI spec
222
- * @param entity Entity name (singular or plural)
223
- */
224
- getSchemaAsync(entity: string): Promise<EntitySchema | null>;
225
- }
226
- //# sourceMappingURL=RestApiService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RestApiService.d.ts","sourceRoot":"","sources":["../src/RestApiService.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,OAAO,EA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QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAYD;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;;OAGG;YACW,gBAAgB;IA6B9B;;OAEG;YACW,kBAAkB;IA4ChC;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAwIxB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoCtB;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAKzB;;;OAGG;IACG,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QACjD,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,kBAAkB,EAAE,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IA6BF;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CAqBnE"}
@@ -1,585 +0,0 @@
1
- /**
2
- * REST API Service
3
- *
4
- * Provides HTTP request functionality with multiple authentication methods:
5
- * - Static Bearer Token
6
- * - Basic Authentication
7
- * - API Key (custom header)
8
- * - OAuth2 Client Credentials Flow (JWT generation)
9
- */
10
- import https from "https";
11
- export class RestApiService {
12
- config;
13
- cachedToken = null;
14
- httpsAgent;
15
- cachedOpenApi = null;
16
- openApiFetchPromise = null;
17
- /** OpenAPI cache TTL in milliseconds (default: 5 minutes) */
18
- static OPENAPI_CACHE_TTL = 5 * 60 * 1000;
19
- constructor(config) {
20
- this.config = {
21
- responseSizeLimit: 10000,
22
- enableSslVerify: true,
23
- timeout: 30000,
24
- ...config,
25
- };
26
- // Normalize base URL (remove trailing slashes)
27
- this.config.baseUrl = this.config.baseUrl.replace(/\/+$/, "");
28
- // Create HTTPS agent if SSL verification is disabled
29
- if (!this.config.enableSslVerify) {
30
- this.httpsAgent = new https.Agent({ rejectUnauthorized: false });
31
- }
32
- // Validate mutually exclusive auth methods
33
- const authMethods = [
34
- this.config.bearerToken ? "bearer" : null,
35
- this.config.basicAuth ? "basic" : null,
36
- this.config.oauth2 ? "oauth2" : null,
37
- this.config.apiKey ? "apikey" : null,
38
- ].filter(Boolean);
39
- if (authMethods.length > 1) {
40
- console.error(`Warning: Multiple auth methods configured (${authMethods.join(", ")}). Only one should be used.`);
41
- }
42
- }
43
- /**
44
- * Get the current authentication method name
45
- */
46
- getAuthMethod() {
47
- if (this.config.oauth2)
48
- return "oauth2";
49
- if (this.config.bearerToken)
50
- return "bearer";
51
- if (this.config.basicAuth)
52
- return "basic";
53
- if (this.config.apiKey)
54
- return "apikey";
55
- return "none";
56
- }
57
- /**
58
- * Get OAuth2 access token using client credentials flow
59
- * Caches token and refreshes when expired
60
- */
61
- async getOAuth2Token() {
62
- const oauth2 = this.config.oauth2;
63
- if (!oauth2) {
64
- throw new Error("OAuth2 configuration not provided");
65
- }
66
- // Check if we have a valid cached token (with 5 minute buffer)
67
- const now = Date.now();
68
- if (this.cachedToken && this.cachedToken.expiresAt > now + 5 * 60 * 1000) {
69
- return this.cachedToken.accessToken;
70
- }
71
- console.error("Acquiring new OAuth2 token...");
72
- // Build token request body
73
- const params = new URLSearchParams();
74
- params.append("grant_type", oauth2.grantType || "client_credentials");
75
- params.append("client_id", oauth2.clientId);
76
- params.append("client_secret", oauth2.clientSecret);
77
- params.append("scope", oauth2.scope);
78
- // Add any additional parameters
79
- if (oauth2.additionalParams) {
80
- for (const [key, value] of Object.entries(oauth2.additionalParams)) {
81
- params.append(key, value);
82
- }
83
- }
84
- const response = await fetch(oauth2.tokenUrl, {
85
- method: "POST",
86
- headers: {
87
- "Content-Type": "application/x-www-form-urlencoded",
88
- },
89
- body: params.toString(),
90
- });
91
- if (!response.ok) {
92
- const errorText = await response.text();
93
- throw new Error(`OAuth2 token request failed: ${response.status} ${response.statusText} - ${errorText}`);
94
- }
95
- const tokenResponse = await response.json();
96
- if (!tokenResponse.access_token) {
97
- throw new Error("OAuth2 response missing access_token");
98
- }
99
- // Cache the token
100
- // Default to 1 hour expiry if not provided
101
- const expiresIn = tokenResponse.expires_in || 3600;
102
- this.cachedToken = {
103
- accessToken: tokenResponse.access_token,
104
- expiresAt: now + expiresIn * 1000,
105
- };
106
- console.error(`OAuth2 token acquired, expires in ${Math.round(expiresIn / 60)} minutes`);
107
- return this.cachedToken.accessToken;
108
- }
109
- /**
110
- * Get the Authorization header value based on configured auth method
111
- */
112
- async getAuthHeader() {
113
- if (this.config.oauth2) {
114
- const token = await this.getOAuth2Token();
115
- return { name: "Authorization", value: `Bearer ${token}` };
116
- }
117
- if (this.config.bearerToken) {
118
- return { name: "Authorization", value: `Bearer ${this.config.bearerToken}` };
119
- }
120
- if (this.config.basicAuth) {
121
- const { username, password } = this.config.basicAuth;
122
- const base64Credentials = Buffer.from(`${username}:${password}`).toString("base64");
123
- return { name: "Authorization", value: `Basic ${base64Credentials}` };
124
- }
125
- if (this.config.apiKey) {
126
- return { name: this.config.apiKey.headerName, value: this.config.apiKey.value };
127
- }
128
- return null;
129
- }
130
- /**
131
- * Sanitize headers for display (redact sensitive values)
132
- */
133
- sanitizeHeaders(headers, isFromRequest = false) {
134
- const sanitized = {};
135
- const safeHeaders = new Set([
136
- "accept",
137
- "accept-language",
138
- "content-type",
139
- "user-agent",
140
- "cache-control",
141
- "if-match",
142
- "if-none-match",
143
- "if-modified-since",
144
- "if-unmodified-since",
145
- ]);
146
- for (const [key, value] of Object.entries(headers)) {
147
- const lowerKey = key.toLowerCase();
148
- // Always include request-provided headers as-is
149
- if (isFromRequest) {
150
- sanitized[key] = value;
151
- continue;
152
- }
153
- // Redact auth headers
154
- if (lowerKey === "authorization") {
155
- sanitized[key] = "[REDACTED]";
156
- continue;
157
- }
158
- // Redact API key header
159
- if (this.config.apiKey &&
160
- lowerKey === this.config.apiKey.headerName.toLowerCase()) {
161
- sanitized[key] = "[REDACTED]";
162
- continue;
163
- }
164
- // Show safe headers, redact others
165
- if (safeHeaders.has(lowerKey)) {
166
- sanitized[key] = value;
167
- }
168
- else {
169
- sanitized[key] = "[REDACTED]";
170
- }
171
- }
172
- return sanitized;
173
- }
174
- /**
175
- * Execute an HTTP request
176
- */
177
- async request(options) {
178
- const { method, endpoint, body, headers: requestHeaders, host } = options;
179
- // Normalize endpoint (ensure leading slash, remove trailing)
180
- const normalizedEndpoint = `/${endpoint.replace(/^\/+|\/+$/g, "")}`;
181
- // Build full URL
182
- const baseUrl = host ? host.replace(/\/+$/, "") : this.config.baseUrl;
183
- const fullUrl = `${baseUrl}${normalizedEndpoint}`;
184
- // Build headers
185
- const headers = {
186
- ...this.config.customHeaders,
187
- ...requestHeaders,
188
- };
189
- // Add content-type for JSON body
190
- if (body && !headers["Content-Type"] && !headers["content-type"]) {
191
- headers["Content-Type"] = "application/json";
192
- }
193
- // Add auth header
194
- const authHeader = await this.getAuthHeader();
195
- if (authHeader) {
196
- headers[authHeader.name] = authHeader.value;
197
- }
198
- // Prepare fetch options
199
- const fetchOptions = {
200
- method,
201
- headers,
202
- };
203
- // Add body for methods that support it
204
- if (["POST", "PUT", "PATCH"].includes(method) && body) {
205
- fetchOptions.body =
206
- typeof body === "string" ? body : JSON.stringify(body);
207
- }
208
- // Add timeout via AbortController
209
- const controller = new AbortController();
210
- const timeoutId = setTimeout(() => controller.abort(), this.config.timeout || 30000);
211
- fetchOptions.signal = controller.signal;
212
- const startTime = Date.now();
213
- try {
214
- const response = await fetch(fullUrl, fetchOptions);
215
- clearTimeout(timeoutId);
216
- const endTime = Date.now();
217
- // Get response body
218
- const responseText = await response.text();
219
- let responseBody;
220
- try {
221
- responseBody = JSON.parse(responseText);
222
- }
223
- catch {
224
- responseBody = responseText;
225
- }
226
- // Get response headers
227
- const responseHeaders = {};
228
- response.headers.forEach((value, key) => {
229
- responseHeaders[key] = value;
230
- });
231
- // Check response size
232
- const bodySize = Buffer.from(responseText).length;
233
- const sizeLimit = this.config.responseSizeLimit || 10000;
234
- const validation = {
235
- isError: response.status >= 400,
236
- messages: response.status >= 400
237
- ? [`Request failed with status ${response.status}`]
238
- : ["Request completed successfully"],
239
- };
240
- if (bodySize > sizeLimit) {
241
- responseBody =
242
- typeof responseBody === "string"
243
- ? responseBody.slice(0, sizeLimit)
244
- : JSON.stringify(responseBody).slice(0, sizeLimit);
245
- validation.messages.push(`Response truncated: ${sizeLimit} of ${bodySize} bytes returned due to size limit`);
246
- validation.truncated = {
247
- originalSize: bodySize,
248
- returnedSize: sizeLimit,
249
- truncationPoint: sizeLimit,
250
- sizeLimit,
251
- };
252
- }
253
- return {
254
- request: {
255
- url: fullUrl,
256
- method,
257
- headers: {
258
- ...this.sanitizeHeaders(headers, false),
259
- ...this.sanitizeHeaders(requestHeaders || {}, true),
260
- },
261
- body,
262
- authMethod: this.getAuthMethod(),
263
- },
264
- response: {
265
- statusCode: response.status,
266
- statusText: response.statusText,
267
- timing: `${endTime - startTime}ms`,
268
- headers: this.sanitizeHeaders(responseHeaders, false),
269
- body: responseBody,
270
- },
271
- validation,
272
- };
273
- }
274
- catch (error) {
275
- clearTimeout(timeoutId);
276
- // Handle abort/timeout
277
- if (error instanceof Error && error.name === "AbortError") {
278
- throw new Error(`Request timeout after ${this.config.timeout}ms`);
279
- }
280
- throw error;
281
- }
282
- }
283
- /**
284
- * Force refresh the OAuth2 token (clears cache)
285
- */
286
- clearTokenCache() {
287
- this.cachedToken = null;
288
- console.error("OAuth2 token cache cleared");
289
- }
290
- /**
291
- * Get configuration summary (safe to display)
292
- */
293
- getConfigSummary() {
294
- return {
295
- baseUrl: this.config.baseUrl,
296
- authMethod: this.getAuthMethod(),
297
- sslVerification: this.config.enableSslVerify !== false,
298
- responseSizeLimit: this.config.responseSizeLimit || 10000,
299
- customHeaderCount: Object.keys(this.config.customHeaders || {}).length,
300
- ...(this.config.oauth2 && { oauth2TokenUrl: this.config.oauth2.tokenUrl }),
301
- ...(this.config.openApiUrl && { openApiUrl: this.config.openApiUrl }),
302
- };
303
- }
304
- /**
305
- * Check if OpenAPI URL is configured
306
- */
307
- hasOpenApiConfig() {
308
- return !!this.config.openApiUrl;
309
- }
310
- /**
311
- * Fetch and parse OpenAPI spec from configured URL
312
- * Results are cached for OPENAPI_CACHE_TTL
313
- */
314
- async fetchOpenApiSpec() {
315
- if (!this.config.openApiUrl) {
316
- throw new Error("OpenAPI URL not configured");
317
- }
318
- // Check cache validity
319
- const now = Date.now();
320
- if (this.cachedOpenApi &&
321
- now - this.cachedOpenApi.fetchedAt < RestApiService.OPENAPI_CACHE_TTL) {
322
- return this.cachedOpenApi;
323
- }
324
- // Avoid concurrent fetches - reuse in-flight promise
325
- if (this.openApiFetchPromise) {
326
- return this.openApiFetchPromise;
327
- }
328
- this.openApiFetchPromise = this.doFetchOpenApiSpec();
329
- try {
330
- const result = await this.openApiFetchPromise;
331
- return result;
332
- }
333
- finally {
334
- this.openApiFetchPromise = null;
335
- }
336
- }
337
- /**
338
- * Actually fetch and parse the OpenAPI spec
339
- */
340
- async doFetchOpenApiSpec() {
341
- const url = this.config.openApiUrl;
342
- console.error(`Fetching OpenAPI spec from ${url}...`);
343
- const fetchOptions = {};
344
- // Add timeout
345
- const controller = new AbortController();
346
- const timeoutId = setTimeout(() => controller.abort(), 30000);
347
- fetchOptions.signal = controller.signal;
348
- try {
349
- const response = await fetch(url, fetchOptions);
350
- clearTimeout(timeoutId);
351
- if (!response.ok) {
352
- throw new Error(`Failed to fetch OpenAPI spec: ${response.status} ${response.statusText}`);
353
- }
354
- const spec = (await response.json());
355
- const parsed = this.parseOpenApiSpec(spec);
356
- this.cachedOpenApi = {
357
- ...parsed,
358
- fetchedAt: Date.now(),
359
- source: `OpenAPI spec from ${url}`,
360
- };
361
- console.error(`OpenAPI spec loaded: ${parsed.endpoints.length} endpoints, ${Object.keys(parsed.schemas).length} schemas`);
362
- return this.cachedOpenApi;
363
- }
364
- catch (error) {
365
- clearTimeout(timeoutId);
366
- if (error instanceof Error && error.name === "AbortError") {
367
- throw new Error("OpenAPI fetch timeout after 30 seconds");
368
- }
369
- throw error;
370
- }
371
- }
372
- /**
373
- * Parse OpenAPI 3.x spec into our internal format
374
- */
375
- parseOpenApiSpec(spec) {
376
- const endpoints = [];
377
- const schemas = {};
378
- // Parse paths into endpoints
379
- if (spec.paths) {
380
- // Group methods by path
381
- const pathMethods = {};
382
- for (const [path, pathItem] of Object.entries(spec.paths)) {
383
- if (!pathItem)
384
- continue;
385
- const methods = [];
386
- if (pathItem.get)
387
- methods.push("GET");
388
- if (pathItem.post)
389
- methods.push("POST");
390
- if (pathItem.put)
391
- methods.push("PUT");
392
- if (pathItem.delete)
393
- methods.push("DELETE");
394
- if (pathItem.patch)
395
- methods.push("PATCH");
396
- if (methods.length > 0) {
397
- // For DAB-style paths, group /entity and /entity/{id} together
398
- const basePath = path.replace(/\/\{[^}]+\}$/, "");
399
- if (!pathMethods[basePath]) {
400
- pathMethods[basePath] = [];
401
- }
402
- for (const method of methods) {
403
- if (!pathMethods[basePath].includes(method)) {
404
- pathMethods[basePath].push(method);
405
- }
406
- }
407
- }
408
- }
409
- // Convert grouped paths to endpoints
410
- for (const [path, methods] of Object.entries(pathMethods)) {
411
- // Extract entity name from path (e.g., "/contacts" -> "contact")
412
- const pathSegments = path.split("/").filter(Boolean);
413
- const lastSegment = pathSegments[pathSegments.length - 1] || "";
414
- const entityName = lastSegment.endsWith("s")
415
- ? lastSegment.slice(0, -1)
416
- : lastSegment;
417
- // Get description from one of the operations
418
- let description;
419
- const fullPath = spec.paths[path];
420
- if (fullPath) {
421
- description =
422
- fullPath.get?.summary ||
423
- fullPath.post?.summary ||
424
- fullPath.get?.description ||
425
- fullPath.post?.description;
426
- }
427
- endpoints.push({
428
- path,
429
- methods: methods.sort(),
430
- entityName: entityName || undefined,
431
- description,
432
- });
433
- }
434
- }
435
- // Parse schemas
436
- if (spec.components?.schemas) {
437
- for (const [schemaName, schemaObj] of Object.entries(spec.components.schemas)) {
438
- if (!schemaObj || typeof schemaObj !== "object")
439
- continue;
440
- // Skip input/output wrapper schemas (DAB pattern)
441
- if (schemaName.endsWith("_input") || schemaName.endsWith("_output")) {
442
- continue;
443
- }
444
- const fields = [];
445
- let primaryKey = "id";
446
- if (schemaObj.properties) {
447
- const required = new Set(schemaObj.required || []);
448
- for (const [propName, propObj] of Object.entries(schemaObj.properties)) {
449
- if (!propObj || typeof propObj !== "object")
450
- continue;
451
- // Detect primary key (common patterns)
452
- if (propName === "id" ||
453
- propName.endsWith("id") ||
454
- propName.endsWith("Id")) {
455
- primaryKey = propName;
456
- }
457
- const field = {
458
- name: propName,
459
- type: this.mapOpenApiType(propObj),
460
- required: required.has(propName),
461
- nullable: propObj.nullable === true,
462
- };
463
- if (propObj.maxLength) {
464
- field.maxLength = propObj.maxLength;
465
- }
466
- if (propObj.description) {
467
- field.description = propObj.description;
468
- }
469
- if (propObj.enum) {
470
- field.enumValues = propObj.enum;
471
- }
472
- fields.push(field);
473
- }
474
- }
475
- // Derive plural name and endpoint from schema name
476
- const pluralName = schemaName.endsWith("s") ? schemaName : `${schemaName}s`;
477
- const endpoint = `/${pluralName.toLowerCase()}`;
478
- schemas[schemaName.toLowerCase()] = {
479
- entityName: schemaName,
480
- pluralName,
481
- endpoint,
482
- primaryKey,
483
- fields,
484
- };
485
- }
486
- }
487
- return { endpoints, schemas };
488
- }
489
- /**
490
- * Map OpenAPI type to simplified type string
491
- */
492
- mapOpenApiType(propObj) {
493
- if (propObj.$ref) {
494
- // Extract type name from $ref (e.g., "#/components/schemas/User" -> "User")
495
- const refParts = propObj.$ref.split("/");
496
- return refParts[refParts.length - 1];
497
- }
498
- const type = propObj.type || "any";
499
- const format = propObj.format;
500
- if (type === "string") {
501
- if (format === "uuid")
502
- return "Guid";
503
- if (format === "date-time")
504
- return "datetime";
505
- if (format === "date")
506
- return "date";
507
- return "string";
508
- }
509
- if (type === "integer") {
510
- if (format === "int64")
511
- return "long";
512
- return "int";
513
- }
514
- if (type === "number") {
515
- if (format === "decimal")
516
- return "decimal";
517
- if (format === "double")
518
- return "double";
519
- if (format === "float")
520
- return "float";
521
- return "number";
522
- }
523
- if (type === "boolean")
524
- return "boolean";
525
- if (type === "array")
526
- return "array";
527
- if (type === "object")
528
- return "object";
529
- return type;
530
- }
531
- /**
532
- * Clear OpenAPI cache (forces re-fetch on next call)
533
- */
534
- clearOpenApiCache() {
535
- this.cachedOpenApi = null;
536
- console.error("OpenAPI cache cleared");
537
- }
538
- /**
539
- * List all available API endpoints from OpenAPI spec
540
- * @param filter Optional filter to match endpoint paths (case-insensitive contains match)
541
- */
542
- async listEndpointsAsync(filter) {
543
- if (!this.config.openApiUrl) {
544
- return {
545
- baseUrl: this.config.baseUrl,
546
- endpointCount: 0,
547
- endpoints: [],
548
- source: "No OpenAPI URL configured. Set REST_OPENAPI_URL environment variable.",
549
- };
550
- }
551
- const openApiData = await this.fetchOpenApiSpec();
552
- const endpoints = filter
553
- ? openApiData.endpoints.filter((ep) => ep.path.toLowerCase().includes(filter.toLowerCase()) ||
554
- ep.entityName?.toLowerCase().includes(filter.toLowerCase()) ||
555
- ep.description?.toLowerCase().includes(filter.toLowerCase()))
556
- : openApiData.endpoints;
557
- return {
558
- baseUrl: this.config.baseUrl,
559
- endpointCount: endpoints.length,
560
- endpoints,
561
- source: openApiData.source,
562
- };
563
- }
564
- /**
565
- * Get schema for a specific entity from OpenAPI spec
566
- * @param entity Entity name (singular or plural)
567
- */
568
- async getSchemaAsync(entity) {
569
- if (!this.config.openApiUrl) {
570
- return null;
571
- }
572
- const openApiData = await this.fetchOpenApiSpec();
573
- const normalizedEntity = entity.toLowerCase();
574
- // Try direct match
575
- for (const [key, schema] of Object.entries(openApiData.schemas)) {
576
- if (key.toLowerCase() === normalizedEntity ||
577
- schema.entityName.toLowerCase() === normalizedEntity ||
578
- schema.pluralName.toLowerCase() === normalizedEntity) {
579
- return schema;
580
- }
581
- }
582
- return null;
583
- }
584
- }
585
- //# sourceMappingURL=R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