All Versions
Latest Version
Avg Release Cycle
34 days
Latest Release
1384 days ago

Changelog History
Page 2

  • v5.1.0-next.10 Changes

    October 17, 2020

    5.1.0-next.10 (2020-10-17)

    ๐Ÿ”จ Code Refactoring

    • ruleIndex: removes possibility to pass subject to rulesFor and possibleRulesFor [skip release] (b8c324d)

    ๐ŸŽ Performance Improvements

    • ruleIndex: removes subject type detection from _buildIndexFor (13fe934)


    ruleIndex: rulesFor, possibleRulesFor, rulesToQuery, ruleToAST, rulesToFields accepts only subject type now!


    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]


    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

  • v5.1.0-next.1 Changes

    August 20, 2020

    5.1.0-next.1 (2020-08-20)

    ๐Ÿ”‹ Features

    • esm: adds ESM support for latest Node.js through exports prop in package.json (cac2506), closes #331
    • extra: adds rulesToAST that converts rules into @ucast AST (55fd6ee), closes #350
  • v5.0.1-next.1 Changes

    August 11, 2020

    5.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, 2020

    5.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

    • ability: stores ast property in Rule if conditionsMatcher has ast (53e5e28), closes #350


    ๐Ÿ“ฆ package: replaces siftjs with @ucast/mongo2js. This changed MongoQuery type and buildMongoQueryMatcher function parameters. Influences users who implemented custom sift operators:

    • MongoQuery accepted a generic type of AdditionalOperators, now it accepts an object interface and custom operators
    • MongoQueryOperators is renamed to MongoQueryFieldOperators and now accepts Value generic parameter
    • buildMongoQuery now accepts 3 optional parameters: custom parsing instruction, custom operator interpreters and options for JavaScript interpreters
    • Ability 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 custom equal function


    import { MongoQuery, MongoQueryOperators, buildMongoQueryMatcher } from '@casl/ability';import { $nor } from 'sift';type CustomMongoQuery = MongoQuery\<{$customOperator: Function}\>;type $eq = MongoQueryOperators['$eq'];const matcher = buildMongoQueryMatcher({ $nor })


    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, use detectSubjectType instead

    ๐Ÿšš LegacyClaimRawRule and LegacySubjectRawRule are both removed, so you are no longer allowed to use actions in rule definition, use action property instead

    Ability throws an error if you specify a rule with property field to be an empty array

    Ability 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

    4.1.6 (2020-09-06)

    ๐Ÿ› Bug Fixes

    • ability: ensure default field matcher can match fields with partial patterns inside (362f49f), closes #388
    • ability: removes sift specific types from casl (9f18b31)
    • angular: fixes sourcemap generation for the code built by ngc (7715263), closes #387 #382
  • v4.1.5 Changes

    September 03, 2020

    4.1.5 (2020-09-03)

    ๐Ÿ› Bug Fixes

    • angular: fixes sourcemap generation for the code built by ngc (7715263), closes #387 #382
  • v3.4.0 Changes

    December 22, 2019

    @casl/ability-v3.4.0 (2019-12-22)

    ๐Ÿ”‹ Features

    • ability: adds possibility to specify custom error messages (#245) (4b48562), closes #241
  • 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

    • ability: uses CSP build of sift.js (f238813), closes #234
  • v3.2.0 Changes

    July 28, 2019

    @casl/ability-v3.2.0 (2019-07-28)

    ๐Ÿ”‹ Features

    • ability: adds support for field patterns in rules (#213) (55ad2db), closes #194
  • 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)