@candesk/contracts 2.4.0 → 3.0.0

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 './telegram.constants';
@@ -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("./telegram.constants"), exports);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * How long a Telegram login waits to be finished in the bot: auth-service keeps
3
+ * the login session, gateway the poll cookie and bot-service the chat session.
4
+ */
5
+ export declare const TELEGRAM_SESSION_TTL_SECONDS: number;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TELEGRAM_SESSION_TTL_SECONDS = void 0;
4
+ /**
5
+ * How long a Telegram login waits to be finished in the bot: auth-service keeps
6
+ * the login session, gateway the poll cookie and bot-service the chat session.
7
+ */
8
+ exports.TELEGRAM_SESSION_TTL_SECONDS = 5 * 60;
@@ -1,5 +1,4 @@
1
1
  export interface OtpRequestedEvent {
2
- identifier: string;
3
- type: string;
2
+ email: string;
4
3
  code: string;
5
4
  }
@@ -31,26 +31,8 @@ export interface ConfirmEmailChangeRequest {
31
31
  export interface ConfirmEmailChangeResponse {
32
32
  ok: boolean;
33
33
  }
34
- export interface InitPhoneChangeRequest {
35
- phone: string;
36
- userId: string;
37
- }
38
- export interface InitPhoneChangeResponse {
39
- ok: boolean;
40
- }
41
- export interface ConfirmPhoneChangeRequest {
42
- phone: string;
43
- code: string;
44
- userId: string;
45
- refreshToken: string;
46
- }
47
- export interface ConfirmPhoneChangeResponse {
48
- ok: boolean;
49
- }
50
34
  export interface AccountService {
51
35
  getAccount(request: GetAccountRequest): Promise<GetAccountResponse>;
52
36
  initEmailChange(request: InitEmailChangeRequest): Promise<InitEmailChangeResponse>;
53
37
  confirmEmailChange(request: ConfirmEmailChangeRequest): Promise<ConfirmEmailChangeResponse>;
54
- initPhoneChange(request: InitPhoneChangeRequest): Promise<InitPhoneChangeResponse>;
55
- confirmPhoneChange(request: ConfirmPhoneChangeRequest): Promise<ConfirmPhoneChangeResponse>;
56
38
  }
@@ -1,15 +1,13 @@
1
1
  import type { Empty } from "./google/protobuf/empty";
2
2
  export declare const protobufPackage = "auth.v1";
3
3
  export interface SendOtpRequest {
4
- identifier: string;
5
- type: string;
4
+ email: string;
6
5
  }
7
6
  export interface SendOtpResponse {
8
7
  ok: boolean;
9
8
  }
10
9
  export interface VerifyOtpRequest {
11
- identifier: string;
12
- type: string;
10
+ email: string;
13
11
  code: string;
14
12
  }
15
13
  export interface VerifyOtpResponse {
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './constants';
1
2
  export * from './proto';
2
3
  export * from './events';
package/dist/index.js CHANGED
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./constants"), exports);
17
18
  __exportStar(require("./proto"), exports);
18
19
  __exportStar(require("./events"), exports);
@@ -32,36 +32,16 @@ export interface ConfirmEmailChangeRequest {
32
32
  export interface ConfirmEmailChangeResponse {
33
33
  ok: boolean;
34
34
  }
35
- export interface InitPhoneChangeRequest {
36
- phone: string;
37
- userId: string;
38
- }
39
- export interface InitPhoneChangeResponse {
40
- ok: boolean;
41
- }
42
- export interface ConfirmPhoneChangeRequest {
43
- phone: string;
44
- code: string;
45
- userId: string;
46
- refreshToken: string;
47
- }
48
- export interface ConfirmPhoneChangeResponse {
49
- ok: boolean;
50
- }
51
35
  export declare const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
52
36
  export interface AccountServiceClient {
53
37
  getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
54
38
  initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
55
39
  confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
56
- initPhoneChange(request: InitPhoneChangeRequest): Observable<InitPhoneChangeResponse>;
57
- confirmPhoneChange(request: ConfirmPhoneChangeRequest): Observable<ConfirmPhoneChangeResponse>;
58
40
  }
59
41
  export interface AccountServiceController {
60
42
  getAccount(request: GetAccountRequest): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
61
43
  initEmailChange(request: InitEmailChangeRequest): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
62
44
  confirmEmailChange(request: ConfirmEmailChangeRequest): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
63
- initPhoneChange(request: InitPhoneChangeRequest): Promise<InitPhoneChangeResponse> | Observable<InitPhoneChangeResponse> | InitPhoneChangeResponse;
64
- confirmPhoneChange(request: ConfirmPhoneChangeRequest): Promise<ConfirmPhoneChangeResponse> | Observable<ConfirmPhoneChangeResponse> | ConfirmPhoneChangeResponse;
65
45
  }
66
46
  export declare function AccountServiceControllerMethods(): (constructor: Function) => void;
67
47
  export declare const ACCOUNT_SERVICE_NAME = "AccountService";
@@ -19,13 +19,7 @@ var Role;
19
19
  exports.ACCOUNT_V1_PACKAGE_NAME = "account.v1";
20
20
  function AccountServiceControllerMethods() {
21
21
  return function (constructor) {
22
- const grpcMethods = [
23
- "getAccount",
24
- "initEmailChange",
25
- "confirmEmailChange",
26
- "initPhoneChange",
27
- "confirmPhoneChange",
28
- ];
22
+ const grpcMethods = ["getAccount", "initEmailChange", "confirmEmailChange"];
29
23
  for (const method of grpcMethods) {
30
24
  const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
31
25
  (0, microservices_1.GrpcMethod)("AccountService", method)(constructor.prototype[method], method, descriptor);
@@ -2,15 +2,13 @@ import { Observable } from "rxjs";
2
2
  import { Empty } from "./google/protobuf/empty";
3
3
  export declare const protobufPackage = "auth.v1";
4
4
  export interface SendOtpRequest {
5
- identifier: string;
6
- type: string;
5
+ email: string;
7
6
  }
8
7
  export interface SendOtpResponse {
9
8
  ok: boolean;
10
9
  }
11
10
  export interface VerifyOtpRequest {
12
- identifier: string;
13
- type: string;
11
+ email: string;
14
12
  code: string;
15
13
  }
16
14
  export interface VerifyOtpResponse {
@@ -1 +1,2 @@
1
+ export * from './loader-options';
1
2
  export * from './paths';
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./loader-options"), exports);
17
18
  __exportStar(require("./paths"), exports);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * proto-loader options for every gRPC server and client. Runtime values must match
3
+ * the generated types: enums stay numeric, int64 comes as a string (`forceLong=string`).
4
+ */
5
+ export declare const PROTO_LOADER_OPTIONS: {
6
+ readonly longs: StringConstructor;
7
+ readonly defaults: true;
8
+ readonly oneofs: true;
9
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROTO_LOADER_OPTIONS = void 0;
4
+ /**
5
+ * proto-loader options for every gRPC server and client. Runtime values must match
6
+ * the generated types: enums stay numeric, int64 comes as a string (`forceLong=string`).
7
+ */
8
+ exports.PROTO_LOADER_OPTIONS = {
9
+ longs: String,
10
+ defaults: true,
11
+ oneofs: true
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candesk/contracts",
3
- "version": "2.4.0",
3
+ "version": "3.0.0",
4
4
  "description": "Protobuf contracts for Candesk microservices",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "scripts": {
22
22
  "build": "tsc -p tsconfig.build.json",
23
23
  "generate": "yarn generate:types && yarn generate:nest",
24
- "generate:types": "node -e \"require('fs').mkdirSync('src/gen',{recursive:true})\" && protoc -I ./proto ./proto/*.proto --ts_proto_out=./src/gen --ts_proto_opt=onlyTypes=true,package=omit,lowerCaseServiceMethods=true",
25
- "generate:nest": "node -e \"require('fs').mkdirSync('src/nest',{recursive:true})\" && protoc -I ./proto ./proto/*.proto --ts_proto_out=./src/nest --ts_proto_opt=nestJs=true,package=omit",
24
+ "generate:types": "node -e \"require('fs').mkdirSync('src/gen',{recursive:true})\" && protoc -I ./proto ./proto/*.proto --ts_proto_out=./src/gen --ts_proto_opt=onlyTypes=true,package=omit,lowerCaseServiceMethods=true,forceLong=string",
25
+ "generate:nest": "node -e \"require('fs').mkdirSync('src/nest',{recursive:true})\" && protoc -I ./proto ./proto/*.proto --ts_proto_out=./src/nest --ts_proto_opt=nestJs=true,package=omit,forceLong=string",
26
26
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\""
27
27
  },
28
28
  "files": [
@@ -7,9 +7,6 @@ service AccountService {
7
7
 
8
8
  rpc InitEmailChange(InitEmailChangeRequest) returns (InitEmailChangeResponse);
9
9
  rpc ConfirmEmailChange(ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
10
-
11
- rpc InitPhoneChange(InitPhoneChangeRequest) returns (InitPhoneChangeResponse);
12
- rpc ConfirmPhoneChange(ConfirmPhoneChangeRequest) returns (ConfirmPhoneChangeResponse);
13
10
  }
14
11
 
15
12
  message GetAccountRequest {
@@ -45,26 +42,6 @@ message ConfirmEmailChangeResponse {
45
42
  bool ok = 1;
46
43
  }
47
44
 
48
- message InitPhoneChangeRequest {
49
- string phone = 1;
50
- string user_id = 2;
51
- }
52
-
53
- message InitPhoneChangeResponse {
54
- bool ok = 1;
55
- }
56
-
57
- message ConfirmPhoneChangeRequest {
58
- string phone = 1;
59
- string code = 2;
60
- string user_id = 3;
61
- string refresh_token = 4;
62
- }
63
-
64
- message ConfirmPhoneChangeResponse {
65
- bool ok = 1;
66
- }
67
-
68
45
  enum Role {
69
46
  USER = 0;
70
47
  ADMIN = 1;
package/proto/auth.proto CHANGED
@@ -18,8 +18,9 @@ service AuthService {
18
18
  }
19
19
 
20
20
  message SendOtpRequest {
21
- string identifier = 1;
22
- string type = 2;
21
+ reserved 2;
22
+
23
+ string email = 1;
23
24
  }
24
25
 
25
26
  message SendOtpResponse {
@@ -27,8 +28,9 @@ message SendOtpResponse {
27
28
  }
28
29
 
29
30
  message VerifyOtpRequest {
30
- string identifier = 1;
31
- string type = 2;
31
+ reserved 2;
32
+
33
+ string email = 1;
32
34
  string code = 3;
33
35
  }
34
36