@taskora-uni/contracts 3.1.0 → 4.0.1

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.
Files changed (32) hide show
  1. package/dist/events/auth/patterns/event-patterns.d.ts +2 -1
  2. package/dist/events/auth/patterns/event-patterns.js +2 -1
  3. package/dist/events/auth/payloads/index.d.ts +1 -0
  4. package/dist/events/auth/payloads/index.js +1 -0
  5. package/dist/events/auth/payloads/profile-creation-requested.payload.d.ts +7 -0
  6. package/dist/events/auth/payloads/profile-creation-requested.payload.js +2 -0
  7. package/dist/events/index.d.ts +1 -0
  8. package/dist/events/index.js +1 -0
  9. package/dist/events/user/index.d.ts +2 -0
  10. package/dist/events/user/index.js +18 -0
  11. package/dist/events/user/patterns/event-patterns.d.ts +4 -0
  12. package/dist/events/user/patterns/event-patterns.js +7 -0
  13. package/dist/events/user/patterns/index.d.ts +1 -0
  14. package/dist/events/user/patterns/index.js +17 -0
  15. package/dist/events/user/payloads/index.d.ts +2 -0
  16. package/dist/events/user/payloads/index.js +18 -0
  17. package/dist/events/user/payloads/profile-created.payload.d.ts +5 -0
  18. package/dist/events/user/payloads/profile-created.payload.js +2 -0
  19. package/dist/events/user/payloads/profile-creation-failed.payload.d.ts +6 -0
  20. package/dist/events/user/payloads/profile-creation-failed.payload.js +2 -0
  21. package/dist/generated/auth.d.ts +67 -0
  22. package/dist/generated/auth.js +42 -0
  23. package/{generated/google/protobuf/empty.ts → dist/generated/google/protobuf/empty.d.ts} +2 -12
  24. package/dist/generated/google/protobuf/empty.js +11 -0
  25. package/{generated/google/protobuf/timestamp.ts → dist/generated/google/protobuf/timestamp.d.ts} +15 -25
  26. package/dist/generated/google/protobuf/timestamp.js +11 -0
  27. package/dist/generated/invitation.d.ts +46 -0
  28. package/dist/generated/invitation.js +33 -0
  29. package/package.json +12 -3
  30. package/proto/auth.proto +19 -2
  31. package/generated/auth.ts +0 -98
  32. package/generated/invitation.ts +0 -100
