2021-09-29 16:28:27 -07:00
|
|
|
import {
|
|
|
|
ICredentialType,
|
|
|
|
INodeProperties,
|
2022-03-13 01:45:26 -08:00
|
|
|
INodePropertyOptions,
|
2021-09-29 16:28:27 -07:00
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
2022-03-13 01:45:26 -08:00
|
|
|
import * as moment from 'moment-timezone';
|
|
|
|
|
|
|
|
// Get options for timezones
|
|
|
|
const timezones: INodePropertyOptions[] = moment.tz.countries().reduce( (timezones: INodePropertyOptions[], country: string) => {
|
|
|
|
const zonesForCountry = moment.tz.zonesForCountry(country).map(zone => ({value: zone, name: zone}));
|
|
|
|
return timezones.concat(zonesForCountry);
|
|
|
|
}, []);
|
|
|
|
|
2021-09-29 16:28:27 -07:00
|
|
|
export class SeaTableApi implements ICredentialType {
|
|
|
|
name = 'seaTableApi';
|
|
|
|
displayName = 'SeaTable API';
|
|
|
|
documentationUrl = 'seaTable';
|
|
|
|
properties: INodeProperties[] = [
|
|
|
|
{
|
|
|
|
displayName: 'Environment',
|
|
|
|
name: 'environment',
|
|
|
|
type: 'options',
|
|
|
|
default: 'cloudHosted',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Cloud-hosted',
|
|
|
|
value: 'cloudHosted',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Self-hosted',
|
|
|
|
value: 'selfHosted',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Self-hosted domain',
|
|
|
|
name: 'domain',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
placeholder: 'https://www.mydomain.com',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
environment: [
|
|
|
|
'selfHosted',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'API Token (of a Base)',
|
|
|
|
name: 'token',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
},
|
2022-03-13 01:45:26 -08:00
|
|
|
{
|
|
|
|
displayName: 'Timezone',
|
|
|
|
name: 'timezone',
|
|
|
|
type: 'options',
|
|
|
|
default: 'Europe/Berlin',
|
|
|
|
description: `Seatable server's timezone`,
|
|
|
|
options: [
|
|
|
|
...timezones,
|
|
|
|
],
|
|
|
|
},
|
2021-09-29 16:28:27 -07:00
|
|
|
];
|
|
|
|
}
|