Skip to content

Commit

Permalink
fix: credentials payload fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kanishkkatara committed Jun 18, 2024
1 parent fa3619c commit e6c5098
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ type UserTransformationLibrary = {
};

type Credential = {
ID: string;
Key: string;
Value: string;
IsSecret: boolean;
id: string;
key: string;
value: string;
isSecret: boolean;
};

type ProcessorTransformationRequest = {
Expand Down
4 changes: 2 additions & 2 deletions src/util/customTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ async function userTransformHandler(
const credentialsMap = {};
if (testMode === false) {
(events[0]?.credentials || []).forEach((cred) => {
credentialsMap[cred.Key] = cred.Value;
credentialsMap[cred.key] = cred.value;
});
} else {
(credentials || []).forEach((cred) => {
credentialsMap[cred.Key] = cred.Value;
credentialsMap[cred.key] = cred.value;

Check warning on line 297 in src/util/customTransformer.js

View check run for this annotation

Codecov / codecov/patch

src/util/customTransformer.js#L297

Added line #L297 was not covered by tests
});
events.forEach((ev) => {
if (isNil(ev.credentials)) {
Expand Down
16 changes: 8 additions & 8 deletions test/__tests__/data/user_transformation_input_credentials.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@
},
"credentials": [
{
"Id": "id1",
"Key": "key1",
"Value": "value1",
"IsSecret": false
"id": "id1",
"key": "key1",
"value": "value1",
"isSecret": false
},
{
"Id": "id2",
"Key": "key2",
"Value": "value2",
"IsSecret": true
"id": "id2",
"key": "key2",
"value": "value2",
"isSecret": true
}
]
}
Expand Down

0 comments on commit e6c5098

Please sign in to comment.