mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
INodeTypeBaseDescription,
|
||||
INodeVersionedType,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeTypeBaseDescription, INodeVersionedType } from 'n8n-workflow';
|
||||
|
||||
import { NodeVersionedType } from '../../src/NodeVersionedType';
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialDataDecryptedObject,
|
||||
@@ -18,7 +16,6 @@ import { router } from './actions/router';
|
||||
import { validateCredentials } from './transport';
|
||||
|
||||
export class SyncroMspV1 implements INodeType {
|
||||
|
||||
description: INodeTypeDescription;
|
||||
|
||||
constructor(baseDescription: INodeTypeBaseDescription) {
|
||||
@@ -31,7 +28,10 @@ export class SyncroMspV1 implements INodeType {
|
||||
methods = {
|
||||
loadOptions,
|
||||
credentialTest: {
|
||||
async syncroMspApiCredentialTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
|
||||
async syncroMspApiCredentialTest(
|
||||
this: ICredentialTestFunctions,
|
||||
credential: ICredentialsDecrypted,
|
||||
): Promise<INodeCredentialTestResult> {
|
||||
try {
|
||||
await validateCredentials.call(this, credential.data as ICredentialDataDecryptedObject);
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import {
|
||||
AllEntities,
|
||||
Entity,
|
||||
PropertiesOf,
|
||||
} from 'n8n-workflow';
|
||||
import { AllEntities, Entity, PropertiesOf } from 'n8n-workflow';
|
||||
|
||||
type SyncroMspMap = {
|
||||
contact: 'create'|'delete'|'get'|'getAll'|'update';
|
||||
customer: 'create'|'delete'|'get'|'getAll'|'update';
|
||||
rmm: 'create'|'delete'|'get'|'getAll'|'mute' ;
|
||||
ticket: 'create'|'delete'|'get'|'getAll'|'update';
|
||||
contact: 'create' | 'delete' | 'get' | 'getAll' | 'update';
|
||||
customer: 'create' | 'delete' | 'get' | 'getAll' | 'update';
|
||||
rmm: 'create' | 'delete' | 'get' | 'getAll' | 'mute';
|
||||
ticket: 'create' | 'delete' | 'get' | 'getAll' | 'update';
|
||||
};
|
||||
|
||||
export type SyncroMsp = AllEntities<SyncroMspMap>;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
ContactProperties,
|
||||
} from '../../Interfaces';
|
||||
import { ContactProperties } from '../../Interfaces';
|
||||
|
||||
import {
|
||||
addressFixedCollection
|
||||
} from '../../../methods/sharedFields';
|
||||
import { addressFixedCollection } from '../../../methods/sharedFields';
|
||||
|
||||
export const contactCreateDescription: ContactProperties = [
|
||||
{
|
||||
@@ -14,12 +10,8 @@ export const contactCreateDescription: ContactProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -31,12 +23,8 @@ export const contactCreateDescription: ContactProperties = [
|
||||
placeholder: 'name@email.com',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -48,12 +36,8 @@ export const contactCreateDescription: ContactProperties = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest,
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function createContact(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function createContact(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('customerId', index) as IDataObject;
|
||||
const email = this.getNodeParameter('email', index) as IDataObject;
|
||||
const { address, notes, phone, name } = this.getNodeParameter('additionalFields', index) as IDataObject;
|
||||
const { address, notes, phone, name } = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
index,
|
||||
) as IDataObject;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'POST';
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { createContact as execute } from './execute';
|
||||
import { contactCreateDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
ContactProperties,
|
||||
} from '../../Interfaces';
|
||||
import { ContactProperties } from '../../Interfaces';
|
||||
|
||||
export const contactDeleteDescription: ContactProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const contactDeleteDescription: ContactProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function deleteContact(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function deleteContact(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('contactId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { deleteContact as execute } from './execute';
|
||||
import { contactDeleteDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
ContactProperties,
|
||||
} from '../../Interfaces';
|
||||
import { ContactProperties } from '../../Interfaces';
|
||||
|
||||
export const contactGetDescription: ContactProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const contactGetDescription: ContactProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function getContact(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function getContact(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('contactId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { getContact as execute } from './execute';
|
||||
import { contactGetDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
ContactProperties,
|
||||
} from '../../Interfaces';
|
||||
import { ContactProperties } from '../../Interfaces';
|
||||
|
||||
export const contactGetAllDescription: ContactProperties = [
|
||||
{
|
||||
@@ -9,12 +7,8 @@ export const contactGetAllDescription: ContactProperties = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
noDataExpression: true,
|
||||
@@ -31,15 +25,9 @@ export const contactGetAllDescription: ContactProperties = [
|
||||
description: 'Max number of results to return',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
default: 25,
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest, apiRequestAllItems
|
||||
} from '../../../transport';
|
||||
import { apiRequest, apiRequestAllItems } from '../../../transport';
|
||||
|
||||
export async function getAll(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function getAll(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const returnAll = this.getNodeParameter('returnAll', index) as boolean;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
@@ -26,6 +22,6 @@ export async function getAll(this: IExecuteFunctions, index: number): Promise<IN
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', index) as IDataObject;
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray((responseData.contacts).splice(0, limit));
|
||||
return this.helpers.returnJsonArray(responseData.contacts.splice(0, limit));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { getAll as execute } from './execute';
|
||||
import { contactGetAllDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import * as getAll from './getAll';
|
||||
import * as create from './create';
|
||||
import * as get from './get';
|
||||
@@ -7,14 +6,7 @@ import * as del from './del';
|
||||
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export {
|
||||
getAll,
|
||||
create,
|
||||
del as delete,
|
||||
update,
|
||||
get,
|
||||
};
|
||||
|
||||
export { getAll, create, del as delete, update, get };
|
||||
|
||||
export const descriptions = [
|
||||
{
|
||||
@@ -24,9 +16,7 @@ export const descriptions = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
resource: ['contact'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
ContactProperties,
|
||||
} from '../../Interfaces';
|
||||
import { ContactProperties } from '../../Interfaces';
|
||||
|
||||
import {
|
||||
addressFixedCollection
|
||||
} from '../../../methods/sharedFields';
|
||||
import { addressFixedCollection } from '../../../methods/sharedFields';
|
||||
|
||||
export const contactUpdateDescription: ContactProperties = [
|
||||
{
|
||||
@@ -13,12 +9,8 @@ export const contactUpdateDescription: ContactProperties = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -30,12 +22,8 @@ export const contactUpdateDescription: ContactProperties = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['contact'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest,
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function updateContact(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function updateContact(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('contactId', index) as IDataObject;
|
||||
const { address, customerId, email, name, notes, phone } = this.getNodeParameter('updateFields', index) as IDataObject;
|
||||
const { address, customerId, email, name, notes, phone } = this.getNodeParameter(
|
||||
'updateFields',
|
||||
index,
|
||||
) as IDataObject;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'PUT';
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { updateContact as execute } from './execute';
|
||||
import { contactUpdateDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
CustomerProperties,
|
||||
} from '../../Interfaces';
|
||||
import { CustomerProperties } from '../../Interfaces';
|
||||
|
||||
import {
|
||||
addressFixedCollection
|
||||
} from '../../../methods/sharedFields';
|
||||
import { addressFixedCollection } from '../../../methods/sharedFields';
|
||||
|
||||
export const customerCreateDescription: CustomerProperties = [
|
||||
{
|
||||
@@ -14,12 +10,8 @@ export const customerCreateDescription: CustomerProperties = [
|
||||
placeholder: 'name@email.com',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -31,12 +23,8 @@ export const customerCreateDescription: CustomerProperties = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -95,9 +83,7 @@ export const customerCreateDescription: CustomerProperties = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
noEmail: [
|
||||
false,
|
||||
],
|
||||
noEmail: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -112,7 +98,8 @@ export const customerCreateDescription: CustomerProperties = [
|
||||
name: 'referredBy',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Source from which customer is referred to the platform like Linkedin, Google, Customer name etc',
|
||||
description:
|
||||
'Source from which customer is referred to the platform like Linkedin, Google, Customer name etc',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest,
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function addCustomer(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function addCustomer(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const email = this.getNodeParameter('email', index) as IDataObject;
|
||||
const { address, getSms, businessName, lastname, firstName, invoiceCcEmails, noEmail, notes, notificationEmail, phone, referredBy } = this.getNodeParameter('additionalFields', index) as IDataObject;
|
||||
const {
|
||||
address,
|
||||
getSms,
|
||||
businessName,
|
||||
lastname,
|
||||
firstName,
|
||||
invoiceCcEmails,
|
||||
noEmail,
|
||||
notes,
|
||||
notificationEmail,
|
||||
phone,
|
||||
referredBy,
|
||||
} = this.getNodeParameter('additionalFields', index) as IDataObject;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'POST';
|
||||
@@ -32,7 +40,7 @@ export async function addCustomer(this: IExecuteFunctions, index: number): Promi
|
||||
email,
|
||||
firstname: firstName,
|
||||
get_sms: getSms,
|
||||
invoice_cc_emails: (invoiceCcEmails as string[] || []).join(','),
|
||||
invoice_cc_emails: ((invoiceCcEmails as string[]) || []).join(','),
|
||||
lastname,
|
||||
no_email: noEmail,
|
||||
notes,
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { addCustomer as execute } from './execute';
|
||||
import { customerCreateDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
CustomerProperties,
|
||||
} from '../../Interfaces';
|
||||
import { CustomerProperties } from '../../Interfaces';
|
||||
|
||||
export const customerDeleteDescription: CustomerProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const customerDeleteDescription: CustomerProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function deleteCustomer(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function deleteCustomer(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('customerId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { deleteCustomer as execute } from './execute';
|
||||
import { customerDeleteDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
CustomerProperties,
|
||||
} from '../../Interfaces';
|
||||
import { CustomerProperties } from '../../Interfaces';
|
||||
|
||||
export const customerGetDescription: CustomerProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const customerGetDescription: CustomerProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function getCustomer(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function getCustomer(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('customerId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { getCustomer as execute } from './execute';
|
||||
import { customerGetDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
CustomerProperties,
|
||||
} from '../../Interfaces';
|
||||
import { CustomerProperties } from '../../Interfaces';
|
||||
|
||||
export const customerGetAllDescription: CustomerProperties = [
|
||||
{
|
||||
@@ -9,12 +7,8 @@ export const customerGetAllDescription: CustomerProperties = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -30,15 +24,9 @@ export const customerGetAllDescription: CustomerProperties = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
default: 25,
|
||||
@@ -51,12 +39,8 @@ export const customerGetAllDescription: CustomerProperties = [
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest, apiRequestAllItems
|
||||
} from '../../../transport';
|
||||
import { apiRequest, apiRequestAllItems } from '../../../transport';
|
||||
|
||||
|
||||
export async function getAll(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function getAll(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const returnAll = this.getNodeParameter('returnAll', index) as boolean;
|
||||
const filters = this.getNodeParameter('filters', index) as IDataObject;
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { getAll as execute } from './execute';
|
||||
import { customerGetAllDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import * as getAll from './getAll';
|
||||
import * as create from './create';
|
||||
import * as del from './del';
|
||||
@@ -7,14 +6,7 @@ import * as get from './get';
|
||||
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export {
|
||||
getAll,
|
||||
create,
|
||||
del as delete,
|
||||
update,
|
||||
get,
|
||||
};
|
||||
|
||||
export { getAll, create, del as delete, update, get };
|
||||
|
||||
export const descriptions = [
|
||||
{
|
||||
@@ -24,9 +16,7 @@ export const descriptions = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
resource: ['customer'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -69,4 +59,3 @@ export const descriptions = [
|
||||
...del.description,
|
||||
...update.description,
|
||||
] as INodeProperties[];
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
CustomerProperties,
|
||||
} from '../../Interfaces';
|
||||
import { CustomerProperties } from '../../Interfaces';
|
||||
|
||||
import {
|
||||
addressFixedCollection
|
||||
} from '../../../methods/sharedFields';
|
||||
import { addressFixedCollection } from '../../../methods/sharedFields';
|
||||
|
||||
export const customerUpdateDescription: CustomerProperties = [
|
||||
{
|
||||
@@ -13,12 +9,8 @@ export const customerUpdateDescription: CustomerProperties = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -30,12 +22,8 @@ export const customerUpdateDescription: CustomerProperties = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'customer',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['customer'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -101,9 +89,7 @@ export const customerUpdateDescription: CustomerProperties = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
noEmail: [
|
||||
false,
|
||||
],
|
||||
noEmail: [false],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -118,7 +104,8 @@ export const customerUpdateDescription: CustomerProperties = [
|
||||
name: 'referredBy',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Source from which customer is referred to the platform like Linkedin, Google, Customer name etc',
|
||||
description:
|
||||
'Source from which customer is referred to the platform like Linkedin, Google, Customer name etc',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest,
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function updateCustomer(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function updateCustomer(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('customerId', index) as IDataObject;
|
||||
const { address, businessName, email, firstName, getSms, invoiceCcEmails,
|
||||
lastName, noEmail, notes, notificationEmail, phone, referredBy } = this.getNodeParameter('updateFields', index) as IDataObject;
|
||||
const {
|
||||
address,
|
||||
businessName,
|
||||
email,
|
||||
firstName,
|
||||
getSms,
|
||||
invoiceCcEmails,
|
||||
lastName,
|
||||
noEmail,
|
||||
notes,
|
||||
notificationEmail,
|
||||
phone,
|
||||
referredBy,
|
||||
} = this.getNodeParameter('updateFields', index) as IDataObject;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'PUT';
|
||||
@@ -35,7 +41,7 @@ export async function updateCustomer(this: IExecuteFunctions, index: number): Pr
|
||||
email,
|
||||
firstname: firstName,
|
||||
get_sms: getSms,
|
||||
invoice_cc_emails: (invoiceCcEmails as string[] || []).join(','),
|
||||
invoice_cc_emails: ((invoiceCcEmails as string[]) || []).join(','),
|
||||
lastname: lastName,
|
||||
no_email: noEmail,
|
||||
notes,
|
||||
@@ -47,7 +53,10 @@ export async function updateCustomer(this: IExecuteFunctions, index: number): Pr
|
||||
let responseData;
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
if (!responseData.customer) {
|
||||
throw new NodeApiError(this.getNode(), responseData, { httpCode: '404', message: 'Customer ID not found' });
|
||||
throw new NodeApiError(this.getNode(), responseData, {
|
||||
httpCode: '404',
|
||||
message: 'Customer ID not found',
|
||||
});
|
||||
}
|
||||
return this.helpers.returnJsonArray(responseData.customer);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { updateCustomer as execute } from './execute';
|
||||
import { customerUpdateDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
RmmProperties,
|
||||
} from '../../Interfaces';
|
||||
import { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmCreateDescription: RmmProperties = [
|
||||
{
|
||||
@@ -9,12 +7,8 @@ export const rmmCreateDescription: RmmProperties = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -25,12 +19,8 @@ export const rmmCreateDescription: RmmProperties = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -41,12 +31,8 @@ export const rmmCreateDescription: RmmProperties = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -58,12 +44,8 @@ export const rmmCreateDescription: RmmProperties = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest,
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function addAlert(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function addAlert(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const customerId = this.getNodeParameter('customerId', index) as IDataObject;
|
||||
const assetId = this.getNodeParameter('assetId', index) as IDataObject;
|
||||
const description = this.getNodeParameter('description', index) as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { addAlert as execute } from './execute';
|
||||
import { rmmCreateDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
RmmProperties,
|
||||
} from '../../Interfaces';
|
||||
import { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmDeleteDescription: RmmProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const rmmDeleteDescription: RmmProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function deleteAlert(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function deleteAlert(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('alertId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { deleteAlert as execute } from './execute';
|
||||
import { rmmDeleteDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
RmmProperties,
|
||||
} from '../../Interfaces';
|
||||
import { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmGetDescription: RmmProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const rmmGetDescription: RmmProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function getAlert(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function getAlert(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('alertId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { getAlert as execute } from './execute';
|
||||
import { rmmGetDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
RmmProperties,
|
||||
} from '../../Interfaces';
|
||||
import { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmGetAllDescription: RmmProperties = [
|
||||
{
|
||||
@@ -9,12 +7,8 @@ export const rmmGetAllDescription: RmmProperties = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -30,15 +24,9 @@ export const rmmGetAllDescription: RmmProperties = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
default: 25,
|
||||
@@ -51,12 +39,8 @@ export const rmmGetAllDescription: RmmProperties = [
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest, apiRequestAllItems
|
||||
} from '../../../transport';
|
||||
import { apiRequest, apiRequestAllItems } from '../../../transport';
|
||||
|
||||
export async function getAll(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function getAll(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const returnAll = this.getNodeParameter('returnAll', index) as boolean;
|
||||
const filters = this.getNodeParameter('filters', index) as IDataObject;
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { getAll as execute } from './execute';
|
||||
import { rmmGetAllDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import * as get from './get';
|
||||
import * as getAll from './getAll';
|
||||
import * as create from './create';
|
||||
@@ -7,14 +6,7 @@ import * as mute from './mute';
|
||||
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export {
|
||||
getAll,
|
||||
get,
|
||||
mute,
|
||||
del as delete,
|
||||
create,
|
||||
};
|
||||
|
||||
export { getAll, get, mute, del as delete, create };
|
||||
|
||||
export const descriptions = [
|
||||
{
|
||||
@@ -24,9 +16,7 @@ export const descriptions = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
RmmProperties,
|
||||
} from '../../Interfaces';
|
||||
import { RmmProperties } from '../../Interfaces';
|
||||
|
||||
export const rmmMuteDescription: RmmProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const rmmMuteDescription: RmmProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'mute',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['mute'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -27,12 +21,8 @@ export const rmmMuteDescription: RmmProperties = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'rmm',
|
||||
],
|
||||
operation: [
|
||||
'mute',
|
||||
],
|
||||
resource: ['rmm'],
|
||||
operation: ['mute'],
|
||||
},
|
||||
},
|
||||
// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function muteAlert(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function muteAlert(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('alertId', index) as string;
|
||||
const mute = this.getNodeParameter('muteFor', index) as string;
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { muteAlert as execute } from './execute';
|
||||
import { rmmMuteDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
INodeExecutionData, NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeExecutionData, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import * as customer from './customer';
|
||||
import * as ticket from './ticket';
|
||||
@@ -31,13 +27,13 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
|
||||
|
||||
try {
|
||||
if (syncroMsp.resource === 'customer') {
|
||||
operationResult.push(...await customer[syncroMsp.operation].execute.call(this, i));
|
||||
operationResult.push(...(await customer[syncroMsp.operation].execute.call(this, i)));
|
||||
} else if (syncroMsp.resource === 'ticket') {
|
||||
operationResult.push(...await ticket[syncroMsp.operation].execute.call(this, i));
|
||||
operationResult.push(...(await ticket[syncroMsp.operation].execute.call(this, i)));
|
||||
} else if (syncroMsp.resource === 'contact') {
|
||||
operationResult.push(...await contact[syncroMsp.operation].execute.call(this, i));
|
||||
operationResult.push(...(await contact[syncroMsp.operation].execute.call(this, i)));
|
||||
} else if (syncroMsp.resource === 'rmm') {
|
||||
operationResult.push(...await rmm[syncroMsp.operation].execute.call(this, i));
|
||||
operationResult.push(...(await rmm[syncroMsp.operation].execute.call(this, i)));
|
||||
}
|
||||
} catch (err) {
|
||||
if (this.continueOnFail()) {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
TicketProperties,
|
||||
} from '../../Interfaces';
|
||||
import { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketCreateDescription: TicketProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const ticketCreateDescription: TicketProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -27,12 +21,8 @@ export const ticketCreateDescription: TicketProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -44,12 +34,8 @@ export const ticketCreateDescription: TicketProperties = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -134,7 +120,6 @@ export const ticketCreateDescription: TicketProperties = [
|
||||
name: 'Waiting on Customer',
|
||||
value: 'Waiting on Customer',
|
||||
},
|
||||
|
||||
],
|
||||
default: 'New',
|
||||
description: 'If used along the parameter Search Query, only Search Query will be applied',
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest,
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function createTicket(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function createTicket(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('customerId', index) as IDataObject;
|
||||
const subject = this.getNodeParameter('subject', index) as IDataObject;
|
||||
const { assetId, dueDate, issueType, status, contactId } = this.getNodeParameter('additionalFields', index) as IDataObject;
|
||||
const { assetId, dueDate, issueType, status, contactId } = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
index,
|
||||
) as IDataObject;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'POST';
|
||||
@@ -33,7 +32,7 @@ export async function createTicket(this: IExecuteFunctions, index: number): Prom
|
||||
body.subject = subject;
|
||||
|
||||
let responseData;
|
||||
|
||||
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
return this.helpers.returnJsonArray(responseData.ticket);
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { createTicket as execute } from './execute';
|
||||
import { ticketCreateDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
TicketProperties,
|
||||
} from '../../Interfaces';
|
||||
import { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketDeleteDescription: TicketProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const ticketDeleteDescription: TicketProperties = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function deleteTicket(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function deleteTicket(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('ticketId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { deleteTicket as execute } from './execute';
|
||||
import { ticketDeleteDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
TicketProperties,
|
||||
} from '../../Interfaces';
|
||||
import { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketGetDescription: TicketProperties = [
|
||||
{
|
||||
@@ -9,12 +7,8 @@ export const ticketGetDescription: TicketProperties = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function getTicket(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function getTicket(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('ticketId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { getTicket as execute } from './execute';
|
||||
import { ticketGetDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
TicketProperties,
|
||||
} from '../../Interfaces';
|
||||
import { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketGetAllDescription: TicketProperties = [
|
||||
{
|
||||
@@ -9,12 +7,8 @@ export const ticketGetAllDescription: TicketProperties = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -30,15 +24,9 @@ export const ticketGetAllDescription: TicketProperties = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
default: 25,
|
||||
@@ -51,12 +39,8 @@ export const ticketGetAllDescription: TicketProperties = [
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest, apiRequestAllItems
|
||||
} from '../../../transport';
|
||||
import { apiRequest, apiRequestAllItems } from '../../../transport';
|
||||
|
||||
|
||||
export async function getAll(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function getAll(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const returnAll = this.getNodeParameter('returnAll', index) as boolean;
|
||||
const filters = this.getNodeParameter('filters', index) as IDataObject;
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { getAll as execute } from './execute';
|
||||
import { ticketGetAllDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import * as getAll from './getAll';
|
||||
import * as create from './create';
|
||||
import * as get from './get';
|
||||
@@ -7,13 +6,7 @@ import * as update from './update';
|
||||
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export {
|
||||
getAll,
|
||||
create,
|
||||
get,
|
||||
del as delete,
|
||||
update,
|
||||
};
|
||||
export { getAll, create, get, del as delete, update };
|
||||
|
||||
export const descriptions = [
|
||||
{
|
||||
@@ -23,9 +16,7 @@ export const descriptions = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
TicketProperties,
|
||||
} from '../../Interfaces';
|
||||
import { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketUpdateDescription: TicketProperties = [
|
||||
{
|
||||
@@ -10,12 +8,8 @@ export const ticketUpdateDescription: TicketProperties = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -27,12 +21,8 @@ export const ticketUpdateDescription: TicketProperties = [
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['ticket'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, INodeExecutionData, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest,
|
||||
} from '../../../transport';
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
|
||||
export async function updateTicket(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
export async function updateTicket(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('ticketId', index) as IDataObject;
|
||||
const { assetId, customerId, dueDate, issueType, status, subject, ticketType, contactId } = this.getNodeParameter('updateFields', index) as IDataObject;
|
||||
|
||||
const { assetId, customerId, dueDate, issueType, status, subject, ticketType, contactId } =
|
||||
this.getNodeParameter('updateFields', index) as IDataObject;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'PUT';
|
||||
@@ -35,7 +29,9 @@ export async function updateTicket(this: IExecuteFunctions, index: number): Prom
|
||||
};
|
||||
|
||||
if (!Object.keys(body).length) {
|
||||
throw new NodeOperationError(this.getNode(), 'At least one update fields has to be defined', { itemIndex: index });
|
||||
throw new NodeOperationError(this.getNode(), 'At least one update fields has to be defined', {
|
||||
itemIndex: index,
|
||||
});
|
||||
}
|
||||
|
||||
let responseData;
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import { updateTicket as execute } from './execute';
|
||||
import { ticketUpdateDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
export { description, execute };
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||
import {
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
import * as customer from './customer';
|
||||
import * as ticket from './ticket';
|
||||
|
||||
@@ -5,9 +5,7 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequestAllItems,
|
||||
} from '../transport';
|
||||
import { apiRequestAllItems } from '../transport';
|
||||
|
||||
// Get all the available channels
|
||||
|
||||
@@ -28,11 +26,14 @@ export async function getCustomers(this: ILoadOptionsFunctions): Promise<INodePr
|
||||
}
|
||||
|
||||
returnData.sort((a, b) => {
|
||||
if (a.name < b.name) { return -1; }
|
||||
if (a.name > b.name) { return 1; }
|
||||
if (a.name < b.name) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name > b.name) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const addressFixedCollection: INodeProperties = {
|
||||
displayName: 'Address',
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
GenericValue,
|
||||
@@ -50,7 +46,6 @@ export async function apiRequestAllItems(
|
||||
body: IDataObject = {},
|
||||
query: IDataObject = {},
|
||||
) {
|
||||
|
||||
let returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
@@ -60,21 +55,20 @@ export async function apiRequestAllItems(
|
||||
responseData = await apiRequest.call(this, method, endpoint, body, query);
|
||||
query.page++;
|
||||
returnData = returnData.concat(responseData[endpoint]);
|
||||
} while (
|
||||
responseData[endpoint].length !== 0
|
||||
);
|
||||
} while (responseData[endpoint].length !== 0);
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export async function validateCredentials(this: ICredentialTestFunctions, decryptedCredentials: ICredentialDataDecryptedObject): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function validateCredentials(
|
||||
this: ICredentialTestFunctions,
|
||||
decryptedCredentials: ICredentialDataDecryptedObject,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = decryptedCredentials;
|
||||
|
||||
const {
|
||||
subdomain,
|
||||
apiKey,
|
||||
} = credentials as {
|
||||
subdomain: string,
|
||||
apiKey: string,
|
||||
const { subdomain, apiKey } = credentials as {
|
||||
subdomain: string;
|
||||
apiKey: string;
|
||||
};
|
||||
|
||||
const options: IHttpRequestOptions = {
|
||||
|
||||
Reference in New Issue
Block a user