@thiscargo/contracts 0.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/index.js ADDED
@@ -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("./path"), exports);
package/gen/auth.ts ADDED
@@ -0,0 +1,48 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.11.2
4
+ // protoc v6.33.5
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
+ phone: string;
15
+ password: string;
16
+ }
17
+
18
+ export interface LoginResponse {
19
+ accessToken: string;
20
+ refreshToken: string;
21
+ }
22
+
23
+ export const AUTH_V1_PACKAGE_NAME = "auth.v1";
24
+
25
+ export interface AuthServiceClient {
26
+ login(request: LoginRequest): Observable<LoginResponse>;
27
+ }
28
+
29
+ export interface AuthServiceController {
30
+ login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
31
+ }
32
+
33
+ export function AuthServiceControllerMethods() {
34
+ return function (constructor: Function) {
35
+ const grpcMethods: string[] = ["login"];
36
+ for (const method of grpcMethods) {
37
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
38
+ GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
39
+ }
40
+ const grpcStreamMethods: string[] = [];
41
+ for (const method of grpcStreamMethods) {
42
+ const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
43
+ GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
44
+ }
45
+ };
46
+ }
47
+
48
+ export const AUTH_SERVICE_NAME = "AuthService";
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@thiscargo/contracts",
3
+ "version": "0.0.3",
4
+ "description": "Protobuf definitions and generated TypeScript types",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.build.json",
9
+ "generate": "protoc -I ./proto ./proto/*.proto --plugin=./node_modules/.bin/protoc-gen-ts_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
+ "dependencies": {
19
+ "@nestjs/microservices": "^11.1.13",
20
+ "rxjs": "^7.8.2"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^25.2.3",
24
+ "ts-proto": "^2.11.2",
25
+ "typescript": "^5.9.3"
26
+ }
27
+ }
@@ -0,0 +1,17 @@
1
+ syntax = "proto3";
2
+
3
+ package auth.v1;
4
+
5
+ service AuthService {
6
+ rpc Login(LoginRequest) returns (LoginResponse);
7
+ }
8
+
9
+ message LoginRequest {
10
+ string phone = 1;
11
+ string password = 2;
12
+ }
13
+
14
+ message LoginResponse {
15
+ string accessToken = 1;
16
+ string refreshToken = 2;
17
+ }