Simplify more property types in credentials classes (#2211)

*  Simplify more property types

* 👕 Fix lint
This commit is contained in:
Iván Ovejero 2021-10-07 23:07:56 +02:00 committed by GitHub
parent d3a312cc6b
commit fa05d7557b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 55 additions and 56 deletions

View file

@ -1,24 +1,24 @@
import { ICredentialType, NodePropertyTypes } from 'n8n-workflow'; import { ICredentialType, NodePropertyTypes, INodeProperties } from 'n8n-workflow';
export class ClassNameReplace implements ICredentialType { export class ClassNameReplace implements ICredentialType {
name = 'N8nNameReplace'; name = 'N8nNameReplace';
displayName = 'DisplayNameReplace'; displayName = 'DisplayNameReplace';
properties = [ properties: INodeProperties[] = [
// The credentials to get from user and save encrypted. // The credentials to get from user and save encrypted.
// Properties can be defined exactly in the same way // Properties can be defined exactly in the same way
// as node properties. // as node properties.
{ {
displayName: 'User', displayName: 'User',
name: 'user', name: 'user',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
{ {
displayName: 'Access Token', displayName: 'Access Token',
name: 'accessToken', name: 'accessToken',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
]; ];

View file

@ -1,17 +1,17 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class ActionNetworkApi implements ICredentialType { export class ActionNetworkApi implements ICredentialType {
name = 'actionNetworkApi'; name = 'actionNetworkApi';
displayName = 'Action Network API'; displayName = 'Action Network API';
documentationUrl = 'actionNetwork'; documentationUrl = 'actionNetwork';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'API Key', displayName: 'API Key',
name: 'apiKey', name: 'apiKey',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
]; ];

View file

@ -1,6 +1,6 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class CiscoWebexOAuth2Api implements ICredentialType { export class CiscoWebexOAuth2Api implements ICredentialType {
@ -9,37 +9,37 @@ export class CiscoWebexOAuth2Api implements ICredentialType {
'oAuth2Api', 'oAuth2Api',
]; ];
displayName = 'Cisco Webex OAuth2 API'; displayName = 'Cisco Webex OAuth2 API';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'Authorization URL', displayName: 'Authorization URL',
name: 'authUrl', name: 'authUrl',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'https://webexapis.com/v1/authorize', default: 'https://webexapis.com/v1/authorize',
required: true, required: true,
}, },
{ {
displayName: 'Access Token URL', displayName: 'Access Token URL',
name: 'accessTokenUrl', name: 'accessTokenUrl',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'https://webexapis.com/v1/access_token', default: 'https://webexapis.com/v1/access_token',
required: true, required: true,
}, },
{ {
displayName: 'Scope', displayName: 'Scope',
name: 'scope', name: 'scope',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'spark:memberships_read meeting:recordings_read spark:kms meeting:schedules_read spark:rooms_read spark:messages_write spark:memberships_write meeting:recordings_write meeting:preferences_read spark:messages_read meeting:schedules_write', default: 'spark:memberships_read meeting:recordings_read spark:kms meeting:schedules_read spark:rooms_read spark:messages_write spark:memberships_write meeting:recordings_write meeting:preferences_read spark:messages_read meeting:schedules_write',
}, },
{ {
displayName: 'Auth URI Query Parameters', displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters', name: 'authQueryParameters',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: '', default: '',
}, },
{ {
displayName: 'Authentication', displayName: 'Authentication',
name: 'authentication', name: 'authentication',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'body', default: 'body',
}, },
]; ];

View file

@ -1,7 +1,6 @@
import { import {
ICredentialType, ICredentialType,
INodeProperties, INodeProperties,
NodePropertyTypes,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class FormIoApi implements ICredentialType { export class FormIoApi implements ICredentialType {
@ -42,13 +41,13 @@ export class FormIoApi implements ICredentialType {
{ {
displayName: 'Email', displayName: 'Email',
name: 'email', name: 'email',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
{ {
displayName: 'Password', displayName: 'Password',
name: 'password', name: 'password',
type: 'string' as NodePropertyTypes, type: 'string',
typeOptions: { typeOptions: {
password: true, password: true,
}, },

View file

@ -1,6 +1,6 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -8,11 +8,11 @@ export class FormstackApi implements ICredentialType {
name = 'formstackApi'; name = 'formstackApi';
displayName = 'Formstack API'; displayName = 'Formstack API';
documentationUrl = 'formstackTrigger'; documentationUrl = 'formstackTrigger';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'Access Token', displayName: 'Access Token',
name: 'accessToken', name: 'accessToken',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
]; ];

View file

@ -1,6 +1,6 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
const scopes: string[] = []; const scopes: string[] = [];
@ -12,37 +12,37 @@ export class FormstackOAuth2Api implements ICredentialType {
]; ];
displayName = 'Formstack OAuth2 API'; displayName = 'Formstack OAuth2 API';
documentationUrl = 'formstackTrigger'; documentationUrl = 'formstackTrigger';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'Authorization URL', displayName: 'Authorization URL',
name: 'authUrl', name: 'authUrl',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'https://www.formstack.com/api/v2/oauth2/authorize', default: 'https://www.formstack.com/api/v2/oauth2/authorize',
required: true, required: true,
}, },
{ {
displayName: 'Access Token URL', displayName: 'Access Token URL',
name: 'accessTokenUrl', name: 'accessTokenUrl',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'https://www.formstack.com/api/v2/oauth2/token', default: 'https://www.formstack.com/api/v2/oauth2/token',
required: true, required: true,
}, },
{ {
displayName: 'Scope', displayName: 'Scope',
name: 'scope', name: 'scope',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: scopes.join(' '), default: scopes.join(' '),
}, },
{ {
displayName: 'Auth URI Query Parameters', displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters', name: 'authQueryParameters',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: '', default: '',
}, },
{ {
displayName: 'Authentication', displayName: 'Authentication',
name: 'authentication', name: 'authentication',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'header', default: 'header',
}, },
]; ];

View file

@ -1,6 +1,6 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
const scopes = [ const scopes = [
@ -16,11 +16,11 @@ export class GoogleDocsOAuth2Api implements ICredentialType {
]; ];
displayName = 'Google Docs OAuth2 API'; displayName = 'Google Docs OAuth2 API';
documentationUrl = 'google'; documentationUrl = 'google';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'Scope', displayName: 'Scope',
name: 'scope', name: 'scope',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: scopes.join(' '), default: scopes.join(' '),
}, },
]; ];

View file

@ -1,6 +1,6 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
const scopes = [ const scopes = [
@ -14,11 +14,11 @@ export class GooglePerspectiveOAuth2Api implements ICredentialType {
]; ];
displayName = 'Google Perspective OAuth2 API'; displayName = 'Google Perspective OAuth2 API';
documentationUrl = 'google'; documentationUrl = 'google';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'Scope', displayName: 'Scope',
name: 'scope', name: 'scope',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: scopes.join(' '), default: scopes.join(' '),
}, },
]; ];

View file

@ -1,35 +1,35 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class HomeAssistantApi implements ICredentialType { export class HomeAssistantApi implements ICredentialType {
name = 'homeAssistantApi'; name = 'homeAssistantApi';
displayName = 'Home Assistant API'; displayName = 'Home Assistant API';
documentationUrl = 'homeAssistant'; documentationUrl = 'homeAssistant';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'Host', displayName: 'Host',
name: 'host', name: 'host',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
{ {
displayName: 'Port', displayName: 'Port',
name: 'port', name: 'port',
type: 'number' as NodePropertyTypes, type: 'number',
default: 8123, default: 8123,
}, },
{ {
displayName: 'SSL', displayName: 'SSL',
name: 'ssl', name: 'ssl',
type: 'boolean' as NodePropertyTypes, type: 'boolean',
default: false, default: false,
}, },
{ {
displayName: 'Access Token', displayName: 'Access Token',
name: 'accessToken', name: 'accessToken',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
]; ];

View file

@ -1,23 +1,23 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class Magento2Api implements ICredentialType { export class Magento2Api implements ICredentialType {
name = 'magento2Api'; name = 'magento2Api';
displayName = 'Magento 2 API'; displayName = 'Magento 2 API';
documentationUrl = 'magento2'; documentationUrl = 'magento2';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'Host', displayName: 'Host',
name: 'host', name: 'host',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
{ {
displayName: 'Access Token', displayName: 'Access Token',
name: 'accessToken', name: 'accessToken',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
]; ];

View file

@ -1,23 +1,23 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class MarketstackApi implements ICredentialType { export class MarketstackApi implements ICredentialType {
name = 'marketstackApi'; name = 'marketstackApi';
displayName = 'Marketstack API'; displayName = 'Marketstack API';
documentationUrl = 'marketstack'; documentationUrl = 'marketstack';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'API Key', displayName: 'API Key',
name: 'apiKey', name: 'apiKey',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
}, },
{ {
displayName: 'Use HTTPS', displayName: 'Use HTTPS',
name: 'useHttps', name: 'useHttps',
type: 'boolean' as NodePropertyTypes, type: 'boolean',
default: false, default: false,
description: 'Use HTTPS (paid plans only).', description: 'Use HTTPS (paid plans only).',
}, },

View file

@ -1,6 +1,6 @@
import { import {
ICredentialType, ICredentialType,
NodePropertyTypes, INodeProperties,
} from 'n8n-workflow'; } from 'n8n-workflow';
export class ServiceNowOAuth2Api implements ICredentialType { export class ServiceNowOAuth2Api implements ICredentialType {
@ -10,11 +10,11 @@ export class ServiceNowOAuth2Api implements ICredentialType {
]; ];
displayName = 'ServiceNow OAuth2 API'; displayName = 'ServiceNow OAuth2 API';
documentationUrl = 'serviceNow'; documentationUrl = 'serviceNow';
properties = [ properties: INodeProperties[] = [
{ {
displayName: 'Subdomain', displayName: 'Subdomain',
name: 'subdomain', name: 'subdomain',
type: 'string' as NodePropertyTypes, type: 'string',
default: '', default: '',
placeholder: 'n8n', placeholder: 'n8n',
description: 'The subdomain of your ServiceNow environment', description: 'The subdomain of your ServiceNow environment',
@ -23,39 +23,39 @@ export class ServiceNowOAuth2Api implements ICredentialType {
{ {
displayName: 'Authorization URL', displayName: 'Authorization URL',
name: 'authUrl', name: 'authUrl',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: '=https://{{$self["subdomain"]}}.service-now.com/oauth_auth.do', default: '=https://{{$self["subdomain"]}}.service-now.com/oauth_auth.do',
required: true, required: true,
}, },
{ {
displayName: 'Access Token URL', displayName: 'Access Token URL',
name: 'accessTokenUrl', name: 'accessTokenUrl',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: '=https://{{$self["subdomain"]}}.service-now.com/oauth_token.do', default: '=https://{{$self["subdomain"]}}.service-now.com/oauth_token.do',
required: true, required: true,
}, },
{ {
displayName: 'Scope', displayName: 'Scope',
name: 'scope', name: 'scope',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'useraccount', default: 'useraccount',
}, },
{ {
displayName: 'Auth URI Query Parameters', displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters', name: 'authQueryParameters',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'response_type=code', default: 'response_type=code',
}, },
{ {
displayName: 'Auth URI Query Parameters', displayName: 'Auth URI Query Parameters',
name: 'authQueryParameters', name: 'authQueryParameters',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'grant_type=authorization_code', default: 'grant_type=authorization_code',
}, },
{ {
displayName: 'Authentication', displayName: 'Authentication',
name: 'authentication', name: 'authentication',
type: 'hidden' as NodePropertyTypes, type: 'hidden',
default: 'header', default: 'header',
}, },
]; ];