Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace InputUtil

Utilities to assist with input handling.

Functions

actionIsMatch

  • actionIsMatch(action: string | undefined, expectedValues: string[]): boolean
  • Test if the action is defined and matches one of the provided identifiers.

    Parameters

    • action: string | undefined

      Action slot value ID

    • expectedValues: string[]

      Action slot value IDs to match against

    Returns boolean

actionIsMatchOrUndefined

  • actionIsMatchOrUndefined(action: string | undefined, actionIds: string[]): boolean
  • Test if the action matches one of the provided identifiers, or is undefined.

    Parameters

    • action: string | undefined

      Action slot value ID

    • actionIds: string[]

    Returns boolean

actionIsSetOrUndefined

  • actionIsSetOrUndefined(action: string | undefined, expectedValues: string[]): boolean
  • Test if the action matches one of the provided identifiers, or is undefined.

    Parameters

    • action: string | undefined

      Action slot value ID

    • expectedValues: string[]

      Action slot value IDs to match against

    Returns boolean

actionIsUndefined

  • actionIsUndefined(action: string | undefined): boolean
  • Test if the action is undefined.

    Parameters

    • action: string | undefined

      Action slot value ID

    Returns boolean

feedbackIsDefined

  • feedbackIsDefined(feedback: string | undefined): boolean
  • Test if the feedback is defined

    Parameters

    • feedback: string | undefined

      Feedback slot value ID

    Returns boolean

feedbackIsFalse

  • feedbackIsFalse(feedback: string | undefined): boolean
  • Test if the feedback is 'builtin_disaffirm'

    Parameters

    • feedback: string | undefined

      Feedback slot value ID

    Returns boolean

feedbackIsMatchOrUndefined

  • feedbackIsMatchOrUndefined(feedback: string | undefined, feedbackIds: string[]): boolean
  • Test if the feedback matches one of the provided identifiers, or is undefined.

    Parameters

    • feedback: string | undefined

      Feedback slot value

    • feedbackIds: string[]

      Feedback slot value IDs to match against

    Returns boolean

feedbackIsTrue

  • feedbackIsTrue(feedback: string | undefined): boolean
  • Test if the feedback is 'builtin_affirm'

    Parameters

    • feedback: string | undefined

      Feedback slot value ID

    Returns boolean

feedbackIsUndefined

  • feedbackIsUndefined(feedback: string | undefined): boolean
  • Test if the feedback is undefined

    Parameters

    • feedback: string | undefined

      Feedback slot value ID

    Returns boolean

getMultiValueResolution

  • Extracts the value and erMatch array list from a ValueControlIntent

    Parameters

    Returns MultiValueSlot[]

getValueResolution

  • Extracts the value and erMatch from a ValueControlIntent

    Parameters

    Returns object

    • erMatch: boolean
    • valueStr: string

isAPLUserEventWithArgs

  • Test if the input is an Alexa.Presentation.APL.UserEvent and has arguments.

    Parameters

    Returns boolean

isAPLUserEventWithMatchingControlId

  • isAPLUserEventWithMatchingControlId(input: ControlInput, controlId: string): boolean
  • Test if the input is an Alexa.Presentation.APL.UserEvent with a first argument equal to the provided control ID.

    Parameters

    • input: ControlInput

      Input

    • controlId: string

      the expected control ID

    Returns boolean

isAPLUserEventWithMatchingControlIdAndArgLength

  • isAPLUserEventWithMatchingControlIdAndArgLength(input: ControlInput, controlId: string, argLength: number): boolean
  • Test if the input is an Alexa.Presentation.APL.UserEvent with a first argument equal to the provided control ID and total argument length equal to the provided length.

    Parameters

    • input: ControlInput

      Input

    • controlId: string

      the expected control ID

    • argLength: number

      the expected argument length

    Returns boolean

isAPLUserEventWithMatchingSourceId

  • isAPLUserEventWithMatchingSourceId(input: ControlInput, sourceId: string): boolean
  • Test if the input is an Alexa.Presentation.APL.UserEvent with sourceId equal to the provided source ID.

    Parameters

    Returns boolean

