mcp4openapi 0.3.1 → 0.3.3
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 +7 -0
- package/dist/src/core/cli-config.d.ts.map +1 -1
- package/dist/src/core/cli-config.js +2 -0
- package/dist/src/core/cli-config.js.map +1 -1
- package/dist/src/core/index.d.ts.map +1 -1
- package/dist/src/core/index.js +18 -3
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/index.js +0 -0
- package/dist/src/profile/profile-allowlist.d.ts +18 -0
- package/dist/src/profile/profile-allowlist.d.ts.map +1 -0
- package/dist/src/profile/profile-allowlist.js +68 -0
- package/dist/src/profile/profile-allowlist.js.map +1 -0
- package/dist/src/profile/profile-registry.d.ts +5 -0
- package/dist/src/profile/profile-registry.d.ts.map +1 -1
- package/dist/src/profile/profile-registry.js +38 -14
- package/dist/src/profile/profile-registry.js.map +1 -1
- package/package.json +2 -2
- package/profiles/gitlab/developer-profile-oauth.json +243 -41
- package/profiles/gitlab/developer-profile-oauth.test.json +1009 -5
- package/profiles/gitlab/openapi.yaml +1419 -164
- package/profiles/gitlab/profile-optimized-oauth.json +785 -0
- package/profiles/gitlab/profile-optimized-oauth.test.json +1566 -0
- package/profiles/grafana/openapi.json +28078 -0
- package/profiles/grafana/profile.json +1083 -0
- package/profiles/grafana/profile.test.json +235 -0
- package/profiles/mattermost/openapi.yaml +27434 -0
- package/profiles/mattermost/profile.json +463 -0
- package/profiles/mattermost/profile.test.json +607 -0
- package/profiles/n8n/profile-optimized.json +1002 -364
- package/profiles/n8n/profile-optimized.test.json +43 -43
- package/dist/src/argument-normalizer.d.ts +0 -5
- package/dist/src/argument-normalizer.d.ts.map +0 -1
- package/dist/src/argument-normalizer.js +0 -61
- package/dist/src/argument-normalizer.js.map +0 -1
- package/dist/src/cli-config.d.ts +0 -9
- package/dist/src/cli-config.d.ts.map +0 -1
- package/dist/src/cli-config.js +0 -111
- package/dist/src/cli-config.js.map +0 -1
- package/dist/src/composite-executor.d.ts +0 -77
- package/dist/src/composite-executor.d.ts.map +0 -1
- package/dist/src/composite-executor.js +0 -193
- package/dist/src/composite-executor.js.map +0 -1
- package/dist/src/constants.d.ts +0 -85
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -85
- package/dist/src/constants.js.map +0 -1
- package/dist/src/dag-executor.d.ts +0 -49
- package/dist/src/dag-executor.d.ts.map +0 -1
- package/dist/src/dag-executor.js +0 -138
- package/dist/src/dag-executor.js.map +0 -1
- package/dist/src/errors.d.ts +0 -59
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js +0 -119
- package/dist/src/errors.js.map +0 -1
- package/dist/src/filtering.d.ts +0 -19
- package/dist/src/filtering.d.ts.map +0 -1
- package/dist/src/filtering.js +0 -292
- package/dist/src/filtering.js.map +0 -1
- package/dist/src/http-client-factory.d.ts +0 -62
- package/dist/src/http-client-factory.d.ts.map +0 -1
- package/dist/src/http-client-factory.js +0 -133
- package/dist/src/http-client-factory.js.map +0 -1
- package/dist/src/http-transport-config.d.ts +0 -6
- package/dist/src/http-transport-config.d.ts.map +0 -1
- package/dist/src/http-transport-config.js +0 -47
- package/dist/src/http-transport-config.js.map +0 -1
- package/dist/src/http-transport.d.ts +0 -316
- package/dist/src/http-transport.d.ts.map +0 -1
- package/dist/src/http-transport.js +0 -2412
- package/dist/src/http-transport.js.map +0 -1
- package/dist/src/interceptors.d.ts +0 -116
- package/dist/src/interceptors.d.ts.map +0 -1
- package/dist/src/interceptors.js +0 -392
- package/dist/src/interceptors.js.map +0 -1
- package/dist/src/jsonrpc-validator.d.ts +0 -27
- package/dist/src/jsonrpc-validator.d.ts.map +0 -1
- package/dist/src/jsonrpc-validator.js +0 -58
- package/dist/src/jsonrpc-validator.js.map +0 -1
- package/dist/src/logger.d.ts +0 -59
- package/dist/src/logger.d.ts.map +0 -1
- package/dist/src/logger.js +0 -177
- package/dist/src/logger.js.map +0 -1
- package/dist/src/mcp-server-manager.d.ts +0 -20
- package/dist/src/mcp-server-manager.d.ts.map +0 -1
- package/dist/src/mcp-server-manager.js +0 -38
- package/dist/src/mcp-server-manager.js.map +0 -1
- package/dist/src/mcp-server.d.ts +0 -203
- package/dist/src/mcp-server.d.ts.map +0 -1
- package/dist/src/mcp-server.js +0 -1369
- package/dist/src/mcp-server.js.map +0 -1
- package/dist/src/metrics.d.ts +0 -97
- package/dist/src/metrics.d.ts.map +0 -1
- package/dist/src/metrics.js +0 -273
- package/dist/src/metrics.js.map +0 -1
- package/dist/src/naming-warnings.d.ts +0 -23
- package/dist/src/naming-warnings.d.ts.map +0 -1
- package/dist/src/naming-warnings.js +0 -83
- package/dist/src/naming-warnings.js.map +0 -1
- package/dist/src/naming.d.ts +0 -58
- package/dist/src/naming.d.ts.map +0 -1
- package/dist/src/naming.js +0 -510
- package/dist/src/naming.js.map +0 -1
- package/dist/src/oauth-provider.d.ts +0 -131
- package/dist/src/oauth-provider.d.ts.map +0 -1
- package/dist/src/oauth-provider.js +0 -836
- package/dist/src/oauth-provider.js.map +0 -1
- package/dist/src/openapi-parser.d.ts +0 -70
- package/dist/src/openapi-parser.d.ts.map +0 -1
- package/dist/src/openapi-parser.js +0 -436
- package/dist/src/openapi-parser.js.map +0 -1
- package/dist/src/profile-loader.d.ts +0 -78
- package/dist/src/profile-loader.d.ts.map +0 -1
- package/dist/src/profile-loader.js +0 -483
- package/dist/src/profile-loader.js.map +0 -1
- package/dist/src/profile-registry.d.ts +0 -18
- package/dist/src/profile-registry.d.ts.map +0 -1
- package/dist/src/profile-registry.js +0 -26
- package/dist/src/profile-registry.js.map +0 -1
- package/dist/src/profile-resolver.d.ts +0 -19
- package/dist/src/profile-resolver.d.ts.map +0 -1
- package/dist/src/profile-resolver.js +0 -167
- package/dist/src/profile-resolver.js.map +0 -1
- package/dist/src/proxy-executor.d.ts +0 -86
- package/dist/src/proxy-executor.d.ts.map +0 -1
- package/dist/src/proxy-executor.js +0 -497
- package/dist/src/proxy-executor.js.map +0 -1
- package/dist/src/schema-validator.d.ts +0 -30
- package/dist/src/schema-validator.d.ts.map +0 -1
- package/dist/src/schema-validator.js +0 -128
- package/dist/src/schema-validator.js.map +0 -1
- package/dist/src/startup-profile.d.ts +0 -17
- package/dist/src/startup-profile.d.ts.map +0 -1
- package/dist/src/startup-profile.js +0 -30
- package/dist/src/startup-profile.js.map +0 -1
- package/dist/src/startup-validation.d.ts +0 -11
- package/dist/src/startup-validation.d.ts.map +0 -1
- package/dist/src/startup-validation.js +0 -21
- package/dist/src/startup-validation.js.map +0 -1
- package/dist/src/tool-filter.d.ts +0 -65
- package/dist/src/tool-filter.d.ts.map +0 -1
- package/dist/src/tool-filter.js +0 -471
- package/dist/src/tool-filter.js.map +0 -1
- package/dist/src/tool-generator.d.ts +0 -67
- package/dist/src/tool-generator.d.ts.map +0 -1
- package/dist/src/tool-generator.js +0 -182
- package/dist/src/tool-generator.js.map +0 -1
- package/dist/src/validation-utils.d.ts +0 -49
- package/dist/src/validation-utils.d.ts.map +0 -1
- package/dist/src/validation-utils.js +0 -138
- package/dist/src/validation-utils.js.map +0 -1
- package/profiles/gitlab/developer-profile.json +0 -1508
- package/profiles/gitlab/developer-profile.test.json +0 -3432
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Profile configuration loader and validator
|
|
3
|
-
*
|
|
4
|
-
* Why validation: Profile config comes from user files. Invalid config would
|
|
5
|
-
* cause runtime errors. Validate upfront with clear error messages.
|
|
6
|
-
*
|
|
7
|
-
* ✅ Schemas are now auto-generated from TypeScript types!
|
|
8
|
-
* When adding fields to src/types/profile.ts:
|
|
9
|
-
* 1. Update TypeScript interface (compile-time checking)
|
|
10
|
-
* 2. Run `npm run generate-schemas` (auto-generates JSON + Zod schemas)
|
|
11
|
-
* 3. That's it! No manual sync needed.
|
|
12
|
-
*
|
|
13
|
-
* See IMPLEMENTATION.md for details.
|
|
14
|
-
*/
|
|
15
|
-
import type { Profile } from './types/profile.js';
|
|
16
|
-
import type { OpenAPIParser } from './openapi-parser.js';
|
|
17
|
-
export declare class ProfileLoader {
|
|
18
|
-
load(profilePath: string): Promise<Profile>;
|
|
19
|
-
/**
|
|
20
|
-
* Validate semantic rules beyond schema
|
|
21
|
-
*
|
|
22
|
-
* Why separate: Some rules can't be expressed in JSON Schema (e.g.,
|
|
23
|
-
* "if composite=true then steps must exist"). Fail fast with clear messages.
|
|
24
|
-
*/
|
|
25
|
-
private validateLogic;
|
|
26
|
-
/**
|
|
27
|
-
* Generate helpful suggestions for invalid operation keys
|
|
28
|
-
*/
|
|
29
|
-
private generateOperationKeySuggestions;
|
|
30
|
-
/**
|
|
31
|
-
* Validate composite steps form a DAG (no circular dependencies)
|
|
32
|
-
*
|
|
33
|
-
* Why: Circular dependencies would cause infinite loops or deadlocks.
|
|
34
|
-
* We use DFS with color-coding to detect cycles.
|
|
35
|
-
*/
|
|
36
|
-
private validateCompositeStepsDAG;
|
|
37
|
-
/**
|
|
38
|
-
* Create a default profile with auto-generated tools from OpenAPI spec
|
|
39
|
-
*
|
|
40
|
-
* Why: Allows running server without profile for quick exploration.
|
|
41
|
-
* Generates simple pass-through tools for all operations.
|
|
42
|
-
*
|
|
43
|
-
* Auth Strategy:
|
|
44
|
-
* 1. Parse security scheme from OpenAPI spec
|
|
45
|
-
* 2. If found, generate auth interceptor
|
|
46
|
-
* 3. Fallback to bearer token from MCP4_API_TOKEN env var
|
|
47
|
-
*/
|
|
48
|
-
static createDefaultProfile(profileName: string, parser: OpenAPIParser): Profile;
|
|
49
|
-
/**
|
|
50
|
-
* Generate auth interceptor from OpenAPI security scheme
|
|
51
|
-
*
|
|
52
|
-
* Strategy:
|
|
53
|
-
* 1. Parse security scheme from OpenAPI spec
|
|
54
|
-
* 2. If not found, check for force auth override via env vars
|
|
55
|
-
* 3. Map to profile auth interceptor format
|
|
56
|
-
* 4. Use env var name from AUTH_ENV_VAR or default to MCP4_API_TOKEN
|
|
57
|
-
*
|
|
58
|
-
* Returns empty object if no security scheme found (public API) and no force override
|
|
59
|
-
*/
|
|
60
|
-
private static generateAuthInterceptor;
|
|
61
|
-
/**
|
|
62
|
-
* Generate a simple tool from an OpenAPI operation
|
|
63
|
-
*
|
|
64
|
-
* Creates a tool with parameters based on the operation's path/query/header parameters
|
|
65
|
-
* and request body. Uses operationId as tool name and summary/description for tool description.
|
|
66
|
-
*/
|
|
67
|
-
private static generateToolFromOperation;
|
|
68
|
-
/**
|
|
69
|
-
* Map OpenAPI schema to parameter type
|
|
70
|
-
*/
|
|
71
|
-
private static mapOpenAPISchemaToParameterType;
|
|
72
|
-
/**
|
|
73
|
-
* Recursively flatten schema properties to parameters
|
|
74
|
-
*/
|
|
75
|
-
private static flattenSchemaToParameters;
|
|
76
|
-
private static normalizeToolNames;
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=profile-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile-loader.d.ts","sourceRoot":"","sources":["../../src/profile-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,oBAAoB,CAAC;AAIjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA2BzD,qBAAa,aAAa;IAClB,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAajD;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IAqJrB;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAsCvC;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IAsEjC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO;IAiDhF;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAqHtC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IA8DxC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,+BAA+B;IAmB9C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAiBxC,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAKlC"}
|
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Profile configuration loader and validator
|
|
3
|
-
*
|
|
4
|
-
* Why validation: Profile config comes from user files. Invalid config would
|
|
5
|
-
* cause runtime errors. Validate upfront with clear error messages.
|
|
6
|
-
*
|
|
7
|
-
* ✅ Schemas are now auto-generated from TypeScript types!
|
|
8
|
-
* When adding fields to src/types/profile.ts:
|
|
9
|
-
* 1. Update TypeScript interface (compile-time checking)
|
|
10
|
-
* 2. Run `npm run generate-schemas` (auto-generates JSON + Zod schemas)
|
|
11
|
-
* 3. That's it! No manual sync needed.
|
|
12
|
-
*
|
|
13
|
-
* See IMPLEMENTATION.md for details.
|
|
14
|
-
*/
|
|
15
|
-
import fs from 'fs/promises';
|
|
16
|
-
import { ValidationError, ConfigurationError } from './errors.js';
|
|
17
|
-
import { profileSchema, authInterceptorSchema } from './generated-schemas.js';
|
|
18
|
-
import { shortenToolName, NamingStrategy, levenshteinDistance } from './naming.js';
|
|
19
|
-
import { normalizeToolName } from './tool-filter/utils.js';
|
|
20
|
-
// Schemas are now auto-generated from TypeScript types!
|
|
21
|
-
// See scripts/generate-schemas.js for details.
|
|
22
|
-
// Custom validations that can't be auto-generated
|
|
23
|
-
const enhancedAuthInterceptorSchema = authInterceptorSchema.refine((data) => {
|
|
24
|
-
if (data.type === 'query' && !data.query_param) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
if (data.type === 'custom-header' && !data.header_name) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}, {
|
|
32
|
-
message: 'query type requires query_param, custom-header requires header_name',
|
|
33
|
-
});
|
|
34
|
-
// Use the basic profile schema - auth validation moved to validateLogic
|
|
35
|
-
const enhancedProfileSchema = profileSchema;
|
|
36
|
-
export class ProfileLoader {
|
|
37
|
-
async load(profilePath) {
|
|
38
|
-
const content = await fs.readFile(profilePath, 'utf-8');
|
|
39
|
-
const json = JSON.parse(content);
|
|
40
|
-
// Validate with Zod - throws detailed error if invalid
|
|
41
|
-
const profile = enhancedProfileSchema.parse(json);
|
|
42
|
-
ProfileLoader.normalizeToolNames(profile);
|
|
43
|
-
this.validateLogic(profile);
|
|
44
|
-
return profile;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Validate semantic rules beyond schema
|
|
48
|
-
*
|
|
49
|
-
* Why separate: Some rules can't be expressed in JSON Schema (e.g.,
|
|
50
|
-
* "if composite=true then steps must exist"). Fail fast with clear messages.
|
|
51
|
-
*/
|
|
52
|
-
validateLogic(profile) {
|
|
53
|
-
// Validate auth interceptors
|
|
54
|
-
const auth = profile.interceptors?.auth;
|
|
55
|
-
if (auth) {
|
|
56
|
-
const validateAuthEntry = (entry, index) => {
|
|
57
|
-
const result = enhancedAuthInterceptorSchema.safeParse(entry);
|
|
58
|
-
if (!result.success) {
|
|
59
|
-
const path = index !== undefined ? `interceptors.auth[${index}]` : 'interceptors.auth';
|
|
60
|
-
throw new ValidationError(`Invalid auth interceptor at ${path}: ${result.error.issues.map(i => i.message).join(', ')}`, { path, issues: result.error.issues });
|
|
61
|
-
}
|
|
62
|
-
// Additional OAuth validation: must have issuer OR both endpoints
|
|
63
|
-
const authEntry = entry;
|
|
64
|
-
if (authEntry.type === 'oauth' && authEntry.oauth_config) {
|
|
65
|
-
const config = authEntry.oauth_config;
|
|
66
|
-
const hasIssuer = !!config.issuer;
|
|
67
|
-
const hasEndpoints = !!config.authorization_endpoint && !!config.token_endpoint;
|
|
68
|
-
if (!hasIssuer && !hasEndpoints) {
|
|
69
|
-
const path = index !== undefined ? `interceptors.auth[${index}].oauth_config` : 'interceptors.auth.oauth_config';
|
|
70
|
-
throw new ValidationError(`OAuth config at ${path} must provide either 'issuer' OR both 'authorization_endpoint' and 'token_endpoint'`, { path, hasIssuer, hasEndpoints });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
if (Array.isArray(auth)) {
|
|
75
|
-
auth.forEach((entry, index) => validateAuthEntry(entry, index));
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
validateAuthEntry(auth);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
for (const tool of profile.tools) {
|
|
82
|
-
// Composite tools must have steps
|
|
83
|
-
if (tool.composite && (!tool.steps || tool.steps.length === 0)) {
|
|
84
|
-
throw new ValidationError(`Tool '${tool.name}' is marked as composite but has no steps`, { toolName: tool.name, composite: tool.composite });
|
|
85
|
-
}
|
|
86
|
-
// Non-composite tools must have operations
|
|
87
|
-
if (!tool.composite && !tool.operations) {
|
|
88
|
-
throw new ValidationError(`Tool '${tool.name}' must have either 'operations' or be marked as 'composite' with 'steps'`, { toolName: tool.name, composite: tool.composite });
|
|
89
|
-
}
|
|
90
|
-
// Validate required_for references existing enum values
|
|
91
|
-
for (const [paramName, paramDef] of Object.entries(tool.parameters)) {
|
|
92
|
-
const paramTypes = Array.isArray(paramDef.type) ? paramDef.type : [paramDef.type];
|
|
93
|
-
const hasType = (type) => paramTypes.includes(type);
|
|
94
|
-
// Validate array parameters have items
|
|
95
|
-
if (hasType('array') && !paramDef.items) {
|
|
96
|
-
throw new ValidationError(`Parameter '${paramName}' in tool '${tool.name}' is type 'array' but missing required 'items' property`, { toolName: tool.name, paramName, paramType: paramDef.type });
|
|
97
|
-
}
|
|
98
|
-
// Validate object parameters have properties
|
|
99
|
-
if (hasType('object') && paramDef.properties === undefined) {
|
|
100
|
-
throw new ValidationError(`Parameter '${paramName}' in tool '${tool.name}' is type 'object' but missing 'properties'. Use empty object {} for free-form objects.`, { toolName: tool.name, paramName, paramType: paramDef.type });
|
|
101
|
-
}
|
|
102
|
-
if (paramDef.required_for) {
|
|
103
|
-
const actionParam = tool.parameters['action'];
|
|
104
|
-
if (!actionParam?.enum) {
|
|
105
|
-
throw new ValidationError(`Parameter '${paramName}' in tool '${tool.name}' has 'required_for' but 'action' parameter has no enum`, { toolName: tool.name, paramName, hasActionParam: !!actionParam });
|
|
106
|
-
}
|
|
107
|
-
for (const action of paramDef.required_for) {
|
|
108
|
-
if (!actionParam.enum.includes(action)) {
|
|
109
|
-
throw new ValidationError(`Parameter '${paramName}' requires action '${action}' but it's not in action enum: ${actionParam.enum.join(', ')}`, { toolName: tool.name, paramName, requiredAction: action, availableActions: actionParam.enum });
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
// Validate operation keys match action enum or follow {action}_{resourceType} pattern
|
|
115
|
-
if (tool.operations && tool.parameters['action']?.enum) {
|
|
116
|
-
const actionEnum = tool.parameters['action'].enum;
|
|
117
|
-
const resourceTypeParam = tool.parameters['resource_type'];
|
|
118
|
-
const resourceTypeEnum = resourceTypeParam?.enum;
|
|
119
|
-
for (const operationKey of Object.keys(tool.operations)) {
|
|
120
|
-
// Check if operation key is directly in action enum
|
|
121
|
-
if (actionEnum.includes(operationKey)) {
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
// Check if operation key follows {action}_{resourceType} pattern
|
|
125
|
-
const parts = operationKey.split('_');
|
|
126
|
-
if (parts.length === 2) {
|
|
127
|
-
const [actionPart, resourceTypePart] = parts;
|
|
128
|
-
// Both parts must be valid
|
|
129
|
-
const actionValid = actionEnum.includes(actionPart);
|
|
130
|
-
const resourceTypeValid = resourceTypeEnum ? resourceTypeEnum.includes(resourceTypePart) : true;
|
|
131
|
-
if (actionValid && resourceTypeValid) {
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// Generate helpful error message with suggestions
|
|
136
|
-
const suggestions = this.generateOperationKeySuggestions(operationKey, actionEnum, resourceTypeEnum);
|
|
137
|
-
const suggestionText = suggestions.length > 0
|
|
138
|
-
? ` Did you mean one of: ${suggestions.join(', ')}?`
|
|
139
|
-
: '';
|
|
140
|
-
throw new ValidationError(`Invalid operation key '${operationKey}' in tool '${tool.name}'. ` +
|
|
141
|
-
`Must be an action from enum [${actionEnum.join(', ')}] or follow pattern {action}_{resourceType}.${suggestionText}`, {
|
|
142
|
-
toolName: tool.name,
|
|
143
|
-
operationKey,
|
|
144
|
-
availableActions: actionEnum,
|
|
145
|
-
availableResourceTypes: resourceTypeEnum,
|
|
146
|
-
suggestions
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
// Validate composite steps DAG (no circular dependencies)
|
|
151
|
-
if (tool.composite && tool.steps) {
|
|
152
|
-
this.validateCompositeStepsDAG(tool.name, tool.steps);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Generate helpful suggestions for invalid operation keys
|
|
158
|
-
*/
|
|
159
|
-
generateOperationKeySuggestions(invalidKey, actionEnum, resourceTypeEnum) {
|
|
160
|
-
const suggestions = [];
|
|
161
|
-
// Direct action matches (case-insensitive)
|
|
162
|
-
for (const action of actionEnum) {
|
|
163
|
-
if (action.toLowerCase() === invalidKey.toLowerCase()) {
|
|
164
|
-
suggestions.push(action);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
// Levenshtein distance suggestions for actions
|
|
168
|
-
const maxDistance = Math.min(2, invalidKey.length - 1);
|
|
169
|
-
for (const action of actionEnum) {
|
|
170
|
-
if (levenshteinDistance(invalidKey, action) <= maxDistance) {
|
|
171
|
-
suggestions.push(action);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
// Check for {action}_{resourceType} patterns
|
|
175
|
-
if (resourceTypeEnum) {
|
|
176
|
-
for (const action of actionEnum) {
|
|
177
|
-
for (const resourceType of resourceTypeEnum) {
|
|
178
|
-
const compositeKey = `${action}_${resourceType}`;
|
|
179
|
-
if (levenshteinDistance(invalidKey, compositeKey) <= maxDistance) {
|
|
180
|
-
suggestions.push(compositeKey);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
// Remove duplicates and return unique suggestions
|
|
186
|
-
return [...new Set(suggestions)];
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Validate composite steps form a DAG (no circular dependencies)
|
|
190
|
-
*
|
|
191
|
-
* Why: Circular dependencies would cause infinite loops or deadlocks.
|
|
192
|
-
* We use DFS with color-coding to detect cycles.
|
|
193
|
-
*/
|
|
194
|
-
validateCompositeStepsDAG(toolName, steps) {
|
|
195
|
-
// Build adjacency list: store_as -> list of steps that depend on it
|
|
196
|
-
const graph = new Map();
|
|
197
|
-
const allStoreAs = new Set();
|
|
198
|
-
// Initialize all nodes
|
|
199
|
-
for (const step of steps) {
|
|
200
|
-
allStoreAs.add(step.store_as);
|
|
201
|
-
if (!graph.has(step.store_as)) {
|
|
202
|
-
graph.set(step.store_as, []);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
// Build dependency edges
|
|
206
|
-
for (const step of steps) {
|
|
207
|
-
if (step.depends_on) {
|
|
208
|
-
for (const dep of step.depends_on) {
|
|
209
|
-
// Validate dependency exists
|
|
210
|
-
if (!allStoreAs.has(dep)) {
|
|
211
|
-
throw new ValidationError(`Composite step '${step.store_as}' in tool '${toolName}' depends on '${dep}' but no step produces '${dep}'`, { toolName, stepStoreAs: step.store_as, dependency: dep, availableStoreAs: Array.from(allStoreAs) });
|
|
212
|
-
}
|
|
213
|
-
// Add edge: dep -> step.store_as (dep must complete before step)
|
|
214
|
-
if (!graph.has(dep)) {
|
|
215
|
-
graph.set(dep, []);
|
|
216
|
-
}
|
|
217
|
-
graph.get(dep).push(step.store_as);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
// DFS cycle detection with color-coding
|
|
222
|
-
const visited = new Set(); // Fully processed nodes
|
|
223
|
-
const visiting = new Set(); // Currently being processed (in recursion stack)
|
|
224
|
-
const dfs = (node) => {
|
|
225
|
-
if (visiting.has(node)) {
|
|
226
|
-
throw new ValidationError(`Circular dependency detected in composite steps of tool '${toolName}': ${node} depends on itself`, { toolName, circularNode: node, visitingNodes: Array.from(visiting) });
|
|
227
|
-
}
|
|
228
|
-
if (visited.has(node)) {
|
|
229
|
-
return; // Already fully processed
|
|
230
|
-
}
|
|
231
|
-
visiting.add(node);
|
|
232
|
-
// Visit all neighbors
|
|
233
|
-
const neighbors = graph.get(node) || [];
|
|
234
|
-
for (const neighbor of neighbors) {
|
|
235
|
-
dfs(neighbor);
|
|
236
|
-
}
|
|
237
|
-
visiting.delete(node);
|
|
238
|
-
visited.add(node);
|
|
239
|
-
};
|
|
240
|
-
// Check all nodes for cycles
|
|
241
|
-
for (const node of allStoreAs) {
|
|
242
|
-
if (!visited.has(node)) {
|
|
243
|
-
dfs(node);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Create a default profile with auto-generated tools from OpenAPI spec
|
|
249
|
-
*
|
|
250
|
-
* Why: Allows running server without profile for quick exploration.
|
|
251
|
-
* Generates simple pass-through tools for all operations.
|
|
252
|
-
*
|
|
253
|
-
* Auth Strategy:
|
|
254
|
-
* 1. Parse security scheme from OpenAPI spec
|
|
255
|
-
* 2. If found, generate auth interceptor
|
|
256
|
-
* 3. Fallback to bearer token from MCP4_API_TOKEN env var
|
|
257
|
-
*/
|
|
258
|
-
static createDefaultProfile(profileName, parser) {
|
|
259
|
-
const operations = parser.getAllOperations();
|
|
260
|
-
// Get configuration for name shortening
|
|
261
|
-
const maxLength = parseInt(process.env.MCP4_TOOLNAME_MAX || '45', 10);
|
|
262
|
-
const strategyStr = (process.env.MCP4_TOOLNAME_STRATEGY || 'none').toLowerCase();
|
|
263
|
-
const warnOnly = (process.env.MCP4_TOOLNAME_WARN_ONLY || 'true').toLowerCase() === 'true';
|
|
264
|
-
const minParts = parseInt(process.env.MCP4_TOOLNAME_MIN_PARTS || '3', 10);
|
|
265
|
-
const minLength = parseInt(process.env.MCP4_TOOLNAME_MIN_LENGTH || '20', 10);
|
|
266
|
-
const strategy = Object.values(NamingStrategy).includes(strategyStr)
|
|
267
|
-
? strategyStr
|
|
268
|
-
: NamingStrategy.None;
|
|
269
|
-
const shouldShorten = strategy !== NamingStrategy.None && !warnOnly;
|
|
270
|
-
// Convert to OperationForNaming for shortening
|
|
271
|
-
const opsForNaming = operations.map(op => ({
|
|
272
|
-
operationId: op.operationId,
|
|
273
|
-
method: op.method,
|
|
274
|
-
path: op.path,
|
|
275
|
-
tags: op.tags,
|
|
276
|
-
}));
|
|
277
|
-
const tools = operations.map(op => this.generateToolFromOperation(op, shouldShorten ? strategy : NamingStrategy.None, maxLength, opsForNaming, { minParts, minLength }));
|
|
278
|
-
// Generate auth interceptor from OpenAPI security scheme
|
|
279
|
-
const interceptors = this.generateAuthInterceptor(parser);
|
|
280
|
-
const profile = {
|
|
281
|
-
profile_name: profileName,
|
|
282
|
-
description: `Auto-generated default profile with ${tools.length} tools from OpenAPI spec`,
|
|
283
|
-
tools,
|
|
284
|
-
interceptors,
|
|
285
|
-
};
|
|
286
|
-
this.normalizeToolNames(profile);
|
|
287
|
-
return profile;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Generate auth interceptor from OpenAPI security scheme
|
|
291
|
-
*
|
|
292
|
-
* Strategy:
|
|
293
|
-
* 1. Parse security scheme from OpenAPI spec
|
|
294
|
-
* 2. If not found, check for force auth override via env vars
|
|
295
|
-
* 3. Map to profile auth interceptor format
|
|
296
|
-
* 4. Use env var name from AUTH_ENV_VAR or default to MCP4_API_TOKEN
|
|
297
|
-
*
|
|
298
|
-
* Returns empty object if no security scheme found (public API) and no force override
|
|
299
|
-
*/
|
|
300
|
-
static generateAuthInterceptor(parser) {
|
|
301
|
-
const securityScheme = parser.getSecurityScheme();
|
|
302
|
-
// Check for force auth override (for APIs with incomplete OpenAPI spec)
|
|
303
|
-
const forceAuth = process.env.MCP4_AUTH_FORCE === 'true';
|
|
304
|
-
if (!securityScheme && !forceAuth) {
|
|
305
|
-
return {}; // Public API, no auth required
|
|
306
|
-
}
|
|
307
|
-
// Get env var name from environment or use default
|
|
308
|
-
const envVarName = process.env.MCP4_AUTH_ENV_VAR || 'MCP4_API_TOKEN';
|
|
309
|
-
const interceptors = {};
|
|
310
|
-
// If force auth is enabled, use env config instead of OpenAPI spec
|
|
311
|
-
if (forceAuth && !securityScheme) {
|
|
312
|
-
const authType = (process.env.MCP4_AUTH_TYPE || 'bearer').toLowerCase();
|
|
313
|
-
switch (authType) {
|
|
314
|
-
case 'bearer':
|
|
315
|
-
interceptors.auth = {
|
|
316
|
-
type: 'bearer',
|
|
317
|
-
value_from_env: envVarName,
|
|
318
|
-
};
|
|
319
|
-
break;
|
|
320
|
-
case 'query':
|
|
321
|
-
const queryParam = process.env.MCP4_AUTH_QUERY_PARAM;
|
|
322
|
-
if (!queryParam) {
|
|
323
|
-
throw new ConfigurationError('MCP4_AUTH_QUERY_PARAM is required when MCP4_AUTH_TYPE=query', { authType });
|
|
324
|
-
}
|
|
325
|
-
interceptors.auth = {
|
|
326
|
-
type: 'query',
|
|
327
|
-
query_param: queryParam,
|
|
328
|
-
value_from_env: envVarName,
|
|
329
|
-
};
|
|
330
|
-
break;
|
|
331
|
-
case 'custom-header':
|
|
332
|
-
const headerName = process.env.MCP4_AUTH_HEADER_NAME;
|
|
333
|
-
if (!headerName) {
|
|
334
|
-
throw new ConfigurationError('MCP4_AUTH_HEADER_NAME is required when MCP4_AUTH_TYPE=custom-header', { authType });
|
|
335
|
-
}
|
|
336
|
-
interceptors.auth = {
|
|
337
|
-
type: 'custom-header',
|
|
338
|
-
header_name: headerName,
|
|
339
|
-
value_from_env: envVarName,
|
|
340
|
-
};
|
|
341
|
-
break;
|
|
342
|
-
default:
|
|
343
|
-
throw new ConfigurationError(`Invalid MCP4_AUTH_TYPE: ${authType}. Must be one of: bearer, query, custom-header`, { authType });
|
|
344
|
-
}
|
|
345
|
-
return interceptors;
|
|
346
|
-
}
|
|
347
|
-
// Use OpenAPI security scheme
|
|
348
|
-
if (!securityScheme) {
|
|
349
|
-
return {}; // Shouldn't happen, but TypeScript needs this
|
|
350
|
-
}
|
|
351
|
-
switch (securityScheme.type) {
|
|
352
|
-
case 'bearer':
|
|
353
|
-
// Bearer token in Authorization header
|
|
354
|
-
interceptors.auth = {
|
|
355
|
-
type: 'bearer',
|
|
356
|
-
value_from_env: envVarName,
|
|
357
|
-
};
|
|
358
|
-
break;
|
|
359
|
-
case 'apiKey':
|
|
360
|
-
// API key in header or query
|
|
361
|
-
if (securityScheme.in === 'query' && securityScheme.name) {
|
|
362
|
-
interceptors.auth = {
|
|
363
|
-
type: 'query',
|
|
364
|
-
query_param: securityScheme.name,
|
|
365
|
-
value_from_env: envVarName,
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
else if (securityScheme.in === 'header' && securityScheme.name) {
|
|
369
|
-
// Check if it's a standard Authorization header
|
|
370
|
-
if (securityScheme.name.toLowerCase() === 'authorization') {
|
|
371
|
-
interceptors.auth = {
|
|
372
|
-
type: 'bearer',
|
|
373
|
-
value_from_env: envVarName,
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
interceptors.auth = {
|
|
378
|
-
type: 'custom-header',
|
|
379
|
-
header_name: securityScheme.name,
|
|
380
|
-
value_from_env: envVarName,
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
break;
|
|
385
|
-
default:
|
|
386
|
-
// Unknown security type, default to bearer
|
|
387
|
-
interceptors.auth = {
|
|
388
|
-
type: 'bearer',
|
|
389
|
-
value_from_env: envVarName,
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
return interceptors;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Generate a simple tool from an OpenAPI operation
|
|
396
|
-
*
|
|
397
|
-
* Creates a tool with parameters based on the operation's path/query/header parameters
|
|
398
|
-
* and request body. Uses operationId as tool name and summary/description for tool description.
|
|
399
|
-
*/
|
|
400
|
-
static generateToolFromOperation(operation, strategy = NamingStrategy.None, maxLength = 45, allOperations = [], options) {
|
|
401
|
-
const parameters = {};
|
|
402
|
-
// Add path parameters
|
|
403
|
-
for (const param of operation.parameters) {
|
|
404
|
-
parameters[param.name] = {
|
|
405
|
-
type: this.mapOpenAPISchemaToParameterType(param.schema),
|
|
406
|
-
description: param.description || `Parameter ${param.name}`,
|
|
407
|
-
required: param.required,
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
// Add request body parameters if present
|
|
411
|
-
if (operation.requestBody?.content) {
|
|
412
|
-
// For simplicity, assume JSON content and flatten the schema
|
|
413
|
-
const jsonContent = operation.requestBody.content['application/json'];
|
|
414
|
-
if (jsonContent?.schema) {
|
|
415
|
-
this.flattenSchemaToParameters(jsonContent.schema, parameters, operation.requestBody.required);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
// Warn if parameter inflation exceeds threshold
|
|
419
|
-
const paramCount = Object.keys(parameters).length;
|
|
420
|
-
if (paramCount > 60) {
|
|
421
|
-
// Using console.warn to avoid adding logger dependency here
|
|
422
|
-
console.warn(`[ProfileLoader] Generated tool has ${paramCount} parameters (>60). Operation: ${operation.operationId} ${operation.method.toUpperCase()} ${operation.path}`);
|
|
423
|
-
}
|
|
424
|
-
// Apply name shortening if strategy is specified
|
|
425
|
-
const opForNaming = {
|
|
426
|
-
operationId: operation.operationId,
|
|
427
|
-
method: operation.method,
|
|
428
|
-
path: operation.path,
|
|
429
|
-
tags: operation.tags,
|
|
430
|
-
};
|
|
431
|
-
const nameResult = shortenToolName(opForNaming, strategy, maxLength, allOperations.length > 0 ? allOperations : [opForNaming], options);
|
|
432
|
-
return {
|
|
433
|
-
name: nameResult.name,
|
|
434
|
-
description: operation.summary || operation.description || `Execute ${operation.method.toUpperCase()} ${operation.path}`,
|
|
435
|
-
operations: {
|
|
436
|
-
'execute': operation.operationId,
|
|
437
|
-
},
|
|
438
|
-
parameters,
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Map OpenAPI schema to parameter type
|
|
443
|
-
*/
|
|
444
|
-
static mapOpenAPISchemaToParameterType(schema) {
|
|
445
|
-
switch (schema.type) {
|
|
446
|
-
case 'string':
|
|
447
|
-
return 'string';
|
|
448
|
-
case 'integer':
|
|
449
|
-
return 'integer';
|
|
450
|
-
case 'number':
|
|
451
|
-
return 'number';
|
|
452
|
-
case 'boolean':
|
|
453
|
-
return 'boolean';
|
|
454
|
-
case 'array':
|
|
455
|
-
return 'array';
|
|
456
|
-
case 'object':
|
|
457
|
-
return 'object';
|
|
458
|
-
default:
|
|
459
|
-
return 'string'; // fallback
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
/**
|
|
463
|
-
* Recursively flatten schema properties to parameters
|
|
464
|
-
*/
|
|
465
|
-
static flattenSchemaToParameters(schema, parameters, required = false) {
|
|
466
|
-
if (schema.type === 'object' && schema.properties) {
|
|
467
|
-
for (const [propName, propSchema] of Object.entries(schema.properties)) {
|
|
468
|
-
const isRequired = schema.required?.includes(propName) || required;
|
|
469
|
-
parameters[propName] = {
|
|
470
|
-
type: this.mapOpenAPISchemaToParameterType(propSchema),
|
|
471
|
-
description: `Property ${propName}`,
|
|
472
|
-
required: isRequired,
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
static normalizeToolNames(profile) {
|
|
478
|
-
for (const tool of profile.tools) {
|
|
479
|
-
tool.name = normalizeToolName(tool.name);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
//# sourceMappingURL=profile-loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile-loader.js","sourceRoot":"","sources":["../../src/profile-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM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CAAC;YACnB,KAAK,OAAO;gBACV,OAAO,OAAO,CAAC;YACjB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB;gBACE,OAAO,QAAQ,CAAC,CAAC,WAAW;QAChC,CAAC;IACH,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,yBAAyB,CACtC,MAAkB,EAClB,UAA4E,EAC5E,WAAoB,KAAK;QAEzB,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YAClD,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;gBACvE,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;gBACnE,UAAU,CAAC,QAAQ,CAAC,GAAG;oBACrB,IAAI,EAAE,IAAI,CAAC,+BAA+B,CAAC,UAAwB,CAAC;oBACpE,WAAW,EAAE,YAAY,QAAQ,EAAE;oBACnC,QAAQ,EAAE,UAAU;iBACrB,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAAC,OAAgB;QAChD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YACjC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Profile registry for resolving profiles by ID or alias.
|
|
3
|
-
*/
|
|
4
|
-
import { type ResolvedProfile } from './profile-resolver.js';
|
|
5
|
-
export interface ProfileRegistryOptions {
|
|
6
|
-
profilesDir?: string;
|
|
7
|
-
defaultProfile?: ResolvedProfile;
|
|
8
|
-
specPathOverride?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare class ProfileRegistry {
|
|
11
|
-
private profilesDir?;
|
|
12
|
-
private defaultProfile?;
|
|
13
|
-
private specPathOverride?;
|
|
14
|
-
constructor(options: ProfileRegistryOptions);
|
|
15
|
-
getDefaultProfile(): ResolvedProfile | undefined;
|
|
16
|
-
resolveProfile(profileId: string): Promise<ResolvedProfile>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=profile-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile-registry.d.ts","sourceRoot":"","sources":["../../src/profile-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEjF,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,cAAc,CAAC,CAAkB;IACzC,OAAO,CAAC,gBAAgB,CAAC,CAAS;gBAEtB,OAAO,EAAE,sBAAsB;IAM3C,iBAAiB,IAAI,eAAe,GAAG,SAAS;IAI1C,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAYlE"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Profile registry for resolving profiles by ID or alias.
|
|
3
|
-
*/
|
|
4
|
-
import { resolveProfileById } from './profile-resolver.js';
|
|
5
|
-
export class ProfileRegistry {
|
|
6
|
-
constructor(options) {
|
|
7
|
-
this.profilesDir = options.profilesDir;
|
|
8
|
-
this.defaultProfile = options.defaultProfile;
|
|
9
|
-
this.specPathOverride = options.specPathOverride;
|
|
10
|
-
}
|
|
11
|
-
getDefaultProfile() {
|
|
12
|
-
return this.defaultProfile;
|
|
13
|
-
}
|
|
14
|
-
async resolveProfile(profileId) {
|
|
15
|
-
if (this.defaultProfile) {
|
|
16
|
-
if (profileId === this.defaultProfile.profileId || profileId === this.defaultProfile.profileName) {
|
|
17
|
-
return this.defaultProfile;
|
|
18
|
-
}
|
|
19
|
-
if (this.defaultProfile.profileAliases?.includes(profileId)) {
|
|
20
|
-
return this.defaultProfile;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return resolveProfileById(profileId, this.profilesDir, { specPathOverride: this.specPathOverride });
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=profile-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile-registry.js","sourceRoot":"","sources":["../../src/profile-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAwB,MAAM,uBAAuB,CAAC;AAQjF,MAAM,OAAO,eAAe;IAK1B,YAAY,OAA+B;QACzC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IACnD,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,SAAiB;QACpC,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;gBACjG,OAAO,IAAI,CAAC,cAAc,CAAC;YAC7B,CAAC;YACD,IAAI,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC5D,OAAO,IAAI,CAAC,cAAc,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,OAAO,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACtG,CAAC;CACF"}
|