Skip to content

Commit

Permalink
fix: adds jsdoc comments (#768)
Browse files Browse the repository at this point in the history
  • Loading branch information
stalniy authored May 5, 2023
1 parent cfa1acb commit 6ca6105
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/casl-ability/src/Ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export interface MongoAbility<
C extends MongoQuery = MongoQuery
> extends PureAbility<A, C> {}

/**
* Creates Ability with MongoDB conditions matcher
*/
export function createMongoAbility<
T extends AnyMongoAbility = MongoAbility
>(rules?: RawRuleOf<T>[], options?: AbilityOptionsOf<T>): T;
Expand Down
3 changes: 3 additions & 0 deletions packages/casl-mongoose/src/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ function convertToMongoQuery(rule: AnyMongoAbility['rules'][number]) {
return rule.inverted ? { $nor: [conditions] } : conditions;
}

/**
* Converts ability action + subjectType to MongoDB query
*/
export function toMongoQuery<T extends AnyMongoAbility>(
ability: T,
subjectType: Parameters<T['rulesFor']>[1],
Expand Down

0 comments on commit 6ca6105

Please sign in to comment.