Skip to content

Commit

Permalink
add in generate business name transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
evisdrenova committed Oct 31, 2024
1 parent 2eb2513 commit 8bba519
Show file tree
Hide file tree
Showing 30 changed files with 3,253,267 additions and 899 deletions.
1,281 changes: 674 additions & 607 deletions backend/gen/go/protos/mgmt/v1alpha1/transformer.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions backend/protos/mgmt/v1alpha1/transformer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ enum TransformerSource {
TRANSFORMER_SOURCE_GENERATE_COUNTRY = 46;
// NeosyncCloud/Enterprise only transformer for anonymizing PII Text
TRANSFORMER_SOURCE_TRANSFORM_PII_TEXT = 47;
TRANSFORMER_SOURCE_GENERATE_BUSINESS_NAME = 48;
}

enum TransformerDataType {
Expand Down Expand Up @@ -217,6 +218,7 @@ message TransformerConfig {
GenerateCountry generate_country_config = 43;
// NeosyncCloud/Enterprise only transformer for anonymizing PII Text
TransformPiiText transform_pii_text_config = 44;
GenerateBusinessName generate_business_name_config = 45;
}
}

Expand Down Expand Up @@ -511,6 +513,8 @@ message GetTransformPiiEntitiesResponse {
repeated string entities = 1;
}

message GenerateBusinessName {}

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 @@ -626,6 +626,19 @@ var (
},
},
},
{
Name: "Generate Business Name",
Description: "Generates a random business name.",
DataType: mgmtv1alpha1.TransformerDataType_TRANSFORMER_DATA_TYPE_STRING,
DataTypes: []mgmtv1alpha1.TransformerDataType{mgmtv1alpha1.TransformerDataType_TRANSFORMER_DATA_TYPE_STRING, mgmtv1alpha1.TransformerDataType_TRANSFORMER_DATA_TYPE_NULL},
SupportedJobTypes: []mgmtv1alpha1.SupportedJobType{mgmtv1alpha1.SupportedJobType_SUPPORTED_JOB_TYPE_GENERATE, mgmtv1alpha1.SupportedJobType_SUPPORTED_JOB_TYPE_SYNC},
Source: mgmtv1alpha1.TransformerSource_TRANSFORMER_SOURCE_GENERATE_BUSINESS_NAME,
Config: &mgmtv1alpha1.TransformerConfig{
Config: &mgmtv1alpha1.TransformerConfig_GenerateBusinessNameConfig{
GenerateBusinessNameConfig: &mgmtv1alpha1.GenerateBusinessName{},
},
},
},
}

// 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 @@ -52,6 +52,7 @@ type TransformerConfig struct {
TransformCharacterScramble *TransformCharacterScramble `json:"transformCharacterScramble,omitempty"`
GenerateJavascript *GenerateJavascript `json:"generateJavascript,omitempty"`
GenerateCountry *GenerateCountryConfig `json:"generateCountryConfig,omitempty"`
GenerateBusinessName *GenerateBusinessNameConfig `json:"generateBusinessNameConfig,omitempty"`
}

