@nick-cinema/common 1.1.2 → 1.1.6

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.
@@ -55,29 +55,38 @@ let GrpcModule = (() => {
55
55
  __runInitializers(_classThis, _classExtraInitializers);
56
56
  }
57
57
  static register(clients) {
58
+ const providers = clients.flatMap(token => {
59
+ const prefixedToken = `${grpc_constants_1.GRPC_CLIENT_PREFIX}_${token}`;
60
+ const cfg = grpc_registry_1.GRPC_CLIENTS[token];
61
+ return [
62
+ {
63
+ provide: prefixedToken,
64
+ useFactory: (grpcClientFactory, configService) => {
65
+ const url = configService.getOrThrow(cfg.env);
66
+ const client = grpcClientFactory.createClient({
67
+ package: cfg.package,
68
+ protoPath: cfg.protoPath,
69
+ url
70
+ });
71
+ grpcClientFactory.register(token, client);
72
+ return client;
73
+ },
74
+ inject: [grpc_client_factory_1.GrpcClientFactory, config_1.ConfigService]
75
+ },
76
+ {
77
+ provide: token,
78
+ useExisting: prefixedToken
79
+ }
80
+ ];
81
+ });
58
82
  return {
59
83
  module: GrpcModule,
60
- providers: [
84
+ providers: [grpc_client_factory_1.GrpcClientFactory, ...providers],
85
+ exports: [
61
86
  grpc_client_factory_1.GrpcClientFactory,
62
- ...clients.map(token => {
63
- const cfg = grpc_registry_1.GRPC_CLIENTS[token];
64
- return {
65
- provide: `${grpc_constants_1.GRPC_CLIENT_PREFIX}_${token}`,
66
- useFactory: (grpcClientFactory, configService) => {
67
- const url = configService.getOrThrow(cfg.env);
68
- const client = grpcClientFactory.createClient({
69
- package: cfg.package,
70
- protoPath: cfg.protoPath,
71
- url
72
- });
73
- grpcClientFactory.register(token, client);
74
- return client;
75
- },
76
- inject: [grpc_client_factory_1.GrpcClientFactory, config_1.ConfigService]
77
- };
78
- })
79
- ],
80
- exports: [grpc_client_factory_1.GrpcClientFactory, ...clients.map(token => `${grpc_constants_1.GRPC_CLIENT_PREFIX}_${token}`)]
87
+ ...clients.map(token => `${grpc_constants_1.GRPC_CLIENT_PREFIX}_${token}`),
88
+ ...clients
89
+ ]
81
90
  };
82
91
  }
83
92
  };
package/package.json CHANGED
@@ -1,11 +1,21 @@
1
1
  {
2
2
  "name": "@nick-cinema/common",
3
- "version": "1.1.2",
3
+ "version": "1.1.6",
4
4
  "description": "Core shared components for cinema project",
5
5
  "author": "Nick Frolov",
6
6
  "license": "ISC",
7
- "main": "dist/index.js",
8
- "types": "dist/index.d.ts",
7
+ "main": "dist/lib/index.js",
8
+ "types": "dist/lib/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/lib/index.d.ts",
12
+ "default": "./dist/lib/index.js"
13
+ },
14
+ "./grpc": {
15
+ "types": "./dist/grpc/index.d.ts",
16
+ "default": "./dist/grpc/index.js"
17
+ }
18
+ },
9
19
  "files": [
10
20
  "dist"
11
21
  ],
@@ -13,19 +23,30 @@
13
23
  "access": "public"
14
24
  },
15
25
  "scripts": {
26
+ "clean": "rm -rf dist",
16
27
  "build": "tsc -p tsconfig.build.json",
17
- "prepack": "yarn run build"
28
+ "prepack": "yarn run clean && yarn run build"
18
29
  },
19
- "dependencies": {
20
- "@nestjs/common": "^11.1.17",
21
- "@nestjs/config": "^4.0.3",
22
- "@nestjs/microservices": "^10.4.22",
23
- "@nick-cinema/proto-contracts": "^1.1.11"
30
+ "peerDependencies": {
31
+ "@nestjs/common": "^11.0.0",
32
+ "@nestjs/config": "^4.0.0",
33
+ "@nestjs/core": "^11.0.0",
34
+ "@nestjs/microservices": "^11.0.0",
35
+ "@nick-cinema/proto-contracts": "^1.1.12",
36
+ "reflect-metadata": "^0.2.2",
37
+ "rxjs": "^7.8.0"
24
38
  },
25
39
  "devDependencies": {
40
+ "@nestjs/common": "^11.1.17",
41
+ "@nestjs/config": "^4.0.3",
42
+ "@nestjs/core": "^11.1.17",
43
+ "@nestjs/microservices": "^11.1.17",
26
44
  "@nick-cinema/code-style": "^1.0.2",
45
+ "@nick-cinema/proto-contracts": "^1.1.12",
27
46
  "@types/node": "^25.2.0",
28
47
  "prettier": "^3.8.1",
48
+ "reflect-metadata": "^0.2.2",
49
+ "rxjs": "^7.8.2",
29
50
  "typescript": "^5.9.3"
30
51
  }
31
52
  }