squarefi-bff-api-module 1.36.55 → 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
  };
@@ -10760,6 +10762,126 @@ export interface paths {
10760
10762
  patch?: never;
10761
10763
  trace?: never;
10762
10764
  };
10765
+ "/frontend/wallets/active": {
10766
+ parameters: {
10767
+ query?: never;
10768
+ header?: never;
10769
+ path?: never;
10770
+ cookie?: never;
10771
+ };
10772
+ /**
10773
+ * Active wallet of the caller
10774
+ * @description The wallet the app should open for the authenticated user.
10775
+ *
10776
+ * Resolution order:
10777
+ * 1. the wallet the user picked in Settings — the membership flagged
10778
+ * `wallets_users.is_selected`, while it is still active and the
10779
+ * wallet is not deleted;
10780
+ * 2. otherwise the default kept for users who never picked one — the
10781
+ * `is_main` wallet, else the oldest one.
10782
+ *
10783
+ * The selection cannot outlive the access it rides on: the flag sits on
10784
+ * the membership row, so revoking membership drops it. A deleted wallet
10785
+ * or a deactivated membership falls back to the default.
10786
+ *
10787
+ * **Authentication**: Bearer token with x-tenant-id header required
10788
+ *
10789
+ */
10790
+ get: {
10791
+ parameters: {
10792
+ query?: never;
10793
+ header?: never;
10794
+ path?: never;
10795
+ cookie?: never;
10796
+ };
10797
+ requestBody?: never;
10798
+ responses: {
10799
+ /** @description Resolved active wallet id (`null` when the user reaches no wallet). */
10800
+ 200: {
10801
+ headers: {
10802
+ [name: string]: unknown;
10803
+ };
10804
+ content: {
10805
+ "application/json": {
10806
+ /** @example true */
10807
+ success?: boolean;
10808
+ data?: {
10809
+ /** Format: uuid */
10810
+ wallet_id?: string | null;
10811
+ };
10812
+ };
10813
+ };
10814
+ };
10815
+ 401: components["responses"]["UnauthorizedError"];
10816
+ };
10817
+ };
10818
+ /**
10819
+ * Select the active wallet
10820
+ * @description Stores the caller's active-wallet choice on their own `wallets_users`
10821
+ * row (`is_selected`), so it follows the account instead of the device.
10822
+ * At most one such row exists per user — the DB enforces it.
10823
+ *
10824
+ * The choice is per user, not per wallet: selecting a wallet shared with
10825
+ * the caller changes nothing for its owner or for the other members.
10826
+ * Any wallet the caller is an **active member** of may be selected —
10827
+ * ownership is not required.
10828
+ *
10829
+ * **Authentication**: Bearer token with x-tenant-id header required
10830
+ *
10831
+ */
10832
+ put: {
10833
+ parameters: {
10834
+ query?: never;
10835
+ header?: never;
10836
+ path?: never;
10837
+ cookie?: never;
10838
+ };
10839
+ requestBody: {
10840
+ content: {
10841
+ "application/json": {
10842
+ /** Format: uuid */
10843
+ wallet_id: string;
10844
+ };
10845
+ };
10846
+ };
10847
+ responses: {
10848
+ /** @description Selection stored. */
10849
+ 200: {
10850
+ headers: {
10851
+ [name: string]: unknown;
10852
+ };
10853
+ content: {
10854
+ "application/json": {
10855
+ /** @example true */
10856
+ success?: boolean;
10857
+ /** @example Active wallet updated successfully */
10858
+ message?: string;
10859
+ data?: {
10860
+ /** Format: uuid */
10861
+ wallet_id?: string;
10862
+ };
10863
+ };
10864
+ };
10865
+ };
10866
+ /** @description wallet_id missing or blank */
10867
+ 400: {
10868
+ headers: {
10869
+ [name: string]: unknown;
10870
+ };
10871
+ content?: never;
10872
+ };
10873
+ 401: components["responses"]["UnauthorizedError"];
10874
+ 403: components["responses"]["ForbiddenError"];
10875
+ 404: components["responses"]["NotFoundError"];
10876
+ };
10877
+ };
10878
+ post?: never;
10879
+ delete?: never;
10880
+ options?: never;
10881
+ head?: never;
10882
+ patch?: never;
10883
+ trace?: never;
10884
+ };
10763
10885
  "/frontend/wallets/accept-invite": {
10764
10886
  parameters: {
10765
10887
  query?: never;
@@ -13321,6 +13443,11 @@ export interface components {
13321
13443
  CounterpartyAccount: {
13322
13444
  /** Format: uuid */
13323
13445
  id: string;
13446
+ /**
13447
+ * Format: uuid
13448
+ * @description Wallet the counterparty belongs to
13449
+ */
13450
+ wallet_id?: string | null;
13324
13451
  /** @description Account holder name */
13325
13452
  name: string;
13326
13453
  /** @enum {string} */
@@ -13340,9 +13467,26 @@ export interface components {
13340
13467
  * @default false
13341
13468
  */
13342
13469
  has_internal_destination: boolean;
13470
+ /** @description Number of active destinations. Present on the list response only. */
13471
+ destinations_count?: number;
13343
13472
  /** Format: date-time */
13344
13473
  created_at: string;
13474
+ /** Format: date-time */
13475
+ updated_at?: string;
13345
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;
13346
13490
  /** @description A counterparty account with its embedded active destinations (returned by GET account by id). */
13347
13491
  CounterpartyAccountWithDestinations: components["schemas"]["CounterpartyAccount"] & {
13348
13492
  /** @description Active destinations belonging to this account. */
@@ -13421,6 +13565,11 @@ export interface components {
13421
13565
  CounterpartyDestination: {
13422
13566
  /** Format: uuid */
13423
13567
  id: string;
13568
+ /**
13569
+ * Format: uuid
13570
+ * @description Owning counterparty account
13571
+ */
13572
+ counterparty_account_id: string;
13424
13573
  /**
13425
13574
  * @description Destination / payment rail type
13426
13575
  * @enum {string}
@@ -13430,9 +13579,13 @@ export interface components {
13430
13579
  nickname?: string | null;
13431
13580
  /** Format: date-time */
13432
13581
  created_at: string;
13582
+ /** Format: date-time */
13583
+ updated_at?: string;
13433
13584
  banking_data?: components["schemas"]["CounterpartyBankingData"] | null;
13434
13585
  crypto_data?: components["schemas"]["CounterpartyCryptoData"] | null;
13435
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;
13436
13589
  };
13437
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. */
13438
13591
  InternalTransferAvailability: {
@@ -7528,60 +7528,6 @@ export interface components {
7528
7528
  mon_min_usd?: number;
7529
7529
  } | null;
7530
7530
  };
7531
- AuthResponse: {
7532
- /** @description JWT access token */
7533
- access_token?: string;
7534
- /**
7535
- * @description Token type (bearer)
7536
- * @enum {string}
7537
- */
7538
- token_type?: "bearer";
7539
- /** @description Seconds until token expiration */
7540
- expires_in?: number;
7541
- /** @description Token expiration timestamp */
7542
- expires_at?: number;
7543
- /** @description Refresh token for obtaining new access token */
7544
- refresh_token?: string;
7545
- user?: components["schemas"]["User"];
7546
- };
7547
- User: {
7548
- /** @description User's unique identifier */
7549
- id?: string;
7550
- /** @description Audience for the token */
7551
- aud?: string;
7552
- /** @description User's role */
7553
- role?: string;
7554
- /** @description User's email address */
7555
- email?: string;
7556
- /**
7557
- * Format: date-time
7558
- * @description When email was confirmed
7559
- */
7560
- email_confirmed_at?: string;
7561
- /** @description User's phone number */
7562
- phone?: string;
7563
- /**
7564
- * Format: date-time
7565
- * @description When user was confirmed
7566
- */
7567
- confirmed_at?: string;
7568
- /**
7569
- * Format: date-time
7570
- * @description When recovery email was sent
7571
- */
7572
- recovery_sent_at?: string;
7573
- /**
7574
- * Format: date-time
7575
- * @description Last sign in timestamp
7576
- */
7577
- last_sign_in_at?: string;
7578
- identities?: Record<string, never>[];
7579
- /** Format: date-time */
7580
- created_at?: string;
7581
- /** Format: date-time */
7582
- updated_at?: string;
7583
- is_anonymous?: boolean;
7584
- };
7585
7531
  SubAccount: {
7586
7532
  /**
7587
7533
  * @description Unique identifier for the sub-account
@@ -8365,6 +8311,7 @@ export interface components {
8365
8311
  [key: string]: unknown;
8366
8312
  };
8367
8313
  };
8314
+ User: unknown;
8368
8315
  Wallet: unknown;
8369
8316
  WalletDetailed: unknown;
8370
8317
  CryptoAddress: unknown;
@@ -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.55",
3
+ "version": "1.36.57",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",