Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for dest config versioning #1851

Draft
wants to merge 9 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
feat: add support for versioning for destination config v2
koladilip committed Dec 26, 2024
commit 2d47532a8045e320a655f69eea196961fe1e9996
77 changes: 67 additions & 10 deletions src/configurations/destinations/fb_custom_audience/db-config.json
Original file line number Diff line number Diff line change
@@ -2,24 +2,78 @@
"name": "FB_CUSTOM_AUDIENCE",
"displayName": "Facebook Custom Audience",
"config": {
"features": ["vdm-next"],
"features": [
"vdm-next"
],
"supportsBlankAudienceCreation": true,
"disableJsonMapper": true,
"supportsVisualMapper": true,
"syncBehaviours": ["mirror"],
"syncBehaviours": [
"mirror"
],
"transformAtV1": "router",
"saveDestinationResponse": true,
"includeKeys": ["oneTrustCookieCategories", "ketchConsentPurposes", "consentManagement"],
"includeKeys": [
"oneTrustCookieCategories",
"ketchConsentPurposes",
"consentManagement"
],
"excludeKeys": [],
"supportedSourceTypes": ["cloud", "warehouse", "shopify"],
"supportedSourceTypes": [
"cloud",
"warehouse",
"shopify"
],
"versions": [
{
"type": "es-v1",
"actions": [
"create",
"update"
]
},
{
"type": "retl-v1",
"actions": [
"create",
"update"
],
"prerequisite": {
"type": "featureFlag",
"name": "AMP_fbca-retl-v2-enabled",
"value": "false"
}
},
{
"type": "retl-v2",
"actions": [
"create",
"update"
],
"prerequisite": {
"type": "featureFlag",
"name": "AMP_fbca-retl-v2-enabled",
"value": "true"
}
}
],
"supportedMessageTypes": {
"cloud": ["audiencelist", "record"]
"cloud": [
"audiencelist",
"record"
]
},
"isAudienceSupported": true,
"supportedConnectionModes": {
"cloud": ["cloud"],
"warehouse": ["cloud"],
"shopify": ["cloud"]
"cloud": [
"cloud"
],
"warehouse": [
"cloud"
],
"shopify": [
"cloud"
]
},
"destConfig": {
"defaultConfig": [
@@ -54,7 +108,10 @@
"ketchConsentPurposes"
]
},
"secretKeys": ["accessToken", "appSecret"]
"secretKeys": [
"accessToken",
"appSecret"
]
},
"responseRules": {
"responseType": "JSON",
@@ -84,4 +141,4 @@
]
}
}
}
}
1,143 changes: 783 additions & 360 deletions src/configurations/destinations/fb_custom_audience/schema.json

Large diffs are not rendered by default.

1,707 changes: 1,195 additions & 512 deletions src/configurations/destinations/fb_custom_audience/ui-config.json

Large diffs are not rendered by default.

