@zenstackhq/plugin-policy 3.8.0-beta.3 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -285,7 +285,11 @@ var ExpressionTransformer = class {
285
285
  const right = this.transform(normalizedRight, context);
286
286
  if (op === "in") if (this.isNullNode(left)) return this.transformValue(false, "Boolean");
287
287
  else if (ValueListNode.is(right)) return BinaryOperationNode.create(left, OperatorNode.create("in"), right);
288
- else return BinaryOperationNode.create(left, OperatorNode.create("="), FunctionNode.create("any", [right]));
288
+ else {
289
+ const leftFieldDef = this.getFieldDefFromFieldRef(normalizedLeft, context);
290
+ const comparand = leftFieldDef && QueryUtils.isEnum(this.schema, leftFieldDef.type) ? this.dialect.castText(new ExpressionWrapper(left)).toOperationNode() : left;
291
+ return BinaryOperationNode.create(comparand, OperatorNode.create("="), FunctionNode.create("any", [right]));
292
+ }
289
293
  if (this.isNullNode(right)) return this.transformNullCheck(left, expr.op);
290
294
  else if (this.isNullNode(left)) return this.transformNullCheck(right, expr.op);
291
295
  else {