Changelog History
Page 2
-
v5.1.0-next.10 Changes
October 17, 20205.1.0-next.10 (2020-10-17)
๐จ Code Refactoring
- ruleIndex: removes possibility to pass subject to
rulesFor
andpossibleRulesFor
[skip release] (b8c324d)
๐ Performance Improvements
- ruleIndex: removes subject type detection from
_buildIndexFor
(13fe934)
๐ฅ BREAKING CHANGES
ruleIndex:
rulesFor
,possibleRulesFor
,rulesToQuery
,ruleToAST
,rulesToFields
accepts only subject type now!Before
import { Ability } from '@casl/ability';const ability = new Ability([{ action: 'read', subject: 'Post' }]);class Post {}console.log(ability.rulesFor('read', new Post())); // [Rule]console.log(ability.rulesFor('read', 'Post')); // [Rule]
After
import { Ability } from '@casl/ability';const ability = new Ability([{ action: 'read', subject: 'Post' }]);class Post {}console.log(ability.rulesFor('read', new Post())); // throws exceptionconsole.log(ability.rulesFor('read', 'Post')); // [Rule]
Other functions and methods have the same behavior
- ruleIndex: removes possibility to pass subject to
-
v5.1.0-next.1 Changes
August 20, 2020 -
v5.0.1-next.1 Changes
August 11, 20205.0.1-next.1 (2020-08-11)
๐ Bug Fixes
- conditions: moves logic related to compare complex types to @ucast/mongo2js (9bd6a1b)
-
v5.0.0 Changes
August 10, 20205.0.0 (2020-08-10)
๐ Bug Fixes
- ability: removes sift specific types from casl (9f18b31)
๐จ Code Refactoring
- ability: removes deprecated types and fields (bf5ef73), closes #355
- ๐ฆ package: replaces siftjs with @ucast/mongo2js (41e53aa), closes #350
๐ Features
๐ฅ BREAKING CHANGES
๐ฆ package: replaces siftjs with @ucast/mongo2js. This changed
MongoQuery
type andbuildMongoQueryMatcher
function parameters. Influences users who implemented custom sift operators:MongoQuery
accepted a generic type of AdditionalOperators, now it accepts an object interface and custom operatorsMongoQueryOperators
is renamed toMongoQueryFieldOperators
and now acceptsValue
generic parameterbuildMongoQuery
now accepts 3 optional parameters: custom parsing instruction, custom operator interpreters and options for JavaScript interpretersAbility
does not compare objects anymore, so if you rely on value to equal specific object, then you need to either change your conditions or implement customequal
function
Before
import { MongoQuery, MongoQueryOperators, buildMongoQueryMatcher } from '@casl/ability';import { $nor } from 'sift';type CustomMongoQuery = MongoQuery\<{$customOperator: Function}\>;type $eq = MongoQueryOperators['$eq'];const matcher = buildMongoQueryMatcher({ $nor })
After
import { MongoQuery, MongoQueryFieldOperators, buildMongoQueryMatcher } from '@casl/ability';import { $nor, nor } from '@ucast/mongo2js'type CustomMongoQuery\<T\> = MongoQuery\<T, {toplevel: {// can be used only on document level$customOperator: Function},field: {// can be used only on field level$my: boolean}}\>type $eq = MongoQueryFieldOperators['$eq']; // accepts optional `Value` generic parameterconst matcher = buildMongoQueryMatcher({ $nor }, { nor });```
ability: removes deprecated options and types:
๐
AbilityOptions['subjectName']
has been removed, usedetectSubjectType
instead๐
LegacyClaimRawRule
andLegacySubjectRawRule
are both removed, so you are no longer allowed to useactions
in rule definition, useaction
property insteadAbility
throws an error if you specify a rule with propertyfield
to be an empty arrayAbility
no longer warns about using only inverted rules. This may be done by intention, so now it's left up to developer to decide whether it's fine or not -
v4.1.6 Changes
September 06, 2020 -
v4.1.5 Changes
September 03, 2020 -
v3.4.0 Changes
December 22, 2019@casl/ability-v3.4.0 (2019-12-22)
๐ Features
-
v3.3.0 Changes
December 09, 2019@casl/ability-v3.3.0 (2019-12-09)
๐ Bug Fixes
- deps: update dependency sift to v9 (cf3aa9a)
๐ Features
-
v3.2.0 Changes
July 28, 2019@casl/ability-v3.2.0 (2019-07-28)
๐ Features
-
v3.1.2 Changes
July 08, 2019@casl/ability-v3.1.2 (2019-07-08)
๐ Performance Improvements
- ability: checks for fields only if fields were specified in rules (da013d4)