From 5da61ef2527156ac8b30931fa8e013363c0b36da Mon Sep 17 00:00:00 2001 From: lublak <44057030+lublak@users.noreply.github.com> Date: Mon, 8 Mar 2021 18:45:35 +0100 Subject: [PATCH] :zap: Replace some fallback values to match the value type (#1421) --- packages/core/test/Helpers.ts | 2 +- packages/nodes-base/nodes/Chargebee/Chargebee.node.ts | 6 +++--- packages/nodes-base/nodes/Cockpit/GenericFunctions.ts | 2 +- packages/nodes-base/nodes/GraphQL/GraphQL.node.ts | 2 +- packages/nodes-base/nodes/Set.node.ts | 2 +- packages/nodes-base/nodes/Slack/Slack.node.ts | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/core/test/Helpers.ts b/packages/core/test/Helpers.ts index ed9897a771..4335e9e1e9 100644 --- a/packages/core/test/Helpers.ts +++ b/packages/core/test/Helpers.ts @@ -596,7 +596,7 @@ class NodeTypesClass implements INodeTypes { let item: INodeExecutionData; let keepOnlySet: boolean; for (let itemIndex = 0; itemIndex < items.length; itemIndex++) { - keepOnlySet = this.getNodeParameter('keepOnlySet', itemIndex, []) as boolean; + keepOnlySet = this.getNodeParameter('keepOnlySet', itemIndex, false) as boolean; item = items[itemIndex]; const options = this.getNodeParameter('options', itemIndex, {}) as IDataObject; diff --git a/packages/nodes-base/nodes/Chargebee/Chargebee.node.ts b/packages/nodes-base/nodes/Chargebee/Chargebee.node.ts index 6bce476c80..1970910c35 100644 --- a/packages/nodes-base/nodes/Chargebee/Chargebee.node.ts +++ b/packages/nodes-base/nodes/Chargebee/Chargebee.node.ts @@ -580,8 +580,8 @@ export class Chargebee implements INodeType { requestMethod = 'POST'; - const subscriptionId = this.getNodeParameter('subscriptionId', i, {}) as string; - body.end_of_term = this.getNodeParameter('endOfTerm', i, {}) as boolean; + const subscriptionId = this.getNodeParameter('subscriptionId', i, '') as string; + body.end_of_term = this.getNodeParameter('endOfTerm', i, false) as boolean; endpoint = `subscriptions/${subscriptionId.trim()}/cancel`; } else if (operation === 'delete') { @@ -591,7 +591,7 @@ export class Chargebee implements INodeType { requestMethod = 'POST'; - const subscriptionId = this.getNodeParameter('subscriptionId', i, {}) as string; + const subscriptionId = this.getNodeParameter('subscriptionId', i, '') as string; endpoint = `subscriptions/${subscriptionId.trim()}/delete`; } else { diff --git a/packages/nodes-base/nodes/Cockpit/GenericFunctions.ts b/packages/nodes-base/nodes/Cockpit/GenericFunctions.ts index baf97ec134..3909b3cb6b 100644 --- a/packages/nodes-base/nodes/Cockpit/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Cockpit/GenericFunctions.ts @@ -50,7 +50,7 @@ export function createDataFromParameters(this: IExecuteFunctions | IExecuteSingl if (dataFieldsAreJson) { // Parameters are defined as JSON - return JSON.parse(this.getNodeParameter('dataFieldsJson', itemIndex, {}) as string); + return JSON.parse(this.getNodeParameter('dataFieldsJson', itemIndex, '') as string); } // Parameters are defined in UI diff --git a/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts b/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts index 95c59ebeff..167eda8e67 100644 --- a/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts +++ b/packages/nodes-base/nodes/GraphQL/GraphQL.node.ts @@ -236,7 +236,7 @@ export class GraphQL implements INodeType { requestOptions.body = { query: gqlQuery, variables: this.getNodeParameter('variables', itemIndex, {}) as object, - operationName: this.getNodeParameter('operationName', itemIndex, null) as string, + operationName: this.getNodeParameter('operationName', itemIndex) as string, }; if (typeof requestOptions.body.variables === 'string') { try { diff --git a/packages/nodes-base/nodes/Set.node.ts b/packages/nodes-base/nodes/Set.node.ts index c401678c1e..9c17ec7e50 100644 --- a/packages/nodes-base/nodes/Set.node.ts +++ b/packages/nodes-base/nodes/Set.node.ts @@ -142,7 +142,7 @@ export class Set implements INodeType { let item: INodeExecutionData; let keepOnlySet: boolean; for (let itemIndex = 0; itemIndex < items.length; itemIndex++) { - keepOnlySet = this.getNodeParameter('keepOnlySet', itemIndex, []) as boolean; + keepOnlySet = this.getNodeParameter('keepOnlySet', itemIndex, false) as boolean; item = items[itemIndex]; const options = this.getNodeParameter('options', itemIndex, {}) as IDataObject; diff --git a/packages/nodes-base/nodes/Slack/Slack.node.ts b/packages/nodes-base/nodes/Slack/Slack.node.ts index d844001b88..132f3b339d 100644 --- a/packages/nodes-base/nodes/Slack/Slack.node.ts +++ b/packages/nodes-base/nodes/Slack/Slack.node.ts @@ -741,7 +741,7 @@ export class Slack implements INodeType { } } else { - const attachmentsJson = this.getNodeParameter('attachmentsJson', i, []) as string; + const attachmentsJson = this.getNodeParameter('attachmentsJson', i, '') as string; const blocksJson = this.getNodeParameter('blocksJson', i, []) as string; if (attachmentsJson !== '' && validateJSON(attachmentsJson) === undefined) { throw new Error('Attachments it is not a valid json');