🔀 Merge branch 'master' of github.com:n8n-io/n8n

This commit is contained in:
Jan Oberhauser 2022-03-13 12:13:08 +01:00
commit ec9590e239
6 changed files with 60 additions and 44 deletions

View file

@ -28,7 +28,7 @@ export const calendarOperations: INodeProperties[] = [
export const calendarFields: INodeProperties[] = [
/* -------------------------------------------------------------------------- */
/* calendar:availability */
/* calendar:availability */
/* -------------------------------------------------------------------------- */
{
displayName: 'Calendar ID',
@ -136,6 +136,4 @@ export const calendarFields: INodeProperties[] = [
},
],
},
];

View file

@ -356,16 +356,6 @@ export const eventFields: INodeProperties[] = [
default: 'opaque',
description: 'Whether the event blocks time on the calendar',
},
{
displayName: 'Timezone',
name: 'timezone',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getTimezones',
},
default: '',
description: 'The timezone the event will have set. By default events are schedule on timezone set in n8n.',
},
{
displayName: 'Visibility',
name: 'visibility',
@ -986,16 +976,6 @@ export const eventFields: INodeProperties[] = [
default: 'opaque',
description: 'Whether the event blocks time on the calendar',
},
{
displayName: 'Timezone',
name: 'timezone',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getTimezones',
},
default: '',
description: 'The timezone the event will have set. By default events are schedule on n8n timezone',
},
{
displayName: 'Visibility',
name: 'visibility',

View file

@ -181,12 +181,12 @@ export class GoogleCalendar implements INodeType {
let responseData;
const resource = this.getNodeParameter('resource', 0) as string;
const operation = this.getNodeParameter('operation', 0) as string;
const timezone = this.getTimezone();
for (let i = 0; i < length; i++) {
try {
if (resource === 'calendar') {
//https://developers.google.com/calendar/v3/reference/freebusy/query
if (operation === 'availability') {
const timezone = moment.tz.guess();
const calendarId = this.getNodeParameter('calendar', i) as string;
const timeMin = this.getNodeParameter('timeMin', i) as string;
const timeMax = this.getNodeParameter('timeMax', i) as string;
@ -194,8 +194,8 @@ export class GoogleCalendar implements INodeType {
const outputFormat = options.outputFormat || 'availability';
const body: IDataObject = {
timeMin: options.timezone ? moment.tz(timeMin, options.timezone as string).utc(true).format() : timeMin,
timeMax: options.timezone ? moment.tz(timeMax, options.timezone as string).utc(true).format() : timeMax,
timeMin: moment(timeMin).utc().format(),
timeMax: moment(timeMax).utc().format(),
items: [
{
id: calendarId,
@ -240,7 +240,6 @@ export class GoogleCalendar implements INodeType {
'additionalFields',
i,
) as IDataObject;
const timezone = (additionalFields.timezone as string);
if (additionalFields.maxAttendees) {
qs.maxAttendees = additionalFields.maxAttendees as number;
@ -253,12 +252,12 @@ export class GoogleCalendar implements INodeType {
}
const body: IEvent = {
start: {
dateTime: timezone ? moment.tz(start, timezone).utc(true).format() : start,
timeZone: timezone || moment.tz.guess(),
dateTime: moment.tz(start, timezone).utc().format(),
timeZone: timezone,
},
end: {
dateTime: timezone ? moment.tz(end, timezone).utc(true).format() : end,
timeZone: timezone || moment.tz.guess(),
dateTime: moment.tz(end, timezone).utc().format(),
timeZone: timezone,
},
};
if (additionalFields.attendees) {
@ -347,10 +346,9 @@ export class GoogleCalendar implements INodeType {
);
}
if (additionalFields.repeatUntil) {
const repeatUntil = timezone ?
moment.tz(additionalFields.repeatUntil as string, timezone).utc(true).format('YYYYMMDDTHHmmss') :
moment(additionalFields.repeatUntil as string).utc().format('YYYYMMDDTHHmmss');
const repeatUntil = moment(additionalFields.repeatUntil as string)
.utc()
.format('YYYYMMDDTHHmmss');
body.recurrence?.push(
`UNTIL=${repeatUntil}Z`,
);
@ -375,7 +373,6 @@ export class GoogleCalendar implements INodeType {
};
}
}
responseData = await googleApiRequest.call(
this,
'POST',
@ -504,14 +501,14 @@ export class GoogleCalendar implements INodeType {
const body: IEvent = {};
if (updateFields.start) {
body.start = {
dateTime: timezone ? moment.tz(updateFields.start as string, timezone).utc(true).format() : updateFields.start as string,
timeZone: timezone || moment.tz.guess(),
dateTime: moment.tz(updateFields.start, timezone).utc().format(),
timeZone: timezone,
};
}
if (updateFields.end) {
body.end = {
dateTime: timezone ? moment.tz(updateFields.end as string, timezone).utc(true).format() : updateFields.end as string,
timeZone: timezone || moment.tz.guess(),
dateTime: moment.tz(updateFields.end, timezone).utc().format(),
timeZone: timezone,
};
}
if (updateFields.attendees) {
@ -594,9 +591,9 @@ export class GoogleCalendar implements INodeType {
body.recurrence?.push(`COUNT=${updateFields.repeatHowManyTimes};`);
}
if (updateFields.repeatUntil) {
const repeatUntil = timezone ?
moment.tz(updateFields.repeatUntil as string, timezone).utc(true).format('YYYYMMDDTHHmmss') :
moment(updateFields.repeatUntil as string).utc().format('YYYYMMDDTHHmmss');
const repeatUntil = moment(updateFields.repeatUntil as string)
.utc()
.format('YYYYMMDDTHHmmss');
body.recurrence?.push(
`UNTIL=${repeatUntil}Z`,

View file

@ -11,6 +11,7 @@ import {
import {
IDataObject,
IHookFunctions,
JsonObject,
NodeApiError,
} from 'n8n-workflow';
@ -41,7 +42,7 @@ export async function mailjetApiRequest(this: IExecuteFunctions | IExecuteSingle
try {
return await this.helpers.request!(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}

View file

@ -0,0 +1,20 @@
{
"node": "n8n-nodes-base.onfleet",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": [
"Miscellaneous"
],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/credentials/onfleet/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/nodes/n8n-nodes-base.onfleet/"
}
]
},
}

View file

@ -0,0 +1,20 @@
{
"node": "n8n-nodes-base.onfleetTrigger",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": [
"Miscellaneous"
],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/credentials/onfleet/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/nodes/n8n-nodes-base.onfleetTrigger/"
}
]
},
}