272 changes: 233 additions & 39 deletions src/schemas/destinations/db-config-schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": ["name", "displayName", "config"],
"required": [
"name",
"displayName",
"config"
],
"title": "Destination definition schema",
"description": "The schema for a destination definition. This is used to validate the destination definition configuration files (db-config.json).",
"properties": {
@@ -11,7 +15,11 @@
"description": "A unique name for a destination without any whitespace or special characters.",
"$comment": "Typically, all the characters are in uppercase with words separated by underscores.",
"pattern": "^[a-zA-Z0-9_-]+$",
"examples": ["BING_ADS", "GOOGLE_ANALYTICS", "FACEBOOK_ADS"]
"examples": [
"BING_ADS",
"GOOGLE_ANALYTICS",
"FACEBOOK_ADS"
]
},
"displayName": {
"type": "string",
@@ -31,21 +39,30 @@
"title": "Category",
"description": "The category of the destination.",
"$comment": "Typically, needs to be defined only for warehouse destinations.",
"enum": ["warehouse"]
"enum": [
"warehouse"
]
},
"config": {
"type": "object",
"title": "Configuration",
"description": "This hosts all the destination parameters.",
"required": ["supportedSourceTypes", "destConfig"],
"required": [
"supportedSourceTypes",
"destConfig"
],
"additionalProperties": false,
"properties": {
"transformAtV1": {
"type": "string",
"title": "Transform At V1",
"description": "The module in the server that should initiate destination transformation.",
"$comment": "This field deprecates 'transformAt'.",
"enum": ["processor", "router", "none"],
"enum": [
"processor",
"router",
"none"
],
"default": "processor"
},
"features": {
@@ -54,7 +71,9 @@
"description": "The list of features supported by the destination.",
"items": {
"type": "string",
"enum": ["vdm-next"]
"enum": [
"vdm-next"
]
},
"minItems": 1,
"uniqueItems": true
@@ -217,7 +236,9 @@
"type": "object",
"title": "Source Type Filter Map",
"description": "The event types supported by the destination for the source type.",
"required": ["messageType"],
"required": [
"messageType"
],
"properties": {
"messageType": {
"type": "array",
@@ -311,19 +332,25 @@
"type": "object",
"title": "Authentication",
"description": "The authentication parameters for the destination.",
"required": ["type"],
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"title": "Type",
"description": "The mechanism of authentication active for the destination.",
"enum": ["OAuth"]
"enum": [
"OAuth"
]
},
"provider": {
"type": "string",
"title": "Provider",
"description": "The authentication provider's name.",
"enum": ["Google"]
"enum": [
"Google"
]
},
"role": {
"type": "string",
@@ -338,7 +365,10 @@
"$comment": "'delivery' - event delivery requests. 'delete' - user deletion requests",
"items": {
"type": "string",
"enum": ["delivery", "delete"]
"enum": [
"delivery",
"delete"
]
},
"minItems": 1,
"uniqueItems": true
@@ -375,9 +405,56 @@
"description": "TBD",
"items": {
"type": "string",
"enum": ["mirror", "upsert"]
"enum": [
"mirror",
"upsert"
]
},
"uniqueItems": true
},
"versions": {
"type": "array",
"title": "Versions",
"description": "The versions supported by the destination.",
"items": {
"type": "object",
"required": [
"type",
"actions",
"sourceCategory"
],
"properties": {
"type": {
"type": "string",
"title": "Type",
"description": "The version type supported by the destination.",
"$comment": "This is used to identify the version of the destination.",
"enum": [
"es-v1",
"retl-v1",
"retl-v2"
]
},
"actions": {
"type": "array",
"title": "Actions",
"description": "The actions supported by the version.",
"$comment": "This is used to identify the actions supported by the version.",
"items": {
"type": "string",
"enum": [
"create",
"update"
]
},
"minItems": 1,
"uniqueItems": true
},
"prerequisite": {
"$ref": "#/definitions/logicalOrBasePrerequisite"
}
}
}
}
},
"allOf": [
@@ -391,90 +468,130 @@
"properties": {
"web": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["web"]
"required": [
"web"
]
},
{
"properties": {
"android": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["android"]
"required": [
"android"
]
},
{
"properties": {
"ios": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["ios"]
"required": [
"ios"
]
},
{
"properties": {
"unity": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["unity"]
"required": [
"unity"
]
},
{
"properties": {
"amp": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["amp"]
"required": [
"amp"
]
},
{
"properties": {
"reactnative": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["reactnative"]
"required": [
"reactnative"
]
},
{
"properties": {
"flutter": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["flutter"]
"required": [
"flutter"
]
},
{
"properties": {
"cordova": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["cordova"]
"required": [
"cordova"
]
},
{
"properties": {
"shopify": {
"type": "array",
"contains": { "const": "hybrid" }
"contains": {
"const": "hybrid"
}
}
},
"required": ["shopify"]
"required": [
"shopify"
]
}
]
}
},
"required": ["supportedConnectionModes"]
"required": [
"supportedConnectionModes"
]
},
"then": {
"required": ["hybridModeCloudEventsFilter"],
"required": [
"hybridModeCloudEventsFilter"
],
"properties": {
"hybridModeCloudEventsFilter": {
"type": "object"
@@ -530,7 +647,6 @@
}
]
},

"deprecated": {
"type": "boolean",
"title": "Deprecated",
@@ -603,14 +719,20 @@
"description": "Some destinations send 2xx as status code even when the request has some errors. Hence, we have to parse the response body to determine the actual status.",
"$comment": "This method of parsing the response is DEPRECATED now in lieu of transformer proxy.",
"additionalProperties": false,
"required": ["responseType", "rules"],
"required": [
"responseType",
"rules"
],
"properties": {
"responseType": {
"type": "string",
"title": "Response Type",
"description": "The response type from the destination.",
"$comment": "This indicates the type of response returned by the destination.",
"enum": ["JSON", "TXT"]
"enum": [
"JSON",
"TXT"
]
},
"rules": {
"type": "object",
@@ -652,13 +774,82 @@
}
},
"definitions": {
"basePrerequisite": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"featureFlag"
]
},
"name": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"type",
"name",
"value"
],
"additionalProperties": false
},
"logicalPrerequisite": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"or",
"and"
]
},
"prerequisites": {
"type": "array",
"items": {
"$ref": "#/definitions/logicalOrBasePrerequisite"
}
}
},
"required": [
"type",
"prerequisites"
],
"additionalProperties": false
},
"logicalOrBasePrerequisite": {
"oneOf": [
{
"$ref": "#/definitions/basePrerequisite"
},
{
"$ref": "#/definitions/logicalPrerequisite"
}
]
},
"eventType": {
"type": "string",
"enum": ["track", "identify", "page", "screen", "alias", "group", "audiencelist", "record"]
"enum": [
"track",
"identify",
"page",
"screen",
"alias",
"group",
"audiencelist",
"record"
]
},
"connectionMode": {
"type": "string",
"enum": ["cloud", "device", "hybrid"]
"enum": [
"cloud",
"device",
"hybrid"
]
},
"sourceType": {
"type": "string",
@@ -691,11 +882,14 @@
"success": {
"type": "string",
"title": "Success",
"enum": ["true", "false"]
"enum": [
"true",
"false"
]
}
},
"minProperties": 1,
"maxProperties": 2
}
}
}
}

Unchanged files with check annotations Beta

}
}
export async function validateDestinationDefinitions(destDefConfig: any): Promise<boolean> {

Check warning on line 62 in src/validator/index.ts

GitHub Actions / Check for formatting & lint errors

Unexpected any. Specify a different type
const ddAjv = new Ajv({
allErrors: true,
useDefaults: true,
return true;
}
export async function validateSourceDefinitions(srcDefConfig: any): Promise<boolean> {

Check warning on line 90 in src/validator/index.ts

GitHub Actions / Check for formatting & lint errors

Unexpected any. Specify a different type
const ddAjv = new Ajv({
allErrors: true,
useDefaults: true,