Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(AWS Rekognition Node): Fix all different action type #6136

Merged
merged 6 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 47 additions & 49 deletions packages/nodes-base/nodes/Aws/Rekognition/AwsRekognition.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,64 +389,62 @@ export class AwsRekognition implements INodeType {

if (type === 'detectText') {
action = 'RekognitionService.DetectText';
}
body.Filters = {};

body.Filters = {};

const box =
((additionalFields.regionsOfInterestUi as IDataObject)
?.regionsOfInterestValues as IDataObject[]) || [];
const box =
((additionalFields.regionsOfInterestUi as IDataObject)
?.regionsOfInterestValues as IDataObject[]) || [];

if (box.length !== 0) {
//@ts-ignore
body.Filters.RegionsOfInterest = box.map((entry: IDataObject) => {
return { BoundingBox: keysTPascalCase(entry) };
});
}
if (box.length !== 0) {
//@ts-ignore
body.Filters.RegionsOfInterest = box.map((entry: IDataObject) => {
return { BoundingBox: keysTPascalCase(entry) };
});
}

const wordFilter = (additionalFields.wordFilterUi as IDataObject) || {};
if (Object.keys(wordFilter).length !== 0) {
//@ts-ignore
body.Filters.WordFilter = keysTPascalCase(wordFilter);
}
const wordFilter = (additionalFields.wordFilterUi as IDataObject) || {};
if (Object.keys(wordFilter).length !== 0) {
//@ts-ignore
body.Filters.WordFilter = keysTPascalCase(wordFilter);
}

const isBinaryData = this.getNodeParameter('binaryData', i);
if (isBinaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const binaryPropertyData = this.helpers.assertBinaryData(i, binaryPropertyName);
Object.assign(body, {
Image: {
Bytes: binaryPropertyData.data,
},
});
} else {
const bucket = this.getNodeParameter('bucket', i) as string;
const name = this.getNodeParameter('name', i) as string;
const isBinaryData = this.getNodeParameter('binaryData', i);
if (isBinaryData) {
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
const binaryPropertyData = this.helpers.assertBinaryData(i, binaryPropertyName);
Object.assign(body, {
Image: {
Bytes: binaryPropertyData.data,
},
});
} else {
const bucket = this.getNodeParameter('bucket', i) as string;
const name = this.getNodeParameter('name', i) as string;

Object.assign(body, {
Image: {
S3Object: {
Bucket: bucket,
Name: name,
},
Object.assign(body, {
Image: {
S3Object: {
Bucket: bucket,
Name: name,
},
});
},
});

if (additionalFields.version) {
//@ts-ignore
body.Image.S3Object.Version = additionalFields.version as string;
}
if (additionalFields.version) {
//@ts-ignore
body.Image.S3Object.Version = additionalFields.version as string;
}

responseData = await awsApiRequestREST.call(
this,
'rekognition',
'POST',
'',
JSON.stringify(body),
{},
{ 'X-Amz-Target': action, 'Content-Type': 'application/x-amz-json-1.1' },
);
}
responseData = await awsApiRequestREST.call(
this,
'rekognition',
'POST',
'',
JSON.stringify(body),
{},
{ 'X-Amz-Target': action, 'Content-Type': 'application/x-amz-json-1.1' },
);
}
}

Expand Down
Loading