mirror of
https://github.com/n8n-io/n8n-nodes-starter.git
synced 2025-10-28 06:02:25 -05:00
🚨 Autofix node linting
This commit is contained in:
parent
b15212d300
commit
b2b5a97188
3 changed files with 143 additions and 153 deletions
|
|
@ -4,18 +4,18 @@ import {
|
|||
ICredentialType,
|
||||
IHttpRequestOptions,
|
||||
INodeProperties,
|
||||
} from "n8n-workflow";
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class HttpBinApi implements ICredentialType {
|
||||
name = "httpbinApi";
|
||||
displayName = "HttpBin API";
|
||||
documentationUrl = "httpbin";
|
||||
name = 'httpbinApi';
|
||||
displayName = 'HttpBin API';
|
||||
documentationUrl = 'httpbin';
|
||||
properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: "Token",
|
||||
name: "token",
|
||||
type: "string",
|
||||
default: "",
|
||||
displayName: 'Token',
|
||||
name: 'token',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
// {
|
||||
// displayName: "API Key",
|
||||
|
|
@ -24,10 +24,10 @@ export class HttpBinApi implements ICredentialType {
|
|||
// default: "",
|
||||
// },
|
||||
{
|
||||
displayName: "Domain",
|
||||
name: "domain",
|
||||
type: "string",
|
||||
default: "https://httpbin.org",
|
||||
displayName: 'Domain',
|
||||
name: 'domain',
|
||||
type: 'string',
|
||||
default: 'https://httpbin.org',
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ export class HttpBinApi implements ICredentialType {
|
|||
|
||||
authenticate = async (
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
requestOptions: IHttpRequestOptions
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<IHttpRequestOptions> => {
|
||||
const headers = requestOptions.headers || {};
|
||||
const authentication = { Authorization: `Bearer ${credentials.token}` };
|
||||
|
|
@ -53,8 +53,8 @@ export class HttpBinApi implements ICredentialType {
|
|||
|
||||
test: ICredentialTestRequest = {
|
||||
request: {
|
||||
baseURL: "={{$credentials?.domain}}",
|
||||
url: "/bearer",
|
||||
baseURL: '={{$credentials?.domain}}',
|
||||
url: '/bearer',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
import { INodeType, INodeTypeDescription } from "n8n-workflow";
|
||||
import { httpVerbOperations, httpVerbFields } from "./HttpVerbDescriptions";
|
||||
import { INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
import { httpVerbFields, httpVerbOperations } from './HttpVerbDescriptions';
|
||||
|
||||
export class HttpBin implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: "HttpBin",
|
||||
name: "httpbin",
|
||||
icon: "file:httpbin.svg",
|
||||
group: ["transform"],
|
||||
displayName: 'HttpBin',
|
||||
name: 'httpbin',
|
||||
icon: 'file:httpbin.svg',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: "Interact with HttpBin API",
|
||||
description: 'Interact with HttpBin API',
|
||||
defaults: {
|
||||
name: "HttpBin",
|
||||
color: "#3b4151",
|
||||
name: 'HttpBin',
|
||||
color: '#3b4151',
|
||||
},
|
||||
inputs: ["main"],
|
||||
outputs: ["main"],
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: "httpbinApi",
|
||||
name: 'httpbinApi',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
requestDefaults: {
|
||||
baseURL: "https://httpbin.org",
|
||||
url: "",
|
||||
baseURL: 'https://httpbin.org',
|
||||
url: '',
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
},
|
||||
/**
|
||||
|
|
@ -44,17 +44,17 @@ export class HttpBin implements INodeType {
|
|||
*/
|
||||
properties: [
|
||||
{
|
||||
displayName: "Resource",
|
||||
name: "resource",
|
||||
type: "options",
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
options: [
|
||||
{
|
||||
name: "HTTP Verbs",
|
||||
value: "httpverbs",
|
||||
}
|
||||
name: 'HTTP Verbs',
|
||||
value: 'httpverbs',
|
||||
},
|
||||
],
|
||||
default: "httpverbs",
|
||||
default: 'httpverbs',
|
||||
},
|
||||
|
||||
...httpVerbOperations,
|
||||
|
|
|
|||
|
|
@ -1,249 +1,239 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
/**
|
||||
* This maps the operations to when the Resource option HTTP Verbs is selected
|
||||
*/
|
||||
export const httpVerbOperations: Array<INodeProperties> = [
|
||||
// This maps the operations to when the Resource option HTTP Verbs is selected
|
||||
export const httpVerbOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: "Operation",
|
||||
name: "operation",
|
||||
type: "options",
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ["httpverbs"],
|
||||
resource: ['httpverbs'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: "GET",
|
||||
value: "get",
|
||||
name: 'GET',
|
||||
value: 'get',
|
||||
routing: {
|
||||
request: {
|
||||
method: "GET",
|
||||
url: "/get",
|
||||
method: 'GET',
|
||||
url: '/get',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "DELETE",
|
||||
value: "delete",
|
||||
name: 'DELETE',
|
||||
value: 'delete',
|
||||
routing: {
|
||||
request: {
|
||||
method: "DELETE",
|
||||
url: "/delete",
|
||||
method: 'DELETE',
|
||||
url: '/delete',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
default: "get",
|
||||
default: 'get',
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
* Here we define what to show when the GET Operation is selected
|
||||
*
|
||||
* We do that by adding operation: ["get"], to "displayOptions.show"
|
||||
*/
|
||||
const getOperation: Array<INodeProperties> = [
|
||||
// Here we define what to show when the GET Operation is selected
|
||||
// We do that by adding operation: ["get"], to "displayOptions.show"
|
||||
const getOperation: INodeProperties[] = [
|
||||
{
|
||||
name: "typeofData",
|
||||
default: "queryParameter",
|
||||
description: "Select type of data to send [Query Parameters]",
|
||||
displayName: "Type of Data",
|
||||
name: 'typeofData',
|
||||
default: 'queryParameter',
|
||||
description: 'Select type of data to send [Query Parameters]',
|
||||
displayName: 'Type of Data',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ["httpverbs"],
|
||||
operation: ["get"],
|
||||
resource: ['httpverbs'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
type: "options",
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: "Query",
|
||||
value: "queryParameter",
|
||||
name: 'Query',
|
||||
value: 'queryParameter',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "arguments",
|
||||
name: 'arguments',
|
||||
default: {},
|
||||
description: "The request's query parameters",
|
||||
displayName: "Query Parameters",
|
||||
description: 'The request\'s query parameters',
|
||||
displayName: 'Query Parameters',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ["httpverbs"],
|
||||
operation: ["get"],
|
||||
resource: ['httpverbs'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: "keyvalue",
|
||||
displayName: "Key:Value",
|
||||
name: 'keyvalue',
|
||||
displayName: 'Key:Value',
|
||||
values: [
|
||||
{
|
||||
displayName: "Key",
|
||||
name: "key",
|
||||
type: "string",
|
||||
default: "",
|
||||
displayName: 'Key',
|
||||
name: 'key',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
description: "Key of query parameter",
|
||||
description: 'Key of query parameter',
|
||||
},
|
||||
{
|
||||
displayName: "Value",
|
||||
name: "value",
|
||||
type: "string",
|
||||
default: "",
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
routing: {
|
||||
send: {
|
||||
property: "={{$parent.key}}",
|
||||
type: "query",
|
||||
property: '={{$parent.key}}',
|
||||
type: 'query',
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: "Value of query parameter",
|
||||
description: 'Value of query parameter',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
type: "fixedCollection",
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
* Here we define what to show when the DELETE Operation is selected
|
||||
*
|
||||
* We do that by adding operation: ["delete"], to "displayOptions.show"
|
||||
*/
|
||||
const deleteOperation: Array<INodeProperties> = [
|
||||
// Here we define what to show when the DELETE Operation is selected
|
||||
// We do that by adding operation: ["delete"], to "displayOptions.show"
|
||||
const deleteOperation: INodeProperties[] = [
|
||||
{
|
||||
name: "typeofData",
|
||||
default: "queryParameter",
|
||||
name: 'typeofData',
|
||||
default: 'queryParameter',
|
||||
description:
|
||||
"Select type of data to send [Query Parameter Arguments, JSON-Body]",
|
||||
displayName: "Type of Data",
|
||||
'Select type of data to send [Query Parameter Arguments, JSON-Body]',
|
||||
displayName: 'Type of Data',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ["httpverbs"],
|
||||
operation: ["delete"],
|
||||
resource: ['httpverbs'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: "Query",
|
||||
value: "queryParameter",
|
||||
name: 'Query',
|
||||
value: 'queryParameter',
|
||||
},
|
||||
{
|
||||
name: "JSON",
|
||||
value: "jsonData",
|
||||
name: 'JSON',
|
||||
value: 'jsonData',
|
||||
},
|
||||
],
|
||||
required: true,
|
||||
type: "options",
|
||||
type: 'options',
|
||||
},
|
||||
{
|
||||
name: "arguments",
|
||||
name: 'arguments',
|
||||
default: {},
|
||||
description: "The request's query parameters",
|
||||
displayName: "Query Parameters",
|
||||
description: 'The request\'s query parameters',
|
||||
displayName: 'Query Parameters',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ["httpverbs"],
|
||||
operation: ["delete"],
|
||||
typeofData: ["queryParameter"],
|
||||
resource: ['httpverbs'],
|
||||
operation: ['delete'],
|
||||
typeofData: ['queryParameter'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: "keyvalue",
|
||||
displayName: "Key:Value",
|
||||
name: 'keyvalue',
|
||||
displayName: 'Key:Value',
|
||||
values: [
|
||||
{
|
||||
displayName: "Key",
|
||||
name: "key",
|
||||
type: "string",
|
||||
default: "",
|
||||
displayName: 'Key',
|
||||
name: 'key',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
description: "Key of query parameter",
|
||||
description: 'Key of query parameter',
|
||||
},
|
||||
{
|
||||
displayName: "Value",
|
||||
name: "value",
|
||||
type: "string",
|
||||
default: "",
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
routing: {
|
||||
send: {
|
||||
property: "={{$parent.key}}",
|
||||
type: "query",
|
||||
property: '={{$parent.key}}',
|
||||
type: 'query',
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: "Value of query parameter",
|
||||
description: 'Value of query parameter',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
type: "fixedCollection",
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "arguments",
|
||||
name: 'arguments',
|
||||
default: {},
|
||||
description: "The request's JSON properties",
|
||||
displayName: "JSON Object",
|
||||
description: 'The request\'s JSON properties',
|
||||
displayName: 'JSON Object',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ["httpverbs"],
|
||||
operation: ["delete"],
|
||||
typeofData: ["jsonData"],
|
||||
resource: ['httpverbs'],
|
||||
operation: ['delete'],
|
||||
typeofData: ['jsonData'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: "keyvalue",
|
||||
displayName: "Key:Value",
|
||||
name: 'keyvalue',
|
||||
displayName: 'Key:Value',
|
||||
values: [
|
||||
{
|
||||
displayName: "Key",
|
||||
name: "key",
|
||||
type: "string",
|
||||
default: "",
|
||||
displayName: 'Key',
|
||||
name: 'key',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
description: "Key of json property",
|
||||
description: 'Key of json property',
|
||||
},
|
||||
{
|
||||
displayName: "Value",
|
||||
name: "value",
|
||||
type: "string",
|
||||
default: "",
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
routing: {
|
||||
send: {
|
||||
property: "={{$parent.key}}",
|
||||
type: "body",
|
||||
property: '={{$parent.key}}',
|
||||
type: 'body',
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: "Value of json property",
|
||||
description: 'Value of json property',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
type: "fixedCollection",
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const httpVerbFields: Array<INodeProperties> = [
|
||||
export const httpVerbFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Http Verbs:Get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue