🔨 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,
} from 'n8n-workflow';
export class ElasticSearchApi implements ICredentialType {
name = 'elasticSearchApi';
displayName = 'Elastic Search API';
documentationUrl = 'elasticSearch';
export class ElasticsearchApi implements ICredentialType {
name = 'elasticsearchApi';
displayName = 'Elasticsearch API';
documentationUrl = 'elasticsearch';
properties = [
{
displayName: 'Username',
@ -30,7 +30,7 @@ export class ElasticSearchApi implements ICredentialType {
type: 'string' as NodePropertyTypes,
default: '',
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';
import {
elasticSearchApiRequest,
elasticsearchApiRequest,
} from './GenericFunctions';
import {
@ -24,24 +24,24 @@ import {
DocumentGetAllAdditionalFields,
} from './types';
export class ElasticSearch implements INodeType {
export class Elasticsearch implements INodeType {
description: INodeTypeDescription = {
displayName: 'ElasticSearch',
name: 'elasticSearch',
icon: 'file:elasticSearch.svg',
displayName: 'Elasticsearch',
name: 'elasticsearch',
icon: 'file:elasticsearch.svg',
group: ['transform'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Consume the ElasticSearch API',
description: 'Consume the Elasticsearch API',
defaults: {
name: 'ElasticSearch',
name: 'Elasticsearch',
color: '#f3d337',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'elasticSearchApi',
name: 'elasticsearchApi',
required: true,
},
],
@ -101,7 +101,7 @@ export class ElasticSearch implements INodeType {
const documentId = this.getNodeParameter('documentId', i);
const endpoint = `/${indexId}/_doc/${documentId}`;
responseData = await elasticSearchApiRequest.call(this, 'DELETE', endpoint);
responseData = await elasticsearchApiRequest.call(this, 'DELETE', endpoint);
} else if (operation === 'get') {
@ -122,7 +122,7 @@ export class ElasticSearch implements INodeType {
}
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') {
@ -149,7 +149,7 @@ export class ElasticSearch implements INodeType {
if (!returnAll) {
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;
} else if (operation === 'index') {
@ -175,7 +175,7 @@ export class ElasticSearch implements INodeType {
}
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') {
@ -193,7 +193,7 @@ export class ElasticSearch implements INodeType {
const documentId = this.getNodeParameter('documentId', i);
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);
}
responseData = await elasticSearchApiRequest.call(this, 'PUT', `/${indexId}`);
responseData = await elasticsearchApiRequest.call(this, 'PUT', `/${indexId}`);
} else if (operation === 'delete') {
@ -237,7 +237,7 @@ export class ElasticSearch implements INodeType {
const indexId = this.getNodeParameter('indexId', i);
responseData = await elasticSearchApiRequest.call(this, 'DELETE', `/${indexId}`);
responseData = await elasticsearchApiRequest.call(this, 'DELETE', `/${indexId}`);
} else if (operation === 'get') {
@ -256,7 +256,7 @@ export class ElasticSearch implements INodeType {
Object.assign(qs, additionalFields);
}
responseData = await elasticSearchApiRequest.call(this, 'GET', `/${indexId}`, {}, qs);
responseData = await elasticsearchApiRequest.call(this, 'GET', `/${indexId}`, {}, qs);
} 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
responseData = await elasticSearchApiRequest.call(this, 'GET', '/_aliases');
responseData = await elasticsearchApiRequest.call(this, 'GET', '/_aliases');
responseData = Object.keys(responseData).map(i => ({ indexId: i }));
const returnAll = this.getNodeParameter('returnAll', i);

View file

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

View file

@ -357,7 +357,7 @@ export const documentFields = [
{
displayName: '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',
typeOptions: {
alwaysOpenEditWindow: true,
@ -368,7 +368,7 @@ export const documentFields = [
{
displayName: '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',
default: false,
},
@ -455,7 +455,7 @@ export const documentFields = [
{
displayName: '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',
default: '1m',
},
@ -571,7 +571,7 @@ export const documentFields = [
{
displayName: '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',
default: '1m',
},
@ -620,7 +620,7 @@ export const documentFields = [
{
displayName: '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',
required: true,
default: '',

View file

@ -110,7 +110,7 @@ export const indexFields = [
{
displayName: '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',
default: '1m',
},
@ -128,7 +128,7 @@ export const indexFields = [
{
displayName: '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',
default: '30s',
},
@ -269,7 +269,7 @@ export const indexFields = [
{
displayName: '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',
default: '1m',
},

View file

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

View file

@ -74,7 +74,7 @@
"dist/credentials/DropboxApi.credentials.js",
"dist/credentials/DropboxOAuth2Api.credentials.js",
"dist/credentials/EgoiApi.credentials.js",
"dist/credentials/ElasticSearchApi.credentials.js",
"dist/credentials/ElasticsearchApi.credentials.js",
"dist/credentials/EmeliaApi.credentials.js",
"dist/credentials/ERPNextApi.credentials.js",
"dist/credentials/EventbriteApi.credentials.js",
@ -340,7 +340,7 @@
"dist/nodes/Dropbox/Dropbox.node.js",
"dist/nodes/EditImage.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/EmailSend.node.js",
"dist/nodes/Emelia/Emelia.node.js",