@konturkod/contracts 1.0.5 → 1.0.9
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.d.ts +1 -0
- package/dist/index.js +17 -0
- package/dist/proto/index.d.ts +1 -0
- package/dist/proto/index.js +17 -0
- package/dist/proto/paths.d.ts +3 -0
- package/dist/proto/paths.js +7 -0
- package/gen/auth.ts +156 -1
- package/package.json +3 -2
- package/proto/auth.proto +116 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./proto";
|
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);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./paths";
|
|
@@ -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("./paths"), exports);
|
package/gen/auth.ts
CHANGED
|
@@ -11,23 +11,133 @@ import { Observable } from "rxjs";
|
|
|
11
11
|
export const protobufPackage = "auth.v1";
|
|
12
12
|
|
|
13
13
|
export interface SendOtpRequest {
|
|
14
|
+
identifier: string;
|
|
15
|
+
/** @deprecated */
|
|
14
16
|
idetifier: string;
|
|
15
17
|
type: string;
|
|
18
|
+
firstName: string;
|
|
19
|
+
lastName: string;
|
|
20
|
+
password: string;
|
|
21
|
+
passwordRepeat: string;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
export interface SendOtpResponse {
|
|
19
25
|
ok: boolean;
|
|
26
|
+
otpTtlSec: number;
|
|
27
|
+
resendAfterSec: number;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
30
|
export interface VerifyOtpRequest {
|
|
31
|
+
identifier: string;
|
|
32
|
+
/** @deprecated */
|
|
23
33
|
idetifier: string;
|
|
24
34
|
type: string;
|
|
25
35
|
code: string;
|
|
36
|
+
sessionMeta: SessionMeta | undefined;
|
|
37
|
+
firstName: string;
|
|
38
|
+
lastName: string;
|
|
39
|
+
password: string;
|
|
40
|
+
passwordRepeat: string;
|
|
26
41
|
}
|
|
27
42
|
|
|
28
43
|
export interface VerifyOtpResponse {
|
|
29
44
|
accessToken: string;
|
|
30
45
|
refreshToken: string;
|
|
46
|
+
session: SessionView | undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface SuggestOrganizationsRequest {
|
|
50
|
+
innQuery: string;
|
|
51
|
+
limit: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface SuggestOrganizationsResponse {
|
|
55
|
+
suggestions: OrganizationSuggestion[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SaveOrganizationRequest {
|
|
59
|
+
accountId: string;
|
|
60
|
+
inn: string;
|
|
61
|
+
kpp: string;
|
|
62
|
+
ogrn: string;
|
|
63
|
+
shortName: string;
|
|
64
|
+
fullName: string;
|
|
65
|
+
address: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface SaveOrganizationResponse {
|
|
69
|
+
ok: boolean;
|
|
70
|
+
organization: OrganizationSuggestion | undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface OrganizationSuggestion {
|
|
74
|
+
id: string;
|
|
75
|
+
label: string;
|
|
76
|
+
inn: string;
|
|
77
|
+
kpp: string;
|
|
78
|
+
ogrn: string;
|
|
79
|
+
shortName: string;
|
|
80
|
+
fullName: string;
|
|
81
|
+
address: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface RefreshSessionRequest {
|
|
85
|
+
refreshToken: string;
|
|
86
|
+
sessionMeta: SessionMeta | undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface RefreshSessionResponse {
|
|
90
|
+
accessToken: string;
|
|
91
|
+
refreshToken: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface GetMySessionsRequest {
|
|
95
|
+
accountId: string;
|
|
96
|
+
currentSessionId: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface GetMySessionsResponse {
|
|
100
|
+
sessions: SessionView[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface RevokeSessionRequest {
|
|
104
|
+
accountId: string;
|
|
105
|
+
sessionId: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface RevokeSessionResponse {
|
|
109
|
+
ok: boolean;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface RevokeOtherSessionsRequest {
|
|
113
|
+
accountId: string;
|
|
114
|
+
currentSessionId: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface RevokeOtherSessionsResponse {
|
|
118
|
+
ok: boolean;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface SessionMeta {
|
|
122
|
+
deviceId: string;
|
|
123
|
+
deviceName: string;
|
|
124
|
+
platform: string;
|
|
125
|
+
userAgent: string;
|
|
126
|
+
ipAddress: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface SessionView {
|
|
130
|
+
id: string;
|
|
131
|
+
accountId: string;
|
|
132
|
+
deviceId: string;
|
|
133
|
+
deviceName: string;
|
|
134
|
+
platform: string;
|
|
135
|
+
ipAddress: string;
|
|
136
|
+
userAgent: string;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
expiresAt: string;
|
|
139
|
+
lastSeenAt: string;
|
|
140
|
+
isCurrent: boolean;
|
|
31
141
|
}
|
|
32
142
|
|
|
33
143
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
@@ -36,17 +146,62 @@ export interface AuthServiceClient {
|
|
|
36
146
|
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
37
147
|
|
|
38
148
|
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOtpResponse>;
|
|
149
|
+
|
|
150
|
+
suggestOrganizations(request: SuggestOrganizationsRequest): Observable<SuggestOrganizationsResponse>;
|
|
151
|
+
|
|
152
|
+
saveOrganization(request: SaveOrganizationRequest): Observable<SaveOrganizationResponse>;
|
|
153
|
+
|
|
154
|
+
refreshSession(request: RefreshSessionRequest): Observable<RefreshSessionResponse>;
|
|
155
|
+
|
|
156
|
+
getMySessions(request: GetMySessionsRequest): Observable<GetMySessionsResponse>;
|
|
157
|
+
|
|
158
|
+
revokeSession(request: RevokeSessionRequest): Observable<RevokeSessionResponse>;
|
|
159
|
+
|
|
160
|
+
revokeOtherSessions(request: RevokeOtherSessionsRequest): Observable<RevokeOtherSessionsResponse>;
|
|
39
161
|
}
|
|
40
162
|
|
|
41
163
|
export interface AuthServiceController {
|
|
42
164
|
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
43
165
|
|
|
44
166
|
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOtpResponse> | Observable<VerifyOtpResponse> | VerifyOtpResponse;
|
|
167
|
+
|
|
168
|
+
suggestOrganizations(
|
|
169
|
+
request: SuggestOrganizationsRequest,
|
|
170
|
+
): Promise<SuggestOrganizationsResponse> | Observable<SuggestOrganizationsResponse> | SuggestOrganizationsResponse;
|
|
171
|
+
|
|
172
|
+
saveOrganization(
|
|
173
|
+
request: SaveOrganizationRequest,
|
|
174
|
+
): Promise<SaveOrganizationResponse> | Observable<SaveOrganizationResponse> | SaveOrganizationResponse;
|
|
175
|
+
|
|
176
|
+
refreshSession(
|
|
177
|
+
request: RefreshSessionRequest,
|
|
178
|
+
): Promise<RefreshSessionResponse> | Observable<RefreshSessionResponse> | RefreshSessionResponse;
|
|
179
|
+
|
|
180
|
+
getMySessions(
|
|
181
|
+
request: GetMySessionsRequest,
|
|
182
|
+
): Promise<GetMySessionsResponse> | Observable<GetMySessionsResponse> | GetMySessionsResponse;
|
|
183
|
+
|
|
184
|
+
revokeSession(
|
|
185
|
+
request: RevokeSessionRequest,
|
|
186
|
+
): Promise<RevokeSessionResponse> | Observable<RevokeSessionResponse> | RevokeSessionResponse;
|
|
187
|
+
|
|
188
|
+
revokeOtherSessions(
|
|
189
|
+
request: RevokeOtherSessionsRequest,
|
|
190
|
+
): Promise<RevokeOtherSessionsResponse> | Observable<RevokeOtherSessionsResponse> | RevokeOtherSessionsResponse;
|
|
45
191
|
}
|
|
46
192
|
|
|
47
193
|
export function AuthServiceControllerMethods() {
|
|
48
194
|
return function (constructor: Function) {
|
|
49
|
-
const grpcMethods: string[] = [
|
|
195
|
+
const grpcMethods: string[] = [
|
|
196
|
+
"sendOtp",
|
|
197
|
+
"verifyOtp",
|
|
198
|
+
"suggestOrganizations",
|
|
199
|
+
"saveOrganization",
|
|
200
|
+
"refreshSession",
|
|
201
|
+
"getMySessions",
|
|
202
|
+
"revokeSession",
|
|
203
|
+
"revokeOtherSessions",
|
|
204
|
+
];
|
|
50
205
|
for (const method of grpcMethods) {
|
|
51
206
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
52
207
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konturkod/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
+
"dist",
|
|
12
13
|
"proto",
|
|
13
14
|
"gen"
|
|
14
15
|
],
|
|
@@ -25,4 +26,4 @@
|
|
|
25
26
|
"ts-proto": "^2.11.2",
|
|
26
27
|
"typescript": "^5.9.3"
|
|
27
28
|
}
|
|
28
|
-
}
|
|
29
|
+
}
|
package/proto/auth.proto
CHANGED
|
@@ -5,24 +5,138 @@ package auth.v1;
|
|
|
5
5
|
service AuthService {
|
|
6
6
|
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
7
7
|
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOtpResponse);
|
|
8
|
+
rpc SuggestOrganizations (SuggestOrganizationsRequest) returns (SuggestOrganizationsResponse);
|
|
9
|
+
rpc SaveOrganization (SaveOrganizationRequest) returns (SaveOrganizationResponse);
|
|
10
|
+
rpc RefreshSession (RefreshSessionRequest) returns (RefreshSessionResponse);
|
|
11
|
+
rpc GetMySessions (GetMySessionsRequest) returns (GetMySessionsResponse);
|
|
12
|
+
rpc RevokeSession (RevokeSessionRequest) returns (RevokeSessionResponse);
|
|
13
|
+
rpc RevokeOtherSessions (RevokeOtherSessionsRequest) returns (RevokeOtherSessionsResponse);
|
|
8
14
|
}
|
|
9
15
|
|
|
10
16
|
message SendOtpRequest {
|
|
11
|
-
string
|
|
17
|
+
string identifier = 1;
|
|
18
|
+
string idetifier = 3 [deprecated = true];
|
|
12
19
|
string type = 2;
|
|
20
|
+
string first_name = 4;
|
|
21
|
+
string last_name = 5;
|
|
22
|
+
string password = 6;
|
|
23
|
+
string password_repeat = 7;
|
|
13
24
|
}
|
|
14
25
|
|
|
15
26
|
message SendOtpResponse {
|
|
16
27
|
bool ok = 1;
|
|
28
|
+
int32 otp_ttl_sec = 2;
|
|
29
|
+
int32 resend_after_sec = 3;
|
|
17
30
|
}
|
|
18
31
|
|
|
19
32
|
message VerifyOtpRequest {
|
|
20
|
-
string
|
|
33
|
+
string identifier = 1;
|
|
34
|
+
string idetifier = 4 [deprecated = true];
|
|
21
35
|
string type = 2;
|
|
22
36
|
string code = 3;
|
|
37
|
+
SessionMeta session_meta = 5;
|
|
38
|
+
string first_name = 6;
|
|
39
|
+
string last_name = 7;
|
|
40
|
+
string password = 8;
|
|
41
|
+
string password_repeat = 9;
|
|
23
42
|
}
|
|
24
43
|
|
|
25
44
|
message VerifyOtpResponse {
|
|
26
45
|
string access_token = 1;
|
|
27
46
|
string refresh_token = 2;
|
|
47
|
+
SessionView session = 3;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message SuggestOrganizationsRequest {
|
|
51
|
+
string inn_query = 1;
|
|
52
|
+
int32 limit = 2;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message SuggestOrganizationsResponse {
|
|
56
|
+
repeated OrganizationSuggestion suggestions = 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
message SaveOrganizationRequest {
|
|
60
|
+
string account_id = 1;
|
|
61
|
+
string inn = 2;
|
|
62
|
+
string kpp = 3;
|
|
63
|
+
string ogrn = 4;
|
|
64
|
+
string short_name = 5;
|
|
65
|
+
string full_name = 6;
|
|
66
|
+
string address = 7;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
message SaveOrganizationResponse {
|
|
70
|
+
bool ok = 1;
|
|
71
|
+
OrganizationSuggestion organization = 2;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
message OrganizationSuggestion {
|
|
75
|
+
string id = 1;
|
|
76
|
+
string label = 2;
|
|
77
|
+
string inn = 3;
|
|
78
|
+
string kpp = 4;
|
|
79
|
+
string ogrn = 5;
|
|
80
|
+
string short_name = 6;
|
|
81
|
+
string full_name = 7;
|
|
82
|
+
string address = 8;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
message RefreshSessionRequest {
|
|
86
|
+
string refresh_token = 1;
|
|
87
|
+
SessionMeta session_meta = 2;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
message RefreshSessionResponse {
|
|
91
|
+
string access_token = 1;
|
|
92
|
+
string refresh_token = 2;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
message GetMySessionsRequest {
|
|
96
|
+
string account_id = 1;
|
|
97
|
+
string current_session_id = 2;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
message GetMySessionsResponse {
|
|
101
|
+
repeated SessionView sessions = 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
message RevokeSessionRequest {
|
|
105
|
+
string account_id = 1;
|
|
106
|
+
string session_id = 2;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
message RevokeSessionResponse {
|
|
110
|
+
bool ok = 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
message RevokeOtherSessionsRequest {
|
|
114
|
+
string account_id = 1;
|
|
115
|
+
string current_session_id = 2;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
message RevokeOtherSessionsResponse {
|
|
119
|
+
bool ok = 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
message SessionMeta {
|
|
123
|
+
string device_id = 1;
|
|
124
|
+
string device_name = 2;
|
|
125
|
+
string platform = 3;
|
|
126
|
+
string user_agent = 4;
|
|
127
|
+
string ip_address = 5;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
message SessionView {
|
|
131
|
+
string id = 1;
|
|
132
|
+
string account_id = 2;
|
|
133
|
+
string device_id = 3;
|
|
134
|
+
string device_name = 4;
|
|
135
|
+
string platform = 5;
|
|
136
|
+
string ip_address = 6;
|
|
137
|
+
string user_agent = 7;
|
|
138
|
+
string created_at = 8;
|
|
139
|
+
string expires_at = 9;
|
|
140
|
+
string last_seen_at = 10;
|
|
141
|
+
bool is_current = 11;
|
|
28
142
|
}
|