Skip to content

Latest commit

 

History

History
382 lines (212 loc) · 14.4 KB

CHANGELOG.md

File metadata and controls

382 lines (212 loc) · 14.4 KB

Change Log

All notable changes to this project will be documented in this file.

2.2.2 (2024-02-14)

Bug Fixes

  • fixes type for ABILITY_TOKEN in casl-vue (#879) (886aeb3)

2.2.1 (2022-12-17)

Bug Fixes

  • handles vue props aliases using "undefined" instead of "in" (#712) (3d85baa)

2.2.0 (2022-08-28)

Features

  • exports types to support TS ES6 modules (c818b1a), closes #668

2.1.3 (2022-07-25)

Bug Fixes

  • package: add repository directory into package.json for all @casl/* packages (#560) (0ef534c)

2.1.2 (2021-10-07)

Bug Fixes

  • vue: makes sure Abilities can and cannot methods are bound (86f9157), closes #530

2.1.1 (2021-07-05)

Bug Fixes

  • vue: binds ability to $can method (cbb3c13), closes #522

2.1.0 (2021-05-12)

Bug Fixes

  • adjusts package tags to improve discoverability (73e88b0)

2.0.2 (2021-01-25)

2.0.1 (2021-01-23)

2.0.0 (2021-01-22)

Code Refactoring

BREAKING CHANGES

  • vue: refactor to use Vue 3 what introduces a bunch of breaking changes:

    • Ability instance is not a required plugin parameter. Previously, we could decide whether to pass ability as plugin parameter or as root component option. Now, the only way is to pass it in plugin:

      Before

      import { abilitiesPlugin } from '@casl/vue';
      import Vue from 'vue';
      import { ability } from './services/AppAbility';
      
      Vue.use(abilitiesPlugin);
      new Vue({
        ability
      }).$mount('#app')

      After

      import { abilitiesPlugin } from '@casl/vue';
      import { createApp } from 'vue';
      import { ability } from './services/AppAbility';
      
      createApp()
       .use(abilitiesPlugin, ability)
       .mount('#app');
    • abilitiesPlugin no more define global $ability and $can properties, instead a recommended way to get AppAbility instance is by injecting it through provide/inject API. To get previous behavior, pass useGlobalProperties: true option:

      Before

      import { abilitiesPlugin } from '@casl/vue';
      import Vue from 'vue';
      import { ability } from './services/AppAbility';
      
      Vue.use(abilitiesPlugin);
      const root = new Vue({
        ability
      }).$mount('#app')
      
      console.log(root.$ability)

      After

      Recommended way:

      import { abilitiesPlugin, ABILITY_TOKEN } from '@casl/vue';
      import { createApp } from 'vue';
      import { ability } from './services/AppAbility';
      
      const App = {
        name: 'App',
        inject: {
          $ability: { from: ABILITY_TOKEN }
        }
      };
      
      const root = createApp(App)
        .use(abilitiesPlugin, ability, {
          useGlobalProperties: true
        })
        .mount('#app');
      
      console.log(root.$ability)

      Backward compatible way:

      import { abilitiesPlugin } from '@casl/vue';
      import { createApp } from 'vue';
      import { ability } from './services/AppAbility';
      
      const root = createApp()
        .use(abilitiesPlugin, ability, {
          useGlobalProperties: true
        })
        .mount('#app');
      
      console.log(root.$ability)
    • AllCanProps<TAbility> type was renamed to CanProps<TAbility>

    • @casl/vue no more augment vue types, so if you decide to use global properties, you will need to augment types by yourself

      Before

      @casl/vue augments type of $ability to AnyAbility and $can to typeof $ability['can']

      After

      create a separate file src/ability-shim.d.ts with the next content:

      import { AppAbility } from './AppAbility'
      
      declare module 'vue' {
        interface ComponentCustomProperties {
          $ability: AppAbility;
          $can(this: this, ...args: Parameters<this['$ability']['can']>): boolean;
        }
      }

1.2.1 (2020-12-28)

Bug Fixes

  • dist: adds separate tsconfig.build.json to every completementary project (87742ce), closes #419

1.2.0 (2020-12-26)

Bug Fixes

  • angular: fixes sourcemap generation for the code built by ngc (7715263), closes #387 #382
  • package: removes engine section that points to npm@6 (eecd12a), closes #417

Features

  • builder: improves typings for AbilityBuilder [skip release] (ebd4d17), closes #379
  • esm: adds ESM support for latest Node.js through exports prop in package.json (cac2506), closes #331

BREAKING CHANGES

  • builder: changes main generic parameter to be a class instead of instance and makes defineAbility to accept options as the 2nd argument.

    Before

    import { AbilityBuilder, defineAbility, Ability } from '@casl/ability';
    
    const resolveAction = (action: string) => {/* custom implementation */ };
    const ability = defineAbility({ resolveAction }, (can) => can('read', 'Item'));
    const builder = new AbilityBuilder<Ability>(Ability);

    After

    import { AbilityBuilder, defineAbility, Ability } from '@casl/ability';
    
    const resolveAction = (action: string) => {/* custom implementation */ };
    const ability = defineAbility((can) => can('read', 'Item'), { resolveAction });
    const builder = new AbilityBuilder(Ability); // first argument is now mandatory!

    The 1st parameter to AbilityBuilder is now madatory. This allows to infer generic parameters from it and makes AbilityType that is built to be explicit.

1.1.1 (2020-06-09)

Bug Fixes

  • docs: ensure README and docs for all packages are in sync (8df3684), closes #338

1.1.0 (2020-05-12)

Features

  • types: extract vue augmentation modules into pseudo submodule (a75296c), closes #312

1.0.3 (2020-04-22)

Bug Fixes

  • types: use AnyAbility in ComponentOptions and in Vue augmentation modules (7f9be6f)

1.0.2 (2020-04-10)

Bug Fixes

  • vue: ensure that terser doesn't mangle reserved required props (7fa234c)

1.0.1 (2020-04-09)

Bug Fixes

  • vue: removes of alias from <can> component (bd658e2)

1.0.0 (2020-04-09)

Bug Fixes

  • vue: adds an alias, so types are compatible between React and Vue (8276942), closes #248

Features

  • ability: updates typings for vue (8ac4ca1), closes #256
  • vue: adds better generics typying for Vue (5cc7b60), closes #107
  • vue: migrates vue to typescript (7bacadd), closes #248
  • vue: throws exception if Ability is not provided (aacd952), closes #248

BREAKING CHANGES

  • typescript: weak hand written declaration files are removed as @casl/vue has been completely rewritten to TypeScript. TypeScript now checks that you correctly use property aliases

  • Can: of alias is removed and field was extracted to a separate prop

    Before

    <can I="read title" of="Post">...</can>

    After

    <can I="read" a="Post" field="title">...</can>

@casl/vue-v0.5.1 (2019-02-10)

Bug Fixes

@casl/vue-v0.5.0 (2018-11-25)

Bug Fixes

  • README: changes links to @casl/ability to point to npm package instead to git root [skip ci] (a74086b), closes #102

Features

  • react:can: updates typescript declarations (213dcde)
  • vue: adds passThrough prop to Can (28ca883), closes #105

@casl/vue-v0.4.3 (2018-07-14)

Bug Fixes

  • vue: fixes ts declaration for abilitiesPlugin (7d8e9ca), closes #92

@casl/vue-v0.4.2 (2018-07-02)

Bug Fixes

  • package: changes location of ES5M modules (2b1ad4e), closes #89

@casl/vue-v0.4.1 (2018-06-04)

Bug Fixes

  • vue: extends ComponentOptions with ability member (#73) (94d4c24)

@casl/vue-v0.4.0 (2018-06-01)

Features

  • vue: pass ability down components tree (28e3d8d), closes #72

@casl/vue-v0.3.0 (2018-05-30)

Features

@casl/vue-v0.2.1 (2018-05-29)

Bug Fixes

  • vue: fixes issue with wrong type definition for abilitiesPlugin (a7e2251)

0.2.0 (2018-04-16)

Features

  • vue: adds typescript definitions (a7eac4b), closes #38

0.1.0 (2018-03-23)

Features

  • integration: adds new folder for vue integration, closes #22
  • vue: adds empty ability instance in case if such is not provided (a971f05)
  • ability: adds reactivity to ability rules