@casl/angular 5.1.3 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,36 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ # [6.0.0](https://github.com/stalniy/casl/compare/@casl/angular@5.1.2...@casl/angular@6.0.0) (2021-05-31)
6
+
7
+
8
+ ### Code Refactoring
9
+
10
+ * **angular:** removes deprecated CanPipe and stick to Ivy compiler ([82b61f5](https://github.com/stalniy/casl/commit/82b61f5e46dc3c031aef42ae499eca25f2698fdb))
11
+
12
+
13
+ ### BREAKING CHANGES
14
+
15
+ * **angular:** there are few important changes:
16
+
17
+ * deprecated `CanPipe` was removed, use `AblePipe` instead
18
+ * library is compiled by Ivy and no longer support ViewEngine
19
+
20
+ ## [5.1.2](https://github.com/stalniy/casl/compare/@casl/angular@5.1.1...@casl/angular@5.1.2) (2021-05-31)
21
+
22
+
23
+ ### chore
24
+
25
+ * **deps:** updates angular to v12 ([#516](https://github.com/stalniy/casl/issues/516)) ([ff4212c](https://github.com/stalniy/casl/commit/ff4212c7f32f1fbc8a73e6b3a6615af65991e39a)), closes [#514](https://github.com/stalniy/casl/issues/514) [#512](https://github.com/stalniy/casl/issues/512)
26
+
27
+
28
+ ### BREAKING CHANGES
29
+
30
+ * **deps:** there are 2 important changes:
31
+
32
+ * deprecated CanPipe was removed, use AblePipe instead
33
+ * library is compiled by Ivy and no longer support ViewEngine
34
+
5
35
  ## [5.1.1](https://github.com/stalniy/casl/compare/@casl/angular@5.1.0...@casl/angular@5.1.1) (2021-05-12)
6
36
 
7
37
 
package/README.md CHANGED
@@ -4,10 +4,12 @@
4
4
  [![](https://img.shields.io/npm/dm/%40casl%2Fangular.svg)](https://www.npmjs.com/package/%40casl%2Fangular)
5
5
  [![CASL Join the chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/stalniy-casl/casl)
6
6
 
7
- This package allows to integrate `@casl/ability` with [Angular] application. It provides `AblePipe` and **deprecated** `CanPipe` to Angular templates, so you can show or hide components, buttons, etc based on user ability to see them.
7
+ This package allows to integrate `@casl/ability` with [Angular] application. It provides `AblePipe` and `AblePurePipe` to Angular templates, so you can show or hide components, buttons, etc based on user ability to see them.
8
8
 
9
9
  ## Installation
10
10
 
11
+ The latest version of this package is compiled by Ivy, so **apps that do not use Ivy are no longer supported.**
12
+
11
13
  ```sh
12
14
  npm install @casl/angular @casl/ability
13
15
  # or
@@ -39,7 +41,7 @@ import { Ability, PureAbility } from '@casl/ability';
39
41
  export class AppModule {}
40
42
  ```
41
43
 
42
- The 2nd provider provides instance of `PureAbility`, so `CanPipe` and `AblePipe` can inject it later. This pipes inject `PureAbility` (not `Ability`) because this allows an application developer to decide how to configure actions, subjects and conditions. Also this is the only way to get maximum from tree shaking (e.g., if you don't need conditions you can use `PureAbility` and get rid of `sift` library).
44
+ The 2nd provider provides instance of `PureAbility`, so pipes can inject it later. This pipes inject `PureAbility` (not `Ability`) because this allows an application developer to decide how to configure actions, subjects and conditions. Also this is the only way to get maximum from tree shaking (e.g., if you don't need conditions you can use `PureAbility` and shrink @casl/ability size).
43
45
 
44
46
  > Read [CASL and TypeScript](https://casl.js.org/v5/en/advanced/typescript) to get more details about `Ability` type configuration.
45
47
 
@@ -131,16 +133,6 @@ To check permissions in any template you can use `AblePipe`:
131
133
 
132
134
  > You can read the expression in `ngIf` as "if creatable Post"
133
135
 
134
- Or with **deprecated** `CanPipe`:
135
-
136
- ```html
137
- <div *ngIf="'Post' | can: 'create'">
138
- <a (click)="createPost()">Add Post</a>
139
- </div>
140
- ```
141
-
142
- `CanPipe` was deprecated because it is less readable and it was harder to integrate it with all type definitions supported by `Ability`'s `can` method. That's why `CanPipe` has weaker typings than `AblePipe`.
143
-
144
136
  ## Why pipe and not directive?
145
137
 
146
138
  Directive cannot be used to pass values into inputs of other components. For example, we need to enable or disable a button based on user's ability to create a post. With directive we cannot do this but we can do this with pipe:
@@ -180,7 +172,7 @@ For apps that mutate application state, we need to use impure `able` pipe as it
180
172
 
181
173
  ## TypeScript support
182
174
 
183
- The package is written in TypeScript, so it will warn you about wrong usage.
175
+ This package is written in TypeScript, so it will warn you about wrong usage.
184
176
 
185
177
  It may be a bit tedious to use application specific abilities in Angular app because everywhere you inject `Ability` instance you will need to import its generic parameters:
186
178
 
@@ -1,53 +1,11 @@
1
- import { Pipe, Inject, ChangeDetectorRef, NgModule } from '@angular/core';
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, Inject, NgModule } from '@angular/core';
2
3
  import { PureAbility } from '@casl/ability';
3
4
  import { Observable } from 'rxjs';
4
5
 
5
- var AbilityPipe = /** @class */ (function () {
6
- function AbilityPipe(ability, cd) {
7
- this._ability = ability;
8
- this._cd = cd;
9
- }
10
- AbilityPipe.prototype.transform = function () {
11
- var _a;
12
- var _this = this;
13
- var args = [];
14
- for (var _i = 0; _i < arguments.length; _i++) {
15
- args[_i] = arguments[_i];
16
- }
17
- if (!this._unsubscribeFromAbility) {
18
- this._unsubscribeFromAbility = this._ability.on('updated', function () { return _this._cd.markForCheck(); });
19
- }
20
- return (_a = this._ability).can.apply(_a, args);
21
- };
22
- AbilityPipe.prototype.ngOnDestroy = function () {
23
- if (this._unsubscribeFromAbility) {
24
- this._unsubscribeFromAbility();
25
- }
26
- };
27
- return AbilityPipe;
28
- }());
29
- var CanPipe = /** @class */ (function () {
30
- function CanPipe(ability, cd) {
31
- this.pipe = new AbilityPipe(ability, cd);
32
- }
33
- CanPipe.prototype.transform = function (subject, action, field) {
34
- return this.pipe.transform(action, subject, field);
35
- };
36
- CanPipe.prototype.ngOnDestroy = function () {
37
- this.pipe.ngOnDestroy();
38
- };
39
- CanPipe.decorators = [
40
- { type: Pipe, args: [{ name: 'can', pure: false },] }
41
- ];
42
- CanPipe.ctorParameters = function () { return [
43
- { type: undefined, decorators: [{ type: Inject, args: [PureAbility,] }] },
44
- { type: ChangeDetectorRef }
45
- ]; };
46
- return CanPipe;
47
- }());
48
6
  var AblePipe = /** @class */ (function () {
49
- function AblePipe(ability, cd) {
50
- this.pipe = new AbilityPipe(ability, cd);
7
+ function AblePipe(ability) {
8
+ this._ability = ability;
51
9
  }
52
10
  AblePipe.prototype.transform = function () {
53
11
  var _a;
@@ -55,20 +13,19 @@ var AblePipe = /** @class */ (function () {
55
13
  for (var _i = 0; _i < arguments.length; _i++) {
56
14
  args[_i] = arguments[_i];
57
15
  }
58
- return (_a = this.pipe).transform.apply(_a, args);
59
- };
60
- AblePipe.prototype.ngOnDestroy = function () {
61
- this.pipe.ngOnDestroy();
16
+ return (_a = this._ability).can.apply(_a, args);
62
17
  };
63
- AblePipe.decorators = [
64
- { type: Pipe, args: [{ name: 'able', pure: false },] }
65
- ];
66
- AblePipe.ctorParameters = function () { return [
67
- { type: undefined, decorators: [{ type: Inject, args: [PureAbility,] }] },
68
- { type: ChangeDetectorRef }
69
- ]; };
18
+ AblePipe.ɵfac = function AblePipe_Factory(t) { return new (t || AblePipe)(i0.ɵɵdirectiveInject(PureAbility, 16)); };
19
+ AblePipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "able", type: AblePipe, pure: false });
70
20
  return AblePipe;
71
21
  }());
22
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AblePipe, [{
23
+ type: Pipe,
24
+ args: [{ name: 'able', pure: false }]
25
+ }], function () { return [{ type: undefined, decorators: [{
26
+ type: Inject,
27
+ args: [PureAbility]
28
+ }] }]; }, null); })();
72
29
  var AblePurePipe = /** @class */ (function () {
73
30
  function AblePurePipe(ability) {
74
31
  this._ability = ability;
@@ -89,34 +46,42 @@ var AblePurePipe = /** @class */ (function () {
89
46
  return _this._ability.on('updated', emit);
90
47
  });
91
48
  };
92
- AblePurePipe.decorators = [
93
- { type: Pipe, args: [{ name: 'ablePure' },] }
94
- ];
95
- AblePurePipe.ctorParameters = function () { return [
96
- { type: undefined, decorators: [{ type: Inject, args: [PureAbility,] }] }
97
- ]; };
49
+ AblePurePipe.ɵfac = function AblePurePipe_Factory(t) { return new (t || AblePurePipe)(i0.ɵɵdirectiveInject(PureAbility, 16)); };
50
+ AblePurePipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ablePure", type: AblePurePipe, pure: true });
98
51
  return AblePurePipe;
99
52
  }());
53
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AblePurePipe, [{
54
+ type: Pipe,
55
+ args: [{ name: 'ablePure' }]
56
+ }], function () { return [{ type: undefined, decorators: [{
57
+ type: Inject,
58
+ args: [PureAbility]
59
+ }] }]; }, null); })();
100
60
 
101
61
  var AbilityModule = /** @class */ (function () {
102
62
  function AbilityModule() {
103
63
  }
104
- AbilityModule.decorators = [
105
- { type: NgModule, args: [{
106
- declarations: [
107
- CanPipe,
108
- AblePipe,
109
- AblePurePipe,
110
- ],
111
- exports: [
112
- CanPipe,
113
- AblePipe,
114
- AblePurePipe,
115
- ],
116
- },] }
117
- ];
64
+ AbilityModule.ɵfac = function AbilityModule_Factory(t) { return new (t || AbilityModule)(); };
65
+ AbilityModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AbilityModule });
66
+ AbilityModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
118
67
  return AbilityModule;
119
68
  }());
69
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AbilityModule, [{
70
+ type: NgModule,
71
+ args: [{
72
+ declarations: [
73
+ AblePipe,
74
+ AblePurePipe,
75
+ ],
76
+ exports: [
77
+ AblePipe,
78
+ AblePurePipe,
79
+ ],
80
+ }]
81
+ }], null, null); })();
82
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AbilityModule, { declarations: [AblePipe,
83
+ AblePurePipe], exports: [AblePipe,
84
+ AblePurePipe] }); })();
120
85
 
