@sorokchat-messenger/microservices 1.0.2 → 1.0.4
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/common/index.d.ts +1 -0
- package/dist/common/index.d.ts.map +1 -1
- package/dist/common/index.js +1 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/status/grpc-to-http.status.d.ts +4 -0
- package/dist/common/status/grpc-to-http.status.d.ts.map +1 -0
- package/dist/common/status/grpc-to-http.status.js +22 -0
- package/dist/common/status/grpc-to-http.status.js.map +1 -0
- package/dist/common/status/grpc.status.d.ts +21 -0
- package/dist/common/status/grpc.status.d.ts.map +1 -0
- package/dist/common/status/grpc.status.js +20 -0
- package/dist/common/status/grpc.status.js.map +1 -0
- package/dist/common/status/index.d.ts +3 -0
- package/dist/common/status/index.d.ts.map +1 -0
- package/dist/common/status/index.js +3 -0
- package/dist/common/status/index.js.map +1 -0
- package/package.json +3 -2
- package/proto/authorization.proto +57 -0
package/dist/common/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
package/dist/common/index.js
CHANGED
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grpc-to-http.status.d.ts","sourceRoot":"","sources":["../../../src/common/status/grpc-to-http.status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAkB3D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HttpStatus } from "@nestjs/common";
|
|
2
|
+
import { GrpcStatus } from "./grpc.status.js";
|
|
3
|
+
export const GrpcToHttpStatus = {
|
|
4
|
+
[GrpcStatus.OK]: HttpStatus.OK,
|
|
5
|
+
[GrpcStatus.CANCELLED]: HttpStatus.REQUEST_TIMEOUT,
|
|
6
|
+
[GrpcStatus.UNKNOWN]: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
7
|
+
[GrpcStatus.INVALID_ARGUMENT]: HttpStatus.BAD_REQUEST,
|
|
8
|
+
[GrpcStatus.DEADLINE_EXCEEDED]: HttpStatus.GATEWAY_TIMEOUT,
|
|
9
|
+
[GrpcStatus.NOT_FOUND]: HttpStatus.NOT_FOUND,
|
|
10
|
+
[GrpcStatus.ALREADY_EXISTS]: HttpStatus.CONFLICT,
|
|
11
|
+
[GrpcStatus.PERMISSION_DENIED]: HttpStatus.FORBIDDEN,
|
|
12
|
+
[GrpcStatus.RESOURCE_EXHAUSTED]: HttpStatus.TOO_MANY_REQUESTS,
|
|
13
|
+
[GrpcStatus.FAILED_PRECONDITION]: HttpStatus.BAD_REQUEST,
|
|
14
|
+
[GrpcStatus.ABORTED]: HttpStatus.CONFLICT,
|
|
15
|
+
[GrpcStatus.OUT_OF_RANGE]: HttpStatus.BAD_REQUEST,
|
|
16
|
+
[GrpcStatus.UNIMPLEMENTED]: HttpStatus.NOT_IMPLEMENTED,
|
|
17
|
+
[GrpcStatus.INTERNAL]: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
18
|
+
[GrpcStatus.UNAVAILABLE]: HttpStatus.SERVICE_UNAVAILABLE,
|
|
19
|
+
[GrpcStatus.DATA_LOSS]: HttpStatus.INTERNAL_SERVER_ERROR,
|
|
20
|
+
[GrpcStatus.UNAUTHENTICATED]: HttpStatus.UNAUTHORIZED,
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=grpc-to-http.status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grpc-to-http.status.js","sourceRoot":"","sources":["../../../src/common/status/grpc-to-http.status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAmC;IAC9D,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,EAAE;IAC9B,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,eAAe;IAClD,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,qBAAqB;IACtD,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAC,WAAW;IACrD,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,eAAe;IAC1D,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,SAAS;IAC5C,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,QAAQ;IAChD,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,SAAS;IACpD,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,UAAU,CAAC,iBAAiB;IAC7D,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,UAAU,CAAC,WAAW;IACxD,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,QAAQ;IACzC,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,UAAU,CAAC,WAAW;IACjD,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC,eAAe;IACtD,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,qBAAqB;IACvD,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,mBAAmB;IACxD,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,qBAAqB;IACxD,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,UAAU,CAAC,YAAY;CACtD,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const GrpcStatus: {
|
|
2
|
+
readonly OK: 0;
|
|
3
|
+
readonly CANCELLED: 1;
|
|
4
|
+
readonly UNKNOWN: 2;
|
|
5
|
+
readonly INVALID_ARGUMENT: 3;
|
|
6
|
+
readonly DEADLINE_EXCEEDED: 4;
|
|
7
|
+
readonly NOT_FOUND: 5;
|
|
8
|
+
readonly ALREADY_EXISTS: 6;
|
|
9
|
+
readonly PERMISSION_DENIED: 7;
|
|
10
|
+
readonly RESOURCE_EXHAUSTED: 8;
|
|
11
|
+
readonly FAILED_PRECONDITION: 9;
|
|
12
|
+
readonly ABORTED: 10;
|
|
13
|
+
readonly OUT_OF_RANGE: 11;
|
|
14
|
+
readonly UNIMPLEMENTED: 12;
|
|
15
|
+
readonly INTERNAL: 13;
|
|
16
|
+
readonly UNAVAILABLE: 14;
|
|
17
|
+
readonly DATA_LOSS: 15;
|
|
18
|
+
readonly UNAUTHENTICATED: 16;
|
|
19
|
+
};
|
|
20
|
+
export type GrpcStatus = (typeof GrpcStatus)[keyof typeof GrpcStatus];
|
|
21
|
+
//# sourceMappingURL=grpc.status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grpc.status.d.ts","sourceRoot":"","sources":["../../../src/common/status/grpc.status.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;aACrB,EAAE,EAAE,CAAC;aACL,SAAS,EAAE,CAAC;aACZ,OAAO,EAAE,CAAC;aACV,gBAAgB,EAAE,CAAC;aACnB,iBAAiB,EAAE,CAAC;aACpB,SAAS,EAAE,CAAC;aACZ,cAAc,EAAE,CAAC;aACjB,iBAAiB,EAAE,CAAC;aACpB,kBAAkB,EAAE,CAAC;aACrB,mBAAmB,EAAE,CAAC;aACtB,OAAO,EAAE,EAAE;aACX,YAAY,EAAE,EAAE;aAChB,aAAa,EAAE,EAAE;aACjB,QAAQ,EAAE,EAAE;aACZ,WAAW,EAAE,EAAE;aACf,SAAS,EAAE,EAAE;aACb,eAAe,EAAE,EAAE;CACX,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const GrpcStatus = {
|
|
2
|
+
OK: 0,
|
|
3
|
+
CANCELLED: 1,
|
|
4
|
+
UNKNOWN: 2,
|
|
5
|
+
INVALID_ARGUMENT: 3,
|
|
6
|
+
DEADLINE_EXCEEDED: 4,
|
|
7
|
+
NOT_FOUND: 5,
|
|
8
|
+
ALREADY_EXISTS: 6,
|
|
9
|
+
PERMISSION_DENIED: 7,
|
|
10
|
+
RESOURCE_EXHAUSTED: 8,
|
|
11
|
+
FAILED_PRECONDITION: 9,
|
|
12
|
+
ABORTED: 10,
|
|
13
|
+
OUT_OF_RANGE: 11,
|
|
14
|
+
UNIMPLEMENTED: 12,
|
|
15
|
+
INTERNAL: 13,
|
|
16
|
+
UNAVAILABLE: 14,
|
|
17
|
+
DATA_LOSS: 15,
|
|
18
|
+
UNAUTHENTICATED: 16,
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=grpc.status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grpc.status.js","sourceRoot":"","sources":["../../../src/common/status/grpc.status.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE,CAAC;IACL,SAAS,EAAE,CAAC;IACZ,OAAO,EAAE,CAAC;IACV,gBAAgB,EAAE,CAAC;IACnB,iBAAiB,EAAE,CAAC;IACpB,SAAS,EAAE,CAAC;IACZ,cAAc,EAAE,CAAC;IACjB,iBAAiB,EAAE,CAAC;IACpB,kBAAkB,EAAE,CAAC;IACrB,mBAAmB,EAAE,CAAC;IACtB,OAAO,EAAE,EAAE;IACX,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE,EAAE;IACjB,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,EAAE;IACb,eAAe,EAAE,EAAE;CACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/status/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/status/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sorokchat-messenger/microservices",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Microservices contracts for sorokchat backend",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sorokchat",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
},
|
|
36
36
|
"files": [
|
|
37
37
|
"dist",
|
|
38
|
-
"generated"
|
|
38
|
+
"generated",
|
|
39
|
+
"proto"
|
|
39
40
|
],
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@sorokchat-messenger/core": "^1.0.0",
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package authorization.v1;
|
|
4
|
+
|
|
5
|
+
service AuthorizationService {
|
|
6
|
+
rpc Register (RegisterRequest) returns (RegisterResponse);
|
|
7
|
+
rpc Login (LoginRequest) returns (LoginResponse);
|
|
8
|
+
rpc RefreshTokens (RefreshTokensRequest) returns (RefreshTokensResponse);
|
|
9
|
+
rpc Profile (ProfileRequest) returns (ProfileResponse);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
message RegisterRequest {
|
|
13
|
+
string login = 1;
|
|
14
|
+
string password = 2;
|
|
15
|
+
optional string display_name = 3;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message RegisterResponse {
|
|
19
|
+
string access_token = 1;
|
|
20
|
+
string refresh_token = 2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message LoginRequest {
|
|
24
|
+
string login = 1;
|
|
25
|
+
string password = 2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message LoginResponse {
|
|
29
|
+
string access_token = 1;
|
|
30
|
+
string refresh_token = 2;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message RefreshTokensRequest {
|
|
34
|
+
string refresh_token = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message RefreshTokensResponse {
|
|
38
|
+
string access_token = 1;
|
|
39
|
+
string refresh_token = 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message ProfileRequest {
|
|
43
|
+
string access_token = 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message ProfileResponse {
|
|
47
|
+
string login = 1;
|
|
48
|
+
string password = 2;
|
|
49
|
+
optional string display_name = 3;
|
|
50
|
+
Role role = 4;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
enum Role {
|
|
54
|
+
USER = 0;
|
|
55
|
+
PRO = 1;
|
|
56
|
+
ADMIN = 2;
|
|
57
|
+
}
|