squarefi-bff-api-module 1.36.56 → 1.36.57

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.
@@ -1,6 +1,7 @@
1
1
  import { API } from './types/types';
2
2
  export declare const counterparties: {
3
3
  getAll: ({ wallet_id, ...params }: API.Counterparties.List.Request) => Promise<API.Counterparties.List.Response>;
4
+ getAllWithDestinations: ({ wallet_id, ...params }: API.Counterparties.ListWithDestinations.Request) => Promise<API.Counterparties.ListWithDestinations.Response>;
4
5
  getById: ({ counterparty_account_id, }: API.Counterparties.GetById.Request) => Promise<API.Counterparties.GetById.Response>;
5
6
  create: ({ wallet_id, ...data }: API.Counterparties.Create.Request) => Promise<API.Counterparties.Create.Response>;
6
7
  update: ({ counterparty_account_id, wallet_id: _wallet_id, ...data }: API.Counterparties.Update.Request) => Promise<API.Counterparties.Update.Response>;
@@ -23,6 +23,22 @@ export const counterparties = {
23
23
  const res = await apiClientV1Frontend.getRequest(`/frontend/counterparty/accounts/wallet/${wallet_id}`, { params });
24
24
  return { total: res.pagination?.total ?? res.data.length, data: res.data };
25
25
  },
26
+ // Тот же роут, что getAll, но с include=destinations: бэкенд вкладывает активные реквизиты
27
+ // в строки листинга, и экран узнаёт состав реквизитов всех контрагентов одним запросом вместо
28
+ // одного запроса на контрагента. Флаг проставляется здесь и снаружи не принимается — иначе
29
+ // вызов с ним вернул бы реквизиты в рантайме, а тип листинга остался бы без них.
30
+ // destinations читаем строго, как в getById: подстановка [] на отсутствующий ключ выдала бы
31
+ // «реквизитов нет» для всех контрагентов сразу и скрыла бы бэкенд, не поддержавший флаг.
32
+ getAllWithDestinations: async ({ wallet_id, ...params }) => {
33
+ const res = await apiClientV1Frontend.getRequest(`/frontend/counterparty/accounts/wallet/${wallet_id}`, { params: { ...params, include: 'destinations' } });
34
+ return {
35
+ total: res.pagination?.total ?? res.data.length,
36
+ data: res.data.map(({ destinations, ...account }) => ({
37
+ ...account,
38
+ destinations: destinations.map(mapDestination),
39
+ })),
40
+ };
41
+ },
26
42
  getById: async ({ counterparty_account_id, }) => {
27
43
  const res = await apiClientV1Frontend.getRequest(`/frontend/counterparty/accounts/${counterparty_account_id}`);
28
44
  const { destinations, ...account } = res.data.account;
@@ -7659,8 +7659,6 @@ export interface components {
7659
7659
  };
7660
7660
  /** @description Bank/beneficiary postal address */
7661
7661
  BankingAddress: {
7662
- /** Format: uuid */
7663
- id?: string;
7664
7662
  /** @description Country ID reference */
7665
7663
  country_id?: number | null;
7666
7664
  city?: string | null;
@@ -7671,8 +7669,6 @@ export interface components {
7671
7669
  } | null;
7672
7670
  /** @description Banking destination details (for SWIFT, SEPA, ACH, Wire, etc.) */
7673
7671
  BankingData: {
7674
- /** Format: uuid */
7675
- id?: string;
7676
7672
  /** @description Bank account number */
7677
7673
  account_number?: string | null;
7678
7674
  /** @description Routing/sort code */
@@ -7705,8 +7701,6 @@ export interface components {
7705
7701
  };
7706
7702
  /** @description Crypto destination details (for CRYPTO_EXTERNAL, CRYPTO_INTERNAL) */
7707
7703
  CryptoData: {
7708
- /** Format: uuid */
7709
- id?: string;
7710
7704
  /** @description Blockchain address */
7711
7705
  address: string;
7712
7706
  /**
@@ -7764,7 +7758,21 @@ export interface components {
7764
7758
  banking_data?: components["schemas"]["BankingData"];
7765
7759
  crypto_data?: components["schemas"]["CryptoData"];
7766
7760
  internal_data?: components["schemas"]["CounterpartyInternalData"];
7761
+ counterparty_account?: components["schemas"]["CounterpartyAccountRef"];
7767
7762
  };
7763
+ /** @description Owning counterparty account, embedded on destination reads; absent on create/update. */
7764
+ CounterpartyAccountRef: {
7765
+ /** Format: uuid */
7766
+ id: string;
7767
+ name: string;
7768
+ /** @enum {string} */
7769
+ type: "BUSINESS" | "INDIVIDUAL";
7770
+ /** Format: uuid */
7771
+ wallet_id?: string | null;
7772
+ nickname?: string | null;
7773
+ email?: string | null;
7774
+ phone?: string | null;
7775
+ } | null;
7768
7776
  ApiSuccessResponse: {
7769
7777
  /** @example true */
7770
7778
  success: boolean;
@@ -1064,6 +1064,8 @@ export interface paths {
1064
1064
  sort_by?: "created_at" | "type" | "name" | "nickname" | "email" | "phone";
1065
1065
  /** @description Sort direction (defaults to ASC). Ignored without `sort_by`. */
1066
1066
  sort_order?: "ASC" | "DESC";
1067
+ /** @description Embed each account's active destinations in the list rows. Omit it and the response is unchanged. With `destinations` every row carries a `destinations` array — empty when the account has none, so "no payment details" is distinguishable from "not loaded". Pagination keeps counting accounts, and the embed combines with `search` / `type` / `sort_by` / `sort_order`. */
1068
+ include?: "destinations";
1067
1069
  };
1068
1070
  header?: never;
1069
1071
  path: {
@@ -1073,7 +1075,7 @@ export interface paths {
1073
1075
  };
1074
1076
  requestBody?: never;
1075
1077
  responses: {
1076
- /** @description Accounts list */
1078
+ /** @description Accounts list. Rows carry their destinations only when `include=destinations` was requested. */
1077
1079
  200: {
1078
1080
  headers: {
1079
1081
  [name: string]: unknown;
@@ -1082,7 +1084,7 @@ export interface paths {
1082
1084
  "application/json": {
1083
1085
  /** @example true */
1084
1086
  success: boolean;
1085
- data: components["schemas"]["CounterpartyAccount"][];
1087
+ data: (components["schemas"]["CounterpartyAccount"] | components["schemas"]["CounterpartyAccountWithDestinations"])[];
1086
1088
  pagination?: components["schemas"]["PaginationResponse"];
1087
1089
  };
1088
1090
  };
@@ -13441,6 +13443,11 @@ export interface components {
13441
13443
  CounterpartyAccount: {
13442
13444
  /** Format: uuid */
13443
13445
  id: string;
13446
+ /**
13447
+ * Format: uuid
13448
+ * @description Wallet the counterparty belongs to
13449
+ */
13450
+ wallet_id?: string | null;
13444
13451
  /** @description Account holder name */
13445
13452
  name: string;
13446
13453
  /** @enum {string} */
@@ -13460,9 +13467,26 @@ export interface components {
13460
13467
  * @default false
13461
13468
  */
13462
13469
  has_internal_destination: boolean;
13470
+ /** @description Number of active destinations. Present on the list response only. */
13471
+ destinations_count?: number;
13463
13472
  /** Format: date-time */
13464
13473
  created_at: string;
13474
+ /** Format: date-time */
13475
+ updated_at?: string;
13465
13476
  };
13477
+ /** @description Owning counterparty account, embedded on destination reads. */
13478
+ CounterpartyAccountRef: {
13479
+ /** Format: uuid */
13480
+ id: string;
13481
+ name: string;
13482
+ /** @enum {string} */
13483
+ type: "BUSINESS" | "INDIVIDUAL";
13484
+ /** Format: uuid */
13485
+ wallet_id?: string | null;
13486
+ nickname?: string | null;
13487
+ email?: string | null;
13488
+ phone?: string | null;
13489
+ } | null;
13466
13490
  /** @description A counterparty account with its embedded active destinations (returned by GET account by id). */
13467
13491
  CounterpartyAccountWithDestinations: components["schemas"]["CounterpartyAccount"] & {
13468
13492
  /** @description Active destinations belonging to this account. */
@@ -13541,6 +13565,11 @@ export interface components {
13541
13565
  CounterpartyDestination: {
13542
13566
  /** Format: uuid */
13543
13567
  id: string;
13568
+ /**
13569
+ * Format: uuid
13570
+ * @description Owning counterparty account
13571
+ */
13572
+ counterparty_account_id: string;
13544
13573
  /**
13545
13574
  * @description Destination / payment rail type
13546
13575
  * @enum {string}
@@ -13550,9 +13579,13 @@ export interface components {
13550
13579
  nickname?: string | null;
13551
13580
  /** Format: date-time */
13552
13581
  created_at: string;
13582
+ /** Format: date-time */
13583
+ updated_at?: string;
13553
13584
  banking_data?: components["schemas"]["CounterpartyBankingData"] | null;
13554
13585
  crypto_data?: components["schemas"]["CounterpartyCryptoData"] | null;
13555
13586
  internal_data?: components["schemas"]["CounterpartyInternalData"] | null;
13587
+ /** @description Embedded on the list and get-by-id reads; absent on create/update. */
13588
+ counterparty_account?: components["schemas"]["CounterpartyAccountRef"] | null;
13556
13589
  };
13557
13590
  /** @description Whether an instant internal transfer is available for a counterparty destination. Two states: available (available=true, target_wallet_id set) and not available (available=false, target_wallet_id=null). Any recipient that cannot receive an instant internal transfer is uniformly reported as not available — the check does not disclose the reason. */
13558
13591
  InternalTransferAvailability: {
@@ -8438,8 +8438,6 @@ export interface components {
8438
8438
  destinations_count?: number;
8439
8439
  };
8440
8440
  BankingData: {
8441
- /** Format: uuid */
8442
- id?: string;
8443
8441
  account_number?: string | null;
8444
8442
  routing_number?: string | null;
8445
8443
  bank_name: string | null;
@@ -8449,8 +8447,6 @@ export interface components {
8449
8447
  sort_code?: string | null;
8450
8448
  note?: string | null;
8451
8449
  address?: {
8452
- /** Format: uuid */
8453
- id?: string;
8454
8450
  country_id?: number | null;
8455
8451
  city?: string | null;
8456
8452
  postcode?: string | null;
@@ -8462,8 +8458,6 @@ export interface components {
8462
8458
  created_at: string;
8463
8459
  } | null;
8464
8460
  CryptoData: {
8465
- /** Format: uuid */
8466
- id?: string;
8467
8461
  address: string;
8468
8462
  /** Format: uuid */
8469
8463
  currency_id?: string;
@@ -8505,7 +8499,21 @@ export interface components {
8505
8499
  banking_data?: components["schemas"]["BankingData"];
8506
8500
  crypto_data?: components["schemas"]["CryptoData"];
8507
8501
  internal_data?: components["schemas"]["CounterpartyInternalData"];
8502
+ counterparty_account?: components["schemas"]["CounterpartyAccountRef"];
8508
8503
  };
8504
+ /** @description Owning counterparty account, embedded on destination reads; absent on create/update. */
8505
+ CounterpartyAccountRef: {
8506
+ /** Format: uuid */
8507
+ id: string;
8508
+ name: string;
8509
+ /** @enum {string} */
8510
+ type: "BUSINESS" | "INDIVIDUAL";
8511
+ /** Format: uuid */
8512
+ wallet_id?: string | null;
8513
+ nickname?: string | null;
8514
+ email?: string | null;
8515
+ phone?: string | null;
8516
+ } | null;
8509
8517
  AdminApiKey: {
8510
8518
  /** Format: uuid */
8511
8519
  id?: string;
@@ -564,12 +564,19 @@ export declare namespace API {
564
564
  type Response = CounterpartyWithDestinations;
565
565
  }
566
566
  namespace List {
567
- type Request = pathsV1Frontend['/frontend/counterparty/accounts/wallet/{wallet_id}']['get']['parameters']['path'] & NonNullable<pathsV1Frontend['/frontend/counterparty/accounts/wallet/{wallet_id}']['get']['parameters']['query']>;
567
+ type Request = Omit<pathsV1Frontend['/frontend/counterparty/accounts/wallet/{wallet_id}']['get']['parameters']['path'] & NonNullable<pathsV1Frontend['/frontend/counterparty/accounts/wallet/{wallet_id}']['get']['parameters']['query']>, 'include'>;
568
568
  type Response = {
569
569
  total: number;
570
570
  data: Counterparty[];
571
571
  };
572
572
  }
573
+ namespace ListWithDestinations {
574
+ type Request = List.Request;
575
+ type Response = {
576
+ total: number;
577
+ data: CounterpartyWithDestinations[];
578
+ };
579
+ }
573
580
  namespace Create {
574
581
  type Request = pathsV1Frontend['/frontend/counterparty/accounts/wallet/{wallet_id}']['post']['parameters']['path'] & pathsV1Frontend['/frontend/counterparty/accounts/wallet/{wallet_id}']['post']['requestBody']['content']['application/json'];
575
582
  type Response = Counterparty;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarefi-bff-api-module",
3
- "version": "1.36.56",
3
+ "version": "1.36.57",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",