121
- export { AbilityModule, AblePipe, AblePurePipe, CanPipe };
86
+ export { AbilityModule, AblePipe, AblePurePipe };
122
87
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/pipes.ts","../../src/AbilityModule.ts"],"sourcesContent":["import { Pipe, ChangeDetectorRef, Inject, PipeTransform } from '@angular/core';\nimport { PureAbility, Unsubscribe, AnyAbility } from '@casl/ability';\nimport { Observable } from 'rxjs';\n\nclass AbilityPipe<T extends AnyAbility> {\n protected _unsubscribeFromAbility?: Unsubscribe;\n private _ability: T;\n private _cd: ChangeDetectorRef;\n\n constructor(ability: T, cd: ChangeDetectorRef) {\n this._ability = ability;\n this._cd = cd;\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n if (!this._unsubscribeFromAbility) {\n this._unsubscribeFromAbility = this._ability.on('updated', () => this._cd.markForCheck());\n }\n return this._ability.can(...args);\n }\n\n ngOnDestroy() {\n if (this._unsubscribeFromAbility) {\n this._unsubscribeFromAbility();\n }\n }\n}\n\n@Pipe({ name: 'can', pure: false })\nexport class CanPipe<T extends AnyAbility> implements PipeTransform {\n protected pipe: AbilityPipe<T>;\n\n constructor(@Inject(PureAbility) ability: T, cd: ChangeDetectorRef) {\n this.pipe = new AbilityPipe(ability, cd);\n }\n\n transform(\n subject: Parameters<T['can']>[1],\n action: Parameters<T['can']>[0],\n field?: string\n ): boolean {\n return (this.pipe as any).transform(action, subject, field);\n }\n\n ngOnDestroy() {\n this.pipe.ngOnDestroy();\n }\n}\n\n@Pipe({ name: 'able', pure: false })\nexport class AblePipe<T extends AnyAbility> implements PipeTransform {\n protected pipe: AbilityPipe<T>;\n\n constructor(@Inject(PureAbility) ability: T, cd: ChangeDetectorRef) {\n this.pipe = new AbilityPipe(ability, cd);\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n return this.pipe.transform(...args);\n }\n\n ngOnDestroy() {\n this.pipe.ngOnDestroy();\n }\n}\n\n@Pipe({ name: 'ablePure' })\nexport class AblePurePipe<T extends AnyAbility> implements PipeTransform {\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n // TODO: `Observable` can be removed after https://github.com/angular/angular/issues/15041\n transform(...args: Parameters<T['can']>): Observable<boolean> {\n return new Observable((s) => {\n const emit = () => s.next(this._ability.can(...args));\n emit();\n return this._ability.on('updated', emit);\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CanPipe, AblePipe, AblePurePipe } from './pipes';\n\n@NgModule({\n declarations: [\n CanPipe,\n AblePipe,\n AblePurePipe,\n ],\n exports: [\n CanPipe,\n AblePipe,\n AblePurePipe,\n ],\n})\nexport class AbilityModule {\n}\n"],"names":[],"mappings":";;;;AAIA;IAKE,qBAAY,OAAU,EAAE,EAAqB;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;KACf;IAED,+BAAS,GAAT;;QAAA,iBAKC;QALS,cAA6B;aAA7B,UAA6B,EAA7B,qBAA6B,EAA7B,IAA6B;YAA7B,yBAA6B;;QACrC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;YACjC,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,cAAM,OAAA,KAAI,CAAC,GAAG,CAAC,YAAY,EAAE,GAAA,CAAC,CAAC;SAC3F;QACD,OAAO,CAAA,KAAA,IAAI,CAAC,QAAQ,EAAC,GAAG,WAAI,IAAI,EAAE;KACnC;IAED,iCAAW,GAAX;QACE,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAChC,IAAI,CAAC,uBAAuB,EAAE,CAAC;SAChC;KACF;IACH,kBAAC;AAAD,CAAC,IAAA;;IAMC,iBAAiC,OAAU,EAAE,EAAqB;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;KAC1C;IAED,2BAAS,GAAT,UACE,OAAgC,E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AAC;YACP,OAAO,KAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAC1C,CAAC,CAAC;KACJ;;gBAfF,IAAI,SAAC,EAAE,IAAI,EAAE,UAAU,EAAE;;;gDAIX,MAAM,SAAC,WAAW;;IAYjC,mBAAC;CAhBD;;;IC/DA;KAaC;;gBAbA,QAAQ,SAAC;oBACR,YAAY,EAAE;wBACZ,OAAO;wBACP,QAAQ;wBACR,YAAY;qBACb;oBACD,OAAO,EAAE;wBACP,OAAO;wBACP,QAAQ;wBACR,YAAY;qBACb;iBACF;;IAED,oBAAC;CAbD;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/pipes.ts","../../src/AbilityModule.ts"],"sourcesContent":["import { Pipe, Inject, PipeTransform } from '@angular/core';\nimport { PureAbility, Unsubscribe, AnyAbility } from '@casl/ability';\nimport { Observable } from 'rxjs';\n\n@Pipe({ name: 'able', pure: false })\nexport class AblePipe<T extends AnyAbility> implements PipeTransform {\n protected _unsubscribeFromAbility?: Unsubscribe;\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n return this._ability.can(...args);\n }\n}\n\n@Pipe({ name: 'ablePure' })\nexport class AblePurePipe<T extends AnyAbility> implements PipeTransform {\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n // TODO: `Observable` can be removed after https://github.com/angular/angular/issues/15041\n transform(...args: Parameters<T['can']>): Observable<boolean> {\n return new Observable((s) => {\n const emit = () => s.next(this._ability.can(...args));\n emit();\n return this._ability.on('updated', emit);\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { AblePipe, AblePurePipe } from './pipes';\n\n@NgModule({\n declarations: [\n AblePipe,\n AblePurePipe,\n ],\n exports: [\n AblePipe,\n AblePurePipe,\n ],\n})\nexport class AbilityModule {\n}\n"],"names":[],"mappings":";;;;;;IASE,kBAAi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R,YAAY;iBACb;aACF;;wFACY,aAAa,mBARtB,QAAQ;QACR,YAAY,aAGZ,QAAQ;QACR,YAAY;;;;"}
@@ -0,0 +1,69 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, Inject, NgModule } from '@angular/core';
3
+ import { PureAbility } from '@casl/ability';
4
+ import { Observable } from 'rxjs';
5
+
6
+ class AblePipe {
7
+ constructor(ability) {
8
+ this._ability = ability;
9
+ }
10
+ transform(...args) {
11
+ return this._ability.can(...args);
12
+ }
13
+ }
14
+ AblePipe.ɵfac = function AblePipe_Factory(t) { return new (t || AblePipe)(i0.ɵɵdirectiveInject(PureAbility, 16)); };
15
+ AblePipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "able", type: AblePipe, pure: false });
16
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AblePipe, [{
17
+ type: Pipe,
18
+ args: [{ name: 'able', pure: false }]
19
+ }], function () { return [{ type: undefined, decorators: [{
20
+ type: Inject,
21
+ args: [PureAbility]
22
+ }] }]; }, null); })();
23
+ class AblePurePipe {
24
+ constructor(ability) {
25
+ this._ability = ability;
26
+ }
27
+ // TODO: `Observable` can be removed after https://github.com/angular/angular/issues/15041
28
+ transform(...args) {
29
+ return new Observable((s) => {
30
+ const emit = () => s.next(this._ability.can(...args));
31
+ emit();
32
+ return this._ability.on('updated', emit);
33
+ });
34
+ }
35
+ }
36
+ AblePurePipe.ɵfac = function AblePurePipe_Factory(t) { return new (t || AblePurePipe)(i0.ɵɵdirectiveInject(PureAbility, 16)); };
37
+ AblePurePipe.ɵpipe = /*@__PURE__*/ i0.ɵɵdefinePipe({ name: "ablePure", type: AblePurePipe, pure: true });
38
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AblePurePipe, [{
39
+ type: Pipe,
40
+ args: [{ name: 'ablePure' }]
41
+ }], function () { return [{ type: undefined, decorators: [{
42
+ type: Inject,
43
+ args: [PureAbility]
44
+ }] }]; }, null); })();
45
+
46
+ class AbilityModule {
47
+ }
48
+ AbilityModule.ɵfac = function AbilityModule_Factory(t) { return new (t || AbilityModule)(); };
49
+ AbilityModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AbilityModule });
50
+ AbilityModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
51
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AbilityModule, [{
52
+ type: NgModule,
53
+ args: [{
54
+ declarations: [
55
+ AblePipe,
56
+ AblePurePipe,
57
+ ],
58
+ exports: [
59
+ AblePipe,
60
+ AblePurePipe,
61
+ ],
62
+ }]
63
+ }], null, null); })();
64
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AbilityModule, { declarations: [AblePipe,
65
+ AblePurePipe], exports: [AblePipe,
66
+ AblePurePipe] }); })();
67
+
68
+ export { AbilityModule, AblePipe, AblePurePipe };
69
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../src/pipes.ts","../../src/AbilityModule.ts"],"sourcesContent":["import { Pipe, Inject, PipeTransform } from '@angular/core';\nimport { PureAbility, Unsubscribe, AnyAbility } from '@casl/ability';\nimport { Observable } from 'rxjs';\n\n@Pipe({ name: 'able', pure: false })\nexport class AblePipe<T extends AnyAbility> implements PipeTransform {\n protected _unsubscribeFromAbility?: Unsubscribe;\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n return this._ability.can(...args);\n }\n}\n\n@Pipe({ name: 'ablePure' })\nexport class AblePurePipe<T extends AnyAbility> implements PipeTransform {\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n // TODO: `Observable` can be removed after https://github.com/angular/angular/issues/15041\n transform(...args: Parameters<T['can']>): Observable<boolean> {\n return new Observable((s) => {\n const emit = () => s.next(this._ability.can(...args));\n emit();\n return this._ability.on('updated', emit);\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { AblePipe, AblePurePipe } from './pipes';\n\n@NgModule({\n declarations: [\n AblePipe,\n AblePurePipe,\n ],\n exports: [\n AblePipe,\n AblePurePipe,\n ],\n})\nexport class AbilityModule {\n}\n"],"names":[],"mappings":";;;;;MAKa,QAAQ;IAInB,YAAiC,OAAU;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;KACzB;IAED,SAAS,CAAC,GAAG,IAA0B;QACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;KACnC;;gEAVU,QAAQ,uBAIC,WAAW;qEAJpB,QAAQ;uFAAR,QAAQ;cADpB,IAAI;eAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE;;sBAKpB,MAAM;uBAAC,WAAW;;MAUpB,YAAY;IAGvB,YAAiC,OAAU;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;KACzB;;IAGD,SAAS,CAAC,GAAG,IAA0B;QACrC,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC;YACtB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;YACtD,IAAI,EAAE,CAAC;YACP,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAC1C,CAAC,CAAC;KACJ;;wEAdU,YAAY,uBAGH,WAAW;6EAHpB,YAAY;uFAAZ,YAAY;cADxB,IAAI;eAAC,EAAE,IAAI,EAAE,UAAU,EAAE;;sBAIX,MAAM;uBAAC,WAAW;;;MCTpB,aAAa;;0EAAb,aAAa;+DAAb,aAAa;;uFAAb,aAAa;cAVzB,QAAQ;eAAC;gBACR,YAAY,EAAE;oBACZ,QAAQ;oBACR,YAAY;iBACb;gBACD,OAAO,EAAE;oBACP,QAAQ;oBACR,YAAY;iBACb;aACF;;wFACY,aAAa,mBARtB,QAAQ;QACR,YAAY,aAGZ,QAAQ;QACR,YAAY;;;;"}
@@ -1,2 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./pipes";
1
3
  export declare class AbilityModule {
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<AbilityModule, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AbilityModule, [typeof i1.AblePipe, typeof i1.AblePurePipe], never, [typeof i1.AblePipe, typeof i1.AblePurePipe]>;
6
+ static ɵinj: i0.ɵɵInjectorDeclaration<AbilityModule>;
2
7
  }
@@ -1,4 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@casl/angular" />
4
5
  export * from './public';
@@ -1,29 +1,19 @@
1
- import { ChangeDetectorRef, PipeTransform } from '@angular/core';
1
+ import { PipeTransform } from '@angular/core';
2
2
  import { Unsubscribe, AnyAbility } from '@casl/ability';
3
3
  import { Observable } from 'rxjs';
4
- declare class AbilityPipe<T extends AnyAbility> {
4
+ import * as i0 from "@angular/core";
5
+ export declare class AblePipe<T extends AnyAbility> implements PipeTransform {
5
6
  protected _unsubscribeFromAbility?: Unsubscribe;
6
7
  private _ability;
7
- private _cd;
8
- constructor(ability: T, cd: ChangeDetectorRef);
9
- transform(...args: Parameters<T['can']>): boolean;
10
- ngOnDestroy(): void;
11
- }
12
- export declare class CanPipe<T extends AnyAbility> implements PipeTransform {
13
- protected pipe: AbilityPipe<T>;
14
- constructor(ability: T, cd: ChangeDetectorRef);
15
- transform(subject: Parameters<T['can']>[1], action: Parameters<T['can']>[0], field?: string): boolean;
16
- ngOnDestroy(): void;
17
- }
18
- export declare class AblePipe<T extends AnyAbility> implements PipeTransform {
19
- protected pipe: AbilityPipe<T>;
20
- constructor(ability: T, cd: ChangeDetectorRef);
8
+ constructor(ability: T);
21
9
  transform(...args: Parameters<T['can']>): boolean;
22
- ngOnDestroy(): void;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<AblePipe<any>, never>;
11
+ static ɵpipe: i0.ɵɵPipeDeclaration<AblePipe<any>, "able">;
23
12
  }
24
13
  export declare class AblePurePipe<T extends AnyAbility> implements PipeTransform {
25
14
  private _ability;
26
15
  constructor(ability: T);
27
16
  transform(...args: Parameters<T['can']>): Observable<boolean>;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<AblePurePipe<any>, never>;
18
+ static ɵpipe: i0.ɵɵPipeDeclaration<AblePurePipe<any>, "ablePure">;
28
19
  }
29
- export {};
package/dist/umd/index.js CHANGED
@@ -2,54 +2,33 @@
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@casl/ability'), require('rxjs')) :
3
3
  typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@casl/ability', 'rxjs'], factory) :
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.casl = global.casl || {}, global.casl.ng = {}), global.ng.core, global.casl, global.rxjs));
5
- }(this, (function (exports, core, ability, rxjs) { 'use strict';
5
+ }(this, (function (exports, i0, ability, rxjs) { 'use strict';
6
6
 
7
- var AbilityPipe = /** @class */ (function () {
8
- function AbilityPipe(ability, cd) {
9
- this._ability = ability;
10
- this._cd = cd;
11
- }
12
- AbilityPipe.prototype.transform = function () {
13
- var _a;
14
- var _this = this;
15
- var args = [];
16
- for (var _i = 0; _i < arguments.length; _i++) {
17
- args[_i] = arguments[_i];
18
- }
19
- if (!this._unsubscribeFromAbility) {
20
- this._unsubscribeFromAbility = this._ability.on('updated', function () { return _this._cd.markForCheck(); });
21
- }
22
- return (_a = this._ability).can.apply(_a, args);
23
- };
24
- AbilityPipe.prototype.ngOnDestroy = function () {
25
- if (this._unsubscribeFromAbility) {
26
- this._unsubscribeFromAbility();
27
- }
28
- };
29
- return AbilityPipe;
30
- }());
31
- var CanPipe = /** @class */ (function () {
32
- function CanPipe(ability, cd) {
33
- this.pipe = new AbilityPipe(ability, cd);
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () {
17
+ return e[k];
18
+ }
19
+ });
20
+ }
21
+ });
34
22
  }
35
- CanPipe.prototype.transform = function (subject, action, field) {
36
- return this.pipe.transform(action, subject, field);
37
- };
38
- CanPipe.prototype.ngOnDestroy = function () {
39
- this.pipe.ngOnDestroy();
40
- };
41
- CanPipe.decorators = [
42
- { type: core.Pipe, args: [{ name: 'can', pure: false },] }
43
- ];
44
- CanPipe.ctorParameters = function () { return [
45
- { type: undefined, decorators: [{ type: core.Inject, args: [ability.PureAbility,] }] },
46
- { type: core.ChangeDetectorRef }
47
- ]; };
48
- return CanPipe;
49
- }());
23
+ n['default'] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
+
50
29
  var AblePipe = /** @class */ (function () {
51
- function AblePipe(ability, cd) {
52
- this.pipe = new AbilityPipe(ability, cd);
30
+ function AblePipe(ability) {
31
+ this._ability = ability;
53
32
  }
54
33
  AblePipe.prototype.transform = function () {
55
34
  var _a;
@@ -57,20 +36,19 @@
57
36
  for (var _i = 0; _i < arguments.length; _i++) {
58
37
  args[_i] = arguments[_i];
59
38
  }
60
- return (_a = this.pipe).transform.apply(_a, args);
61
- };
62
- AblePipe.prototype.ngOnDestroy = function () {
63
- this.pipe.ngOnDestroy();
39
+ return (_a = this._ability).can.apply(_a, args);
64
40
  };
65
- AblePipe.decorators = [
66
- { type: core.Pipe, args: [{ name: 'able', pure: false },] }
67
- ];
68
- AblePipe.ctorParameters = function () { return [
69
- { type: undefined, decorators: [{ type: core.Inject, args: [ability.PureAbility,] }] },
70
- { type: core.ChangeDetectorRef }
71
- ]; };
41
+ AblePipe.ɵfac = function AblePipe_Factory(t) { return new (t || AblePipe)(i0__namespace.ɵɵdirectiveInject(ability.PureAbility, 16)); };
42
+ AblePipe.ɵpipe = /*@__PURE__*/ i0__namespace.ɵɵdefinePipe({ name: "able", type: AblePipe, pure: false });
72
43
  return AblePipe;
73
44
  }());
45
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AblePipe, [{
46
+ type: i0.Pipe,
47
+ args: [{ name: 'able', pure: false }]
48
+ }], function () { return [{ type: undefined, decorators: [{
49
+ type: i0.Inject,
50
+ args: [ability.PureAbility]
51
+ }] }]; }, null); })();
74
52
  var AblePurePipe = /** @class */ (function () {
75
53
  function AblePurePipe(ability) {
76
54
  this._ability = ability;
@@ -91,39 +69,46 @@
91
69
  return _this._ability.on('updated', emit);
92
70
  });
93
71
  };
