fix(Google Drive Node): Process all input items with List operation (#3525)

* Fix: process all input items in GDrive list

*  linter fixes

*  added versioning

*  fix option naming

*  removed option for choosing list operation behavior

*  Improvement

Co-authored-by: Yann Jouanique <yann.jouanique@gmail.com>
Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
Michael Kret 2022-07-10 13:26:58 +03:00 committed by GitHub
parent ce06d9bb3e
commit ece1836c45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,7 @@ export class GoogleDrive implements INodeType {
name: 'googleDrive', name: 'googleDrive',
icon: 'file:googleDrive.svg', icon: 'file:googleDrive.svg',
group: ['input'], group: ['input'],
version: 1, version: [1, 2],
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Access data on Google Drive', description: 'Access data on Google Drive',
defaults: { defaults: {
@ -475,7 +475,7 @@ export class GoogleDrive implements INodeType {
minValue: 1, minValue: 1,
maxValue: 1000, maxValue: 1000,
}, },
default: 100, default: 50,
description: 'Max number of results to return', description: 'Max number of results to return',
}, },
{ {
@ -951,7 +951,7 @@ export class GoogleDrive implements INodeType {
type: 'multiOptions', type: 'multiOptions',
options: [ options: [
{ {
name: '*', name: '[All]',
value: '*', value: '*',
description: 'All fields', description: 'All fields',
}, },
@ -1404,7 +1404,7 @@ export class GoogleDrive implements INodeType {
}, },
options: [ options: [
{ {
name: '*', name: '[All]',
value: '*', value: '*',
description: 'All spaces', description: 'All spaces',
}, },
@ -2268,6 +2268,7 @@ export class GoogleDrive implements INodeType {
// Create a shallow copy of the binary data so that the old // Create a shallow copy of the binary data so that the old
// data references which do not get changed still stay behind // data references which do not get changed still stay behind
// but the incoming data does not get changed. // but the incoming data does not get changed.
// @ts-ignore
Object.assign(newItem.binary, items[i].binary); Object.assign(newItem.binary, items[i].binary);
} }
@ -2365,7 +2366,13 @@ export class GoogleDrive implements INodeType {
const files = response!.files; const files = response!.files;
const version = this.getNode().typeVersion;
if (version === 1) {
return [this.helpers.returnJsonArray(files as IDataObject[])]; return [this.helpers.returnJsonArray(files as IDataObject[])];
} else {
returnData.push(...files);
}
} else if (operation === 'upload') { } else if (operation === 'upload') {
// ---------------------------------- // ----------------------------------