Skip to content

Commit

Permalink
merge acl-mongodbBackend.d.ts and acl-redisBackend.d.ts into acl.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
vvakame committed Apr 29, 2015
1 parent 7faade2 commit 6d64be2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 46 deletions.
3 changes: 1 addition & 2 deletions acl/acl-mongodbBackend-tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path='acl-mongodbBackend.d.ts'/>
/// <reference path='acl.d.ts'/>

// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
Expand All @@ -14,4 +14,3 @@ acl.allow('guest', 'blogs', 'view');

// allow function accepts arrays as any parameter
acl.allow('member', 'blogs', ['edit','view', 'delete']);

22 changes: 0 additions & 22 deletions acl/acl-mongodbBackend.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion acl/acl-redisBackend-test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path='acl-redisBackend.d.ts'/>
/// <reference path='acl.d.ts'/>

// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
Expand Down
21 changes: 0 additions & 21 deletions acl/acl-redisBackend.d.ts

This file was deleted.

30 changes: 30 additions & 0 deletions acl/acl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
/// <reference path="../bluebird/bluebird.d.ts" />
/// <reference path='../node/node.d.ts'/>

/// <reference path='../redis/redis.d.ts'/>
/// <reference path="../mongodb/mongodb.d.ts" />

declare module "acl" {
import http = require('http');
import Promise = require("bluebird");
Expand Down Expand Up @@ -115,6 +118,33 @@ declare module "acl" {
end: () => void;
}

// for redis backend
import redis = require('redis');

interface AclStatic {
redisBackend: RedisBackendStatic;
}

interface RedisBackend extends Backend<redis.RedisClient> { }
interface RedisBackendStatic {
new(redis: redis.RedisClient, prefix: string): RedisBackend;
new(redis: redis.RedisClient): RedisBackend;
}

// for mongodb backend
import mongo = require('mongodb');

interface AclStatic {
mongodbBackend: MongodbBackendStatic;
}

interface MongodbBackend extends Backend<Callback> { }
interface MongodbBackendStatic {
new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend;
new(db: mongo.Db, prefix: string): MongodbBackend;
new(db: mongo.Db): MongodbBackend;
}

var _: AclStatic;
export = _;
}

0 comments on commit 6d64be2

Please sign in to comment.