refactor: Format nodes-base package (A-F) (#3800)

* 🔨 prettier formated nodes - A

* 🔨 prettier formated nodes - B

*  prettier formated nodes - C

*  prettier formated nodes - D

*  prettier formated nodes - E-F

* 🎨 Adjust nodes-base formatting command (#3805)

* Format additional files in nodes A-F (#3811)

*  fixes

* 🎨 Add Mindee to ignored dirs

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
Michael Kret
2022-08-01 23:47:55 +03:00
committed by GitHub
parent 2c17e6f3ca
commit 0ecbb4a19d
411 changed files with 12906 additions and 20148 deletions

View File

@@ -1,6 +1,4 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
ICredentialsDecrypted,
@@ -13,26 +11,13 @@ import {
JsonObject,
} from 'n8n-workflow';
import {
elasticsearchApiRequest,
} from './GenericFunctions';
import { elasticsearchApiRequest } from './GenericFunctions';
import {
documentFields,
documentOperations,
indexFields,
indexOperations,
} from './descriptions';
import { documentFields, documentOperations, indexFields, indexOperations } from './descriptions';
import {
DocumentGetAllOptions,
ElasticsearchApiCredentials,
FieldsUiValues,
} from './types';
import { DocumentGetAllOptions, ElasticsearchApiCredentials, FieldsUiValues } from './types';
import {
omit,
} from 'lodash';
import { omit } from 'lodash';
export class Elasticsearch implements INodeType {
description: INodeTypeDescription = {
@@ -89,9 +74,7 @@ export class Elasticsearch implements INodeType {
let responseData;
for (let i = 0; i < items.length; i++) {
if (resource === 'document') {
// **********************************************************************
// document
// **********************************************************************
@@ -99,7 +82,6 @@ export class Elasticsearch implements INodeType {
// https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html
if (operation === 'delete') {
// ----------------------------------------
// document: delete
// ----------------------------------------
@@ -111,9 +93,7 @@ export class Elasticsearch implements INodeType {
const endpoint = `/${indexId}/_doc/${documentId}`;
responseData = await elasticsearchApiRequest.call(this, 'DELETE', endpoint);
} else if (operation === 'get') {
// ----------------------------------------
// document: get
// ----------------------------------------
@@ -142,9 +122,7 @@ export class Elasticsearch implements INodeType {
...responseData._source,
};
}
} else if (operation === 'getAll') {
// ----------------------------------------
// document: getAll
// ----------------------------------------
@@ -170,7 +148,13 @@ export class Elasticsearch implements INodeType {
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;
const simple = this.getNodeParameter('simple', 0) as IDataObject;
@@ -183,9 +167,7 @@ export class Elasticsearch implements INodeType {
};
});
}
} else if (operation === 'create') {
// ----------------------------------------
// document: create
// ----------------------------------------
@@ -194,24 +176,22 @@ export class Elasticsearch implements INodeType {
const body: IDataObject = {};
const dataToSend = this.getNodeParameter('dataToSend', 0) as 'defineBelow' | 'autoMapInputData';
const dataToSend = this.getNodeParameter('dataToSend', 0) as
| 'defineBelow'
| 'autoMapInputData';
if (dataToSend === 'defineBelow') {
const fields = this.getNodeParameter('fieldsUi.fieldValues', i, []) as FieldsUiValues;
fields.forEach(({ fieldId, fieldValue }) => body[fieldId] = fieldValue);
fields.forEach(({ fieldId, fieldValue }) => (body[fieldId] = fieldValue));
} else {
const inputData = items[i].json;
const rawInputsToIgnore = this.getNodeParameter('inputsToIgnore', i) as string;
const inputsToIgnore = rawInputsToIgnore.split(',').map(c => c.trim());
const inputsToIgnore = rawInputsToIgnore.split(',').map((c) => c.trim());
for (const key of Object.keys(inputData)) {
if (inputsToIgnore.includes(key)) continue;
body[key] = inputData[key];
}
}
const qs = {} as IDataObject;
@@ -234,9 +214,7 @@ export class Elasticsearch implements INodeType {
const endpoint = `/${indexId}/_doc`;
responseData = await elasticsearchApiRequest.call(this, 'POST', endpoint, body, qs);
}
} else if (operation === 'update') {
// ----------------------------------------
// document: update
// ----------------------------------------
@@ -245,24 +223,22 @@ export class Elasticsearch implements INodeType {
const body = { doc: {} } as { doc: { [key: string]: string } };
const dataToSend = this.getNodeParameter('dataToSend', 0) as 'defineBelow' | 'autoMapInputData';
const dataToSend = this.getNodeParameter('dataToSend', 0) as
| 'defineBelow'
| 'autoMapInputData';
if (dataToSend === 'defineBelow') {
const fields = this.getNodeParameter('fieldsUi.fieldValues', i, []) as FieldsUiValues;
fields.forEach(({ fieldId, fieldValue }) => body.doc[fieldId] = fieldValue);
fields.forEach(({ fieldId, fieldValue }) => (body.doc[fieldId] = fieldValue));
} else {
const inputData = items[i].json;
const rawInputsToIgnore = this.getNodeParameter('inputsToIgnore', i) as string;
const inputsToIgnore = rawInputsToIgnore.split(',').map(c => c.trim());
const inputsToIgnore = rawInputsToIgnore.split(',').map((c) => c.trim());
for (const key of Object.keys(inputData)) {
if (inputsToIgnore.includes(key)) continue;
body.doc[key] = inputData[key] as string;
}
}
const indexId = this.getNodeParameter('indexId', i);
@@ -275,11 +251,8 @@ export class Elasticsearch implements INodeType {
const endpoint = `/${indexId}/_update/${documentId}`;
responseData = await elasticsearchApiRequest.call(this, 'POST', endpoint, body, qs);
}
} else if (resource === 'index') {
// **********************************************************************
// index
// **********************************************************************
@@ -287,7 +260,6 @@ export class Elasticsearch implements INodeType {
// https://www.elastic.co/guide/en/elasticsearch/reference/current/indices.html
if (operation === 'create') {
// ----------------------------------------
// index: create
// ----------------------------------------
@@ -309,9 +281,7 @@ export class Elasticsearch implements INodeType {
responseData = await elasticsearchApiRequest.call(this, 'PUT', `/${indexId}`);
responseData = { id: indexId, ...responseData };
delete responseData.index;
} else if (operation === 'delete') {
// ----------------------------------------
// index: delete
// ----------------------------------------
@@ -322,9 +292,7 @@ export class Elasticsearch implements INodeType {
responseData = await elasticsearchApiRequest.call(this, 'DELETE', `/${indexId}`);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------------
// index: get
// ----------------------------------------
@@ -342,9 +310,7 @@ export class Elasticsearch implements INodeType {
responseData = await elasticsearchApiRequest.call(this, 'GET', `/${indexId}`, {}, qs);
responseData = { id: indexId, ...responseData[indexId] };
} else if (operation === 'getAll') {
// ----------------------------------------
// index: getAll
// ----------------------------------------
@@ -352,7 +318,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 = Object.keys(responseData).map(i => ({ indexId: i }));
responseData = Object.keys(responseData).map((i) => ({ indexId: i }));
const returnAll = this.getNodeParameter('returnAll', i);
@@ -360,15 +326,12 @@ export class Elasticsearch implements INodeType {
const limit = this.getNodeParameter('limit', i) as number;
responseData = responseData.slice(0, limit);
}
}
}
Array.isArray(responseData)
? returnData.push(...responseData)
: returnData.push(responseData);
}
return [this.helpers.returnJsonArray(returnData)];

View File

@@ -1,20 +1,10 @@
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
IDataObject,
JsonObject,
NodeApiError,
} from 'n8n-workflow';
import { IDataObject, JsonObject, NodeApiError } from 'n8n-workflow';
import {
ElasticsearchApiCredentials,
} from './types';
import { ElasticsearchApiCredentials } from './types';
export async function elasticsearchApiRequest(
this: IExecuteFunctions,
@@ -23,10 +13,9 @@ export async function elasticsearchApiRequest(
body: IDataObject = {},
qs: IDataObject = {},
) {
const {
baseUrl,
ignoreSSLIssues,
} = await this.getCredentials('elasticsearchApi') as ElasticsearchApiCredentials;
const { baseUrl, ignoreSSLIssues } = (await this.getCredentials(
'elasticsearchApi',
)) as ElasticsearchApiCredentials;
const options: OptionsWithUri = {
method,

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
import * as placeholders from './placeholders';
@@ -12,9 +10,7 @@ export const documentOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'document',
],
resource: ['document'],
},
},
options: [
@@ -66,12 +62,8 @@ export const documentFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'delete',
],
resource: ['document'],
operation: ['delete'],
},
},
},
@@ -84,12 +76,8 @@ export const documentFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'delete',
],
resource: ['document'],
operation: ['delete'],
},
},
},
@@ -106,12 +94,8 @@ export const documentFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'get',
],
resource: ['document'],
operation: ['get'],
},
},
},
@@ -124,12 +108,8 @@ export const documentFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'get',
],
resource: ['document'],
operation: ['get'],
},
},
},
@@ -141,12 +121,8 @@ export const documentFields: INodeProperties[] = [
description: 'Whether to return a simplified version of the response instead of the raw data',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'get',
],
resource: ['document'],
operation: ['get'],
},
},
},
@@ -158,12 +134,8 @@ export const documentFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'get',
],
resource: ['document'],
operation: ['get'],
},
},
options: [
@@ -184,7 +156,8 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'Stored Fields',
name: 'stored_fields',
description: 'Whether to retrieve the document fields stored in the index rather than the document <code>_source</code>. Defaults to false.',
description:
'Whether to retrieve the document fields stored in the index rather than the document <code>_source</code>. Defaults to false.',
type: 'boolean',
default: false,
},
@@ -203,12 +176,8 @@ export const documentFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'getAll',
],
resource: ['document'],
operation: ['getAll'],
},
},
},
@@ -220,12 +189,8 @@ export const documentFields: INodeProperties[] = [
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'getAll',
],
resource: ['document'],
operation: ['getAll'],
},
},
},
@@ -240,15 +205,9 @@ export const documentFields: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['document'],
operation: ['getAll'],
returnAll: [false],
},
},
},
@@ -260,12 +219,8 @@ export const documentFields: INodeProperties[] = [
description: 'Whether to return a simplified version of the response instead of the raw data',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'getAll',
],
resource: ['document'],
operation: ['getAll'],
},
},
},
@@ -277,12 +232,8 @@ export const documentFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'getAll',
],
resource: ['document'],
operation: ['getAll'],
},
},
options: [
@@ -290,7 +241,8 @@ export const documentFields: INodeProperties[] = [
displayName: 'Allow No Indices',
name: 'allow_no_indices',
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'If false, return an error if any of the following targets only missing/closed indices: wildcard expression, index alias, or <code>_all</code> value. Defaults to true.',
description:
'If false, return an error if any of the following targets only missing/closed indices: wildcard expression, index alias, or <code>_all</code> value. Defaults to true.',
type: 'boolean',
default: true,
},
@@ -298,14 +250,16 @@ export const documentFields: INodeProperties[] = [
displayName: 'Allow Partial Search Results',
name: 'allow_partial_search_results',
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: '<p>If true, return partial results if there are shard request timeouts or shard failures.</p><p>If false, returns an error with no partial results. Defaults to true.</p>.',
description:
'<p>If true, return partial results if there are shard request timeouts or shard failures.</p><p>If false, returns an error with no partial results. Defaults to true.</p>.',
type: 'boolean',
default: true,
},
{
displayName: 'Batched Reduce Size',
name: 'batched_reduce_size',
description: 'Number of shard results that should be reduced at once on the coordinating node. Defaults to 512.',
description:
'Number of shard results that should be reduced at once on the coordinating node. Defaults to 512.',
type: 'number',
typeOptions: {
minValue: 2,
@@ -315,21 +269,24 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'CCS Minimize Roundtrips',
name: 'ccs_minimize_roundtrips',
description: 'Whether network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search (CCS) requests. Defaults to true.',
description:
'Whether network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search (CCS) requests. Defaults to true.',
type: 'boolean',
default: true,
},
{
displayName: 'Doc Value Fields',
name: 'docvalue_fields',
description: 'Comma-separated list of fields to return as the docvalue representation of a field for each hit',
description:
'Comma-separated list of fields to return as the docvalue representation of a field for each hit',
type: 'string',
default: '',
},
{
displayName: 'Expand Wildcards',
name: 'expand_wildcards',
description: 'Type of index that wildcard expressions can match. Defaults to <code>open</code>',
description:
'Type of index that wildcard expressions can match. Defaults to <code>open</code>',
type: 'options',
options: [
{
@@ -358,35 +315,40 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'Explain',
name: 'explain',
description: 'Whether to return detailed information about score computation as part of a hit. Defaults to false.',
description:
'Whether to return detailed information about score computation as part of a hit. Defaults to false.',
type: 'boolean',
default: false,
},
{
displayName: 'Ignore Throttled',
name: 'ignore_throttled',
description: 'Whether concrete, expanded or aliased indices are ignored when frozen. Defaults to true.',
description:
'Whether concrete, expanded or aliased indices are ignored when frozen. Defaults to true.',
type: 'boolean',
default: true,
},
{
displayName: 'Ignore Unavailable',
name: 'ignore_unavailable',
description: 'Whether missing or closed indices are not included in the response. Defaults to false.',
description:
'Whether missing or closed indices are not included in the response. Defaults to false.',
type: 'boolean',
default: false,
},
{
displayName: 'Max Concurrent Shard Requests',
name: 'max_concurrent_shard_requests',
description: 'Define the number of shard requests per node this search executes concurrently. Defaults to 5.',
description:
'Define the number of shard requests per node this search executes concurrently. Defaults to 5.',
type: 'number',
default: 5,
},
{
displayName: 'Pre-Filter Shard Size',
name: 'pre_filter_shard_size',
description: 'Define a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting. Only used if the number of shards the search request expands to exceeds the threshold.',
description:
'Define a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting. Only used if the number of shards the search request expands to exceeds the threshold.',
type: 'number',
typeOptions: {
minValue: 1,
@@ -396,7 +358,8 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'Query',
name: 'query',
description: 'Query in the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html">Elasticsearch Query DSL</a>',
description:
'Query in the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html">Elasticsearch Query DSL</a>',
type: 'json',
typeOptions: {
alwaysOpenEditWindow: true,
@@ -407,7 +370,8 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'Request Cache',
name: 'request_cache',
description: 'Whether 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">Elasticsearch shard request cache settings</a>.',
description:
'Whether 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">Elasticsearch shard request cache settings</a>.',
type: 'boolean',
default: false,
},
@@ -421,7 +385,8 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'Search Type',
name: 'search_type',
description: 'How distributed term frequencies are calculated for relevance scoring. Defaults to Query then Fetch.',
description:
'How distributed term frequencies are calculated for relevance scoring. Defaults to Query then Fetch.',
type: 'options',
options: [
{
@@ -438,7 +403,8 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'Sequence Number and Primary Term',
name: 'seq_no_primary_term',
description: 'Whether to return the sequence number and primary term of the last modification of each hit. See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/optimistic-concurrency-control.html">Optimistic concurrency control</a>.',
description:
'Whether to return the sequence number and primary term of the last modification of each hit. See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/optimistic-concurrency-control.html">Optimistic concurrency control</a>.',
type: 'boolean',
default: false,
},
@@ -473,7 +439,8 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'Stored Fields',
name: 'stored_fields',
description: 'Whether to retrieve the document fields stored in the index rather than the document <code>_source</code>. Defaults to false.',
description:
'Whether to retrieve the document fields stored in the index rather than the document <code>_source</code>. Defaults to false.',
type: 'boolean',
default: false,
},
@@ -487,14 +454,16 @@ export const documentFields: INodeProperties[] = [
{
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">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">Elasticsearch time units reference</a>',
type: 'string',
default: '1m',
},
{
displayName: 'Track Scores',
name: 'track_scores',
description: 'Whether to calculate and return document scores, even if the scores are not used for sorting. Defaults to false.',
description:
'Whether to calculate and return document scores, even if the scores are not used for sorting. Defaults to false.',
type: 'boolean',
default: false,
},
@@ -527,12 +496,8 @@ export const documentFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'create',
],
resource: ['document'],
operation: ['create'],
},
},
},
@@ -554,12 +519,8 @@ export const documentFields: INodeProperties[] = [
],
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'create',
],
resource: ['document'],
operation: ['create'],
},
},
default: 'defineBelow',
@@ -571,19 +532,14 @@ export const documentFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'create',
],
dataToSend: [
'autoMapInputData',
],
resource: ['document'],
operation: ['create'],
dataToSend: ['autoMapInputData'],
},
},
default: '',
description: 'List of input properties to avoid sending, separated by commas. Leave empty to send all properties.',
description:
'List of input properties to avoid sending, separated by commas. Leave empty to send all properties.',
placeholder: 'Enter properties...',
},
{
@@ -597,15 +553,9 @@ export const documentFields: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'create',
],
dataToSend: [
'defineBelow',
],
resource: ['document'],
operation: ['create'],
dataToSend: ['defineBelow'],
},
},
default: {},
@@ -638,12 +588,8 @@ export const documentFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'create',
],
resource: ['document'],
operation: ['create'],
},
},
options: [
@@ -664,7 +610,8 @@ export const documentFields: INodeProperties[] = [
{
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">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">Elasticsearch time units reference</a>',
type: 'string',
default: '1m',
},
@@ -678,12 +625,8 @@ export const documentFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'create',
],
resource: ['document'],
operation: ['create'],
},
},
options: [
@@ -697,7 +640,8 @@ export const documentFields: INodeProperties[] = [
{
displayName: 'Refresh',
name: 'refresh',
description: 'If true, Elasticsearch refreshes the affected shards to make this operation visible to search,if wait_for then wait for a refresh to make this operation visible to search,if false do nothing with refreshes',
description:
'If true, Elasticsearch refreshes the affected shards to make this operation visible to search,if wait_for then wait for a refresh to make this operation visible to search,if false do nothing with refreshes',
type: 'options',
default: 'false',
options: [
@@ -733,12 +677,8 @@ export const documentFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'update',
],
resource: ['document'],
operation: ['update'],
},
},
},
@@ -751,12 +691,8 @@ export const documentFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'update',
],
resource: ['document'],
operation: ['update'],
},
},
},
@@ -778,12 +714,8 @@ export const documentFields: INodeProperties[] = [
],
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'update',
],
resource: ['document'],
operation: ['update'],
},
},
default: 'defineBelow',
@@ -795,19 +727,14 @@ export const documentFields: INodeProperties[] = [
type: 'string',
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'update',
],
dataToSend: [
'autoMapInputData',
],
resource: ['document'],
operation: ['update'],
dataToSend: ['autoMapInputData'],
},
},
default: '',
description: 'List of input properties to avoid sending, separated by commas. Leave empty to send all properties.',
description:
'List of input properties to avoid sending, separated by commas. Leave empty to send all properties.',
placeholder: 'Enter properties...',
},
{
@@ -821,15 +748,9 @@ export const documentFields: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'update',
],
dataToSend: [
'defineBelow',
],
resource: ['document'],
operation: ['update'],
dataToSend: ['defineBelow'],
},
},
default: {},
@@ -862,19 +783,16 @@ export const documentFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'document',
],
operation: [
'update',
],
resource: ['document'],
operation: ['update'],
},
},
options: [
{
displayName: 'Refresh',
name: 'refresh',
description: 'If true, Elasticsearch refreshes the affected shards to make this operation visible to search,if wait_for then wait for a refresh to make this operation visible to search,if false do nothing with refreshes',
description:
'If true, Elasticsearch refreshes the affected shards to make this operation visible to search,if wait_for then wait for a refresh to make this operation visible to search,if false do nothing with refreshes',
type: 'options',
default: 'false',
options: [

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
import * as placeholders from './placeholders';
@@ -12,9 +10,7 @@ export const indexOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'index',
],
resource: ['index'],
},
},
options: [
@@ -56,12 +52,8 @@ export const indexFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'index',
],
operation: [
'create',
],
resource: ['index'],
operation: ['create'],
},
},
},
@@ -73,19 +65,16 @@ export const indexFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'index',
],
operation: [
'create',
],
resource: ['index'],
operation: ['create'],
},
},
options: [
{
displayName: 'Aliases',
name: 'aliases',
description: 'Index aliases which include the index, as an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">alias object</a>',
description:
'Index aliases which include the index, as an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">alias object</a>',
type: 'json',
typeOptions: {
alwaysOpenEditWindow: true,
@@ -96,14 +85,16 @@ export const indexFields: INodeProperties[] = [
{
displayName: 'Include Type Name',
name: 'include_type_name',
description: 'Whether a mapping type is expected in the body of mappings. Defaults to false.',
description:
'Whether a mapping type is expected in the body of mappings. Defaults to false.',
type: 'boolean',
default: false,
},
{
displayName: 'Mappings',
name: 'mappings',
description: 'Mapping for fields in the index, as <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html">mapping object</a>',
description:
'Mapping for fields in the index, as <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html">mapping object</a>',
type: 'json',
typeOptions: {
alwaysOpenEditWindow: true,
@@ -114,14 +105,16 @@ export const indexFields: INodeProperties[] = [
{
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, 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">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, 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">Elasticsearch time units reference</a>',
type: 'string',
default: '1m',
},
{
displayName: 'Settings',
name: 'settings',
description: 'Configuration options for the index, as an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings">index settings object</a>',
description:
'Configuration options for the index, as an <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings">index settings object</a>',
type: 'json',
typeOptions: {
alwaysOpenEditWindow: true,
@@ -132,14 +125,16 @@ export const indexFields: INodeProperties[] = [
{
displayName: 'Timeout',
name: 'timeout',
description: 'Period to wait for a response. If no response is received before the timeout expires, the request 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">Elasticsearch time units reference</a>',
description:
'Period to wait for a response. If no response is received before the timeout expires, the request 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">Elasticsearch time units reference</a>',
type: 'string',
default: '30s',
},
{
displayName: 'Wait for Active Shards',
name: 'wait_for_active_shards',
description: 'The number of shard copies that must be active before proceeding with the operation. Set to <code>all</code> or any positive integer up to the total number of shards in the index. Default: 1, the primary shard',
description:
'The number of shard copies that must be active before proceeding with the operation. Set to <code>all</code> or any positive integer up to the total number of shards in the index. Default: 1, the primary shard',
type: 'string',
default: '1',
},
@@ -158,12 +153,8 @@ export const indexFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'index',
],
operation: [
'delete',
],
resource: ['index'],
operation: ['delete'],
},
},
},
@@ -180,12 +171,8 @@ export const indexFields: INodeProperties[] = [
default: '',
displayOptions: {
show: {
resource: [
'index',
],
operation: [
'get',
],
resource: ['index'],
operation: ['get'],
},
},
},
@@ -197,12 +184,8 @@ export const indexFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'index',
],
operation: [
'get',
],
resource: ['index'],
operation: ['get'],
},
},
options: [
@@ -210,14 +193,16 @@ export const indexFields: INodeProperties[] = [
displayName: 'Allow No Indices',
name: 'allow_no_indices',
// eslint-disable-next-line n8n-nodes-base/node-param-description-boolean-without-whether
description: 'If false, return an error if any of the following targets only missing/closed indices: wildcard expression, index alias, or <code>_all</code> value. Defaults to true.',
description:
'If false, return an error if any of the following targets only missing/closed indices: wildcard expression, index alias, or <code>_all</code> value. Defaults to true.',
type: 'boolean',
default: true,
},
{
displayName: 'Expand Wildcards',
name: 'expand_wildcards',
description: 'Type of index that wildcard expressions can match. Defaults to <code>open</code>',
description:
'Type of index that wildcard expressions can match. Defaults to <code>open</code>',
type: 'options',
options: [
{
@@ -253,7 +238,8 @@ export const indexFields: INodeProperties[] = [
{
displayName: 'Ignore Unavailable',
name: 'ignore_unavailable',
description: 'Whether to request that target a missing index return an error. Defaults to false.',
description:
'Whether to request that target a missing index return an error. Defaults to false.',
type: 'boolean',
default: false,
},
@@ -274,7 +260,8 @@ export const indexFields: INodeProperties[] = [
{
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, 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">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, 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">Elasticsearch time units reference</a>',
type: 'string',
default: '1m',
},
@@ -292,12 +279,8 @@ export const indexFields: INodeProperties[] = [
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'index',
],
operation: [
'getAll',
],
resource: ['index'],
operation: ['getAll'],
},
},
},
@@ -312,15 +295,9 @@ export const indexFields: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'index',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['index'],
operation: ['getAll'],
returnAll: [false],
},
},
},