|
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 |
|
18 | | -import { CollectionReference } from '../api'; |
19 | | -import { |
20 | | - AggregateFunction, |
21 | | - AggregateWithAlias, |
22 | | - BooleanExpression, |
23 | | - Expression, |
24 | | - field, |
25 | | - Field, |
26 | | - Ordering, |
27 | | - Selectable |
28 | | -} from '../lite-api/expressions'; |
29 | | -import { Pipeline as LitePipeline } from '../lite-api/pipeline'; |
30 | | - |
31 | 18 | /** Sentinel value that sorts before any Mutation Batch ID. */ |
32 | 19 | export const BATCHID_UNKNOWN = -1; |
33 | 20 |
|
@@ -97,58 +84,3 @@ export type OneOf<T> = { |
97 | 84 | [P in Exclude<keyof T, K>]?: undefined; |
98 | 85 | }; |
99 | 86 | }[keyof T]; |
100 | | - |
101 | | -export function isSelectable(val: unknown): val is Selectable { |
102 | | - const candidate = val as Selectable; |
103 | | - return ( |
104 | | - candidate.selectable && isString(candidate.alias) && isExpr(candidate.expr) |
105 | | - ); |
106 | | -} |
107 | | - |
108 | | -export function isOrdering(val: unknown): val is Ordering { |
109 | | - const candidate = val as Ordering; |
110 | | - return ( |
111 | | - isExpr(candidate.expr) && |
112 | | - (candidate.direction === 'ascending' || |
113 | | - candidate.direction === 'descending') |
114 | | - ); |
115 | | -} |
116 | | - |
117 | | -export function isAliasedAggregate(val: unknown): val is AggregateWithAlias { |
118 | | - const candidate = val as AggregateWithAlias; |
119 | | - return ( |
120 | | - isString(candidate.alias) && |
121 | | - candidate.aggregate instanceof AggregateFunction |
122 | | - ); |
123 | | -} |
124 | | - |
125 | | -export function isExpr(val: unknown): val is Expression { |
126 | | - return val instanceof Expression; |
127 | | -} |
128 | | - |
129 | | -export function isBooleanExpr(val: unknown): val is BooleanExpression { |
130 | | - return val instanceof BooleanExpression; |
131 | | -} |
132 | | - |
133 | | -export function isField(val: unknown): val is Field { |
134 | | - return val instanceof Field; |
135 | | -} |
136 | | - |
137 | | -export function isLitePipeline(val: unknown): val is LitePipeline { |
138 | | - return val instanceof LitePipeline; |
139 | | -} |
140 | | - |
141 | | -export function isCollectionReference( |
142 | | - val: unknown |
143 | | -): val is CollectionReference { |
144 | | - return val instanceof CollectionReference; |
145 | | -} |
146 | | - |
147 | | -export function toField(value: string | Field): Field { |
148 | | - if (isString(value)) { |
149 | | - const result = field(value); |
150 | | - return result; |
151 | | - } else { |
152 | | - return value as Field; |
153 | | - } |
154 | | -} |
0 commit comments