@dimgit9/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 ADDED
@@ -0,0 +1,57 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.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
+ /** Req for OTP */
14
+ export interface SendOtpRequest {
15
+ identifier: string;
16
+ type: string;
17
+ }
18
+
19
+ /** Res whether it was successfully sent */
20
+ export interface SendOtpResponse {
21
+ ok: boolean;
22
+ }
23
+
24
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
25
+
26
+ /** Provides authentication-related RPCs */
27
+
28
+ export interface AuthServiceClient {
29
+ /** SendOtp sends a one-time password (OTP) to the given identifier */
30
+
31
+ sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
32
+ }
33
+
34
+ /** Provides authentication-related RPCs */
35
+
36
+ export interface AuthServiceController {
37
+ /** SendOtp sends a one-time password (OTP) to the given identifier */
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,20 @@
1
+ {
2
+ "name": "@dimgit9/contracts",
3
+ "version": "1.0.0",
4
+ "description": "Protobuf definitions and generated TS types",
5
+ "scripts": {
6
+ "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
7
+ },
8
+ "files": [
9
+ "proto",
10
+ "gen"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@nestjs/microservices": "^11.1.12",
17
+ "rxjs": "^7.8.2",
18
+ "ts-proto": "^2.11.1"
19
+ }
20
+ }
@@ -0,0 +1,21 @@
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ // Provides authentication-related RPCs
6
+ service AuthService {
7
+ // SendOtp sends a one-time password (OTP) to the given identifier
8
+ rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
9
+ }
10
+
11
+ // Req for OTP
12
+ message SendOtpRequest {
13
+ string identifier = 1;
14
+ string type = 2;
15
+ }
16
+
17
+ // Res whether it was successfully sent
18
+ message SendOtpResponse {
19
+ bool ok = 1;
20
+ }
21
+