@candesk/contracts 2.5.0 → 3.1.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.
@@ -1,3 +1,5 @@
1
1
  export declare const AUTH_EVENTS: {
2
2
  readonly OTP_REQUESTED: 'auth.otp.requested';
3
+ readonly EMAIL_CHANGE_REQUESTED: 'auth.email-change.requested';
4
+ readonly EMAIL_CHANGED: 'auth.email.changed';
3
5
  };
@@ -2,5 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AUTH_EVENTS = void 0;
4
4
  exports.AUTH_EVENTS = {
5
- OTP_REQUESTED: 'auth.otp.requested'
5
+ OTP_REQUESTED: 'auth.otp.requested',
6
+ EMAIL_CHANGE_REQUESTED: 'auth.email-change.requested',
7
+ EMAIL_CHANGED: 'auth.email.changed'
6
8
  };
@@ -0,0 +1,4 @@
1
+ export interface EmailChangeRequestedEvent {
2
+ email: string;
3
+ code: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface EmailChangedEvent {
2
+ previousEmail: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,4 @@
1
1
  export * from './auth.events';
2
+ export * from './email-change-requested.interface';
3
+ export * from './email-changed.interface';
2
4
  export * from './otp-requested.interface';
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth.events"), exports);
18
+ __exportStar(require("./email-change-requested.interface"), exports);
19
+ __exportStar(require("./email-changed.interface"), exports);
18
20
  __exportStar(require("./otp-requested.interface"), exports);
@@ -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 {
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candesk/contracts",
3
- "version": "2.5.0",
3
+ "version": "3.1.0",
4
4
  "description": "Protobuf contracts for Candesk microservices",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -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