Interface IngredientContainerModel<AdditionalData>

The IngredientContainer represents the collection of IngredientModel entities that are considered as part of the KOS Beverage Graph.

Its primary purpose is expose the set of ingredients that can be used to compose a pourable beverage. The presence or absence of an ingredient in the container will determine if the ingredient is available for use in the beverage graph.

The ingredient container will index all of the underlying ingredients by the type property of the ingredient. This allows for the grouping and filtering of ingredients based on the type property. For example, to get the ingredients that are used for flavor shots, you would call IngredientContainer.getIngredientsByType with the type of the flavor shot.

The Ingredient is a IKosDataModel and is registered with the model registry using the IngredientContainer type.

See

Lifecycle

Load

During the load phase of the model lifecycle, the set of IngredientModel models will be retrieved and processed. The nodes will be indexed based on the defined type for the node. The type is defined as part of the backend Ingredient model.

Extension Points

The load lifecycle hook will call into the ExtensionType.IngredientLoader extension point in order to establish the context that will be used to populate the ingredients nodes. Use of this extension point is optional.

The load lifecycle hook will call into the ExtensionType.IngredientMapper for each ingredient node that is retrieved from the backend. The extension point will be called with the Ingredient context data and the IngredientServices.IngredientResponse for the ingredient node and will map the results into the IngredientModel as part of the data property.

The load lifecycle hook will call into the ExtensionType.IngredientTypeMapper for each ingredient node that is retrieved from the backend. The extension point will be called with the Ingredient context data and the IngredientServices.IngredientResponse for the ingredient node. The results will be mapped into the IngredientModel as the type property.

interface IngredientContainerModel<AdditionalData> {
    ingredients: IKosModelContainer<IngredientModel<any>>;
    getIngredientsByType(type): IngredientModel<AdditionalData>[];
}

Type Parameters

  • AdditionalData extends object = {}

Hierarchy (view full)

  • IngredientContainerOptions
  • IKosDataModel
  • AdditionalData
    • IngredientContainerModel

Properties

ingredients: IKosModelContainer<IngredientModel<any>>

The set of ingredients that are available for use in the beverage graph.

Methods

  • Utility method to retrieve the ingredients that are associated with the specified type.

    Parameters

    • type: string

      The type of the ingredient to retrieve.

    Returns IngredientModel<AdditionalData>[]

    The set of ingredients that are associated with the specified type.