@casl/angular
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -5,2 +5,9 @@ # Change Log | ||
# [@casl/angular-v2.1.0](https://github.com/stalniy/casl/compare/@casl/angular@2.0.0...@casl/angular@2.1.0) (2019-07-01) | ||
### Features | ||
* **angular:** upgrades Angular and typescript ([08591f4](https://github.com/stalniy/casl/commit/08591f4)), closes [#158](https://github.com/stalniy/casl/issues/158) [#195](https://github.com/stalniy/casl/issues/195) | ||
# [@casl/angular-v2.0.0](https://github.com/stalniy/casl/compare/@casl/angular@1.0.0...@casl/angular@2.0.0) (2019-02-10) | ||
@@ -7,0 +14,0 @@ |
@@ -18,79 +18,86 @@ import { Pipe, ChangeDetectorRef, NgModule } from '@angular/core'; | ||
***************************************************************************** */ | ||
function __decorate(decorators, target, key, desc) { | ||
var c = arguments.length, | ||
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | ||
d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
var c = arguments.length, | ||
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | ||
d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) { | ||
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
} | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
} | ||
function __metadata(metadataKey, metadataValue) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | ||
} | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
var noop = function noop() {}; | ||
var ɵ0 = noop; // TODO: `pure` can be removed after https://github.com/angular/angular/issues/15041 | ||
var CanPipe = | ||
/*#__PURE__*/ | ||
function () { | ||
function CanPipe(ability, cd) { | ||
this.ability = ability; | ||
this.cd = cd; | ||
this.unsubscribeFromAbility = noop; | ||
} | ||
}; | ||
var noop = function noop() {}; | ||
var ɵ0 = noop; | ||
// TODO: `pure` can be removed after https://github.com/angular/angular/issues/15041 | ||
var CanPipe = function () { | ||
function CanPipe(ability, cd) { | ||
classCallCheck(this, CanPipe); | ||
var _proto = CanPipe.prototype; | ||
this.ability = ability; | ||
this.cd = cd; | ||
this.unsubscribeFromAbility = noop; | ||
_proto.transform = function transform(resource, action, field) { | ||
var _this = this; | ||
if (this.unsubscribeFromAbility === noop) { | ||
this.unsubscribeFromAbility = this.ability.on('updated', function () { | ||
return _this.cd.markForCheck(); | ||
}); | ||
} | ||
CanPipe.prototype.transform = function transform(resource, action, field) { | ||
var _this = this; | ||
return this.can(action, resource, field); | ||
}; | ||
if (this.unsubscribeFromAbility === noop) { | ||
this.unsubscribeFromAbility = this.ability.on('updated', function () { | ||
return _this.cd.markForCheck(); | ||
}); | ||
} | ||
return this.can(action, resource, field); | ||
}; | ||
_proto.can = function can(action, subject, field) { | ||
return this.ability.can(action, subject, field); | ||
}; | ||
CanPipe.prototype.can = function can(action, subject, field) { | ||
return this.ability.can(action, subject, field); | ||
}; | ||
_proto.ngOnDestroy = function ngOnDestroy() { | ||
this.unsubscribeFromAbility(); | ||
}; | ||
CanPipe.prototype.ngOnDestroy = function ngOnDestroy() { | ||
this.unsubscribeFromAbility(); | ||
}; | ||
return CanPipe; | ||
return CanPipe; | ||
}(); | ||
CanPipe = __decorate([Pipe({ name: 'can', pure: false }), __metadata("design:paramtypes", [Ability, ChangeDetectorRef])], CanPipe); | ||
CanPipe = __decorate([Pipe({ | ||
name: 'can', | ||
pure: false | ||
}), __metadata("design:paramtypes", [Ability, ChangeDetectorRef])], CanPipe); | ||
var AbilityModule_1; | ||
function createAbility() { | ||
return new Ability([]); | ||
return new Ability([]); | ||
} | ||
var AbilityModule = AbilityModule_1 = function () { | ||
function AbilityModule() { | ||
classCallCheck(this, AbilityModule); | ||
} | ||
AbilityModule.forRoot = function forRoot() { | ||
return { | ||
ngModule: AbilityModule_1, | ||
providers: [{ provide: Ability, useFactory: createAbility }] | ||
}; | ||
var AbilityModule = AbilityModule_1 = | ||
/*#__PURE__*/ | ||
function () { | ||
function AbilityModule() {} | ||
AbilityModule.forRoot = function forRoot() { | ||
return { | ||
ngModule: AbilityModule_1, | ||
providers: [{ | ||
provide: Ability, | ||
useFactory: createAbility | ||
}] | ||
}; | ||
}; | ||
return AbilityModule; | ||
return AbilityModule; | ||
}(); | ||
AbilityModule = AbilityModule_1 = __decorate([NgModule({ | ||
declarations: [CanPipe], | ||
exports: [CanPipe] | ||
declarations: [CanPipe], | ||
exports: [CanPipe] | ||
})], AbilityModule); | ||
export { CanPipe, ɵ0, createAbility, AbilityModule }; | ||
export { AbilityModule, CanPipe, createAbility, ɵ0 }; |
@@ -18,56 +18,67 @@ import { Pipe, ChangeDetectorRef, NgModule } from '@angular/core'; | ||
***************************************************************************** */ | ||
function __decorate(decorators, target, key, desc) { | ||
var c = arguments.length, | ||
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | ||
d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
var c = arguments.length, | ||
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, | ||
d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
} | ||
function __metadata(metadataKey, metadataValue) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); | ||
} | ||
const noop = () => {}; | ||
const ɵ0 = noop; | ||
// TODO: `pure` can be removed after https://github.com/angular/angular/issues/15041 | ||
const ɵ0 = noop; // TODO: `pure` can be removed after https://github.com/angular/angular/issues/15041 | ||
let CanPipe = class CanPipe { | ||
constructor(ability, cd) { | ||
this.ability = ability; | ||
this.cd = cd; | ||
this.unsubscribeFromAbility = noop; | ||
constructor(ability, cd) { | ||
this.ability = ability; | ||
this.cd = cd; | ||
this.unsubscribeFromAbility = noop; | ||
} | ||
transform(resource, action, field) { | ||
if (this.unsubscribeFromAbility === noop) { | ||
this.unsubscribeFromAbility = this.ability.on('updated', () => this.cd.markForCheck()); | ||
} | ||
transform(resource, action, field) { | ||
if (this.unsubscribeFromAbility === noop) { | ||
this.unsubscribeFromAbility = this.ability.on('updated', () => this.cd.markForCheck()); | ||
} | ||
return this.can(action, resource, field); | ||
} | ||
can(action, subject, field) { | ||
return this.ability.can(action, subject, field); | ||
} | ||
ngOnDestroy() { | ||
this.unsubscribeFromAbility(); | ||
} | ||
return this.can(action, resource, field); | ||
} | ||
can(action, subject, field) { | ||
return this.ability.can(action, subject, field); | ||
} | ||
ngOnDestroy() { | ||
this.unsubscribeFromAbility(); | ||
} | ||
}; | ||
CanPipe = __decorate([Pipe({ name: 'can', pure: false }), __metadata("design:paramtypes", [Ability, ChangeDetectorRef])], CanPipe); | ||
CanPipe = __decorate([Pipe({ | ||
name: 'can', | ||
pure: false | ||
}), __metadata("design:paramtypes", [Ability, ChangeDetectorRef])], CanPipe); | ||
var AbilityModule_1; | ||
function createAbility() { | ||
return new Ability([]); | ||
return new Ability([]); | ||
} | ||
let AbilityModule = AbilityModule_1 = class AbilityModule { | ||
static forRoot() { | ||
return { | ||
ngModule: AbilityModule_1, | ||
providers: [{ provide: Ability, useFactory: createAbility }] | ||
}; | ||
} | ||
static forRoot() { | ||
return { | ||
ngModule: AbilityModule_1, | ||
providers: [{ | ||
provide: Ability, | ||
useFactory: createAbility | ||
}] | ||
}; | ||
} | ||
}; | ||
AbilityModule = AbilityModule_1 = __decorate([NgModule({ | ||
declarations: [CanPipe], | ||
exports: [CanPipe] | ||
declarations: [CanPipe], | ||
exports: [CanPipe] | ||
})], AbilityModule); | ||
export { CanPipe, ɵ0, createAbility, AbilityModule }; | ||
export { AbilityModule, CanPipe, createAbility, ɵ0 }; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@casl/ability")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@casl/ability"],t):t(((e=e||self).casl=e.casl||{},e.casl.ng={}),e.ng.core,e.casl)}(this,function(e,t,i){"use strict";function n(e,t,i,n){var o,r=arguments.length,c=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;0<=a;a--)(o=e[a])&&(c=(r<3?o(c):3<r?o(t,i,c):o(t,i))||c);return 3<r&&c&&Object.defineProperty(t,i,c),c}var o,r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},c=function(){},a=c;function u(){return new i.Ability([])}e.CanPipe=function(){function i(e,t){r(this,i),this.ability=e,this.cd=t,this.unsubscribeFromAbility=c}return i.prototype.transform=function(e,t,i){var n=this;return this.unsubscribeFromAbility===c&&(this.unsubscribeFromAbility=this.ability.on("updated",function(){return n.cd.markForCheck()})),this.can(t,e,i)},i.prototype.can=function(e,t,i){return this.ability.can(e,t,i)},i.prototype.ngOnDestroy=function(){this.unsubscribeFromAbility()},i}(),e.CanPipe=n([t.Pipe({name:"can",pure:!1}),function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}("design:paramtypes",[i.Ability,t.ChangeDetectorRef])],e.CanPipe),e.AbilityModule=o=function(){function e(){r(this,e)}return e.forRoot=function(){return{ngModule:o,providers:[{provide:i.Ability,useFactory:u}]}},e}(),e.AbilityModule=o=n([t.NgModule({declarations:[e.CanPipe],exports:[e.CanPipe]})],e.AbilityModule),e.ɵ0=a,e.createAbility=u,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@casl/ability")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@casl/ability"],t):t(((e=e||self).casl=e.casl||{},e.casl.ng={}),e.ng.core,e.casl)}(this,function(e,t,i){"use strict";function n(e,t,i,n){var r,o=arguments.length,c=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,i,n);else for(var u=e.length-1;0<=u;u--)(r=e[u])&&(c=(o<3?r(c):3<o?r(t,i,c):r(t,i))||c);return 3<o&&c&&Object.defineProperty(t,i,c),c}function r(){}var o,c=r;function u(){return new i.Ability([])}e.CanPipe=function(){function e(e,t){this.ability=e,this.cd=t,this.unsubscribeFromAbility=r}var t=e.prototype;return t.transform=function(e,t,i){var n=this;return this.unsubscribeFromAbility===r&&(this.unsubscribeFromAbility=this.ability.on("updated",function(){return n.cd.markForCheck()})),this.can(t,e,i)},t.can=function(e,t,i){return this.ability.can(e,t,i)},t.ngOnDestroy=function(){this.unsubscribeFromAbility()},e}(),e.CanPipe=n([t.Pipe({name:"can",pure:!1}),function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}("design:paramtypes",[i.Ability,t.ChangeDetectorRef])],e.CanPipe),e.AbilityModule=o=function(){function e(){}return e.forRoot=function(){return{ngModule:o,providers:[{provide:i.Ability,useFactory:u}]}},e}(),e.AbilityModule=o=n([t.NgModule({declarations:[e.CanPipe],exports:[e.CanPipe]})],e.AbilityModule),e.createAbility=u,e.ɵ0=c,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "@casl/angular", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Angular module for CASL which makes it easy to add permissions in any Angular application", | ||
@@ -45,18 +45,19 @@ "main": "dist/umd/index.js", | ||
"peerDependencies": { | ||
"@angular/core": "^2.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0", | ||
"@angular/core": "^2.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", | ||
"@casl/ability": "^2.0.0 || ^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@angular/common": "^7.0.0", | ||
"@angular/compiler": "^7.0.3", | ||
"@angular/compiler-cli": "^7.0.3", | ||
"@angular/core": "^7.0.0", | ||
"@angular/platform-browser": "^7.0.0", | ||
"@angular/platform-browser-dynamic": "^7.0.0", | ||
"@casl/ability": "^2.0.0", | ||
"@abraham/reflection": "^0.5.1", | ||
"@angular/common": "^8.0.0", | ||
"@angular/compiler": "^8.0.0", | ||
"@angular/compiler-cli": "^8.0.0", | ||
"@angular/core": "^8.0.0", | ||
"@angular/platform-browser": "^8.0.0", | ||
"@angular/platform-browser-dynamic": "^8.0.0", | ||
"@casl/ability": "^3.0.0", | ||
"jest-zone-patch": "0.0.10", | ||
"rxjs": "^6.0.0", | ||
"rxjs-compat": "^6.0.0", | ||
"zone.js": "^0.8.20" | ||
"zone.js": "^0.9.0" | ||
} | ||
} |
182
22994
12