protonfile-auth 1.6.6 → 1.6.7
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/lib/index.d.ts +4 -1
- package/lib/index.js +2 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -11,8 +11,11 @@ import { OTP } from './Entities/OTP';
|
|
|
11
11
|
import OTPVacuum from './services/OTPVacuum';
|
|
12
12
|
import SessionCache from './services/SessionCache';
|
|
13
13
|
import UMS from './services/UMS';
|
|
14
|
+
interface Options {
|
|
15
|
+
customUms?: UMS;
|
|
16
|
+
}
|
|
14
17
|
declare const _default: {
|
|
15
|
-
router: (typeormConfig: ConnectionOptions) => import("express-serve-static-core").Router;
|
|
18
|
+
router: (typeormConfig: ConnectionOptions, options?: Options | undefined) => import("express-serve-static-core").Router;
|
|
16
19
|
authMiddleware: (req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>, next: express.NextFunction) => Promise<void | express.Response<any, Record<string, any>>>;
|
|
17
20
|
entities: {
|
|
18
21
|
User: typeof User;
|
package/lib/index.js
CHANGED
|
@@ -30,7 +30,7 @@ const UMS_1 = __importDefault(require("./services/UMS"));
|
|
|
30
30
|
const sessionCache = new SessionCache_1.default();
|
|
31
31
|
const ums = new UMS_1.default();
|
|
32
32
|
exports.default = {
|
|
33
|
-
router: (typeormConfig) => {
|
|
33
|
+
router: (typeormConfig, options) => {
|
|
34
34
|
(0, typeorm_1.createConnection)(Object.assign(Object.assign({}, typeormConfig), { entities: [User_1.User, Session_1.Session, TempToken_1.TempToken, OTP_1.OTP] })).then((connection) => {
|
|
35
35
|
TempToken_1.TempToken.find().then((res) => {
|
|
36
36
|
for (const session of res) {
|
|
@@ -40,7 +40,7 @@ exports.default = {
|
|
|
40
40
|
});
|
|
41
41
|
const router = express_1.default.Router();
|
|
42
42
|
router.use(body_parser_1.default.urlencoded({ extended: false }));
|
|
43
|
-
router.use(appendUms_1.default.bind(null, ums));
|
|
43
|
+
router.use(appendUms_1.default.bind(null, (options && options.customUms) || ums));
|
|
44
44
|
router.post('/register', register_1.default);
|
|
45
45
|
router.post('/register/otp', registerOtp_1.default);
|
|
46
46
|
router.post('/login', (0, cookie_parser_1.default)(), login_1.default);
|