n8n-3867-progressively-apply-prettier-to-all (#3873)

* 🔨 formatting nodes with prettier
This commit is contained in:
Michael Kret
2022-08-17 18:50:24 +03:00
committed by GitHub
parent f2d326c7f0
commit 91d7e16c81
1072 changed files with 42357 additions and 59109 deletions

View File

@@ -1,21 +1,10 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
IDataObject,
ILoadOptionsFunctions,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';
import { IDataObject, ILoadOptionsFunctions, NodeApiError, NodeOperationError } from 'n8n-workflow';
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
import {
flow,
} from 'lodash';
import { flow } from 'lodash';
import type { Zammad } from './types';
@@ -37,8 +26,9 @@ export async function zammadApiRequest(
const authentication = this.getNodeParameter('authentication', 0) as 'basicAuth' | 'tokenAuth';
if (authentication === 'basicAuth') {
const credentials = await this.getCredentials('zammadBasicAuthApi') as Zammad.BasicAuthCredentials;
const credentials = (await this.getCredentials(
'zammadBasicAuthApi',
)) as Zammad.BasicAuthCredentials;
const baseUrl = tolerateTrailingSlash(credentials.baseUrl);
@@ -50,10 +40,10 @@ export async function zammadApiRequest(
};
options.rejectUnauthorized = !credentials.allowUnauthorizedCerts;
} else {
const credentials = await this.getCredentials('zammadTokenAuthApi') as Zammad.TokenAuthCredentials;
const credentials = (await this.getCredentials(
'zammadTokenAuthApi',
)) as Zammad.TokenAuthCredentials;
const baseUrl = tolerateTrailingSlash(credentials.baseUrl);
@@ -64,7 +54,6 @@ export async function zammadApiRequest(
};
options.rejectUnauthorized = !credentials.allowUnauthorizedCerts;
}
if (!Object.keys(body).length) {
@@ -117,9 +106,7 @@ export async function zammadApiRequestAllItems(
}
export function tolerateTrailingSlash(url: string) {
return url.endsWith('/')
? url.substr(0, url.length - 1)
: url;
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
}
export function throwOnEmptyUpdate(this: IExecuteFunctions, resource: string) {
@@ -143,18 +130,19 @@ export const isCustomer = (user: Zammad.User) =>
user.role_ids.includes(3) && !user.email.endsWith('@zammad.org');
export async function getAllFields(this: ILoadOptionsFunctions) {
return await zammadApiRequest.call(this, 'GET', '/object_manager_attributes') as Zammad.Field[];
return (await zammadApiRequest.call(this, 'GET', '/object_manager_attributes')) as Zammad.Field[];
}
const isTypeField = (resource: 'Group' | 'Organization' | 'Ticket' | 'User') =>
(arr: Zammad.Field[]) => arr.filter(i => i.object === resource);
const isTypeField =
(resource: 'Group' | 'Organization' | 'Ticket' | 'User') => (arr: Zammad.Field[]) =>
arr.filter((i) => i.object === resource);
export const getGroupFields = isTypeField('Group');
export const getOrganizationFields = isTypeField('Organization');
export const getUserFields = isTypeField('User');
export const getTicketFields = isTypeField('Ticket');
const getCustomFields = (arr: Zammad.Field[]) => arr.filter(i => i.created_by_id !== 1);
const getCustomFields = (arr: Zammad.Field[]) => arr.filter((i) => i.created_by_id !== 1);
export const getGroupCustomFields = flow(getGroupFields, getCustomFields);
export const getOrganizationCustomFields = flow(getOrganizationFields, getCustomFields);
@@ -163,4 +151,5 @@ export const getTicketCustomFields = flow(getTicketFields, getCustomFields);
export const isNotZammadFoundation = (i: Zammad.Organization) => i.name !== 'Zammad Foundation';
export const doesNotBelongToZammad = (i: Zammad.User) => !i.email.endsWith('@zammad.org') && i.login !== '-';
export const doesNotBelongToZammad = (i: Zammad.User) =>
!i.email.endsWith('@zammad.org') && i.login !== '-';

View File

@@ -1,6 +1,4 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
ICredentialsDecrypted,
@@ -14,9 +12,7 @@ import {
NodeOperationError,
} from 'n8n-workflow';
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
import {
groupDescription,
@@ -59,12 +55,8 @@ export class Zammad implements INodeType {
defaults: {
name: 'Zammad',
},
inputs: [
'main',
],
outputs: [
'main',
],
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'zammadBasicAuthApi',
@@ -72,9 +64,7 @@ export class Zammad implements INodeType {
testedBy: 'zammadBasicAuthApiTest',
displayOptions: {
show: {
authentication: [
'basicAuth',
],
authentication: ['basicAuth'],
},
},
},
@@ -84,9 +74,7 @@ export class Zammad implements INodeType {
testedBy: 'zammadTokenAuthApiTest',
displayOptions: {
show: {
authentication: [
'tokenAuth',
],
authentication: ['tokenAuth'],
},
},
},
@@ -209,47 +197,55 @@ export class Zammad implements INodeType {
* POST /tickets requires group name instead of group ID.
*/
async loadGroupNames(this: ILoadOptionsFunctions) {
const groups = await zammadApiRequest.call(this, 'GET', '/groups') as ZammadTypes.Group[];
const groups = (await zammadApiRequest.call(this, 'GET', '/groups')) as ZammadTypes.Group[];
return groups.map(i => ({ name: i.name, value: i.name }));
return groups.map((i) => ({ name: i.name, value: i.name }));
},
/**
* PUT /users requires organization name instead of organization ID.
*/
async loadOrganizationNames(this: ILoadOptionsFunctions) {
const orgs = await zammadApiRequest.call(this, 'GET', '/organizations') as ZammadTypes.Group[];
const orgs = (await zammadApiRequest.call(
this,
'GET',
'/organizations',
)) as ZammadTypes.Group[];
return orgs.filter(isNotZammadFoundation).map(i => ({ name: i.name, value: i.name }));
return orgs.filter(isNotZammadFoundation).map((i) => ({ name: i.name, value: i.name }));
},
/**
* POST & PUT /tickets requires customer email instead of customer ID.
*/
async loadCustomerEmails(this: ILoadOptionsFunctions) {
const users = await zammadApiRequest.call(this, 'GET', '/users') as ZammadTypes.User[];
const users = (await zammadApiRequest.call(this, 'GET', '/users')) as ZammadTypes.User[];
return users.filter(isCustomer).map(i => ({ name: i.email, value: i.email }));
return users.filter(isCustomer).map((i) => ({ name: i.email, value: i.email }));
},
// by ID
async loadGroups(this: ILoadOptionsFunctions) {
const groups = await zammadApiRequest.call(this, 'GET', '/groups') as ZammadTypes.Group[];
const groups = (await zammadApiRequest.call(this, 'GET', '/groups')) as ZammadTypes.Group[];
return groups.map(i => ({ name: i.name, value: i.id }));
return groups.map((i) => ({ name: i.name, value: i.id }));
},
async loadOrganizations(this: ILoadOptionsFunctions) {
const orgs = await zammadApiRequest.call(this, 'GET', '/organizations') as ZammadTypes.Organization[];
const orgs = (await zammadApiRequest.call(
this,
'GET',
'/organizations',
)) as ZammadTypes.Organization[];
return orgs.filter(isNotZammadFoundation).map(i => ({ name: i.name, value: i.id }));
return orgs.filter(isNotZammadFoundation).map((i) => ({ name: i.name, value: i.id }));
},
async loadUsers(this: ILoadOptionsFunctions) {
const users = await zammadApiRequest.call(this, 'GET', '/users') as ZammadTypes.User[];
const users = (await zammadApiRequest.call(this, 'GET', '/users')) as ZammadTypes.User[];
return users.filter(doesNotBelongToZammad).map(i => ({ name: i.login, value: i.id }));
return users.filter(doesNotBelongToZammad).map((i) => ({ name: i.login, value: i.id }));
},
},
credentialTest: {
@@ -330,17 +326,13 @@ export class Zammad implements INodeType {
const returnData: IDataObject[] = [];
for (let i = 0; i < items.length; i++) {
try {
if (resource === 'user') {
// **********************************************************************
// user
// **********************************************************************
if (operation === 'create') {
// ----------------------------------
// user:create
// ----------------------------------
@@ -352,11 +344,10 @@ export class Zammad implements INodeType {
lastname: this.getNodeParameter('lastname', i),
};
const {
addressUi,
customFieldsUi,
...rest
} = this.getNodeParameter('additionalFields', i) as ZammadTypes.UserAdditionalFields;
const { addressUi, customFieldsUi, ...rest } = this.getNodeParameter(
'additionalFields',
i,
) as ZammadTypes.UserAdditionalFields;
Object.assign(body, addressUi?.addressDetails);
@@ -367,9 +358,7 @@ export class Zammad implements INodeType {
Object.assign(body, rest);
responseData = await zammadApiRequest.call(this, 'POST', '/users', body);
} else if (operation === 'update') {
// ----------------------------------
// user:update
// ----------------------------------
@@ -380,7 +369,10 @@ export class Zammad implements INodeType {
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i) as ZammadTypes.UserUpdateFields;
const updateFields = this.getNodeParameter(
'updateFields',
i,
) as ZammadTypes.UserUpdateFields;
if (!Object.keys(updateFields).length) {
throwOnEmptyUpdate.call(this, resource);
@@ -397,9 +389,7 @@ export class Zammad implements INodeType {
Object.assign(body, rest);
responseData = await zammadApiRequest.call(this, 'PUT', `/users/${id}`, body);
} else if (operation === 'delete') {
// ----------------------------------
// user:delete
// ----------------------------------
@@ -411,9 +401,7 @@ export class Zammad implements INodeType {
await zammadApiRequest.call(this, 'DELETE', `/users/${id}`);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------
// user:get
// ----------------------------------
@@ -423,9 +411,7 @@ export class Zammad implements INodeType {
const id = this.getNodeParameter('id', i) as string;
responseData = await zammadApiRequest.call(this, 'GET', `/users/${id}`);
} else if (operation === 'getAll') {
// ----------------------------------
// user:getAll
// ----------------------------------
@@ -435,7 +421,10 @@ export class Zammad implements INodeType {
const qs: IDataObject = {};
const { sortUi, ...rest } = this.getNodeParameter('filters', i) as ZammadTypes.UserFilterFields;
const { sortUi, ...rest } = this.getNodeParameter(
'filters',
i,
) as ZammadTypes.UserFilterFields;
Object.assign(qs, sortUi?.sortDetails);
@@ -445,19 +434,17 @@ export class Zammad implements INodeType {
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
const limit = returnAll ? 0 : this.getNodeParameter('limit', i) as number;
const limit = returnAll ? 0 : (this.getNodeParameter('limit', i) as number);
responseData = await zammadApiRequestAllItems.call(
this, 'GET', '/users/search', {}, qs, limit,
).then(responseData => {
return responseData.map(user => {
const { preferences, ...rest } = user;
return rest;
responseData = await zammadApiRequestAllItems
.call(this, 'GET', '/users/search', {}, qs, limit)
.then((responseData) => {
return responseData.map((user) => {
const { preferences, ...rest } = user;
return rest;
});
});
});
} else if (operation === 'getSelf') {
// ----------------------------------
// user:me
// ----------------------------------
@@ -466,15 +453,12 @@ export class Zammad implements INodeType {
responseData = await zammadApiRequest.call(this, 'GET', '/users/me');
}
} else if (resource === 'organization') {
// **********************************************************************
// organization
// **********************************************************************
if (operation === 'create') {
// ----------------------------------
// organization:create
// ----------------------------------
@@ -485,10 +469,10 @@ export class Zammad implements INodeType {
name: this.getNodeParameter('name', i),
};
const {
customFieldsUi,
...rest
} = this.getNodeParameter('additionalFields', i) as ZammadTypes.UserAdditionalFields;
const { customFieldsUi, ...rest } = this.getNodeParameter(
'additionalFields',
i,
) as ZammadTypes.UserAdditionalFields;
customFieldsUi?.customFieldPairs.forEach((pair) => {
body[pair['name']] = pair['value'];
@@ -497,9 +481,7 @@ export class Zammad implements INodeType {
Object.assign(body, rest);
responseData = await zammadApiRequest.call(this, 'POST', '/organizations', body);
} else if (operation === 'update') {
// ----------------------------------
// organization:update
// ----------------------------------
@@ -510,7 +492,10 @@ export class Zammad implements INodeType {
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i) as ZammadTypes.UserUpdateFields;
const updateFields = this.getNodeParameter(
'updateFields',
i,
) as ZammadTypes.UserUpdateFields;
if (!Object.keys(updateFields).length) {
throwOnEmptyUpdate.call(this, resource);
@@ -525,9 +510,7 @@ export class Zammad implements INodeType {
Object.assign(body, rest);
responseData = await zammadApiRequest.call(this, 'PUT', `/organizations/${id}`, body);
} else if (operation === 'delete') {
// ----------------------------------
// organization:delete
// ----------------------------------
@@ -539,9 +522,7 @@ export class Zammad implements INodeType {
await zammadApiRequest.call(this, 'DELETE', `/organizations/${id}`);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------
// organization:get
// ----------------------------------
@@ -551,9 +532,7 @@ export class Zammad implements INodeType {
const id = this.getNodeParameter('id', i) as string;
responseData = await zammadApiRequest.call(this, 'GET', `/organizations/${id}`);
} else if (operation === 'getAll') {
// ----------------------------------
// organization:getAll
// ----------------------------------
@@ -563,22 +542,23 @@ export class Zammad implements INodeType {
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
const limit = returnAll ? 0 : this.getNodeParameter('limit', i) as number;
const limit = returnAll ? 0 : (this.getNodeParameter('limit', i) as number);
responseData = await zammadApiRequestAllItems.call(
this, 'GET', '/organizations', {}, {}, limit,
this,
'GET',
'/organizations',
{},
{},
limit,
);
}
} else if (resource === 'group') {
// **********************************************************************
// group
// **********************************************************************
if (operation === 'create') {
// ----------------------------------
// group:create
// ----------------------------------
@@ -589,10 +569,10 @@ export class Zammad implements INodeType {
name: this.getNodeParameter('name', i) as string,
};
const {
customFieldsUi,
...rest
} = this.getNodeParameter('additionalFields', i) as ZammadTypes.UserAdditionalFields;
const { customFieldsUi, ...rest } = this.getNodeParameter(
'additionalFields',
i,
) as ZammadTypes.UserAdditionalFields;
customFieldsUi?.customFieldPairs.forEach((pair) => {
body[pair['name']] = pair['value'];
@@ -601,9 +581,7 @@ export class Zammad implements INodeType {
Object.assign(body, rest);
responseData = await zammadApiRequest.call(this, 'POST', '/groups', body);
} else if (operation === 'update') {
// ----------------------------------
// group:update
// ----------------------------------
@@ -614,7 +592,10 @@ export class Zammad implements INodeType {
const body: IDataObject = {};
const updateFields = this.getNodeParameter('updateFields', i) as ZammadTypes.GroupUpdateFields;
const updateFields = this.getNodeParameter(
'updateFields',
i,
) as ZammadTypes.GroupUpdateFields;
if (!Object.keys(updateFields).length) {
throwOnEmptyUpdate.call(this, resource);
@@ -629,9 +610,7 @@ export class Zammad implements INodeType {
Object.assign(body, rest);
responseData = await zammadApiRequest.call(this, 'PUT', `/groups/${id}`, body);
} else if (operation === 'delete') {
// ----------------------------------
// group:delete
// ----------------------------------
@@ -643,9 +622,7 @@ export class Zammad implements INodeType {
await zammadApiRequest.call(this, 'DELETE', `/groups/${id}`);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------
// group:get
// ----------------------------------
@@ -655,9 +632,7 @@ export class Zammad implements INodeType {
const id = this.getNodeParameter('id', i) as string;
responseData = await zammadApiRequest.call(this, 'GET', `/groups/${id}`);
} else if (operation === 'getAll') {
// ----------------------------------
// group:getAll
// ----------------------------------
@@ -666,22 +641,23 @@ export class Zammad implements INodeType {
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
const limit = returnAll ? 0 : this.getNodeParameter('limit', i) as number;
const limit = returnAll ? 0 : (this.getNodeParameter('limit', i) as number);
responseData = await zammadApiRequestAllItems.call(
this, 'GET', '/groups', {}, {}, limit,
this,
'GET',
'/groups',
{},
{},
limit,
);
}
} else if (resource === 'ticket') {
// **********************************************************************
// ticket
// **********************************************************************
if (operation === 'create') {
// ----------------------------------
// ticket:create
// ----------------------------------
@@ -714,10 +690,12 @@ export class Zammad implements INodeType {
const { id } = responseData;
responseData.articles = await zammadApiRequest.call(this, 'GET', `/ticket_articles/by_ticket/${id}`);
responseData.articles = await zammadApiRequest.call(
this,
'GET',
`/ticket_articles/by_ticket/${id}`,
);
} else if (operation === 'delete') {
// ----------------------------------
// ticket:delete
// ----------------------------------
@@ -729,9 +707,7 @@ export class Zammad implements INodeType {
await zammadApiRequest.call(this, 'DELETE', `/tickets/${id}`);
responseData = { success: true };
} else if (operation === 'get') {
// ----------------------------------
// ticket:get
// ----------------------------------
@@ -741,10 +717,12 @@ export class Zammad implements INodeType {
const id = this.getNodeParameter('id', i) as string;
responseData = await zammadApiRequest.call(this, 'GET', `/tickets/${id}`);
responseData.articles = await zammadApiRequest.call(this, 'GET', `/ticket_articles/by_ticket/${id}`);
responseData.articles = await zammadApiRequest.call(
this,
'GET',
`/ticket_articles/by_ticket/${id}`,
);
} else if (operation === 'getAll') {
// ----------------------------------
// ticket:getAll
// ----------------------------------
@@ -754,20 +732,22 @@ export class Zammad implements INodeType {
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
const limit = returnAll ? 0 : this.getNodeParameter('limit', i) as number;
const limit = returnAll ? 0 : (this.getNodeParameter('limit', i) as number);
responseData = await zammadApiRequestAllItems.call(
this, 'GET', '/tickets', {}, {}, limit,
this,
'GET',
'/tickets',
{},
{},
limit,
);
}
}
Array.isArray(responseData)
? returnData.push(...responseData)
: returnData.push(responseData);
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ error: error.message });

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
export const groupDescription: INodeProperties[] = [
// ----------------------------------
@@ -13,9 +11,7 @@ export const groupDescription: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'group',
],
resource: ['group'],
},
},
options: [
@@ -64,12 +60,8 @@ export const groupDescription: INodeProperties[] = [
required: true,
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'group',
],
operation: ['create'],
resource: ['group'],
},
},
},
@@ -77,17 +69,14 @@ export const groupDescription: INodeProperties[] = [
displayName: 'Group ID',
name: 'id',
type: 'string',
description: 'Group to update. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Group to update. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'group',
],
operation: [
'update',
],
resource: ['group'],
operation: ['update'],
},
},
},
@@ -95,17 +84,14 @@ export const groupDescription: INodeProperties[] = [
displayName: 'Group ID',
name: 'id',
type: 'string',
description: 'Group to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Group to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'group',
],
operation: [
'delete',
],
resource: ['group'],
operation: ['delete'],
},
},
},
@@ -113,17 +99,14 @@ export const groupDescription: INodeProperties[] = [
displayName: 'Group ID',
name: 'id',
type: 'string',
description: 'Group to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Group to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'group',
],
operation: [
'get',
],
resource: ['group'],
operation: ['get'],
},
},
},
@@ -134,12 +117,8 @@ export const groupDescription: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
resource: [
'group',
],
operation: [
'create',
],
resource: ['group'],
operation: ['create'],
},
},
default: {},
@@ -173,7 +152,8 @@ export const groupDescription: INodeProperties[] = [
loadOptionsMethod: 'loadGroupCustomFields',
},
default: '',
description: 'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Field Value',
@@ -203,12 +183,8 @@ export const groupDescription: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'group',
],
operation: ['update'],
resource: ['group'],
},
},
default: {},
@@ -242,7 +218,8 @@ export const groupDescription: INodeProperties[] = [
loadOptionsMethod: 'loadGroupCustomFields',
},
default: '',
description: 'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Field Value',
@@ -280,12 +257,8 @@ export const groupDescription: INodeProperties[] = [
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'group',
],
operation: [
'getAll',
],
resource: ['group'],
operation: ['getAll'],
},
},
},
@@ -300,15 +273,9 @@ export const groupDescription: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'group',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['group'],
operation: ['getAll'],
returnAll: [false],
},
},
},

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
export const organizationDescription: INodeProperties[] = [
// ----------------------------------
@@ -13,9 +11,7 @@ export const organizationDescription: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'organization',
],
resource: ['organization'],
},
},
options: [
@@ -64,12 +60,8 @@ export const organizationDescription: INodeProperties[] = [
required: true,
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'organization',
],
operation: ['create'],
resource: ['organization'],
},
},
},
@@ -77,17 +69,14 @@ export const organizationDescription: INodeProperties[] = [
displayName: 'Organization ID',
name: 'id',
type: 'string',
description: 'Organization to update. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Organization to update. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'organization',
],
operation: [
'update',
],
resource: ['organization'],
operation: ['update'],
},
},
},
@@ -95,17 +84,14 @@ export const organizationDescription: INodeProperties[] = [
displayName: 'Organization ID',
name: 'id',
type: 'string',
description: 'Organization to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Organization to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'organization',
],
operation: [
'delete',
],
resource: ['organization'],
operation: ['delete'],
},
},
},
@@ -113,17 +99,14 @@ export const organizationDescription: INodeProperties[] = [
displayName: 'Organization ID',
name: 'id',
type: 'string',
description: 'Organization to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Organization to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'organization',
],
operation: [
'get',
],
resource: ['organization'],
operation: ['get'],
},
},
},
@@ -133,12 +116,8 @@ export const organizationDescription: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'organization',
],
operation: ['create'],
resource: ['organization'],
},
},
default: {},
@@ -172,7 +151,8 @@ export const organizationDescription: INodeProperties[] = [
loadOptionsMethod: 'loadOrganizationCustomFields',
},
default: '',
description: 'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Value',
@@ -202,12 +182,8 @@ export const organizationDescription: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'organization',
],
operation: ['update'],
resource: ['organization'],
},
},
default: {},
@@ -241,7 +217,8 @@ export const organizationDescription: INodeProperties[] = [
loadOptionsMethod: 'loadOrganizationCustomFields',
},
default: '',
description: 'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Value',
@@ -279,12 +256,8 @@ export const organizationDescription: INodeProperties[] = [
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'organization',
],
operation: [
'getAll',
],
resource: ['organization'],
operation: ['getAll'],
},
},
},
@@ -299,15 +272,9 @@ export const organizationDescription: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'organization',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['organization'],
operation: ['getAll'],
returnAll: [false],
},
},
},

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
export const ticketDescription: INodeProperties[] = [
// ----------------------------------
@@ -13,9 +11,7 @@ export const ticketDescription: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'ticket',
],
resource: ['ticket'],
},
},
options: [
@@ -59,12 +55,8 @@ export const ticketDescription: INodeProperties[] = [
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'create',
],
resource: ['ticket'],
operation: ['create'],
},
},
},
@@ -76,17 +68,14 @@ export const ticketDescription: INodeProperties[] = [
loadOptionsMethod: 'loadGroupNames',
},
placeholder: 'First-Level Helpdesk',
description: 'Group that will own the ticket to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Group that will own the ticket to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'create',
],
resource: ['ticket'],
operation: ['create'],
},
},
},
@@ -97,18 +86,15 @@ export const ticketDescription: INodeProperties[] = [
typeOptions: {
loadOptionsMethod: 'loadCustomerEmails',
},
description: 'Email address of the customer concerned in the ticket to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Email address of the customer concerned in the ticket to create. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
placeholder: 'hello@n8n.io',
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'create',
],
resource: ['ticket'],
operation: ['create'],
},
},
},
@@ -116,17 +102,14 @@ export const ticketDescription: INodeProperties[] = [
displayName: 'Ticket ID',
name: 'id',
type: 'string',
description: 'Ticket to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Ticket to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'get',
],
resource: ['ticket'],
operation: ['get'],
},
},
},
@@ -135,16 +118,13 @@ export const ticketDescription: INodeProperties[] = [
name: 'id',
type: 'string',
default: '',
description: 'Ticket to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Ticket to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
required: true,
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'delete',
],
resource: ['ticket'],
operation: ['delete'],
},
},
},
@@ -157,12 +137,8 @@ export const ticketDescription: INodeProperties[] = [
default: {},
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'create',
],
resource: ['ticket'],
operation: ['create'],
},
},
options: [
@@ -246,12 +222,8 @@ export const ticketDescription: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'create',
],
resource: ['ticket'],
operation: ['create'],
},
},
default: {},
@@ -279,7 +251,8 @@ export const ticketDescription: INodeProperties[] = [
loadOptionsMethod: 'loadTicketCustomFields',
},
default: '',
description: 'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Value',
@@ -302,12 +275,8 @@ export const ticketDescription: INodeProperties[] = [
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'getAll',
],
resource: ['ticket'],
operation: ['getAll'],
},
},
},
@@ -322,15 +291,9 @@ export const ticketDescription: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'ticket',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['ticket'],
operation: ['getAll'],
returnAll: [false],
},
},
},

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
export const userDescription: INodeProperties[] = [
// ----------------------------------
@@ -13,9 +11,7 @@ export const userDescription: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'user',
],
resource: ['user'],
},
},
options: [
@@ -71,12 +67,8 @@ export const userDescription: INodeProperties[] = [
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
resource: ['user'],
operation: ['create'],
},
},
},
@@ -89,12 +81,8 @@ export const userDescription: INodeProperties[] = [
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
resource: ['user'],
operation: ['create'],
},
},
},
@@ -102,17 +90,14 @@ export const userDescription: INodeProperties[] = [
displayName: 'User ID',
name: 'id',
type: 'string',
description: 'User to update. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'User to update. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'update',
],
resource: ['user'],
operation: ['update'],
},
},
},
@@ -120,17 +105,14 @@ export const userDescription: INodeProperties[] = [
displayName: 'User ID',
name: 'id',
type: 'string',
description: 'User to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'User to delete. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'delete',
],
resource: ['user'],
operation: ['delete'],
},
},
},
@@ -138,17 +120,14 @@ export const userDescription: INodeProperties[] = [
displayName: 'User ID',
name: 'id',
type: 'string',
description: 'User to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'User to retrieve. Specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
required: true,
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'get',
],
resource: ['user'],
operation: ['get'],
},
},
},
@@ -158,12 +137,8 @@ export const userDescription: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'create',
],
resource: ['user'],
operation: ['create'],
},
},
default: {},
@@ -240,7 +215,8 @@ export const userDescription: INodeProperties[] = [
loadOptionsMethod: 'loadUserCustomFields',
},
default: '',
description: 'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Field Value',
@@ -287,7 +263,8 @@ export const userDescription: INodeProperties[] = [
displayName: 'Organization Name or ID',
name: 'organization',
type: 'options',
description: 'Name of the organization to assign to the user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the organization to assign to the user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
typeOptions: {
loadOptionsMethod: 'loadOrganizations',
@@ -336,12 +313,8 @@ export const userDescription: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'user',
],
operation: ['update'],
resource: ['user'],
},
},
default: {},
@@ -418,7 +391,8 @@ export const userDescription: INodeProperties[] = [
loadOptionsMethod: 'loadUserCustomFields',
},
default: '',
description: 'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the custom field to set. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Field Value',
@@ -479,7 +453,8 @@ export const userDescription: INodeProperties[] = [
displayName: 'Organization Name or ID',
name: 'organization',
type: 'options',
description: 'Name of the organization to assign to the user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Name of the organization to assign to the user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
default: '',
typeOptions: {
loadOptionsMethod: 'loadOrganizationNames',
@@ -530,12 +505,8 @@ export const userDescription: INodeProperties[] = [
required: true,
displayOptions: {
show: {
operation: [
'search',
],
resource: [
'user',
],
operation: ['search'],
resource: ['user'],
},
},
},
@@ -549,12 +520,8 @@ export const userDescription: INodeProperties[] = [
},
displayOptions: {
show: {
operation: [
'search',
],
resource: [
'user',
],
operation: ['search'],
resource: ['user'],
},
},
description: 'Max number of results to return',
@@ -567,12 +534,8 @@ export const userDescription: INodeProperties[] = [
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
resource: ['user'],
operation: ['getAll'],
},
},
},
@@ -587,15 +550,9 @@ export const userDescription: INodeProperties[] = [
},
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['user'],
operation: ['getAll'],
returnAll: [false],
},
},
},
@@ -605,12 +562,8 @@ export const userDescription: INodeProperties[] = [
type: 'collection',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'getAll',
],
resource: ['user'],
operation: ['getAll'],
},
},
default: {},
@@ -639,7 +592,8 @@ export const userDescription: INodeProperties[] = [
displayName: 'Sort Key Name or ID',
name: 'sort_by',
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: 'loadUserFields',
},

