mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
🔀 Merge branch 'feature/aws-s3' of https://github.com/RicardoE105/n8n into RicardoE105-feature/aws-s3
This commit is contained in:
commit
aa949dd11f
|
@ -41,7 +41,9 @@ import {
|
||||||
createHash,
|
createHash,
|
||||||
} from 'crypto';
|
} from 'crypto';
|
||||||
|
|
||||||
import * as js2xmlparser from 'js2xmlparser';
|
import {
|
||||||
|
Builder,
|
||||||
|
} from 'xml2js';
|
||||||
|
|
||||||
export class AwsS3 implements INodeType {
|
export class AwsS3 implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
@ -136,13 +138,16 @@ export class AwsS3 implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
const body: IDataObject = {
|
const body: IDataObject = {
|
||||||
'@': {
|
CreateBucketConfiguration: {
|
||||||
xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
|
'$': {
|
||||||
},
|
xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
|
||||||
LocationConstraint: [credentials!.region],
|
},
|
||||||
|
LocationConstraint: [credentials!.region],
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const data = js2xmlparser.parse('CreateBucketConfiguration', body);
|
const builder = new Builder();
|
||||||
|
const data = builder.buildObject(body);
|
||||||
|
|
||||||
responseData = await awsApiRequestSOAP.call(this, `${name}.s3`, 'PUT', '', data, qs, headers);
|
responseData = await awsApiRequestSOAP.call(this, `${name}.s3`, 'PUT', '', data, qs, headers);
|
||||||
|
|
||||||
|
@ -243,17 +248,23 @@ export class AwsS3 implements INodeType {
|
||||||
} else {
|
} else {
|
||||||
// delete everything inside the folder
|
// delete everything inside the folder
|
||||||
const body: IDataObject = {
|
const body: IDataObject = {
|
||||||
'@': {
|
Delete: {
|
||||||
xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
|
'$': {
|
||||||
|
xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
|
||||||
|
},
|
||||||
|
Object: [],
|
||||||
},
|
},
|
||||||
Object: [],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const childObject of responseData) {
|
for (const childObject of responseData) {
|
||||||
(body.Object as IDataObject[]).push({
|
//@ts-ignore
|
||||||
|
(body.Delete.Object as IDataObject[]).push({
|
||||||
Key: childObject.Key as string
|
Key: childObject.Key as string
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const data = js2xmlparser.parse('Delete', body);
|
|
||||||
|
const builder = new Builder();
|
||||||
|
const data = builder.buildObject(body);
|
||||||
|
|
||||||
headers['Content-MD5'] = createHash('md5').update(data).digest('base64');
|
headers['Content-MD5'] = createHash('md5').update(data).digest('base64');
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,6 @@
|
||||||
"gm": "^1.23.1",
|
"gm": "^1.23.1",
|
||||||
"googleapis": "~46.0.0",
|
"googleapis": "~46.0.0",
|
||||||
"imap-simple": "^4.3.0",
|
"imap-simple": "^4.3.0",
|
||||||
"js2xmlparser": "^4.0.1",
|
|
||||||
"lodash.get": "^4.4.2",
|
"lodash.get": "^4.4.2",
|
||||||
"lodash.set": "^4.3.2",
|
"lodash.set": "^4.3.2",
|
||||||
"lodash.unset": "^4.5.2",
|
"lodash.unset": "^4.5.2",
|
||||||
|
|
Loading…
Reference in a new issue