@hodfords/nestjs-grpc-helper 10.1.1 → 10.2.1

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/README.md CHANGED
@@ -6,15 +6,6 @@
6
6
  <b>nestjs-grpc-helper</b> simplifies gRPC integration in NestJS, allowing seamless communication between services. It enables easy setup of gRPC clients and servers, and supports building SDK packages that any service can import and use, ensuring consistent API interaction across your microservices architecture.
7
7
  </p>
8
8
 
9
- ## Pre-Installation 🔧
10
-
11
- Before using nestjs-grpc-helper, you'll need to install the necessary gRPC dependencies. Follow
12
- [the official NestJS documentation](https://docs.nestjs.com/microservices/grpc) for gRPC setup by installing the required packages:
13
-
14
- ```bash
15
- npm install @grpc/grpc-js @grpc/proto-loader --save
16
- ```
17
-
18
9
  ## Installation 🤖
19
10
 
20
11
  Install the `nestjs-grpc-helper` package with:
@@ -1 +1 @@
1
- {"version":3,"file":"microservice-document.module.js","sourceRoot":"","sources":["../../../libs/documents/microservice-document.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAuD;AACvD,yFAAoF;AAEpF,yDAAsD;AACtD,uDAAyD;AACzD,gDAAwB;AACxB,2EAAsE;AAI/D,IAAM,0BAA0B,kCAAhC,MAAM,0BAA0B;IACnC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAiC;QACnD,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO;gBACH,MAAM,EAAE,4BAA0B;aACrC,CAAC;QACN,CAAC;QAED,IAAI,SAAS,GAAG,yBAAyB,CAAC;QAC1C,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,SAAS,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QACjD,CAAC;QAGD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3B,UAAU,CAAC,GAAG,EAAE;gBACZ,OAAO,CAAC;oBACJ,MAAM,EAAE,4BAA0B;oBAClC,SAAS,EAAE;wBACP;4BACI,OAAO,EAAE,kBAAkB;4BAC3B,QAAQ,EAAE,OAAO;yBACpB;wBACD,yCAAkB;qBACrB;oBACD,WAAW,EAAE,CAAC,iEAA8B,CAAC;oBAC7C,OAAO,EAAE;wBACL,6BAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;wBAC5E,gCAAiB,CAAC,OAAO,CAAC;4BACtB,QAAQ,EAAE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC;4BAChD,UAAU,EAAE,IAAI;4BAChB,SAAS,EAAE,SAAS;yBACvB,CAAC;qBACL;iBACJ,CAAC,CAAC;YACP,CAAC,EAAE,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAtCY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,0BAA0B,CAsCtC"}
1
+ {"version":3,"file":"microservice-document.module.js","sourceRoot":"","sources":["../../../libs/documents/microservice-document.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAuD;AACvD,yFAAoF;AAEpF,yDAAsD;AACtD,uDAAyD;AACzD,gDAAwB;AACxB,2EAAsE;AAG/D,IAAM,0BAA0B,kCAAhC,MAAM,0BAA0B;IACnC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAiC;QACnD,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO;gBACH,MAAM,EAAE,4BAA0B;aACrC,CAAC;QACN,CAAC;QAED,IAAI,SAAS,GAAG,yBAAyB,CAAC;QAC1C,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjB,SAAS,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QACjD,CAAC;QAGD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3B,UAAU,CAAC,GAAG,EAAE;gBACZ,OAAO,CAAC;oBACJ,MAAM,EAAE,4BAA0B;oBAClC,SAAS,EAAE;wBACP;4BACI,OAAO,EAAE,kBAAkB;4BAC3B,QAAQ,EAAE,OAAO;yBACpB;wBACD,yCAAkB;qBACrB;oBACD,WAAW,EAAE,CAAC,iEAA8B,CAAC;oBAC7C,OAAO,EAAE;wBACL,6BAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;wBAC5E,gCAAiB,CAAC,OAAO,CAAC;4BACtB,QAAQ,EAAE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC;4BAChD,UAAU,EAAE,IAAI;4BAChB,SAAS,EAAE,SAAS;yBACvB,CAAC;qBACL;iBACJ,CAAC,CAAC;YACP,CAAC,EAAE,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAtCY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,0BAA0B,CAsCtC"}
@@ -1,32 +1,9 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.sample = sample;
27
4
  const property_helper_1 = require("./property.helper");
28
5
  const class_transformer_1 = require("class-transformer");
29
- const faker = __importStar(require("faker"));
6
+ const faker_1 = require("@faker-js/faker");
30
7
  const lodash_1 = require("lodash");
31
8
  function getData(option) {
32
9
  const { mock } = option;
@@ -40,7 +17,7 @@ function getData(option) {
40
17
  return sample(option.type);
41
18
  }
42
19
  if (mock.method && mock.method.startsWith('faker.')) {
43
- const method = (0, lodash_1.get)({ faker }, mock.method);
20
+ const method = (0, lodash_1.get)({ faker: faker_1.faker }, mock.method);
44
21
  return method(...mock.args);
45
22
  }
46
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mock.helper.js","sourceRoot":"","sources":["../../../libs/helpers/mock.helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,wBAWC;AAnCD,uDAAyD;AACzD,yDAAoD;AACpD,6CAA+B;AAC/B,mCAA6B;AAG7B,SAAS,OAAO,CAAC,MAA0B;IACvC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IACxB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CA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declare function getClassHasProperties(): IterableIterator<Function>;
2
+ export declare function getClassHasProperties(): MapIterator<Function>;
3
3
  export declare function addPropertyToStorage(constructor: Function, propertyName: string, option: PropertyOptionType): void;
4
4
  export declare function extractProperties(): Record<string, {
5
5
  option: PropertyOptionType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hodfords/nestjs-grpc-helper",
3
- "version": "10.1.1",
3
+ "version": "10.2.1",
4
4
  "description": "A utility for simplifying gRPC integration and communication in NestJS applications",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -31,42 +31,46 @@
31
31
  "cspell": "cspell",
32
32
  "lint-staged": "lint-staged"
33
33
  },
34
+ "dependencies": {
35
+ "@grpc/grpc-js": "^1.11.3",
36
+ "@grpc/proto-loader": "^0.7.13",
37
+ "@faker-js/faker": "^9.0.1"
38
+ },
39
+ "peerDependencies": {
40
+ "@grpc/grpc-js": "^1.11.3",
41
+ "@grpc/proto-loader": "^0.7.13",
42
+ "@faker-js/faker": "^9.0.1"
43
+ },
34
44
  "devDependencies": {
35
- "@hodfords/nestjs-cls-translation": "10.1.0",
36
- "@hodfords/nestjs-command": "10.1.0",
37
- "@hodfords/nestjs-response": "10.2.1",
38
- "@grpc/grpc-js": "1.11.1",
39
- "@grpc/proto-loader": "0.7.13",
40
- "@nestjs/cli": "10.4.4",
41
- "@nestjs/common": "10.4.1",
42
- "@nestjs/core": "10.4.1",
43
- "@nestjs/microservices": "10.4.1",
44
- "@nestjs/platform-express": "10.4.1",
45
+ "@hodfords/nestjs-cls-translation": "10.1.1",
46
+ "@hodfords/nestjs-command": "10.1.1",
47
+ "@hodfords/nestjs-eslint-config": "10.0.4",
48
+ "@hodfords/nestjs-prettier-config": "10.0.1",
49
+ "@hodfords/nestjs-response": "10.2.2",
50
+ "@nestjs/cli": "10.4.5",
51
+ "@nestjs/common": "10.4.3",
52
+ "@nestjs/core": "10.4.3",
53
+ "@nestjs/microservices": "10.4.3",
54
+ "@nestjs/platform-express": "10.4.3",
45
55
  "@nestjs/schematics": "10.1.4",
46
56
  "@nestjs/serve-static": "4.0.2",
47
- "@nestjs/swagger": "7.4.0",
48
- "@nestjs/testing": "10.4.1",
57
+ "@nestjs/swagger": "7.4.2",
58
+ "@nestjs/testing": "10.4.3",
49
59
  "@nestjs/typeorm": "10.0.2",
50
60
  "@types/express": "4.17.21",
51
- "@types/faker": "6.6.9",
52
- "@types/jest": "29.5.12",
61
+ "@types/jest": "29.5.13",
53
62
  "@types/lodash": "4.17.7",
54
- "@types/node": "22.5.0",
63
+ "@types/node": "22.5.5",
55
64
  "@types/supertest": "6.0.2",
56
- "@typescript-eslint/eslint-plugin": "8.3.0",
57
- "@typescript-eslint/parser": "8.3.0",
58
- "auto-changelog": "2.4.0",
65
+ "auto-changelog": "2.5.0",
59
66
  "class-transformer": "0.5.1",
60
67
  "class-validator": "0.14.1",
61
- "cspell": "8.14.2",
62
- "eslint": "8.57.0",
63
- "eslint-config-prettier": "9.1.0",
64
- "eslint-plugin-prettier": "5.2.1",
65
- "faker": "6.6.6",
66
- "husky": "9.1.5",
68
+ "cspell": "8.14.4",
69
+ "eslint": "9.11.0",
70
+ "husky": "9.1.6",
67
71
  "is-ci": "3.0.1",
68
72
  "jest": "29.7.0",
69
- "lint-staged": "15.2.9",
73
+ "lint-staged": "15.2.10",
70
74
  "lodash": "4.17.21",
71
75
  "reflect-metadata": "0.2.2",
72
76
  "rimraf": "6.0.1",
@@ -78,7 +82,7 @@
78
82
  "ts-node": "10.9.2",
79
83
  "tsconfig-paths": "4.2.0",
80
84
  "typeorm": "0.3.20",
81
- "typescript": "5.5.4"
85
+ "typescript": "5.6.2"
82
86
  },
83
87
  "jest": {
84
88
  "moduleFileExtensions": [
@@ -1,7 +1,8 @@
1
+ import { Faker } from '@faker-js/faker';
1
2
  type NestedKeyOf<ObjectType extends object> = {
2
3
  [Key in keyof ObjectType & (string | number)]: ObjectType[Key] extends object ? `${Key}` | `${Key}.${NestedKeyOf<ObjectType[Key]>}` : `${Key}`;
3
4
  }[keyof ObjectType & (string | number)];
4
- export type MockMethodType = `faker.${NestedKeyOf<Faker.FakerStatic>}`;
5
+ export type MockMethodType = `faker.${NestedKeyOf<Faker>}`;
5
6
  export type MockOptionType = {
6
7
  method?: MockMethodType;
7
8
  args?: any[];