@tabcinema/contracts 1.0.2

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,47 @@
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
+ export interface SendOtpRequest {
14
+ identifier: string;
15
+ type: string;
16
+ }
17
+
18
+ export interface SendOtpResponse {
19
+ ok: boolean;
20
+ }
21
+
22
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
23
+
24
+ export interface AuthServiceClient {
25
+ sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
26
+ }
27
+
28
+ export interface AuthServiceController {
29
+ sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
30
+ }
31
+
32
+ export function AuthServiceControllerMethods() {
33
+ return function (constructor: Function) {
34
+ const grpcMethods: string[] = ["sendOtp"];
35
+ for (const method of grpcMethods) {
36
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
37
+ GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
38
+ }
39
+ const grpcStreamMethods: string[] = [];
40
+ for (const method of grpcStreamMethods) {
41
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
42
+ GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
43
+ }
44
+ };
45
+ }
46
+
47
+ export const AUTH_SERVICE_NAME = "AuthService";
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@tabcinema/contracts",
3
+ "version": "1.0.2",
4
+ "description": "Protobuf definitions and generated TypeScript 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.11",
17
+ "rxjs": "^7.8.2",
18
+ "ts-proto": "^2.10.1"
19
+ }
20
+ }
@@ -0,0 +1,16 @@
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ service AuthService {
6
+ rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
7
+ }
8
+
9
+ message SendOtpRequest {
10
+ string identifier = 1;
11
+ string type = 2;
12
+ }
13
+
14
+ message SendOtpResponse {
15
+ bool ok = 1;
16
+ }
@@ -0,0 +1,54 @@
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ import "google/protobuf/struct.proto"; // == json
6
+ //? но надо быт с struct по осторожнее так как он делаеть данные динамическими и типизация пропадает
7
+ // import "google/protobuf/duration.proto"; // помогаеть работать с точностю в наносекундах
8
+ // import "google/protobuf/timestamp.proto"; // для времены
9
+ // import "google/protobuf/empty.proto"; // для вставлении в контракт пустой response или request
10
+
11
+ service AuthService {
12
+ rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
13
+
14
+ // rpc Ping (google.protobuf.Empty) returns (SendOtpRequest);
15
+ }
16
+
17
+ message SendOtpRequest {
18
+ string identifier = 1;
19
+ string type = 2;
20
+ }
21
+
22
+ // message UserSession {
23
+ // string id = 1;
24
+ // google.protobuf.Struct struct = 2;
25
+ // // google.protobuf.Duration duration = 2;
26
+ // // google.protobuf.Timestamp creteded_at = 2;
27
+ // }
28
+
29
+
30
+ /**
31
+
32
+
33
+
34
+ // message UserProfile {
35
+ // string id = 1;
36
+ // int32 age = 2;
37
+ // double rating = 3;
38
+ // bool verified = 4;
39
+ // repeated string roles = 5; // array
40
+ // map<string, string> meta = 6; // Record<string, string>
41
+ // Status status = 7;
42
+ // oneof contact {
43
+ // string phone = 8;
44
+ // string email = 9;
45
+ // }
46
+ // }
47
+
48
+ // enum Status {
49
+ // STATUS_UNKNOWN = 0;
50
+ // STATUS_ACTIVE = 1;
51
+ // STATUS_BANNED = 2;
52
+ // }
53
+
54
+ */