Skip to content

Commit

Permalink
feat: added origin field to Rule class (#752)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksey Druzhinin <[email protected]>
  • Loading branch information
drudrum and Aleksey Druzhinin authored Apr 12, 2023
1 parent 7307c98 commit 073d355
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/casl-ability/src/Rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class Rule<A extends Abilities, C> {
public readonly conditions!: C | undefined;
public readonly fields!: string[] | undefined;
public readonly reason!: string | undefined;
public readonly origin!: RawRule<ToAbilityTypes<A>, C>;
public readonly priority!: number;

constructor(
Expand All @@ -56,6 +57,7 @@ export class Rule<A extends Abilities, C> {
this.inverted = !!rule.inverted;
this.conditions = rule.conditions;
this.reason = rule.reason;
this.origin = rule;
this.fields = rule.fields ? wrapArray(rule.fields) : undefined;
this.priority = priority;
this._options = options;
Expand Down

0 comments on commit 073d355

Please sign in to comment.