n8n/packages/nodes-base/credentials/Imap.credentials.ts

73 lines
1.3 KiB
TypeScript
Raw Normal View History

import { ICredentialType, INodeProperties } from 'n8n-workflow';
2019-06-23 03:35:23 -07:00
export class Imap implements ICredentialType {
name = 'imap';
2019-06-23 03:35:23 -07:00
displayName = 'IMAP';
documentationUrl = 'imap';
properties: INodeProperties[] = [
2019-06-23 03:35:23 -07:00
{
displayName: 'User',
name: 'user',
type: 'string',
2019-06-23 03:35:23 -07:00
default: '',
},
{
displayName: 'Password',
name: 'password',
type: 'string',
2019-06-23 03:35:23 -07:00
typeOptions: {
password: true,
},
default: '',
},
{
displayName: 'Host',
name: 'host',
type: 'string',
2019-06-23 03:35:23 -07:00
default: '',
},
{
displayName: 'Port',
name: 'port',
type: 'number',
2019-06-23 03:35:23 -07:00
default: 993,
},
{
displayName: 'SSL/TLS',
name: 'secure',
type: 'boolean',
2019-06-23 03:35:23 -07:00
default: true,
},
{
displayName: 'Allow Self-Signed Certificates',
name: 'allowUnauthorizedCerts',
type: 'boolean',
description: 'Whether to connect even if SSL certificate validation is not possible',
default: false,
},
2019-06-23 03:35:23 -07:00
];
}
export interface ICredentialsDataImap {
host: string;
port: number;
user: string;
password: string;
secure: boolean;
allowUnauthorizedCerts: boolean;
}
export function isCredentialsDataImap(candidate: unknown): candidate is ICredentialsDataImap {
const o = candidate as ICredentialsDataImap;
return (
o.host !== undefined &&
o.password !== undefined &&
o.port !== undefined &&
o.secure !== undefined &&
o.user !== undefined
);
}