diff --git a/packages/cli/package.json b/packages/cli/package.json index 833123d8a7..dae777a687 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "n8n", - "version": "0.132.0", + "version": "0.132.2", "description": "n8n Workflow Automation Tool", "license": "SEE LICENSE IN LICENSE.md", "homepage": "https://n8n.io", @@ -110,7 +110,7 @@ "mysql2": "~2.2.0", "n8n-core": "~0.78.0", "n8n-editor-ui": "~0.100.0", - "n8n-nodes-base": "~0.129.0", + "n8n-nodes-base": "~0.129.1", "n8n-workflow": "~0.64.0", "oauth-1.0a": "^2.2.6", "open": "^7.0.0", @@ -120,7 +120,7 @@ "sqlite3": "^5.0.1", "sse-channel": "^3.1.1", "tslib": "1.14.1", - "typeorm": "^0.2.30", + "typeorm": "0.2.34", "winston": "^3.3.3" }, "jest": { diff --git a/packages/nodes-base/nodes/Cisco/Webex/CiscoWebex.node.ts b/packages/nodes-base/nodes/Cisco/Webex/CiscoWebex.node.ts index c75a261353..136a8c9aac 100644 --- a/packages/nodes-base/nodes/Cisco/Webex/CiscoWebex.node.ts +++ b/packages/nodes-base/nodes/Cisco/Webex/CiscoWebex.node.ts @@ -35,7 +35,7 @@ export class CiscoWebex implements INodeType { description: INodeTypeDescription = { displayName: 'Cisco Webex', name: 'ciscoWebex', - icon: 'file:ciscoWebex.svg', + icon: 'file:ciscoWebex.png', group: ['transform'], version: 1, subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', diff --git a/packages/nodes-base/nodes/Cisco/Webex/CiscoWebexTrigger.node.ts b/packages/nodes-base/nodes/Cisco/Webex/CiscoWebexTrigger.node.ts index bff18e37ee..43902109cc 100644 --- a/packages/nodes-base/nodes/Cisco/Webex/CiscoWebexTrigger.node.ts +++ b/packages/nodes-base/nodes/Cisco/Webex/CiscoWebexTrigger.node.ts @@ -26,7 +26,7 @@ export class CiscoWebexTrigger implements INodeType { description: INodeTypeDescription = { displayName: 'Cisco Webex Trigger', name: 'ciscoWebexTrigger', - icon: 'file:ciscoWebex.svg', + icon: 'file:ciscoWebex.png', group: ['trigger'], version: 1, subtitle: '={{$parameter["resource"] + ":" + $parameter["event"]}}', diff --git a/packages/nodes-base/nodes/Cisco/Webex/ciscoWebex.png b/packages/nodes-base/nodes/Cisco/Webex/ciscoWebex.png new file mode 100644 index 0000000000..f36061c12e Binary files /dev/null and b/packages/nodes-base/nodes/Cisco/Webex/ciscoWebex.png differ diff --git a/packages/nodes-base/nodes/Cisco/Webex/ciscoWebex.svg b/packages/nodes-base/nodes/Cisco/Webex/ciscoWebex.svg deleted file mode 100644 index f8253bbf23..0000000000 --- a/packages/nodes-base/nodes/Cisco/Webex/ciscoWebex.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/nodes-base/nodes/Interval.node.ts b/packages/nodes-base/nodes/Interval.node.ts index 55592236e9..c5ee0631be 100644 --- a/packages/nodes-base/nodes/Interval.node.ts +++ b/packages/nodes-base/nodes/Interval.node.ts @@ -84,7 +84,7 @@ export class Interval implements INodeType { throw new Error('The interval value is too large.'); } - const intervalObj = setInterval(executeTrigger, ); + const intervalObj = setInterval(executeTrigger, intervalValue); async function closeFunction() { clearInterval(intervalObj); diff --git a/packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts b/packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts index 7be0c77221..4416961a07 100644 --- a/packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts +++ b/packages/nodes-base/nodes/WooCommerce/GenericFunctions.ts @@ -149,6 +149,17 @@ export function toSnakeCase(data: } } +export function setFields(fieldsToSet: IDataObject, body: IDataObject) { + for(const fields in fieldsToSet) { + if (fields === 'tags') { + body['tags'] = (fieldsToSet[fields] as string[]).map(tag => ({id: parseInt(tag, 10)})); + } else { + body[snakeCase(fields.toString())] = fieldsToSet[fields]; + } + + } +} + export function adjustMetadata(fields: IDataObject & Metadata) { if (!fields.meta_data) return fields; diff --git a/packages/nodes-base/nodes/WooCommerce/OrderInterface.ts b/packages/nodes-base/nodes/WooCommerce/OrderInterface.ts index 74e5ce7376..5a59c4c02a 100644 --- a/packages/nodes-base/nodes/WooCommerce/OrderInterface.ts +++ b/packages/nodes-base/nodes/WooCommerce/OrderInterface.ts @@ -46,6 +46,7 @@ export interface ICouponLine { } export interface IOrder { + [index: string]: any; // tslint:disable-line:no-any billing?: IAddress; coupon_lines?: ICouponLine[]; currency?: string; diff --git a/packages/nodes-base/nodes/WooCommerce/ProductInterface.ts b/packages/nodes-base/nodes/WooCommerce/ProductInterface.ts index 2c4072146d..b4382677cb 100644 --- a/packages/nodes-base/nodes/WooCommerce/ProductInterface.ts +++ b/packages/nodes-base/nodes/WooCommerce/ProductInterface.ts @@ -13,42 +13,5 @@ export interface IImage { } export interface IProduct { - backorders?: string; - button_text?: string; - catalog_visibility?: string; - categories?: IDataObject[]; - cross_sell_ids?: string[]; - date_on_sale_from?: string; - date_on_sale_to?: string; - description?: string; - dimensions?: IDimension; - downloadable?: boolean; - external_url?: string; - featured?: boolean; - images?: IImage[]; - manage_stock?: boolean; - menu_order?: number; - meta_data?: IDataObject[]; - name?: string; - parent_id?: string; - price?: string; - purchase_note?: string; - regular_price?: string; - reviews_allowed?: boolean; - sale_price?: string; - shipping_class?: string; - short_description?: string; - sku?: string; - slug?: string; - sold_individually?: boolean; - status?: string; - stock_quantity?: number; - stock_status?: string; - tags?: IDataObject[]; - tax_class?: string; - tax_status?: string; - type?: string; - upsell_ids?: string[]; - virtual?: boolean; - weight?: string; + [index: string]: string | number | string[] | number[] | IDataObject | IDataObject[] | IImage[] | IDimension; } diff --git a/packages/nodes-base/nodes/WooCommerce/WooCommerce.node.ts b/packages/nodes-base/nodes/WooCommerce/WooCommerce.node.ts index 9b7361402b..c8264dda24 100644 --- a/packages/nodes-base/nodes/WooCommerce/WooCommerce.node.ts +++ b/packages/nodes-base/nodes/WooCommerce/WooCommerce.node.ts @@ -11,6 +11,7 @@ import { } from 'n8n-workflow'; import { adjustMetadata, + setFields, setMetadata, toSnakeCase, woocommerceApiRequest, @@ -252,102 +253,13 @@ export class WooCommerce implements INodeType { const body: IProduct = { name, }; - if (additionalFields.backorders) { - body.backorders = additionalFields.backorders as string; - } - if (additionalFields.buttonText) { - body.button_text = additionalFields.buttonText as string; - } - if (additionalFields.catalogVisibility) { - body.catalog_visibility = additionalFields.catalogVisibility as string; - } + + setFields(additionalFields, body); + if (additionalFields.categories) { body.categories = (additionalFields.categories as string[]).map(category => ({ id: parseInt(category, 10) })) as unknown as IDataObject[]; } - if (additionalFields.crossSellIds) { - body.cross_sell_ids = (additionalFields.crossSellIds as string).split(',') as string[]; - } - if (additionalFields.dateOnSaleFrom) { - body.date_on_sale_from = additionalFields.dateOnSaleFrom as string; - } - if (additionalFields.dateOnSaleTo) { - body.date_on_sale_to = additionalFields.dateOnSaleTo as string; - } - if (additionalFields.description) { - body.description = additionalFields.description as string; - } - if (additionalFields.downloadable) { - body.downloadable = additionalFields.downloadable as boolean; - } - if (additionalFields.externalUrl) { - body.external_url = additionalFields.externalUrl as string; - } - if (additionalFields.featured) { - body.featured = additionalFields.featured as boolean; - } - if (additionalFields.manageStock) { - body.manage_stock = additionalFields.manageStock as boolean; - } - if (additionalFields.parentId) { - body.parent_id = additionalFields.parentId as string; - } - if (additionalFields.purchaseNote) { - body.purchase_note = additionalFields.purchaseNote as string; - } - if (additionalFields.regularPrice) { - body.regular_price = additionalFields.regularPrice as string; - } - if (additionalFields.reviewsAllowed) { - body.reviews_allowed = additionalFields.reviewsAllowed as boolean; - } - if (additionalFields.salePrice) { - body.sale_price = additionalFields.salePrice as string; - } - if (additionalFields.shippingClass) { - body.shipping_class = additionalFields.shippingClass as string; - } - if (additionalFields.shortDescription) { - body.short_description = additionalFields.shortDescription as string; - } - if (additionalFields.sku) { - body.sku = additionalFields.sku as string; - } - if (additionalFields.slug) { - body.slug = additionalFields.slug as string; - } - if (additionalFields.soldIndividually) { - body.sold_individually = additionalFields.soldIndividually as boolean; - } - if (additionalFields.status) { - body.status = additionalFields.status as string; - } - if (additionalFields.stockQuantity) { - body.stock_quantity = additionalFields.stockQuantity as number; - } - if (additionalFields.stockStatus) { - body.stock_status = additionalFields.stockStatus as string; - } - if (additionalFields.tags) { - body.tags = (additionalFields.tags as string[]).map(tag => ({ 'id': parseInt(tag, 10) })) as unknown as IDataObject[]; - } - if (additionalFields.taxClass) { - body.tax_class = additionalFields.taxClass as string; - } - if (additionalFields.taxStatus) { - body.tax_status = additionalFields.taxStatus as string; - } - if (additionalFields.type) { - body.type = additionalFields.type as string; - } - if (additionalFields.upsellIds) { - body.upsell_ids = (additionalFields.upsellIds as string).split(',') as string[]; - } - if (additionalFields.virtual) { - body.virtual = additionalFields.virtual as boolean; - } - if (additionalFields.weight) { - body.weight = additionalFields.weight as string; - } + const images = (this.getNodeParameter('imagesUi', i) as IDataObject).imagesValues as IImage[]; if (images) { body.images = images; @@ -367,105 +279,9 @@ export class WooCommerce implements INodeType { const productId = this.getNodeParameter('productId', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IProduct = {}; - if (updateFields.name) { - body.name = updateFields.name as string; - } - if (updateFields.backorders) { - body.backorders = updateFields.backorders as string; - } - if (updateFields.buttonText) { - body.button_text = updateFields.buttonText as string; - } - if (updateFields.catalogVisibility) { - body.catalog_visibility = updateFields.catalogVisibility as string; - } - if (updateFields.categories) { - body.categories = (updateFields.categories as string[]).map(category => ({ id: parseInt(category, 10) })) as unknown as IDataObject[]; - } - if (updateFields.crossSellIds) { - body.cross_sell_ids = (updateFields.crossSellIds as string).split(',') as string[]; - } - if (updateFields.dateOnSaleFrom) { - body.date_on_sale_from = updateFields.dateOnSaleFrom as string; - } - if (updateFields.dateOnSaleTo) { - body.date_on_sale_to = updateFields.dateOnSaleTo as string; - } - if (updateFields.description) { - body.description = updateFields.description as string; - } - if (updateFields.downloadable) { - body.downloadable = updateFields.downloadable as boolean; - } - if (updateFields.externalUrl) { - body.external_url = updateFields.externalUrl as string; - } - if (updateFields.featured) { - body.featured = updateFields.featured as boolean; - } - if (updateFields.manageStock) { - body.manage_stock = updateFields.manageStock as boolean; - } - if (updateFields.parentId) { - body.parent_id = updateFields.parentId as string; - } - if (updateFields.purchaseNote) { - body.purchase_note = updateFields.purchaseNote as string; - } - if (updateFields.regularPrice) { - body.regular_price = updateFields.regularPrice as string; - } - if (updateFields.reviewsAllowed) { - body.reviews_allowed = updateFields.reviewsAllowed as boolean; - } - if (updateFields.salePrice) { - body.sale_price = updateFields.salePrice as string; - } - if (updateFields.shippingClass) { - body.shipping_class = updateFields.shippingClass as string; - } - if (updateFields.shortDescription) { - body.short_description = updateFields.shortDescription as string; - } - if (updateFields.sku) { - body.sku = updateFields.sku as string; - } - if (updateFields.slug) { - body.slug = updateFields.slug as string; - } - if (updateFields.soldIndividually) { - body.sold_individually = updateFields.soldIndividually as boolean; - } - if (updateFields.status) { - body.status = updateFields.status as string; - } - if (updateFields.stockQuantity) { - body.stock_quantity = updateFields.stockQuantity as number; - } - if (updateFields.stockStatus) { - body.stock_status = updateFields.stockStatus as string; - } - if (updateFields.tags) { - body.tags = (updateFields.tags as string[]).map(tag => ({ id: parseInt(tag, 10) })) as unknown as IDataObject[]; - } - if (updateFields.taxClass) { - body.tax_class = updateFields.taxClass as string; - } - if (updateFields.taxStatus) { - body.tax_status = updateFields.taxStatus as string; - } - if (updateFields.type) { - body.type = updateFields.type as string; - } - if (updateFields.upsellIds) { - body.upsell_ids = (updateFields.upsellIds as string).split(',') as string[]; - } - if (updateFields.virtual) { - body.virtual = updateFields.virtual as boolean; - } - if (updateFields.weight) { - body.weight = updateFields.weight as string; - } + + setFields(updateFields, body); + const images = (this.getNodeParameter('imagesUi', i) as IDataObject).imagesValues as IImage[]; if (images) { body.images = images; @@ -558,33 +374,9 @@ export class WooCommerce implements INodeType { if (operation === 'create') { const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; const body: IOrder = {}; - if (additionalFields.currency) { - body.currency = additionalFields.currency as string; - } - if (additionalFields.customerId) { - body.customer_id = parseInt(additionalFields.customerId as string, 10); - } - if (additionalFields.customerNote) { - body.customer_note = additionalFields.customerNote as string; - } - if (additionalFields.parentId) { - body.parent_id = parseInt(additionalFields.parentId as string, 10); - } - if (additionalFields.paymentMethodId) { - body.payment_method = additionalFields.paymentMethodId as string; - } - if (additionalFields.paymentMethodTitle) { - body.payment_method_title = additionalFields.paymentMethodTitle as string; - } - if (additionalFields.setPaid) { - body.set_paid = additionalFields.setPaid as boolean; - } - if (additionalFields.status) { - body.status = additionalFields.status as string; - } - if (additionalFields.transactionID) { - body.transaction_id = additionalFields.transactionID as string; - } + + setFields(additionalFields, body); + const billing = (this.getNodeParameter('billingUi', i) as IDataObject).billingValues as IAddress; if (billing !== undefined) { body.billing = billing; @@ -631,6 +423,7 @@ export class WooCommerce implements INodeType { const orderId = this.getNodeParameter('orderId', i) as string; const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; const body: IOrder = {}; + if (updateFields.currency) { body.currency = updateFields.currency as string; } @@ -694,6 +487,7 @@ export class WooCommerce implements INodeType { setMetadata(shippingLines); toSnakeCase(shippingLines); } + responseData = await woocommerceApiRequest.call(this, 'PUT', `/orders/${orderId}`, body); } //https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-an-order diff --git a/packages/nodes-base/package.json b/packages/nodes-base/package.json index 03e740d6d7..59b91c4123 100644 --- a/packages/nodes-base/package.json +++ b/packages/nodes-base/package.json @@ -1,6 +1,6 @@ { "name": "n8n-nodes-base", - "version": "0.129.0", + "version": "0.129.1", "description": "Base nodes of n8n", "license": "SEE LICENSE IN LICENSE.md", "homepage": "https://n8n.io",