@accounts/database-manager
Advanced tools
Comparing version
@@ -114,2 +114,34 @@ import { DatabaseManager } from '../src'; | ||
} | ||
public findAuthenticatorById() { | ||
return this.name; | ||
} | ||
public findUserAuthenticators() { | ||
return this.name; | ||
} | ||
public createAuthenticator() { | ||
return this.name; | ||
} | ||
public activateAuthenticator() { | ||
return this.name; | ||
} | ||
public createMfaChallenge() { | ||
return this.name; | ||
} | ||
public findMfaChallengeByToken() { | ||
return this.name; | ||
} | ||
public deactivateMfaChallenge() { | ||
return this.name; | ||
} | ||
public updateMfaChallenge() { | ||
return this.name; | ||
} | ||
} | ||
@@ -257,2 +289,38 @@ | ||
}); | ||
it('findAuthenticatorById should be called on userStorage', () => { | ||
expect(databaseManager.findAuthenticatorById('authenticatorId')).toBe('userStorage'); | ||
}); | ||
it('findUserAuthenticators should be called on userStorage', () => { | ||
expect(databaseManager.findUserAuthenticators('userId')).toBe('userStorage'); | ||
}); | ||
it('createAuthenticator should be called on userStorage', () => { | ||
expect( | ||
databaseManager.createAuthenticator({ userId: 'userId', type: 'type', active: true }) | ||
).toBe('userStorage'); | ||
}); | ||
it('activateAuthenticator should be called on userStorage', () => { | ||
expect(databaseManager.activateAuthenticator('userId')).toBe('userStorage'); | ||
}); | ||
it('createMfaChallenge should be called on userStorage', () => { | ||
expect(databaseManager.createMfaChallenge({ userId: 'userId', token: 'token' })).toBe( | ||
'userStorage' | ||
); | ||
}); | ||
it('findMfaChallengeByToken should be called on userStorage', () => { | ||
expect(databaseManager.findMfaChallengeByToken('userId')).toBe('userStorage'); | ||
}); | ||
it('deactivateMfaChallenge should be called on userStorage', () => { | ||
expect(databaseManager.deactivateMfaChallenge('userId')).toBe('userStorage'); | ||
}); | ||
it('updateMfaChallenge should be called on userStorage', () => { | ||
expect(databaseManager.updateMfaChallenge('userId', {})).toBe('userStorage'); | ||
}); | ||
}); |
@@ -34,2 +34,12 @@ import { DatabaseInterface } from '@accounts/types'; | ||
get setUserDeactivated(): DatabaseInterface['setUserDeactivated']; | ||
get findAuthenticatorById(): DatabaseInterface['findAuthenticatorById']; | ||
get findUserAuthenticators(): DatabaseInterface['findUserAuthenticators']; | ||
get createAuthenticator(): DatabaseInterface['createAuthenticator']; | ||
get activateAuthenticator(): DatabaseInterface['activateAuthenticator']; | ||
get deactivateAuthenticator(): DatabaseInterface['deactivateAuthenticator']; | ||
get updateAuthenticator(): DatabaseInterface['updateAuthenticator']; | ||
get createMfaChallenge(): DatabaseInterface['createMfaChallenge']; | ||
get findMfaChallengeByToken(): DatabaseInterface['findMfaChallengeByToken']; | ||
get deactivateMfaChallenge(): DatabaseInterface['deactivateMfaChallenge']; | ||
get updateMfaChallenge(): DatabaseInterface['updateMfaChallenge']; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DatabaseManager = void 0; | ||
var DatabaseManager = /** @class */ (function () { | ||
@@ -25,3 +26,3 @@ function DatabaseManager(configuration) { | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -34,3 +35,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -43,3 +44,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -52,3 +53,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -61,3 +62,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -70,3 +71,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -79,3 +80,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -88,3 +89,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -97,3 +98,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -106,3 +107,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -115,3 +116,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -124,3 +125,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -133,3 +134,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -142,3 +143,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -151,3 +152,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -160,3 +161,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -169,3 +170,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -178,3 +179,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -187,3 +188,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -196,3 +197,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -205,3 +206,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -214,3 +215,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -223,3 +224,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -232,3 +233,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -241,3 +242,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -250,5 +251,85 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "findAuthenticatorById", { | ||
// Return the findAuthenticatorById function from the userStorage | ||
get: function () { | ||
return this.userStorage.findAuthenticatorById.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "findUserAuthenticators", { | ||
// Return the findUserAuthenticators function from the userStorage | ||
get: function () { | ||
return this.userStorage.findUserAuthenticators.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "createAuthenticator", { | ||
// Return the createAuthenticator function from the userStorage | ||
get: function () { | ||
return this.userStorage.createAuthenticator.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "activateAuthenticator", { | ||
// Return the activateAuthenticator function from the userStorage | ||
get: function () { | ||
return this.userStorage.activateAuthenticator.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "deactivateAuthenticator", { | ||
// Return the deactivateAuthenticator function from the userStorage | ||
get: function () { | ||
return this.userStorage.deactivateAuthenticator.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "updateAuthenticator", { | ||
// Return the updateAuthenticator function from the userStorage | ||
get: function () { | ||
return this.userStorage.updateAuthenticator.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "createMfaChallenge", { | ||
// Return the createMfaChallenge function from the userStorage | ||
get: function () { | ||
return this.userStorage.createMfaChallenge.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "findMfaChallengeByToken", { | ||
// Return the findMfaChallengeByToken function from the userStorage | ||
get: function () { | ||
return this.userStorage.findMfaChallengeByToken.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "deactivateMfaChallenge", { | ||
// Return the deactivateMfaChallenge function from the userStorage | ||
get: function () { | ||
return this.userStorage.deactivateMfaChallenge.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DatabaseManager.prototype, "updateMfaChallenge", { | ||
// Return the updateMfaChallenge function from the userStorage | ||
get: function () { | ||
return this.userStorage.updateMfaChallenge.bind(this.userStorage); | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
return DatabaseManager; | ||
@@ -255,0 +336,0 @@ }()); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var database_manager_1 = require("./database-manager"); | ||
exports.DatabaseManager = database_manager_1.DatabaseManager; | ||
Object.defineProperty(exports, "DatabaseManager", { enumerable: true, get: function () { return database_manager_1.DatabaseManager; } }); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@accounts/database-manager", | ||
"version": "0.27.0", | ||
"version": "0.28.0-alpha.0", | ||
"description": "Accounts Database Manager, allow the use of separate databases for session and user", | ||
@@ -39,3 +39,3 @@ "main": "lib/index.js", | ||
"@types/jest": "25.2.1", | ||
"@types/node": "13.13.5", | ||
"@types/node": "14.0.13", | ||
"jest": "26.0.1", | ||
@@ -45,6 +45,6 @@ "rimraf": "3.0.2" | ||
"dependencies": { | ||
"@accounts/types": "^0.27.0", | ||
"tslib": "1.11.2" | ||
"@accounts/types": "^0.28.0-alpha.0", | ||
"tslib": "2.0.0" | ||
}, | ||
"gitHead": "3f2f184f7d1f4229bfefb4ed99283de05a60d985" | ||
"gitHead": "9d3a051504a7c8a1698fd3c9cd8b1dbb11fcd906" | ||
} |
@@ -162,2 +162,52 @@ import { DatabaseInterface, DatabaseInterfaceSessions } from '@accounts/types'; | ||
} | ||
// Return the findAuthenticatorById function from the userStorage | ||
public get findAuthenticatorById(): DatabaseInterface['findAuthenticatorById'] { | ||
return this.userStorage.findAuthenticatorById.bind(this.userStorage); | ||
} | ||
// Return the findUserAuthenticators function from the userStorage | ||
public get findUserAuthenticators(): DatabaseInterface['findUserAuthenticators'] { | ||
return this.userStorage.findUserAuthenticators.bind(this.userStorage); | ||
} | ||
// Return the createAuthenticator function from the userStorage | ||
public get createAuthenticator(): DatabaseInterface['createAuthenticator'] { | ||
return this.userStorage.createAuthenticator.bind(this.userStorage); | ||
} | ||
// Return the activateAuthenticator function from the userStorage | ||
public get activateAuthenticator(): DatabaseInterface['activateAuthenticator'] { | ||
return this.userStorage.activateAuthenticator.bind(this.userStorage); | ||
} | ||
// Return the deactivateAuthenticator function from the userStorage | ||
public get deactivateAuthenticator(): DatabaseInterface['deactivateAuthenticator'] { | ||
return this.userStorage.deactivateAuthenticator.bind(this.userStorage); | ||
} | ||
// Return the updateAuthenticator function from the userStorage | ||
public get updateAuthenticator(): DatabaseInterface['updateAuthenticator'] { | ||
return this.userStorage.updateAuthenticator.bind(this.userStorage); | ||
} | ||
// Return the createMfaChallenge function from the userStorage | ||
public get createMfaChallenge(): DatabaseInterface['createMfaChallenge'] { | ||
return this.userStorage.createMfaChallenge.bind(this.userStorage); | ||
} | ||
// Return the findMfaChallengeByToken function from the userStorage | ||
public get findMfaChallengeByToken(): DatabaseInterface['findMfaChallengeByToken'] { | ||
return this.userStorage.findMfaChallengeByToken.bind(this.userStorage); | ||
} | ||
// Return the deactivateMfaChallenge function from the userStorage | ||
public get deactivateMfaChallenge(): DatabaseInterface['deactivateMfaChallenge'] { | ||
return this.userStorage.deactivateMfaChallenge.bind(this.userStorage); | ||
} | ||
// Return the updateMfaChallenge function from the userStorage | ||
public get updateMfaChallenge(): DatabaseInterface['updateMfaChallenge'] { | ||
return this.userStorage.updateMfaChallenge.bind(this.userStorage); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
134224
7.81%1374
15.37%+ Added
+ Added
- Removed
- Removed
Updated