@@ -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 });
@@ -0,0 +1,67 @@
1
+ import { Observable } from "rxjs";
2
+ export declare const protobufPackage = "auth.v1";
3
+ export declare enum RegistrationStatus {
4
+ UNSPECIFIED = 0,
5
+ PENDING = 1,
6
+ COMPLETED = 2,
7
+ REQUIRES_RESTART = 3,
8
+ UNRECOGNIZED = -1
9
+ }
10
+ export interface LoginRequest {
11
+ email: string;
12
+ password: string;
13
+ }
14
+ export interface LoginResponse {
15
+ accessToken: string;
16
+ refreshToken: string;
17
+ }
18
+ export interface RefreshTokensRequest {
19
+ refreshToken: string;
20
+ }
21
+ export interface RefreshTokensResponse {
22
+ accessToken: string;
23
+ refreshToken: string;
24
+ }
25
+ export interface StartRegistrationRequest {
26
+ email: string;
27
+ password: string;
28
+ token: string;
29
+ }
30
+ export interface StartRegistrationResponse {
31
+ id: string;
32
+ }
33
+ export interface CompleteRegistrationRequest {
34
+ id: string;
35
+ code: string;
36
+ token: string;
37
+ firstName: string;
38
+ lastName: string;
39
+ }
40
+ export interface CompleteRegistrationResponse {
41
+ status: RegistrationStatus;
42
+ }
43
+ export interface GetRegistrationStatusRequest {
44
+ id: string;
45
+ }
46
+ export interface GetRegistrationStatusResponse {
47
+ status: RegistrationStatus;
48
+ accessToken?: string | undefined;
49
+ refreshToken?: string | undefined;
50
+ }
51
+ export declare const AUTH_V1_PACKAGE_NAME = "auth.v1";
52
+ export interface AuthServiceClient {
53
+ login(request: LoginRequest): Observable<LoginResponse>;
54
+ refreshTokens(request: RefreshTokensRequest): Observable<RefreshTokensResponse>;
55
+ startRegistration(request: StartRegistrationRequest): Observable<StartRegistrationResponse>;
56
+ completeRegistration(request: CompleteRegistrationRequest): Observable<CompleteRegistrationResponse>;
57
+ getRegistrationStatus(request: GetRegistrationStatusRequest): Observable<GetRegistrationStatusResponse>;
58
+ }
59
+ export interface AuthServiceController {
60
+ login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
61
+ refreshTokens(request: RefreshTokensRequest): Promise<RefreshTokensResponse> | Observable<RefreshTokensResponse> | RefreshTokensResponse;
62
+ startRegistration(request: StartRegistrationRequest): Promise<StartRegistrationResponse> | Observable<StartRegistrationResponse> | StartRegistrationResponse;
63
+ completeRegistration(request: CompleteRegistrationRequest): Promise<CompleteRegistrationResponse> | Observable<CompleteRegistrationResponse> | CompleteRegistrationResponse;
64
+ getRegistrationStatus(request: GetRegistrationStatusRequest): Promise<GetRegistrationStatusResponse> | Observable<GetRegistrationStatusResponse> | GetRegistrationStatusResponse;
65
+ }
66
+ export declare function AuthServiceControllerMethods(): (constructor: Function) => void;
67
+ export declare const AUTH_SERVICE_NAME = "AuthService";
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
+ // source: auth.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AUTH_SERVICE_NAME = exports.AUTH_V1_PACKAGE_NAME = exports.RegistrationStatus = exports.protobufPackage = void 0;
9
+ exports.AuthServiceControllerMethods = AuthServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "auth.v1";
13
+ var RegistrationStatus;
14
+ (function (RegistrationStatus) {
15
+ RegistrationStatus[RegistrationStatus["UNSPECIFIED"] = 0] = "UNSPECIFIED";
16
+ RegistrationStatus[RegistrationStatus["PENDING"] = 1] = "PENDING";
17
+ RegistrationStatus[RegistrationStatus["COMPLETED"] = 2] = "COMPLETED";
18
+ RegistrationStatus[RegistrationStatus["REQUIRES_RESTART"] = 3] = "REQUIRES_RESTART";
19
+ RegistrationStatus[RegistrationStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
20
+ })(RegistrationStatus || (exports.RegistrationStatus = RegistrationStatus = {}));
21
+ exports.AUTH_V1_PACKAGE_NAME = "auth.v1";
22
+ function AuthServiceControllerMethods() {
23
+ return function (constructor) {
24
+ const grpcMethods = [
25
+ "login",
26
+ "refreshTokens",
27
+ "startRegistration",
28
+ "completeRegistration",
29
+ "getRegistrationStatus",
30
+ ];
31
+ for (const method of grpcMethods) {
32
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
33
+ (0, microservices_1.GrpcMethod)("AuthService", method)(constructor.prototype[method], method, descriptor);
34
+ }
35
+ const grpcStreamMethods = [];
36
+ for (const method of grpcStreamMethods) {
37
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
38
+ (0, microservices_1.GrpcStreamMethod)("AuthService", method)(constructor.prototype[method], method, descriptor);
39
+ }
40
+ };
41
+ }
42
+ exports.AUTH_SERVICE_NAME = "AuthService";
@@ -1,13 +1,4 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.6
4
- // protoc v3.21.12
5
- // source: google/protobuf/empty.proto
6
-
7
- /* eslint-disable */
8
-
9
- export const protobufPackage = "google.protobuf";
10
-
1
+ export declare const protobufPackage = "google.protobuf";
11
2
  /**
12
3
  * A generic empty message that you can re-use to avoid defining duplicated
13
4
  * empty messages in your APIs. A typical example is to use it as the request
@@ -19,5 +10,4 @@ export const protobufPackage = "google.protobuf";
19
10
  */
20
11
  export interface Empty {
21
12
  }
22
-
23
- export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
13
+ export declare const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
+ // source: google/protobuf/empty.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ exports.protobufPackage = "google.protobuf";
11
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
@@ -1,13 +1,4 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.6
4
- // protoc v3.21.12
5
- // source: google/protobuf/timestamp.proto
6
-
7
- /* eslint-disable */
8
-
9
- export const protobufPackage = "google.protobuf";
10
-
1
+ export declare const protobufPackage = "google.protobuf";
11
2
  /**
12
3
  * A Timestamp represents a point in time independent of any time zone or local
13
4
  * calendar, encoded as a count of seconds and fractions of seconds at
@@ -100,19 +91,18 @@ export const protobufPackage = "google.protobuf";
100
91
  * ) to obtain a formatter capable of generating timestamps in this format.
101
92
  */
102
93
  export interface Timestamp {
103
- /**
104
- * Represents seconds of UTC time since Unix epoch
105
- * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
106
- * 9999-12-31T23:59:59Z inclusive.
107
- */
108
- seconds: number;
109
- /**
110
- * Non-negative fractions of a second at nanosecond resolution. Negative
111
- * second values with fractions must still have non-negative nanos values
112
- * that count forward in time. Must be from 0 to 999,999,999
113
- * inclusive.
114
- */
115
- nanos: number;
94
+ /**
95
+ * Represents seconds of UTC time since Unix epoch
96
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
97
+ * 9999-12-31T23:59:59Z inclusive.
98
+ */
99
+ seconds: number;
100
+ /**
101
+ * Non-negative fractions of a second at nanosecond resolution. Negative
102
+ * second values with fractions must still have non-negative nanos values
103
+ * that count forward in time. Must be from 0 to 999,999,999
104
+ * inclusive.
105
+ */
106
+ nanos: number;
116
107
  }
117
-
118
- export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
108
+ export declare const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
+ // source: google/protobuf/timestamp.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ exports.protobufPackage = "google.protobuf";
11
+ exports.GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
@@ -0,0 +1,46 @@
1
+ import { Observable } from "rxjs";
2
+ import { Empty } from "./google/protobuf/empty";
3
+ import { Timestamp } from "./google/protobuf/timestamp";
4
+ export declare const protobufPackage = "invitation.v1";
5
+ export interface CreateInvitationResponse {
6
+ token: string;
7
+ expiresAt: Timestamp | undefined;
8
+ }
9
+ export interface InvitationUsedBy {
10
+ id: string;
11
+ email: string;
12
+ }
13
+ export interface Invitation {
14
+ id: string;
15
+ usedBy?: InvitationUsedBy | undefined;
16
+ expiresAt: Timestamp | undefined;
17
+ usedAt?: Timestamp | undefined;
18
+ createdAt: Timestamp | undefined;
19
+ }
20
+ export interface ListInvitationsResponse {
21
+ invitations: Invitation[];
22
+ }
23
+ export interface ValidateInvitationTokenRequest {
24
+ token: string;
25
+ }
26
+ export interface ValidateInvitationTokenResponse {
27
+ isValid: boolean;
28
+ }
29
+ export interface DeleteInvitationRequest {
30
+ id: string;
31
+ }
32
+ export declare const INVITATION_V1_PACKAGE_NAME = "invitation.v1";
33
+ export interface InvitationServiceClient {
34
+ createInvitation(request: Empty): Observable<CreateInvitationResponse>;
35
+ listInvitations(request: Empty): Observable<ListInvitationsResponse>;
36
+ validateInvitationToken(request: ValidateInvitationTokenRequest): Observable<ValidateInvitationTokenResponse>;
37
+ deleteInvitation(request: DeleteInvitationRequest): Observable<Empty>;
38
+ }
39
+ export interface InvitationServiceController {
40
+ createInvitation(request: Empty): Promise<CreateInvitationResponse> | Observable<CreateInvitationResponse> | CreateInvitationResponse;
41
+ listInvitations(request: Empty): Promise<ListInvitationsResponse> | Observable<ListInvitationsResponse> | ListInvitationsResponse;
42
+ validateInvitationToken(request: ValidateInvitationTokenRequest): Promise<ValidateInvitationTokenResponse> | Observable<ValidateInvitationTokenResponse> | ValidateInvitationTokenResponse;
43
+ deleteInvitation(request: DeleteInvitationRequest): void | Promise<void>;
44
+ }
45
+ export declare function InvitationServiceControllerMethods(): (constructor: Function) => void;
46
+ export declare const INVITATION_SERVICE_NAME = "InvitationService";
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.11.6
5
+ // protoc v3.21.12
6
+ // source: invitation.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.INVITATION_SERVICE_NAME = exports.INVITATION_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
9
+ exports.InvitationServiceControllerMethods = InvitationServiceControllerMethods;
10
+ /* eslint-disable */
11
+ const microservices_1 = require("@nestjs/microservices");
12
+ exports.protobufPackage = "invitation.v1";
13
+ exports.INVITATION_V1_PACKAGE_NAME = "invitation.v1";
14
+ function InvitationServiceControllerMethods() {
15
+ return function (constructor) {
16
+ const grpcMethods = [
17
+ "createInvitation",
18
+ "listInvitations",
19
+ "validateInvitationToken",
20
+ "deleteInvitation",
21
+ ];
22
+ for (const method of grpcMethods) {
23
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
24
+ (0, microservices_1.GrpcMethod)("InvitationService", method)(constructor.prototype[method], method, descriptor);
25
+ }
26
+ const grpcStreamMethods = [];
27
+ for (const method of grpcStreamMethods) {
28
+ const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
29
+ (0, microservices_1.GrpcStreamMethod)("InvitationService", method)(constructor.prototype[method], method, descriptor);
30
+ }
31
+ };
32
+ }
33
+ exports.INVITATION_SERVICE_NAME = "InvitationService";
package/package.json CHANGED
@@ -1,14 +1,23 @@
1
1
  {
2
2
  "name": "@taskora-uni/contracts",
3
- "version": "3.1.0",
3
+ "version": "4.0.1",
4
4
  "description": "Shared protobuf contracts and generated TypeScript bindings for Taskora Uni backend services.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./generated/auth": {
15
+ "types": "./dist/generated/auth.d.ts",
16
+ "default": "./dist/generated/auth.js"
17
+ }
18
+ },
9
19
  "files": [
10
20
  "proto",
11
- "generated",
12
21
  "dist"
13
22
  ],
14
23
  "publishConfig": {
@@ -25,6 +34,6 @@
25
34
  },
26
35
  "scripts": {
27
36
  "build": "tsc -p tsconfig.build.json",
28
- "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./generated --ts_proto_opt=nestJs=true,package=omit"
37
+ "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./src/generated --ts_proto_opt=nestJs=true,package=omit"
29
38
  }
30
39
  }
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
  }
