@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.cjs CHANGED
@@ -286,7 +286,11 @@ var ExpressionTransformer = class {
286
286
  const right = this.transform(normalizedRight, context);
287
287
  if (op === "in") if (this.isNullNode(left)) return this.transformValue(false, "Boolean");
288
288
  else if (kysely.ValueListNode.is(right)) return kysely.BinaryOperationNode.create(left, kysely.OperatorNode.create("in"), right);
289
- else return kysely.BinaryOperationNode.create(left, kysely.OperatorNode.create("="), kysely.FunctionNode.create("any", [right]));
289
+ else {
290
+ const leftFieldDef = this.getFieldDefFromFieldRef(normalizedLeft, context);
291
+ const comparand = leftFieldDef && _zenstackhq_orm.QueryUtils.isEnum(this.schema, leftFieldDef.type) ? this.dialect.castText(new kysely.ExpressionWrapper(left)).toOperationNode() : left;
292
+ return kysely.BinaryOperationNode.create(comparand, kysely.OperatorNode.create("="), kysely.FunctionNode.create("any", [right]));
293
+ }
290
294
  if (this.isNullNode(right)) return this.transformNullCheck(left, expr.op);
291
295
  else if (this.isNullNode(left)) return this.transformNullCheck(right, expr.op);
292
296
  else {