@taskora-uni/contracts 3.1.0 → 4.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.
@@ -1,3 +1,4 @@
1
1
  export declare const AUTH_EVENT_PATTERNS: {
2
- readonly OTP_REQUESTED: "auth.otp.requested";
2
+ readonly OTP_REQUESTED: "auth.registration.otp-requested";
3
+ readonly PROFILE_CREATION_REQUESTED: "auth.registration.profile-creation-requested";
3
4
  };
@@ -2,5 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AUTH_EVENT_PATTERNS = void 0;
4
4
  exports.AUTH_EVENT_PATTERNS = {
5
- OTP_REQUESTED: "auth.otp.requested",
5
+ OTP_REQUESTED: "auth.registration.otp-requested",
6
+ PROFILE_CREATION_REQUESTED: "auth.registration.profile-creation-requested",
6
7
  };
@@ -1 +1,2 @@
1
1
  export * from "./otp-requested.payload";
2
+ export * from "./profile-creation-requested.payload";
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./otp-requested.payload"), exports);
18
+ __exportStar(require("./profile-creation-requested.payload"), exports);
@@ -0,0 +1,7 @@
1
+ export interface AuthProfileCreationRequestedPayload {
2
+ eventId: string;
3
+ userId: string;
4
+ firstName: string;
5
+ lastName: string;
6
+ occurredAt: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,2 @@
1
1
  export * from "./auth";
2
+ export * from "./user";
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./auth"), exports);
18
+ __exportStar(require("./user"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./patterns";
2
+ export * from "./payloads";
@@ -0,0 +1,18 @@
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("./patterns"), exports);
18
+ __exportStar(require("./payloads"), exports);
@@ -0,0 +1,4 @@
1
+ export declare const USER_EVENT_PATTERNS: {
2
+ readonly PROFILE_CREATED: "user.profile-created";
3
+ readonly PROFILE_CREATION_FAILED: "user.profile-creation-failed";
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_EVENT_PATTERNS = void 0;
4
+ exports.USER_EVENT_PATTERNS = {
5
+ PROFILE_CREATED: "user.profile-created",
6
+ PROFILE_CREATION_FAILED: "user.profile-creation-failed",
7
+ };
@@ -0,0 +1 @@
1
+ export * from "./event-patterns";
@@ -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("./event-patterns"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./profile-created.payload";
2
+ export * from "./profile-creation-failed.payload";
@@ -0,0 +1,18 @@
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("./profile-created.payload"), exports);
18
+ __exportStar(require("./profile-creation-failed.payload"), exports);
@@ -0,0 +1,5 @@
1
+ export interface UserProfileCreatedPayload {
2
+ eventId: string;
3
+ userId: string;
4
+ occurredAt: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface UserProfileCreationFailedPayload {
2
+ eventId: string;
3
+ userId: string;
4
+ reason: string;
5
+ occurredAt: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/generated/auth.ts CHANGED
@@ -10,6 +10,14 @@ import { Observable } from "rxjs";
10
10
 
11
11
  export const protobufPackage = "auth.v1";
12
12
 
13
+ export enum RegistrationStatus {
14
+ UNSPECIFIED = 0,
15
+ PENDING = 1,
16
+ COMPLETED = 2,
17
+ REQUIRES_RESTART = 3,
18
+ UNRECOGNIZED = -1,
19
+ }
20
+
13
21
  export interface LoginRequest {
14
22
  email: string;
15
23
  password: string;
@@ -48,8 +56,17 @@ export interface CompleteRegistrationRequest {
48
56
  }
49
57
 
50
58
  export interface CompleteRegistrationResponse {
51
- accessToken: string;
52
- refreshToken: string;
59
+ status: RegistrationStatus;
60
+ }
61
+
62
+ export interface GetRegistrationStatusRequest {
63
+ id: string;
64
+ }
65
+
66
+ export interface GetRegistrationStatusResponse {
67
+ status: RegistrationStatus;
68
+ accessToken?: string | undefined;
69
+ refreshToken?: string | undefined;
53
70
  }
54
71
 
55
72
  export const AUTH_V1_PACKAGE_NAME = "auth.v1";
@@ -62,6 +79,8 @@ export interface AuthServiceClient {
62
79
  startRegistration(request: StartRegistrationRequest): Observable<StartRegistrationResponse>;
63
80
 
64
81
  completeRegistration(request: CompleteRegistrationRequest): Observable<CompleteRegistrationResponse>;
82
+
83
+ getRegistrationStatus(request: GetRegistrationStatusRequest): Observable<GetRegistrationStatusResponse>;
65
84
  }
66
85
 
67
86
  export interface AuthServiceController {
@@ -78,11 +97,21 @@ export interface AuthServiceController {
78
97
  completeRegistration(
79
98
  request: CompleteRegistrationRequest,
80
99
  ): Promise<CompleteRegistrationResponse> | Observable<CompleteRegistrationResponse> | CompleteRegistrationResponse;
100
+
101
+ getRegistrationStatus(
102
+ request: GetRegistrationStatusRequest,
103
+ ): Promise<GetRegistrationStatusResponse> | Observable<GetRegistrationStatusResponse> | GetRegistrationStatusResponse;
81
104
  }
82
105
 
83
106
  export function AuthServiceControllerMethods() {
84
107
  return function (constructor: Function) {
85
- const grpcMethods: string[] = ["login", "refreshTokens", "startRegistration", "completeRegistration"];
108
+ const grpcMethods: string[] = [
109
+ "login",
110
+ "refreshTokens",
111
+ "startRegistration",
112
+ "completeRegistration",
113
+ "getRegistrationStatus",
114
+ ];
86
115
  for (const method of grpcMethods) {
87
116
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
88
117
  GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taskora-uni/contracts",
3
- "version": "3.1.0",
3
+ "version": "4.0.0",
4
4
  "description": "Shared protobuf contracts and generated TypeScript bindings for Taskora Uni backend services.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
package/proto/auth.proto CHANGED
@@ -7,6 +7,7 @@ service AuthService {
7
7
  rpc RefreshTokens(RefreshTokensRequest) returns (RefreshTokensResponse);
8
8
  rpc StartRegistration(StartRegistrationRequest) returns (StartRegistrationResponse);
9
9
  rpc CompleteRegistration(CompleteRegistrationRequest) returns (CompleteRegistrationResponse);
10
+ rpc GetRegistrationStatus(GetRegistrationStatusRequest) returns (GetRegistrationStatusResponse);
10
11
  }
11
12
 
12
13
  message LoginRequest {
@@ -38,6 +39,13 @@ message StartRegistrationResponse {
38
39
  string id = 1;
39
40
  }
40
41
 
42
+ enum RegistrationStatus {
43
+ UNSPECIFIED = 0;
44
+ PENDING = 1;
45
+ COMPLETED = 2;
46
+ REQUIRES_RESTART = 3;
47
+ }
48
+
41
49
  message CompleteRegistrationRequest {
42
50
  string id = 1;
43
51
  string code = 2;
@@ -47,6 +55,15 @@ message CompleteRegistrationRequest {
47
55
  }
48
56
 
49
57
  message CompleteRegistrationResponse {
50
- string access_token = 1;
51
- string refresh_token = 2;
58
+ RegistrationStatus status = 1;
59
+ }
60
+
61
+ message GetRegistrationStatusRequest {
62
+ string id = 1;
63
+ }
64
+
65
+ message GetRegistrationStatusResponse {
66
+ RegistrationStatus status = 1;
67
+ optional string access_token = 2;
68
+ optional string refresh_token = 3;
52
69
  }