geniebox-shared-lib 1.0.26 → 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;
@@ -38,6 +39,18 @@ export interface UserResponse {
38
39
  birthday: string;
39
40
  gender: string;
40
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
+ }
41
54
  export interface RefreshTokenRequest {
42
55
  userId: string;
43
56
  sessionId: string;
@@ -52,17 +65,20 @@ export declare const LoginCredentials: MessageFns<LoginCredentials>;
52
65
  export declare const Tokens: MessageFns<Tokens>;
53
66
  export declare const AuthResponse: MessageFns<AuthResponse>;
54
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>;
55
71
  export declare const RefreshTokenRequest: MessageFns<RefreshTokenRequest>;
56
72
  export declare const RefreshTokenResponse: MessageFns<RefreshTokenResponse>;
57
73
  export interface AuthServiceClient {
58
74
  login(request: LoginCredentials, metadata?: Metadata): Observable<AuthResponse>;
59
75
  register(request: RegisterCredentials, metadata?: Metadata): Observable<AuthResponse>;
60
- refreshToken(request: RefreshTokenRequest, metadata?: Metadata): Observable<RefreshTokenResponse>;
76
+ logout(request: LogoutRequest, metadata?: Metadata): Observable<Empty>;
61
77
  }
62
78
  export interface AuthServiceController {
63
79
  login(request: LoginCredentials, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
64
80
  register(request: RegisterCredentials, metadata?: Metadata): Promise<AuthResponse> | Observable<AuthResponse> | AuthResponse;
65
- refreshToken(request: RefreshTokenRequest, metadata?: Metadata): Promise<RefreshTokenResponse> | Observable<RefreshTokenResponse> | RefreshTokenResponse;
81
+ logout(request: LogoutRequest, metadata?: Metadata): void;
66
82
  }
67
83
  export declare function AuthServiceControllerMethods(): (constructor: Function) => void;
68
84
  export declare const AUTH_SERVICE_NAME = "AuthService";
@@ -86,20 +102,20 @@ export declare const AuthServiceService: {
86
102
  readonly responseSerialize: (value: AuthResponse) => Buffer;
87
103
  readonly responseDeserialize: (value: Buffer) => AuthResponse;
88
104
  };
89
- readonly refreshToken: {
90
- readonly path: "/auth.AuthService/refreshToken";
105
+ readonly logout: {
106
+ readonly path: "/auth.AuthService/logout";
91
107
  readonly requestStream: false;
92
108
  readonly responseStream: false;
93
- readonly requestSerialize: (value: RefreshTokenRequest) => Buffer;
94
- readonly requestDeserialize: (value: Buffer) => RefreshTokenRequest;
95
- readonly responseSerialize: (value: RefreshTokenResponse) => Buffer;
96
- 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;
97
113
  };
98
114
  };
99
115
  export interface AuthServiceServer extends UntypedServiceImplementation {
100
116
  login: handleUnaryCall<LoginCredentials, AuthResponse>;
101
117
  register: handleUnaryCall<RegisterCredentials, AuthResponse>;
102
- refreshToken: handleUnaryCall<RefreshTokenRequest, RefreshTokenResponse>;
118
+ logout: handleUnaryCall<LogoutRequest, Empty>;
103
119
  }
104
120
  export interface MessageFns<T> {
105
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() {
@@ -387,6 +388,135 @@ exports.UserResponse = {
387
388
  return message;
388
389
  },
389
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
+ };
390
520
  function createBaseRefreshTokenRequest() {
391
521
  return { userId: "", sessionId: "", refreshToken: "" };
392
522
  }
@@ -475,7 +605,7 @@ exports.RefreshTokenResponse = {
475
605
  };
476
606
  function AuthServiceControllerMethods() {
477
607
  return function (constructor) {
478
- const grpcMethods = ["login", "register", "refreshToken"];
608
+ const grpcMethods = ["login", "register", "logout"];
479
609
  for (const method of grpcMethods) {
480
610
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
481
611
  (0, microservices_1.GrpcMethod)("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -507,13 +637,13 @@ exports.AuthServiceService = {
507
637
  responseSerialize: (value) => Buffer.from(exports.AuthResponse.encode(value).finish()),
508
638
  responseDeserialize: (value) => exports.AuthResponse.decode(value),
509
639
  },
510
- refreshToken: {
511
- path: "/auth.AuthService/refreshToken",
640
+ logout: {
641
+ path: "/auth.AuthService/logout",
512
642
  requestStream: false,
513
643
  responseStream: false,
514
- requestSerialize: (value) => Buffer.from(exports.RefreshTokenRequest.encode(value).finish()),
515
- requestDeserialize: (value) => exports.RefreshTokenRequest.decode(value),
516
- responseSerialize: (value) => Buffer.from(exports.RefreshTokenResponse.encode(value).finish()),
517
- 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),
518
648
  },
519
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.26",
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",