@vuvannghiawork/common 0.0.29 → 0.0.30

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.
@@ -0,0 +1 @@
1
+ export declare function Auth(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Auth = Auth;
4
+ const common_1 = require("@nestjs/common");
5
+ const jwt_auth_guard_1 = require("../guards/jwt-auth.guard");
6
+ function Auth() {
7
+ return (0, common_1.applyDecorators)((0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard));
8
+ }
9
+ //# sourceMappingURL=current-user.decorator%20copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"current-user.decorator copy.js","sourceRoot":"","sources":["../../src/decorators/current-user.decorator copy.ts"],"names":[],"mappings":";;AAIA,oBAIC;AARD,2CAA4D;AAC5D,6DAAyD;AAGzD,SAAgB,IAAI;IAClB,OAAO,IAAA,wBAAe,EACpB,IAAA,kBAAS,EAAC,6BAAY,CAAC,CACxB,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"current-user.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-user.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAE3D,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC7C,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;IACvC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"current-user.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-user.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAI3D,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC7C,CAAC,IAAa,EAAE,GAAqB,EAAe,EAAE;IACpD,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC,CACF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  export * from './constants/auth-strategy.constant';
2
2
  export * from './constants/swagger.constant';
3
3
  export * from './controllers/base-app.controller';
4
+ export * from './decorators/current-user.decorator copy';
4
5
  export * from './decorators/current-user.decorator';
5
6
  export * from './filters/error-handler.filter';
6
7
  export * from './guards/jwt-auth.guard';
7
8
  export * from './helpers/bootstrap.helper';
8
9
  export * from './helpers/swagger.helper';
9
10
  export * from './interfaces/jwt-payload.interface';
11
+ export * from './interfaces/user-payload.interface';
10
12
  export * from './middlewares/logger.middleware';
11
13
  export * from './modules/base-auth.module';
12
14
  export * from './strategies/base-jwt.strategy';
package/dist/index.js CHANGED
@@ -17,12 +17,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./constants/auth-strategy.constant"), exports);
18
18
  __exportStar(require("./constants/swagger.constant"), exports);
19
19
  __exportStar(require("./controllers/base-app.controller"), exports);
20
+ __exportStar(require("./decorators/current-user.decorator copy"), exports);
20
21
  __exportStar(require("./decorators/current-user.decorator"), exports);
21
22
  __exportStar(require("./filters/error-handler.filter"), exports);
22
23
  __exportStar(require("./guards/jwt-auth.guard"), exports);
23
24
  __exportStar(require("./helpers/bootstrap.helper"), exports);
24
25
  __exportStar(require("./helpers/swagger.helper"), exports);
25
26
  __exportStar(require("./interfaces/jwt-payload.interface"), exports);
27
+ __exportStar(require("./interfaces/user-payload.interface"), exports);
26
28
  __exportStar(require("./middlewares/logger.middleware"), exports);
27
29
  __exportStar(require("./modules/base-auth.module"), exports);
28
30
  __exportStar(require("./strategies/base-jwt.strategy"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,qEAAmD;AACnD,+DAA6C;AAC7C,oEAAkD;AAClD,sEAAoD;AACpD,iEAA+C;AAC/C,0DAAwC;AACxC,6DAA2C;AAC3C,2DAAyC;AACzC,qEAAmD;AACnD,kEAAgD;AAChD,6DAA2C;AAC3C,iEAA+C;AAC/C,mEAAiD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAIA,qEAAmD;AACnD,+DAA6C;AAC7C,oEAAkD;AAClD,2EAAyD;AACzD,sEAAoD;AACpD,iEAA+C;AAC/C,0DAAwC;AACxC,6DAA2C;AAC3C,2DAAyC;AACzC,qEAAmD;AACnD,sEAAoD;AACpD,kEAAgD;AAChD,6DAA2C;AAC3C,iEAA+C;AAC/C,mEAAiD"}
@@ -0,0 +1,4 @@
1
+ export interface UserPayload {
2
+ sub: number;
3
+ email: string;
4
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=user-payload.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-payload.interface.js","sourceRoot":"","sources":["../../src/interfaces/user-payload.interface.ts"],"names":[],"mappings":""}
@@ -17,9 +17,7 @@ exports.BaseAuthModule = BaseAuthModule;
17
17
  exports.BaseAuthModule = BaseAuthModule = __decorate([
18
18
  (0, common_1.Global)(),
19
19
  (0, common_1.Module)({
20
- imports: [
21
- passport_1.PassportModule.register({ defaultStrategy: auth_strategy_constant_1.AUTH_STRATEGY.JWT }),
22
- ],
20
+ imports: [passport_1.PassportModule.register({ defaultStrategy: auth_strategy_constant_1.AUTH_STRATEGY.JWT })],
23
21
  providers: [common_jwt_strategy_1.CommonJwtStrategy],
24
22
  exports: [passport_1.PassportModule, common_jwt_strategy_1.CommonJwtStrategy],
25
23
  })
@@ -1 +1 @@
1
- {"version":3,"file":"base-auth.module.js","sourceRoot":"","sources":["../../src/modules/base-auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAChD,+CAAkD;AAClD,gFAAqE;AACrE,2EAAuE;AAUhE,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAR1B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,yBAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,sCAAa,CAAC,GAAG,EAAE,CAAC;SAChE;QACD,SAAS,EAAE,CAAC,uCAAiB,CAAC;QAC9B,OAAO,EAAE,CAAC,yBAAc,EAAE,uCAAiB,CAAC;KAC7C,CAAC;GACW,cAAc,CAAG"}
1
+ {"version":3,"file":"base-auth.module.js","sourceRoot":"","sources":["../../src/modules/base-auth.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgD;AAChD,+CAAkD;AAClD,gFAAqE;AACrE,2EAAuE;AAQhE,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAN1B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,yBAAc,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,sCAAa,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1E,SAAS,EAAE,CAAC,uCAAiB,CAAC;QAC9B,OAAO,EAAE,CAAC,yBAAc,EAAE,uCAAiB,CAAC;KAC7C,CAAC;GACW,cAAc,CAAG"}
@@ -3,7 +3,7 @@ import { JwtPayload } from 'src/interfaces/jwt-payload.interface';
3
3
  export declare class CommonJwtStrategy extends BaseJwtStrategy {
4
4
  constructor();
5
5
  validate(payload: JwtPayload): Promise<{
6
- id: string;
6
+ sub: string;
7
7
  email: string;
8
8
  }>;
9
9
  }
@@ -21,7 +21,7 @@ let CommonJwtStrategy = class CommonJwtStrategy extends base_jwt_strategy_1.Base
21
21
  }
22
22
  async validate(payload) {
23
23
  return {
24
- id: payload.sub,
24
+ sub: payload.sub,
25
25
  email: payload.email,
26
26
  };
27
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"common-jwt.strategy.js","sourceRoot":"","sources":["../../src/strategies/common-jwt.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2DAAsD;AAI/C,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,mCAAe;IACpD;QACE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAmB;QAChC,OAAO;YACL,EAAE,EAAE,OAAO,CAAC,GAAG;YACf,KAAK,EAAE,OAAO,CAAC,KAAK;SAErB,CAAC;IACJ,CAAC;CACF,CAAA;AAfY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;;GACA,iBAAiB,CAe7B"}
1
+ {"version":3,"file":"common-jwt.strategy.js","sourceRoot":"","sources":["../../src/strategies/common-jwt.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2DAAsD;AAI/C,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,mCAAe;IACpD;QACE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAmB;QAChC,OAAO;YACL,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK,EAAE,OAAO,CAAC,KAAK;SAErB,CAAC;IACJ,CAAC;CACF,CAAA;AAfY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;;GACA,iBAAiB,CAe7B"}