(value: number | string | boolean | Date)
| 144 | }; |
| 145 | |
| 146 | const wrapConstExpr = (value: number | string | boolean | Date): CELExpr => { |
| 147 | if (typeof value === "string") { |
| 148 | return wrapCELExpr({ |
| 149 | case: "constExpr", |
| 150 | value: create(ConstantSchema, { |
| 151 | constantKind: { |
| 152 | case: "stringValue", |
| 153 | value, |
| 154 | }, |
| 155 | }), |
| 156 | }); |
| 157 | } |
| 158 | if (typeof value === "number") { |
| 159 | return wrapCELExpr({ |
| 160 | case: "constExpr", |
| 161 | value: create(ConstantSchema, { |
| 162 | constantKind: { |
| 163 | case: "int64Value", |
| 164 | value: BigInt(value), |
| 165 | }, |
| 166 | }), |
| 167 | }); |
| 168 | } |
| 169 | if (typeof value === "boolean") { |
| 170 | return wrapCELExpr({ |
| 171 | case: "constExpr", |
| 172 | value: create(ConstantSchema, { |
| 173 | constantKind: { |
| 174 | case: "boolValue", |
| 175 | value, |
| 176 | }, |
| 177 | }), |
| 178 | }); |
| 179 | } |
| 180 | throw new Error(`unexpected value "${value}"`); |
| 181 | }; |
| 182 | |
| 183 | const wrapListExpr = (values: string[] | number[]): CELExpr => { |
| 184 | return wrapCELExpr({ |
no test coverage detected