94
- AblePurePipe.decorators = [
95
- { type: core.Pipe, args: [{ name: 'ablePure' },] }
96
- ];
97
- AblePurePipe.ctorParameters = function () { return [
98
- { type: undefined, decorators: [{ type: core.Inject, args: [ability.PureAbility,] }] }
99
- ]; };
72
+ AblePurePipe.ɵfac = function AblePurePipe_Factory(t) { return new (t || AblePurePipe)(i0__namespace.ɵɵdirectiveInject(ability.PureAbility, 16)); };
73
+ AblePurePipe.ɵpipe = /*@__PURE__*/ i0__namespace.ɵɵdefinePipe({ name: "ablePure", type: AblePurePipe, pure: true });
100
74
  return AblePurePipe;
101
75
  }());
76
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AblePurePipe, [{
77
+ type: i0.Pipe,
78
+ args: [{ name: 'ablePure' }]
79
+ }], function () { return [{ type: undefined, decorators: [{
80
+ type: i0.Inject,
81
+ args: [ability.PureAbility]
82
+ }] }]; }, null); })();
102
83
 
103
84
  var AbilityModule = /** @class */ (function () {
104
85
  function AbilityModule() {
105
86
  }
106
- AbilityModule.decorators = [
107
- { type: core.NgModule, args: [{
108
- declarations: [
109
- CanPipe,
110
- AblePipe,
111
- AblePurePipe,
112
- ],
113
- exports: [
114
- CanPipe,
115
- AblePipe,
116
- AblePurePipe,
117
- ],
118
- },] }
119
- ];
87
+ AbilityModule.ɵfac = function AbilityModule_Factory(t) { return new (t || AbilityModule)(); };
88
+ AbilityModule.ɵmod = /*@__PURE__*/ i0__namespace.ɵɵdefineNgModule({ type: AbilityModule });
89
+ AbilityModule.ɵinj = /*@__PURE__*/ i0__namespace.ɵɵdefineInjector({});
120
90
  return AbilityModule;
121
91
  }());
