From 94862d2db4bb8669040c567ebd38752ef7d186c5 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Tue, 4 Aug 2020 17:30:08 +0200 Subject: [PATCH] :zap: Remove server option from Twake-Node till supported --- .../nodes/Twake/GenericFunctions.ts | 19 +++--- packages/nodes-base/nodes/Twake/Twake.node.ts | 68 +++++++++---------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/packages/nodes-base/nodes/Twake/GenericFunctions.ts b/packages/nodes-base/nodes/Twake/GenericFunctions.ts index 84aaf9e20b..d756c9cf2b 100644 --- a/packages/nodes-base/nodes/Twake/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Twake/GenericFunctions.ts @@ -7,6 +7,8 @@ import { import { OptionsWithUri, } from 'request'; + + /** * Make an API request to Twake * @@ -16,7 +18,7 @@ import { * @param {object} body * @returns {Promise} */ -export async function twakeApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object, query?: object, uri?: string): Promise { // tslint:disable-line:no-any +export async function twakeApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object, query?: object, uri?: string): Promise { // tslint:disable-line:no-any const authenticationMethod = this.getNodeParameter('twakeVersion', 0, 'twakeCloudApi') as string; @@ -30,21 +32,20 @@ export async function twakeApiRequest(this: IHookFunctions | IExecuteFunctions | }; - if (authenticationMethod === 'cloud') { + // if (authenticationMethod === 'cloud') { const credentials = this.getCredentials('twakeCloudApi'); options.headers!.Authorization = `Bearer ${credentials!.workspaceKey}`; - } else { - - const credentials = this.getCredentials('twakeServerApi'); - options.auth = { user: credentials!.publicId as string, pass: credentials!.privateApiKey as string }; - options.uri = `${credentials!.hostUrl}/api/v1${resource}`; - } + // } else { + // const credentials = this.getCredentials('twakeServerApi'); + // options.auth = { user: credentials!.publicId as string, pass: credentials!.privateApiKey as string }; + // options.uri = `${credentials!.hostUrl}/api/v1${resource}`; + // } try { return await this.helpers.request!(options); } catch (error) { - if( error.error.code === "ECONNREFUSED"){ + if (error.error.code === 'ECONNREFUSED') { throw new Error('Twake host is not accessible!'); } diff --git a/packages/nodes-base/nodes/Twake/Twake.node.ts b/packages/nodes-base/nodes/Twake/Twake.node.ts index d890e6b6cd..3b5459cde9 100644 --- a/packages/nodes-base/nodes/Twake/Twake.node.ts +++ b/packages/nodes-base/nodes/Twake/Twake.node.ts @@ -34,43 +34,43 @@ export class Twake implements INodeType { { name: 'twakeCloudApi', required: true, - displayOptions: { - show: { - twakeVersion: [ - 'cloud', - ], - }, - }, - }, - { - name: 'twakeServerApi', - required: true, - displayOptions: { - show: { - twakeVersion: [ - 'server', - ], - }, - }, + // displayOptions: { + // show: { + // twakeVersion: [ + // 'cloud', + // ], + // }, + // }, }, + // { + // name: 'twakeServerApi', + // required: true, + // displayOptions: { + // show: { + // twakeVersion: [ + // 'server', + // ], + // }, + // }, + // }, ], properties: [ - { - displayName: 'Twake Version', - name: 'twakeVersion', - type: 'options', - options: [ - { - name: 'Cloud', - value: 'cloud', - }, - // { - // name: 'Server (Self Hosted)', - // value: 'server', - // }, - ], - default: 'cloud', - }, + // { + // displayName: 'Twake Version', + // name: 'twakeVersion', + // type: 'options', + // options: [ + // { + // name: 'Cloud', + // value: 'cloud', + // }, + // { + // name: 'Server (Self Hosted)', + // value: 'server', + // }, + // ], + // default: 'cloud', + // }, { displayName: 'Resource', name: 'resource',