type GenerateEmailConfig struct {
Expand Down Expand Up @@ -204,6 +205,8 @@ type GenerateCountryConfig struct {
GenerateFullName *bool `json:"generateFullName,omitempty"`
}

type GenerateBusinessNameConfig struct{}

func (t *JobMappingTransformerModel) FromTransformerDto(tr *mgmtv1alpha1.JobMappingTransformer) error {
if tr == nil {
tr = &mgmtv1alpha1.JobMappingTransformer{}
Expand Down Expand Up @@ -374,6 +377,8 @@ func (t *TransformerConfig) FromTransformerConfigDto(tr *mgmtv1alpha1.Transforme
t.GenerateCountry = &GenerateCountryConfig{
GenerateFullName: tr.GetGenerateCountryConfig().GenerateFullName,
}
case *mgmtv1alpha1.TransformerConfig_GenerateBusinessNameConfig:
t.GenerateBusinessName = &GenerateBusinessNameConfig{}
default:
t = &TransformerConfig{}
}
Expand Down Expand Up @@ -714,6 +719,12 @@ func (t *TransformerConfig) ToTransformerConfigDto() *mgmtv1alpha1.TransformerCo
},
},
}
case t.GenerateBusinessName != nil:
return &mgmtv1alpha1.TransformerConfig{
Config: &mgmtv1alpha1.TransformerConfig_GenerateBusinessNameConfig{
GenerateBusinessNameConfig: &mgmtv1alpha1.GenerateBusinessName{},
},
}
default:
return &mgmtv1alpha1.TransformerConfig{}
}
Expand Down
31 changes: 31 additions & 0 deletions docs/docs/transformers/gen-javascript-transformer.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,37 @@ const newValue = neosync.generateBool({
<br/>


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

### generateBusinessName

Generates a random business name between 2 and 35 characters long.

**Parameters**

**Config**

| Field | Type | Default | Required | Description |
| -------- | ---- | ------- | -------- | ----------- |
| maxLength | int64 | 100 | false | Specifies the maximum length for the generated data. This field ensures that the output does not exceed a certain number of characters.
| seed | int64 | | false | An optional seed value used to generate deterministic outputs.
<br/>

**Example**

```javascript

const newValue = neosync.generateBusinessName({
maxLength: 100,
seed: 1,
});

```
<br/>


<!--
source: generate_card_number.go
-->
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 @@ -260,6 +260,10 @@ components:
type: object
title: GenerateBool
additionalProperties: false
mgmt.v1alpha1.GenerateBusinessName:
type: object
title: GenerateBusinessName
additionalProperties: false
mgmt.v1alpha1.GenerateCardNumber:
type: object
allOf:
Expand Down Expand Up @@ -1206,6 +1210,8 @@ components:
- anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -1296,6 +1302,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -1385,6 +1393,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -1475,6 +1485,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -1739,6 +1751,10 @@ components:
- title: transform_pii_text_config
description: NeosyncCloud/Enterprise only transformer for anonymizing PII Text
- $ref: '#/components/schemas/mgmt.v1alpha1.TransformPiiText'
generateBusinessNameConfig:
allOf:
- title: generate_business_name_config
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateBusinessName'
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 @@ -1132,6 +1132,7 @@ components:
- TRANSFORMER_SOURCE_GENERATE_JAVASCRIPT
- TRANSFORMER_SOURCE_GENERATE_COUNTRY
- TRANSFORMER_SOURCE_TRANSFORM_PII_TEXT
- TRANSFORMER_SOURCE_GENERATE_BUSINESS_NAME
google.protobuf.Timestamp:
type: string
format: date-time
Expand Down Expand Up @@ -1802,6 +1803,10 @@ components:
type: object
title: GenerateBool
additionalProperties: false
mgmt.v1alpha1.GenerateBusinessName:
type: object
title: GenerateBusinessName
additionalProperties: false
mgmt.v1alpha1.GenerateCardNumber:
type: object
allOf:
Expand Down Expand Up @@ -4370,6 +4375,8 @@ components:
- anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -4460,6 +4467,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -4549,6 +4558,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -4639,6 +4650,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -4903,6 +4916,10 @@ components:
- title: transform_pii_text_config
description: NeosyncCloud/Enterprise only transformer for anonymizing PII Text
- $ref: '#/components/schemas/mgmt.v1alpha1.TransformPiiText'
generateBusinessNameConfig:
allOf:
- title: generate_business_name_config
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateBusinessName'
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 @@ -487,6 +487,7 @@ components:
- TRANSFORMER_SOURCE_GENERATE_JAVASCRIPT
- TRANSFORMER_SOURCE_GENERATE_COUNTRY
- TRANSFORMER_SOURCE_TRANSFORM_PII_TEXT
- TRANSFORMER_SOURCE_GENERATE_BUSINESS_NAME
google.protobuf.Timestamp:
type: string
format: date-time
Expand Down Expand Up @@ -634,6 +635,10 @@ components:
type: object
title: GenerateBool
additionalProperties: false
mgmt.v1alpha1.GenerateBusinessName:
type: object
title: GenerateBusinessName
additionalProperties: false
mgmt.v1alpha1.GenerateCardNumber:
type: object
allOf:
Expand Down Expand Up @@ -1724,6 +1729,8 @@ components:
- anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -1814,6 +1821,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -1903,6 +1912,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -1993,6 +2004,8 @@ components:
anyOf:
- required:
- generateBoolConfig
- required:
- generateBusinessNameConfig
- required:
- generateCardNumberConfig
- required:
Expand Down Expand Up @@ -2257,6 +2270,10 @@ components:
- title: transform_pii_text_config
description: NeosyncCloud/Enterprise only transformer for anonymizing PII Text
- $ref: '#/components/schemas/mgmt.v1alpha1.TransformPiiText'
generateBusinessNameConfig:
allOf:
- title: generate_business_name_config
- $ref: '#/components/schemas/mgmt.v1alpha1.GenerateBusinessName'
title: TransformerConfig
additionalProperties: false
mgmt.v1alpha1.UpdateUserDefinedTransformerRequest:
Expand Down
Loading

0 comments on commit 8bba519

Please sign in to comment.