diff --git a/packages/nodes-base/credentials/CustomS3Endpoint.credentials.ts b/packages/nodes-base/credentials/S3.credentials.ts similarity index 86% rename from packages/nodes-base/credentials/CustomS3Endpoint.credentials.ts rename to packages/nodes-base/credentials/S3.credentials.ts index 266a38fdd..9d5b08c19 100644 --- a/packages/nodes-base/credentials/CustomS3Endpoint.credentials.ts +++ b/packages/nodes-base/credentials/S3.credentials.ts @@ -4,9 +4,9 @@ import { } from 'n8n-workflow'; -export class CustomS3Endpoint implements ICredentialType { - name = 'customS3Endpoint'; - displayName = 'Custom S3'; +export class S3 implements ICredentialType { + name = 's3'; + displayName = 'S3'; properties = [ { displayName: 'S3 endpoint', diff --git a/packages/nodes-base/nodes/S3/GenericFunctions.ts b/packages/nodes-base/nodes/S3/GenericFunctions.ts index 093b7cfb7..19dbfa6df 100644 --- a/packages/nodes-base/nodes/S3/GenericFunctions.ts +++ b/packages/nodes-base/nodes/S3/GenericFunctions.ts @@ -23,7 +23,7 @@ import { import { IDataObject, - } from 'n8n-workflow'; +} from 'n8n-workflow'; import { URL } from 'url'; @@ -31,7 +31,7 @@ export async function s3ApiRequest(this: IHookFunctions | IExecuteFunctions | IL let credentials; - credentials = this.getCredentials('customS3Endpoint'); + credentials = this.getCredentials('s3'); if (credentials === undefined) { throw new Error('No credentials got returned!'); @@ -64,13 +64,13 @@ export async function s3ApiRequest(this: IHookFunctions | IExecuteFunctions | IL body }; - sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim()}); + sign(signOpts, { accessKeyId: `${credentials.accessKeyId}`.trim(), secretAccessKey: `${credentials.secretAccessKey}`.trim() }); const options: OptionsWithUri = { headers: signOpts.headers, method, qs: query, - uri: endpoint, + uri: endpoint.toString(), body: signOpts.body, }; diff --git a/packages/nodes-base/nodes/S3/S3.node.ts b/packages/nodes-base/nodes/S3/S3.node.ts index 4272adb5b..accb8494f 100644 --- a/packages/nodes-base/nodes/S3/S3.node.ts +++ b/packages/nodes-base/nodes/S3/S3.node.ts @@ -49,12 +49,12 @@ import { export class S3 implements INodeType { description: INodeTypeDescription = { displayName: 'S3', - name: 'S3', - icon: 'file:generic-s3.png', + name: 's3', + icon: 'file:s3.png', group: ['output'], version: 1, subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', - description: 'Sends data to any S3-compatible services', + description: 'Sends data to any S3-compatible service', defaults: { name: 'S3', color: '#d05b4b', @@ -63,7 +63,7 @@ export class S3 implements INodeType { outputs: ['main'], credentials: [ { - name: 'customS3Endpoint', + name: 's3', required: true, }, ], @@ -117,7 +117,7 @@ export class S3 implements INodeType { let credentials; try { - credentials = this.getCredentials('customS3Endpoint'); + credentials = this.getCredentials('s3'); } catch (error) { throw new Error(error); } @@ -274,10 +274,10 @@ export class S3 implements INodeType { responseData = await s3ApiRequestSOAP.call(this, bucketName, 'DELETE', `/${folderKey}`, '', qs, {}, {}, region); - responseData = { deleted: [ { 'Key': folderKey } ] }; + responseData = { deleted: [{ 'Key': folderKey }] }; } else { - // delete everything inside the folder + // delete everything inside the folder const body: IDataObject = { Delete: { '$': { @@ -301,7 +301,7 @@ export class S3 implements INodeType { 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 }; } @@ -437,7 +437,7 @@ export class S3 implements INodeType { region = region.LocationConstraint._; - const response = await s3ApiRequestREST.call(this, bucketName, 'GET', `/${fileKey}`, '', qs, {}, { encoding: null, resolveWithFullResponse: true }, region); + const response = await s3ApiRequestREST.call(this, bucketName, 'GET', `/${fileKey}`, '', qs, {}, { encoding: null, resolveWithFullResponse: true }, region); let mimeType: string | undefined; if (response.headers['content-type']) { @@ -462,7 +462,7 @@ export class S3 implements INodeType { const data = Buffer.from(response.body as string, 'utf8'); - items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data as unknown as Buffer, fileName, mimeType); + items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data as unknown as Buffer, fileName, mimeType); } //https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html if (operation === 'delete') { diff --git a/packages/nodes-base/nodes/S3/generic-s3.png b/packages/nodes-base/nodes/S3/generic-s3.png deleted file mode 100644 index 4f9faf6dd..000000000 Binary files a/packages/nodes-base/nodes/S3/generic-s3.png and /dev/null differ diff --git a/packages/nodes-base/nodes/S3/s3.png b/packages/nodes-base/nodes/S3/s3.png new file mode 100644 index 000000000..7c79e52ac Binary files /dev/null and b/packages/nodes-base/nodes/S3/s3.png differ diff --git a/packages/nodes-base/package.json b/packages/nodes-base/package.json index 5c759a70a..02886773d 100644 --- a/packages/nodes-base/package.json +++ b/packages/nodes-base/package.json @@ -52,7 +52,7 @@ "dist/credentials/CopperApi.credentials.js", "dist/credentials/CalendlyApi.credentials.js", "dist/credentials/CustomerIoApi.credentials.js", - "dist/credentials/CustomS3Endpoint.credentials.js", + "dist/credentials/S3.credentials.js", "dist/credentials/CrateDb.credentials.js", "dist/credentials/DisqusApi.credentials.js", "dist/credentials/DriftApi.credentials.js",