92
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(AbilityModule, [{
93
+ type: i0.NgModule,
94
+ args: [{
95
+ declarations: [
96
+ AblePipe,
97
+ AblePurePipe,
98
+ ],
99
+ exports: [
100
+ AblePipe,
101
+ AblePurePipe,
102
+ ],
103
+ }]
104
+ }], null, null); })();
105
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0__namespace.ɵɵsetNgModuleScope(AbilityModule, { declarations: [AblePipe,
106
+ AblePurePipe], exports: [AblePipe,
107
+ AblePurePipe] }); })();
122
108
 
123
109
  exports.AbilityModule = AbilityModule;
124
110
  exports.AblePipe = AblePipe;
125
111
  exports.AblePurePipe = AblePurePipe;
126
- exports.CanPipe = CanPipe;
127
112
 
128
113
  Object.defineProperty(exports, '__esModule', { value: true });
129
114
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/pipes.ts","../../src/AbilityModule.ts"],"sourcesContent":["import { Pipe, ChangeDetectorRef, Inject, PipeTransform } from '@angular/core';\nimport { PureAbility, Unsubscribe, AnyAbility } from '@casl/ability';\nimport { Observable } from 'rxjs';\n\nclass AbilityPipe<T extends AnyAbility> {\n protected _unsubscribeFromAbility?: Unsubscribe;\n private _ability: T;\n private _cd: ChangeDetectorRef;\n\n constructor(ability: T, cd: ChangeDetectorRef) {\n this._ability = ability;\n this._cd = cd;\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n if (!this._unsubscribeFromAbility) {\n this._unsubscribeFromAbility = this._ability.on('updated', () => this._cd.markForCheck());\n }\n return this._ability.can(...args);\n }\n\n ngOnDestroy() {\n if (this._unsubscribeFromAbility) {\n this._unsubscribeFromAbility();\n }\n }\n}\n\n@Pipe({ name: 'can', pure: false })\nexport class CanPipe<T extends AnyAbility> implements PipeTransform {\n protected pipe: AbilityPipe<T>;\n\n constructor(@Inject(PureAbility) ability: T, cd: ChangeDetectorRef) {\n this.pipe = new AbilityPipe(ability, cd);\n }\n\n transform(\n subject: Parameters<T['can']>[1],\n action: Parameters<T['can']>[0],\n field?: string\n ): boolean {\n return (this.pipe as any).transform(action, subject, field);\n }\n\n ngOnDestroy() {\n this.pipe.ngOnDestroy();\n }\n}\n\n@Pipe({ name: 'able', pure: false })\nexport class AblePipe<T extends AnyAbility> implements PipeTransform {\n protected pipe: AbilityPipe<T>;\n\n constructor(@Inject(PureAbility) ability: T, cd: ChangeDetectorRef) {\n this.pipe = new AbilityPipe(ability, cd);\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n return this.pipe.transform(...args);\n }\n\n ngOnDestroy() {\n this.pipe.ngOnDestroy();\n }\n}\n\n@Pipe({ name: 'ablePure' })\nexport class AblePurePipe<T extends AnyAbility> implements PipeTransform {\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n // TODO: `Observable` can be removed after https://github.com/angular/angular/issues/15041\n transform(...args: Parameters<T['can']>): Observable<boolean> {\n return new Observable((s) => {\n const emit = () => s.next(this._ability.can(...args));\n emit();\n return this._ability.on('updated', emit);\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CanPipe, AblePipe, AblePurePipe } from './pipes';\n\n@NgModule({\n declarations: [\n CanPipe,\n AblePipe,\n AblePurePipe,\n ],\n exports: [\n CanPipe,\n AblePipe,\n AblePurePipe,\n ],\n})\nexport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EAAE;4BACP,OAAO;4BACP,QAAQ;4BACR,YAAY;yBACb;qBACF;;QAED,oBAAC;KAbD;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/pipes.ts","../../src/AbilityModule.ts"],"sourcesContent":["import { Pipe, Inject, PipeTransform } from '@angular/core';\nimport { PureAbility, Unsubscribe, AnyAbility } from '@casl/ability';\nimport { Observable } from 'rxjs';\n\n@Pipe({ name: 'able', pure: false })\nexport class AblePipe<T extends AnyAbility> implements PipeTransform {\n protected _unsubscribeFromAbility?: Unsubscribe;\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n return this._ability.can(...args);\n }\n}\n\n@Pipe({ name: 'ablePure' })\nexport class AblePurePipe<T extends AnyAbility> implements PipeTransform {\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n // TODO: `Observable` can be removed after https://github.com/angular/angular/issues/15041\n transform(...args: Parameters<T['can']>): Observable<boolean> {\n return new Observable((s) => {\n const emit = () => s.next(this._ability.can(...args));\n emit();\n return this._ability.on('updated', emit);\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { AblePipe, AblePurePipe } from './pipes';\n\n@NgModule({\n declarations: [\n AblePipe,\n AblePurePipe,\n ],\n exports: [\n AblePipe,\n AblePurePipe,\n ],\n})\nexport class AbilityModule {\n}\n"],"names":["PureAbility","Pipe","Inject","Observable","NgModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;QASE,kBAAiC,OAAU;YACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;SACzB;QAED,4BAAS,GAAT;;YAAU,cAA6B;iBAA7B,UAA6B,EAA7B,qBAA6B,EAA7B,IAA6B;gBAA7B,yBAA6B;;YACrC,OAAO,CAAA,KAAA,IAAI,CAAC,QAAQ,EAAC,GAAG,WAAI,IAAI,EAAE;SACnC;wEAVU,QAAQ,kCAICA,mBAAW;wFAJpB,QAAQ;uBALrB;KAIA,IAYC;sGAXY,QAAQ;kBADpBC,OAAI;mBAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE;;0BAKpBC,SAAM;2BAACF,mBAAW;;;QAa/B,sBAAiC,OAAU;YACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;SACzB;;QAGD,gCAAS,GAAT;YAAA,iBAMC;YANS,cAA6B;iBAA7B,UAA6B,EAA7B,qBAA6B,EAA7B,IAA6B;gBAA7B,yBAA6B;;YACrC,OAAO,IAAIG,eAAU,CAAC,UAAC,CAAC;gBACtB,IAAM,IAAI,GAAG;;oBAAM,OAAA,CAAC,CAAC,IAAI,CAAC,CAAA,KAAA,KAAI,CAAC,QAAQ,EAAC,GAAG,WAAI,IAAI,EAAE;iBAAA,CAAC;gBACtD,IAAI,EAAE,CAAC;gBACP,OAAO,KAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;aAC1C,CAAC,CAAC;SACJ;gFAdU,YAAY,kCAGHH,mBAAW;gGAHpB,YAAY;2BAnBzB;KAkBA,IAgBC;sGAfY,YAAY;kBADxBC,OAAI;mBAAC,EAAE,IAAI,EAAE,UAAU,EAAE;;0BAIXC,SAAM;2BAACF,mBAAW;;;;QCnBjC;SAWC;kFADY,aAAa;kFAAb,aAAa;;4BAb1B;KAGA,IAWC;sGADY,aAAa;kBAVzBI,WAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,QAAQ;wBACR,YAAY;qBACb;oBACD,OAAO,EAAE;wBACP,QAAQ;wBACR,YAAY;qBACb;iBACF;;uGACY,aAAa,mBARtB,QAAQ;YACR,YAAY,aAGZ,QAAQ;YACR,YAAY;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@casl/angular",
3
- "version": "5.1.3",
3
+ "version": "6.0.0",
4
4
  "description": "Angular module for CASL which makes it easy to add permissions in any Angular app",
5
5
  "main": "dist/umd/index.js",
6
6
  "module": "dist/es5m/index.js",
7
- "es2015": "dist/es6m/index.js",
7
+ "es2015": "dist/es6m/index.mjs",
8
8
  "typings": "dist/types/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./dist/es6m/index.js",
11
+ "import": "./dist/es6m/index.mjs",
12
12
  "require": "./dist/umd/index.js"
13
13
  }
