Skip to content

Commit 8fc0da5

Browse files
committed
update
1 parent 4a08dfe commit 8fc0da5

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/runtime/src/plugins/policy/expression-transformer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ export class ExpressionTransformer<Schema extends SchemaDef> {
461461
if (isBeforeInvocation(expr.receiver)) {
462462
// policy handler creates a join table named `$before` using entity value before update,
463463
// we can directly reference the column from there
464+
invariant(context.operation === 'post-update', 'before() can only be used in post-update policy');
464465
invariant(expr.members.length === 1, 'before() can only be followed by a scalar field access');
465466
return ReferenceNode.create(ColumnNode.create(expr.members[0]!), TableNode.create('$before'));
466467
}

packages/runtime/src/utils/expression-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414

1515
export class ExpressionVisitor {
1616
visit(expr: Expression): void {
17-
return match(expr)
17+
match(expr)
1818
.with({ kind: 'literal' }, (e) => this.visitLiteral(e))
1919
.with({ kind: 'array' }, (e) => this.visitArray(e))
2020
.with({ kind: 'field' }, (e) => this.visitField(e))

0 commit comments

Comments
 (0)