🔨 Fix casing

This commit is contained in:
Iván Ovejero 2021-05-27 09:44:48 +02:00
parent 64ce0c6046
commit 1afd492b0f
7 changed files with 36 additions and 36 deletions

View file

@ -3,10 +3,10 @@ import {
NodePropertyTypes, NodePropertyTypes,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class ElasticSearchApi implements ICredentialType { export class ElasticsearchApi implements ICredentialType {
name = 'elasticSearchApi'; name = 'elasticsearchApi';
displayName = 'Elastic Search API'; displayName = 'Elasticsearch API';
documentationUrl = 'elasticSearch'; documentationUrl = 'elasticsearch';
properties = [ properties = [
{ {
displayName: 'Username', displayName: 'Username',
@ -30,7 +30,7 @@ export class ElasticSearchApi implements ICredentialType {
type: 'string' as NodePropertyTypes, type: 'string' as NodePropertyTypes,
default: '', default: '',
placeholder: 'https://a-b-optimized-deployment-ffc9df.es.us-west1.gcp.cloud.es.io:9243', placeholder: 'https://a-b-optimized-deployment-ffc9df.es.us-west1.gcp.cloud.es.io:9243',
description: 'Referred to as \'endpoint\' in the ElasticSearch dashboard.', description: 'Referred to as \'endpoint\' in the Elasticsearch dashboard.',
}, },
]; ];
} }

View file

@ -10,7 +10,7 @@ import {
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {
elasticSearchApiRequest, elasticsearchApiRequest,
} from './GenericFunctions'; } from './GenericFunctions';
import { import {
@ -24,24 +24,24 @@ import {
DocumentGetAllAdditionalFields, DocumentGetAllAdditionalFields,
} from './types'; } from './types';
export class ElasticSearch implements INodeType { export class Elasticsearch implements INodeType {
description: INodeTypeDescription = { description: INodeTypeDescription = {
displayName: 'ElasticSearch', displayName: 'Elasticsearch',
name: 'elasticSearch', name: 'elasticsearch',
icon: 'file:elasticSearch.svg', icon: 'file:elasticsearch.svg',
group: ['transform'], group: ['transform'],
version: 1, version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume the ElasticSearch API', description: 'Consume the Elasticsearch API',
defaults: { defaults: {
name: 'ElasticSearch', name: 'Elasticsearch',
color: '#f3d337', color: '#f3d337',
}, },
inputs: ['main'], inputs: ['main'],
outputs: ['main'], outputs: ['main'],
credentials: [ credentials: [
{ {
name: 'elasticSearchApi', name: 'elasticsearchApi',
required: true, required: true,
}, },
], ],
@ -101,7 +101,7 @@ export class ElasticSearch implements INodeType {
const documentId = this.getNodeParameter('documentId', i); const documentId = this.getNodeParameter('documentId', i);
const endpoint = `/${indexId}/_doc/${documentId}`; const endpoint = `/${indexId}/_doc/${documentId}`;
responseData = await elasticSearchApiRequest.call(this, 'DELETE', endpoint); responseData = await elasticsearchApiRequest.call(this, 'DELETE', endpoint);
} else if (operation === 'get') { } else if (operation === 'get') {
@ -122,7 +122,7 @@ export class ElasticSearch implements INodeType {
} }
const endpoint = `/${indexId}/_doc/${documentId}`; const endpoint = `/${indexId}/_doc/${documentId}`;
responseData = await elasticSearchApiRequest.call(this, 'GET', endpoint, {}, qs); responseData = await elasticsearchApiRequest.call(this, 'GET', endpoint, {}, qs);
} else if (operation === 'getAll') { } else if (operation === 'getAll') {
@ -149,7 +149,7 @@ export class ElasticSearch implements INodeType {
if (!returnAll) { if (!returnAll) {
qs.size = this.getNodeParameter('limit', 0); qs.size = this.getNodeParameter('limit', 0);
} }
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}/_search`, body, qs); responseData = await elasticsearchApiRequest.call(this, 'GET', `/${indexId}/_search`, body, qs);
responseData = responseData.hits.hits; responseData = responseData.hits.hits;
} else if (operation === 'index') { } else if (operation === 'index') {
@ -175,7 +175,7 @@ export class ElasticSearch implements INodeType {
} }
const endpoint = `/${indexId}/_doc/${documentId}`; const endpoint = `/${indexId}/_doc/${documentId}`;
responseData = await elasticSearchApiRequest.call(this, 'PUT', endpoint, body); responseData = await elasticsearchApiRequest.call(this, 'PUT', endpoint, body);
} else if (operation === 'update') { } else if (operation === 'update') {
@ -193,7 +193,7 @@ export class ElasticSearch implements INodeType {
const documentId = this.getNodeParameter('documentId', i); const documentId = this.getNodeParameter('documentId', i);
const endpoint = `/${indexId}/_update/${documentId}`; const endpoint = `/${indexId}/_update/${documentId}`;
responseData = await elasticSearchApiRequest.call(this, 'POST', endpoint, body); responseData = await elasticsearchApiRequest.call(this, 'POST', endpoint, body);
} }
@ -225,7 +225,7 @@ export class ElasticSearch implements INodeType {
Object.assign(qs, rest); Object.assign(qs, rest);
} }
responseData = await elasticSearchApiRequest.call(this, 'PUT', `/${indexId}`); responseData = await elasticsearchApiRequest.call(this, 'PUT', `/${indexId}`);
} else if (operation === 'delete') { } else if (operation === 'delete') {
@ -237,7 +237,7 @@ export class ElasticSearch implements INodeType {
const indexId = this.getNodeParameter('indexId', i); const indexId = this.getNodeParameter('indexId', i);
responseData = await elasticSearchApiRequest.call(this, 'DELETE', `/${indexId}`); responseData = await elasticsearchApiRequest.call(this, 'DELETE', `/${indexId}`);
} else if (operation === 'get') { } else if (operation === 'get') {
@ -256,7 +256,7 @@ export class ElasticSearch implements INodeType {
Object.assign(qs, additionalFields); Object.assign(qs, additionalFields);
} }
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}`, {}, qs); responseData = await elasticsearchApiRequest.call(this, 'GET', `/${indexId}`, {}, qs);
} else if (operation === 'getAll') { } else if (operation === 'getAll') {
@ -266,7 +266,7 @@ export class ElasticSearch implements INodeType {
// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
responseData = await elasticSearchApiRequest.call(this, 'GET', '/_aliases'); responseData = await elasticsearchApiRequest.call(this, 'GET', '/_aliases');
responseData = Object.keys(responseData).map(i => ({ indexId: i })); responseData = Object.keys(responseData).map(i => ({ indexId: i }));
const returnAll = this.getNodeParameter('returnAll', i); const returnAll = this.getNodeParameter('returnAll', i);

View file

@ -12,10 +12,10 @@ import {
} from 'n8n-workflow'; } from 'n8n-workflow';
import { import {
ElasticSearchApiCredentials, ElasticsearchApiCredentials,
} from './types'; } from './types';
export async function elasticSearchApiRequest( export async function elasticsearchApiRequest(
this: IExecuteFunctions, this: IExecuteFunctions,
method: 'GET' | 'PUT' | 'POST' | 'DELETE', method: 'GET' | 'PUT' | 'POST' | 'DELETE',
endpoint: string, endpoint: string,
@ -26,7 +26,7 @@ export async function elasticSearchApiRequest(
username, username,
password, password,
baseUrl, baseUrl,
} = this.getCredentials('elasticSearchApi') as ElasticSearchApiCredentials; } = this.getCredentials('elasticsearchApi') as ElasticsearchApiCredentials;
const token = Buffer.from(`${username}:${password}`).toString('base64'); const token = Buffer.from(`${username}:${password}`).toString('base64');

View file

@ -357,7 +357,7 @@ export const documentFields = [
{ {
displayName: 'Query', displayName: 'Query',
name: 'query', name: 'query',
description: 'Query in the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html" target="_blank">ElasticSearch Query DSL</a>.', description: 'Query in the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html" target="_blank">Elasticsearch Query DSL</a>.',
type: 'json', type: 'json',
typeOptions: { typeOptions: {
alwaysOpenEditWindow: true, alwaysOpenEditWindow: true,
@ -368,7 +368,7 @@ export const documentFields = [
{ {
displayName: 'Request Cache', displayName: 'Request Cache',
name: 'request_cache', name: 'request_cache',
description: 'If true, the caching of search results is enabled for requests where size is 0. See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html" target="_blank">ElasticSearch shard request cache settings</a>.', description: 'If true, the caching of search results is enabled for requests where size is 0. See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html" target="_blank">Elasticsearch shard request cache settings</a>.',
type: 'boolean', type: 'boolean',
default: false, default: false,
}, },
@ -455,7 +455,7 @@ export const documentFields = [
{ {
displayName: 'Timeout', displayName: 'Timeout',
name: 'timeout', name: 'timeout',
description: 'Period to wait for active shards. Defaults to <code>1m</code> (one minute). See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">ElasticSearch time units reference</a>.', description: 'Period to wait for active shards. Defaults to <code>1m</code> (one minute). See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">Elasticsearch time units reference</a>.',
type: 'string', type: 'string',
default: '1m', default: '1m',
}, },
@ -571,7 +571,7 @@ export const documentFields = [
{ {
displayName: 'Timeout', displayName: 'Timeout',
name: 'timeout', name: 'timeout',
description: 'Period to wait for active shards. Defaults to <code>1m</code> (one minute). See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">ElasticSearch time units reference</a>.', description: 'Period to wait for active shards. Defaults to <code>1m</code> (one minute). See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">Elasticsearch time units reference</a>.',
type: 'string', type: 'string',
default: '1m', default: '1m',
}, },
@ -620,7 +620,7 @@ export const documentFields = [
{ {
displayName: 'Script', displayName: 'Script',
name: 'script', name: 'script',
description: 'Script to update the document. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html" target="_blank">ElasticSearch guide to writing scripts</a>.', description: 'Script to update the document. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html" target="_blank">Elasticsearch guide to writing scripts</a>.',
type: 'string', type: 'string',
required: true, required: true,
default: '', default: '',

View file

@ -110,7 +110,7 @@ export const indexFields = [
{ {
displayName: 'Master Timeout', displayName: 'Master Timeout',
name: 'master_timeout', name: 'master_timeout',
description: 'Period to wait for a connection to the master node. If no response is received before the timeout expires,<br>the request fails and returns an error. Defaults to <code>1m</code>. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">ElasticSearch time units reference</a>.', description: 'Period to wait for a connection to the master node. If no response is received before the timeout expires,<br>the request fails and returns an error. Defaults to <code>1m</code>. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">Elasticsearch time units reference</a>.',
type: 'string', type: 'string',
default: '1m', default: '1m',
}, },
@ -128,7 +128,7 @@ export const indexFields = [
{ {
displayName: 'Timeout', displayName: 'Timeout',
name: 'timeout', name: 'timeout',
description: 'Period to wait for a response. If no response is received before the timeout expires, the request<br>fails and returns an error. Defaults to <code>30s</code>. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">ElasticSearch time units reference</a>.', description: 'Period to wait for a response. If no response is received before the timeout expires, the request<br>fails and returns an error. Defaults to <code>30s</code>. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">Elasticsearch time units reference</a>.',
type: 'string', type: 'string',
default: '30s', default: '30s',
}, },
@ -269,7 +269,7 @@ export const indexFields = [
{ {
displayName: 'Master Timeout', displayName: 'Master Timeout',
name: 'master_timeout', name: 'master_timeout',
description: 'Period to wait for a connection to the master node. If no response is received before the timeout expires,<br>the request fails and returns an error. Defaults to <code>1m</code>. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">ElasticSearch time units reference</a>.', description: 'Period to wait for a connection to the master node. If no response is received before the timeout expires,<br>the request fails and returns an error. Defaults to <code>1m</code>. See the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#time-units" target="_blank">Elasticsearch time units reference</a>.',
type: 'string', type: 'string',
default: '1m', default: '1m',
}, },

View file

@ -1,4 +1,4 @@
export type ElasticSearchApiCredentials = { export type ElasticsearchApiCredentials = {
username: string; username: string;
password: string; password: string;
baseUrl: string; baseUrl: string;

View file

@ -74,7 +74,7 @@
"dist/credentials/DropboxApi.credentials.js", "dist/credentials/DropboxApi.credentials.js",
"dist/credentials/DropboxOAuth2Api.credentials.js", "dist/credentials/DropboxOAuth2Api.credentials.js",
"dist/credentials/EgoiApi.credentials.js", "dist/credentials/EgoiApi.credentials.js",
"dist/credentials/ElasticSearchApi.credentials.js", "dist/credentials/ElasticsearchApi.credentials.js",
"dist/credentials/EmeliaApi.credentials.js", "dist/credentials/EmeliaApi.credentials.js",
"dist/credentials/ERPNextApi.credentials.js", "dist/credentials/ERPNextApi.credentials.js",
"dist/credentials/EventbriteApi.credentials.js", "dist/credentials/EventbriteApi.credentials.js",
@ -340,7 +340,7 @@
"dist/nodes/Dropbox/Dropbox.node.js", "dist/nodes/Dropbox/Dropbox.node.js",
"dist/nodes/EditImage.node.js", "dist/nodes/EditImage.node.js",
"dist/nodes/Egoi/Egoi.node.js", "dist/nodes/Egoi/Egoi.node.js",
"dist/nodes/ElasticSearch/ElasticSearch.node.js", "dist/nodes/Elasticsearch/Elasticsearch.node.js",
"dist/nodes/EmailReadImap.node.js", "dist/nodes/EmailReadImap.node.js",
"dist/nodes/EmailSend.node.js", "dist/nodes/EmailSend.node.js",
"dist/nodes/Emelia/Emelia.node.js", "dist/nodes/Emelia/Emelia.node.js",