mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Remove server option from Twake-Node till supported
This commit is contained in:
@@ -7,6 +7,8 @@ import {
|
|||||||
import {
|
import {
|
||||||
OptionsWithUri,
|
OptionsWithUri,
|
||||||
} from 'request';
|
} from 'request';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make an API request to Twake
|
* Make an API request to Twake
|
||||||
*
|
*
|
||||||
@@ -16,7 +18,7 @@ import {
|
|||||||
* @param {object} body
|
* @param {object} body
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
export async function twakeApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object, query?: object, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
export async function twakeApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object, query?: object, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
||||||
|
|
||||||
const authenticationMethod = this.getNodeParameter('twakeVersion', 0, 'twakeCloudApi') as string;
|
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');
|
const credentials = this.getCredentials('twakeCloudApi');
|
||||||
options.headers!.Authorization = `Bearer ${credentials!.workspaceKey}`;
|
options.headers!.Authorization = `Bearer ${credentials!.workspaceKey}`;
|
||||||
|
|
||||||
} else {
|
// } else {
|
||||||
|
// const credentials = this.getCredentials('twakeServerApi');
|
||||||
const credentials = this.getCredentials('twakeServerApi');
|
// options.auth = { user: credentials!.publicId as string, pass: credentials!.privateApiKey as string };
|
||||||
options.auth = { user: credentials!.publicId as string, pass: credentials!.privateApiKey as string };
|
// options.uri = `${credentials!.hostUrl}/api/v1${resource}`;
|
||||||
options.uri = `${credentials!.hostUrl}/api/v1${resource}`;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return await this.helpers.request!(options);
|
return await this.helpers.request!(options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if( error.error.code === "ECONNREFUSED"){
|
if (error.error.code === 'ECONNREFUSED') {
|
||||||
throw new Error('Twake host is not accessible!');
|
throw new Error('Twake host is not accessible!');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,43 +34,43 @@ export class Twake implements INodeType {
|
|||||||
{
|
{
|
||||||
name: 'twakeCloudApi',
|
name: 'twakeCloudApi',
|
||||||
required: true,
|
required: true,
|
||||||
displayOptions: {
|
// displayOptions: {
|
||||||
show: {
|
// show: {
|
||||||
twakeVersion: [
|
// twakeVersion: [
|
||||||
'cloud',
|
// 'cloud',
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'twakeServerApi',
|
|
||||||
required: true,
|
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
twakeVersion: [
|
|
||||||
'server',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// name: 'twakeServerApi',
|
||||||
|
// required: true,
|
||||||
|
// displayOptions: {
|
||||||
|
// show: {
|
||||||
|
// twakeVersion: [
|
||||||
|
// 'server',
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// },
|
||||||
],
|
],
|
||||||
properties: [
|
properties: [
|
||||||
{
|
// {
|
||||||
displayName: 'Twake Version',
|
// displayName: 'Twake Version',
|
||||||
name: 'twakeVersion',
|
// name: 'twakeVersion',
|
||||||
type: 'options',
|
// type: 'options',
|
||||||
options: [
|
// options: [
|
||||||
{
|
// {
|
||||||
name: 'Cloud',
|
// name: 'Cloud',
|
||||||
value: 'cloud',
|
// value: 'cloud',
|
||||||
},
|
// },
|
||||||
// {
|
// {
|
||||||
// name: 'Server (Self Hosted)',
|
// name: 'Server (Self Hosted)',
|
||||||
// value: 'server',
|
// value: 'server',
|
||||||
// },
|
// },
|
||||||
],
|
// ],
|
||||||
default: 'cloud',
|
// default: 'cloud',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
displayName: 'Resource',
|
displayName: 'Resource',
|
||||||
name: 'resource',
|
name: 'resource',
|
||||||
|
|||||||
Reference in New Issue
Block a user