Skip to content

Commit

Permalink
Merge pull request #1071 from rudderlabs/release/v1.59.0
Browse files Browse the repository at this point in the history
chore(release): pull release/v1.59.0 into main
  • Loading branch information
aashishmalik authored Nov 15, 2023
2 parents f210234 + 721cd35 commit 9125204
Show file tree
Hide file tree
Showing 38 changed files with 893 additions and 75 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [ ] I have made corresponding changes to the documentation
- [ ] The code changed/added as part of this pull request has been covered with tests
- [ ] All tests related to the changed code pass in development
- [ ] I have executed schemaGenerator tests and updated schema if needed

### Code review

Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.59.0](https://github.com/rudderlabs/rudder-config-schema/compare/v1.58.1...v1.59.0) (2023-11-13)


### Features

* add Ketch for Mixpanel, CustomerIO & Snowflake ([#1054](https://github.com/rudderlabs/rudder-config-schema/issues/1054)) ([e1964fb](https://github.com/rudderlabs/rudder-config-schema/commit/e1964fbf74372761c076be00df9eedb285f036ed))
* added allowUserSuppliedJavascript for braze ([#1070](https://github.com/rudderlabs/rudder-config-schema/issues/1070)) ([6b10504](https://github.com/rudderlabs/rudder-config-schema/commit/6b105041274efbf5e02a8af64c6b212a4910afec))
* **analytics-js-integrations:** add in-app message in customerIo ([#1017](https://github.com/rudderlabs/rudder-config-schema/issues/1017)) ([7cf7385](https://github.com/rudderlabs/rudder-config-schema/commit/7cf7385d0e019a8844dd10d006f841adb4aae062))
* custom screen call amplitude ([#1069](https://github.com/rudderlabs/rudder-config-schema/issues/1069)) ([c78780e](https://github.com/rudderlabs/rudder-config-schema/commit/c78780e2be5b3603457ff6c4cd80e027f8a07e04))
* **INT-503:** hybrid mode braze ([#1030](https://github.com/rudderlabs/rudder-config-schema/issues/1030)) ([4bf4f48](https://github.com/rudderlabs/rudder-config-schema/commit/4bf4f48ae1a312b20aa9493d6c455d157c79b823))
* **INT-901:** onboard sprig destination ([#1052](https://github.com/rudderlabs/rudder-config-schema/issues/1052)) ([62f089d](https://github.com/rudderlabs/rudder-config-schema/commit/62f089d4741c4b7d7d398412affcd17b886fd35f))
* marketo: migrate to new UI layout ([#1044](https://github.com/rudderlabs/rudder-config-schema/issues/1044)) ([968310a](https://github.com/rudderlabs/rudder-config-schema/commit/968310a5f72e8480e2e38106b0be8e7b98e531d6))
* onboarding salesforce with oauth ([#998](https://github.com/rudderlabs/rudder-config-schema/issues/998)) ([f774dfd](https://github.com/rudderlabs/rudder-config-schema/commit/f774dfdc371e12bf8545fc17672fa8420667d4f5))


### Bug Fixes

* eventFiltering options key and schema ([#1064](https://github.com/rudderlabs/rudder-config-schema/issues/1064)) ([8e0cf6a](https://github.com/rudderlabs/rudder-config-schema/commit/8e0cf6a362b4dae4e3361a8a0789a34c35f0fa28))
* mp schema inconsistency ([#1068](https://github.com/rudderlabs/rudder-config-schema/issues/1068)) ([ee7cbed](https://github.com/rudderlabs/rudder-config-schema/commit/ee7cbed52b26927c95f9b5204c93b0b2e0a9106a))
* remove web from Singular supported source ([#1051](https://github.com/rudderlabs/rudder-config-schema/issues/1051)) ([dee78f5](https://github.com/rudderlabs/rudder-config-schema/commit/dee78f54873b00a5802fbc3e34a33e65558b8933))
* schema generator script for updating tagInput fiel schema ([#1066](https://github.com/rudderlabs/rudder-config-schema/issues/1066)) ([688aa0b](https://github.com/rudderlabs/rudder-config-schema/commit/688aa0b67f2c70da37915407bdc7fc6f18281ebb))


### [1.58.1](https://github.com/rudderlabs/rudder-config-schema/compare/v1.58.0...v1.58.1) (2023-11-09)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-config-schema",
"version": "1.58.1",
"version": "1.59.0",
"description": "",
"main": "src/index.ts",
"private": true,
Expand All @@ -26,7 +26,13 @@
"prepare": "husky install",
"pre-commit": "npm run test && npx lint-staged",
"commit-msg": "commitlint --edit",
"release:github": "DEBUG=conventional-github-releaser npx conventional-github-releaser -p angular --config github-release.config.js"
"release:github": "DEBUG=conventional-github-releaser npx conventional-github-releaser -p angular --config github-release.config.js",
"check:schema:source:all": "python3 scripts/schemaGenerator.py source -all",
"check:schema:source": "python3 scripts/schemaGenerator.py source -name ",
"update:schema:source": "python3 scripts/schemaGenerator.py source -update -name ",
"check:schema:destination:all": "python3 scripts/schemaGenerator.py destination -all",
"check:schema:destination": "python3 scripts/schemaGenerator.py destination -name ",
"update:schema:destination": "python3 scripts/schemaGenerator.py destination -update -name "
},
"devDependencies": {
"@babel/core": "^7.21.3",
Expand Down
56 changes: 42 additions & 14 deletions scripts/schemaGenerator.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'''
Usage: schemaGenerator.py [-h] [-name name | -all] selector
Usage: schemaGenerator.py [-h] [-name name | -all] [-update] selector
1. selector - “source” or “destination”
2. all - runs the validator for all the selector.
3. name - any particular source or destination name such as `google_analytics`
3. update - updates existing schema with detected changes
Example:
1. python3 scripts/schemaGenerator.py -name="adobe_analytics" destination
2. python3 scripts/schemaGenerator.py -all source
Expand Down Expand Up @@ -414,6 +415,15 @@ def generate_schema_for_tag_input(field, dbConfig, schema_field_name):
}
tagItem['properties'] = tagItemProps
tagObject["items"] = tagItem
isSourceDependent = is_dest_field_dependent_on_source(field, dbConfig, schema_field_name)
if isSourceDependent:
tagObjectCopy = tagObject
tagObject = {}
tagObject = {"type": FieldTypeEnum.OBJECT.value}
tagObject["properties"] = {}
for sourceType in dbConfig["supportedSourceTypes"]:
if sourceType in dbConfig["destConfig"] and field[schema_field_name] in dbConfig["destConfig"][sourceType]:
tagObject["properties"][sourceType] = tagObjectCopy
return tagObject


Expand Down Expand Up @@ -802,14 +812,15 @@ def generate_config_props(config):
generate_config_props(config)


def generate_schema(uiConfig, dbConfig, name, selector):
def generate_schema(uiConfig, dbConfig, name, selector, shouldUpdateSchema):
"""Returns the schema generated from given uiConfig and dbConfig.
Args:
uiConfig (object): file content of ui-config.json.
dbConfig (object): Configurations of db-config.json.
name (string): name of the source or destination.
selector (string): either 'source' or 'destination'
shouldUpdateSchema (boolean): if it should update the existing schema with generated one
Returns:
object: schema
Expand All @@ -824,7 +835,7 @@ def generate_schema(uiConfig, dbConfig, name, selector):
if is_old_format(uiConfig):
allOfSchemaObj = generate_schema_for_allOf(uiConfig, dbConfig, "value")
if allOfSchemaObj:
# AnyOf occuring separately, not inside of allOf.
# AnyOf occurring separately, not inside allOf.
if len(allOfSchemaObj) == 1:
if isinstance(allOfSchemaObj[0], list):
schemaObject['anyOf'] = allOfSchemaObj[0]
Expand All @@ -835,6 +846,19 @@ def generate_schema(uiConfig, dbConfig, name, selector):
generate_schema_properties(uiConfig, dbConfig, schemaObject,
schemaObject['properties'], name, selector)
newSchema['configSchema'] = schemaObject

if shouldUpdateSchema:
# Get the parent directory (one level up)
script_directory = os.path.dirname(os.path.abspath(__file__))
directory = os.path.dirname(script_directory)
# Define the relative path
relative_path = f'src/configurations/{selector}s/{name.lower()}/schema.json'
file_path = os.path.join(directory, relative_path)
new_content = json.dumps(newSchema)
# Write the new content
with open(file_path, 'w') as file:
file.write(new_content)

return newSchema

def generate_warnings_for_each_type(uiConfig, dbConfig, schema, curUiType):
Expand Down Expand Up @@ -924,7 +948,7 @@ def generate_warnings_for_each_type(uiConfig, dbConfig, schema, curUiType):
}


def validate_config_consistency(name, selector, uiConfig, dbConfig, schema):
def validate_config_consistency(name, selector, uiConfig, dbConfig, schema, shouldUpdateSchema):
"""Generates a schema and compares it with an existing one.
If schemaDiff is present, it calls for individual warnings by iterating over each ui-type.
Expand All @@ -934,6 +958,7 @@ def validate_config_consistency(name, selector, uiConfig, dbConfig, schema):
uiConfig (object): file content of ui-config.json.
dbConfig (object): Configurations of db-config.json.
schema (object): Existing schema in schema.json.
shouldUpdateSchema (boolean): if it should update the existing schema with generated one
"""
if schema == None and uiConfig == None:
return
Expand All @@ -942,7 +967,7 @@ def validate_config_consistency(name, selector, uiConfig, dbConfig, schema):
warnings.warn(f"Ui-Config is null for {name} in {selector} \n",UserWarning)
print('-'*50)
return
generatedSchema = generate_schema(uiConfig, dbConfig, name, selector)
generatedSchema = generate_schema(uiConfig, dbConfig, name, selector, shouldUpdateSchema)
if schema:
schemaDiff = diff(schema, generatedSchema["configSchema"])
if schemaDiff:
Expand Down Expand Up @@ -986,12 +1011,13 @@ def validate_config_consistency(name, selector, uiConfig, dbConfig, schema):
print(json.dumps(generatedSchema,indent=2))
print('-'*50)

def get_schema_diff(name, selector):
def get_schema_diff(name, selector, shouldUpdateSchema=False):
""" Validates the schema for the given name and selector.
Args:
name (string): name of the source or destination.
selector (string): either 'source' or 'destination'.
shouldUpdateSchema (boolean): if it should update the existing schema with generated one
"""
file_selectors = ['db-config.json', 'ui-config.json', 'schema.json']
directory = f'./{CONFIG_DIR}/{selector}s/{name}'
Expand All @@ -1005,25 +1031,27 @@ def get_schema_diff(name, selector):
schema = file_content.get("configSchema")
dbConfig = file_content.get("config")
if name not in EXCLUDED_DEST:
validate_config_consistency(name, selector, uiConfig, dbConfig, schema)
validate_config_consistency(name, selector, uiConfig, dbConfig, schema, shouldUpdateSchema)


if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generates schema.json from ui-cofing.json and db-config.json and validates against actual scheme.json')
parser = argparse.ArgumentParser(description='Generates schema.json from ui-config.json and db-config.json and validates against actual scheme.json')
group = parser.add_mutually_exclusive_group()
parser.add_argument('selector',metavar='selector',type=str,help='Enter wheather -name is a source or destination')
group.add_argument('-name',metavar='name',type=str,help='Enter the folder name under selector')
group.add_argument('-all',action='store_true', help='will run validation for all entites under selector')

parser.add_argument('selector', metavar='selector', type=str, help='Enter whether -name is a source or destination')
parser.add_argument('-update', action='store_true', help='Will update existing schema with any changes')
group.add_argument('-name', metavar='name', type=str, help='Enter the folder name under selector')
group.add_argument('-all', action='store_true', help='Will run validation for all entities under selector')

args = parser.parse_args()
selector = args.selector
shouldUpdateSchema = args.update

if args.all:
CONFIG_DIR = 'src/configurations'
current_items = os.listdir(f'./{CONFIG_DIR}/{selector}s')
for name in current_items:
get_schema_diff(name,selector)
get_schema_diff(name, selector)

else:
name = args.name
get_schema_diff(name, selector)
get_schema_diff(name, selector, shouldUpdateSchema)
8 changes: 6 additions & 2 deletions src/configurations/destinations/am/db-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
"attribution",
"eventUploadThreshold",
"eventUploadPeriodMillis",
"trackNewCampaigns"
"trackNewCampaigns",
"userProvidedScreenEventString",
"useUserDefinedScreenEventName"
],
"excludeKeys": [],
"supportedSourceTypes": [
Expand Down Expand Up @@ -84,7 +86,9 @@
"mapDeviceBrand",
"oneTrustCookieCategories",
"userProvidedPageEventString",
"useUserDefinedPageEventName"
"useUserDefinedPageEventName",
"userProvidedScreenEventString",
"useUserDefinedScreenEventName"
],
"web": [
"useNativeSDK",
Expand Down
5 changes: 5 additions & 0 deletions src/configurations/destinations/am/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
"mapDeviceBrand": { "type": "boolean", "default": false },
"trackProductsOnce": { "type": "boolean", "default": false },
"trackRevenuePerProduct": { "type": "boolean", "default": false },
"useUserDefinedScreenEventName": { "type": "boolean", "default": false },
"userProvidedScreenEventString": {
"type": "string",
"pattern": "(^\\{\\{.*\\|\\|(.*)\\}\\}$)|(^env[.].+)|^(.{0,200})$"
},
"eventFilteringOption": {
"type": "string",
"enum": ["disable", "whitelistedEvents", "blacklistedEvents"],
Expand Down
39 changes: 39 additions & 0 deletions src/configurations/destinations/am/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,45 @@
}
}
]
},
{
"title": "Screen settings",
"note": "Set how you want to send your screen calls to Amplitude",
"icon": "file",
"fields": [
{
"type": "checkbox",
"label": "Use Custom Screen Event Name",
"configKey": "useUserDefinedScreenEventName",
"default": false,
"preRequisites": {
"fields": [
{
"configKey": "connectionModes.cloud",
"value": true
}
]
}
},
{
"type": "textInput",
"label": "Screen Event Name Format",
"note": "Assign a event name for your screen calls. Text {{ }} will be replaced with event payload value",
"configKey": "userProvidedScreenEventString",
"regex": "^(.{0,200})$",
"regexErrorMessage": "Invalid Screen Event Name",
"placeholder": "e.g: Viewed a {{ name }}",
"secret": false,
"preRequisites": {
"fields": [
{
"configKey": "useUserDefinedScreenEventName",
"value": true
}
]
}
}
]
}
]
},
Expand Down
17 changes: 14 additions & 3 deletions src/configurations/destinations/braze/db-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"whitelistedEvents",
"oneTrustCookieCategories",
"eventFilteringOption",
"connectionMode"
"connectionMode",
"enablePushNotification",
"allowUserSuppliedJavascript"
],
"excludeKeys": [],
"supportedSourceTypes": [
Expand All @@ -37,11 +39,20 @@
],
"supportedConnectionModes": {
"android": ["cloud", "device", "hybrid"],
"web": ["cloud", "device"],
"web": ["cloud", "device", "hybrid"],
"ios": ["cloud", "device", "hybrid"],
"flutter": ["cloud", "device"],
"reactnative": ["cloud", "device"]
},
"hybridModeCloudEventsFilter": {
"web": {
"messageType": [
"identify",
"track",
"page"
]
}
},
"supportedMessageTypes": ["group", "identify", "page", "screen", "track", "alias"],
"destConfig": {
"defaultConfig": [
Expand All @@ -61,7 +72,7 @@
"ios": ["useNativeSDK", "connectionMode"],
"reactnative": ["useNativeSDK", "connectionMode"],
"flutter": ["useNativeSDK", "connectionMode"],
"web": ["useNativeSDK", "enableBrazeLogging", "connectionMode"]
"web": ["useNativeSDK", "enableBrazeLogging", "connectionMode", "enablePushNotification", "allowUserSuppliedJavascript"]
},
"secretKeys": ["restApiKey"]
}
Expand Down
6 changes: 4 additions & 2 deletions src/configurations/destinations/braze/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@
"properties": {
"android": { "type": "string", "enum": ["cloud", "device", "hybrid"] },
"ios": { "type": "string", "enum": ["cloud", "device", "hybrid"] },
"web": { "type": "string", "enum": ["cloud", "device"] },
"web": { "type": "string", "enum": ["cloud", "device", "hybrid"] },
"reactnative": { "type": "string", "enum": ["cloud", "device"] },
"flutter": { "type": "string", "enum": ["cloud", "device"] }
}
}
},
"enablePushNotification": { "type": "object", "properties": { "web": { "type": "boolean" } } },
"allowUserSuppliedJavascript": { "type": "object", "properties": { "web": { "type": "boolean" } } }
}
}
}
21 changes: 21 additions & 0 deletions src/configurations/destinations/braze/ui-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,27 @@
"configKey": "enableBrazeLogging",
"default": false,
"note": "Turn on if you want to show braze logs to customer"
},
{
"type": "checkbox",
"label": "Use web push notifications",
"configKey": "enablePushNotification",
"default": false,
"note": [
"Turn on if you want to use ",
{
"text": "push notification",
"link": "https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration/#step-1-configure-your-sites-service-worker"
},
". It requires service worker setup by client."
]
},
{
"type": "checkbox",
"label": "enable HTML in-app messages",
"configKey": "allowUserSuppliedJavascript",
"default": false,
"note": "Turn on if you want to enable HTML in-app messages"
}
]
}
Expand Down
Loading

0 comments on commit 9125204

Please sign in to comment.