@arbiwallet/contracts 1.0.57 → 1.0.59

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/gen/user.ts CHANGED
@@ -105,6 +105,27 @@ export interface ResolveUserForTransferResponse {
105
105
  id: number;
106
106
  }
107
107
 
108
+ export interface GetCrmSessionRequest {
109
+ forceRefresh: boolean;
110
+ }
111
+
112
+ export interface GetCrmSessionResponse {
113
+ sessionId: string;
114
+ expiresAtUnix: number;
115
+ }
116
+
117
+ export interface CrmExchangeHttpRequest {
118
+ method: string;
119
+ path: string;
120
+ queryString?: string | undefined;
121
+ jsonBody?: string | undefined;
122
+ }
123
+
124
+ export interface CrmExchangeHttpResponse {
125
+ httpStatus: number;
126
+ bodyJson: string;
127
+ }
128
+
108
129
  export interface UserBalance {
109
130
  asset: string;
110
131
  network: string;
@@ -138,6 +159,14 @@ export interface UserServiceClient {
138
159
  /** Ровно одно из полей: user_id, email, phone, telegram_username → id получателя для внутреннего перевода. */
139
160
 
140
161
  resolveUserForTransfer(request: ResolveUserForTransferRequest): Observable<ResolveUserForTransferResponse>;
162
+
163
+ /** CRM Arbi Exchange: логин сервисным аккаунтом (env), OTP из TOTP-секрета; session_id для X-Session-ID. */
164
+
165
+ getCrmSession(request: GetCrmSessionRequest): Observable<GetCrmSessionResponse>;
166
+
167
+ /** HTTP к CRM Exchange: сессия и X-Session-ID только внутри user-service. */
168
+
169
+ crmExchangeHttp(request: CrmExchangeHttpRequest): Observable<CrmExchangeHttpResponse>;
141
170
  }
142
171
 
143
172
  export interface UserServiceController {
@@ -157,11 +186,31 @@ export interface UserServiceController {
157
186
  | Promise<ResolveUserForTransferResponse>
158
187
  | Observable<ResolveUserForTransferResponse>
159
188
  | ResolveUserForTransferResponse;
189
+
190
+ /** CRM Arbi Exchange: логин сервисным аккаунтом (env), OTP из TOTP-секрета; session_id для X-Session-ID. */
191
+
192
+ getCrmSession(
193
+ request: GetCrmSessionRequest,
194
+ ): Promise<GetCrmSessionResponse> | Observable<GetCrmSessionResponse> | GetCrmSessionResponse;
195
+
196
+ /** HTTP к CRM Exchange: сессия и X-Session-ID только внутри user-service. */
197
+
198
+ crmExchangeHttp(
199
+ request: CrmExchangeHttpRequest,
200
+ ): Promise<CrmExchangeHttpResponse> | Observable<CrmExchangeHttpResponse> | CrmExchangeHttpResponse;
160
201
  }
161
202
 
162
203
  export function UserServiceControllerMethods() {
163
204
  return function (constructor: Function) {
164
- const grpcMethods: string[] = ["getUser", "updateUser", "updateUserStatus", "listUsers", "resolveUserForTransfer"];
205
+ const grpcMethods: string[] = [
206
+ "getUser",
207
+ "updateUser",
208
+ "updateUserStatus",
209
+ "listUsers",
210
+ "resolveUserForTransfer",
211
+ "getCrmSession",
212
+ "crmExchangeHttp",
213
+ ];
165
214
  for (const method of grpcMethods) {
166
215
  const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
167
216
  GrpcMethod("UserService", method)(constructor.prototype[method], method, descriptor);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arbiwallet/contracts",
3
3
  "descriptions": "Generate and manage smart contracts for ArbiWallet",
4
- "version": "1.0.57",
4
+ "version": "1.0.59",
5
5
  "scripts": {
6
6
  "generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
7
7
  },
package/proto/user.proto CHANGED
@@ -8,6 +8,10 @@ service UserService {
8
8
  rpc ListUsers (ListUsersRequest) returns (ListUsersResponse);
9
9
  // Ровно одно из полей: user_id, email, phone, telegram_username → id получателя для внутреннего перевода.
10
10
  rpc ResolveUserForTransfer (ResolveUserForTransferRequest) returns (ResolveUserForTransferResponse);
11
+ // CRM Arbi Exchange: логин сервисным аккаунтом (env), OTP из TOTP-секрета; session_id для X-Session-ID.
12
+ rpc GetCrmSession (GetCrmSessionRequest) returns (GetCrmSessionResponse);
13
+ // HTTP к CRM Exchange: сессия и X-Session-ID только внутри user-service.
14
+ rpc CrmExchangeHttp (CrmExchangeHttpRequest) returns (CrmExchangeHttpResponse);
11
15
  }
12
16
 
13
17
  enum UserStatus {
@@ -101,6 +105,27 @@ message ResolveUserForTransferResponse {
101
105
  int32 id = 1;
102
106
  }
103
107
 
108
+ message GetCrmSessionRequest {
109
+ bool force_refresh = 1;
110
+ }
111
+
112
+ message GetCrmSessionResponse {
113
+ string session_id = 1;
114
+ int64 expires_at_unix = 2;
115
+ }
116
+
117
+ message CrmExchangeHttpRequest {
118
+ string method = 1;
119
+ string path = 2;
120
+ optional string query_string = 3;
121
+ optional string json_body = 4;
122
+ }
123
+
124
+ message CrmExchangeHttpResponse {
125
+ int32 http_status = 1;
126
+ string body_json = 2;
127
+ }
128
+
104
129
  message UserBalance {
105
130
  string asset = 1;
106
131
  string network = 2;