grm-shared-library 1.0.11 → 1.0.12

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,3 @@
1
+ export declare function SentenceCase(): PropertyDecorator;
2
+ export declare function UpperCase(): PropertyDecorator;
3
+ export declare function LowerCase(): PropertyDecorator;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SentenceCase = SentenceCase;
4
+ exports.UpperCase = UpperCase;
5
+ exports.LowerCase = LowerCase;
6
+ const class_transformer_1 = require("class-transformer");
7
+ function SentenceCase() {
8
+ return (0, class_transformer_1.Transform)(({ value }) => {
9
+ if (typeof value !== 'string') {
10
+ return value;
11
+ }
12
+ return value
13
+ .split(' ')
14
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
15
+ .join(' ');
16
+ });
17
+ }
18
+ function UpperCase() {
19
+ return (0, class_transformer_1.Transform)(({ value }) => {
20
+ if (typeof value !== 'string') {
21
+ return value;
22
+ }
23
+ return value.toUpperCase();
24
+ });
25
+ }
26
+ function LowerCase() {
27
+ return (0, class_transformer_1.Transform)(({ value }) => typeof value === "string" ? value.toLowerCase() : value);
28
+ }
package/dist/index.d.ts CHANGED
@@ -15,3 +15,7 @@ export * from './modules/common/dtos/map-address.dto';
15
15
  * Kafka
16
16
  */
17
17
  export * from './kafka/topics';
18
+ /**
19
+ * Utilities
20
+ */
21
+ export * from './decorators/case-decorators';
package/dist/index.js CHANGED
@@ -31,3 +31,7 @@ __exportStar(require("./modules/common/dtos/map-address.dto"), exports);
31
31
  * Kafka
32
32
  */
33
33
  __exportStar(require("./kafka/topics"), exports);
34
+ /**
35
+ * Utilities
36
+ */
37
+ __exportStar(require("./decorators/case-decorators"), exports);
@@ -11,13 +11,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ContactPersonDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
- const decorators_1 = require("../../utilities/decorators");
14
+ const case_decorators_1 = require("../../../decorators/case-decorators");
15
15
  class ContactPersonDto {
16
16
  }
17
17
  exports.ContactPersonDto = ContactPersonDto;
18
18
  __decorate([
19
19
  (0, class_validator_1.IsString)(),
20
- (0, decorators_1.SentenceCase)(),
20
+ (0, case_decorators_1.SentenceCase)(),
21
21
  (0, class_validator_1.IsNotEmpty)(),
22
22
  __metadata("design:type", String)
23
23
  ], ContactPersonDto.prototype, "name", void 0);
@@ -1,4 +1,4 @@
1
- import { MapAddressDto } from "../modules/common/dtos/map-address.dto";
1
+ import { MapAddressDto } from "../../common/dtos/map-address.dto";
2
2
  export interface Organization {
3
3
  id: number;
4
4
  name: string;
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CreateUserDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const user_role_enum_1 = require("../enums/user-role.enum");
15
+ const case_decorators_1 = require("../../../decorators/case-decorators");
15
16
  class CreateUserDto {
16
17
  constructor() {
17
18
  this.role = user_role_enum_1.UserRole.USER;
@@ -22,6 +23,7 @@ __decorate([
22
23
  (0, class_validator_1.IsString)(),
23
24
  (0, class_validator_1.IsNotEmpty)(),
24
25
  (0, class_validator_1.MinLength)(2),
26
+ (0, case_decorators_1.SentenceCase)(),
25
27
  __metadata("design:type", String)
26
28
  ], CreateUserDto.prototype, "name", void 0);
27
29
  __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grm-shared-library",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [