grm-shared-library 1.0.52 → 1.0.54

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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Modules
3
3
  */
4
+ export * from './modules/auth/index';
4
5
  export * from './modules/organization/index';
5
6
  export * from './modules/common/index';
6
7
  export * from './modules/permission/index';
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /**
18
18
  * Modules
19
19
  */
20
+ __exportStar(require("./modules/auth/index"), exports);
20
21
  __exportStar(require("./modules/organization/index"), exports);
21
22
  __exportStar(require("./modules/common/index"), exports);
22
23
  __exportStar(require("./modules/permission/index"), exports);
@@ -1,4 +1,10 @@
1
1
  export declare const KAFKA_TOPICS: {
2
+ USER_REGISTERED: string;
3
+ USER_LOGGED_IN: string;
4
+ USER_LOGGED_OUT: string;
5
+ USER_CREATED: string;
6
+ USER_UPDATED: string;
7
+ USER_DELETED: string;
2
8
  ORG_CREATED: string;
3
9
  ORG_UPDATED: string;
4
10
  ORG_DELETED: string;
@@ -2,6 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KAFKA_TOPICS = void 0;
4
4
  exports.KAFKA_TOPICS = {
5
+ // Auth
6
+ USER_REGISTERED: 'user.registered',
7
+ USER_LOGGED_IN: 'user.logged.in',
8
+ USER_LOGGED_OUT: 'user.logged.out',
9
+ // User
10
+ USER_CREATED: 'user.created',
11
+ USER_UPDATED: 'user.updated',
12
+ USER_DELETED: 'user.deleted',
13
+ // Org
5
14
  ORG_CREATED: 'org.created',
6
15
  ORG_UPDATED: 'org.updated',
7
16
  ORG_DELETED: 'org.deleted',
@@ -0,0 +1,5 @@
1
+ export declare class ChangePasswordDto {
2
+ oldPassword: string;
3
+ newPassword: string;
4
+ confirmPassword: string;
5
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ChangePasswordDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const password_regex_const_1 = require("../../common/constants/password-regex.const");
15
+ const match_decorator_1 = require("../validators/match.decorator");
16
+ class ChangePasswordDto {
17
+ }
18
+ exports.ChangePasswordDto = ChangePasswordDto;
19
+ __decorate([
20
+ (0, class_validator_1.IsString)(),
21
+ (0, class_validator_1.IsNotEmpty)(),
22
+ __metadata("design:type", String)
23
+ ], ChangePasswordDto.prototype, "oldPassword", void 0);
24
+ __decorate([
25
+ (0, class_validator_1.IsString)(),
26
+ (0, class_validator_1.IsNotEmpty)(),
27
+ (0, class_validator_1.MinLength)(8),
28
+ (0, class_validator_1.Matches)(password_regex_const_1.PASSWORD_REGEX, { message: password_regex_const_1.PASSWORD_ERROR_MESSAGE }),
29
+ __metadata("design:type", String)
30
+ ], ChangePasswordDto.prototype, "newPassword", void 0);
31
+ __decorate([
32
+ (0, class_validator_1.IsString)(),
33
+ (0, class_validator_1.IsNotEmpty)(),
34
+ (0, class_validator_1.MinLength)(8),
35
+ (0, class_validator_1.Matches)(password_regex_const_1.PASSWORD_REGEX, { message: password_regex_const_1.PASSWORD_ERROR_MESSAGE }),
36
+ (0, match_decorator_1.Match)('newPassword', { message: 'Passwords do not match' }),
37
+ __metadata("design:type", String)
38
+ ], ChangePasswordDto.prototype, "confirmPassword", void 0);
@@ -0,0 +1,4 @@
1
+ export declare class LoginDto {
2
+ email: string;
3
+ password: string;
4
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LoginDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const password_regex_const_1 = require("../../common/constants/password-regex.const");
15
+ class LoginDto {
16
+ }
17
+ exports.LoginDto = LoginDto;
18
+ __decorate([
19
+ (0, class_validator_1.IsEmail)(),
20
+ (0, class_validator_1.IsNotEmpty)(),
21
+ __metadata("design:type", String)
22
+ ], LoginDto.prototype, "email", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsString)(),
25
+ (0, class_validator_1.IsNotEmpty)(),
26
+ (0, class_validator_1.MinLength)(8),
27
+ (0, class_validator_1.Matches)(password_regex_const_1.PASSWORD_REGEX, { message: password_regex_const_1.PASSWORD_ERROR_MESSAGE }),
28
+ __metadata("design:type", String)
29
+ ], LoginDto.prototype, "password", void 0);
@@ -0,0 +1,6 @@
1
+ import { CreateOrganizationDto } from "../../organization";
2
+ import { CreateUserDto } from "../../user";
3
+ export declare class RegisterDto {
4
+ organization: CreateOrganizationDto;
5
+ user: CreateUserDto;
6
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RegisterDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const organization_1 = require("../../organization");
15
+ const user_1 = require("../../user");
16
+ const class_transformer_1 = require("class-transformer");
17
+ class RegisterDto {
18
+ }
19
+ exports.RegisterDto = RegisterDto;
20
+ __decorate([
21
+ (0, class_validator_1.ValidateNested)(),
22
+ (0, class_transformer_1.Type)(() => organization_1.CreateOrganizationDto),
23
+ (0, class_validator_1.IsNotEmpty)({
24
+ message: 'All Organization details must be provided'
25
+ }),
26
+ __metadata("design:type", organization_1.CreateOrganizationDto)
27
+ ], RegisterDto.prototype, "organization", void 0);
28
+ __decorate([
29
+ (0, class_validator_1.ValidateNested)(),
30
+ (0, class_transformer_1.Type)(() => user_1.CreateUserDto),
31
+ (0, class_validator_1.IsNotEmpty)({
32
+ message: 'All User details must be provided'
33
+ }),
34
+ __metadata("design:type", user_1.CreateUserDto)
35
+ ], RegisterDto.prototype, "user", void 0);
@@ -0,0 +1,4 @@
1
+ export declare class SetPasswordDto {
2
+ password: string;
3
+ confirmPassword: string;
4
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SetPasswordDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const match_decorator_1 = require("../validators/match.decorator");
15
+ const password_regex_const_1 = require("../../common/constants/password-regex.const");
16
+ class SetPasswordDto {
17
+ }
18
+ exports.SetPasswordDto = SetPasswordDto;
19
+ __decorate([
20
+ (0, class_validator_1.IsString)(),
21
+ (0, class_validator_1.IsNotEmpty)(),
22
+ (0, class_validator_1.MinLength)(8),
23
+ (0, class_validator_1.Matches)(password_regex_const_1.PASSWORD_REGEX, { message: password_regex_const_1.PASSWORD_ERROR_MESSAGE }),
24
+ __metadata("design:type", String)
25
+ ], SetPasswordDto.prototype, "password", void 0);
26
+ __decorate([
27
+ (0, class_validator_1.IsString)(),
28
+ (0, class_validator_1.IsNotEmpty)(),
29
+ (0, class_validator_1.MinLength)(8),
30
+ (0, class_validator_1.Matches)(password_regex_const_1.PASSWORD_REGEX, { message: password_regex_const_1.PASSWORD_ERROR_MESSAGE }),
31
+ (0, match_decorator_1.Match)('password', { message: 'Passwords do not match' }),
32
+ __metadata("design:type", String)
33
+ ], SetPasswordDto.prototype, "confirmPassword", void 0);
@@ -0,0 +1,4 @@
1
+ export * from './dtos/register.dto';
2
+ export * from './dtos/login.dto';
3
+ export * from './dtos/set-password.dto';
4
+ export * from './dtos/change-password.dto';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./dtos/register.dto"), exports);
18
+ __exportStar(require("./dtos/login.dto"), exports);
19
+ __exportStar(require("./dtos/set-password.dto"), exports);
20
+ __exportStar(require("./dtos/change-password.dto"), exports);
@@ -0,0 +1,2 @@
1
+ import { ValidationOptions } from "class-validator";
2
+ export declare function Match(property: string, validationOptions?: ValidationOptions): (object: Object, propertyName: string) => void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Match = Match;
4
+ const class_validator_1 = require("class-validator");
5
+ function Match(property, validationOptions) {
6
+ return function (object, propertyName) {
7
+ (0, class_validator_1.registerDecorator)({
8
+ name: "Match",
9
+ target: object.constructor,
10
+ propertyName: propertyName,
11
+ constraints: [property],
12
+ options: validationOptions,
13
+ validator: {
14
+ validate(value, args) {
15
+ const relatedValue = args.object[args.constraints[0]];
16
+ return value === relatedValue;
17
+ },
18
+ defaultMessage(args) {
19
+ return `${args.property} must match ${args.constraints[0]}`;
20
+ },
21
+ },
22
+ });
23
+ };
24
+ }
@@ -0,0 +1,3 @@
1
+ declare const PASSWORD_REGEX: RegExp;
2
+ declare const PASSWORD_ERROR_MESSAGE = "Password must contain at least 1 uppercase letter, 1 lowercase letter, and 1 number or special character";
3
+ export { PASSWORD_REGEX, PASSWORD_ERROR_MESSAGE };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PASSWORD_ERROR_MESSAGE = exports.PASSWORD_REGEX = void 0;
4
+ const PASSWORD_REGEX = /((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/;
5
+ exports.PASSWORD_REGEX = PASSWORD_REGEX;
6
+ const PASSWORD_ERROR_MESSAGE = 'Password must contain at least 1 uppercase letter, 1 lowercase letter, and 1 number or special character';
7
+ exports.PASSWORD_ERROR_MESSAGE = PASSWORD_ERROR_MESSAGE;
@@ -13,6 +13,7 @@ exports.CreateUserDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const case_decorators_1 = require("../../../decorators/case-decorators");
15
15
  const user_status_enum_1 = require("../enums/user-status.enum");
16
+ const password_regex_const_1 = require("../../common/constants/password-regex.const");
16
17
  class CreateUserDto {
17
18
  }
18
19
  exports.CreateUserDto = CreateUserDto;
@@ -45,9 +46,7 @@ __decorate([
45
46
  __decorate([
46
47
  (0, class_validator_1.IsString)(),
47
48
  (0, class_validator_1.MinLength)(8),
48
- (0, class_validator_1.Matches)(/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/, {
49
- message: 'Password must contain at least 1 uppercase letter, 1 lowercase letter, and 1 number or special character',
50
- }),
49
+ (0, class_validator_1.Matches)(password_regex_const_1.PASSWORD_REGEX, { message: password_regex_const_1.PASSWORD_ERROR_MESSAGE }),
51
50
  (0, class_validator_1.IsOptional)(),
52
51
  __metadata("design:type", String)
53
52
  ], CreateUserDto.prototype, "password", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grm-shared-library",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [