Skip to content

Commit

Permalink
add in transform uuid transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
evisdrenova committed Dec 23, 2024
1 parent a43a4e3 commit d43065c
Show file tree
Hide file tree
Showing 22 changed files with 1,366 additions and 799 deletions.
1,355 changes: 710 additions & 645 deletions backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.go

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions backend/protos/mgmt/v1alpha1/transformer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ enum TransformerSource {
TRANSFORMER_SOURCE_TRANSFORM_PII_TEXT = 47;
TRANSFORMER_SOURCE_GENERATE_BUSINESS_NAME = 48;
TRANSFORMER_SOURCE_GENERATE_IP_ADDRESS = 49;
TRANSFORMER_SOURCE_TRANSFORM_UUID = 50;
}

enum TransformerDataType {
Expand Down Expand Up @@ -221,6 +222,7 @@ message TransformerConfig {
TransformPiiText transform_pii_text_config = 44;
GenerateBusinessName generate_business_name_config = 45;
GenerateIpAddress generate_ip_address_config = 46;
TransformUuid transform_uuid_config = 47;
}
}

Expand Down Expand Up @@ -547,6 +549,8 @@ message GenerateIpAddress {
optional GenerateIpAddressType ip_type = 1;
}

message TransformUuid {}

service TransformersService {
rpc GetSystemTransformers(GetSystemTransformersRequest) returns (GetSystemTransformersResponse) {}
rpc GetSystemTransformerBySource(GetSystemTransformerBySourceRequest) returns (GetSystemTransformerBySourceResponse) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,19 @@ var (
},
},
},
{
Name: "Transform UUID",
Description: "Transforms a UUID",
DataType: mgmtv1alpha1.TransformerDataType_TRANSFORMER_DATA_TYPE_UUID,
DataTypes: []mgmtv1alpha1.TransformerDataType{mgmtv1alpha1.TransformerDataType_TRANSFORMER_DATA_TYPE_UUID, mgmtv1alpha1.TransformerDataType_TRANSFORMER_DATA_TYPE_NULL, mgmtv1alpha1.TransformerDataType_TRANSFORMER_DATA_TYPE_STRING},
SupportedJobTypes: []mgmtv1alpha1.SupportedJobType{mgmtv1alpha1.SupportedJobType_SUPPORTED_JOB_TYPE_SYNC},
Source: mgmtv1alpha1.TransformerSource_TRANSFORMER_SOURCE_TRANSFORM_UUID,
Config: &mgmtv1alpha1.TransformerConfig{
Config: &mgmtv1alpha1.TransformerConfig_TransformUuidConfig{
TransformUuidConfig: &mgmtv1alpha1.TransformUuid{},
},
},
},
}

// base transformers + ee transformers
Expand Down
11 changes: 11 additions & 0 deletions backend/sql/postgresql/models/transformers.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type TransformerConfig struct {
GenerateCountry *GenerateCountryConfig `json:"generateCountryConfig,omitempty"`
GenerateBusinessName *GenerateBusinessNameConfig `json:"generateBusinessNameConfig,omitempty"`
GenerateIpAddress *GenerateIpAddressConfig `json:"generateIpAddressConfig,omitempty"`
TransformUuid *TransformUuidConfig `json:"transformUuid,omitempty"`
}