14
14
  },
@@ -26,9 +26,9 @@
26
26
  "build.es5m": "TARGET=es5 BUILD=es5m npm run rollup",
27
27
  "build.es6": "TARGET=es2015 BUILD=es6m npm run rollup",
28
28
  "build.umd": "TARGET=es5 BUILD=umd npm run rollup",
29
- "build.types": "ngc -p tsconfig.types.json",
29
+ "build.types": "ngc -p tsconfig.types.json && rm -rf dist/types/*.js",
30
30
  "prerollup": "ngc -p tsconfig.build.json --target $TARGET --outDir dist/$BUILD/tmp",
31
- "rollup": "IGNORE_SUBPATH=1 LIB_MINIFY=false BUILD_TYPES=$BUILD ES_TRANSFORM=false ES6M_EXT=.js dx rollup -i dist/$BUILD/tmp/index.js -n casl.ng -g @angular/core:ng.core,@casl/ability:casl,tslib:tslib,rxjs:rxjs",
31
+ "rollup": "IGNORE_SUBPATH=1 LIB_MINIFY=false BUILD_TYPES=$BUILD ES_TRANSFORM=false dx rollup -i dist/$BUILD/tmp/index.js -n casl.ng -g @angular/core:ng.core,@casl/ability:casl,tslib:tslib,rxjs:rxjs",
32
32
  "postrollup": "rm -rf dist/$BUILD/tmp",
