geniebox-shared-lib 1.0.25 → 1.0.27

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.
@@ -1,6 +1,7 @@
1
1
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
2
  import type { handleUnaryCall, Metadata, UntypedServiceImplementation } from "@grpc/grpc-js";
3
3
  import { Observable } from "rxjs";
4
+ import { Empty } from "./google/protobuf/empty.interface";
4
5
  export declare const protobufPackage = "auth";
5
6
  export interface RegisterCredentials {
6
7
  firstName: string;
@@ -16,6 +17,7 @@ export interface LoginCredentials {
16
17
  email?: string | undefined;
17
18
  phoneNumber?: string | undefined;
18
19
  password: string;
20
+ rememberMe?: boolean | undefined;
19
21
  }
20
22
  export interface Tokens {
21
23
  accessToken: string;
@@ -37,6 +39,18 @@ export interface UserResponse {
37
39
  birthday: string;
38
40
  gender: string;
39
41
  }
42
+ export interface LogoutRequest {
43
+ userId: string;
44
+ sessionId: string;
45
+ }
46
+ export interface ForgotPasswordRequest {
47
+ email: string;
48
+ }
49
+ export interface ResetPasswordRequest {
50
+ email: string;
51
+ code: string;
52
+ newPassword: string;
53
+ }
40
54
  export interface RefreshTokenRequest {
41
55
  userId: string;
42
56
  sessionId: string;
@@ -51,17 +65,20 @@ export declare const LoginCredentials: MessageFns<LoginCredentials>;
51
65
  export declare const Tokens: MessageFns<Tokens>;
52
66
  export declare const AuthResponse: MessageFns<AuthResponse>;
53
67
  export declare const UserResponse: MessageFns<UserResponse>;
68
+ export declare const LogoutRequest: MessageFns<LogoutRequest>;
69
+ export declare const ForgotPasswordRequest: MessageFns<ForgotPasswordRequest>;
70
+ export declare const ResetPasswordRequest: MessageFns<ResetPasswordRequest>;
54
71
  export declare const RefreshTokenRequest: MessageFns<RefreshTokenRequest>;
55
72
  export declare const RefreshTokenResponse: MessageFns<RefreshTokenResponse>;
56
73
  export interface AuthServiceClient {
57
74
  login(request: LoginCredentials, metadata?: Metadata): Observable<AuthResponse>;
58
75
  register(request: RegisterCredentials, metadata?: Metadata): Observable<AuthResponse>;
59
- refreshToken(request: RefreshTokenRequest, metadata?: Metadata): Observable<RefreshTokenResponse>;
76
+ logout(request: LogoutRequest, metadata?: Metadata): Observable<Empty>;
60
77
  }
61
78
  export interface AuthServiceController {
62
79
  login(request: LoginCredentials, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
63
80
  register(request: RegisterCredentials, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
64
- refreshToken(request: RefreshTokenRequest, metadata?: Metadata): Promise<RefreshTokenResponse> | Observable<RefreshTokenResponse> | RefreshTokenResponse;
81
+ logout(request: LogoutRequest, metadata?: Metadata): void;
65
82
  }
66
83
  export declare function AuthServiceControllerMethods(): (constructor: Function) => void;
67
84
  export declare const AUTH_SERVICE_NAME = "AuthService";
@@ -85,20 +102,20 @@ export declare const AuthServiceService: {
85
102
  readonly responseSerialize: (value: AuthResponse) => Buffer;
86
103
  readonly responseDeserialize: (value: Buffer) => AuthResponse;
87
104
  };
88
- readonly refreshToken: {
89
- readonly path: "/auth.AuthService/refreshToken";
105
+ readonly logout: {
106
+ readonly path: "/auth.AuthService/logout";
90
107
  readonly requestStream: false;
91
108
  readonly responseStream: false;
92
- readonly requestSerialize: (value: RefreshTokenRequest) => Buffer;
93
- readonly requestDeserialize: (value: Buffer) => RefreshTokenRequest;
94
- readonly responseSerialize: (value: RefreshTokenResponse) => Buffer;
95
- readonly responseDeserialize: (value: Buffer) => RefreshTokenResponse;
109
+ readonly requestSerialize: (value: LogoutRequest) => Buffer;
110
+ readonly requestDeserialize: (value: Buffer) => LogoutRequest;
111
+ readonly responseSerialize: (value: Empty) => Buffer;
112
+ readonly responseDeserialize: (value: Buffer) => Empty;
96
113
  };
97
114
  };
98
115
  export interface AuthServiceServer extends UntypedServiceImplementation {
99
116
  login: handleUnaryCall<LoginCredentials, AuthResponse>;
100
117
  register: handleUnaryCall<RegisterCredentials, AuthResponse>;
101
- refreshToken: handleUnaryCall<RefreshTokenRequest, RefreshTokenResponse>;
118
+ logout: handleUnaryCall<LogoutRequest, Empty>;
102
119
  }
103
120
  export interface MessageFns<T> {
104
121
  encode(message: T, writer?: BinaryWriter): BinaryWriter;
@@ -5,11 +5,12 @@
5
5
  // protoc v5.28.2
6
6
  // source: auth.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.AuthServiceService = exports.AUTH_SERVICE_NAME = exports.RefreshTokenResponse = exports.RefreshTokenRequest = exports.UserResponse = exports.AuthResponse = exports.Tokens = exports.LoginCredentials = exports.RegisterCredentials = exports.AUTH_PACKAGE_NAME = exports.protobufPackage = void 0;
8
+ exports.AuthServiceService = exports.AUTH_SERVICE_NAME = exports.RefreshTokenResponse = exports.RefreshTokenRequest = exports.ResetPasswordRequest = exports.ForgotPasswordRequest = exports.LogoutRequest = exports.UserResponse = exports.AuthResponse = exports.Tokens = exports.LoginCredentials = exports.RegisterCredentials = exports.AUTH_PACKAGE_NAME = exports.protobufPackage = void 0;
9
9
  exports.AuthServiceControllerMethods = AuthServiceControllerMethods;
10
10
  /* eslint-disable */
11
11
  const wire_1 = require("@bufbuild/protobuf/wire");
12
12
  const microservices_1 = require("@nestjs/microservices");
13
+ const empty_interface_1 = require("./google/protobuf/empty.interface");
13
14
  exports.protobufPackage = "auth";
14
15
  exports.AUTH_PACKAGE_NAME = "auth";
15
16
  function createBaseRegisterCredentials() {
@@ -129,6 +130,9 @@ exports.LoginCredentials = {
129
130
  if (message.password !== "") {
130
131
  writer.uint32(26).string(message.password);
131
132
  }
133
+ if (message.rememberMe !== undefined) {
134
+ writer.uint32(32).bool(message.rememberMe);
135
+ }
132
136
  return writer;
133
137
  },
134
138
  decode(input, length) {
@@ -159,6 +163,13 @@ exports.LoginCredentials = {
159
163
  message.password = reader.string();
160
164
  continue;
161
165
  }
166
+ case 4: {
167
+ if (tag !== 32) {
168
+ break;
169
+ }
170
+ message.rememberMe = reader.bool();
171
+ continue;
172
+ }
162
173
  }
163
174
  if ((tag & 7) === 4 || tag === 0) {
164
175
  break;
@@ -377,6 +388,135 @@ exports.UserResponse = {
377
388
  return message;
378
389
  },
379
390
  };
391
+ function createBaseLogoutRequest() {
392
+ return { userId: "", sessionId: "" };
393
+ }
394
+ exports.LogoutRequest = {
395
+ encode(message, writer = new wire_1.BinaryWriter()) {
396
+ if (message.userId !== "") {
397
+ writer.uint32(10).string(message.userId);
398
+ }
399
+ if (message.sessionId !== "") {
400
+ writer.uint32(18).string(message.sessionId);
401
+ }
402
+ return writer;
403
+ },
404
+ decode(input, length) {
405
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
406
+ const end = length === undefined ? reader.len : reader.pos + length;
407
+ const message = createBaseLogoutRequest();
408
+ while (reader.pos < end) {
409
+ const tag = reader.uint32();
410
+ switch (tag >>> 3) {
411
+ case 1: {
412
+ if (tag !== 10) {
413
+ break;
414
+ }
415
+ message.userId = reader.string();
416
+ continue;
417
+ }
418
+ case 2: {
419
+ if (tag !== 18) {
420
+ break;
421
+ }
422
+ message.sessionId = reader.string();
423
+ continue;
424
+ }
425
+ }
426
+ if ((tag & 7) === 4 || tag === 0) {
427
+ break;
428
+ }
429
+ reader.skip(tag & 7);
430
+ }
431
+ return message;
432
+ },
433
+ };
434
+ function createBaseForgotPasswordRequest() {
435
+ return { email: "" };
436
+ }
437
+ exports.ForgotPasswordRequest = {
438
+ encode(message, writer = new wire_1.BinaryWriter()) {
439
+ if (message.email !== "") {
440
+ writer.uint32(10).string(message.email);
441
+ }
442
+ return writer;
443
+ },
444
+ decode(input, length) {
445
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
446
+ const end = length === undefined ? reader.len : reader.pos + length;
447
+ const message = createBaseForgotPasswordRequest();
448
+ while (reader.pos < end) {
449
+ const tag = reader.uint32();
450
+ switch (tag >>> 3) {
451
+ case 1: {
452
+ if (tag !== 10) {
453
+ break;
454
+ }
455
+ message.email = reader.string();
456
+ continue;
457
+ }
458
+ }
459
+ if ((tag & 7) === 4 || tag === 0) {
460
+ break;
461
+ }
462
+ reader.skip(tag & 7);
463
+ }
464
+ return message;
465
+ },
466
+ };
467
+ function createBaseResetPasswordRequest() {
468
+ return { email: "", code: "", newPassword: "" };
469
+ }
470
+ exports.ResetPasswordRequest = {
471
+ encode(message, writer = new wire_1.BinaryWriter()) {
472
+ if (message.email !== "") {
473
+ writer.uint32(10).string(message.email);
474
+ }
475
+ if (message.code !== "") {
476
+ writer.uint32(18).string(message.code);
477
+ }
478
+ if (message.newPassword !== "") {
479
+ writer.uint32(26).string(message.newPassword);
480
+ }
481
+ return writer;
482
+ },
483
+ decode(input, length) {
484
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
485
+ const end = length === undefined ? reader.len : reader.pos + length;
486
+ const message = createBaseResetPasswordRequest();
487
+ while (reader.pos < end) {
488
+ const tag = reader.uint32();
489
+ switch (tag >>> 3) {
490
+ case 1: {
491
+ if (tag !== 10) {
492
+ break;
493
+ }
494
+ message.email = reader.string();
495
+ continue;
496
+ }
497
+ case 2: {
498
+ if (tag !== 18) {
499
+ break;
500
+ }
501
+ message.code = reader.string();
502
+ continue;
503
+ }
504
+ case 3: {
505
+ if (tag !== 26) {
506
+ break;
507
+ }
508
+ message.newPassword = reader.string();
509
+ continue;
510
+ }
511
+ }
512
+ if ((tag & 7) === 4 || tag === 0) {
513
+ break;
514
+ }
515
+ reader.skip(tag & 7);
516
+ }
517
+ return message;
518
+ },
519
+ };
380
520
  function createBaseRefreshTokenRequest() {
381
521
  return { userId: "", sessionId: "", refreshToken: "" };
382
522
  }
@@ -465,7 +605,7 @@ exports.RefreshTokenResponse = {
465
605
  };
466
606
  function AuthServiceControllerMethods() {
467
607
  return function (constructor) {
468
- const grpcMethods = ["login", "register", "refreshToken"];
608
+ const grpcMethods = ["login", "register", "logout"];
469
609
  for (const method of grpcMethods) {
470
610
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
471
611
  (0, microservices_1.GrpcMethod)("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -497,13 +637,13 @@ exports.AuthServiceService = {
497
637
  responseSerialize: (value) => Buffer.from(exports.AuthResponse.encode(value).finish()),
498
638
  responseDeserialize: (value) => exports.AuthResponse.decode(value),
499
639
  },
500
- refreshToken: {
501
- path: "/auth.AuthService/refreshToken",
640
+ logout: {
641
+ path: "/auth.AuthService/logout",
502
642
  requestStream: false,
503
643
  responseStream: false,
504
- requestSerialize: (value) => Buffer.from(exports.RefreshTokenRequest.encode(value).finish()),
505
- requestDeserialize: (value) => exports.RefreshTokenRequest.decode(value),
506
- responseSerialize: (value) => Buffer.from(exports.RefreshTokenResponse.encode(value).finish()),
507
- responseDeserialize: (value) => exports.RefreshTokenResponse.decode(value),
644
+ requestSerialize: (value) => Buffer.from(exports.LogoutRequest.encode(value).finish()),
645
+ requestDeserialize: (value) => exports.LogoutRequest.decode(value),
646
+ responseSerialize: (value) => Buffer.from(empty_interface_1.Empty.encode(value).finish()),
647
+ responseDeserialize: (value) => empty_interface_1.Empty.decode(value),
508
648
  },
509
649
  };
@@ -0,0 +1,19 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ export declare const protobufPackage = "google.protobuf";
3
+ /**
4
+ * A generic empty message that you can re-use to avoid defining duplicated
5
+ * empty messages in your APIs. A typical example is to use it as the request
6
+ * or the response type of an API method. For instance:
7
+ *
8
+ * service Foo {
9
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
10
+ * }
11
+ */
12
+ export interface Empty {
13
+ }
14
+ export declare const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
15
+ export declare const Empty: MessageFns<Empty>;
16
+ export interface MessageFns<T> {
17
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
18
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
19
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.7.7
5
+ // protoc v5.28.2
6
+ // source: google/protobuf/empty.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Empty = exports.GOOGLE_PROTOBUF_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ const wire_1 = require("@bufbuild/protobuf/wire");
11
+ exports.protobufPackage = "google.protobuf";
12
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
13
+ function createBaseEmpty() {
14
+ return {};
15
+ }
16
+ exports.Empty = {
17
+ encode(_, writer = new wire_1.BinaryWriter()) {
18
+ return writer;
19
+ },
20
+ decode(input, length) {
21
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
22
+ const end = length === undefined ? reader.len : reader.pos + length;
23
+ const message = createBaseEmpty();
24
+ while (reader.pos < end) {
25
+ const tag = reader.uint32();
26
+ switch (tag >>> 3) {
27
+ }
28
+ if ((tag & 7) === 4 || tag === 0) {
29
+ break;
30
+ }
31
+ reader.skip(tag & 7);
32
+ }
33
+ return message;
34
+ },
35
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geniebox-shared-lib",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "Shared NestJS library with gRPC clients",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",