diff --git a/packages/nodes-base/nodes/Facebook/FacebookTrigger.node.ts b/packages/nodes-base/nodes/Facebook/FacebookTrigger.node.ts index b462d83a10..2f68521790 100644 --- a/packages/nodes-base/nodes/Facebook/FacebookTrigger.node.ts +++ b/packages/nodes-base/nodes/Facebook/FacebookTrigger.node.ts @@ -11,7 +11,7 @@ import { NodeApiError, } from 'n8n-workflow'; -import * as uuid from 'uuid/v4'; +import { v4 as uuid } from 'uuid'; import { snakeCase, diff --git a/packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts b/packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts index 9a848cd58f..77423a3301 100644 --- a/packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts +++ b/packages/nodes-base/nodes/Google/BigQuery/GoogleBigQuery.node.ts @@ -22,7 +22,7 @@ import { recordOperations, } from './RecordDescription'; -import * as uuid from 'uuid'; +import { v4 as uuid } from 'uuid'; export class GoogleBigQuery implements INodeType { description: INodeTypeDescription = { diff --git a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts index c813f44fd9..5c2d4a4d76 100644 --- a/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts +++ b/packages/nodes-base/nodes/Google/Calendar/GoogleCalendar.node.ts @@ -34,7 +34,7 @@ import { import * as moment from 'moment-timezone'; -import * as uuid from 'uuid/v4'; +import { v4 as uuid } from 'uuid'; export class GoogleCalendar implements INodeType { description: INodeTypeDescription = { diff --git a/packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts b/packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts index 38eee4a3b7..9cf0dcb171 100644 --- a/packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts +++ b/packages/nodes-base/nodes/Google/Drive/GoogleDrive.node.ts @@ -16,7 +16,7 @@ import { googleApiRequestAllItems, } from './GenericFunctions'; -import uuid = require('uuid'); +import { v4 as uuid } from 'uuid'; export class GoogleDrive implements INodeType { description: INodeTypeDescription = { diff --git a/packages/nodes-base/nodes/Matrix/GenericFunctions.ts b/packages/nodes-base/nodes/Matrix/GenericFunctions.ts index bed9eff1b4..70355430f2 100644 --- a/packages/nodes-base/nodes/Matrix/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Matrix/GenericFunctions.ts @@ -12,7 +12,7 @@ import { } from 'n8n-core'; import * as _ from 'lodash'; -import * as uuid from 'uuid/v4'; +import { v4 as uuid } from 'uuid'; interface MessageResponse { diff --git a/packages/nodes-base/nodes/Notion/GenericFunctions.ts b/packages/nodes-base/nodes/Notion/GenericFunctions.ts index 661241df72..2d8931b5c7 100644 --- a/packages/nodes-base/nodes/Notion/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Notion/GenericFunctions.ts @@ -24,6 +24,8 @@ import { import * as moment from 'moment-timezone'; +import { validate as uuidValidate } from 'uuid'; + export async function notionApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IPollFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise { // tslint:disable-line:no-any try { @@ -244,9 +246,15 @@ function getPropertyKeyValue(value: any, type: string, timezone: string) { }; break; case 'multi_select': + const multiSelectValue = value.multiSelectValue; result = { + type: 'multi_select', // tslint:disable-next-line: no-any - type: 'multi_select', multi_select: value.multiSelectValue.filter((id: any) => id !== null).map((option: string) => ({ id: option })), + multi_select: (Array.isArray(multiSelectValue) ? multiSelectValue : multiSelectValue.split(',').map(v => v.trim())) + // tslint:disable-next-line: no-any + .filter((value: any) => value !== null) + .map((option: string) => + ((!uuidValidate(option)) ? { name: option } : { id: option })), }; break; case 'email': diff --git a/packages/nodes-base/nodes/Notion/Notion.node.ts b/packages/nodes-base/nodes/Notion/Notion.node.ts index bce3672730..ee6992a64b 100644 --- a/packages/nodes-base/nodes/Notion/Notion.node.ts +++ b/packages/nodes-base/nodes/Notion/Notion.node.ts @@ -47,6 +47,7 @@ import { databasePageFields, databasePageOperations, } from './DatabasePageDescription'; +import { getServers } from 'dns'; export class Notion implements INodeType { description: INodeTypeDescription = { @@ -215,8 +216,16 @@ export class Notion implements INodeType { const resource = this.getCurrentNodeParameter('resource') as string; const operation = this.getCurrentNodeParameter('operation') as string; const { properties } = await notionApiRequest.call(this, 'GET', `/databases/${databaseId}`); - const useNames = (resource === 'databasePage' && operation === 'getAll'); - return (properties[name][type].options).map((option: IDataObject) => ({ name: option.name, value: (['select', 'multi_select'].includes(type) && useNames) ? option.name : option.id })); + if (resource === 'databasePage') { + if (['multi_select', 'select'].includes(type) && operation === 'getAll') { + return (properties[name][type].options) + .map((option: IDataObject) => ({ name: option.name, value: option.name })); + } else if (['multi_select'].includes(type) && ['create', 'update'].includes(operation)) { + return (properties[name][type].options) + .map((option: IDataObject) => ({ name: option.name, value: option.name })); + } + } + return (properties[name][type].options).map((option: IDataObject) => ({ name: option.name, value: option.id })); }, async getUsers(this: ILoadOptionsFunctions): Promise { const returnData: INodePropertyOptions[] = []; diff --git a/packages/nodes-base/nodes/Segment/Segment.node.ts b/packages/nodes-base/nodes/Segment/Segment.node.ts index 82f39e7309..eea1ef5481 100644 --- a/packages/nodes-base/nodes/Segment/Segment.node.ts +++ b/packages/nodes-base/nodes/Segment/Segment.node.ts @@ -37,7 +37,7 @@ import { ITrack, } from './TrackInterface'; -import * as uuid from 'uuid/v4'; +import { v4 as uuid } from 'uuid'; export class Segment implements INodeType { description: INodeTypeDescription = { diff --git a/packages/nodes-base/nodes/Twist/Twist.node.ts b/packages/nodes-base/nodes/Twist/Twist.node.ts index 93ad3ae0b7..232cb4bf1a 100644 --- a/packages/nodes-base/nodes/Twist/Twist.node.ts +++ b/packages/nodes-base/nodes/Twist/Twist.node.ts @@ -37,7 +37,7 @@ import { commentFields, commentOperations } from './CommentDescription'; -import uuid = require('uuid'); +import { v4 as uuid } from 'uuid'; import * as moment from 'moment'; export class Twist implements INodeType { diff --git a/packages/nodes-base/nodes/Wise/Wise.node.ts b/packages/nodes-base/nodes/Wise/Wise.node.ts index dfdf1e7beb..90f8146478 100644 --- a/packages/nodes-base/nodes/Wise/Wise.node.ts +++ b/packages/nodes-base/nodes/Wise/Wise.node.ts @@ -41,7 +41,7 @@ import { import * as moment from 'moment-timezone'; -import * as uuid from 'uuid/v4'; +import { v4 as uuid } from 'uuid'; export class Wise implements INodeType { description: INodeTypeDescription = { diff --git a/packages/nodes-base/package.json b/packages/nodes-base/package.json index 4b4416d9fa..c5d6c004b3 100644 --- a/packages/nodes-base/package.json +++ b/packages/nodes-base/package.json @@ -599,7 +599,7 @@ "@types/request-promise-native": "~1.0.15", "@types/ssh2-sftp-client": "^5.1.0", "@types/tmp": "^0.2.0", - "@types/uuid": "^3.4.6", + "@types/uuid": "^8.3.0", "@types/xml2js": "^0.4.3", "gulp": "^4.0.0", "jest": "^26.4.2", @@ -656,7 +656,7 @@ "snowflake-sdk": "^1.5.3", "ssh2-sftp-client": "^5.2.1", "tmp-promise": "^3.0.2", - "uuid": "^3.4.0", + "uuid": "^8.3.0", "vm2": "^3.6.10", "xlsx": "^0.17.0", "xml2js": "^0.4.23"