@aaanton/contracts 1.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.
- package/gen/auth.ts +57 -0
- package/package.json +27 -0
- package/proto/auth.proto +20 -0
package/gen/auth.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.10.1
|
|
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
|
+
/** Request to SendOtp */
|
|
14
|
+
export interface SendOtpRequest {
|
|
15
|
+
identifier: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Response for SendOtp */
|
|
20
|
+
export interface SendOtpResponse {
|
|
21
|
+
status: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
25
|
+
|
|
26
|
+
/** Auth service handles authentication */
|
|
27
|
+
|
|
28
|
+
export interface AuthServiceClient {
|
|
29
|
+
/** Sends one time password */
|
|
30
|
+
|
|
31
|
+
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Auth service handles authentication */
|
|
35
|
+
|
|
36
|
+
export interface AuthServiceController {
|
|
37
|
+
/** Sends one time password */
|
|
38
|
+
|
|
39
|
+
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function AuthServiceControllerMethods() {
|
|
43
|
+
return function (constructor: Function) {
|
|
44
|
+
const grpcMethods: string[] = ["sendOtp"];
|
|
45
|
+
for (const method of grpcMethods) {
|
|
46
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
47
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
48
|
+
}
|
|
49
|
+
const grpcStreamMethods: string[] = [];
|
|
50
|
+
for (const method of grpcStreamMethods) {
|
|
51
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
52
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aaanton/contracts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"proto:gen": "node node_modules/grpc-tools/bin/protoc.js -I proto proto/*.proto --plugin=protoc-gen-ts_proto=node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=gen --ts_proto_opt=nestJs=true,outputServices=grpc-js,packageOmit=true",
|
|
9
|
+
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"proto",
|
|
13
|
+
"gen"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"type": "commonjs",
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"grpc-tools": "^1.13.1",
|
|
21
|
+
"ts-proto": "^2.10.1"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@nestjs/microservices": "^11.1.11",
|
|
25
|
+
"rxjs": "^7.8.2"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/proto/auth.proto
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package auth.v1;
|
|
4
|
+
|
|
5
|
+
// Auth service handles authentication
|
|
6
|
+
service AuthService {
|
|
7
|
+
// Sends one time password
|
|
8
|
+
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Request to SendOtp
|
|
12
|
+
message SendOtpRequest {
|
|
13
|
+
string identifier = 1;
|
|
14
|
+
string type = 2;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Response for SendOtp
|
|
18
|
+
message SendOtpResponse {
|
|
19
|
+
bool status = 1;
|
|
20
|
+
}
|