geniebox-shared-lib 1.0.11 → 1.0.13

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.
@@ -2,9 +2,9 @@ import { OnModuleInit } from "@nestjs/common";
2
2
  import { ClientGrpc } from "@nestjs/microservices";
3
3
  import { AuthServiceClient } from "./auth.interface";
4
4
  export declare class AuthClient implements OnModuleInit {
5
- private client;
5
+ private readonly client;
6
6
  private readonly logger;
7
- private authClient;
7
+ private authClient?;
8
8
  constructor(client: ClientGrpc);
9
9
  onModuleInit(): void;
10
10
  get service(): AuthServiceClient;
@@ -19,15 +19,19 @@ let AuthClient = AuthClient_1 = class AuthClient {
19
19
  constructor(client) {
20
20
  this.client = client;
21
21
  this.logger = new common_1.Logger(AuthClient_1.name);
22
- this.authClient = null;
23
22
  }
24
23
  onModuleInit() {
25
24
  this.authClient = this.client.getService("AuthService");
26
- this.logger.log("AuthServiceClient initialized");
25
+ if (!this.authClient) {
26
+ this.logger.error("Failed to initialize AuthServiceClient");
27
+ throw new Error("AuthServiceClient initialization failed");
28
+ }
29
+ this.logger.log("AuthServiceClient initialized successfully");
27
30
  }
28
31
  get service() {
29
32
  if (!this.authClient) {
30
- throw new Error("AuthService not initialized yet");
33
+ this.logger.error("Tried to access AuthService before initialization");
34
+ throw new Error("AuthServiceClient not initialized yet");
31
35
  }
32
36
  return this.authClient;
33
37
  }
@@ -20,7 +20,6 @@ export interface AuthTokensResponse {
20
20
  userId: string;
21
21
  sessionId: string;
22
22
  email: string;
23
- accountId: string;
24
23
  tokens: Tokens | undefined;
25
24
  }
26
25
  export interface UserResponse {
@@ -29,7 +28,6 @@ export interface UserResponse {
29
28
  lastName: string;
30
29
  email: string;
31
30
  phoneNumber: string;
32
- accounts: string[];
33
31
  photoUrl: string;
34
32
  birthday: string;
35
33
  gender: string;
@@ -62,7 +60,7 @@ export declare const AUTH_SERVICE_NAME = "AuthService";
62
60
  export type AuthServiceService = typeof AuthServiceService;
63
61
  export declare const AuthServiceService: {
64
62
  readonly register: {
65
- readonly path: "/auth.AuthService/Register";
63
+ readonly path: "/auth.AuthService/register";
66
64
  readonly requestStream: false;
67
65
  readonly responseStream: false;
68
66
  readonly requestSerialize: (value: RegisterRequest) => Buffer;
@@ -71,7 +69,7 @@ export declare const AuthServiceService: {
71
69
  readonly responseDeserialize: (value: Buffer) => AuthTokensResponse;
72
70
  };
73
71
  readonly refreshToken: {
74
- readonly path: "/auth.AuthService/RefreshToken";
72
+ readonly path: "/auth.AuthService/refreshToken";
75
73
  readonly requestStream: false;
76
74
  readonly responseStream: false;
77
75
  readonly requestSerialize: (value: RefreshTokenRequest) => Buffer;
@@ -168,7 +168,7 @@ exports.Tokens = {
168
168
  },
169
169
  };
170
170
  function createBaseAuthTokensResponse() {
171
- return { userId: "", sessionId: "", email: "", accountId: "", tokens: undefined };
171
+ return { userId: "", sessionId: "", email: "", tokens: undefined };
172
172
  }
173
173
  exports.AuthTokensResponse = {
174
174
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -181,11 +181,8 @@ exports.AuthTokensResponse = {
181
181
  if (message.email !== "") {
182
182
  writer.uint32(26).string(message.email);
183
183
  }
184
- if (message.accountId !== "") {
185
- writer.uint32(34).string(message.accountId);
186
- }
187
184
  if (message.tokens !== undefined) {
188
- exports.Tokens.encode(message.tokens, writer.uint32(42).fork()).join();
185
+ exports.Tokens.encode(message.tokens, writer.uint32(34).fork()).join();
189
186
  }
190
187
  return writer;
191
188
  },
@@ -221,13 +218,6 @@ exports.AuthTokensResponse = {
221
218
  if (tag !== 34) {
222
219
  break;
223
220
  }
224
- message.accountId = reader.string();
225
- continue;
226
- }
227
- case 5: {
228
- if (tag !== 42) {
229
- break;
230
- }
231
221
  message.tokens = exports.Tokens.decode(reader, reader.uint32());
232
222
  continue;
233
223
  }
@@ -241,17 +231,7 @@ exports.AuthTokensResponse = {
241
231
  },
242
232
  };
243
233
  function createBaseUserResponse() {
244
- return {
245
- uuid: "",
246
- firstName: "",
247
- lastName: "",
248
- email: "",
249
- phoneNumber: "",
250
- accounts: [],
251
- photoUrl: "",
252
- birthday: "",
253
- gender: "",
254
- };
234
+ return { uuid: "", firstName: "", lastName: "", email: "", phoneNumber: "", photoUrl: "", birthday: "", gender: "" };
255
235
  }
256
236
  exports.UserResponse = {
257
237
  encode(message, writer = new wire_1.BinaryWriter()) {
@@ -270,17 +250,14 @@ exports.UserResponse = {
270
250
  if (message.phoneNumber !== "") {
271
251
  writer.uint32(42).string(message.phoneNumber);
272
252
  }
273
- for (const v of message.accounts) {
274
- writer.uint32(50).string(v);
275
- }
276
253
  if (message.photoUrl !== "") {
277
- writer.uint32(58).string(message.photoUrl);
254
+ writer.uint32(50).string(message.photoUrl);
278
255
  }
279
256
  if (message.birthday !== "") {
280
- writer.uint32(66).string(message.birthday);
257
+ writer.uint32(58).string(message.birthday);
281
258
  }
282
259
  if (message.gender !== "") {
283
- writer.uint32(74).string(message.gender);
260
+ writer.uint32(66).string(message.gender);
284
261
  }
285
262
  return writer;
286
263
  },
@@ -330,27 +307,20 @@ exports.UserResponse = {
330
307
  if (tag !== 50) {
331
308
  break;
332
309
  }
333
- message.accounts.push(reader.string());
310
+ message.photoUrl = reader.string();
334
311
  continue;
335
312
  }
336
313
  case 7: {
337
314
  if (tag !== 58) {
338
315
  break;
339
316
  }
340
- message.photoUrl = reader.string();
317
+ message.birthday = reader.string();
341
318
  continue;
342
319
  }
343
320
  case 8: {
344
321
  if (tag !== 66) {
345
322
  break;
346
323
  }
347
- message.birthday = reader.string();
348
- continue;
349
- }
350
- case 9: {
351
- if (tag !== 74) {
352
- break;
353
- }
354
324
  message.gender = reader.string();
355
325
  continue;
356
326
  }
@@ -466,7 +436,7 @@ function AuthServiceControllerMethods() {
466
436
  exports.AUTH_SERVICE_NAME = "AuthService";
467
437
  exports.AuthServiceService = {
468
438
  register: {
469
- path: "/auth.AuthService/Register",
439
+ path: "/auth.AuthService/register",
470
440
  requestStream: false,
471
441
  responseStream: false,
472
442
  requestSerialize: (value) => Buffer.from(exports.RegisterRequest.encode(value).finish()),
@@ -475,7 +445,7 @@ exports.AuthServiceService = {
475
445
  responseDeserialize: (value) => exports.AuthTokensResponse.decode(value),
476
446
  },
477
447
  refreshToken: {
478
- path: "/auth.AuthService/RefreshToken",
448
+ path: "/auth.AuthService/refreshToken",
479
449
  requestStream: false,
480
450
  responseStream: false,
481
451
  requestSerialize: (value) => Buffer.from(exports.RefreshTokenRequest.encode(value).finish()),
@@ -2,10 +2,11 @@ import { OnModuleInit } from "@nestjs/common";
2
2
  import { ClientGrpc } from "@nestjs/microservices";
3
3
  import { UserServiceClient } from "./user.interface";
4
4
  export declare class UsersClient implements OnModuleInit {
5
- private client;
5
+ private readonly client;
6
6
  private readonly logger;
7
- private userClient;
7
+ private userClient?;
8
8
  constructor(client: ClientGrpc);
9
9
  onModuleInit(): void;
10
10
  get service(): UserServiceClient;
11
+ isReady(): boolean;
11
12
  }
@@ -19,7 +19,6 @@ let UsersClient = UsersClient_1 = class UsersClient {
19
19
  constructor(client) {
20
20
  this.client = client;
21
21
  this.logger = new common_1.Logger(UsersClient_1.name);
22
- this.userClient = null;
23
22
  }
24
23
  onModuleInit() {
25
24
  this.userClient = this.client.getService("UserService");
@@ -27,10 +26,13 @@ let UsersClient = UsersClient_1 = class UsersClient {
27
26
  }
28
27
  get service() {
29
28
  if (!this.userClient) {
30
- throw new Error("UserService not initialized yet");
29
+ throw new common_1.InternalServerErrorException("UserService is not initialized yet");
31
30
  }
32
31
  return this.userClient;
33
32
  }
33
+ isReady() {
34
+ return !!this.userClient;
35
+ }
34
36
  };
35
37
  exports.UsersClient = UsersClient;
36
38
  exports.UsersClient = UsersClient = UsersClient_1 = __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geniebox-shared-lib",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Shared NestJS library with gRPC clients",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",