@hemia/auth-sdk 0.0.6 → 0.0.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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
1
|
import { BadRequestError, CustomHttpError, InternalServerError, Get, Req, Res, Post, HttpError } from '@hemia/common';
|
|
3
2
|
import { HMNetworkServices } from '@hemia/network-services';
|
|
4
3
|
import { JwtManager } from '@hemia/jwt-manager';
|
|
@@ -314,16 +313,14 @@ AuthService = __decorate([
|
|
|
314
313
|
JwtManager])
|
|
315
314
|
], AuthService);
|
|
316
315
|
|
|
317
|
-
const AUTH_SERVICE_ID = Symbol.for(
|
|
316
|
+
const AUTH_SERVICE_ID = Symbol.for('HemiaAuthService');
|
|
318
317
|
|
|
319
318
|
/**
|
|
320
319
|
* Controller Abstracto Reutilizable
|
|
321
320
|
* Gestiona automáticamente Login, Callback, Me y Logout.
|
|
322
321
|
*/
|
|
323
322
|
let AbstractAuthController = class AbstractAuthController {
|
|
324
|
-
constructor(
|
|
325
|
-
this.authService = authService;
|
|
326
|
-
}
|
|
323
|
+
constructor() { }
|
|
327
324
|
async login(req, res) {
|
|
328
325
|
try {
|
|
329
326
|
const autoParam = typeof req.query.auto === 'string' ? req.query.auto : 'false';
|
|
@@ -440,10 +437,12 @@ let AbstractAuthController = class AbstractAuthController {
|
|
|
440
437
|
return res.status(200).json({ success: true });
|
|
441
438
|
}
|
|
442
439
|
};
|
|
440
|
+
__decorate([
|
|
441
|
+
inject(AUTH_SERVICE_ID),
|
|
442
|
+
__metadata("design:type", AuthService)
|
|
443
|
+
], AbstractAuthController.prototype, "authService", void 0);
|
|
443
444
|
__decorate([
|
|
444
445
|
Get('/login'),
|
|
445
|
-
__param(0, Req()),
|
|
446
|
-
__param(1, Res()),
|
|
447
446
|
__metadata("design:type", Function),
|
|
448
447
|
__metadata("design:paramtypes", [Object, Object]),
|
|
449
448
|
__metadata("design:returntype", Promise)
|
|
@@ -472,8 +471,7 @@ __decorate([
|
|
|
472
471
|
], AbstractAuthController.prototype, "logout", null);
|
|
473
472
|
AbstractAuthController = __decorate([
|
|
474
473
|
injectable(),
|
|
475
|
-
|
|
476
|
-
__metadata("design:paramtypes", [AuthService])
|
|
474
|
+
__metadata("design:paramtypes", [])
|
|
477
475
|
], AbstractAuthController);
|
|
478
476
|
|
|
479
477
|
class AuthCacheAdapter {
|
package/dist/hemia-auth-sdk.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('reflect-metadata');
|
|
4
3
|
var common = require('@hemia/common');
|
|
5
4
|
var networkServices = require('@hemia/network-services');
|
|
6
5
|
var jwtManager = require('@hemia/jwt-manager');
|
|
@@ -316,16 +315,14 @@ exports.AuthService = __decorate([
|
|
|
316
315
|
jwtManager.JwtManager])
|
|
317
316
|
], exports.AuthService);
|
|
318
317
|
|
|
319
|
-
const AUTH_SERVICE_ID = Symbol.for(
|
|
318
|
+
const AUTH_SERVICE_ID = Symbol.for('HemiaAuthService');
|
|
320
319
|
|
|
321
320
|
/**
|
|
322
321
|
* Controller Abstracto Reutilizable
|
|
323
322
|
* Gestiona automáticamente Login, Callback, Me y Logout.
|
|
324
323
|
*/
|
|
325
324
|
exports.AbstractAuthController = class AbstractAuthController {
|
|
326
|
-
constructor(
|
|
327
|
-
this.authService = authService;
|
|
328
|
-
}
|
|
325
|
+
constructor() { }
|
|
329
326
|
async login(req, res) {
|
|
330
327
|
try {
|
|
331
328
|
const autoParam = typeof req.query.auto === 'string' ? req.query.auto : 'false';
|
|
@@ -442,10 +439,12 @@ exports.AbstractAuthController = class AbstractAuthController {
|
|
|
442
439
|
return res.status(200).json({ success: true });
|
|
443
440
|
}
|
|
444
441
|
};
|
|
442
|
+
__decorate([
|
|
443
|
+
inversify.inject(AUTH_SERVICE_ID),
|
|
444
|
+
__metadata("design:type", exports.AuthService)
|
|
445
|
+
], exports.AbstractAuthController.prototype, "authService", void 0);
|
|
445
446
|
__decorate([
|
|
446
447
|
common.Get('/login'),
|
|
447
|
-
__param(0, common.Req()),
|
|
448
|
-
__param(1, common.Res()),
|
|
449
448
|
__metadata("design:type", Function),
|
|
450
449
|
__metadata("design:paramtypes", [Object, Object]),
|
|
451
450
|
__metadata("design:returntype", Promise)
|
|
@@ -474,8 +473,7 @@ __decorate([
|
|
|
474
473
|
], exports.AbstractAuthController.prototype, "logout", null);
|
|
475
474
|
exports.AbstractAuthController = __decorate([
|
|
476
475
|
inversify.injectable(),
|
|
477
|
-
|
|
478
|
-
__metadata("design:paramtypes", [exports.AuthService])
|
|
476
|
+
__metadata("design:paramtypes", [])
|
|
479
477
|
], exports.AbstractAuthController);
|
|
480
478
|
|
|
481
479
|
class AuthCacheAdapter {
|
|
@@ -6,7 +6,7 @@ import { AuthService } from "../services/auth.service";
|
|
|
6
6
|
*/
|
|
7
7
|
export declare abstract class AbstractAuthController {
|
|
8
8
|
protected readonly authService: AuthService;
|
|
9
|
-
constructor(
|
|
9
|
+
constructor();
|
|
10
10
|
login(req: Request, res: Response): Promise<void>;
|
|
11
11
|
callback(req: Request, res: Response): Promise<void>;
|
|
12
12
|
me(req: Request, res: Response): Promise<Response>;
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hemia/auth-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Hemia SDK for authentication",
|
|
5
5
|
"main": "dist/hemia-auth-sdk.js",
|
|
6
6
|
"module": "dist/hemia-auth-sdk.esm.js",
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
"test:watch": "jest --watch"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
+
"@hemia/cache-manager": "^0.0.5",
|
|
18
|
+
"@hemia/common": "^0.0.2",
|
|
19
|
+
"@hemia/jwt-manager": "^0.0.4",
|
|
20
|
+
"@hemia/network-services": "^0.0.3",
|
|
17
21
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
18
22
|
"@rollup/plugin-json": "^6.1.0",
|
|
19
23
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
24
|
+
"@types/express": "^4.17.21",
|
|
20
25
|
"@types/jest": "^29.5.14",
|
|
21
26
|
"@types/node": "^22.3.0",
|
|
22
27
|
"@typescript-eslint/eslint-plugin": "^8.5.0",
|
|
23
|
-
"@hemia/network-services": "^0.0.3",
|
|
24
|
-
"@hemia/common": "^0.0.2",
|
|
25
|
-
"@hemia/cache-manager": "^0.0.5",
|
|
26
|
-
"@hemia/jwt-manager": "^0.0.4",
|
|
27
|
-
"@types/express": "^4.17.21",
|
|
28
|
-
"express": "^5.2.1",
|
|
29
28
|
"events": "^3.3.0",
|
|
29
|
+
"express": "^5.2.1",
|
|
30
30
|
"inversify": "^7.11.0",
|
|
31
31
|
"jest": "^29.7.0",
|
|
32
32
|
"rimraf": "^6.0.1",
|
|
@@ -42,14 +42,11 @@
|
|
|
42
42
|
"dist"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"
|
|
46
|
-
"inversify": "^7.11.0",
|
|
45
|
+
"@hemia/cache-manager": "^0.0.5",
|
|
47
46
|
"@hemia/common": "^0.0.2",
|
|
47
|
+
"@hemia/jwt-manager": "^0.0.4",
|
|
48
48
|
"@hemia/network-services": "^0.0.3",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
},
|
|
52
|
-
"dependencies": {
|
|
53
|
-
|
|
49
|
+
"inversify": "^7.11.0",
|
|
50
|
+
"reflect-metadata": "^0.2.2"
|
|
54
51
|
}
|
|
55
52
|
}
|