first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,217 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { TIMEZONE_VALIDATION_REGEX } from './GenericFunctions';
|
||||
|
||||
export const calendarOperations: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['calendar'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Availability',
|
||||
value: 'availability',
|
||||
description: 'If a time-slot is available in a calendar',
|
||||
action: 'Get availability in a calendar',
|
||||
},
|
||||
],
|
||||
default: 'availability',
|
||||
},
|
||||
];
|
||||
|
||||
export const calendarFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* calendar:availability */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Calendar',
|
||||
name: 'calendar',
|
||||
type: 'resourceLocator',
|
||||
default: { mode: 'list', value: '' },
|
||||
required: true,
|
||||
description: 'Google Calendar to operate on',
|
||||
modes: [
|
||||
{
|
||||
displayName: 'Calendar',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
placeholder: 'Select a Calendar...',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getCalendars',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
// calendar ids are emails. W3C email regex with optional trailing whitespace.
|
||||
regex:
|
||||
'(^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*(?:[ \t]+)*$)',
|
||||
errorMessage: 'Not a valid Google Calendar ID',
|
||||
},
|
||||
},
|
||||
],
|
||||
extractValue: {
|
||||
type: 'regex',
|
||||
regex: '(^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*)',
|
||||
},
|
||||
placeholder: 'name@google.com',
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['calendar'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Start Time',
|
||||
name: 'timeMin',
|
||||
type: 'dateTime',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['availability'],
|
||||
resource: ['calendar'],
|
||||
'@version': [{ _cnd: { lt: 1.3 } }],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Start of the interval',
|
||||
},
|
||||
{
|
||||
displayName: 'End Time',
|
||||
name: 'timeMax',
|
||||
type: 'dateTime',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['availability'],
|
||||
resource: ['calendar'],
|
||||
'@version': [{ _cnd: { lt: 1.3 } }],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'End of the interval',
|
||||
},
|
||||
{
|
||||
displayName: 'Start Time',
|
||||
name: 'timeMin',
|
||||
type: 'dateTime',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['availability'],
|
||||
resource: ['calendar'],
|
||||
'@version': [{ _cnd: { gte: 1.3 } }],
|
||||
},
|
||||
},
|
||||
default: '={{ $now }}',
|
||||
description:
|
||||
'Start of the interval, use <a href="https://docs.n8n.io/code/cookbook/luxon/" target="_blank">expression</a> to set a date, or switch to fixed mode to choose date from widget',
|
||||
},
|
||||
{
|
||||
displayName: 'End Time',
|
||||
name: 'timeMax',
|
||||
type: 'dateTime',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['availability'],
|
||||
resource: ['calendar'],
|
||||
'@version': [{ _cnd: { gte: 1.3 } }],
|
||||
},
|
||||
},
|
||||
default: "={{ $now.plus(1, 'hour') }}",
|
||||
description:
|
||||
'End of the interval, use <a href="https://docs.n8n.io/code/cookbook/luxon/" target="_blank">expression</a> to set a date, or switch to fixed mode to choose date from widget',
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add option',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: ['availability'],
|
||||
resource: ['calendar'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Output Format',
|
||||
name: 'outputFormat',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Availability',
|
||||
value: 'availability',
|
||||
description: 'Returns if there are any events in the given time or not',
|
||||
},
|
||||
{
|
||||
name: 'Booked Slots',
|
||||
value: 'bookedSlots',
|
||||
description: 'Returns the booked slots',
|
||||
},
|
||||
{
|
||||
name: 'RAW',
|
||||
value: 'raw',
|
||||
description: 'Returns the RAW data from the API',
|
||||
},
|
||||
],
|
||||
default: 'availability',
|
||||
description: 'The format to return the data in',
|
||||
},
|
||||
{
|
||||
displayName: 'Timezone',
|
||||
name: 'timezone',
|
||||
type: 'resourceLocator',
|
||||
default: { mode: 'list', value: '' },
|
||||
description: 'Time zone used in the response. By default n8n timezone is used.',
|
||||
modes: [
|
||||
{
|
||||
displayName: 'Timezone',
|
||||
name: 'list',
|
||||
type: 'list',
|
||||
placeholder: 'Select a Timezone...',
|
||||
typeOptions: {
|
||||
searchListMethod: 'getTimezones',
|
||||
searchable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
validation: [
|
||||
{
|
||||
type: 'regex',
|
||||
properties: {
|
||||
regex: TIMEZONE_VALIDATION_REGEX,
|
||||
errorMessage: 'Not a valid Timezone',
|
||||
},
|
||||
},
|
||||
],
|
||||
extractValue: {
|
||||
type: 'regex',
|
||||
regex: '([-+/_a-zA-Z0-9]*)',
|
||||
},
|
||||
placeholder: 'Europe/Berlin',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user