Some minor improvements

This commit is contained in:
Jan Oberhauser 2020-06-13 13:47:49 +02:00
parent fbfdd7ceb5
commit 094614508d
3 changed files with 21 additions and 21 deletions

View file

@ -1,6 +1,6 @@
import {
OptionsWithUri,
} from 'request';
} from 'request';
import {
IExecuteFunctions,
@ -64,7 +64,7 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
errorMessages = errorMessages.join('|');
} else if (error.response.body.error.message){
} else if (error.response.body.error.message) {
errorMessages = error.response.body.error.message;
}
@ -74,7 +74,7 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
}
}
export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];
@ -93,7 +93,7 @@ export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOp
return returnData;
}
function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, credentials: IDataObject) : Promise<IDataObject> {
function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, credentials: IDataObject): Promise<IDataObject> {
//https://developers.google.com/identity/protocols/oauth2/service-account#httprest
const scopes = [
@ -106,25 +106,25 @@ function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions | ILoa
const signature = jwt.sign(
{
'iss': credentials.email as string,
'sub': credentials.email as string,
'scope': scopes.join(' '),
'aud': `https://oauth2.googleapis.com/token`,
'iat': now,
'exp': now + 3600,
'iss': credentials.email as string,
'sub': credentials.email as string,
'scope': scopes.join(' '),
'aud': `https://oauth2.googleapis.com/token`,
'iat': now,
'exp': now + 3600,
},
credentials.privateKey as string,
{
algorithm: 'RS256',
header: {
'kid': credentials.privateKey as string,
'typ': 'JWT',
'alg': 'RS256',
},
algorithm: 'RS256',
header: {
'kid': credentials.privateKey as string,
'typ': 'JWT',
'alg': 'RS256',
},
}
);
);
const options: OptionsWithUri = {
const options: OptionsWithUri = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},

View file

@ -797,7 +797,7 @@ export class GoogleDrive implements INodeType {
{
name: 'domain',
value: 'domain',
description:"All files shared to the user's domain that are searchable",
description: 'All files shared to the user\'s domain that are searchable',
},
{
name: 'drive',
@ -945,7 +945,7 @@ export class GoogleDrive implements INodeType {
queryCorpora = options.corpora as string;
}
let driveId : string | undefined;
let driveId: string | undefined;
driveId = options.driveId as string;
if (driveId === '') {
driveId = undefined;

View file

@ -138,7 +138,7 @@ export class Twitter implements INodeType {
const isImage = binaryData[binaryPropertyName].mimeType.includes('image');
if (isImage && isAnimatedWebp) {
throw new Error('Animated .webp images are not supported use .git instead');
throw new Error('Animated .webp images are not supported use .gif instead');
}
if (isImage) {