Skip to content

Instantly share code, notes, and snippets.

@enriquebeta6
Last active November 29, 2023 14:32
Show Gist options
  • Save enriquebeta6/385e57c881e9240cd2a4d6353790c561 to your computer and use it in GitHub Desktop.
Save enriquebeta6/385e57c881e9240cd2a4d6353790c561 to your computer and use it in GitHub Desktop.
This function returns the dynamic entity and schema created by the https://github.com/vtex/io-clients/blob/3391975288a7cd73b353bafe1d74e2d37a2e09c2/src/clients/masterData/MasterDataEntity/MasterDataEntityV1.ts#L32 (master data factory client)
function getEntityNameAndSchemaOfMDV2({
appName,
vendor,
entity,
version,
workspace = '',
}) {
return {
entityName: `${vendor}_${appName}_${entity}`.replace(/(\.)|-|:|@/gi, "_"),
schema: [version, workspace].filter(Boolean).join('-'),
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment