@enclusiorpetcinema/contracts 1.0.0 → 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/dist/index.js +17 -0
- package/gen/auth.ts +16 -1
- package/package.json +12 -1
- package/proto/auth.proto +12 -0
- package/.github/workflows/publish.yml +0 -37
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("./proto"), exports);
|
package/gen/auth.ts
CHANGED
|
@@ -19,19 +19,34 @@ export interface SendOtpResponse {
|
|
|
19
19
|
ok: boolean;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export interface VerifyOtpRequest {
|
|
23
|
+
identifier: string;
|
|
24
|
+
type: string;
|
|
25
|
+
code: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface VerifyOtpResponse {
|
|
29
|
+
accessToken: string;
|
|
30
|
+
refreshToken: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
23
34
|
|
|
24
35
|
export interface AuthServiceClient {
|
|
25
36
|
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
37
|
+
|
|
38
|
+
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
26
39
|
}
|
|
27
40
|
|
|
28
41
|
export interface AuthServiceController {
|
|
29
42
|
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
43
|
+
|
|
44
|
+
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
30
45
|
}
|
|
31
46
|
|
|
32
47
|
export function AuthServiceControllerMethods() {
|
|
33
48
|
return function (constructor: Function) {
|
|
34
|
-
const grpcMethods: string[] = ["sendOtp"];
|
|
49
|
+
const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
|
|
35
50
|
for (const method of grpcMethods) {
|
|
36
51
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
37
52
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enclusiorpetcinema/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"proto",
|
|
8
|
+
"gen"
|
|
9
|
+
],
|
|
4
10
|
"scripts": {
|
|
11
|
+
"build": "tsc -p tsconfig.build.json",
|
|
5
12
|
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
6
13
|
},
|
|
7
14
|
"author": "Enclusior",
|
|
@@ -13,5 +20,9 @@
|
|
|
13
20
|
"@nestjs/microservices": "^11.1.12",
|
|
14
21
|
"rxjs": "^7.8.2",
|
|
15
22
|
"ts-proto": "^2.11.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^25.2.1",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
16
27
|
}
|
|
17
28
|
}
|
package/proto/auth.proto
CHANGED
|
@@ -5,6 +5,7 @@ package auth.v1;
|
|
|
5
5
|
|
|
6
6
|
service AuthService {
|
|
7
7
|
rpc SendOtp(SendOtpRequest) returns (SendOtpResponse);
|
|
8
|
+
rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
message SendOtpRequest {
|
|
@@ -15,3 +16,14 @@ message SendOtpRequest {
|
|
|
15
16
|
message SendOtpResponse {
|
|
16
17
|
bool ok = 1;
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
message VerifyOtpRequest {
|
|
21
|
+
string identifier = 1;
|
|
22
|
+
string type = 2;
|
|
23
|
+
string code = 3;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
message VerifyOtpResponse {
|
|
27
|
+
string access_token = 1;
|
|
28
|
+
string refresh_token = 2;
|
|
29
|
+
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
name: Publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
publish:
|
|
10
|
-
name: Publish Job
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout repository
|
|
14
|
-
uses: actions/checkout@v4
|
|
15
|
-
|
|
16
|
-
- name: Setup Node.js
|
|
17
|
-
uses: actions/setup-node@v4
|
|
18
|
-
|
|
19
|
-
- name: Setup Node.js
|
|
20
|
-
uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: 20
|
|
23
|
-
registry-url: https://registry.npmjs.org/
|
|
24
|
-
|
|
25
|
-
- name: Install protoc
|
|
26
|
-
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
|
|
27
|
-
|
|
28
|
-
- name: Install dependencies
|
|
29
|
-
run: npm i --frozen-lockfile
|
|
30
|
-
|
|
31
|
-
- name: Generate TS Protobuf contracts
|
|
32
|
-
run: npm run generate
|
|
33
|
-
|
|
34
|
-
- name: Publish package
|
|
35
|
-
run: npm publish
|
|
36
|
-
env:
|
|
37
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|