@robinmordasiewicz/f5xc-api-mcp 3.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/CHANGELOG.md +74 -0
- package/README.md +234 -0
- package/dist/auth/credential-manager.d.ts +116 -0
- package/dist/auth/credential-manager.d.ts.map +1 -0
- package/dist/auth/credential-manager.js +208 -0
- package/dist/auth/credential-manager.js.map +1 -0
- package/dist/auth/http-client.d.ts +81 -0
- package/dist/auth/http-client.d.ts.map +1 -0
- package/dist/auth/http-client.js +197 -0
- package/dist/auth/http-client.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +6 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/generator/index.d.ts +7 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +7 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/naming/acronyms.d.ts +81 -0
- package/dist/generator/naming/acronyms.d.ts.map +1 -0
- package/dist/generator/naming/acronyms.js +253 -0
- package/dist/generator/naming/acronyms.js.map +1 -0
- package/dist/generator/naming/index.d.ts +6 -0
- package/dist/generator/naming/index.d.ts.map +1 -0
- package/dist/generator/naming/index.js +6 -0
- package/dist/generator/naming/index.js.map +1 -0
- package/dist/generator/naming/volterra-mapping.d.ts +102 -0
- package/dist/generator/naming/volterra-mapping.d.ts.map +1 -0
- package/dist/generator/naming/volterra-mapping.js +259 -0
- package/dist/generator/naming/volterra-mapping.js.map +1 -0
- package/dist/generator/openapi-parser.d.ts +339 -0
- package/dist/generator/openapi-parser.d.ts.map +1 -0
- package/dist/generator/openapi-parser.js +463 -0
- package/dist/generator/openapi-parser.js.map +1 -0
- package/dist/generator/tool-generator.d.ts +74 -0
- package/dist/generator/tool-generator.d.ts.map +1 -0
- package/dist/generator/tool-generator.js +387 -0
- package/dist/generator/tool-generator.js.map +1 -0
- package/dist/generator/transformers/index.d.ts +7 -0
- package/dist/generator/transformers/index.d.ts.map +1 -0
- package/dist/generator/transformers/index.js +7 -0
- package/dist/generator/transformers/index.js.map +1 -0
- package/dist/generator/transformers/normalize-examples.d.ts +48 -0
- package/dist/generator/transformers/normalize-examples.d.ts.map +1 -0
- package/dist/generator/transformers/normalize-examples.js +66 -0
- package/dist/generator/transformers/normalize-examples.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +6 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +5 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/workflows.d.ts +59 -0
- package/dist/prompts/workflows.d.ts.map +1 -0
- package/dist/prompts/workflows.js +585 -0
- package/dist/prompts/workflows.js.map +1 -0
- package/dist/resources/handlers.d.ts +72 -0
- package/dist/resources/handlers.d.ts.map +1 -0
- package/dist/resources/handlers.js +279 -0
- package/dist/resources/handlers.js.map +1 -0
- package/dist/resources/index.d.ts +8 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +6 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/templates.d.ts +86 -0
- package/dist/resources/templates.d.ts.map +1 -0
- package/dist/resources/templates.js +248 -0
- package/dist/resources/templates.js.map +1 -0
- package/dist/server.d.ts +78 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +426 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/discovery/consolidate.d.ts +97 -0
- package/dist/tools/discovery/consolidate.d.ts.map +1 -0
- package/dist/tools/discovery/consolidate.js +200 -0
- package/dist/tools/discovery/consolidate.js.map +1 -0
- package/dist/tools/discovery/describe.d.ts +132 -0
- package/dist/tools/discovery/describe.d.ts.map +1 -0
- package/dist/tools/discovery/describe.js +206 -0
- package/dist/tools/discovery/describe.js.map +1 -0
- package/dist/tools/discovery/execute.d.ts +98 -0
- package/dist/tools/discovery/execute.d.ts.map +1 -0
- package/dist/tools/discovery/execute.js +251 -0
- package/dist/tools/discovery/execute.js.map +1 -0
- package/dist/tools/discovery/index-loader.d.ts +28 -0
- package/dist/tools/discovery/index-loader.d.ts.map +1 -0
- package/dist/tools/discovery/index-loader.js +69 -0
- package/dist/tools/discovery/index-loader.js.map +1 -0
- package/dist/tools/discovery/index.d.ts +185 -0
- package/dist/tools/discovery/index.d.ts.map +1 -0
- package/dist/tools/discovery/index.js +177 -0
- package/dist/tools/discovery/index.js.map +1 -0
- package/dist/tools/discovery/search.d.ts +41 -0
- package/dist/tools/discovery/search.d.ts.map +1 -0
- package/dist/tools/discovery/search.js +155 -0
- package/dist/tools/discovery/search.js.map +1 -0
- package/dist/tools/discovery/types.d.ts +70 -0
- package/dist/tools/discovery/types.d.ts.map +1 -0
- package/dist/tools/discovery/types.js +9 -0
- package/dist/tools/discovery/types.js.map +1 -0
- package/dist/tools/generated/ai_intelligence/index.d.ts +8 -0
- package/dist/tools/generated/ai_intelligence/index.d.ts.map +1 -0
- package/dist/tools/generated/ai_intelligence/index.js +282 -0
- package/dist/tools/generated/ai_intelligence/index.js.map +1 -0
- package/dist/tools/generated/api_security/index.d.ts +8 -0
- package/dist/tools/generated/api_security/index.d.ts.map +1 -0
- package/dist/tools/generated/api_security/index.js +1852 -0
- package/dist/tools/generated/api_security/index.js.map +1 -0
- package/dist/tools/generated/applications/index.d.ts +8 -0
- package/dist/tools/generated/applications/index.d.ts.map +1 -0
- package/dist/tools/generated/applications/index.js +1589 -0
- package/dist/tools/generated/applications/index.js.map +1 -0
- package/dist/tools/generated/bigip/index.d.ts +8 -0
- package/dist/tools/generated/bigip/index.d.ts.map +1 -0
- package/dist/tools/generated/bigip/index.js +1173 -0
- package/dist/tools/generated/bigip/index.js.map +1 -0
- package/dist/tools/generated/billing/index.d.ts +8 -0
- package/dist/tools/generated/billing/index.d.ts.map +1 -0
- package/dist/tools/generated/billing/index.js +759 -0
- package/dist/tools/generated/billing/index.js.map +1 -0
- package/dist/tools/generated/cdn/index.d.ts +8 -0
- package/dist/tools/generated/cdn/index.d.ts.map +1 -0
- package/dist/tools/generated/cdn/index.js +841 -0
- package/dist/tools/generated/cdn/index.js.map +1 -0
- package/dist/tools/generated/config/index.d.ts +8 -0
- package/dist/tools/generated/config/index.d.ts.map +1 -0
- package/dist/tools/generated/config/index.js +316 -0
- package/dist/tools/generated/config/index.js.map +1 -0
- package/dist/tools/generated/identity/index.d.ts +8 -0
- package/dist/tools/generated/identity/index.d.ts.map +1 -0
- package/dist/tools/generated/identity/index.js +5371 -0
- package/dist/tools/generated/identity/index.js.map +1 -0
- package/dist/tools/generated/infrastructure/index.d.ts +8 -0
- package/dist/tools/generated/infrastructure/index.d.ts.map +1 -0
- package/dist/tools/generated/infrastructure/index.js +5342 -0
- package/dist/tools/generated/infrastructure/index.js.map +1 -0
- package/dist/tools/generated/infrastructure_protection/index.d.ts +8 -0
- package/dist/tools/generated/infrastructure_protection/index.d.ts.map +1 -0
- package/dist/tools/generated/infrastructure_protection/index.js +2919 -0
- package/dist/tools/generated/infrastructure_protection/index.js.map +1 -0
- package/dist/tools/generated/integrations/index.d.ts +8 -0
- package/dist/tools/generated/integrations/index.d.ts.map +1 -0
- package/dist/tools/generated/integrations/index.js +1995 -0
- package/dist/tools/generated/integrations/index.js.map +1 -0
- package/dist/tools/generated/load_balancer/index.d.ts +8 -0
- package/dist/tools/generated/load_balancer/index.d.ts.map +1 -0
- package/dist/tools/generated/load_balancer/index.js +2269 -0
- package/dist/tools/generated/load_balancer/index.js.map +1 -0
- package/dist/tools/generated/networking/index.d.ts +8 -0
- package/dist/tools/generated/networking/index.d.ts.map +1 -0
- package/dist/tools/generated/networking/index.js +11289 -0
- package/dist/tools/generated/networking/index.js.map +1 -0
- package/dist/tools/generated/nginx/index.d.ts +8 -0
- package/dist/tools/generated/nginx/index.d.ts.map +1 -0
- package/dist/tools/generated/nginx/index.js +680 -0
- package/dist/tools/generated/nginx/index.js.map +1 -0
- package/dist/tools/generated/observability/index.d.ts +8 -0
- package/dist/tools/generated/observability/index.d.ts.map +1 -0
- package/dist/tools/generated/observability/index.js +6140 -0
- package/dist/tools/generated/observability/index.js.map +1 -0
- package/dist/tools/generated/operations/index.d.ts +8 -0
- package/dist/tools/generated/operations/index.d.ts.map +1 -0
- package/dist/tools/generated/operations/index.js +1759 -0
- package/dist/tools/generated/operations/index.js.map +1 -0
- package/dist/tools/generated/security/index.d.ts +8 -0
- package/dist/tools/generated/security/index.d.ts.map +1 -0
- package/dist/tools/generated/security/index.js +9111 -0
- package/dist/tools/generated/security/index.js.map +1 -0
- package/dist/tools/generated/service_mesh/index.d.ts +8 -0
- package/dist/tools/generated/service_mesh/index.d.ts.map +1 -0
- package/dist/tools/generated/service_mesh/index.js +1628 -0
- package/dist/tools/generated/service_mesh/index.js.map +1 -0
- package/dist/tools/generated/shape_security/index.d.ts +8 -0
- package/dist/tools/generated/shape_security/index.d.ts.map +1 -0
- package/dist/tools/generated/shape_security/index.js +4121 -0
- package/dist/tools/generated/shape_security/index.js.map +1 -0
- package/dist/tools/generated/subscriptions/index.d.ts +8 -0
- package/dist/tools/generated/subscriptions/index.d.ts.map +1 -0
- package/dist/tools/generated/subscriptions/index.js +778 -0
- package/dist/tools/generated/subscriptions/index.js.map +1 -0
- package/dist/tools/generated/tenant_management/index.d.ts +8 -0
- package/dist/tools/generated/tenant_management/index.d.ts.map +1 -0
- package/dist/tools/generated/tenant_management/index.js +2292 -0
- package/dist/tools/generated/tenant_management/index.js.map +1 -0
- package/dist/tools/generated/vpn/index.d.ts +8 -0
- package/dist/tools/generated/vpn/index.d.ts.map +1 -0
- package/dist/tools/generated/vpn/index.js +1183 -0
- package/dist/tools/generated/vpn/index.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +6 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +27 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +83 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/utils/error-handling.d.ts +109 -0
- package/dist/utils/error-handling.d.ts.map +1 -0
- package/dist/utils/error-handling.js +239 -0
- package/dist/utils/error-handling.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logging.d.ts +75 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +131 -0
- package/dist/utils/logging.js.map +1 -0
- package/manifest.json +143 -0
- package/package.json +95 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authenticated HTTP Client for F5 Distributed Cloud API
|
|
3
|
+
*
|
|
4
|
+
* Provides a configured Axios client for making authenticated API requests.
|
|
5
|
+
* Supports both API token and P12 certificate (mTLS) authentication.
|
|
6
|
+
*/
|
|
7
|
+
import { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
8
|
+
import { CredentialManager } from "./credential-manager.js";
|
|
9
|
+
/**
|
|
10
|
+
* HTTP client configuration options
|
|
11
|
+
*/
|
|
12
|
+
export interface HttpClientConfig {
|
|
13
|
+
/** Request timeout in milliseconds */
|
|
14
|
+
timeout?: number;
|
|
15
|
+
/** Custom headers to include in all requests */
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
/** Enable request/response logging */
|
|
18
|
+
debug?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* API response wrapper with metadata
|
|
22
|
+
*/
|
|
23
|
+
export interface ApiResponse<T = unknown> {
|
|
24
|
+
/** Response data */
|
|
25
|
+
data: T;
|
|
26
|
+
/** HTTP status code */
|
|
27
|
+
status: number;
|
|
28
|
+
/** Response headers */
|
|
29
|
+
headers: Record<string, string>;
|
|
30
|
+
/** Request duration in milliseconds */
|
|
31
|
+
duration: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* HTTP Client for F5XC API
|
|
35
|
+
*
|
|
36
|
+
* Creates and manages an authenticated Axios instance for making
|
|
37
|
+
* API requests to F5 Distributed Cloud.
|
|
38
|
+
*/
|
|
39
|
+
export declare class HttpClient {
|
|
40
|
+
private client;
|
|
41
|
+
private credentialManager;
|
|
42
|
+
private config;
|
|
43
|
+
constructor(credentialManager: CredentialManager, config?: HttpClientConfig);
|
|
44
|
+
/**
|
|
45
|
+
* Create configured Axios client
|
|
46
|
+
*/
|
|
47
|
+
private createClient;
|
|
48
|
+
/**
|
|
49
|
+
* Check if the client is available (authenticated mode)
|
|
50
|
+
*/
|
|
51
|
+
isAvailable(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Make a GET request
|
|
54
|
+
*/
|
|
55
|
+
get<T = unknown>(path: string, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
|
|
56
|
+
/**
|
|
57
|
+
* Make a POST request
|
|
58
|
+
*/
|
|
59
|
+
post<T = unknown>(path: string, data?: unknown, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
|
|
60
|
+
/**
|
|
61
|
+
* Make a PUT request
|
|
62
|
+
*/
|
|
63
|
+
put<T = unknown>(path: string, data?: unknown, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
|
|
64
|
+
/**
|
|
65
|
+
* Make a DELETE request
|
|
66
|
+
*/
|
|
67
|
+
delete<T = unknown>(path: string, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
|
|
68
|
+
/**
|
|
69
|
+
* Make a generic request
|
|
70
|
+
*/
|
|
71
|
+
private request;
|
|
72
|
+
/**
|
|
73
|
+
* Get the underlying Axios instance
|
|
74
|
+
*/
|
|
75
|
+
getAxiosInstance(): AxiosInstance | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create HTTP client from credential manager
|
|
79
|
+
*/
|
|
80
|
+
export declare function createHttpClient(credentialManager: CredentialManager, config?: HttpClientConfig): HttpClient;
|
|
81
|
+
//# sourceMappingURL=http-client.d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MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAI1B;;OAEG;IACG,GAAG,CAAC,CAAC,GAAG,OAAO,EACnB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAI1B;;OAEG;IACG,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAI7F;;OAEG;YACW,OAAO;IAgCrB;;OAEG;IACH,gBAAgB,IAAI,aAAa,GAAG,IAAI;CAGzC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,CAAC,EAAE,gBAAgB,GACxB,UAAU,CAEZ"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authenticated HTTP Client for F5 Distributed Cloud API
|
|
3
|
+
*
|
|
4
|
+
* Provides a configured Axios client for making authenticated API requests.
|
|
5
|
+
* Supports both API token and P12 certificate (mTLS) authentication.
|
|
6
|
+
*/
|
|
7
|
+
import axios from "axios";
|
|
8
|
+
import https from "https";
|
|
9
|
+
import { AuthMode } from "./credential-manager.js";
|
|
10
|
+
import { logger } from "../utils/logging.js";
|
|
11
|
+
import { F5XCApiError, AuthenticationError } from "../utils/error-handling.js";
|
|
12
|
+
/**
|
|
13
|
+
* Default HTTP client configuration
|
|
14
|
+
*/
|
|
15
|
+
const DEFAULT_CONFIG = {
|
|
16
|
+
timeout: 30000, // 30 seconds
|
|
17
|
+
headers: {},
|
|
18
|
+
debug: false,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* HTTP Client for F5XC API
|
|
22
|
+
*
|
|
23
|
+
* Creates and manages an authenticated Axios instance for making
|
|
24
|
+
* API requests to F5 Distributed Cloud.
|
|
25
|
+
*/
|
|
26
|
+
export class HttpClient {
|
|
27
|
+
client = null;
|
|
28
|
+
credentialManager;
|
|
29
|
+
config;
|
|
30
|
+
constructor(credentialManager, config = {}) {
|
|
31
|
+
this.credentialManager = credentialManager;
|
|
32
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
33
|
+
if (this.credentialManager.isAuthenticated()) {
|
|
34
|
+
this.client = this.createClient();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create configured Axios client
|
|
39
|
+
*/
|
|
40
|
+
createClient() {
|
|
41
|
+
const authMode = this.credentialManager.getAuthMode();
|
|
42
|
+
const baseURL = this.credentialManager.getApiUrl();
|
|
43
|
+
if (!baseURL) {
|
|
44
|
+
throw new AuthenticationError("API URL not configured");
|
|
45
|
+
}
|
|
46
|
+
const axiosConfig = {
|
|
47
|
+
baseURL,
|
|
48
|
+
timeout: this.config.timeout,
|
|
49
|
+
headers: {
|
|
50
|
+
"Content-Type": "application/json",
|
|
51
|
+
Accept: "application/json",
|
|
52
|
+
...this.config.headers,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
// Configure authentication
|
|
56
|
+
if (authMode === AuthMode.TOKEN) {
|
|
57
|
+
const token = this.credentialManager.getToken();
|
|
58
|
+
if (!token) {
|
|
59
|
+
throw new AuthenticationError("API token not configured");
|
|
60
|
+
}
|
|
61
|
+
axiosConfig.headers = {
|
|
62
|
+
...axiosConfig.headers,
|
|
63
|
+
Authorization: `APIToken ${token}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
else if (authMode === AuthMode.CERTIFICATE) {
|
|
67
|
+
const p12Buffer = this.credentialManager.getP12Certificate();
|
|
68
|
+
const p12Password = this.credentialManager.getP12Password();
|
|
69
|
+
if (!p12Buffer) {
|
|
70
|
+
throw new AuthenticationError("P12 certificate not loaded");
|
|
71
|
+
}
|
|
72
|
+
// Create HTTPS agent with P12 certificate for mTLS
|
|
73
|
+
axiosConfig.httpsAgent = new https.Agent({
|
|
74
|
+
pfx: p12Buffer,
|
|
75
|
+
passphrase: p12Password ?? undefined,
|
|
76
|
+
rejectUnauthorized: true,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const client = axios.create(axiosConfig);
|
|
80
|
+
// Add request interceptor for logging
|
|
81
|
+
client.interceptors.request.use((config) => {
|
|
82
|
+
// Add request timestamp for duration calculation
|
|
83
|
+
config.metadata = {
|
|
84
|
+
startTime: Date.now(),
|
|
85
|
+
};
|
|
86
|
+
if (this.config.debug) {
|
|
87
|
+
logger.debug("API Request", {
|
|
88
|
+
method: config.method?.toUpperCase(),
|
|
89
|
+
url: config.url,
|
|
90
|
+
baseURL: config.baseURL,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return config;
|
|
94
|
+
}, (error) => {
|
|
95
|
+
logger.error("Request interceptor error", { error });
|
|
96
|
+
return Promise.reject(error);
|
|
97
|
+
});
|
|
98
|
+
// Add response interceptor for logging and error handling
|
|
99
|
+
client.interceptors.response.use((response) => {
|
|
100
|
+
const config = response.config;
|
|
101
|
+
const duration = config.metadata ? Date.now() - config.metadata.startTime : 0;
|
|
102
|
+
if (this.config.debug) {
|
|
103
|
+
logger.debug("API Response", {
|
|
104
|
+
status: response.status,
|
|
105
|
+
url: response.config.url,
|
|
106
|
+
duration: `${duration}ms`,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return response;
|
|
110
|
+
}, (error) => {
|
|
111
|
+
if (axios.isAxiosError(error)) {
|
|
112
|
+
const status = error.response?.status;
|
|
113
|
+
const message = error.response?.data?.message ?? error.message;
|
|
114
|
+
logger.error("API Error", {
|
|
115
|
+
status,
|
|
116
|
+
message,
|
|
117
|
+
url: error.config?.url,
|
|
118
|
+
});
|
|
119
|
+
// Transform to F5XC API error
|
|
120
|
+
throw new F5XCApiError(message, status, error.response?.data);
|
|
121
|
+
}
|
|
122
|
+
throw error;
|
|
123
|
+
});
|
|
124
|
+
logger.info("HTTP client created", {
|
|
125
|
+
baseURL,
|
|
126
|
+
authMode,
|
|
127
|
+
timeout: this.config.timeout,
|
|
128
|
+
});
|
|
129
|
+
return client;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Check if the client is available (authenticated mode)
|
|
133
|
+
*/
|
|
134
|
+
isAvailable() {
|
|
135
|
+
return this.client !== null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Make a GET request
|
|
139
|
+
*/
|
|
140
|
+
async get(path, config) {
|
|
141
|
+
return this.request("GET", path, undefined, config);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Make a POST request
|
|
145
|
+
*/
|
|
146
|
+
async post(path, data, config) {
|
|
147
|
+
return this.request("POST", path, data, config);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Make a PUT request
|
|
151
|
+
*/
|
|
152
|
+
async put(path, data, config) {
|
|
153
|
+
return this.request("PUT", path, data, config);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Make a DELETE request
|
|
157
|
+
*/
|
|
158
|
+
async delete(path, config) {
|
|
159
|
+
return this.request("DELETE", path, undefined, config);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Make a generic request
|
|
163
|
+
*/
|
|
164
|
+
async request(method, path, data, config) {
|
|
165
|
+
if (!this.client) {
|
|
166
|
+
throw new AuthenticationError("HTTP client not available - server is in documentation mode. " +
|
|
167
|
+
"Set F5XC_API_URL and F5XC_API_TOKEN or F5XC_P12_FILE to enable API execution.");
|
|
168
|
+
}
|
|
169
|
+
const startTime = Date.now();
|
|
170
|
+
const response = await this.client.request({
|
|
171
|
+
method,
|
|
172
|
+
url: path,
|
|
173
|
+
data,
|
|
174
|
+
...config,
|
|
175
|
+
});
|
|
176
|
+
const duration = Date.now() - startTime;
|
|
177
|
+
return {
|
|
178
|
+
data: response.data,
|
|
179
|
+
status: response.status,
|
|
180
|
+
headers: response.headers,
|
|
181
|
+
duration,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get the underlying Axios instance
|
|
186
|
+
*/
|
|
187
|
+
getAxiosInstance() {
|
|
188
|
+
return this.client;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Create HTTP client from credential manager
|
|
193
|
+
*/
|
|
194
|
+
export function createHttpClient(credentialManager, config) {
|
|
195
|
+
return new HttpClient(credentialManager, config);
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=http-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/auth/http-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAKN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAqB,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAc/E;;GAEG;AACH,MAAM,cAAc,GAA+B;IACjD,OAAO,EAAE,KAAK,EAAE,aAAa;IAC7B,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,KAAK;CACb,CAAC;AAgBF;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,GAAyB,IAAI,CAAC;IACpC,iBAAiB,CAAoB;IACrC,MAAM,CAA6B;IAE3C,YAAY,iBAAoC,EAAE,SAA2B,EAAE;QAC7E,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;QAE/C,IAAI,IAAI,CAAC,i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AC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,iBAAoC,EACpC,MAAyB;IAEzB,OAAO,IAAI,UAAU,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Module - Export all authentication utilities
|
|
3
|
+
*/
|
|
4
|
+
export { AuthMode, AUTH_ENV_VARS, CredentialManager, normalizeApiUrl, extractTenantFromUrl, } from "./credential-manager.js";
|
|
5
|
+
export type { Credentials } from "./credential-manager.js";
|
|
6
|
+
export { HttpClient, createHttpClient } from "./http-client.js";
|
|
7
|
+
export type { HttpClientConfig, ApiResponse } from "./http-client.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth Module - Export all authentication utilities
|
|
3
|
+
*/
|
|
4
|
+
export { AuthMode, AUTH_ENV_VARS, CredentialManager, normalizeApiUrl, extractTenantFromUrl, } from "./credential-manager.js";
|
|
5
|
+
export { HttpClient, createHttpClient } from "./http-client.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acronym Normalization for F5XC API
|
|
3
|
+
*
|
|
4
|
+
* Handles consistent capitalization of technical acronyms in API
|
|
5
|
+
* documentation, tool names, and descriptions.
|
|
6
|
+
*
|
|
7
|
+
* Ported from terraform-provider-f5xc/tools/pkg/naming/acronyms.go
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Known technical acronyms that should be capitalized consistently
|
|
11
|
+
*/
|
|
12
|
+
export declare const TECHNICAL_ACRONYMS: readonly string[];
|
|
13
|
+
/**
|
|
14
|
+
* Normalize acronyms in a text string to consistent capitalization
|
|
15
|
+
*
|
|
16
|
+
* @param text - Input text with potentially inconsistent acronym casing
|
|
17
|
+
* @returns Text with normalized acronym capitalization
|
|
18
|
+
* @deprecated Pre-enriched specs already have normalized acronyms
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeAcronyms(text: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Normalize acronyms in title case text
|
|
23
|
+
*
|
|
24
|
+
* Handles cases like "Tcp Load Balancer" -> "TCP Load Balancer"
|
|
25
|
+
*
|
|
26
|
+
* @param title - Title text to normalize
|
|
27
|
+
* @returns Title with normalized acronym capitalization
|
|
28
|
+
* @deprecated Pre-enriched specs already have normalized acronyms
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizeTitleAcronyms(title: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Check if a word is a known acronym
|
|
33
|
+
*
|
|
34
|
+
* @param word - Word to check
|
|
35
|
+
* @returns True if the word is a known acronym
|
|
36
|
+
*/
|
|
37
|
+
export declare function isAcronym(word: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get the canonical form of an acronym
|
|
40
|
+
*
|
|
41
|
+
* @param word - Word to look up
|
|
42
|
+
* @returns Canonical acronym form or null if not an acronym
|
|
43
|
+
*/
|
|
44
|
+
export declare function getCanonicalAcronym(word: string): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Convert a string to kebab-case with normalized acronyms
|
|
47
|
+
*
|
|
48
|
+
* Used for tool naming: "HTTP Load Balancer" -> "http-loadbalancer"
|
|
49
|
+
*
|
|
50
|
+
* @param text - Input text
|
|
51
|
+
* @returns Kebab-case string
|
|
52
|
+
*/
|
|
53
|
+
export declare function toKebabCase(text: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Convert a string to snake_case with normalized acronyms
|
|
56
|
+
*
|
|
57
|
+
* Used for resource naming: "HTTP Load Balancer" -> "http_load_balancer"
|
|
58
|
+
*
|
|
59
|
+
* @param text - Input text
|
|
60
|
+
* @returns Snake_case string
|
|
61
|
+
*/
|
|
62
|
+
export declare function toSnakeCase(text: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Convert a string to PascalCase with normalized acronyms
|
|
65
|
+
*
|
|
66
|
+
* Used for TypeScript type names: "http load balancer" -> "HttpLoadBalancer"
|
|
67
|
+
*
|
|
68
|
+
* @param text - Input text
|
|
69
|
+
* @returns PascalCase string
|
|
70
|
+
*/
|
|
71
|
+
export declare function toPascalCase(text: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Convert a string to camelCase with normalized acronyms
|
|
74
|
+
*
|
|
75
|
+
* Used for property names: "http load balancer" -> "httpLoadBalancer"
|
|
76
|
+
*
|
|
77
|
+
* @param text - Input text
|
|
78
|
+
* @returns camelCase string
|
|
79
|
+
*/
|
|
80
|
+
export declare function toCamelCase(text: string): string;
|
|
81
|
+
//# sourceMappingURL=acronyms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acronyms.d.ts","sourceRoot":"","sources":["../../../src/generator/naming/acronyms.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAiItC,CAAC;AASX;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAcjD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGhD"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acronym Normalization for F5XC API
|
|
3
|
+
*
|
|
4
|
+
* Handles consistent capitalization of technical acronyms in API
|
|
5
|
+
* documentation, tool names, and descriptions.
|
|
6
|
+
*
|
|
7
|
+
* Ported from terraform-provider-f5xc/tools/pkg/naming/acronyms.go
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Known technical acronyms that should be capitalized consistently
|
|
11
|
+
*/
|
|
12
|
+
export const TECHNICAL_ACRONYMS = [
|
|
13
|
+
// Networking
|
|
14
|
+
"TCP",
|
|
15
|
+
"UDP",
|
|
16
|
+
"HTTP",
|
|
17
|
+
"HTTPS",
|
|
18
|
+
"DNS",
|
|
19
|
+
"IP",
|
|
20
|
+
"IPv4",
|
|
21
|
+
"IPv6",
|
|
22
|
+
"BGP",
|
|
23
|
+
"OSPF",
|
|
24
|
+
"VLAN",
|
|
25
|
+
"VPN",
|
|
26
|
+
"CIDR",
|
|
27
|
+
"NAT",
|
|
28
|
+
"SNAT",
|
|
29
|
+
"DNAT",
|
|
30
|
+
"MAC",
|
|
31
|
+
"ARP",
|
|
32
|
+
"NIC",
|
|
33
|
+
"MTU",
|
|
34
|
+
"QoS",
|
|
35
|
+
"MPLS",
|
|
36
|
+
"GRE",
|
|
37
|
+
"VXLAN",
|
|
38
|
+
"IPsec",
|
|
39
|
+
"SSL",
|
|
40
|
+
"TLS",
|
|
41
|
+
"SNI",
|
|
42
|
+
// Security
|
|
43
|
+
"WAF",
|
|
44
|
+
"DDoS",
|
|
45
|
+
"XSS",
|
|
46
|
+
"CSRF",
|
|
47
|
+
"SQLi",
|
|
48
|
+
"OWASP",
|
|
49
|
+
"CVE",
|
|
50
|
+
"JWT",
|
|
51
|
+
"OAuth",
|
|
52
|
+
"SAML",
|
|
53
|
+
"LDAP",
|
|
54
|
+
"AD",
|
|
55
|
+
"ACL",
|
|
56
|
+
"RBAC",
|
|
57
|
+
"MFA",
|
|
58
|
+
"SSO",
|
|
59
|
+
"PKI",
|
|
60
|
+
// Load Balancing
|
|
61
|
+
"LB",
|
|
62
|
+
"SLB",
|
|
63
|
+
"GLB",
|
|
64
|
+
"GSLB",
|
|
65
|
+
"ADC",
|
|
66
|
+
// Cloud & Infrastructure
|
|
67
|
+
"AWS",
|
|
68
|
+
"GCP",
|
|
69
|
+
"Azure",
|
|
70
|
+
"VPC",
|
|
71
|
+
"VNet",
|
|
72
|
+
"EC2",
|
|
73
|
+
"EKS",
|
|
74
|
+
"AKS",
|
|
75
|
+
"GKE",
|
|
76
|
+
"VM",
|
|
77
|
+
"K8s",
|
|
78
|
+
"API",
|
|
79
|
+
"REST",
|
|
80
|
+
"gRPC",
|
|
81
|
+
"SDK",
|
|
82
|
+
"CLI",
|
|
83
|
+
"CDN",
|
|
84
|
+
"SaaS",
|
|
85
|
+
"PaaS",
|
|
86
|
+
"IaaS",
|
|
87
|
+
// F5 Specific
|
|
88
|
+
"XC",
|
|
89
|
+
"F5",
|
|
90
|
+
"BIG-IP",
|
|
91
|
+
"NGINX",
|
|
92
|
+
"RE",
|
|
93
|
+
"CE",
|
|
94
|
+
"POP",
|
|
95
|
+
// Standards & Formats
|
|
96
|
+
"JSON",
|
|
97
|
+
"XML",
|
|
98
|
+
"YAML",
|
|
99
|
+
"CSV",
|
|
100
|
+
"HTML",
|
|
101
|
+
"CSS",
|
|
102
|
+
"URL",
|
|
103
|
+
"URI",
|
|
104
|
+
"UUID",
|
|
105
|
+
"RFC",
|
|
106
|
+
"ISO",
|
|
107
|
+
"UTC",
|
|
108
|
+
"TTL",
|
|
109
|
+
// Protocols
|
|
110
|
+
"SMTP",
|
|
111
|
+
"IMAP",
|
|
112
|
+
"POP3",
|
|
113
|
+
"FTP",
|
|
114
|
+
"SFTP",
|
|
115
|
+
"SSH",
|
|
116
|
+
"RDP",
|
|
117
|
+
"SNMP",
|
|
118
|
+
"NTP",
|
|
119
|
+
"RADIUS",
|
|
120
|
+
"TACACS",
|
|
121
|
+
// Other
|
|
122
|
+
"CPU",
|
|
123
|
+
"GPU",
|
|
124
|
+
"RAM",
|
|
125
|
+
"SSD",
|
|
126
|
+
"HDD",
|
|
127
|
+
"IOPS",
|
|
128
|
+
"IO",
|
|
129
|
+
"ID",
|
|
130
|
+
"IDs",
|
|
131
|
+
"ASN",
|
|
132
|
+
"CRD",
|
|
133
|
+
"CRDs",
|
|
134
|
+
];
|
|
135
|
+
/**
|
|
136
|
+
* Lowercase mapping of acronyms for case-insensitive lookup
|
|
137
|
+
*/
|
|
138
|
+
const ACRONYM_MAP = new Map(TECHNICAL_ACRONYMS.map((acronym) => [acronym.toLowerCase(), acronym]));
|
|
139
|
+
/**
|
|
140
|
+
* Normalize acronyms in a text string to consistent capitalization
|
|
141
|
+
*
|
|
142
|
+
* @param text - Input text with potentially inconsistent acronym casing
|
|
143
|
+
* @returns Text with normalized acronym capitalization
|
|
144
|
+
* @deprecated Pre-enriched specs already have normalized acronyms
|
|
145
|
+
*/
|
|
146
|
+
export function normalizeAcronyms(text) {
|
|
147
|
+
// Word boundary pattern that matches words
|
|
148
|
+
const wordPattern = /\b([a-zA-Z][a-zA-Z0-9-]*)\b/g;
|
|
149
|
+
return text.replace(wordPattern, (match) => {
|
|
150
|
+
const normalized = ACRONYM_MAP.get(match.toLowerCase());
|
|
151
|
+
return normalized ?? match;
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Normalize acronyms in title case text
|
|
156
|
+
*
|
|
157
|
+
* Handles cases like "Tcp Load Balancer" -> "TCP Load Balancer"
|
|
158
|
+
*
|
|
159
|
+
* @param title - Title text to normalize
|
|
160
|
+
* @returns Title with normalized acronym capitalization
|
|
161
|
+
* @deprecated Pre-enriched specs already have normalized acronyms
|
|
162
|
+
*/
|
|
163
|
+
export function normalizeTitleAcronyms(title) {
|
|
164
|
+
return normalizeAcronyms(title);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Check if a word is a known acronym
|
|
168
|
+
*
|
|
169
|
+
* @param word - Word to check
|
|
170
|
+
* @returns True if the word is a known acronym
|
|
171
|
+
*/
|
|
172
|
+
export function isAcronym(word) {
|
|
173
|
+
return ACRONYM_MAP.has(word.toLowerCase());
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get the canonical form of an acronym
|
|
177
|
+
*
|
|
178
|
+
* @param word - Word to look up
|
|
179
|
+
* @returns Canonical acronym form or null if not an acronym
|
|
180
|
+
*/
|
|
181
|
+
export function getCanonicalAcronym(word) {
|
|
182
|
+
return ACRONYM_MAP.get(word.toLowerCase()) ?? null;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Convert a string to kebab-case with normalized acronyms
|
|
186
|
+
*
|
|
187
|
+
* Used for tool naming: "HTTP Load Balancer" -> "http-loadbalancer"
|
|
188
|
+
*
|
|
189
|
+
* @param text - Input text
|
|
190
|
+
* @returns Kebab-case string
|
|
191
|
+
*/
|
|
192
|
+
export function toKebabCase(text) {
|
|
193
|
+
return text
|
|
194
|
+
.trim()
|
|
195
|
+
.replace(/([a-z])([A-Z])/g, "$1-$2") // camelCase to kebab
|
|
196
|
+
.replace(/[\s_]+/g, "-") // spaces and underscores to hyphens
|
|
197
|
+
.replace(/[^a-zA-Z0-9-]/g, "") // remove special characters
|
|
198
|
+
.replace(/-+/g, "-") // collapse multiple hyphens
|
|
199
|
+
.toLowerCase();
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Convert a string to snake_case with normalized acronyms
|
|
203
|
+
*
|
|
204
|
+
* Used for resource naming: "HTTP Load Balancer" -> "http_load_balancer"
|
|
205
|
+
*
|
|
206
|
+
* @param text - Input text
|
|
207
|
+
* @returns Snake_case string
|
|
208
|
+
*/
|
|
209
|
+
export function toSnakeCase(text) {
|
|
210
|
+
return text
|
|
211
|
+
.trim()
|
|
212
|
+
.replace(/([a-z])([A-Z])/g, "$1_$2") // camelCase to snake
|
|
213
|
+
.replace(/[\s-]+/g, "_") // spaces and hyphens to underscores
|
|
214
|
+
.replace(/[^a-zA-Z0-9_]/g, "") // remove special characters
|
|
215
|
+
.replace(/_+/g, "_") // collapse multiple underscores
|
|
216
|
+
.toLowerCase();
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Convert a string to PascalCase with normalized acronyms
|
|
220
|
+
*
|
|
221
|
+
* Used for TypeScript type names: "http load balancer" -> "HttpLoadBalancer"
|
|
222
|
+
*
|
|
223
|
+
* @param text - Input text
|
|
224
|
+
* @returns PascalCase string
|
|
225
|
+
*/
|
|
226
|
+
export function toPascalCase(text) {
|
|
227
|
+
return text
|
|
228
|
+
.trim()
|
|
229
|
+
.split(/[\s_-]+/)
|
|
230
|
+
.map((word) => {
|
|
231
|
+
const acronym = ACRONYM_MAP.get(word.toLowerCase());
|
|
232
|
+
if (acronym) {
|
|
233
|
+
// Keep acronyms as-is for PascalCase
|
|
234
|
+
return acronym;
|
|
235
|
+
}
|
|
236
|
+
// Capitalize first letter
|
|
237
|
+
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
238
|
+
})
|
|
239
|
+
.join("");
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Convert a string to camelCase with normalized acronyms
|
|
243
|
+
*
|
|
244
|
+
* Used for property names: "http load balancer" -> "httpLoadBalancer"
|
|
245
|
+
*
|
|
246
|
+
* @param text - Input text
|
|
247
|
+
* @returns camelCase string
|
|
248
|
+
*/
|
|
249
|
+
export function toCamelCase(text) {
|
|
250
|
+
const pascal = toPascalCase(text);
|
|
251
|
+
return pascal.charAt(0).toLowerCase() + pascal.slice(1);
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=acronyms.js.map
|