grm-shared-library 1.0.10 → 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.
Files changed (37) hide show
  1. package/dist/decorators/decorators.d.ts +3 -0
  2. package/dist/decorators/decorators.js +28 -0
  3. package/dist/index.d.ts +10 -18
  4. package/dist/index.js +10 -18
  5. package/dist/{dtos/contact-person → modules/organization/dtos}/contact-person.dto.js +2 -2
  6. package/dist/{dtos/organization → modules/organization/dtos}/create-organization.dto.d.ts +2 -2
  7. package/dist/{dtos/organization → modules/organization/dtos}/create-organization.dto.js +3 -3
  8. package/dist/{interfaces → modules/organization/interfaces}/organization.d.ts +1 -1
  9. package/dist/{dtos/user → modules/user/dtos}/create-user.dto.d.ts +1 -1
  10. package/dist/{dtos/user → modules/user/dtos}/create-user.dto.js +3 -1
  11. package/package.json +1 -1
  12. package/dist/kafka/client-ids/index.d.ts +0 -4
  13. package/dist/kafka/client-ids/index.js +0 -7
  14. package/dist/kafka/group-ids/index.d.ts +0 -4
  15. package/dist/kafka/group-ids/index.js +0 -7
  16. package/dist/kafka/service-tokens/index.d.ts +0 -4
  17. package/dist/kafka/service-tokens/index.js +0 -7
  18. package/dist/topics/index.d.ts +0 -3
  19. package/dist/topics/index.js +0 -6
  20. /package/dist/{utilities/decorators.d.ts → decorators/case-decorators.d.ts} +0 -0
  21. /package/dist/{utilities/decorators.js → decorators/case-decorators.js} +0 -0
  22. /package/dist/{dtos/location → modules/common/dtos}/map-address.dto.d.ts +0 -0
  23. /package/dist/{dtos/location → modules/common/dtos}/map-address.dto.js +0 -0
  24. /package/dist/{dtos/location → modules/common/dtos}/map-location.dto.d.ts +0 -0
  25. /package/dist/{dtos/location → modules/common/dtos}/map-location.dto.js +0 -0
  26. /package/dist/{dtos/contact-person → modules/organization/dtos}/contact-person.dto.d.ts +0 -0
  27. /package/dist/{dtos/organization → modules/organization/dtos}/update-organization.dto.d.ts +0 -0
  28. /package/dist/{dtos/organization → modules/organization/dtos}/update-organization.dto.js +0 -0
  29. /package/dist/{enums → modules/organization/enums}/org-status.enum.d.ts +0 -0
  30. /package/dist/{enums → modules/organization/enums}/org-status.enum.js +0 -0
  31. /package/dist/{interfaces → modules/organization/interfaces}/organization.js +0 -0
  32. /package/dist/{dtos/user → modules/user/dtos}/update-user.dto.d.ts +0 -0
  33. /package/dist/{dtos/user → modules/user/dtos}/update-user.dto.js +0 -0
  34. /package/dist/{enums → modules/user/enums}/user-role.enum.d.ts +0 -0
  35. /package/dist/{enums → modules/user/enums}/user-role.enum.js +0 -0
  36. /package/dist/{interfaces → modules/user/interfaces}/user.d.ts +0 -0
  37. /package/dist/{interfaces → modules/user/interfaces}/user.js +0 -0
@@ -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
@@ -1,29 +1,21 @@
1
1
  /**
2
- * DTOs
2
+ * Organization
3
3
  */
4
- export * from './dtos/user/create-user.dto';
5
- export * from './dtos/user/update-user.dto';
6
- export * from './dtos/organization/create-organization.dto';
7
- export * from './dtos/organization/update-organization.dto';
8
- export * from './dtos/location/map-location.dto';
9
- export * from './dtos/location/map-address.dto';
4
+ export * from './modules/organization/dtos/create-organization.dto';
5
+ export * from './modules/organization/dtos/update-organization.dto';
6
+ export * from './modules/organization/dtos/contact-person.dto';
7
+ export * from './modules/organization/interfaces/organization';
8
+ export * from './modules/organization/enums/org-status.enum';
10
9
  /**
11
- * Interfaces
10
+ * Common
12
11
  */
13
- export * from './interfaces/organization';
14
- /**
15
- * Enums
16
- */
17
- export * from './enums/user-role.enum';
18
- export * from './enums/org-status.enum';
12
+ export * from './modules/common/dtos/map-location.dto';
13
+ export * from './modules/common/dtos/map-address.dto';
19
14
  /**
20
15
  * Kafka
21
16
  */
22
17
  export * from './kafka/topics';
23
- export * from './kafka/group-ids';
24
- export * from './kafka/client-ids';
25
- export * from './kafka/service-tokens';
26
18
  /**
27
19
  * Utilities
28
20
  */
29
- export * from './utilities/decorators';
21
+ export * from './decorators/case-decorators';
package/dist/index.js CHANGED
@@ -15,31 +15,23 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /**
18
- * DTOs
18
+ * Organization
19
19
  */
