@hemia/auth-sdk 0.0.4 → 0.0.6

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.
@@ -122,15 +122,11 @@ class InvalidTokenFormatError extends SessionError {
122
122
  }
123
123
 
124
124
  let AuthService = class AuthService {
125
- // private networkServices: HMNetworkServices;
126
- // private jwtManager: JwtManager
127
125
  constructor(config, storage, networkServices, jwtManager) {
128
126
  this.config = config;
129
127
  this.storage = storage;
130
128
  this.networkServices = networkServices;
131
129
  this.jwtManager = jwtManager;
132
- // this.networkServices = new HMNetworkServices(this.config.ssoBaseUrl);
133
- // this.jwtManager = new JwtManager();
134
130
  }
135
131
  /**
136
132
  * Genera los parámetros necesarios para iniciar el login SSO
@@ -318,14 +314,16 @@ AuthService = __decorate([
318
314
  JwtManager])
319
315
  ], AuthService);
320
316
 
321
- const AUTH_SERVICE_ID = 'AuthService';
317
+ const AUTH_SERVICE_ID = Symbol.for("AuthService");
322
318
 
323
319
  /**
324
320
  * Controller Abstracto Reutilizable
325
321
  * Gestiona automáticamente Login, Callback, Me y Logout.
326
322
  */
327
323
  let AbstractAuthController = class AbstractAuthController {
328
- constructor() { }
324
+ constructor(authService) {
325
+ this.authService = authService;
326
+ }
329
327
  async login(req, res) {
330
328
  try {
331
329
  const autoParam = typeof req.query.auto === 'string' ? req.query.auto : 'false';
@@ -442,10 +440,6 @@ let AbstractAuthController = class AbstractAuthController {
442
440
  return res.status(200).json({ success: true });
443
441
  }
444
442
  };
445
- __decorate([
446
- inject(AUTH_SERVICE_ID),
447
- __metadata("design:type", AuthService)
448
- ], AbstractAuthController.prototype, "authService", void 0);
449
443
  __decorate([
450
444
  Get('/login'),
451
445
  __param(0, Req()),
@@ -478,7 +472,8 @@ __decorate([
478
472
  ], AbstractAuthController.prototype, "logout", null);
479
473
  AbstractAuthController = __decorate([
480
474
  injectable(),
481
- __metadata("design:paramtypes", [])
475
+ __param(0, inject(AUTH_SERVICE_ID)),
476
+ __metadata("design:paramtypes", [AuthService])
482
477
  ], AbstractAuthController);
483
478
 
484
479
  class AuthCacheAdapter {
@@ -124,15 +124,11 @@ class InvalidTokenFormatError extends SessionError {
124
124
  }
125
125
 
126
126
  exports.AuthService = class AuthService {
127
- // private networkServices: HMNetworkServices;
128
- // private jwtManager: JwtManager
129
127
  constructor(config, storage, networkServices, jwtManager) {
130
128
  this.config = config;
131
129
  this.storage = storage;
132
130
  this.networkServices = networkServices;
133
131
  this.jwtManager = jwtManager;
134
- // this.networkServices = new HMNetworkServices(this.config.ssoBaseUrl);
135
- // this.jwtManager = new JwtManager();
136
132
  }
137
133
  /**
138
134
  * Genera los parámetros necesarios para iniciar el login SSO
@@ -320,14 +316,16 @@ exports.AuthService = __decorate([
320
316
  jwtManager.JwtManager])
321
317
  ], exports.AuthService);
322
318
 
323
- const AUTH_SERVICE_ID = 'AuthService';
319
+ const AUTH_SERVICE_ID = Symbol.for("AuthService");
324
320
 
325
321
  /**
326
322
  * Controller Abstracto Reutilizable
327
323
  * Gestiona automáticamente Login, Callback, Me y Logout.
328
324
  */
329
325
  exports.AbstractAuthController = class AbstractAuthController {
330
- constructor() { }
326
+ constructor(authService) {
327
+ this.authService = authService;
328
+ }
331
329
  async login(req, res) {
332
330
  try {
333
331
  const autoParam = typeof req.query.auto === 'string' ? req.query.auto : 'false';
@@ -444,10 +442,6 @@ exports.AbstractAuthController = class AbstractAuthController {
444
442
  return res.status(200).json({ success: true });
445
443
  }
446
444
  };
447
- __decorate([
448
- inversify.inject(AUTH_SERVICE_ID),
449
- __metadata("design:type", exports.AuthService)
450
- ], exports.AbstractAuthController.prototype, "authService", void 0);
451
445
  __decorate([
452
446
  common.Get('/login'),
453
447
  __param(0, common.Req()),
@@ -480,7 +474,8 @@ __decorate([
480
474
  ], exports.AbstractAuthController.prototype, "logout", null);
481
475
  exports.AbstractAuthController = __decorate([
482
476
  inversify.injectable(),
483
- __metadata("design:paramtypes", [])
477
+ __param(0, inversify.inject(AUTH_SERVICE_ID)),
478
+ __metadata("design:paramtypes", [exports.AuthService])
484
479
  ], exports.AbstractAuthController);
485
480
 
486
481
  class AuthCacheAdapter {
@@ -1 +1 @@
1
- export declare const AUTH_SERVICE_ID = "AuthService";
1
+ export declare const AUTH_SERVICE_ID: unique symbol;
@@ -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
- protected constructor();
9
+ constructor(authService: AuthService);
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hemia/auth-sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Hemia SDK for authentication",
5
5
  "main": "dist/hemia-auth-sdk.js",
6
6
  "module": "dist/hemia-auth-sdk.esm.js",