UNPKG

@ai-growth/n8n-nodes-wordpress

Version:

n8n node for WordPress integration with AI GROWTH - SEO WP plugin

782 lines 27.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.nodeFields = exports.operationField = exports.resourceField = void 0; exports.getAllNodeFields = getAllNodeFields; /** * Configurações padrão para campos do tipo select */ const selectDefaults = { noDataExpression: true, }; /** * Configurações padrão para campos do tipo string */ const textDefaults = { typeOptions: { multipleValues: false, multipleValueButtonText: 'Add Value', }, }; /** * Lista de status possíveis para um post/página */ const statusOptions = [ { name: 'Published', value: 'publish', description: 'Content is published', }, { name: 'Draft', value: 'draft', description: 'Content is saved as a draft', }, { name: 'Pending Review', value: 'pending', description: 'Content is waiting for review', }, { name: 'Private', value: 'private', description: 'Content is private, only visible to logged in users with access', }, { name: 'Future', value: 'future', description: 'Content is scheduled for future publishing', }, ]; /** * Definição de campo para escolha de recurso (post ou página) */ exports.resourceField = { displayName: 'Resource', name: 'resource', type: 'options', noDataExpression: true, options: [ { name: 'Post', value: 'post', description: 'WordPress blog post with categories, tags and comments', }, { name: 'Page', value: 'page', description: 'WordPress page for static content', }, ], default: 'post', required: true, description: 'WordPress resource to operate on', }; /** * Definição de campo para escolha de operação */ exports.operationField = { displayName: 'Operation', name: 'operation', type: 'options', noDataExpression: true, displayOptions: { show: { resource: ['post', 'page'], }, }, options: [ { name: 'Create', value: 'create', description: 'Create a new post or page', action: 'Create a post or page', }, { name: 'Get', value: 'get', description: 'Get a post or page by ID', action: 'Get a post or page', }, { name: 'Get Many', value: 'getAll', description: 'Get many posts or pages with optional filtering', action: 'Get many posts or pages', }, { name: 'Update', value: 'update', description: 'Update an existing post or page', action: 'Update a post or page', }, { name: 'Delete', value: 'delete', description: 'Delete a post or page', action: 'Delete a post or page', }, ], default: 'getAll', description: 'Operation to perform on the selected resource', }; /** * Lista de campos para o WordPress */ exports.nodeFields = [ // Campo ID (para get, update, delete) { field: { displayName: 'Post ID', name: 'id', type: 'number', displayOptions: { show: { resource: ['post'], operation: ['get', 'update', 'delete'], }, }, default: 0, required: true, description: 'ID of the post', }, operations: ['get', 'update', 'delete'], resources: ['post'], }, { field: { displayName: 'Page ID', name: 'id', type: 'number', displayOptions: { show: { resource: ['page'], operation: ['get', 'update', 'delete'], }, }, default: 0, required: true, description: 'ID of the page', }, operations: ['get', 'update', 'delete'], resources: ['page'], }, // Campos para create/update { field: { displayName: 'Title', name: 'title', type: 'string', displayOptions: { show: { operation: ['create', 'update'], }, }, default: '', required: true, description: 'Title of the post or page', placeholder: 'My Awesome Post', ...textDefaults, }, operations: ['create', 'update'], }, { field: { displayName: 'Content', name: 'content', type: 'string', displayOptions: { show: { operation: ['create', 'update'], }, }, default: '', required: true, description: 'Content of the post or page (HTML supported)', placeholder: '<p>This is the content of my post.</p>', typeOptions: { rows: 5, }, }, operations: ['create', 'update'], }, { field: { displayName: 'Status', name: 'status', type: 'options', displayOptions: { show: { operation: ['create', 'update'], }, }, options: statusOptions, default: 'draft', description: 'Status of the post or page. Use "publish" to make it visible on the site.', ...selectDefaults, }, operations: ['create', 'update'], }, { field: { displayName: 'Excerpt', name: 'excerpt', type: 'string', displayOptions: { show: { operation: ['create', 'update'], }, }, default: '', required: false, description: 'Short summary of the post for use in archive pages and SEO', placeholder: 'A brief summary of this post...', typeOptions: { rows: 3, }, }, operations: ['create', 'update'], }, { field: { displayName: 'Slug', name: 'slug', type: 'string', displayOptions: { show: { operation: ['create', 'update'], }, }, default: '', required: false, description: 'URL-friendly name for the post (e.g., "my-awesome-post")', placeholder: 'my-awesome-post', ...textDefaults, }, operations: ['create', 'update'], }, { field: { displayName: 'Featured Image URL', name: 'featured_image_url', type: 'string', displayOptions: { show: { operation: ['create', 'update'], }, }, default: '', required: false, description: 'URL of the image to download and set as featured image', placeholder: 'https://example.com/image.jpg', ...textDefaults, }, operations: ['create', 'update'], }, { field: { displayName: 'Categories', name: 'categories', type: 'string', displayOptions: { show: { resource: ['post'], operation: ['create', 'update'], }, }, default: '', required: false, description: 'Comma-separated list of category names or IDs (e.g., "Fitness,Beach Tennis,Training")', placeholder: 'Fitness,Beach Tennis,Training', ...textDefaults, }, operations: ['create', 'update'], resources: ['post'], }, { field: { displayName: 'Tags', name: 'tags', type: 'string', displayOptions: { show: { resource: ['post'], operation: ['create', 'update'], }, }, default: '', required: false, description: 'Comma-separated list of tag names or IDs (e.g., "Personal Trainer,Beach Tennis,Millbody")', placeholder: 'Personal Trainer,Beach Tennis,Millbody', ...textDefaults, }, operations: ['create', 'update'], resources: ['post'], }, // Campos para getAll { field: { displayName: 'Return All', name: 'returnAll', type: 'boolean', displayOptions: { show: { operation: ['getAll'], }, }, default: false, description: 'Whether to return all results or only up to a given limit', }, operations: ['getAll'], }, { field: { displayName: 'Limit', name: 'limit', type: 'number', displayOptions: { show: { operation: ['getAll'], returnAll: [false], }, }, typeOptions: { minValue: 1, maxValue: 100, }, default: 10, description: 'Max number of results to return', }, operations: ['getAll'], }, { field: { displayName: 'Additional Parameters', name: 'additionalParameters', type: 'collection', placeholder: 'Add Parameter', displayOptions: { show: { operation: ['getAll'], }, }, default: {}, options: [ { displayName: 'Search Term', name: 'search', type: 'string', default: '', description: 'Search for posts/pages containing this term in title or content', placeholder: 'wordpress tips', }, { displayName: 'Status', name: 'status', type: 'options', options: statusOptions, default: 'publish', description: 'Filter posts/pages by their status', }, { displayName: 'Categories', name: 'categories', type: 'string', displayOptions: { show: { '/resource': ['post'], }, }, default: '', description: 'Comma-separated list of category IDs to filter posts', placeholder: '5,12,25', }, { displayName: 'Tags', name: 'tags', type: 'string', displayOptions: { show: { '/resource': ['post'], }, }, default: '', description: 'Comma-separated list of tag IDs to filter posts', placeholder: '7,18,42', }, { displayName: 'Page', name: 'page', type: 'number', default: 1, description: 'Current page of results (used for pagination)', typeOptions: { minValue: 1, }, }, { displayName: 'Order By', name: 'orderby', type: 'options', options: [ { name: 'Date', value: 'date', description: 'Order by publish date', }, { name: 'Title', value: 'title', description: 'Order alphabetically by title', }, { name: 'Modified Date', value: 'modified', description: 'Order by last modified date', }, { name: 'ID', value: 'id', description: 'Order by post ID', }, ], default: 'date', description: 'Sort retrieved posts by this parameter', }, { displayName: 'Order Direction', name: 'order', type: 'options', options: [ { name: 'Ascending', value: 'asc', description: 'Oldest to newest or A-Z', }, { name: 'Descending', value: 'desc', description: 'Newest to oldest or Z-A', }, ], default: 'desc', description: 'Direction to order posts', }, ], }, operations: ['getAll'], }, // Opções para delete { field: { displayName: 'Force Delete', name: 'force', type: 'boolean', displayOptions: { show: { operation: ['delete'], }, }, default: false, description: 'Whether to permanently delete or move to trash', }, operations: ['delete'], }, // Opções do AI GROWTH - SEO WP { field: { displayName: 'SEO Options', name: 'seoOptions', type: 'fixedCollection', displayOptions: { show: { operation: ['create', 'update', 'get', 'getAll'], }, }, default: {}, description: 'SEO options from AI GROWTH - SEO WP plugin', options: [ { name: 'metadataValues', displayName: 'Metadata', values: [ { displayName: 'Include SEO Metadata', name: 'includeSeoMetadata', type: 'boolean', displayOptions: { show: { '/operation': ['get', 'getAll'], }, }, default: false, description: 'Whether to include SEO metadata in the response', }, { displayName: 'Update SEO Metadata', name: 'updateSeoMetadata', type: 'boolean', displayOptions: { show: { '/operation': ['create', 'update'], }, }, default: false, description: 'Whether to update SEO metadata', }, { displayName: 'Meta Title', name: 'meta_title', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateSeoMetadata: [true], }, }, default: '', description: 'SEO title for the post/page', ...textDefaults, }, { displayName: 'Meta Description', name: 'meta_description', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateSeoMetadata: [true], }, }, default: '', description: 'SEO description for the post/page', typeOptions: { rows: 3, }, }, { displayName: 'Meta Keywords', name: 'meta_keywords', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateSeoMetadata: [true], }, }, default: '', description: 'SEO keywords for the post/page (comma separated)', ...textDefaults, }, { displayName: 'OG Title', name: 'og_title', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateSeoMetadata: [true], }, }, default: '', description: 'Open Graph title for social media sharing', ...textDefaults, }, { displayName: 'OG Description', name: 'og_description', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateSeoMetadata: [true], }, }, default: '', description: 'Open Graph description for social media sharing', typeOptions: { rows: 3, }, }, { displayName: 'Twitter Title', name: 'twitter_title', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateSeoMetadata: [true], }, }, default: '', description: 'Twitter card title for Twitter sharing', ...textDefaults, }, { displayName: 'Twitter Description', name: 'twitter_description', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateSeoMetadata: [true], }, }, default: '', description: 'Twitter card description for Twitter sharing', typeOptions: { rows: 3, }, }, ], }, { name: 'faqValues', displayName: 'FAQ', values: [ { displayName: 'Include FAQs', name: 'includeFaqs', type: 'boolean', displayOptions: { show: { '/operation': ['get', 'getAll'], }, }, default: false, description: 'Whether to include FAQs in the response', }, { displayName: 'Update FAQs', name: 'updateFaqs', type: 'boolean', displayOptions: { show: { '/operation': ['create', 'update'], }, }, default: false, description: 'Whether to update FAQs', }, { displayName: 'FAQs', name: 'faq', type: 'fixedCollection', typeOptions: { multipleValues: true, }, displayOptions: { show: { '/operation': ['create', 'update'], updateFaqs: [true], }, }, default: {}, options: [ { name: 'faqValues', displayName: 'FAQ Item', values: [ { displayName: 'Question', name: 'question', type: 'string', default: '', description: 'Question for the FAQ', ...textDefaults, }, { displayName: 'Answer', name: 'answer', type: 'string', default: '', description: 'Answer for the FAQ', typeOptions: { rows: 3, }, }, ], }, ], }, ], }, { name: 'ctaValues', displayName: 'CTA (Call to Action)', values: [ { displayName: 'Include CTA', name: 'includeCta', type: 'boolean', displayOptions: { show: { '/operation': ['get', 'getAll'], }, }, default: false, description: 'Whether to include CTA in the response', }, { displayName: 'Update CTA', name: 'updateCta', type: 'boolean', displayOptions: { show: { '/operation': ['create', 'update'], }, }, default: false, description: 'Whether to update CTA', }, { displayName: 'Button Text', name: 'text', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateCta: [true], }, }, default: '', description: 'Text for the CTA button', ...textDefaults, }, { displayName: 'URL', name: 'url', type: 'string', displayOptions: { show: { '/operation': ['create', 'update'], updateCta: [true], }, }, default: '', description: 'URL for the CTA button', ...textDefaults, }, ], }, ], }, operations: ['create', 'update', 'get', 'getAll'], }, ]; /** * Obtém todos os campos para o * @returns Lista de propriedades de */ function getAllNodeFields() { // Adicionar campos básicos de recurso e operação const fields = [ exports.resourceField, exports.operationField, ]; // Adicionar todos os campos específicos exports.nodeFields.forEach(field => { fields.push(field.field); }); return fields; } //# sourceMappingURL=NodeFields.js.map