Minor improvements to S3-Node

This commit is contained in:
Jan Oberhauser 2020-09-02 08:30:01 +02:00
parent a0f335b0c8
commit 248ccce5c3
6 changed files with 18 additions and 18 deletions

View file

@ -4,9 +4,9 @@ import {
} from 'n8n-workflow'; } from 'n8n-workflow';
export class CustomS3Endpoint implements ICredentialType { export class S3 implements ICredentialType {
name = 'customS3Endpoint'; name = 's3';
displayName = 'Custom S3'; displayName = 'S3';
properties = [ properties = [
{ {
displayName: 'S3 endpoint', displayName: 'S3 endpoint',

View file

@ -23,7 +23,7 @@ import {
import { import {
IDataObject, IDataObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { URL } from 'url'; import { URL } from 'url';
@ -31,7 +31,7 @@ export async function s3ApiRequest(this: IHookFunctions | IExecuteFunctions | IL
let credentials; let credentials;
credentials = this.getCredentials('customS3Endpoint'); credentials = this.getCredentials('s3');
if (credentials === undefined) { if (credentials === undefined) {
throw new Error('No credentials got returned!'); throw new Error('No credentials got returned!');
@ -64,13 +64,13 @@ export async function s3ApiRequest(this: IHookFunctions | IExecuteFunctions | IL
body body
}; };
sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim()}); sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim() });
const options: OptionsWithUri = { const options: OptionsWithUri = {
headers: signOpts.headers, headers: signOpts.headers,
method, method,
qs: query, qs: query,
uri: endpoint, uri: endpoint.toString(),
body: signOpts.body, body: signOpts.body,
}; };

View file

@ -49,12 +49,12 @@ import {
export class S3 implements INodeType { export class S3 implements INodeType {
description: INodeTypeDescription = { description: INodeTypeDescription = {
displayName: 'S3', displayName: 'S3',
name: 'S3', name: 's3',
icon: 'file:generic-s3.png', icon: 'file:s3.png',
group: ['output'], group: ['output'],
version: 1, version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Sends data to any S3-compatible services', description: 'Sends data to any S3-compatible service',
defaults: { defaults: {
name: 'S3', name: 'S3',
color: '#d05b4b', color: '#d05b4b',
@ -63,7 +63,7 @@ export class S3 implements INodeType {
outputs: ['main'], outputs: ['main'],
credentials: [ credentials: [
{ {
name: 'customS3Endpoint', name: 's3',
required: true, required: true,
}, },
], ],
@ -117,7 +117,7 @@ export class S3 implements INodeType {
let credentials; let credentials;
try { try {
credentials = this.getCredentials('customS3Endpoint'); credentials = this.getCredentials('s3');
} catch (error) { } catch (error) {
throw new Error(error); throw new Error(error);
} }
@ -274,7 +274,7 @@ export class S3 implements INodeType {
responseData = await s3ApiRequestSOAP.call(this, bucketName, 'DELETE', `/${folderKey}`, '', qs, {}, {}, region); responseData = await s3ApiRequestSOAP.call(this, bucketName, 'DELETE', `/${folderKey}`, '', qs, {}, {}, region);
responseData = { deleted: [ { 'Key': folderKey } ] }; responseData = { deleted: [{ 'Key': folderKey }] };
} else { } else {
// delete everything inside the folder // delete everything inside the folder
@ -301,7 +301,7 @@ export class S3 implements INodeType {
headers['Content-Type'] = 'application/xml'; headers['Content-Type'] = 'application/xml';
responseData = await s3ApiRequestSOAP.call(this, bucketName, 'POST', '/', data, { delete: '' } , headers, {}, region); responseData = await s3ApiRequestSOAP.call(this, bucketName, 'POST', '/', data, { delete: '' }, headers, {}, region);
responseData = { deleted: responseData.DeleteResult.Deleted }; responseData = { deleted: responseData.DeleteResult.Deleted };
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -52,7 +52,7 @@
"dist/credentials/CopperApi.credentials.js", "dist/credentials/CopperApi.credentials.js",
"dist/credentials/CalendlyApi.credentials.js", "dist/credentials/CalendlyApi.credentials.js",
"dist/credentials/CustomerIoApi.credentials.js", "dist/credentials/CustomerIoApi.credentials.js",
"dist/credentials/CustomS3Endpoint.credentials.js", "dist/credentials/S3.credentials.js",
"dist/credentials/CrateDb.credentials.js", "dist/credentials/CrateDb.credentials.js",
"dist/credentials/DisqusApi.credentials.js", "dist/credentials/DisqusApi.credentials.js",
"dist/credentials/DriftApi.credentials.js", "dist/credentials/DriftApi.credentials.js",