-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: mapping and utilities (VF-2613) #175
Conversation
export const AmazonToGeneralIntentMap: Partial<Record<AmazonIntent, General.IntentName>> = { | ||
[AmazonIntent.NO]: General.IntentName.NO, | ||
[AmazonIntent.YES]: General.IntentName.YES, | ||
[AmazonIntent.STOP]: General.IntentName.STOP, | ||
[AmazonIntent.NEXT]: General.IntentName.NEXT, | ||
[AmazonIntent.HELP]: General.IntentName.HELP, | ||
[AmazonIntent.PAUSE]: General.IntentName.PAUSE, | ||
[AmazonIntent.CANCEL]: General.IntentName.CANCEL, | ||
[AmazonIntent.RESUME]: General.IntentName.RESUME, | ||
[AmazonIntent.REPEAT]: General.IntentName.REPEAT, | ||
[AmazonIntent.FALLBACK]: General.IntentName.NONE, | ||
[AmazonIntent.PREVIOUS]: General.IntentName.PREVIOUS, | ||
[AmazonIntent.START_OVER]: General.IntentName.START_OVER, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const GeneralToAmazonIntentMap: Partial<Record<General.IntentName, AmazonIntent>> = { | ||
[General.IntentName.NO]: AmazonIntent.NO, | ||
[General.IntentName.YES]: AmazonIntent.YES, | ||
[General.IntentName.STOP]: AmazonIntent.STOP, | ||
[General.IntentName.NEXT]: AmazonIntent.NEXT, | ||
[General.IntentName.HELP]: AmazonIntent.HELP, | ||
[General.IntentName.PAUSE]: AmazonIntent.PAUSE, | ||
[General.IntentName.CANCEL]: AmazonIntent.CANCEL, | ||
[General.IntentName.RESUME]: AmazonIntent.RESUME, | ||
[General.IntentName.REPEAT]: AmazonIntent.REPEAT, | ||
[General.IntentName.NONE]: AmazonIntent.FALLBACK, | ||
[General.IntentName.PREVIOUS]: AmazonIntent.PREVIOUS, | ||
[General.IntentName.START_OVER]: AmazonIntent.START_OVER, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos, SonarCloud Quality Gate passed! |
export const AmazonToGeneralSlotMap: Partial<Record<SlotType, General.SlotType>> = { | ||
[SlotType.TIME]: General.SlotType.DATETIME, | ||
[SlotType.DATE]: General.SlotType.DATETIME, | ||
[SlotType.FOUR_DIGIT_NUMBER]: General.SlotType.NUMBER, | ||
[SlotType.NUMBER]: General.SlotType.NUMBER, | ||
[SlotType.PHONENUMBER]: General.SlotType.PHONENUMBER, | ||
[SlotType.PERSON]: General.SlotType.NAME, | ||
[SlotType.DE_FIRST_NAME]: General.SlotType.NAME, | ||
[SlotType.GB_FIRST_NAME]: General.SlotType.NAME, | ||
[SlotType.US_FIRST_NAME]: General.SlotType.NAME, | ||
[SlotType.FIRSTNAME]: General.SlotType.NAME, | ||
[SlotType.ORDINAL]: General.SlotType.ORDINAL, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const GeneralToAmazonSlotMap: Partial<Record<General.SlotType, SlotType>> = { | ||
[General.SlotType.DATETIME]: SlotType.DATE, | ||
[General.SlotType.NUMBER]: SlotType.NUMBER, | ||
[General.SlotType.PHONENUMBER]: SlotType.PHONENUMBER, | ||
[General.SlotType.NAME]: SlotType.FIRSTNAME, | ||
[General.SlotType.ORDINAL]: SlotType.ORDINAL, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const AmazonToGeneralLocaleMap: Record<Locale, General.Locale> = { | ||
[Locale.EN_US]: General.Locale.EN_US, | ||
[Locale.EN_AU]: General.Locale.EN_US, | ||
[Locale.EN_CA]: General.Locale.EN_US, | ||
[Locale.EN_IN]: General.Locale.EN_US, | ||
[Locale.EN_GB]: General.Locale.EN_US, | ||
[Locale.FR_CA]: General.Locale.FR_CA, | ||
[Locale.ES_US]: General.Locale.ES_ES, | ||
[Locale.FR_FR]: General.Locale.FR_FR, | ||
[Locale.DE_DE]: General.Locale.DE_DE, | ||
[Locale.IT_IT]: General.Locale.IT_IT, | ||
[Locale.JA_JP]: General.Locale.JA_JP, | ||
[Locale.ES_ES]: General.Locale.ES_ES, | ||
[Locale.ES_MX]: General.Locale.ES_MX, | ||
[Locale.PT_BR]: General.Locale.PT_BR, | ||
[Locale.HI_IN]: General.Locale.HI_IN, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const GeneralToAmazonLocaleMap: Record<General.Locale, Locale> = { | ||
[General.Locale.EN_US]: Locale.EN_US, | ||
[General.Locale.AR_AR]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
[General.Locale.ZH_CN]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
[General.Locale.NL_NL]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
[General.Locale.FR_FR]: Locale.FR_FR, | ||
[General.Locale.FR_CA]: Locale.FR_CA, | ||
[General.Locale.DE_DE]: Locale.DE_DE, | ||
[General.Locale.GU_IN]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
[General.Locale.HI_IN]: Locale.HI_IN, | ||
[General.Locale.IT_IT]: Locale.IT_IT, | ||
[General.Locale.JA_JP]: Locale.JA_JP, | ||
[General.Locale.KO_KR]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
[General.Locale.MR_IN]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
[General.Locale.PT_BR]: Locale.PT_BR, | ||
[General.Locale.ES_ES]: Locale.ES_ES, | ||
[General.Locale.ES_MX]: Locale.ES_MX, | ||
[General.Locale.TA_IN]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
[General.Locale.TE_IN]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
[General.Locale.TR_TR]: Locale.EN_US, // FIXME: Unsupported language by Alexa | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes or implements VF-2613
Brief description. What is this change?
moved a bunch of utility functions out from services to a centralized location, and started adding in the mappings patterns with proper declarations and consistent names.
Check my comments for where they originally came from
We were using the
_invert
method to invert the array, but this has side effects because of many to one/one to many mappings. So it is better to be explicit