mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
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:
@@ -1,15 +1,15 @@
|
||||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||
import {IExecuteFunctions} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
import {
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData, INodePropertyOptions,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
|
||||
import {OptionsWithUri} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
import {
|
||||
getFields,
|
||||
getPortals,
|
||||
@@ -109,7 +109,8 @@ export class FileMaker implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {},
|
||||
placeholder: 'Layout Name',
|
||||
description: 'FileMaker Layout Name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'FileMaker Layout Name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Record ID',
|
||||
@@ -119,12 +120,7 @@ export class FileMaker implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'record',
|
||||
'edit',
|
||||
'delete',
|
||||
'duplicate',
|
||||
],
|
||||
action: ['record', 'edit', 'delete', 'duplicate'],
|
||||
},
|
||||
},
|
||||
placeholder: 'Record ID',
|
||||
@@ -139,10 +135,7 @@ export class FileMaker implements INodeType {
|
||||
default: 1,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'records',
|
||||
],
|
||||
action: ['find', 'records'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -158,10 +151,7 @@ export class FileMaker implements INodeType {
|
||||
default: 100,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'records',
|
||||
],
|
||||
action: ['find', 'records'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -173,11 +163,7 @@ export class FileMaker implements INodeType {
|
||||
description: 'Whether to get portal data as well',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'record',
|
||||
'records',
|
||||
'find',
|
||||
],
|
||||
action: ['record', 'records', 'find'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -194,18 +180,13 @@ export class FileMaker implements INodeType {
|
||||
default: [],
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'record',
|
||||
'records',
|
||||
'find',
|
||||
],
|
||||
getPortals: [
|
||||
true,
|
||||
],
|
||||
action: ['record', 'records', 'find'],
|
||||
getPortals: [true],
|
||||
},
|
||||
},
|
||||
placeholder: 'Portals',
|
||||
description: 'The portal result set to return. Use the portal object name or portal table name. If this parameter is omitted, the API will return all portal objects and records in the layout. For best performance, pass the portal object name or portal table name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The portal result set to return. Use the portal object name or portal table name. If this parameter is omitted, the API will return all portal objects and records in the layout. For best performance, pass the portal object name or portal table name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
// ----------------------------------
|
||||
// find/records
|
||||
@@ -214,7 +195,8 @@ export class FileMaker implements INodeType {
|
||||
displayName: 'Response Layout Name or ID',
|
||||
name: 'responseLayout',
|
||||
type: 'options',
|
||||
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getResponseLayouts',
|
||||
},
|
||||
@@ -222,9 +204,7 @@ export class FileMaker implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
],
|
||||
action: ['find'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -238,9 +218,7 @@ export class FileMaker implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
],
|
||||
action: ['find'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -258,30 +236,32 @@ export class FileMaker implements INodeType {
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
options: [{
|
||||
name: 'field',
|
||||
displayName: 'Field',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Field Name or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getFields',
|
||||
options: [
|
||||
{
|
||||
name: 'field',
|
||||
displayName: 'Field',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Field Name or ID',
|
||||
name: 'name',
|
||||
type: 'options',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getFields',
|
||||
},
|
||||
options: [],
|
||||
description:
|
||||
'Search Field. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
options: [],
|
||||
description: 'Search Field. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to search',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value to search',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
description: 'Field Name',
|
||||
},
|
||||
@@ -303,11 +283,7 @@ export class FileMaker implements INodeType {
|
||||
description: 'Whether to sort data',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -321,13 +297,8 @@ export class FileMaker implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
setSort: [
|
||||
true,
|
||||
],
|
||||
action: [
|
||||
'find',
|
||||
'records',
|
||||
],
|
||||
setSort: [true],
|
||||
action: ['find', 'records'],
|
||||
},
|
||||
},
|
||||
description: 'Sort rules',
|
||||
@@ -346,7 +317,8 @@ export class FileMaker implements INodeType {
|
||||
loadOptionsMethod: 'getFields',
|
||||
},
|
||||
options: [],
|
||||
description: 'Field Name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Field Name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order',
|
||||
@@ -374,14 +346,11 @@ export class FileMaker implements INodeType {
|
||||
name: 'setScriptBefore',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to define a script to be run before the action specified by the API call and after the subsequent sort',
|
||||
description:
|
||||
'Whether to define a script to be run before the action specified by the API call and after the subsequent sort',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -397,18 +366,13 @@ export class FileMaker implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
setScriptBefore: [
|
||||
true,
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
setScriptBefore: [true],
|
||||
},
|
||||
},
|
||||
placeholder: 'Script Name',
|
||||
description: 'The name of the FileMaker script to be run after the action specified by the API call and after the subsequent sort. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The name of the FileMaker script to be run after the action specified by the API call and after the subsequent sort. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Script Parameter',
|
||||
@@ -417,14 +381,8 @@ export class FileMaker implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
setScriptBefore: [
|
||||
true,
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
setScriptBefore: [true],
|
||||
},
|
||||
},
|
||||
placeholder: 'Script Parameters',
|
||||
@@ -435,14 +393,11 @@ export class FileMaker implements INodeType {
|
||||
name: 'setScriptSort',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to define a script to be run after the action specified by the API call but before the subsequent sort',
|
||||
description:
|
||||
'Whether to define a script to be run after the action specified by the API call but before the subsequent sort',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -458,18 +413,13 @@ export class FileMaker implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
setScriptSort: [
|
||||
true,
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
setScriptSort: [true],
|
||||
},
|
||||
},
|
||||
placeholder: 'Script Name',
|
||||
description: 'The name of the FileMaker script to be run after the action specified by the API call but before the subsequent sort. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The name of the FileMaker script to be run after the action specified by the API call but before the subsequent sort. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Script Parameter',
|
||||
@@ -478,14 +428,8 @@ export class FileMaker implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
setScriptSort: [
|
||||
true,
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
setScriptSort: [true],
|
||||
},
|
||||
},
|
||||
placeholder: 'Script Parameters',
|
||||
@@ -496,14 +440,11 @@ export class FileMaker implements INodeType {
|
||||
name: 'setScriptAfter',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Whether to define a script to be run after the action specified by the API call but before the subsequent sort',
|
||||
description:
|
||||
'Whether to define a script to be run after the action specified by the API call but before the subsequent sort',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -519,18 +460,13 @@ export class FileMaker implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
setScriptAfter: [
|
||||
true,
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
setScriptAfter: [true],
|
||||
},
|
||||
},
|
||||
placeholder: 'Script Name',
|
||||
description: 'The name of the FileMaker script to be run after the action specified by the API call and after the subsequent sort. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The name of the FileMaker script to be run after the action specified by the API call and after the subsequent sort. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Script Parameter',
|
||||
@@ -539,14 +475,8 @@ export class FileMaker implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'find',
|
||||
'record',
|
||||
'records',
|
||||
],
|
||||
setScriptAfter: [
|
||||
true,
|
||||
],
|
||||
action: ['find', 'record', 'records'],
|
||||
setScriptAfter: [true],
|
||||
},
|
||||
},
|
||||
placeholder: 'Script Parameters',
|
||||
@@ -574,14 +504,13 @@ export class FileMaker implements INodeType {
|
||||
{
|
||||
displayName: 'Mod ID',
|
||||
name: 'modId',
|
||||
description: 'The last modification ID. When you use modId, a record is edited only when the modId matches.',
|
||||
description:
|
||||
'The last modification ID. When you use modId, a record is edited only when the modId matches.',
|
||||
type: 'number',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'edit',
|
||||
],
|
||||
action: ['edit'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -595,10 +524,7 @@ export class FileMaker implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'create',
|
||||
'edit',
|
||||
],
|
||||
action: ['create', 'edit'],
|
||||
},
|
||||
},
|
||||
description: 'Fields to define',
|
||||
@@ -617,7 +543,8 @@ export class FileMaker implements INodeType {
|
||||
loadOptionsMethod: 'getFields',
|
||||
},
|
||||
options: [],
|
||||
description: 'Field Name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Field Name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
@@ -644,13 +571,12 @@ export class FileMaker implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'performscript',
|
||||
],
|
||||
action: ['performscript'],
|
||||
},
|
||||
},
|
||||
placeholder: 'Script Name',
|
||||
description: 'The name of the FileMaker script to be run. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The name of the FileMaker script to be run. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Script Parameter',
|
||||
@@ -659,9 +585,7 @@ export class FileMaker implements INodeType {
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'performscript',
|
||||
],
|
||||
action: ['performscript'],
|
||||
},
|
||||
},
|
||||
placeholder: 'Script Parameters',
|
||||
@@ -766,7 +690,6 @@ export class FileMaker implements INodeType {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
@@ -795,7 +718,7 @@ export class FileMaker implements INodeType {
|
||||
requestOptions = {
|
||||
uri: '',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
method: 'GET',
|
||||
json: true,
|
||||
@@ -807,15 +730,15 @@ export class FileMaker implements INodeType {
|
||||
const recid = this.getNodeParameter('recid', i) as string;
|
||||
requestOptions.uri = url + `/databases/${database}/layouts/${layout}/records/${recid}`;
|
||||
requestOptions.qs = {
|
||||
'portal': JSON.stringify(parsePortals.call(this, i)),
|
||||
portal: JSON.stringify(parsePortals.call(this, i)),
|
||||
...parseScripts.call(this, i),
|
||||
};
|
||||
} else if (action === 'records') {
|
||||
requestOptions.uri = url + `/databases/${database}/layouts/${layout}/records`;
|
||||
requestOptions.qs = {
|
||||
'_offset': this.getNodeParameter('offset', i),
|
||||
'_limit': this.getNodeParameter('limit', i),
|
||||
'portal': JSON.stringify(parsePortals.call(this, i)),
|
||||
_offset: this.getNodeParameter('offset', i),
|
||||
_limit: this.getNodeParameter('limit', i),
|
||||
portal: JSON.stringify(parsePortals.call(this, i)),
|
||||
...parseScripts.call(this, i),
|
||||
};
|
||||
const sort = parseSort.call(this, i);
|
||||
@@ -826,9 +749,9 @@ export class FileMaker implements INodeType {
|
||||
requestOptions.uri = url + `/databases/${database}/layouts/${layout}/_find`;
|
||||
requestOptions.method = 'POST';
|
||||
requestOptions.body = {
|
||||
'query': parseQuery.call(this, i),
|
||||
'offset': this.getNodeParameter('offset', i),
|
||||
'limit': this.getNodeParameter('limit', i),
|
||||
query: parseQuery.call(this, i),
|
||||
offset: this.getNodeParameter('offset', i),
|
||||
limit: this.getNodeParameter('limit', i),
|
||||
'layout.response': this.getNodeParameter('responseLayout', i),
|
||||
...parseScripts.call(this, i),
|
||||
};
|
||||
@@ -843,7 +766,7 @@ export class FileMaker implements INodeType {
|
||||
|
||||
//TODO: handle portalData
|
||||
requestOptions.body = {
|
||||
fieldData: {...parseFields.call(this, i)},
|
||||
fieldData: { ...parseFields.call(this, i) },
|
||||
portalData: {},
|
||||
...parseScripts.call(this, i),
|
||||
};
|
||||
@@ -855,13 +778,14 @@ export class FileMaker implements INodeType {
|
||||
|
||||
//TODO: handle portalData
|
||||
requestOptions.body = {
|
||||
fieldData: {...parseFields.call(this, i)},
|
||||
fieldData: { ...parseFields.call(this, i) },
|
||||
portalData: {},
|
||||
...parseScripts.call(this, i),
|
||||
};
|
||||
} else if (action === 'performscript') {
|
||||
const scriptName = this.getNodeParameter('script', i) as string;
|
||||
requestOptions.uri = url + `/databases/${database}/layouts/${layout}/script/${scriptName}`;
|
||||
requestOptions.uri =
|
||||
url + `/databases/${database}/layouts/${layout}/script/${scriptName}`;
|
||||
requestOptions.qs = {
|
||||
'script.param': this.getNodeParameter('scriptParam', i),
|
||||
};
|
||||
@@ -881,7 +805,11 @@ export class FileMaker implements INodeType {
|
||||
...parseScripts.call(this, i),
|
||||
};
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), `The action "${action}" is not implemented yet!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`The action "${action}" is not implemented yet!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
// Now that the options are all set make the actual http request
|
||||
@@ -893,9 +821,13 @@ export class FileMaker implements INodeType {
|
||||
}
|
||||
|
||||
if (typeof response === 'string') {
|
||||
throw new NodeOperationError(this.getNode(), 'Response body is not valid JSON. Change "Response Format" to "String"', { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'Response body is not valid JSON. Change "Response Format" to "String"',
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
returnData.push({json: response});
|
||||
returnData.push({ json: response });
|
||||
}
|
||||
} catch (error) {
|
||||
await logout.call(this, token);
|
||||
@@ -904,7 +836,10 @@ export class FileMaker implements INodeType {
|
||||
throw error;
|
||||
}
|
||||
|
||||
throw new NodeOperationError(this.getNode(), `The action "${error.message}" is not implemented yet!`);
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`The action "${error.message}" is not implemented yet!`,
|
||||
);
|
||||
}
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
|
||||
Reference in New Issue
Block a user