type GenerateEmailConfig struct {
Expand Down Expand Up @@ -208,6 +209,8 @@ type GenerateCountryConfig struct {

type GenerateBusinessNameConfig struct{}

type TransformUuidConfig struct{}

type GenerateIpAddressConfig struct {
IpType *int32 `json:"ipType,omitempty"`
}
Expand Down Expand Up @@ -388,6 +391,8 @@ func (t *TransformerConfig) FromTransformerConfigDto(tr *mgmtv1alpha1.Transforme
t.GenerateIpAddress = &GenerateIpAddressConfig{
IpType: (*int32)(tr.GetGenerateIpAddressConfig().IpType),
}
case *mgmtv1alpha1.TransformerConfig_TransformUuidConfig:
t.TransformUuid = &TransformUuidConfig{}
default:
t = &TransformerConfig{}
}
Expand Down Expand Up @@ -742,6 +747,12 @@ func (t *TransformerConfig) ToTransformerConfigDto() *mgmtv1alpha1.TransformerCo
},
},
}
case t.TransformUuid != nil:
return &mgmtv1alpha1.TransformerConfig{
Config: &mgmtv1alpha1.TransformerConfig_TransformUuidConfig{
TransformUuidConfig: &mgmtv1alpha1.TransformUuid{},
},
}
default:
return &mgmtv1alpha1.TransformerConfig{}
}
Expand Down
38 changes: 34 additions & 4 deletions docs/docs/transformers/gen-javascript-transformer.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,38 @@ const newValue = neosync.transformStringPhoneNumber(value, {
<br/>


<!--
source: transform_uuid.go
-->

### transformUuid

Transforms an existing UUID to a UUID v5

**Parameters**

**Value**
Type: Any
Description: Value that will be transformed

**Config**

| Field | Type | Default | Required | Description |
| -------- | ---- | ------- | -------- | ----------- |
| seed | int64 | | false | An optional seed value used for generating deterministic transformations.<br/>

**Example**

```javascript

const newValue = neosync.transformUuid(value, {
seed: 1,
});

```
<br/>


## Generators

Neosync's generator functions enable the creation of various data values, facilitating the generation of realistic and diverse data for
Expand Down Expand Up @@ -934,8 +966,7 @@ Generates IPv4 or IPv6 addresses with support for different network classes.
| Field | Type | Default | Required | Description |
| -------- | ---- | ------- | -------- | ----------- |
| maxLength | int64 | 100000 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters.
| version | string | string(IpVersion_V4) | false | IP version to generate: 'ipv4' or 'ipv6'
| class | string | string(IpV4Class_Public) | false | IP class: 'public', 'private-a', 'private-b', 'private-c', 'link_local', 'multicast', 'loopback'
| ipType | string | string(IpV4_Public) | false | IP type to generate.
| seed | int64 | | false | Optional seed for deterministic generation
<br/>

Expand All @@ -945,8 +976,7 @@ Generates IPv4 or IPv6 addresses with support for different network classes.

const newValue = neosync.generateIpAddress({
maxLength: 100000,
version: string(IpVersion_V4),
class: string(IpV4Class_Public),
ipType: string(IpV4_Public),
seed: 1,
});

Expand Down
16 changes: 16 additions & 0 deletions docs/openapi/mgmt/v1alpha1/anonymization.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,10 @@ components:
title: preserve_length
title: TransformString
additionalProperties: false
mgmt.v1alpha1.TransformUuid:
type: object
title: TransformUuid
additionalProperties: false
mgmt.v1alpha1.TransformerConfig:
type: object
allOf:
Expand Down Expand Up @@ -1357,6 +1361,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
- not:
Expand Down Expand Up @@ -1451,6 +1457,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
anyOf:
Expand Down Expand Up @@ -1544,6 +1552,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
- not:
Expand Down Expand Up @@ -1638,6 +1648,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
properties:
Expand Down Expand Up @@ -1826,6 +1838,10 @@ components:
allOf:
- title: generate_ip_address_config
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddress'
transformUuidConfig:
allOf:
- title: transform_uuid_config
- $ref: '#/components/schemas/mgmt.v1alpha1.TransformUuid'
title: TransformerConfig
additionalProperties: false
mgmt.v1alpha1.TransformerMapping:
Expand Down
17 changes: 17 additions & 0 deletions docs/openapi/mgmt/v1alpha1/job.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,7 @@ components:
- TRANSFORMER_SOURCE_TRANSFORM_PII_TEXT
- TRANSFORMER_SOURCE_GENERATE_BUSINESS_NAME
- TRANSFORMER_SOURCE_GENERATE_IP_ADDRESS
- TRANSFORMER_SOURCE_TRANSFORM_UUID
google.protobuf.Timestamp:
type: string
format: date-time
Expand Down Expand Up @@ -5136,6 +5137,10 @@ components:
title: preserve_length
title: TransformString
additionalProperties: false
mgmt.v1alpha1.TransformUuid:
type: object
title: TransformUuid
additionalProperties: false
mgmt.v1alpha1.TransformerConfig:
type: object
allOf:
Expand Down Expand Up @@ -5230,6 +5235,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
- not:
Expand Down Expand Up @@ -5324,6 +5331,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
anyOf:
Expand Down Expand Up @@ -5417,6 +5426,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
- not:
Expand Down Expand Up @@ -5511,6 +5522,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
properties:
Expand Down Expand Up @@ -5699,6 +5712,10 @@ components:
allOf:
- title: generate_ip_address_config
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddress'
transformUuidConfig:
allOf:
- title: transform_uuid_config
- $ref: '#/components/schemas/mgmt.v1alpha1.TransformUuid'
title: TransformerConfig
additionalProperties: false
mgmt.v1alpha1.UpdateJobDestinationConnectionRequest:
Expand Down
17 changes: 17 additions & 0 deletions docs/openapi/mgmt/v1alpha1/transformer.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ components:
- TRANSFORMER_SOURCE_TRANSFORM_PII_TEXT
- TRANSFORMER_SOURCE_GENERATE_BUSINESS_NAME
- TRANSFORMER_SOURCE_GENERATE_IP_ADDRESS
- TRANSFORMER_SOURCE_TRANSFORM_UUID
google.protobuf.Timestamp:
type: string
format: date-time
Expand Down Expand Up @@ -1783,6 +1784,10 @@ components:
title: preserve_length
title: TransformString
additionalProperties: false
mgmt.v1alpha1.TransformUuid:
type: object
title: TransformUuid
additionalProperties: false
mgmt.v1alpha1.TransformerConfig:
type: object
allOf:
Expand Down Expand Up @@ -1877,6 +1882,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
- not:
Expand Down Expand Up @@ -1971,6 +1978,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
anyOf:
Expand Down Expand Up @@ -2064,6 +2073,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
- not:
Expand Down Expand Up @@ -2158,6 +2169,8 @@ components:
- transformPiiTextConfig
- required:
- transformStringConfig
- required:
- transformUuidConfig
- required:
- userDefinedTransformerConfig
properties:
Expand Down Expand Up @@ -2346,6 +2359,10 @@ components:
allOf:
- title: generate_ip_address_config
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateIpAddress'
transformUuidConfig:
allOf:
- title: transform_uuid_config
- $ref: '#/components/schemas/mgmt.v1alpha1.TransformUuid'
title: TransformerConfig
additionalProperties: false
mgmt.v1alpha1.UpdateUserDefinedTransformerRequest:
Expand Down
Loading

0 comments on commit d43065c

Please sign in to comment.