mcp-wordpress 2.6.4 → 2.7.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/README.md +1 -1
- package/dist/cache/CacheInvalidation.d.ts +25 -6
- package/dist/cache/CacheInvalidation.d.ts.map +1 -1
- package/dist/cache/CacheInvalidation.js +168 -16
- package/dist/cache/CacheInvalidation.js.map +1 -1
- package/dist/cache/HttpCacheWrapper.d.ts.map +1 -1
- package/dist/cache/HttpCacheWrapper.js +3 -4
- package/dist/cache/HttpCacheWrapper.js.map +1 -1
- package/dist/cache/SEOCacheManager.d.ts +150 -0
- package/dist/cache/SEOCacheManager.d.ts.map +1 -0
- package/dist/cache/SEOCacheManager.js +275 -0
- package/dist/cache/SEOCacheManager.js.map +1 -0
- package/dist/client/SEOWordPressClient.d.ts +164 -0
- package/dist/client/SEOWordPressClient.d.ts.map +1 -0
- package/dist/client/SEOWordPressClient.js +674 -0
- package/dist/client/SEOWordPressClient.js.map +1 -0
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +50 -20
- package/dist/client/api.js.map +1 -1
- package/dist/client/auth.js +19 -19
- package/dist/client/auth.js.map +1 -1
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +14 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/managers/AuthManager.d.ts +39 -0
- package/dist/client/managers/AuthManager.d.ts.map +1 -0
- package/dist/client/managers/AuthManager.js +142 -0
- package/dist/client/managers/AuthManager.js.map +1 -0
- package/dist/client/managers/AuthenticationManager.d.ts.map +1 -1
- package/dist/client/managers/AuthenticationManager.js +10 -9
- package/dist/client/managers/AuthenticationManager.js.map +1 -1
- package/dist/client/managers/BaseManager.d.ts.map +1 -1
- package/dist/client/managers/BaseManager.js +12 -0
- package/dist/client/managers/BaseManager.js.map +1 -1
- package/dist/client/managers/ComposedAuthenticationManager.d.ts +94 -0
- package/dist/client/managers/ComposedAuthenticationManager.d.ts.map +1 -0
- package/dist/client/managers/ComposedAuthenticationManager.js +340 -0
- package/dist/client/managers/ComposedAuthenticationManager.js.map +1 -0
- package/dist/client/managers/ComposedManagerFactory.d.ts +104 -0
- package/dist/client/managers/ComposedManagerFactory.d.ts.map +1 -0
- package/dist/client/managers/ComposedManagerFactory.js +180 -0
- package/dist/client/managers/ComposedManagerFactory.js.map +1 -0
- package/dist/client/managers/ComposedRequestManager.d.ts +82 -0
- package/dist/client/managers/ComposedRequestManager.d.ts.map +1 -0
- package/dist/client/managers/ComposedRequestManager.js +260 -0
- package/dist/client/managers/ComposedRequestManager.js.map +1 -0
- package/dist/client/managers/JWTAuthImplementation.d.ts +86 -0
- package/dist/client/managers/JWTAuthImplementation.d.ts.map +1 -0
- package/dist/client/managers/JWTAuthImplementation.js +240 -0
- package/dist/client/managers/JWTAuthImplementation.js.map +1 -0
- package/dist/client/managers/ManagersIndex.d.ts +6 -0
- package/dist/client/managers/ManagersIndex.d.ts.map +1 -0
- package/dist/client/managers/ManagersIndex.js +6 -0
- package/dist/client/managers/ManagersIndex.js.map +1 -0
- package/dist/client/managers/RequestManager.d.ts.map +1 -1
- package/dist/client/managers/RequestManager.js +5 -3
- package/dist/client/managers/RequestManager.js.map +1 -1
- package/dist/client/managers/composed/MigrationAdapter.d.ts +80 -0
- package/dist/client/managers/composed/MigrationAdapter.d.ts.map +1 -0
- package/dist/client/managers/composed/MigrationAdapter.js +214 -0
- package/dist/client/managers/composed/MigrationAdapter.js.map +1 -0
- package/dist/client/managers/composed/index.d.ts +23 -0
- package/dist/client/managers/composed/index.d.ts.map +1 -0
- package/dist/client/managers/composed/index.js +26 -0
- package/dist/client/managers/composed/index.js.map +1 -0
- package/dist/client/managers/implementations/ConfigurationProviderImpl.d.ts +27 -0
- package/dist/client/managers/implementations/ConfigurationProviderImpl.d.ts.map +1 -0
- package/dist/client/managers/implementations/ConfigurationProviderImpl.js +41 -0
- package/dist/client/managers/implementations/ConfigurationProviderImpl.js.map +1 -0
- package/dist/client/managers/implementations/ErrorHandlerImpl.d.ts +31 -0
- package/dist/client/managers/implementations/ErrorHandlerImpl.d.ts.map +1 -0
- package/dist/client/managers/implementations/ErrorHandlerImpl.js +73 -0
- package/dist/client/managers/implementations/ErrorHandlerImpl.js.map +1 -0
- package/dist/client/managers/implementations/ParameterValidatorImpl.d.ts +47 -0
- package/dist/client/managers/implementations/ParameterValidatorImpl.d.ts.map +1 -0
- package/dist/client/managers/implementations/ParameterValidatorImpl.js +141 -0
- package/dist/client/managers/implementations/ParameterValidatorImpl.js.map +1 -0
- package/dist/client/managers/interfaces/ManagerInterfaces.d.ts +147 -0
- package/dist/client/managers/interfaces/ManagerInterfaces.d.ts.map +1 -0
- package/dist/client/managers/interfaces/ManagerInterfaces.js +6 -0
- package/dist/client/managers/interfaces/ManagerInterfaces.js.map +1 -0
- package/dist/config/Config.d.ts +30 -0
- package/dist/config/Config.d.ts.map +1 -1
- package/dist/config/Config.js +30 -0
- package/dist/config/Config.js.map +1 -1
- package/dist/config/ConfigurationSchema.d.ts +75 -198
- package/dist/config/ConfigurationSchema.d.ts.map +1 -1
- package/dist/config/ConfigurationSchema.js +17 -17
- package/dist/config/ConfigurationSchema.js.map +1 -1
- package/dist/config/ServerConfiguration.d.ts +2 -2
- package/dist/config/ServerConfiguration.d.ts.map +1 -1
- package/dist/config/ServerConfiguration.js +15 -13
- package/dist/config/ServerConfiguration.js.map +1 -1
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +11 -0
- package/dist/config/index.js.map +1 -0
- package/dist/docs/DocumentationGenerator.js +2 -2
- package/dist/docs/DocumentationGenerator.js.map +1 -1
- package/dist/dxt-entry.js +3 -3
- package/dist/dxt-entry.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -37
- package/dist/index.js.map +1 -1
- package/dist/performance/MetricsCollector.d.ts.map +1 -1
- package/dist/performance/MetricsCollector.js +5 -4
- package/dist/performance/MetricsCollector.js.map +1 -1
- package/dist/security/AISecurityScanner.js +7 -7
- package/dist/security/AISecurityScanner.js.map +1 -1
- package/dist/security/AutomatedRemediation.d.ts.map +1 -1
- package/dist/security/AutomatedRemediation.js +11 -11
- package/dist/security/AutomatedRemediation.js.map +1 -1
- package/dist/security/InputValidator.d.ts +50 -126
- package/dist/security/InputValidator.d.ts.map +1 -1
- package/dist/security/InputValidator.js +9 -9
- package/dist/security/InputValidator.js.map +1 -1
- package/dist/security/SecurityCIPipeline.d.ts +47 -5
- package/dist/security/SecurityCIPipeline.d.ts.map +1 -1
- package/dist/security/SecurityCIPipeline.js +390 -49
- package/dist/security/SecurityCIPipeline.js.map +1 -1
- package/dist/security/SecurityConfigManager.js +10 -10
- package/dist/security/SecurityConfigManager.js.map +1 -1
- package/dist/security/SecurityMonitoring.js +4 -4
- package/dist/security/SecurityMonitoring.js.map +1 -1
- package/dist/security/SecurityReviewer.d.ts.map +1 -1
- package/dist/security/SecurityReviewer.js +13 -6
- package/dist/security/SecurityReviewer.js.map +1 -1
- package/dist/security/index.js +3 -3
- package/dist/security/index.js.map +1 -1
- package/dist/server/ConnectionTester.js +5 -5
- package/dist/server/ConnectionTester.js.map +1 -1
- package/dist/server/ToolRegistry.d.ts +2 -2
- package/dist/server/ToolRegistry.d.ts.map +1 -1
- package/dist/server/ToolRegistry.js +7 -6
- package/dist/server/ToolRegistry.js.map +1 -1
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +9 -0
- package/dist/server/index.js.map +1 -0
- package/dist/tools/BaseToolManager.d.ts.map +1 -1
- package/dist/tools/BaseToolManager.js +11 -11
- package/dist/tools/BaseToolManager.js.map +1 -1
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +7 -7
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +14 -14
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/media.d.ts.map +1 -1
- package/dist/tools/media.js +14 -11
- package/dist/tools/media.js.map +1 -1
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +12 -12
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/performance.d.ts.map +1 -1
- package/dist/tools/performance.js +13 -11
- package/dist/tools/performance.js.map +1 -1
- package/dist/tools/posts/PostHandlers.d.ts.map +1 -1
- package/dist/tools/posts/PostHandlers.js +16 -16
- package/dist/tools/posts/PostHandlers.js.map +1 -1
- package/dist/tools/posts/PostToolDefinitions.d.ts.map +1 -1
- package/dist/tools/posts/index.d.ts.map +1 -1
- package/dist/tools/seo/BulkOperations.d.ts +113 -0
- package/dist/tools/seo/BulkOperations.d.ts.map +1 -0
- package/dist/tools/seo/BulkOperations.js +398 -0
- package/dist/tools/seo/BulkOperations.js.map +1 -0
- package/dist/tools/seo/SEOHandlers.d.ts +55 -0
- package/dist/tools/seo/SEOHandlers.d.ts.map +1 -0
- package/dist/tools/seo/SEOHandlers.js +255 -0
- package/dist/tools/seo/SEOHandlers.js.map +1 -0
- package/dist/tools/seo/SEOToolDefinitions.d.ts +59 -0
- package/dist/tools/seo/SEOToolDefinitions.d.ts.map +1 -0
- package/dist/tools/seo/SEOToolDefinitions.js +385 -0
- package/dist/tools/seo/SEOToolDefinitions.js.map +1 -0
- package/dist/tools/seo/SEOTools.d.ts +203 -0
- package/dist/tools/seo/SEOTools.d.ts.map +1 -0
- package/dist/tools/seo/SEOTools.js +708 -0
- package/dist/tools/seo/SEOTools.js.map +1 -0
- package/dist/tools/seo/analyzers/ContentAnalyzer.d.ts +94 -0
- package/dist/tools/seo/analyzers/ContentAnalyzer.d.ts.map +1 -0
- package/dist/tools/seo/analyzers/ContentAnalyzer.js +402 -0
- package/dist/tools/seo/analyzers/ContentAnalyzer.js.map +1 -0
- package/dist/tools/seo/auditors/SiteAuditor.d.ts +121 -0
- package/dist/tools/seo/auditors/SiteAuditor.d.ts.map +1 -0
- package/dist/tools/seo/auditors/SiteAuditor.js +600 -0
- package/dist/tools/seo/auditors/SiteAuditor.js.map +1 -0
- package/dist/tools/seo/generators/MetaGenerator.d.ts +128 -0
- package/dist/tools/seo/generators/MetaGenerator.d.ts.map +1 -0
- package/dist/tools/seo/generators/MetaGenerator.js +547 -0
- package/dist/tools/seo/generators/MetaGenerator.js.map +1 -0
- package/dist/tools/seo/generators/SchemaGenerator.d.ts +204 -0
- package/dist/tools/seo/generators/SchemaGenerator.d.ts.map +1 -0
- package/dist/tools/seo/generators/SchemaGenerator.js +670 -0
- package/dist/tools/seo/generators/SchemaGenerator.js.map +1 -0
- package/dist/tools/seo/index.d.ts +17 -0
- package/dist/tools/seo/index.d.ts.map +1 -0
- package/dist/tools/seo/index.js +18 -0
- package/dist/tools/seo/index.js.map +1 -0
- package/dist/tools/seo/optimizers/InternalLinkingSuggester.d.ts +186 -0
- package/dist/tools/seo/optimizers/InternalLinkingSuggester.d.ts.map +1 -0
- package/dist/tools/seo/optimizers/InternalLinkingSuggester.js +683 -0
- package/dist/tools/seo/optimizers/InternalLinkingSuggester.js.map +1 -0
- package/dist/tools/site.d.ts.map +1 -1
- package/dist/tools/site.js +12 -12
- package/dist/tools/site.js.map +1 -1
- package/dist/tools/taxonomies.d.ts.map +1 -1
- package/dist/tools/taxonomies.js +20 -20
- package/dist/tools/taxonomies.js.map +1 -1
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +12 -12
- package/dist/tools/users.js.map +1 -1
- package/dist/types/client.d.ts +8 -6
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client.js.map +1 -1
- package/dist/types/seo.d.ts +473 -0
- package/dist/types/seo.d.ts.map +1 -0
- package/dist/types/seo.js +94 -0
- package/dist/types/seo.js.map +1 -0
- package/dist/utils/enhancedError.js +1 -1
- package/dist/utils/enhancedError.js.map +1 -1
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/error.js +0 -1
- package/dist/utils/error.js.map +1 -1
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.js +3 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/toolWrapper.d.ts +2 -2
- package/dist/utils/toolWrapper.js +8 -8
- package/dist/utils/toolWrapper.js.map +1 -1
- package/dist/utils/validation/core.d.ts.map +1 -1
- package/dist/utils/validation/core.js.map +1 -1
- package/dist/utils/validation/index.d.ts.map +1 -1
- package/dist/utils/validation/index.js.map +1 -1
- package/dist/utils/validation/network.js +3 -3
- package/dist/utils/validation/network.js.map +1 -1
- package/dist/utils/validation/rateLimit.js.map +1 -1
- package/dist/utils/validation/security.js.map +1 -1
- package/dist/utils/validation/wordpress.js.map +1 -1
- package/dist/utils/version.d.ts +144 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +318 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +21 -55
- package/src/cache/CacheInvalidation.ts +183 -20
- package/src/cache/HttpCacheWrapper.ts +8 -5
- package/src/cache/SEOCacheManager.ts +330 -0
- package/src/cache/__tests__/CacheInvalidation.test.ts +6 -11
- package/src/cache/__tests__/CachedWordPressClient.test.ts +37 -62
- package/src/client/SEOWordPressClient.ts +876 -0
- package/src/client/api.ts +50 -21
- package/src/client/auth.ts +19 -19
- package/src/client/index.ts +16 -0
- package/src/client/managers/AuthManager.ts +175 -0
- package/src/client/managers/AuthenticationManager.ts +16 -14
- package/src/client/managers/BaseManager.ts +24 -5
- package/src/client/managers/ComposedAuthenticationManager.ts +409 -0
- package/src/client/managers/ComposedManagerFactory.ts +231 -0
- package/src/client/managers/ComposedRequestManager.ts +336 -0
- package/src/client/managers/JWTAuthImplementation.ts +326 -0
- package/src/client/managers/ManagersIndex.ts +6 -0
- package/src/client/managers/RequestManager.ts +9 -7
- package/src/client/managers/composed/MigrationAdapter.ts +263 -0
- package/src/client/managers/composed/index.ts +47 -0
- package/src/client/managers/implementations/ConfigurationProviderImpl.ts +52 -0
- package/src/client/managers/implementations/ErrorHandlerImpl.ts +102 -0
- package/src/client/managers/implementations/ParameterValidatorImpl.ts +221 -0
- package/src/client/managers/interfaces/ManagerInterfaces.ts +171 -0
- package/src/config/Config.ts +63 -0
- package/src/config/ConfigurationSchema.ts +17 -17
- package/src/config/ServerConfiguration.ts +18 -16
- package/src/config/index.ts +13 -0
- package/src/docs/DocumentationGenerator.ts +2 -2
- package/src/dxt-entry.ts +3 -3
- package/src/index.ts +43 -43
- package/src/performance/MetricsCollector.ts +15 -11
- package/src/security/AISecurityScanner.ts +7 -7
- package/src/security/AutomatedRemediation.ts +13 -11
- package/src/security/InputValidator.ts +10 -9
- package/src/security/SecurityCIPipeline.ts +494 -56
- package/src/security/SecurityConfigManager.ts +10 -10
- package/src/security/SecurityMonitoring.ts +5 -5
- package/src/security/SecurityReviewer.ts +13 -6
- package/src/security/index.ts +3 -3
- package/src/server/ConnectionTester.ts +5 -5
- package/src/server/ToolRegistry.ts +9 -8
- package/src/server/index.ts +10 -0
- package/src/tools/BaseToolManager.ts +55 -83
- package/src/tools/auth.ts +21 -12
- package/src/tools/comments.ts +23 -19
- package/src/tools/index.ts +1 -0
- package/src/tools/media.ts +23 -20
- package/src/tools/pages.ts +20 -13
- package/src/tools/performance.ts +101 -32
- package/src/tools/posts/PostHandlers.ts +23 -23
- package/src/tools/posts/PostToolDefinitions.ts +1 -1
- package/src/tools/posts/index.ts +2 -2
- package/src/tools/seo/BulkOperations.ts +557 -0
- package/src/tools/seo/SEOHandlers.ts +296 -0
- package/src/tools/seo/SEOToolDefinitions.ts +402 -0
- package/src/tools/seo/SEOTools.ts +871 -0
- package/src/tools/seo/analyzers/ContentAnalyzer.ts +493 -0
- package/src/tools/seo/auditors/SiteAuditor.ts +787 -0
- package/src/tools/seo/generators/MetaGenerator.ts +694 -0
- package/src/tools/seo/generators/SchemaGenerator.ts +955 -0
- package/src/tools/seo/index.ts +47 -0
- package/src/tools/seo/optimizers/InternalLinkingSuggester.ts +934 -0
- package/src/tools/site.ts +27 -26
- package/src/tools/taxonomies.ts +29 -25
- package/src/tools/users.ts +20 -13
- package/src/types/client.ts +8 -6
- package/src/types/seo.ts +546 -0
- package/src/utils/enhancedError.ts +1 -1
- package/src/utils/error.ts +1 -2
- package/src/utils/index.ts +23 -0
- package/src/utils/logger.ts +3 -3
- package/src/utils/toolWrapper.ts +10 -10
- package/src/utils/validation/core.ts +2 -2
- package/src/utils/validation/index.ts +2 -2
- package/src/utils/validation/network.ts +5 -5
- package/src/utils/validation/rateLimit.ts +1 -1
- package/src/utils/validation/security.ts +1 -1
- package/src/utils/validation/wordpress.ts +1 -1
- package/src/utils/version.ts +402 -0
|
@@ -247,7 +247,7 @@ const SecurityPolicySchema = z.object({
|
|
|
247
247
|
paths: z.array(z.string()).optional(),
|
|
248
248
|
userRoles: z.array(z.string()).optional(),
|
|
249
249
|
}),
|
|
250
|
-
parameters: z.record(z.unknown()),
|
|
250
|
+
parameters: z.record(z.string(), z.unknown()),
|
|
251
251
|
exceptions: z.array(z.string()),
|
|
252
252
|
}),
|
|
253
253
|
),
|
|
@@ -287,7 +287,7 @@ export class SecurityConfigManager {
|
|
|
287
287
|
|
|
288
288
|
logger.info("Loaded configurations and policies", {
|
|
289
289
|
configurationCount: this.configurations.size,
|
|
290
|
-
policyCount: this.policies.size
|
|
290
|
+
policyCount: this.policies.size,
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
|
|
@@ -309,8 +309,8 @@ export class SecurityConfigManager {
|
|
|
309
309
|
// Validate policy
|
|
310
310
|
try {
|
|
311
311
|
SecurityPolicySchema.parse(policy);
|
|
312
|
-
} catch (
|
|
313
|
-
throw new SecurityValidationError("Invalid security policy", [{ message: String(
|
|
312
|
+
} catch (_error) {
|
|
313
|
+
throw new SecurityValidationError("Invalid security policy", [{ message: String(_error) }]);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
this.policies.set(policy.id, policy);
|
|
@@ -342,8 +342,8 @@ export class SecurityConfigManager {
|
|
|
342
342
|
// Validate updated policy
|
|
343
343
|
try {
|
|
344
344
|
SecurityPolicySchema.parse(updatedPolicy);
|
|
345
|
-
} catch (
|
|
346
|
-
throw new SecurityValidationError("Invalid policy update", [{ message: String(
|
|
345
|
+
} catch (_error) {
|
|
346
|
+
throw new SecurityValidationError("Invalid policy update", [{ message: String(_error) }]);
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
this.policies.set(policyId, updatedPolicy);
|
|
@@ -786,8 +786,8 @@ export class SecurityConfigManager {
|
|
|
786
786
|
await fs.unlink(filePath);
|
|
787
787
|
logger.info(`Deleted policy: ${policy.name}`, { policyId });
|
|
788
788
|
return true;
|
|
789
|
-
} catch (
|
|
790
|
-
logger.warn("Failed to delete policy file", {
|
|
789
|
+
} catch (_error) {
|
|
790
|
+
logger.warn("Failed to delete policy file", { _error });
|
|
791
791
|
return false;
|
|
792
792
|
}
|
|
793
793
|
}
|
|
@@ -826,8 +826,8 @@ export class SecurityConfigManager {
|
|
|
826
826
|
|
|
827
827
|
logger.info(`Imported configuration for environment: ${config.environment}`, { environment: config.environment });
|
|
828
828
|
return config;
|
|
829
|
-
} catch (
|
|
830
|
-
throw new SecurityValidationError("Failed to import configuration", [{ message: String(
|
|
829
|
+
} catch (_error) {
|
|
830
|
+
throw new SecurityValidationError("Failed to import configuration", [{ message: String(_error) }]);
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
}
|
|
@@ -282,10 +282,10 @@ export class SecurityMonitor extends EventEmitter {
|
|
|
282
282
|
|
|
283
283
|
action.result = "success";
|
|
284
284
|
action.details += " - executed successfully";
|
|
285
|
-
} catch (
|
|
285
|
+
} catch (_error) {
|
|
286
286
|
action.result = "failure";
|
|
287
|
-
action.details += ` - failed: ${
|
|
288
|
-
logger.error(`Action ${type} failed`, { type,
|
|
287
|
+
action.details += ` - failed: ${_error instanceof Error ? _error.message : String(_error)}`;
|
|
288
|
+
logger.error(`Action ${type} failed`, { type, _error });
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
return action;
|
|
@@ -614,9 +614,9 @@ export class SecurityMonitor extends EventEmitter {
|
|
|
614
614
|
/**
|
|
615
615
|
* Group array by property
|
|
616
616
|
*/
|
|
617
|
-
private groupBy(array:
|
|
617
|
+
private groupBy(array: SecurityEvent[], property: string): Record<string, number> {
|
|
618
618
|
return array.reduce<Record<string, number>>((acc, item) => {
|
|
619
|
-
const key = (item
|
|
619
|
+
const key = String((item as unknown as Record<string, unknown>)[property]) || "unknown";
|
|
620
620
|
acc[key] = (acc[key] || 0) + 1;
|
|
621
621
|
return acc;
|
|
622
622
|
}, {});
|
|
@@ -381,9 +381,13 @@ export class SecurityReviewer {
|
|
|
381
381
|
logger.info("Review completed", { filePath, findingsCount: findings.length, reviewId });
|
|
382
382
|
|
|
383
383
|
return result;
|
|
384
|
-
} catch (
|
|
385
|
-
logger.error("Review failed", {
|
|
386
|
-
|
|
384
|
+
} catch (_error) {
|
|
385
|
+
logger.error("Review failed", {
|
|
386
|
+
filePath,
|
|
387
|
+
reviewId,
|
|
388
|
+
_error: _error instanceof Error ? _error.message : String(_error),
|
|
389
|
+
});
|
|
390
|
+
throw new SecurityValidationError("Security review failed", [{ message: String(_error) }]);
|
|
387
391
|
}
|
|
388
392
|
}
|
|
389
393
|
|
|
@@ -422,9 +426,12 @@ export class SecurityReviewer {
|
|
|
422
426
|
}
|
|
423
427
|
|
|
424
428
|
return results;
|
|
425
|
-
} catch (
|
|
426
|
-
logger.error("Directory review failed", {
|
|
427
|
-
|
|
429
|
+
} catch (_error) {
|
|
430
|
+
logger.error("Directory review failed", {
|
|
431
|
+
dirPath,
|
|
432
|
+
_error: _error instanceof Error ? _error.message : String(_error),
|
|
433
|
+
});
|
|
434
|
+
throw new SecurityValidationError("Directory review failed", [{ message: String(_error) }]);
|
|
428
435
|
}
|
|
429
436
|
}
|
|
430
437
|
|
package/src/security/index.ts
CHANGED
|
@@ -107,11 +107,11 @@ export class SecuritySystem {
|
|
|
107
107
|
|
|
108
108
|
this.initialized = true;
|
|
109
109
|
logger.info("Security system initialized successfully");
|
|
110
|
-
} catch (
|
|
110
|
+
} catch (_error) {
|
|
111
111
|
logger.error("Security system initialization failed", {
|
|
112
|
-
|
|
112
|
+
_error: _error instanceof Error ? _error.message : String(_error),
|
|
113
113
|
});
|
|
114
|
-
throw new SecurityValidationError("Security system initialization failed", [{ message: String(
|
|
114
|
+
throw new SecurityValidationError("Security system initialization failed", [{ message: String(_error) }]);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -59,15 +59,15 @@ export class ConnectionTester {
|
|
|
59
59
|
const duration = Date.now() - startTime;
|
|
60
60
|
this.logger.info("Connection successful", { siteId, duration: `${duration}ms` });
|
|
61
61
|
results.push({ siteId, success: true });
|
|
62
|
-
} catch (
|
|
62
|
+
} catch (_error) {
|
|
63
63
|
const duration = Date.now() - startTime;
|
|
64
|
-
const errorMessage = getErrorMessage(
|
|
64
|
+
const errorMessage = getErrorMessage(_error);
|
|
65
65
|
|
|
66
66
|
this.logger.warn("Connection failed", {
|
|
67
67
|
siteId,
|
|
68
68
|
error: errorMessage,
|
|
69
69
|
duration: `${duration}ms`,
|
|
70
|
-
isAuthError: ConnectionTester.isAuthenticationError(
|
|
70
|
+
isAuthError: ConnectionTester.isAuthenticationError(_error),
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
results.push({ siteId, success: false, error: errorMessage });
|
|
@@ -122,10 +122,10 @@ export class ConnectionTester {
|
|
|
122
122
|
|
|
123
123
|
this.logger.debug("Health check passed", { siteId });
|
|
124
124
|
return true;
|
|
125
|
-
} catch (
|
|
125
|
+
} catch (_error) {
|
|
126
126
|
this.logger.warn("Health check failed", {
|
|
127
127
|
siteId,
|
|
128
|
-
|
|
128
|
+
_error: getErrorMessage(_error),
|
|
129
129
|
});
|
|
130
130
|
return false;
|
|
131
131
|
}
|
|
@@ -26,8 +26,9 @@ export interface ToolDefinition {
|
|
|
26
26
|
* Handles tool registration, parameter validation, and execution
|
|
27
27
|
*/
|
|
28
28
|
export class ToolRegistry {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// Exposed for tests that assert presence of these fields
|
|
30
|
+
public server: McpServer;
|
|
31
|
+
public wordpressClients: Map<string, WordPressClient>;
|
|
31
32
|
|
|
32
33
|
constructor(server: McpServer, wordpressClients: Map<string, WordPressClient>) {
|
|
33
34
|
this.server = server;
|
|
@@ -141,8 +142,8 @@ export class ToolRegistry {
|
|
|
141
142
|
},
|
|
142
143
|
],
|
|
143
144
|
};
|
|
144
|
-
} catch (
|
|
145
|
-
if (this.isAuthenticationError(
|
|
145
|
+
} catch (_error) {
|
|
146
|
+
if (this.isAuthenticationError(_error)) {
|
|
146
147
|
return {
|
|
147
148
|
content: [
|
|
148
149
|
{
|
|
@@ -155,12 +156,12 @@ export class ToolRegistry {
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
// Handle enhanced errors with suggestions
|
|
158
|
-
if (
|
|
159
|
+
if (_error instanceof EnhancedError) {
|
|
159
160
|
return {
|
|
160
161
|
content: [
|
|
161
162
|
{
|
|
162
163
|
type: "text" as const,
|
|
163
|
-
text:
|
|
164
|
+
text: _error.toString(),
|
|
164
165
|
},
|
|
165
166
|
],
|
|
166
167
|
isError: true,
|
|
@@ -171,7 +172,7 @@ export class ToolRegistry {
|
|
|
171
172
|
content: [
|
|
172
173
|
{
|
|
173
174
|
type: "text" as const,
|
|
174
|
-
text: `Error: ${getErrorMessage(
|
|
175
|
+
text: `Error: ${getErrorMessage(_error)}`,
|
|
175
176
|
},
|
|
176
177
|
],
|
|
177
178
|
isError: true,
|
|
@@ -223,7 +224,7 @@ export class ToolRegistry {
|
|
|
223
224
|
case "array":
|
|
224
225
|
return z.array(z.string());
|
|
225
226
|
case "object":
|
|
226
|
-
return z.record(z.unknown());
|
|
227
|
+
return z.record(z.string(), z.unknown());
|
|
227
228
|
default:
|
|
228
229
|
return z.string();
|
|
229
230
|
}
|
|
@@ -33,10 +33,10 @@ export class BaseToolUtils {
|
|
|
33
33
|
*/
|
|
34
34
|
static validateParams<T extends Record<string, unknown>>(
|
|
35
35
|
params: unknown,
|
|
36
|
-
rules: readonly ParameterValidationRule[]
|
|
36
|
+
rules: readonly ParameterValidationRule[],
|
|
37
37
|
): Result<T, Error> {
|
|
38
|
-
if (!params || typeof params !==
|
|
39
|
-
return createError(new ValidationError(
|
|
38
|
+
if (!params || typeof params !== "object" || Array.isArray(params)) {
|
|
39
|
+
return createError(new ValidationError("Parameters must be a non-null object", "params", params));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const typedParams = params as Record<string, unknown>;
|
|
@@ -48,11 +48,9 @@ export class BaseToolUtils {
|
|
|
48
48
|
|
|
49
49
|
// Check required fields
|
|
50
50
|
if (rule.required && (!exists || value === undefined || value === null)) {
|
|
51
|
-
errors.push(
|
|
52
|
-
rule.errorMessage || `Missing required parameter: ${rule.key}`,
|
|
53
|
-
|
|
54
|
-
value
|
|
55
|
-
));
|
|
51
|
+
errors.push(
|
|
52
|
+
new ValidationError(rule.errorMessage || `Missing required parameter: ${rule.key}`, rule.key, value),
|
|
53
|
+
);
|
|
56
54
|
continue;
|
|
57
55
|
}
|
|
58
56
|
|
|
@@ -63,21 +61,21 @@ export class BaseToolUtils {
|
|
|
63
61
|
|
|
64
62
|
// Type validation
|
|
65
63
|
if (rule.type && typeof value !== rule.type) {
|
|
66
|
-
errors.push(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
errors.push(
|
|
65
|
+
new ValidationError(
|
|
66
|
+
`Parameter ${rule.key} must be of type ${rule.type}, got ${typeof value}`,
|
|
67
|
+
rule.key,
|
|
68
|
+
value,
|
|
69
|
+
),
|
|
70
|
+
);
|
|
71
71
|
continue;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// Custom validation
|
|
75
75
|
if (rule.validator && !rule.validator(value)) {
|
|
76
|
-
errors.push(
|
|
77
|
-
rule.errorMessage || `Parameter ${rule.key} failed validation`,
|
|
78
|
-
|
|
79
|
-
value
|
|
80
|
-
));
|
|
76
|
+
errors.push(
|
|
77
|
+
new ValidationError(rule.errorMessage || `Parameter ${rule.key} failed validation`, rule.key, value),
|
|
78
|
+
);
|
|
81
79
|
continue;
|
|
82
80
|
}
|
|
83
81
|
|
|
@@ -85,12 +83,14 @@ export class BaseToolUtils {
|
|
|
85
83
|
if (rule.transformer) {
|
|
86
84
|
try {
|
|
87
85
|
typedParams[rule.key] = rule.transformer(value);
|
|
88
|
-
} catch (
|
|
89
|
-
errors.push(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
} catch (_error) {
|
|
87
|
+
errors.push(
|
|
88
|
+
new ValidationError(
|
|
89
|
+
`Failed to transform parameter ${rule.key}: ${getErrorMessage(_error)}`,
|
|
90
|
+
rule.key,
|
|
91
|
+
value,
|
|
92
|
+
),
|
|
93
|
+
);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -109,19 +109,11 @@ export class BaseToolUtils {
|
|
|
109
109
|
try {
|
|
110
110
|
const numId = Number(id);
|
|
111
111
|
if (!Number.isInteger(numId) || numId <= 0) {
|
|
112
|
-
return createError(new ValidationError(
|
|
113
|
-
`Invalid ${name}: must be a positive integer`,
|
|
114
|
-
name,
|
|
115
|
-
id
|
|
116
|
-
));
|
|
112
|
+
return createError(new ValidationError(`Invalid ${name}: must be a positive integer`, name, id));
|
|
117
113
|
}
|
|
118
114
|
return createSuccess(createWordPressId(numId));
|
|
119
|
-
} catch (
|
|
120
|
-
return createError(new ValidationError(
|
|
121
|
-
`Invalid ${name}: ${getErrorMessage(error)}`,
|
|
122
|
-
name,
|
|
123
|
-
id
|
|
124
|
-
));
|
|
115
|
+
} catch (_error) {
|
|
116
|
+
return createError(new ValidationError(`Invalid ${name}: ${getErrorMessage(_error)}`, name, id));
|
|
125
117
|
}
|
|
126
118
|
}
|
|
127
119
|
|
|
@@ -130,7 +122,7 @@ export class BaseToolUtils {
|
|
|
130
122
|
*/
|
|
131
123
|
static validateIds(ids: unknown[], name = "ids"): Result<readonly WordPressId[], Error> {
|
|
132
124
|
const validatedIds: WordPressId[] = [];
|
|
133
|
-
|
|
125
|
+
|
|
134
126
|
for (let i = 0; i < ids.length; i++) {
|
|
135
127
|
const result = this.validateId(ids[i], `${name}[${i}]`);
|
|
136
128
|
if (!result.success) {
|
|
@@ -138,7 +130,7 @@ export class BaseToolUtils {
|
|
|
138
130
|
}
|
|
139
131
|
validatedIds.push(result.data);
|
|
140
132
|
}
|
|
141
|
-
|
|
133
|
+
|
|
142
134
|
return createSuccess(validatedIds as readonly WordPressId[]);
|
|
143
135
|
}
|
|
144
136
|
|
|
@@ -148,13 +140,13 @@ export class BaseToolUtils {
|
|
|
148
140
|
static handleError(error: unknown, operation: string, context?: Record<string, unknown> | undefined): Error {
|
|
149
141
|
const errorMessage = getErrorMessage(error);
|
|
150
142
|
const enhancedMessage = `Error in ${operation}: ${errorMessage}`;
|
|
151
|
-
|
|
143
|
+
|
|
152
144
|
const enhancedError = new Error(enhancedMessage) as EnhancedError;
|
|
153
145
|
enhancedError.originalError = error;
|
|
154
146
|
enhancedError.operation = operation;
|
|
155
147
|
enhancedError.context = context;
|
|
156
148
|
enhancedError.timestamp = new Date();
|
|
157
|
-
|
|
149
|
+
|
|
158
150
|
return enhancedError;
|
|
159
151
|
}
|
|
160
152
|
|
|
@@ -162,18 +154,14 @@ export class BaseToolUtils {
|
|
|
162
154
|
* Generate cache keys with enhanced options
|
|
163
155
|
*/
|
|
164
156
|
static generateCacheKey(
|
|
165
|
-
operation: string,
|
|
157
|
+
operation: string,
|
|
166
158
|
params: DeepReadonly<Record<string, unknown>>,
|
|
167
|
-
options: CacheKeyOptions = {}
|
|
159
|
+
options: CacheKeyOptions = {},
|
|
168
160
|
): string {
|
|
169
|
-
const {
|
|
170
|
-
namespace = 'wp',
|
|
171
|
-
includeTimestamp = false,
|
|
172
|
-
customHasher
|
|
173
|
-
} = options;
|
|
161
|
+
const { namespace = "wp", includeTimestamp = false, customHasher } = options;
|
|
174
162
|
|
|
175
163
|
const site = params.site || "default";
|
|
176
|
-
|
|
164
|
+
|
|
177
165
|
let paramStr: string;
|
|
178
166
|
if (customHasher) {
|
|
179
167
|
paramStr = customHasher(params as Record<string, unknown>);
|
|
@@ -186,12 +174,12 @@ export class BaseToolUtils {
|
|
|
186
174
|
}
|
|
187
175
|
|
|
188
176
|
let cacheKey = `${namespace}:${site}:${operation}:${paramStr}`;
|
|
189
|
-
|
|
177
|
+
|
|
190
178
|
if (includeTimestamp) {
|
|
191
179
|
const timestamp = Math.floor(Date.now() / 1000);
|
|
192
180
|
cacheKey += `:${timestamp}`;
|
|
193
181
|
}
|
|
194
|
-
|
|
182
|
+
|
|
195
183
|
return cacheKey;
|
|
196
184
|
}
|
|
197
185
|
|
|
@@ -200,17 +188,17 @@ export class BaseToolUtils {
|
|
|
200
188
|
*/
|
|
201
189
|
static formatSuccessMessage(operation: string, details?: string, count?: number): string {
|
|
202
190
|
let message = operation;
|
|
203
|
-
|
|
191
|
+
|
|
204
192
|
if (count !== undefined) {
|
|
205
|
-
message += ` (${count} ${count === 1 ?
|
|
193
|
+
message += ` (${count} ${count === 1 ? "item" : "items"})`;
|
|
206
194
|
}
|
|
207
|
-
|
|
195
|
+
|
|
208
196
|
if (details) {
|
|
209
197
|
message += `: ${details}`;
|
|
210
198
|
} else {
|
|
211
199
|
message += " completed successfully";
|
|
212
200
|
}
|
|
213
|
-
|
|
201
|
+
|
|
214
202
|
return message;
|
|
215
203
|
}
|
|
216
204
|
|
|
@@ -218,7 +206,7 @@ export class BaseToolUtils {
|
|
|
218
206
|
* Validate string parameters with enhanced checks
|
|
219
207
|
*/
|
|
220
208
|
static validateString(
|
|
221
|
-
value: unknown,
|
|
209
|
+
value: unknown,
|
|
222
210
|
name: string,
|
|
223
211
|
options: {
|
|
224
212
|
readonly required?: boolean;
|
|
@@ -226,7 +214,7 @@ export class BaseToolUtils {
|
|
|
226
214
|
readonly maxLength?: number;
|
|
227
215
|
readonly pattern?: RegExp;
|
|
228
216
|
readonly allowEmpty?: boolean;
|
|
229
|
-
} = {}
|
|
217
|
+
} = {},
|
|
230
218
|
): Result<string, Error> {
|
|
231
219
|
const { required = true, minLength, maxLength, pattern, allowEmpty = false } = options;
|
|
232
220
|
|
|
@@ -234,10 +222,10 @@ export class BaseToolUtils {
|
|
|
234
222
|
if (required) {
|
|
235
223
|
return createError(new ValidationError(`${name} is required`, name, value));
|
|
236
224
|
}
|
|
237
|
-
return createSuccess(
|
|
225
|
+
return createSuccess("");
|
|
238
226
|
}
|
|
239
227
|
|
|
240
|
-
if (typeof value !==
|
|
228
|
+
if (typeof value !== "string") {
|
|
241
229
|
return createError(new ValidationError(`${name} must be a string`, name, value));
|
|
242
230
|
}
|
|
243
231
|
|
|
@@ -246,27 +234,15 @@ export class BaseToolUtils {
|
|
|
246
234
|
}
|
|
247
235
|
|
|
248
236
|
if (minLength !== undefined && value.length < minLength) {
|
|
249
|
-
return createError(new ValidationError(
|
|
250
|
-
`${name} must be at least ${minLength} characters long`,
|
|
251
|
-
name,
|
|
252
|
-
value
|
|
253
|
-
));
|
|
237
|
+
return createError(new ValidationError(`${name} must be at least ${minLength} characters long`, name, value));
|
|
254
238
|
}
|
|
255
239
|
|
|
256
240
|
if (maxLength !== undefined && value.length > maxLength) {
|
|
257
|
-
return createError(new ValidationError(
|
|
258
|
-
`${name} must be no more than ${maxLength} characters long`,
|
|
259
|
-
name,
|
|
260
|
-
value
|
|
261
|
-
));
|
|
241
|
+
return createError(new ValidationError(`${name} must be no more than ${maxLength} characters long`, name, value));
|
|
262
242
|
}
|
|
263
243
|
|
|
264
244
|
if (pattern && !pattern.test(value)) {
|
|
265
|
-
return createError(new ValidationError(
|
|
266
|
-
`${name} does not match required pattern`,
|
|
267
|
-
name,
|
|
268
|
-
value
|
|
269
|
-
));
|
|
245
|
+
return createError(new ValidationError(`${name} does not match required pattern`, name, value));
|
|
270
246
|
}
|
|
271
247
|
|
|
272
248
|
return createSuccess(value);
|
|
@@ -275,25 +251,21 @@ export class BaseToolUtils {
|
|
|
275
251
|
/**
|
|
276
252
|
* Type-safe parameter extraction
|
|
277
253
|
*/
|
|
278
|
-
static extractParam<T>(
|
|
279
|
-
params: DeepReadonly<Record<string, unknown>>,
|
|
280
|
-
key: string,
|
|
281
|
-
defaultValue?: T
|
|
282
|
-
): T | undefined {
|
|
254
|
+
static extractParam<T>(params: DeepReadonly<Record<string, unknown>>, key: string, defaultValue?: T): T | undefined {
|
|
283
255
|
const value = params[key];
|
|
284
|
-
return value !== undefined ? value as T : defaultValue;
|
|
256
|
+
return value !== undefined ? (value as T) : defaultValue;
|
|
285
257
|
}
|
|
286
258
|
|
|
287
259
|
/**
|
|
288
260
|
* Safe array extraction with type validation
|
|
289
261
|
*/
|
|
290
262
|
static extractArray<T>(
|
|
291
|
-
params: DeepReadonly<Record<string, unknown>>,
|
|
263
|
+
params: DeepReadonly<Record<string, unknown>>,
|
|
292
264
|
key: string,
|
|
293
|
-
itemValidator?: (item: unknown) => item is T
|
|
265
|
+
itemValidator?: (item: unknown) => item is T,
|
|
294
266
|
): readonly T[] {
|
|
295
267
|
const value = params[key];
|
|
296
|
-
|
|
268
|
+
|
|
297
269
|
if (!Array.isArray(value)) {
|
|
298
270
|
return [];
|
|
299
271
|
}
|
|
@@ -311,9 +283,9 @@ class ValidationError extends Error {
|
|
|
311
283
|
constructor(
|
|
312
284
|
message: string,
|
|
313
285
|
public readonly field: string,
|
|
314
|
-
public readonly value: unknown
|
|
286
|
+
public readonly value: unknown,
|
|
315
287
|
) {
|
|
316
288
|
super(message);
|
|
317
|
-
this.name =
|
|
289
|
+
this.name = "ValidationError";
|
|
318
290
|
}
|
|
319
291
|
}
|
package/src/tools/auth.ts
CHANGED
|
@@ -14,7 +14,14 @@ export class AuthTools {
|
|
|
14
14
|
public getTools(): Array<{
|
|
15
15
|
name: string;
|
|
16
16
|
description: string;
|
|
17
|
-
parameters?: Array<{
|
|
17
|
+
parameters?: Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
type?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
required?: boolean;
|
|
22
|
+
enum?: string[];
|
|
23
|
+
items?: unknown;
|
|
24
|
+
}>;
|
|
18
25
|
handler: (client: WordPressClient, params: Record<string, unknown>) => Promise<unknown>;
|
|
19
26
|
}> {
|
|
20
27
|
return [
|
|
@@ -94,8 +101,8 @@ export class AuthTools {
|
|
|
94
101
|
"Your WordPress connection is working properly.";
|
|
95
102
|
|
|
96
103
|
return { content };
|
|
97
|
-
} catch (
|
|
98
|
-
throw new Error(`Authentication test failed: ${getErrorMessage(
|
|
104
|
+
} catch (_error) {
|
|
105
|
+
throw new Error(`Authentication test failed: ${getErrorMessage(_error)}`);
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
|
|
@@ -126,8 +133,8 @@ export class AuthTools {
|
|
|
126
133
|
}
|
|
127
134
|
|
|
128
135
|
return { content };
|
|
129
|
-
} catch (
|
|
130
|
-
throw new Error(`Failed to get auth status: ${getErrorMessage(
|
|
136
|
+
} catch (_error) {
|
|
137
|
+
throw new Error(`Failed to get auth status: ${getErrorMessage(_error)}`);
|
|
131
138
|
}
|
|
132
139
|
}
|
|
133
140
|
|
|
@@ -138,11 +145,13 @@ export class AuthTools {
|
|
|
138
145
|
* @param params - The parameters for the tool request, including the new auth details.
|
|
139
146
|
* @returns A promise that resolves to an MCPToolResponse.
|
|
140
147
|
*/
|
|
141
|
-
public async handleSwitchAuthMethod(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
public async handleSwitchAuthMethod(client: WordPressClient, params: Record<string, unknown>): Promise<unknown> {
|
|
149
|
+
const {
|
|
150
|
+
method: _method,
|
|
151
|
+
username: _username,
|
|
152
|
+
password: _password,
|
|
153
|
+
jwt_token: _jwt_token,
|
|
154
|
+
} = params as {
|
|
146
155
|
method: AuthMethod;
|
|
147
156
|
username?: string;
|
|
148
157
|
password?: string;
|
|
@@ -154,8 +163,8 @@ export class AuthTools {
|
|
|
154
163
|
throw new Error(
|
|
155
164
|
"Dynamic authentication method switching is not currently supported. Please update your configuration file and restart the server.",
|
|
156
165
|
);
|
|
157
|
-
} catch (
|
|
158
|
-
throw new Error(`Failed to switch auth method: ${getErrorMessage(
|
|
166
|
+
} catch (_error) {
|
|
167
|
+
throw new Error(`Failed to switch auth method: ${getErrorMessage(_error)}`);
|
|
159
168
|
}
|
|
160
169
|
}
|
|
161
170
|
}
|