33
33
  "test": "dx jest --config ./jest.config.js",
34
34
  "lint": "dx eslint src/ spec/",
@@ -45,24 +45,25 @@
45
45
  "author": "Sergii Stotskyi <sergiy.stotskiy@gmail.com>",
46
46
  "license": "MIT",
47
47
  "peerDependencies": {
48
- "@angular/core": "^9.0.0 || ^10.0.0 || ^11.0.0",
48
+ "@angular/core": "^12.0.0",
49
49
  "@casl/ability": "^3.0.0 || ^4.0.0 || ^5.1.0",
50
- "rxjs": "^6.0.0",
50
+ "rxjs": "^6.5.3",
51
51
  "tslib": "^2.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@abraham/reflection": "^0.7.0",
55
- "@angular/common": "^11.0.0",
56
- "@angular/compiler": "^11.0.0",
57
- "@angular/compiler-cli": "^11.0.0",
58
- "@angular/core": "^11.0.0",
59
- "@angular/platform-browser": "^11.0.0",
60
- "@angular/platform-browser-dynamic": "^11.0.0",
54
+ "@abraham/reflection": "^0.8.0",
55
+ "@angular/common": "^12.0.0",
56
+ "@angular/compiler": "^12.0.0",
57
+ "@angular/compiler-cli": "^12.0.0",
58
+ "@angular/core": "^12.0.0",
59
+ "@angular/platform-browser": "^12.0.0",
60
+ "@angular/platform-browser-dynamic": "^12.0.0",
61
61
  "@casl/ability": "^5.1.0",
62
62
  "@casl/dx": "workspace:^1.0.0",
63
- "rxjs": "^6.0.0",
63
+ "rxjs": "^6.5.3",
64
64
  "tslib": "^2.0.0",
65
- "zone.js": "^0.10.2"
65
+ "typescript": "~4.2.3",
66
+ "zone.js": "~0.11.4"
66
67
  },
