From b8e28dfa15fc9a770295648795a1ef56f3185ecf Mon Sep 17 00:00:00 2001 From: Zura Benashvili Date: Thu, 6 Aug 2020 16:28:27 +0400 Subject: [PATCH] feat(core/operator/uid): accept ref --- packages/core/src/operators/operators.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/core/src/operators/operators.ts b/packages/core/src/operators/operators.ts index 9eba5a2..5d28e6d 100644 --- a/packages/core/src/operators/operators.ts +++ b/packages/core/src/operators/operators.ts @@ -1,6 +1,7 @@ import { OperatorBuilder, OpBuilderValue, Subject } from '../operator'; import { UidLike, Uid } from '../uid'; import { ParamBuilder } from '../param'; +import { RefAble, isRefAble } from '../ref'; type UidArg = UidLike | ParamBuilder; @@ -14,10 +15,16 @@ export const type = (type: string) => export const has = (subject: Subject) => new OperatorBuilder({ name: 'has', subject }); -export const uid = (...uids: UidArg<'uid' | 'uid[]'>[]) => +export const uid = (...uids: (UidArg<'uid' | 'uid[]'> | RefAble)[]) => new OperatorBuilder({ name: 'uid', - value: uids.map(x => x instanceof ParamBuilder ? x : new Uid(x)), + value: uids.map(x => { + if (x instanceof ParamBuilder) + return x; + if (isRefAble(x)) + return x.ref(); + return new Uid(x); + }), }); /**