View File

@@ -1,6 +1,4 @@
import {
IDataObject,
} from 'n8n-workflow';
import { IDataObject } from 'n8n-workflow';
export declare namespace Zammad {
export type Resource = 'group' | 'organization' | 'ticket' | 'user';
@@ -12,7 +10,7 @@ export declare namespace Zammad {
type CredentialsBase = {
baseUrl: string;
allowUnauthorizedCerts: boolean;
}
};
export type BasicAuthCredentials = CredentialsBase & {
authType: 'basicAuth';
@@ -48,7 +46,7 @@ export declare namespace Zammad {
};
export type Field = {
id: number,
id: number;
display: string;
name: string;
object: string;
@@ -62,7 +60,7 @@ export declare namespace Zammad {
export type CustomFieldsUi = {
customFieldsUi?: {
customFieldPairs: Array<{ name: string, value: string }>;
customFieldPairs: Array<{ name: string; value: string }>;
};
};
@@ -88,10 +86,10 @@ export declare namespace Zammad {
export type Article = {
articleDetails: {
visibility: 'external' | 'internal',
subject: string,
body: string,
type: 'chat' | 'email' | 'fax' | 'note' | 'phone' | 'sms',
visibility: 'external' | 'internal';
subject: string;
body: string;
type: 'chat' | 'email' | 'fax' | 'note' | 'phone' | 'sms';
};
};
}