getModelFromOptions

Function

To streamline passing of either a model id or the model itself, we use this function to extract the model or fetch it, and return it. It uses failSafe and if the item is not accessible for whatever reason, will return a model-ish object with isMissing: true It is up to the caller to take approriate action

  • getModelFromOptions(modelType: string, options: Record<stringany>) : Promise<IModel>

Parameters

Parameter Type Default Notes
modelType Required string

the type of model to extract from the options hash

options Required Record<stringany>

Something that extends IRequestOptions

Returns

Promise<IModel>
Property Type Notes
item IItem
data Optional [key: string]: any

Function defined in packages/common/src/items/get-model-from-options.ts:13