Skip to main content

Function: oneOrCurrent()

oneOrCurrent<C, I, CI, RawData, Data, Deserialized, Next>(transform?): (action) => Promise<CI | Next>

Run the action and deserialize one model's instance. Returns current instance when not found or empty result.

Type parameters

C extends ConsumeInstance<CI>

I extends ModelInstance

CI extends ModelInstance

RawData

Data

Deserialized extends DeserializedData <ModelInstance>

Next = CI

Parameters

transform?

Returns

Function

Parameters

action: Action<C & ConsumeInstance<CI> & ConsumeAdapter<RawData, Data> & ConsumeDeserializer<NonNullable<Data>, Deserialized>, any>

Returns

Promise<CI | Next>

Source

packages/core/src/actions/context/runners/oneOrCurrent.ts:38