20
- __exportStar(require("./dtos/user/create-user.dto"), exports);
21
- __exportStar(require("./dtos/user/update-user.dto"), exports);
22
- __exportStar(require("./dtos/organization/create-organization.dto"), exports);
23
- __exportStar(require("./dtos/organization/update-organization.dto"), exports);
24
- __exportStar(require("./dtos/location/map-location.dto"), exports);
25
- __exportStar(require("./dtos/location/map-address.dto"), exports);
20
+ __exportStar(require("./modules/organization/dtos/create-organization.dto"), exports);
21
+ __exportStar(require("./modules/organization/dtos/update-organization.dto"), exports);
22
+ __exportStar(require("./modules/organization/dtos/contact-person.dto"), exports);
23
+ __exportStar(require("./modules/organization/interfaces/organization"), exports);
24
+ __exportStar(require("./modules/organization/enums/org-status.enum"), exports);
26
25
  /**
27
- * Interfaces
26
+ * Common
28
27
  */
29
- __exportStar(require("./interfaces/organization"), exports);
30
- /**
31
- * Enums
32
- */
33
- __exportStar(require("./enums/user-role.enum"), exports);
34
- __exportStar(require("./enums/org-status.enum"), exports);
28
+ __exportStar(require("./modules/common/dtos/map-location.dto"), exports);
29
+ __exportStar(require("./modules/common/dtos/map-address.dto"), exports);
35
30
  /**
36
31
  * Kafka
37
32
  */
38
33
  __exportStar(require("./kafka/topics"), exports);
39
- __exportStar(require("./kafka/group-ids"), exports);
40
- __exportStar(require("./kafka/client-ids"), exports);
41
- __exportStar(require("./kafka/service-tokens"), exports);
42
34
  /**
43
35
  * Utilities
44
36
  */
45
- __exportStar(require("./utilities/decorators"), exports);
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,5 +1,5 @@
1
- import { MapAddressDto } from "../location/map-address.dto";
2
- import { ContactPersonDto } from "../contact-person/contact-person.dto";
1
+ import { MapAddressDto } from "../../common/dtos/map-address.dto";
2
+ import { ContactPersonDto } from "./contact-person.dto";
3
3
  export declare class CreateOrganizationDto {
4
4
  name: string;
5
5
  phoneNumber?: string;
@@ -12,9 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CreateOrganizationDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const class_transformer_1 = require("class-transformer");
15
- const map_address_dto_1 = require("../location/map-address.dto");
16
- const org_status_enum_1 = require("../../enums/org-status.enum");
17
- const contact_person_dto_1 = require("../contact-person/contact-person.dto");
15
+ const map_address_dto_1 = require("../../common/dtos/map-address.dto");
16
+ const org_status_enum_1 = require("../enums/org-status.enum");
17
+ const contact_person_dto_1 = require("./contact-person.dto");
18
18
  class CreateOrganizationDto {
19
19
  }
20
20
  exports.CreateOrganizationDto = CreateOrganizationDto;
@@ -1,4 +1,4 @@
1
- import { MapAddressDto } from "../dtos/location/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;
@@ -1,4 +1,4 @@
1
- import { UserRole } from "../../enums/user-role.enum";
1
+ import { UserRole } from "../enums/user-role.enum";
2
2
  export declare class CreateUserDto {
3
3
  name: string;
4
4
  email: string;
@@ -11,7 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CreateUserDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
- const user_role_enum_1 = require("../../enums/user-role.enum");
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.10",
3
+ "version": "1.0.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,4 +0,0 @@
1
- export declare const KAFKA_CLIENT_IDS: {
2
- API_SERVICE_ID: string;
3
- ORGANIZATION_SERVICE_ID: string;
4
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KAFKA_CLIENT_IDS = void 0;
4
- exports.KAFKA_CLIENT_IDS = {
5
- API_SERVICE_ID: 'api',
6
- ORGANIZATION_SERVICE_ID: 'organization'
7
- };
@@ -1,4 +0,0 @@
1
- export declare const KAFKA_GROUP_IDS: {
2
- API_CONSUMER: string;
3
- ORGANIZATION_CONSUMER: string;
4
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KAFKA_GROUP_IDS = void 0;
4
- exports.KAFKA_GROUP_IDS = {
5
- API_CONSUMER: 'api-consumer',
6
- ORGANIZATION_CONSUMER: 'organization-consumer',
7
- };
@@ -1,4 +0,0 @@
1
- export declare const SERVICE_TOKENS: {
2
- API_SERVICE: string;
3
- ORGANIZATION_SERVICE: string;
4
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SERVICE_TOKENS = void 0;
4
- exports.SERVICE_TOKENS = {
5
- API_SERVICE: 'API SERVICE',
6
- ORGANIZATION_SERVICE: 'ORGANIZATION_SERVICE'
7
- };
@@ -1,3 +0,0 @@
1
- export declare const KAFKA_TOPICS: {
2
- CREATE_ORG: string;
3
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KAFKA_TOPICS = void 0;
4
- exports.KAFKA_TOPICS = {
5
- CREATE_ORG: 'create.org'
6
- };