mcp-wordpress 2.4.2 → 2.5.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 +114 -48
- package/dist/ajv-patch.js +34 -0
- package/dist/cache/CacheInvalidation.d.ts +3 -1
- package/dist/cache/CacheInvalidation.d.ts.map +1 -1
- package/dist/cache/CacheInvalidation.js +10 -4
- package/dist/cache/CacheInvalidation.js.map +1 -1
- package/dist/cache/CacheManager.d.ts +3 -2
- package/dist/cache/CacheManager.d.ts.map +1 -1
- package/dist/cache/CacheManager.js +11 -3
- package/dist/cache/CacheManager.js.map +1 -1
- package/dist/cache/HttpCacheWrapper.d.ts +7 -6
- package/dist/cache/HttpCacheWrapper.d.ts.map +1 -1
- package/dist/cache/HttpCacheWrapper.js +8 -5
- package/dist/cache/HttpCacheWrapper.js.map +1 -1
- package/dist/cache/__tests__/HttpCacheWrapper.test.js +6 -5
- package/dist/cache/__tests__/HttpCacheWrapper.test.js.map +1 -1
- package/dist/cache/index.d.ts +3 -3
- package/dist/cache/index.d.ts.map +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/cache/index.js.map +1 -1
- package/dist/client/CachedWordPressClient.d.ts +23 -9
- package/dist/client/CachedWordPressClient.d.ts.map +1 -1
- package/dist/client/CachedWordPressClient.js +4 -1
- package/dist/client/CachedWordPressClient.js.map +1 -1
- package/dist/client/MockWordPressClient.d.ts +2 -1
- package/dist/client/MockWordPressClient.d.ts.map +1 -1
- package/dist/client/MockWordPressClient.js +3 -1
- package/dist/client/MockWordPressClient.js.map +1 -1
- package/dist/client/api.d.ts +17 -13
- package/dist/client/api.d.ts.map +1 -1
- package/dist/client/api.js +135 -30
- package/dist/client/api.js.map +1 -1
- package/dist/client/auth.d.ts.map +1 -1
- package/dist/client/auth.js +2 -3
- package/dist/client/auth.js.map +1 -1
- package/dist/client/managers/AuthenticationManager.d.ts +55 -2
- package/dist/client/managers/AuthenticationManager.d.ts.map +1 -1
- package/dist/client/managers/AuthenticationManager.js +269 -71
- package/dist/client/managers/AuthenticationManager.js.map +1 -1
- package/dist/client/managers/BaseManager.d.ts +3 -3
- package/dist/client/managers/BaseManager.d.ts.map +1 -1
- package/dist/client/managers/BaseManager.js +11 -5
- package/dist/client/managers/BaseManager.js.map +1 -1
- package/dist/client/managers/RequestManager.d.ts +2 -2
- package/dist/client/managers/RequestManager.d.ts.map +1 -1
- package/dist/client/managers/RequestManager.js +25 -12
- package/dist/client/managers/RequestManager.js.map +1 -1
- package/dist/config/Config.d.ts +155 -0
- package/dist/config/Config.d.ts.map +1 -0
- package/dist/config/Config.js +215 -0
- package/dist/config/Config.js.map +1 -0
- package/dist/config/ConfigurationSchema.d.ts +21 -21
- package/dist/config/ConfigurationSchema.d.ts.map +1 -1
- package/dist/config/ConfigurationSchema.js +19 -2
- package/dist/config/ConfigurationSchema.js.map +1 -1
- package/dist/config/ServerConfiguration.d.ts +2 -1
- package/dist/config/ServerConfiguration.d.ts.map +1 -1
- package/dist/config/ServerConfiguration.js +50 -41
- package/dist/config/ServerConfiguration.js.map +1 -1
- package/dist/docs/DocumentationGenerator.d.ts +9 -8
- package/dist/docs/DocumentationGenerator.d.ts.map +1 -1
- package/dist/docs/DocumentationGenerator.js +10 -7
- package/dist/docs/DocumentationGenerator.js.map +1 -1
- package/dist/docs/MarkdownFormatter.d.ts.map +1 -1
- package/dist/docs/MarkdownFormatter.js +3 -2
- package/dist/docs/MarkdownFormatter.js.map +1 -1
- package/dist/dxt-entry.cjs +81 -0
- package/dist/dxt-entry.js +15 -14
- package/dist/dxt-entry.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -21
- package/dist/index.js.map +1 -1
- package/dist/performance/MetricsCollector.d.ts +13 -7
- package/dist/performance/MetricsCollector.d.ts.map +1 -1
- package/dist/performance/MetricsCollector.js +69 -27
- package/dist/performance/MetricsCollector.js.map +1 -1
- package/dist/performance/PerformanceAnalytics.d.ts +8 -2
- package/dist/performance/PerformanceAnalytics.d.ts.map +1 -1
- package/dist/performance/PerformanceAnalytics.js +17 -47
- package/dist/performance/PerformanceAnalytics.js.map +1 -1
- package/dist/performance/PerformanceMonitor.d.ts +2 -1
- package/dist/performance/PerformanceMonitor.d.ts.map +1 -1
- package/dist/performance/PerformanceMonitor.js +12 -13
- package/dist/performance/PerformanceMonitor.js.map +1 -1
- package/dist/performance/index.d.ts +2 -2
- package/dist/performance/index.d.ts.map +1 -1
- package/dist/security/AISecurityScanner.d.ts +1 -0
- package/dist/security/AISecurityScanner.d.ts.map +1 -1
- package/dist/security/AISecurityScanner.js +22 -12
- package/dist/security/AISecurityScanner.js.map +1 -1
- package/dist/security/AutomatedRemediation.d.ts +4 -3
- package/dist/security/AutomatedRemediation.d.ts.map +1 -1
- package/dist/security/AutomatedRemediation.js +46 -15
- package/dist/security/AutomatedRemediation.js.map +1 -1
- package/dist/security/InputValidator.d.ts +13 -9
- package/dist/security/InputValidator.d.ts.map +1 -1
- package/dist/security/InputValidator.js +4 -2
- package/dist/security/InputValidator.js.map +1 -1
- package/dist/security/SecurityCIPipeline.d.ts +1 -1
- package/dist/security/SecurityCIPipeline.d.ts.map +1 -1
- package/dist/security/SecurityCIPipeline.js +38 -29
- package/dist/security/SecurityCIPipeline.js.map +1 -1
- package/dist/security/SecurityConfig.d.ts +3 -3
- package/dist/security/SecurityConfig.d.ts.map +1 -1
- package/dist/security/SecurityConfig.js +13 -9
- package/dist/security/SecurityConfig.js.map +1 -1
- package/dist/security/SecurityConfigManager.d.ts +2 -2
- package/dist/security/SecurityConfigManager.d.ts.map +1 -1
- package/dist/security/SecurityConfigManager.js +20 -15
- package/dist/security/SecurityConfigManager.js.map +1 -1
- package/dist/security/SecurityMonitoring.d.ts +2 -2
- package/dist/security/SecurityMonitoring.d.ts.map +1 -1
- package/dist/security/SecurityMonitoring.js +19 -17
- package/dist/security/SecurityMonitoring.js.map +1 -1
- package/dist/security/SecurityReviewer.d.ts.map +1 -1
- package/dist/security/SecurityReviewer.js +10 -7
- package/dist/security/SecurityReviewer.js.map +1 -1
- package/dist/security/index.d.ts +24 -23
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +52 -23
- package/dist/security/index.js.map +1 -1
- package/dist/server/ConnectionTester.d.ts +12 -4
- package/dist/server/ConnectionTester.d.ts.map +1 -1
- package/dist/server/ConnectionTester.js +96 -22
- 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 +10 -5
- package/dist/server/ToolRegistry.js.map +1 -1
- package/dist/tools/BaseToolManager.d.ts +47 -11
- package/dist/tools/BaseToolManager.d.ts.map +1 -1
- package/dist/tools/BaseToolManager.js +168 -29
- package/dist/tools/BaseToolManager.js.map +1 -1
- package/dist/tools/auth.d.ts +16 -10
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +3 -2
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/cache.d.ts +30 -30
- package/dist/tools/cache.d.ts.map +1 -1
- package/dist/tools/cache.js +1 -6
- package/dist/tools/cache.js.map +1 -1
- package/dist/tools/comments.d.ts +20 -20
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +16 -9
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/media.d.ts +18 -16
- package/dist/tools/media.d.ts.map +1 -1
- package/dist/tools/media.js +16 -15
- package/dist/tools/media.js.map +1 -1
- package/dist/tools/pages.d.ts +19 -17
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +16 -12
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/performance.d.ts +11 -1
- package/dist/tools/performance.d.ts.map +1 -1
- package/dist/tools/performance.js +67 -34
- package/dist/tools/performance.js.map +1 -1
- package/dist/tools/posts/PostHandlers.d.ts +46 -0
- package/dist/tools/posts/PostHandlers.d.ts.map +1 -0
- package/dist/tools/posts/PostHandlers.js +400 -0
- package/dist/tools/posts/PostHandlers.js.map +1 -0
- package/dist/tools/posts/PostToolDefinitions.d.ts +37 -0
- package/dist/tools/posts/PostToolDefinitions.d.ts.map +1 -0
- package/dist/tools/posts/PostToolDefinitions.js +236 -0
- package/dist/tools/posts/PostToolDefinitions.js.map +1 -0
- package/dist/tools/posts/index.d.ts +138 -0
- package/dist/tools/posts/index.d.ts.map +1 -0
- package/dist/tools/posts/index.js +163 -0
- package/dist/tools/posts/index.js.map +1 -0
- package/dist/tools/posts.d.ts +10 -246
- package/dist/tools/posts.d.ts.map +1 -1
- package/dist/tools/posts.js +11 -723
- package/dist/tools/posts.js.map +1 -1
- package/dist/tools/site.d.ts +19 -18
- package/dist/tools/site.d.ts.map +1 -1
- package/dist/tools/site.js +14 -10
- package/dist/tools/site.js.map +1 -1
- package/dist/tools/taxonomies.d.ts +23 -24
- package/dist/tools/taxonomies.d.ts.map +1 -1
- package/dist/tools/taxonomies.js +24 -18
- package/dist/tools/taxonomies.js.map +1 -1
- package/dist/tools/users.d.ts +20 -15
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +12 -8
- package/dist/tools/users.js.map +1 -1
- package/dist/types/client.d.ts +48 -41
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/client.js +30 -5
- package/dist/types/client.js.map +1 -1
- package/dist/types/enhanced.d.ts +237 -0
- package/dist/types/enhanced.d.ts.map +1 -0
- package/dist/types/enhanced.js +49 -0
- package/dist/types/enhanced.js.map +1 -0
- package/dist/types/index.d.ts +15 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/mcp.d.ts +12 -12
- package/dist/types/mcp.d.ts.map +1 -1
- package/dist/types/requests.d.ts +322 -0
- package/dist/types/requests.d.ts.map +1 -0
- package/dist/types/requests.js +8 -0
- package/dist/types/requests.js.map +1 -0
- package/dist/types/tools.d.ts +506 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +8 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/wordpress.d.ts +43 -15
- package/dist/types/wordpress.d.ts.map +1 -1
- package/dist/types/wordpress.js +8 -1
- package/dist/types/wordpress.js.map +1 -1
- package/dist/utils/debug.d.ts +19 -11
- package/dist/utils/debug.d.ts.map +1 -1
- package/dist/utils/debug.js +46 -10
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/enhancedError.d.ts +8 -8
- package/dist/utils/enhancedError.d.ts.map +1 -1
- package/dist/utils/enhancedError.js.map +1 -1
- package/dist/utils/error.d.ts +2 -4
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/error.js +42 -5
- package/dist/utils/error.js.map +1 -1
- package/dist/utils/logger.d.ts +106 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +280 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/streaming.d.ts +9 -9
- package/dist/utils/streaming.d.ts.map +1 -1
- package/dist/utils/streaming.js +71 -52
- package/dist/utils/streaming.js.map +1 -1
- package/dist/utils/toolWrapper.d.ts +9 -7
- package/dist/utils/toolWrapper.d.ts.map +1 -1
- package/dist/utils/toolWrapper.js.map +1 -1
- package/dist/utils/validation/core.d.ts +21 -0
- package/dist/utils/validation/core.d.ts.map +1 -0
- package/dist/utils/validation/core.js +71 -0
- package/dist/utils/validation/core.js.map +1 -0
- package/dist/utils/validation/index.d.ts +25 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +29 -0
- package/dist/utils/validation/index.js.map +1 -0
- package/dist/utils/validation/network.d.ts +19 -0
- package/dist/utils/validation/network.d.ts.map +1 -0
- package/dist/utils/validation/network.js +93 -0
- package/dist/utils/validation/network.js.map +1 -0
- package/dist/utils/validation/rateLimit.d.ts +21 -0
- package/dist/utils/validation/rateLimit.d.ts.map +1 -0
- package/dist/utils/validation/rateLimit.js +43 -0
- package/dist/utils/validation/rateLimit.js.map +1 -0
- package/dist/utils/validation/security.d.ts +29 -0
- package/dist/utils/validation/security.d.ts.map +1 -0
- package/dist/utils/validation/security.js +327 -0
- package/dist/utils/validation/security.js.map +1 -0
- package/dist/utils/validation/wordpress.d.ts +31 -0
- package/dist/utils/validation/wordpress.d.ts.map +1 -0
- package/dist/utils/validation/wordpress.js +146 -0
- package/dist/utils/validation/wordpress.js.map +1 -0
- package/dist/utils/validation.d.ts +13 -82
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +25 -343
- package/dist/utils/validation.js.map +1 -1
- package/docs/BADGE_UPDATES.md +132 -0
- package/docs/CI_CD_IMPROVEMENTS.md +191 -0
- package/docs/INCREMENTAL_COVERAGE.md +183 -0
- package/docs/api/README.md +3 -1
- package/docs/api/openapi.json +5 -1
- package/docs/api/summary.json +1 -1
- package/docs/api/tools/wp_create_post.md +12 -14
- package/docs/examples/claude-desktop-config.md +1 -1
- package/docs/examples/docker-production.md +100 -93
- package/docs/examples/multi-site-setup.md +5 -4
- package/docs/examples/single-site-setup.md +3 -4
- package/docs/examples/use-case-workflows.md +4 -5
- package/docs/integrations/claude-desktop.md +31 -31
- package/docs/integrations/cline.md +4 -4
- package/docs/integrations/vs-code.md +9 -8
- package/docs/user-guides/SMITHERY_SETUP.md +10 -10
- package/package.json +44 -25
- package/src/cache/CacheInvalidation.ts +12 -5
- package/src/cache/CacheManager.ts +18 -15
- package/src/cache/HttpCacheWrapper.ts +30 -59
- package/src/cache/__tests__/HttpCacheWrapper.test.ts +6 -5
- package/src/cache/index.ts +3 -14
- package/src/client/CachedWordPressClient.ts +32 -30
- package/src/client/MockWordPressClient.ts +4 -2
- package/src/client/api.ts +186 -64
- package/src/client/auth.ts +15 -40
- package/src/client/managers/AuthenticationManager.ts +337 -77
- package/src/client/managers/BaseManager.ts +18 -30
- package/src/client/managers/RequestManager.ts +39 -44
- package/src/config/Config.ts +308 -0
- package/src/config/ConfigurationSchema.ts +23 -2
- package/src/config/ServerConfiguration.ts +51 -47
- package/src/docs/DocumentationGenerator.ts +50 -39
- package/src/docs/MarkdownFormatter.ts +19 -29
- package/src/dxt-entry.cjs +26 -16
- package/src/dxt-entry.ts +17 -27
- package/src/index.ts +42 -28
- package/src/performance/MetricsCollector.ts +108 -86
- package/src/performance/PerformanceAnalytics.ts +69 -164
- package/src/performance/PerformanceMonitor.ts +32 -47
- package/src/performance/index.ts +2 -10
- package/src/security/AISecurityScanner.ts +22 -12
- package/src/security/AutomatedRemediation.ts +49 -18
- package/src/security/InputValidator.ts +9 -6
- package/src/security/SecurityCIPipeline.ts +53 -37
- package/src/security/SecurityConfig.ts +22 -22
- package/src/security/SecurityConfigManager.ts +23 -19
- package/src/security/SecurityMonitoring.ts +24 -21
- package/src/security/SecurityReviewer.ts +10 -7
- package/src/security/index.ts +64 -29
- package/src/server/ConnectionTester.ts +120 -31
- package/src/server/ToolRegistry.ts +31 -21
- package/src/tools/BaseToolManager.ts +286 -33
- package/src/tools/auth.ts +20 -8
- package/src/tools/cache.ts +5 -15
- package/src/tools/comments.ts +34 -48
- package/src/tools/media.ts +41 -53
- package/src/tools/pages.ts +32 -54
- package/src/tools/performance.ts +141 -176
- package/src/tools/posts/PostHandlers.ts +474 -0
- package/src/tools/posts/PostToolDefinitions.ts +250 -0
- package/src/tools/posts/index.ts +192 -0
- package/src/tools/posts.ts +24 -780
- package/src/tools/site.ts +34 -19
- package/src/tools/taxonomies.ts +41 -57
- package/src/tools/users.ts +28 -16
- package/src/types/client.ts +114 -138
- package/src/types/enhanced.ts +318 -0
- package/src/types/index.ts +51 -30
- package/src/types/mcp.ts +20 -42
- package/src/types/requests.ts +378 -0
- package/src/types/tools.ts +608 -0
- package/src/types/wordpress.ts +56 -34
- package/src/utils/debug.ts +77 -59
- package/src/utils/enhancedError.ts +8 -8
- package/src/utils/error.ts +53 -31
- package/src/utils/logger.ts +351 -0
- package/src/utils/streaming.ts +86 -68
- package/src/utils/toolWrapper.ts +10 -12
- package/src/utils/validation/core.ts +108 -0
- package/src/utils/validation/index.ts +36 -0
- package/src/utils/validation/network.ts +132 -0
- package/src/utils/validation/rateLimit.ts +54 -0
- package/src/utils/validation/security.ts +361 -0
- package/src/utils/validation/wordpress.ts +180 -0
- package/src/utils/validation.ts +47 -470
package/dist/tools/posts.d.ts
CHANGED
|
@@ -1,251 +1,15 @@
|
|
|
1
|
-
import { WordPressClient } from "../client/api.js";
|
|
2
|
-
import { CreatePostRequest, PostQueryParams, UpdatePostRequest } from "../types/wordpress.js";
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* WordPress Posts Tools - Legacy Import Module
|
|
5
3
|
*
|
|
6
|
-
* This
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - Updating existing posts with validation
|
|
10
|
-
* - Deleting posts with trash/permanent options
|
|
11
|
-
* - Retrieving individual posts with detailed information
|
|
12
|
-
* - Managing post revisions and history
|
|
4
|
+
* This file maintains backward compatibility while the codebase transitions
|
|
5
|
+
* to the new modular structure. The actual implementation has been refactored
|
|
6
|
+
* into focused modules under ./posts/ directory.
|
|
13
7
|
*
|
|
14
|
-
* @
|
|
15
|
-
*
|
|
16
|
-
* const postTools = new PostTools();
|
|
17
|
-
* const tools = postTools.getTools();
|
|
18
|
-
*
|
|
19
|
-
* // Use with a WordPress client
|
|
20
|
-
* const client = new WordPressClient(config);
|
|
21
|
-
* const result = await postTools.handleListPosts(client, { per_page: 10 });
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @since 1.0.0
|
|
25
|
-
* @author MCP WordPress Team
|
|
8
|
+
* @deprecated Use direct imports from ./posts/ modules instead
|
|
9
|
+
* @see ./posts/index.ts for the new modular implementation
|
|
26
10
|
*/
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* Returns an array of tool definitions that can be registered with an MCP server.
|
|
32
|
-
* Each tool includes comprehensive parameter validation, error handling, and
|
|
33
|
-
* detailed documentation with usage examples.
|
|
34
|
-
*
|
|
35
|
-
* @returns {Array<MCPTool>} An array of MCPTool definitions for post management
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* const postTools = new PostTools();
|
|
40
|
-
* const tools = postTools.getTools();
|
|
41
|
-
* console.log(tools.length); // 6 tools: list, get, create, update, delete, revisions
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
getTools(): any[];
|
|
45
|
-
/**
|
|
46
|
-
* Handles listing posts from a WordPress site with comprehensive filtering options.
|
|
47
|
-
*
|
|
48
|
-
* This method provides advanced search capabilities, status filtering, pagination,
|
|
49
|
-
* and category/tag filtering. Results include enhanced metadata and author information.
|
|
50
|
-
* For large result sets (>50 posts), it automatically uses streaming for better performance.
|
|
51
|
-
*
|
|
52
|
-
* @param {WordPressClient} client - The WordPress client instance for API communication
|
|
53
|
-
* @param {PostQueryParams} params - Query parameters for filtering and pagination
|
|
54
|
-
* @param {number} [params.per_page=10] - Number of posts to return per page (max 100)
|
|
55
|
-
* @param {string} [params.search] - Search term to filter posts by title/content
|
|
56
|
-
* @param {string|string[]} [params.status] - Post status filter (publish, draft, etc.)
|
|
57
|
-
* @param {number[]} [params.categories] - Array of category IDs to filter by
|
|
58
|
-
* @param {number[]} [params.tags] - Array of tag IDs to filter by
|
|
59
|
-
* @param {number} [params.page=1] - Page number for pagination
|
|
60
|
-
*
|
|
61
|
-
* @returns {Promise<string>} Formatted list of posts with metadata and context
|
|
62
|
-
*
|
|
63
|
-
* @throws {EnhancedError} When validation fails or API request encounters an error
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* // Basic listing
|
|
68
|
-
* const result = await handleListPosts(client, {});
|
|
69
|
-
*
|
|
70
|
-
* // Advanced filtering
|
|
71
|
-
* const filtered = await handleListPosts(client, {
|
|
72
|
-
* search: "WordPress tips",
|
|
73
|
-
* status: "publish",
|
|
74
|
-
* categories: [1, 2],
|
|
75
|
-
* per_page: 20
|
|
76
|
-
* });
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @since 1.0.0
|
|
80
|
-
*/
|
|
81
|
-
handleListPosts(client: WordPressClient, params: PostQueryParams): Promise<any>;
|
|
82
|
-
/**
|
|
83
|
-
* Retrieves a single WordPress post by ID with complete details and metadata.
|
|
84
|
-
*
|
|
85
|
-
* This method fetches a specific post and returns comprehensive information including
|
|
86
|
-
* content, metadata, author details, categories, tags, and publication status.
|
|
87
|
-
*
|
|
88
|
-
* @param {WordPressClient} client - The WordPress client instance for API communication
|
|
89
|
-
* @param {Object} params - Parameters for post retrieval
|
|
90
|
-
* @param {number} params.id - The unique ID of the post to retrieve
|
|
91
|
-
*
|
|
92
|
-
* @returns {Promise<string>} Detailed post information formatted for display
|
|
93
|
-
*
|
|
94
|
-
* @throws {EnhancedError} When post ID is invalid or post is not found
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* ```typescript
|
|
98
|
-
* // Get a specific post
|
|
99
|
-
* const post = await handleGetPost(client, { id: 123 });
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
* @since 1.0.0
|
|
103
|
-
*/
|
|
104
|
-
handleGetPost(client: WordPressClient, params: {
|
|
105
|
-
id: number;
|
|
106
|
-
}): Promise<any>;
|
|
107
|
-
/**
|
|
108
|
-
* Creates a new WordPress post with comprehensive validation and metadata support.
|
|
109
|
-
*
|
|
110
|
-
* This method handles the creation of new posts with full support for content,
|
|
111
|
-
* metadata, categories, tags, and publishing options. Includes automatic validation
|
|
112
|
-
* and sanitization of all input parameters.
|
|
113
|
-
*
|
|
114
|
-
* @param {WordPressClient} client - The WordPress client instance for API communication
|
|
115
|
-
* @param {CreatePostRequest} params - Post creation parameters
|
|
116
|
-
* @param {string} params.title - The post title
|
|
117
|
-
* @param {string} params.content - The post content in HTML format
|
|
118
|
-
* @param {string} [params.status="draft"] - Post status (publish, draft, pending, private)
|
|
119
|
-
* @param {string} [params.excerpt] - Post excerpt/summary
|
|
120
|
-
* @param {number[]} [params.categories] - Array of category IDs to assign
|
|
121
|
-
* @param {number[]} [params.tags] - Array of tag IDs to assign
|
|
122
|
-
*
|
|
123
|
-
* @returns {Promise<string>} Success message with the new post ID and details
|
|
124
|
-
*
|
|
125
|
-
* @throws {EnhancedError} When validation fails or post creation encounters an error
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* // Create a basic post
|
|
130
|
-
* const result = await handleCreatePost(client, {
|
|
131
|
-
* title: "My New Post",
|
|
132
|
-
* content: "<p>This is the post content.</p>",
|
|
133
|
-
* status: "publish"
|
|
134
|
-
* });
|
|
135
|
-
*
|
|
136
|
-
* // Create post with categories and tags
|
|
137
|
-
* const detailed = await handleCreatePost(client, {
|
|
138
|
-
* title: "WordPress Tips",
|
|
139
|
-
* content: "<p>Detailed WordPress tips...</p>",
|
|
140
|
-
* categories: [1, 2],
|
|
141
|
-
* tags: [5, 6],
|
|
142
|
-
* excerpt: "Learn essential WordPress tips"
|
|
143
|
-
* });
|
|
144
|
-
* ```
|
|
145
|
-
*
|
|
146
|
-
* @since 1.0.0
|
|
147
|
-
*/
|
|
148
|
-
handleCreatePost(client: WordPressClient, params: CreatePostRequest): Promise<any>;
|
|
149
|
-
/**
|
|
150
|
-
* Updates an existing WordPress post with validation and detailed confirmation.
|
|
151
|
-
*
|
|
152
|
-
* This method allows updating any aspect of a post including title, content, status,
|
|
153
|
-
* categories, and tags. Only provided fields are updated, leaving others unchanged.
|
|
154
|
-
*
|
|
155
|
-
* @param {WordPressClient} client - The WordPress client instance for API communication
|
|
156
|
-
* @param {UpdatePostRequest & {id: number}} params - Update parameters
|
|
157
|
-
* @param {number} params.id - The ID of the post to update
|
|
158
|
-
* @param {string} [params.title] - New post title
|
|
159
|
-
* @param {string} [params.content] - New post content in HTML format
|
|
160
|
-
* @param {string} [params.status] - New post status (publish, draft, pending, private)
|
|
161
|
-
* @param {string} [params.excerpt] - New post excerpt
|
|
162
|
-
* @param {number[]} [params.categories] - New category IDs to assign
|
|
163
|
-
* @param {number[]} [params.tags] - New tag IDs to assign
|
|
164
|
-
*
|
|
165
|
-
* @returns {Promise<string>} Success message confirming the update
|
|
166
|
-
*
|
|
167
|
-
* @throws {EnhancedError} When post ID is invalid or update fails
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```typescript
|
|
171
|
-
* // Update post title and status
|
|
172
|
-
* const result = await handleUpdatePost(client, {
|
|
173
|
-
* id: 123,
|
|
174
|
-
* title: "Updated Post Title",
|
|
175
|
-
* status: "publish"
|
|
176
|
-
* });
|
|
177
|
-
*
|
|
178
|
-
* // Update content and categories
|
|
179
|
-
* const updated = await handleUpdatePost(client, {
|
|
180
|
-
* id: 123,
|
|
181
|
-
* content: "<p>New content here...</p>",
|
|
182
|
-
* categories: [1, 3, 5]
|
|
183
|
-
* });
|
|
184
|
-
* ```
|
|
185
|
-
*
|
|
186
|
-
* @since 1.0.0
|
|
187
|
-
*/
|
|
188
|
-
handleUpdatePost(client: WordPressClient, params: UpdatePostRequest & {
|
|
189
|
-
id: number;
|
|
190
|
-
}): Promise<any>;
|
|
191
|
-
/**
|
|
192
|
-
* Deletes a WordPress post with options for trash or permanent deletion.
|
|
193
|
-
*
|
|
194
|
-
* This method provides safe deletion with trash option (default) or permanent
|
|
195
|
-
* deletion when force is specified. Includes confirmation of the deletion action.
|
|
196
|
-
*
|
|
197
|
-
* @param {WordPressClient} client - The WordPress client instance for API communication
|
|
198
|
-
* @param {Object} params - Deletion parameters
|
|
199
|
-
* @param {number} params.id - The ID of the post to delete
|
|
200
|
-
* @param {boolean} [params.force=false] - Whether to permanently delete (true) or move to trash (false)
|
|
201
|
-
*
|
|
202
|
-
* @returns {Promise<string>} Confirmation message of the deletion action
|
|
203
|
-
*
|
|
204
|
-
* @throws {EnhancedError} When post ID is invalid or deletion fails
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```typescript
|
|
208
|
-
* // Move post to trash (safe deletion)
|
|
209
|
-
* const result = await handleDeletePost(client, { id: 123 });
|
|
210
|
-
*
|
|
211
|
-
* // Permanently delete post (cannot be undone)
|
|
212
|
-
* const permanent = await handleDeletePost(client, {
|
|
213
|
-
* id: 123,
|
|
214
|
-
* force: true
|
|
215
|
-
* });
|
|
216
|
-
* ```
|
|
217
|
-
*
|
|
218
|
-
* @since 1.0.0
|
|
219
|
-
*/
|
|
220
|
-
handleDeletePost(client: WordPressClient, params: {
|
|
221
|
-
id: number;
|
|
222
|
-
force?: boolean;
|
|
223
|
-
}): Promise<any>;
|
|
224
|
-
/**
|
|
225
|
-
* Retrieves revision history for a specific WordPress post.
|
|
226
|
-
*
|
|
227
|
-
* This method fetches all available revisions for a post, providing a complete
|
|
228
|
-
* history of changes including dates, authors, and modification details.
|
|
229
|
-
*
|
|
230
|
-
* @param {WordPressClient} client - The WordPress client instance for API communication
|
|
231
|
-
* @param {Object} params - Parameters for revision retrieval
|
|
232
|
-
* @param {number} params.id - The ID of the post to get revisions for
|
|
233
|
-
*
|
|
234
|
-
* @returns {Promise<string>} Formatted list of post revisions with details
|
|
235
|
-
*
|
|
236
|
-
* @throws {EnhancedError} When post ID is invalid or revisions cannot be retrieved
|
|
237
|
-
*
|
|
238
|
-
* @example
|
|
239
|
-
* ```typescript
|
|
240
|
-
* // Get all revisions for a post
|
|
241
|
-
* const revisions = await handleGetPostRevisions(client, { id: 123 });
|
|
242
|
-
* ```
|
|
243
|
-
*
|
|
244
|
-
* @since 1.0.0
|
|
245
|
-
*/
|
|
246
|
-
handleGetPostRevisions(client: WordPressClient, params: {
|
|
247
|
-
id: number;
|
|
248
|
-
}): Promise<any>;
|
|
249
|
-
}
|
|
250
|
-
export default PostTools;
|
|
11
|
+
export { PostTools as default, PostTools } from "./posts/index.js";
|
|
12
|
+
export type { CreatePostRequest, PostQueryParams, UpdatePostRequest, WordPressPost } from "../types/wordpress.js";
|
|
13
|
+
export { postToolDefinitions } from "./posts/PostToolDefinitions.js";
|
|
14
|
+
export { handleListPosts, handleGetPost, handleCreatePost, handleUpdatePost, handleDeletePost, handleGetPostRevisions, } from "./posts/PostHandlers.js";
|
|
251
15
|
//# sourceMappingURL=posts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posts.d.ts","sourceRoot":"","sources":["../../src/tools/posts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"posts.d.ts","sourceRoot":"","sources":["../../src/tools/posts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGnE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGlH,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC"}
|