🔀 Merge branch 'uProc_integration' of https://github.com/mcolomer/n8n into mcolomer-uProc_integration

This commit is contained in:
Jan Oberhauser 2021-03-25 23:38:56 +01:00
commit 0ba526dd67
9 changed files with 132 additions and 162 deletions

View file

@ -20,12 +20,15 @@ export async function uprocApiRequest(this: IHookFunctions | IExecuteFunctions |
}
const token = Buffer.from(`${credentials.email}:${credentials.apiKey}`).toString('base64');
const options: OptionsWithUri = {
headers: { Authorization: `Basic ${token}` },
headers: {
Authorization: `Basic ${token}`,
"User-agent": "n8n"
},
method,
qs,
body,
uri: uri || `https://api.uproc.io/api/v2/process`,
json: true,
json: true
};
try {

View file

@ -1,6 +1,6 @@
import {
IDataObject,
INodeProperties,
INodeProperties
} from 'n8n-workflow';
import {

View file

@ -1,36 +1 @@
export const groups = {
groups: [{
'translated': 'Audio',
'name': 'audio',
}, {
'translated': 'Communication',
'name': 'communication',
}, {
'translated': 'Company',
'name': 'company',
}, {
'translated': 'Finance',
'name': 'finance',
}, {
'translated': 'Geographical',
'name': 'geographic',
}, {
'translated': 'Image',
'name': 'image',
}, {
'translated': 'Internet',
'name': 'internet',
}, {
'translated': 'Personal',
'name': 'personal',
}, {
'translated': 'Product',
'name': 'product',
}, {
'translated': 'Security',
'name': 'security',
}, {
'translated': 'Text',
'name': 'text',
}],
};
export const groups = {groups: [{'translated':'Audio','name':'audio'},{'translated':'Communication','name':'communication'},{'translated':'Company','name':'company'},{'translated':'Finance','name':'finance'},{'translated':'Geographical','name':'geographic'},{'translated':'Image','name':'image'},{'translated':'Internet','name':'internet'},{'translated':'Personal','name':'personal'},{'translated':'Product','name':'product'},{'translated':'Security','name':'security'},{'translated':'Text','name':'text'}]};

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
import {
IDataObject,
INodeProperties,
INodeProperties
} from 'n8n-workflow';
import {
@ -30,12 +30,12 @@ for (const group of (groups as IDataObject).groups as IDataObject[]) {
displayOptions: {
show: {
group: [
group.name,
group.name
],
},
},
default: '',
options: [],
options: []
};
const options = [];
@ -45,7 +45,7 @@ for (const group of (groups as IDataObject).groups as IDataObject[]) {
const option = {
name: tool.d as string,
value: tool.k,
description: (tool.ed as string) + ` <a href="${link}" target='_blank'>Info</a>`,
description: (tool.ed as string) + ` <a href="${link}" target='_blank'>Info</a>`
};
options.push(option);
}
@ -82,7 +82,7 @@ for (const tool of (tools as IDataObject).processors as IDataObject[]) {
tool.g,
],
tool: [
tool.k,
tool.k
],
},
},

View file

@ -75,11 +75,11 @@ export class UProc implements INodeType {
displayName: 'Data Webhook',
name: 'dataWebhook',
type: 'string',
description: 'URL to send tool response when tool has resolved your request. You can create your own webhook at <a href="https://beeceptor.com" target="_blank">Beeceptor</a>, <a href="https://www.integromat.com/" target="_blank">Integromat</a>, <a href="https://zapier.com/" target="_blank">Zapier</a> or <a href="https://n8n.io/" target="_blank">n8n</a>',
description: 'URL to send tool response when tool has resolved your request. You can create your own webhook at en <a href="https://beeceptor.com" target="_blank">Beeceptor</a>, <a href="https://www.integromat.com/" target="_blank">Integromat</a>, <a href="https://zapier.com/" target="_blank">Zapier</a> or <a href="https://n8n.io/" target="_blank">n8n</a>',
default: '',
},
],
},
}
]
}
],
};
@ -96,7 +96,7 @@ export class UProc implements INodeType {
const dataWebhook = additionalOptions.dataWebhook as string;
interface LooseObject {
[key: string]: any; // tslint:disable-line:no-any
[key: string]: any;
}
const fields = toolParameters.filter((field) => {
@ -108,16 +108,18 @@ export class UProc implements INodeType {
const requestPromises = [];
for (let i = 0; i < length; i++) {
const toolKey = tool.replace(/([A-Z]+)/g, '-$1').toLowerCase();
const toolKey = tool.replace(/([A-Z]+)/g, "-$1").toLowerCase();
const body: LooseObject = {
processor: toolKey,
params: {},
params: {}
};
//console.log(fields);
fields.forEach((field) => {
if (field && field.length) {
const data = this.getNodeParameter(field, i) as string;
body.params[field] = data + '';
//console.log(field, data);
body.params[field] = data + "";
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB