2023-01-27 03:22:44 -08:00
|
|
|
import type { ICredentialType, INodeProperties, INodePropertyOptions } from 'n8n-workflow';
|
2021-09-29 16:28:27 -07:00
|
|
|
|
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
|
2022-07-24 08:36:17 -07:00
|
|
|
const timezones: INodePropertyOptions[] = moment.tz
|
|
|
|
.countries()
|
2022-12-02 12:54:28 -08:00
|
|
|
.reduce((tz: INodePropertyOptions[], country: string) => {
|
2022-07-24 08:36:17 -07:00
|
|
|
const zonesForCountry = moment.tz
|
|
|
|
.zonesForCountry(country)
|
|
|
|
.map((zone) => ({ value: zone, name: zone }));
|
2022-12-02 12:54:28 -08:00
|
|
|
return tz.concat(zonesForCountry);
|
2022-07-24 08:36:17 -07:00
|
|
|
}, []);
|
2022-03-13 01:45:26 -08:00
|
|
|
|
2021-09-29 16:28:27 -07:00
|
|
|
export class SeaTableApi implements ICredentialType {
|
|
|
|
name = 'seaTableApi';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-09-29 16:28:27 -07:00
|
|
|
displayName = 'SeaTable API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-09-29 16:28:27 -07:00
|
|
|
documentationUrl = 'seaTable';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2021-09-29 16:28:27 -07:00
|
|
|
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: {
|
2022-07-24 08:36:17 -07:00
|
|
|
environment: ['selfHosted'],
|
2021-09-29 16:28:27 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'API Token (of a Base)',
|
|
|
|
name: 'token',
|
|
|
|
type: 'string',
|
2023-08-01 04:08:25 -07:00
|
|
|
typeOptions: { password: true },
|
2021-09-29 16:28:27 -07:00
|
|
|
default: '',
|
|
|
|
},
|
2022-03-13 01:45:26 -08:00
|
|
|
{
|
|
|
|
displayName: 'Timezone',
|
|
|
|
name: 'timezone',
|
|
|
|
type: 'options',
|
2022-04-13 23:32:27 -07:00
|
|
|
default: '',
|
2022-07-24 08:36:17 -07:00
|
|
|
description: "Seatable server's timezone",
|
|
|
|
options: [...timezones],
|
2022-03-13 01:45:26 -08:00
|
|
|
},
|
2021-09-29 16:28:27 -07:00
|
|
|
];
|
|
|
|
}
|