Skip to content

Commit 073d355

Browse files
drudrumAleksey Druzhinin
andauthored
feat: added origin field to Rule class (#752)
Co-authored-by: Aleksey Druzhinin <[email protected]>
1 parent 7307c98 commit 073d355

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/casl-ability/src/Rule.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class Rule<A extends Abilities, C> {
4242
public readonly conditions!: C | undefined;
4343
public readonly fields!: string[] | undefined;
4444
public readonly reason!: string | undefined;
45+
public readonly origin!: RawRule<ToAbilityTypes<A>, C>;
4546
public readonly priority!: number;
4647

4748
constructor(
@@ -56,6 +57,7 @@ export class Rule<A extends Abilities, C> {
5657
this.inverted = !!rule.inverted;
5758
this.conditions = rule.conditions;
5859
this.reason = rule.reason;
60+
this.origin = rule;
5961
this.fields = rule.fields ? wrapArray(rule.fields) : undefined;
6062
this.priority = priority;
6163
this._options = options;

0 commit comments

Comments
 (0)