package/generated/auth.ts DELETED
@@ -1,98 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.6
4
- // protoc v3.21.12
5
- // source: auth.proto
6
-
7
- /* eslint-disable */
8
- import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
- import { Observable } from "rxjs";
10
-
11
- export const protobufPackage = "auth.v1";
12
-
13
- export interface LoginRequest {
14
- email: string;
15
- password: string;
16
- }
17
-
18
- export interface LoginResponse {
19
- accessToken: string;
20
- refreshToken: string;
21
- }
22
-
23
- export interface RefreshTokensRequest {
24
- refreshToken: string;
25
- }
26
-
27
- export interface RefreshTokensResponse {
28
- accessToken: string;
29
- refreshToken: string;
30
- }
31
-
32
- export interface StartRegistrationRequest {
33
- email: string;
34
- password: string;
35
- token: string;
36
- }
37
-
38
- export interface StartRegistrationResponse {
39
- id: string;
40
- }
41
-
42
- export interface CompleteRegistrationRequest {
43
- id: string;
44
- code: string;
45
- token: string;
46
- firstName: string;
47
- lastName: string;
48
- }
49
-
50
- export interface CompleteRegistrationResponse {
51
- accessToken: string;
52
- refreshToken: string;
53
- }
54
-
55
- export const AUTH_V1_PACKAGE_NAME = "auth.v1";
56
-
57
- export interface AuthServiceClient {
58
- login(request: LoginRequest): Observable<LoginResponse>;
59
-
60
- refreshTokens(request: RefreshTokensRequest): Observable<RefreshTokensResponse>;
61
-
62
- startRegistration(request: StartRegistrationRequest): Observable<StartRegistrationResponse>;
63
-
64
- completeRegistration(request: CompleteRegistrationRequest): Observable<CompleteRegistrationResponse>;
65
- }
66
-
67
- export interface AuthServiceController {
68
- login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
69
-
70
- refreshTokens(
71
- request: RefreshTokensRequest,
72
- ): Promise<RefreshTokensResponse> | Observable<RefreshTokensResponse> | RefreshTokensResponse;
73
-
74
- startRegistration(
75
- request: StartRegistrationRequest,
76
- ): Promise<StartRegistrationResponse> | Observable<StartRegistrationResponse> | StartRegistrationResponse;
77
-
78
- completeRegistration(
79
- request: CompleteRegistrationRequest,
80
- ): Promise<CompleteRegistrationResponse> | Observable<CompleteRegistrationResponse> | CompleteRegistrationResponse;
81
- }
82
-
83
- export function AuthServiceControllerMethods() {
84
- return function (constructor: Function) {
85
- const grpcMethods: string[] = ["login", "refreshTokens", "startRegistration", "completeRegistration"];
86
- for (const method of grpcMethods) {
87
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
88
- GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
89
- }
90
- const grpcStreamMethods: string[] = [];
91
- for (const method of grpcStreamMethods) {
92
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
93
- GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
94
- }
95
- };
96
- }
97
-
98
- export const AUTH_SERVICE_NAME = "AuthService";
@@ -1,100 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.6
4
- // protoc v3.21.12
5
- // source: invitation.proto
6
-
7
- /* eslint-disable */
8
- import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
9
- import { Observable } from "rxjs";
10
- import { Empty } from "./google/protobuf/empty";
11
- import { Timestamp } from "./google/protobuf/timestamp";
12
-
13
- export const protobufPackage = "invitation.v1";
14
-
15
- export interface CreateInvitationResponse {
16
- token: string;
17
- expiresAt: Timestamp | undefined;
18
- }
19
-
20
- export interface InvitationUsedBy {
21
- id: string;
22
- email: string;
23
- }
24
-
25
- export interface Invitation {
26
- id: string;
27
- usedBy?: InvitationUsedBy | undefined;
28
- expiresAt: Timestamp | undefined;
29
- usedAt?: Timestamp | undefined;
30
- createdAt: Timestamp | undefined;
31
- }
32
-
33
- export interface ListInvitationsResponse {
34
- invitations: Invitation[];
35
- }
36
-
37
- export interface ValidateInvitationTokenRequest {
38
- token: string;
39
- }
40
-
41
- export interface ValidateInvitationTokenResponse {
42
- isValid: boolean;
43
- }
44
-
45
- export interface DeleteInvitationRequest {
46
- id: string;
47
- }
48
-
49
- export const INVITATION_V1_PACKAGE_NAME = "invitation.v1";
50
-
51
- export interface InvitationServiceClient {
52
- createInvitation(request: Empty): Observable<CreateInvitationResponse>;
53
-
54
- listInvitations(request: Empty): Observable<ListInvitationsResponse>;
55
-
56
- validateInvitationToken(request: ValidateInvitationTokenRequest): Observable<ValidateInvitationTokenResponse>;
57
-
58
- deleteInvitation(request: DeleteInvitationRequest): Observable<Empty>;
59
- }
60
-
61
- export interface InvitationServiceController {
62
- createInvitation(
63
- request: Empty,
64
- ): Promise<CreateInvitationResponse> | Observable<CreateInvitationResponse> | CreateInvitationResponse;
65
-
66
- listInvitations(
67
- request: Empty,
68
- ): Promise<ListInvitationsResponse> | Observable<ListInvitationsResponse> | ListInvitationsResponse;
69
-
70
- validateInvitationToken(
71
- request: ValidateInvitationTokenRequest,
72
- ):
73
- | Promise<ValidateInvitationTokenResponse>
74
- | Observable<ValidateInvitationTokenResponse>
75
- | ValidateInvitationTokenResponse;
76
-
77
- deleteInvitation(request: DeleteInvitationRequest): void | Promise<void>;
78
- }
79
-
80
- export function InvitationServiceControllerMethods() {
81
- return function (constructor: Function) {
82
- const grpcMethods: string[] = [
83
- "createInvitation",
84
- "listInvitations",
85
- "validateInvitationToken",
86
- "deleteInvitation",
87
- ];
88
- for (const method of grpcMethods) {
89
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
90
- GrpcMethod("InvitationService", method)(constructor.prototype[method], method, descriptor);
91
- }
92
- const grpcStreamMethods: string[] = [];
93
- for (const method of grpcStreamMethods) {
94
- const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
95
- GrpcStreamMethod("InvitationService", method)(constructor.prototype[method], method, descriptor);
96
- }
97
- };
98
- }
99
-
100
- export const INVITATION_SERVICE_NAME = "InvitationService";