@ciganov/contracts 1.0.1 → 1.0.3
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.
- package/dist/events/account/email-changed.event.d.ts +4 -0
- package/dist/events/account/email-changed.event.js +2 -0
- package/dist/events/account/index.d.ts +1 -0
- package/dist/events/account/index.js +17 -0
- package/dist/events/auth/index.d.ts +1 -0
- package/dist/events/auth/index.js +17 -0
- package/dist/events/auth/otp-requested.event.d.ts +4 -0
- package/dist/events/auth/otp-requested.event.js +2 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/events/index.js +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +2 -1
- package/gen/account.ts +87 -0
- package/gen/auth.ts +88 -0
- package/gen/google/protobuf/empty.ts +23 -0
- package/package.json +3 -6
- package/proto/account.proto +45 -0
- package/proto/auth.proto +23 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './email-changed.event';
|
|
@@ -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("./email-changed.event"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './otp-requested.event';
|
|
@@ -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("./otp-requested.event"), exports);
|
|
@@ -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("./auth"), exports);
|
|
18
|
+
__exportStar(require("./account"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './proto';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './events';
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./proto"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./events"), exports);
|
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PROTO_PATHS = void 0;
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
exports.PROTO_PATHS = {
|
|
6
|
-
AUTH: (0, node_path_1.join)(__dirname, '../../proto/auth.proto')
|
|
6
|
+
AUTH: (0, node_path_1.join)(__dirname, '../../proto/auth.proto'),
|
|
7
|
+
ACCOUNT: (0, node_path_1.join)(__dirname, '../../proto/account.proto')
|
|
7
8
|
};
|
package/gen/account.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
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: account.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "account.v1";
|
|
12
|
+
|
|
13
|
+
export enum Role {
|
|
14
|
+
USER = 0,
|
|
15
|
+
ADMIN = 1,
|
|
16
|
+
UNRECOGNIZED = -1,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface GetAccountRequest {
|
|
20
|
+
id: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface GetAccountResponse {
|
|
24
|
+
id: string;
|
|
25
|
+
email: string;
|
|
26
|
+
role: Role;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface InitEmailChangeRequest {
|
|
30
|
+
email: string;
|
|
31
|
+
userId: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface InitEmailChangeResponse {
|
|
35
|
+
ok: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface ConfirmEmailChangeRequest {
|
|
39
|
+
email: string;
|
|
40
|
+
code: string;
|
|
41
|
+
userId: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ConfirmEmailChangeResponse {
|
|
45
|
+
ok: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const ACCOUNT_V1_PACKAGE_NAME = "account.v1";
|
|
49
|
+
|
|
50
|
+
export interface AccountServiceClient {
|
|
51
|
+
getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
52
|
+
|
|
53
|
+
initEmailChange(request: InitEmailChangeRequest): Observable<InitEmailChangeResponse>;
|
|
54
|
+
|
|
55
|
+
confirmEmailChange(request: ConfirmEmailChangeRequest): Observable<ConfirmEmailChangeResponse>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface AccountServiceController {
|
|
59
|
+
getAccount(
|
|
60
|
+
request: GetAccountRequest,
|
|
61
|
+
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
62
|
+
|
|
63
|
+
initEmailChange(
|
|
64
|
+
request: InitEmailChangeRequest,
|
|
65
|
+
): Promise<InitEmailChangeResponse> | Observable<InitEmailChangeResponse> | InitEmailChangeResponse;
|
|
66
|
+
|
|
67
|
+
confirmEmailChange(
|
|
68
|
+
request: ConfirmEmailChangeRequest,
|
|
69
|
+
): Promise<ConfirmEmailChangeResponse> | Observable<ConfirmEmailChangeResponse> | ConfirmEmailChangeResponse;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function AccountServiceControllerMethods() {
|
|
73
|
+
return function (constructor: Function) {
|
|
74
|
+
const grpcMethods: string[] = ["getAccount", "initEmailChange", "confirmEmailChange"];
|
|
75
|
+
for (const method of grpcMethods) {
|
|
76
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
77
|
+
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
78
|
+
}
|
|
79
|
+
const grpcStreamMethods: string[] = [];
|
|
80
|
+
for (const method of grpcStreamMethods) {
|
|
81
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
82
|
+
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
package/gen/auth.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
import { Empty } from "./google/protobuf/empty";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "auth.v1";
|
|
13
|
+
|
|
14
|
+
export interface SendOtpRequest {
|
|
15
|
+
identifier: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SendOtpResponse {
|
|
19
|
+
ok: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface VerifyOtpRequest {
|
|
23
|
+
identifier: string;
|
|
24
|
+
code: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface VerifyOtpResponse {
|
|
28
|
+
token: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface GetSessionByTokenRequest {
|
|
32
|
+
token: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface GetSessionByTokenResponse {
|
|
36
|
+
session?: Session | undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Session {
|
|
40
|
+
id: string;
|
|
41
|
+
token: string;
|
|
42
|
+
userId: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface RefreshTokenRequest {
|
|
46
|
+
token: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
50
|
+
|
|
51
|
+
export interface AuthServiceClient {
|
|
52
|
+
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
53
|
+
|
|
54
|
+
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
55
|
+
|
|
56
|
+
getSessionByToken(request: GetSessionByTokenRequest): Observable<GetSessionByTokenResponse>;
|
|
57
|
+
|
|
58
|
+
refreshToken(request: RefreshTokenRequest): Observable<Empty>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface AuthServiceController {
|
|
62
|
+
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
63
|
+
|
|
64
|
+
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
65
|
+
|
|
66
|
+
getSessionByToken(
|
|
67
|
+
request: GetSessionByTokenRequest,
|
|
68
|
+
): Promise<GetSessionByTokenResponse> | Observable<GetSessionByTokenResponse> | GetSessionByTokenResponse;
|
|
69
|
+
|
|
70
|
+
refreshToken(request: RefreshTokenRequest): void | Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function AuthServiceControllerMethods() {
|
|
74
|
+
return function (constructor: Function) {
|
|
75
|
+
const grpcMethods: string[] = ["sendOtp", "verifyOtp", "getSessionByToken", "refreshToken"];
|
|
76
|
+
for (const method of grpcMethods) {
|
|
77
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
78
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
79
|
+
}
|
|
80
|
+
const grpcStreamMethods: string[] = [];
|
|
81
|
+
for (const method of grpcStreamMethods) {
|
|
82
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
83
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A generic empty message that you can re-use to avoid defining duplicated
|
|
13
|
+
* empty messages in your APIs. A typical example is to use it as the request
|
|
14
|
+
* or the response type of an API method. For instance:
|
|
15
|
+
*
|
|
16
|
+
* service Foo {
|
|
17
|
+
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
|
18
|
+
* }
|
|
19
|
+
*/
|
|
20
|
+
export interface Empty {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";
|
package/package.json
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ciganov/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Protobuf definitions and generated ts types",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./
|
|
8
|
+
"generate": "mkdir -p ./gen && protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit",
|
|
9
9
|
"build": "tsc -p tsconfig.build.json"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"proto",
|
|
13
|
+
"gen",
|
|
13
14
|
"dist"
|
|
14
15
|
],
|
|
15
|
-
"exports": {
|
|
16
|
-
".": "./dist/index.js",
|
|
17
|
-
"./gen/*": "./dist/gen/*"
|
|
18
|
-
},
|
|
19
16
|
"publishConfig": {
|
|
20
17
|
"access": "public"
|
|
21
18
|
},
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package account.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
service AccountService {
|
|
7
|
+
rpc GetAccount(GetAccountRequest) returns (GetAccountResponse);
|
|
8
|
+
rpc InitEmailChange(InitEmailChangeRequest) returns (InitEmailChangeResponse);
|
|
9
|
+
rpc ConfirmEmailChange(ConfirmEmailChangeRequest) returns (ConfirmEmailChangeResponse);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
message GetAccountRequest {
|
|
13
|
+
string id = 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message GetAccountResponse {
|
|
17
|
+
string id = 1;
|
|
18
|
+
string email = 2;
|
|
19
|
+
Role role = 3;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message InitEmailChangeRequest {
|
|
23
|
+
string email = 1;
|
|
24
|
+
string user_id = 2;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message InitEmailChangeResponse {
|
|
28
|
+
bool ok = 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message ConfirmEmailChangeRequest {
|
|
32
|
+
string email = 1;
|
|
33
|
+
string code = 2;
|
|
34
|
+
string user_id = 3;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message ConfirmEmailChangeResponse {
|
|
38
|
+
bool ok = 1;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
enum Role {
|
|
43
|
+
USER = 0;
|
|
44
|
+
ADMIN = 1;
|
|
45
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -2,9 +2,14 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package auth.v1;
|
|
4
4
|
|
|
5
|
+
import "google/protobuf/empty.proto";
|
|
6
|
+
|
|
5
7
|
service AuthService {
|
|
6
8
|
rpc SendOtp(SendOtpRequest) returns (SendOtpResponse);
|
|
7
9
|
rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
10
|
+
|
|
11
|
+
rpc GetSessionByToken(GetSessionByTokenRequest) returns(GetSessionByTokenResponse);
|
|
12
|
+
rpc RefreshToken(RefreshTokenRequest) returns (google.protobuf.Empty);
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
message SendOtpRequest {
|
|
@@ -22,4 +27,22 @@ message VerifyOtpRequest {
|
|
|
22
27
|
|
|
23
28
|
message VerifyOtpResponse {
|
|
24
29
|
string token = 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
message GetSessionByTokenRequest {
|
|
33
|
+
string token = 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
message GetSessionByTokenResponse {
|
|
37
|
+
optional Session session = 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
message Session {
|
|
41
|
+
string id = 1;
|
|
42
|
+
string token = 2;
|
|
43
|
+
string user_id = 3;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message RefreshTokenRequest {
|
|
47
|
+
string token = 1;
|
|
25
48
|
}
|