@astromonacinema/contracts 1.0.2 → 1.0.4

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.
@@ -0,0 +1 @@
1
+ export * from './proto';
@@ -0,0 +1 @@
1
+ export * from './paths';
@@ -0,0 +1,17 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./paths"), exports);
@@ -0,0 +1,3 @@
1
+ export declare const PROTO_PATHS: {
2
+ readonly AUTH: string;
3
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROTO_PATHS = void 0;
4
+ const path_1 = require("path");
5
+ exports.PROTO_PATHS = {
6
+ AUTH: (0, path_1.join)(__dirname, '../../proto/auth.proto'),
7
+ };
package/gen/auth.ts CHANGED
@@ -45,6 +45,15 @@ export interface VerifyOtpResponse {
45
45
  refreshToken: string;
46
46
  }
47
47
 
48
+ export interface RefreshRequest {
49
+ refreshToken: string;
50
+ }
51
+
52
+ export interface RefreshResponse {
53
+ accessToken: string;
54
+ refreshToken: string;
55
+ }
56
+
48
57
  export interface UserSession {
49
58
  id: string;
50
59
  /** временное значение */
@@ -96,17 +105,21 @@ export interface AuthServiceClient {
96
105
  sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
97
106
 
98
107
  verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
108
+
109
+ refresh(request: RefreshRequest): Observable<RefreshResponse>;
99
110
  }
100
111
 
101
112
  export interface AuthServiceController {
102
113
  sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
103
114
 
104
115
  verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
116
+
117
+ refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
105
118
  }
106
119
 
107
120
  export function AuthServiceControllerMethods() {
108
121
  return function (constructor: Function) {
109
- const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
122
+ const grpcMethods: string[] = ["sendOtp", "verifyOtp", "refresh"];
110
123
  for (const method of grpcMethods) {
111
124
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
112
125
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astromonacinema/contracts",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "license": "MIT",
5
5
  "description": "Protobuf contracts for microservices",
6
6
  "main": "dist/index.js",
@@ -11,7 +11,8 @@
11
11
  },
12
12
  "files": [
13
13
  "proto",
14
- "gen"
14
+ "gen",
15
+ "dist"
15
16
  ],
16
17
  "publishConfig": {
17
18
  "access": "public"
package/proto/auth.proto CHANGED
@@ -9,6 +9,7 @@ import "google/protobuf/any.proto";
9
9
  service AuthService {
10
10
  rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
11
11
  rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
12
+ rpc Refresh (RefreshRequest) returns (RefreshResponse);
12
13
  }
13
14
 
14
15
  message SendOtpRequest {
@@ -32,6 +33,15 @@ message VerifyOtpResponse {
32
33
  }
33
34
 
34
35
 
36
+ message RefreshRequest {
37
+ string refresh_token = 1;
38
+ }
39
+
40
+ message RefreshResponse {
41
+ string access_token = 1;
42
+ string refresh_token = 2;
43
+ }
44
+
35
45
 
36
46
 
37
47