Skip to content

Commit

Permalink
Published v2.0.1 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
Shady Khalifa committed May 12, 2019
1 parent 6ad5cc9 commit 5bba217
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.0.1] - 2019-04-10

### Added

- `AccessControlModule#forRootAsync` method for loading `RolesBuilder` asynchronously. (from database for example.)

## [2.0.0] - 2019-04-10

## Updated [Breacking Change]

- Now we are using Nestjs V6

## [1.0.1] - 2019-04-01
Expand Down
6 changes: 5 additions & 1 deletion lib/access-control.module.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamicModule } from '@nestjs/common';
import { DynamicModule, Provider } from '@nestjs/common';
import { RolesBuilder } from './roles-builder.class';
export declare class AccessControlModule {
/**
Expand All @@ -7,4 +7,8 @@ export declare class AccessControlModule {
* definitions. See the structure of this object in the examples.
*/
static forRoles(roles: RolesBuilder): DynamicModule;
static forRootAsync(options: {
inject?: Provider[];
useFactory: (...args: any) => RolesBuilder;
}): DynamicModule;
}
16 changes: 16 additions & 0 deletions lib/access-control.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ let AccessControlModule = AccessControlModule_1 = class AccessControlModule {
],
};
}
static forRootAsync(options) {
const provider = {
provide: constants_1.ROLES_BUILDER_TOKEN,
useFactory: options.useFactory,
inject: options.inject || [],
};
return {
module: AccessControlModule_1,
providers: [
provider,
],
exports: [
provider,
],
};
}
};
AccessControlModule = AccessControlModule_1 = __decorate([
common_1.Global(),
Expand Down
9 changes: 5 additions & 4 deletions lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nest-access-control",
"version": "2.0.0",
"version": "2.0.1",
"description": "Access Control Module For Nestjs Framework",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -28,16 +28,17 @@
"devDependencies": {
"@nestjs/common": "^6.0.1",
"@nestjs/core": "^6.0.1",
"@types/jest": "^22.2.3",
"@nestjs/testing": "^6.1.1",
"@types/jest": "^24.0.12",
"@types/node": "^10.1.2",
"coveralls": "^3.0.1",
"gulp": "^4.0.0",
"gulp-sequence": "^1.0.0",
"gulp-typescript": "^4.0.2",
"jest": "^22.4.4",
"jest": "^24.8.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^6.0.0",
"ts-jest": "^22.4.6",
"ts-jest": "^24.0.2",
"ts-node": "^6.0.3",
"typescript": "^3.2"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nest-access-control",
"version": "2.0.0",
"version": "2.0.1",
"description": "Access Control Module For Nestjs Framework",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 5bba217

Please sign in to comment.