Skip to content

Commit

Permalink
sha256 fe and lint updates
Browse files Browse the repository at this point in the history
  • Loading branch information
evisdrenova committed Nov 6, 2023
1 parent 705cc94 commit 4cb8643
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions frontend/app/new/transformer/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export const transformerConfig = Yup.object().shape({
return Yup.object().shape({});
case 'creditcardConfig':
return creditcardConfig;
case 'sha256hashConfig':
return Yup.object().shape({});
default:
return Yup.object().shape({});
}
Expand Down
8 changes: 8 additions & 0 deletions frontend/app/transformers/EditTransformerOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,14 @@ export function handleTransformerMetadata(
type: 'int64',
},
},
{
sha256_hash: {
name: 'SHA256 Hash',
description:
'SHA256 hashes the input value and returns back a string representation of the hash.',
type: 'string',
},
},
];

const def = {
Expand Down
12 changes: 12 additions & 0 deletions frontend/yup-validations/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
RandomFloat,
RandomInt,
RandomString,
SHA256Hash,
State,
StreetAddress,
Transformer,
Expand Down Expand Up @@ -440,6 +441,17 @@ export function ToTransformerConfigOptions(
}),
});
}
case 'sha256_hash': {
return new Transformer({
value: val.source,
config: new TransformerConfig({
config: {
case: 'sha256hashConfig',
value: new SHA256Hash({}),
},
}),
});
}
default: {
return new Transformer({
value: 'passthrough',
Expand Down
3 changes: 3 additions & 0 deletions worker/pkg/workflows/datasync/activities/activities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ func Test_computeMutationFunction_null(t *testing.T) {
assert.Equal(t, val, "null")
}

// nolint
func Test_sha256Hash_transformer_string(t *testing.T) {

mapping := `root = this.bytes().hash("sha256").encode("hex")`
Expand Down Expand Up @@ -484,6 +485,7 @@ func Test_sha256Hash_transformer_string(t *testing.T) {
assert.Equal(t, res, buf.String())
}

// nolint
func Test_sha256Hash_transformer_int64(t *testing.T) {

mapping := `root = this.bytes().hash("sha256").encode("hex")`
Expand Down Expand Up @@ -511,6 +513,7 @@ func Test_sha256Hash_transformer_int64(t *testing.T) {
assert.Equal(t, res, buf.String())
}

// nolint
func Test_sha256Hash_transformer_float(t *testing.T) {

mapping := `root = this.bytes().hash("sha256").encode("hex")`
Expand Down

0 comments on commit 4cb8643

Please sign in to comment.