isBareNo

  • Test if the input is equivalent to simply saying "no".

    Parameters

    Returns boolean

    true if the input is:

    • AMAZON.NoIntent, or,
    • A GeneralControlIntent with feedback = builtin_disaffirm and no other filled.

isBareYes

  • Test if the input is equivalent to simply saying "yes".

    Parameters

    Returns boolean

    true if the input is:

    • AMAZON.YesIntent, or,
    • A GeneralControlIntent with feedback = builtin_affirm and no other filled.

isFallbackIntent

  • Test if the input is an AMAZON.FallbackIntent.

    Parameters

    Returns boolean

isIntent

  • isIntent(input: ControlInput, expectedIntentName?: undefined | string): boolean
  • Test if the input is an IntentRequest (and optionally a specific Intent).

    Parameters

    • input: ControlInput

      Input

    • Optional expectedIntentName: undefined | string

      a specific intent name

    Returns boolean

isIntentShape

  • isIntentShape(x: any): x
  • Test and assert if an object looks like an Intent. (user-defined type guard)

    Parameters

    • x: any

    Returns x

isLaunchRequest

  • Test if the input is a LaunchRequest.

    Parameters

    Returns boolean

isSessionEndedRequest

  • Test if the input is a SessionEndedRequest.

    Parameters

    Returns boolean

isValueControlIntent

  • isValueControlIntent(input: ControlInput, slotType: string): boolean
  • Test if the input is a ValueControlIntent for the provided slotType.

    Parameters

    Returns boolean

slotIsUndefinedOrMatch

  • slotIsUndefinedOrMatch(slotValue: string | undefined, expectedValues: string[]): boolean
  • Test if the slot value matches one of the provided identifiers, or is undefined.

    Parameters

    • slotValue: string | undefined

      Slot value ID

    • expectedValues: string[]

      Slot value IDs to match against

    Returns boolean

targetIsDefined

  • targetIsDefined(target: string | undefined): boolean
  • Test if the feedback is defined.

    Parameters

    • target: string | undefined

      Target slot value ID

    Returns boolean

targetIsMatch

  • targetIsMatch(target: string | undefined, targetIds: string[]): boolean
  • Test if the target is defined and matches one of the provided identifiers.

    Parameters

    • target: string | undefined

      Target slot value ID

    • targetIds: string[]

      Target slot value IDs to match against

    Returns boolean

targetIsMatchOrUndefined

  • targetIsMatchOrUndefined(target: string | undefined, targetIds: string[]): boolean
  • Test if the target matches one of the provided identifiers, or is undefined.

    Parameters

    • target: string | undefined

      Target slot value ID

    • targetIds: string[]

      Target slot value IDs to match against

    Returns boolean

targetIsUndefined

  • targetIsUndefined(target: string | undefined): boolean
  • Test if the feedback is undefined.

    Parameters

    • target: string | undefined

      Target slot value ID

    Returns boolean

valueStrDefined

  • valueStrDefined(value: MultiValueSlot[] | string | undefined): boolean
  • Test if the value is defined.

    A value of '?' is interpreted as being equal to undefined. (A value of '?' is produced by NLU when slot elicitation is used but the response cannot be understood.)

    Parameters

    Returns boolean

valueStrIsUndefined

  • valueStrIsUndefined(value: string | undefined): boolean
  • Test if the value is undefined.

    A value of '?' is interpreted as being equal to undefined. (A value of '?' is produced by NLU when slot elicitation is used but the response cannot be understood.)

    Parameters

    • value: string | undefined

      Value

    Returns boolean

valueTypeIsUndefined

  • valueTypeIsUndefined(valueType: string | undefined): boolean
  • Test if the valueType is undefined.

    Parameters

    • valueType: string | undefined

      ValueType slot value ID

    Returns boolean

valueTypeMatch

  • valueTypeMatch(valueType: string | undefined, expectedValueType: string | string[]): boolean
  • Test if the valueType is defined and matches the provided identifier.

    Parameters

    • valueType: string | undefined

      ValueType slot value ID

    • expectedValueType: string | string[]

      ValueType slot value ID to match against

    Returns boolean