@platfformx/proto-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/.github/workflows/publish.npm.yml +34 -0
- package/eslint.config.mjs +35 -0
- package/gen/ts/auth-service/account.ts +52 -0
- package/gen/ts/auth-service/auth.ts +47 -0
- package/package.json +25 -0
- package/proto/auth-service/account.proto +24 -0
- package/proto/auth-service/auth.proto +18 -0
- package/src/index.ts +1 -0
- package/src/paths/index.ts +1 -0
- package/src/paths/proto-paths.ts +6 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Publish Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
name: Build job
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout repository
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: 20
|
|
21
|
+
|
|
22
|
+
- name: Install protoc
|
|
23
|
+
run: |
|
|
24
|
+
sudo apt-get update
|
|
25
|
+
sudo apt-get install -y protobuf-compiler
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: yarn install --frozen-lockfile
|
|
29
|
+
|
|
30
|
+
- name: Generate Ts protobuf
|
|
31
|
+
run: yarn run generate
|
|
32
|
+
|
|
33
|
+
- name: Build
|
|
34
|
+
run: yarn run build
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import eslint from '@eslint/js';
|
|
3
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
import tseslint from 'typescript-eslint';
|
|
6
|
+
|
|
7
|
+
export default tseslint.config(
|
|
8
|
+
{
|
|
9
|
+
ignores: ['eslint.config.mjs'],
|
|
10
|
+
},
|
|
11
|
+
eslint.configs.recommended,
|
|
12
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
13
|
+
eslintPluginPrettierRecommended,
|
|
14
|
+
{
|
|
15
|
+
languageOptions: {
|
|
16
|
+
globals: {
|
|
17
|
+
...globals.node,
|
|
18
|
+
...globals.jest,
|
|
19
|
+
},
|
|
20
|
+
sourceType: 'commonjs',
|
|
21
|
+
parserOptions: {
|
|
22
|
+
projectService: true,
|
|
23
|
+
tsconfigRootDir: import.meta.dirname,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
rules: {
|
|
29
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
30
|
+
'@typescript-eslint/no-floating-promises': 'warn',
|
|
31
|
+
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
32
|
+
'prettier/prettier': ['error', { endOfLine: 'auto' }],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.8
|
|
4
|
+
// protoc v7.34.0
|
|
5
|
+
// source: auth-service/account.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "auth_service.v1";
|
|
12
|
+
|
|
13
|
+
export interface GetAccountRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface GetAccountResponse {
|
|
18
|
+
id: string;
|
|
19
|
+
phone: string;
|
|
20
|
+
email: string;
|
|
21
|
+
isPhoneVerified: boolean;
|
|
22
|
+
isEmailVerified: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
|
|
26
|
+
|
|
27
|
+
export interface AccountServiceClient {
|
|
28
|
+
getAccount(request: GetAccountRequest): Observable<GetAccountResponse>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface AccountServiceController {
|
|
32
|
+
getAccount(
|
|
33
|
+
request: GetAccountRequest,
|
|
34
|
+
): Promise<GetAccountResponse> | Observable<GetAccountResponse> | GetAccountResponse;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function AccountServiceControllerMethods() {
|
|
38
|
+
return function (constructor: Function) {
|
|
39
|
+
const grpcMethods: string[] = ["getAccount"];
|
|
40
|
+
for (const method of grpcMethods) {
|
|
41
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
42
|
+
GrpcMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
43
|
+
}
|
|
44
|
+
const grpcStreamMethods: string[] = [];
|
|
45
|
+
for (const method of grpcStreamMethods) {
|
|
46
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
47
|
+
GrpcStreamMethod("AccountService", method)(constructor.prototype[method], method, descriptor);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const ACCOUNT_SERVICE_NAME = "AccountService";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.8
|
|
4
|
+
// protoc v7.34.0
|
|
5
|
+
// source: auth-service/auth.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "auth_service.v1";
|
|
12
|
+
|
|
13
|
+
export interface LoginRequest {
|
|
14
|
+
email: string;
|
|
15
|
+
password: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface LoginResponse {
|
|
19
|
+
accessToken: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const AUTH_SERVICE_V1_PACKAGE_NAME = "auth_service.v1";
|
|
23
|
+
|
|
24
|
+
export interface AuthServiceClient {
|
|
25
|
+
login(request: LoginRequest): Observable<LoginResponse>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AuthServiceController {
|
|
29
|
+
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function AuthServiceControllerMethods() {
|
|
33
|
+
return function (constructor: Function) {
|
|
34
|
+
const grpcMethods: string[] = ["login"];
|
|
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,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@platfformx/proto-contracts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"generate": "mkdirp gen/ts && globstar -- protoc -I=proto proto/**/*.proto --ts_proto_out=./gen/ts --ts_proto_opt=nestJs=true,esModuleInterop=true"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [],
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^25.7.0",
|
|
19
|
+
"globstar": "^1.0.0",
|
|
20
|
+
"mkdirp": "^3.0.1",
|
|
21
|
+
"ts-proto": "^2.11.8",
|
|
22
|
+
"typescript": "^6.0.3"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {}
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package auth_service.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
service AccountService {
|
|
8
|
+
rpc GetAccount (GetAccountRequest) returns (GetAccountResponse);
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
message GetAccountRequest {
|
|
13
|
+
string id = 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message GetAccountResponse {
|
|
17
|
+
string id = 1;
|
|
18
|
+
string phone = 2;
|
|
19
|
+
string email = 3;
|
|
20
|
+
bool is_phone_verified = 4;
|
|
21
|
+
bool is_email_verified = 5;
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package auth_service.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
service AuthService {
|
|
8
|
+
rpc Login (LoginRequest) returns (LoginResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message LoginRequest {
|
|
12
|
+
string email = 1;
|
|
13
|
+
string password = 2;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message LoginResponse {
|
|
17
|
+
string access_token = 1;
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './paths';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './proto-paths';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "esnext",
|
|
4
|
+
"moduleResolution": "bundler",
|
|
5
|
+
"target": "esnext",
|
|
6
|
+
"types": ["node"],
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"outDir": "./dist",
|
|
10
|
+
"rootDir": ".",
|
|
11
|
+
"strictNullChecks": false,
|
|
12
|
+
"noUncheckedIndexedAccess": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"strictNullChecks": false,
|
|
16
|
+
"skipLibCheck": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*"]
|
|
19
|
+
}
|