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-04-08 14:32:08 -07:00
|
|
|
import moment from 'moment-timezone';
|
2022-03-13 01:45:26 -08:00
|
|
|
|
|
|
|
// 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: [
|
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
name: 'Cloud-Hosted',
|
2021-09-29 16:28:27 -07:00
|
|
|
value: 'cloudHosted',
|
|
|
|
},
|
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
name: 'Self-Hosted',
|
2021-09-29 16:28:27 -07:00
|
|
|
value: 'selfHosted',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
2022-04-13 23:32:27 -07:00
|
|
|
displayName: 'Self-Hosted Domain',
|
2021-09-29 16:28:27 -07:00
|
|
|
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',
|
2022-04-13 23:32:27 -07:00
|
|
|
default: '',
|
|
|
|
description: 'Seatable server\'s timezone',
|
2022-03-13 01:45:26 -08:00
|
|
|
options: [
|
|
|
|
...timezones,
|
|
|
|
],
|
|
|
|
},
|
2021-09-29 16:28:27 -07:00
|
|
|
];
|
|
|
|
}
|