mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 21:07:28 -08:00
⚡ Some minor improvements
This commit is contained in:
parent
fbfdd7ceb5
commit
094614508d
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
OptionsWithUri,
|
OptionsWithUri,
|
||||||
} from 'request';
|
} from 'request';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
|
@ -64,7 +64,7 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||||
|
|
||||||
errorMessages = errorMessages.join('|');
|
errorMessages = errorMessages.join('|');
|
||||||
|
|
||||||
} else if (error.response.body.error.message){
|
} else if (error.response.body.error.message) {
|
||||||
errorMessages = 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[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOp
|
||||||
return returnData;
|
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
|
//https://developers.google.com/identity/protocols/oauth2/service-account#httprest
|
||||||
|
|
||||||
const scopes = [
|
const scopes = [
|
||||||
|
@ -106,25 +106,25 @@ function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions | ILoa
|
||||||
|
|
||||||
const signature = jwt.sign(
|
const signature = jwt.sign(
|
||||||
{
|
{
|
||||||
'iss': credentials.email as string,
|
'iss': credentials.email as string,
|
||||||
'sub': credentials.email as string,
|
'sub': credentials.email as string,
|
||||||
'scope': scopes.join(' '),
|
'scope': scopes.join(' '),
|
||||||
'aud': `https://oauth2.googleapis.com/token`,
|
'aud': `https://oauth2.googleapis.com/token`,
|
||||||
'iat': now,
|
'iat': now,
|
||||||
'exp': now + 3600,
|
'exp': now + 3600,
|
||||||
},
|
},
|
||||||
credentials.privateKey as string,
|
credentials.privateKey as string,
|
||||||
{
|
{
|
||||||
algorithm: 'RS256',
|
algorithm: 'RS256',
|
||||||
header: {
|
header: {
|
||||||
'kid': credentials.privateKey as string,
|
'kid': credentials.privateKey as string,
|
||||||
'typ': 'JWT',
|
'typ': 'JWT',
|
||||||
'alg': 'RS256',
|
'alg': 'RS256',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const options: OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
},
|
},
|
||||||
|
|
|
@ -797,7 +797,7 @@ export class GoogleDrive implements INodeType {
|
||||||
{
|
{
|
||||||
name: 'domain',
|
name: 'domain',
|
||||||
value: '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',
|
name: 'drive',
|
||||||
|
@ -945,7 +945,7 @@ export class GoogleDrive implements INodeType {
|
||||||
queryCorpora = options.corpora as string;
|
queryCorpora = options.corpora as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
let driveId : string | undefined;
|
let driveId: string | undefined;
|
||||||
driveId = options.driveId as string;
|
driveId = options.driveId as string;
|
||||||
if (driveId === '') {
|
if (driveId === '') {
|
||||||
driveId = undefined;
|
driveId = undefined;
|
||||||
|
|
|
@ -138,7 +138,7 @@ export class Twitter implements INodeType {
|
||||||
const isImage = binaryData[binaryPropertyName].mimeType.includes('image');
|
const isImage = binaryData[binaryPropertyName].mimeType.includes('image');
|
||||||
|
|
||||||
if (isImage && isAnimatedWebp) {
|
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) {
|
if (isImage) {
|
||||||
|
|
Loading…
Reference in a new issue