67
68
  "files": [
68
69
  "dist",
@@ -1,96 +0,0 @@
1
- import { Pipe, Inject, ChangeDetectorRef, NgModule } from '@angular/core';
2
- import { PureAbility } from '@casl/ability';
3
- import { Observable } from 'rxjs';
4
-
5
- class AbilityPipe {
6
- constructor(ability, cd) {
7
- this._ability = ability;
8
- this._cd = cd;
9
- }
10
- transform(...args) {
11
- if (!this._unsubscribeFromAbility) {
12
- this._unsubscribeFromAbility = this._ability.on('updated', () => this._cd.markForCheck());
13
- }
14
- return this._ability.can(...args);
15
- }
16
- ngOnDestroy() {
17
- if (this._unsubscribeFromAbility) {
18
- this._unsubscribeFromAbility();
19
- }
20
- }
21
- }
22
- class CanPipe {
23
- constructor(ability, cd) {
24
- this.pipe = new AbilityPipe(ability, cd);
25
- }
26
- transform(subject, action, field) {
27
- return this.pipe.transform(action, subject, field);
28
- }
29
- ngOnDestroy() {
30
- this.pipe.ngOnDestroy();
31
- }
32
- }
33
- CanPipe.decorators = [
34
- { type: Pipe, args: [{ name: 'can', pure: false },] }
35
- ];
36
- CanPipe.ctorParameters = () => [
37
- { type: undefined, decorators: [{ type: Inject, args: [PureAbility,] }] },
38
- { type: ChangeDetectorRef }
39
- ];
40
- class AblePipe {
41
- constructor(ability, cd) {
42
- this.pipe = new AbilityPipe(ability, cd);
43
- }
44
- transform(...args) {
45
- return this.pipe.transform(...args);
46
- }
47
- ngOnDestroy() {
48
- this.pipe.ngOnDestroy();
49
- }
50
- }
51
- AblePipe.decorators = [
52
- { type: Pipe, args: [{ name: 'able', pure: false },] }
53
- ];
54
- AblePipe.ctorParameters = () => [
55
- { type: undefined, decorators: [{ type: Inject, args: [PureAbility,] }] },
56
- { type: ChangeDetectorRef }
57
- ];
58
- class AblePurePipe {
59
- constructor(ability) {
60
- this._ability = ability;
61
- }
62
- // TODO: `Observable` can be removed after https://github.com/angular/angular/issues/15041
63
- transform(...args) {
64
- return new Observable((s) => {
65
- const emit = () => s.next(this._ability.can(...args));
66
- emit();
67
- return this._ability.on('updated', emit);
68
- });
69
- }
70
- }
71
- AblePurePipe.decorators = [
72
- { type: Pipe, args: [{ name: 'ablePure' },] }
73
- ];
74
- AblePurePipe.ctorParameters = () => [
75
- { type: undefined, decorators: [{ type: Inject, args: [PureAbility,] }] }
76
- ];
77
-
78
- class AbilityModule {
79
- }
80
- AbilityModule.decorators = [
81
- { type: NgModule, args: [{
82
- declarations: [
83
- CanPipe,
84
- AblePipe,
85
- AblePurePipe,
86
- ],
87
- exports: [
88
- CanPipe,
89
- AblePipe,
90
- AblePurePipe,
91
- ],
92
- },] }
93
- ];
94
-
95
- export { AbilityModule, AblePipe, AblePurePipe, CanPipe };
96
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/pipes.ts","../../src/AbilityModule.ts"],"sourcesContent":["import { Pipe, ChangeDetectorRef, Inject, PipeTransform } from '@angular/core';\nimport { PureAbility, Unsubscribe, AnyAbility } from '@casl/ability';\nimport { Observable } from 'rxjs';\n\nclass AbilityPipe<T extends AnyAbility> {\n protected _unsubscribeFromAbility?: Unsubscribe;\n private _ability: T;\n private _cd: ChangeDetectorRef;\n\n constructor(ability: T, cd: ChangeDetectorRef) {\n this._ability = ability;\n this._cd = cd;\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n if (!this._unsubscribeFromAbility) {\n this._unsubscribeFromAbility = this._ability.on('updated', () => this._cd.markForCheck());\n }\n return this._ability.can(...args);\n }\n\n ngOnDestroy() {\n if (this._unsubscribeFromAbility) {\n this._unsubscribeFromAbility();\n }\n }\n}\n\n@Pipe({ name: 'can', pure: false })\nexport class CanPipe<T extends AnyAbility> implements PipeTransform {\n protected pipe: AbilityPipe<T>;\n\n constructor(@Inject(PureAbility) ability: T, cd: ChangeDetectorRef) {\n this.pipe = new AbilityPipe(ability, cd);\n }\n\n transform(\n subject: Parameters<T['can']>[1],\n action: Parameters<T['can']>[0],\n field?: string\n ): boolean {\n return (this.pipe as any).transform(action, subject, field);\n }\n\n ngOnDestroy() {\n this.pipe.ngOnDestroy();\n }\n}\n\n@Pipe({ name: 'able', pure: false })\nexport class AblePipe<T extends AnyAbility> implements PipeTransform {\n protected pipe: AbilityPipe<T>;\n\n constructor(@Inject(PureAbility) ability: T, cd: ChangeDetectorRef) {\n this.pipe = new AbilityPipe(ability, cd);\n }\n\n transform(...args: Parameters<T['can']>): boolean {\n return this.pipe.transform(...args);\n }\n\n ngOnDestroy() {\n this.pipe.ngOnDestroy();\n }\n}\n\n@Pipe({ name: 'ablePure' })\nexport class AblePurePipe<T extends AnyAbility> implements PipeTransform {\n private _ability: T;\n\n constructor(@Inject(PureAbility) ability: T) {\n this._ability = ability;\n }\n\n // TODO: `Observable` can be removed after https://github.com/angular/angular/issues/15041\n transform(...args: Parameters<T['can']>): Observable<boolean> {\n return new Observable((s) => {\n const emit = () => s.next(this._ability.can(...args));\n emit();\n return this._ability.on('updated', emit);\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CanPipe, AblePipe, AblePurePipe } from './pipes';\n\n@NgModule({\n declarations: [\n CanPipe,\n AblePipe,\n AblePurePipe,\n ],\n exports: [\n CanPipe,\n AblePipe,\n AblePurePipe,\n ],\n})\nexport class AbilityModule {\n}\n"],"names":[],"mappings":";;;;AAIA,MAAM,WAAW;IAKf,YAAY,OAAU,EAAE,EAAqB;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;KACf;IAED,SAAS,CAAC,GAAG,IAA0B;QACrC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE;YACjC,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;SAC3F;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;KACnC;IAED,WAAW;QACT,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAChC,IAAI,CAAC,uBAAuB,EAAE,CAAC;SAChC;KACF;CACF;MAGY,OAAO;IAGlB,YAAiC,OAAU,EAAE,EAAqB;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;KAC1C;IAED,SAAS,CACP,OAAgC,EAChC,MAA+B,EAC/B,KAAc;QAEd,OAAQ,IAAI,CAAC,IAAY,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;KAC7D;IAED,WAAW;QACT,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;KACzB;;;YAlBF,IAAI,SAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE;;;4CAInB,MAAM,SAAC,WAAW;YAhClB,iBAAiB;;MAkDnB,QAAQ;IAGnB,YAAiC,OAAU,EAAE,EAAqB;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;KAC1C;IAED,SAAS,CAAC,GAAG,IAA0B;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;KACrC;IAED,WAAW;QACT,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;KACzB;;;YAdF,IAAI,SAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE;;;4CAIpB,MAAM,SAAC,WAAW;YArDlB,iBAAiB;;MAmEnB,YAAY;IAGvB,YAAiC,OAAU;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;KACzB;;IAGD,SAAS,CAAC,GAAG,IAA0B;QACrC,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC;YACtB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;YACtD,IAAI,EAAE,CAAC;YACP,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAC1C,CAAC,CAAC;KACJ;;;YAfF,IAAI,SAAC,EAAE,IAAI,EAAE,UAAU,EAAE;;;4CAIX,MAAM,SAAC,WAAW;;;MCvDpB,aAAa;;;YAZzB,QAAQ,SAAC;gBACR,YAAY,EAAE;oBACZ,OAAO;oBACP,QAAQ;oBACR,YAAY;iBACb;gBACD,OAAO,EAAE;oBACP,OAAO;oBACP,QAAQ;oBACR,YAAY;iBACb;aACF;;;;;"}
@@ -1 +0,0 @@
1
- {"__symbolic":"module","version":4,"metadata":{"CanPipe":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":28,"character":1},"arguments":[{"name":"can","pure":false}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":32,"character":15},"arguments":[{"__symbolic":"reference","module":"@casl/ability","name":"PureAbility","line":32,"character":22}]}],null],"parameters":[{"__symbolic":"error","message":"Could not resolve type","line":32,"character":44,"context":{"typeName":"T"},"module":"./pipes"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":32,"character":51}]}],"transform":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"AblePipe":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":49,"character":1},"arguments":[{"name":"able","pure":false}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":53,"character":15},"arguments":[{"__symbolic":"reference","module":"@casl/ability","name":"PureAbility","line":53,"character":22}]}],null],"parameters":[{"__symbolic":"error","message":"Could not resolve type","line":53,"character":44,"context":{"typeName":"T"},"module":"./pipes"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":32,"character":51}]}],"transform":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}},"AblePurePipe":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Pipe","line":66,"character":1},"arguments":[{"name":"ablePure"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":70,"character":15},"arguments":[{"__symbolic":"reference","module":"@casl/ability","name":"PureAbility","line":70,"character":22}]}]],"parameters":[{"__symbolic":"error","message":"Could not resolve type","line":70,"character":44,"context":{"typeName":"T"},"module":"./pipes"}]}],"transform":[{"__symbolic":"method"}]}},"AbilityModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"CanPipe"},{"__symbolic":"reference","name":"AblePipe"},{"__symbolic":"reference","name":"AblePurePipe"}],"exports":[{"__symbolic":"reference","name":"CanPipe"},{"__symbolic":"reference","name":"AblePipe"},{"__symbolic":"reference","name":"AblePurePipe"}]}]}],"members":{}}},"origins":{"CanPipe":"./pipes","AblePipe":"./pipes","AblePurePipe":"./pipes","AbilityModule":"./AbilityModule"},"importAs":"@casl/angular"}