@v3finance/core-sdk 0.3.2 → 0.5.0

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.
Files changed (173) hide show
  1. package/CHANGELOG.md +175 -0
  2. package/README.md +18 -14
  3. package/dist/cjs/client.d.ts +27 -34
  4. package/dist/cjs/client.d.ts.map +1 -1
  5. package/dist/cjs/client.js +69 -0
  6. package/dist/cjs/client.js.map +1 -1
  7. package/dist/cjs/core/gated.d.ts +12 -10
  8. package/dist/cjs/core/gated.d.ts.map +1 -1
  9. package/dist/cjs/core/gated.js +12 -10
  10. package/dist/cjs/core/gated.js.map +1 -1
  11. package/dist/cjs/core/http.d.ts +18 -0
  12. package/dist/cjs/core/http.d.ts.map +1 -1
  13. package/dist/cjs/core/http.js +11 -1
  14. package/dist/cjs/core/http.js.map +1 -1
  15. package/dist/cjs/core/pagination.d.ts +11 -9
  16. package/dist/cjs/core/pagination.d.ts.map +1 -1
  17. package/dist/cjs/core/pagination.js +11 -9
  18. package/dist/cjs/core/pagination.js.map +1 -1
  19. package/dist/cjs/generated/operations.d.ts +218 -2
  20. package/dist/cjs/generated/operations.d.ts.map +1 -1
  21. package/dist/cjs/generated/operations.js +220 -4
  22. package/dist/cjs/generated/operations.js.map +1 -1
  23. package/dist/cjs/generated/types.d.ts +945 -93
  24. package/dist/cjs/generated/types.d.ts.map +1 -1
  25. package/dist/cjs/index.d.ts +6 -6
  26. package/dist/cjs/index.d.ts.map +1 -1
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/resources/addresses.d.ts +91 -4
  29. package/dist/cjs/resources/addresses.d.ts.map +1 -1
  30. package/dist/cjs/resources/addresses.js +55 -3
  31. package/dist/cjs/resources/addresses.js.map +1 -1
  32. package/dist/cjs/resources/admin.d.ts +32 -1
  33. package/dist/cjs/resources/admin.d.ts.map +1 -1
  34. package/dist/cjs/resources/admin.js +45 -0
  35. package/dist/cjs/resources/admin.js.map +1 -1
  36. package/dist/cjs/resources/approvals.d.ts +30 -2
  37. package/dist/cjs/resources/approvals.d.ts.map +1 -1
  38. package/dist/cjs/resources/approvals.js.map +1 -1
  39. package/dist/cjs/resources/auth.d.ts +17 -1
  40. package/dist/cjs/resources/auth.d.ts.map +1 -1
  41. package/dist/cjs/resources/auth.js +20 -0
  42. package/dist/cjs/resources/auth.js.map +1 -1
  43. package/dist/cjs/resources/balances.d.ts +14 -7
  44. package/dist/cjs/resources/balances.d.ts.map +1 -1
  45. package/dist/cjs/resources/balances.js +10 -4
  46. package/dist/cjs/resources/balances.js.map +1 -1
  47. package/dist/cjs/resources/categories.d.ts +20 -6
  48. package/dist/cjs/resources/categories.d.ts.map +1 -1
  49. package/dist/cjs/resources/categories.js +19 -7
  50. package/dist/cjs/resources/categories.js.map +1 -1
  51. package/dist/cjs/resources/counterparties.d.ts +52 -6
  52. package/dist/cjs/resources/counterparties.d.ts.map +1 -1
  53. package/dist/cjs/resources/counterparties.js +24 -0
  54. package/dist/cjs/resources/counterparties.js.map +1 -1
  55. package/dist/cjs/resources/history.d.ts +227 -26
  56. package/dist/cjs/resources/history.d.ts.map +1 -1
  57. package/dist/cjs/resources/history.js +46 -0
  58. package/dist/cjs/resources/history.js.map +1 -1
  59. package/dist/cjs/resources/me.d.ts +17 -1
  60. package/dist/cjs/resources/me.d.ts.map +1 -1
  61. package/dist/cjs/resources/me.js +19 -0
  62. package/dist/cjs/resources/me.js.map +1 -1
  63. package/dist/cjs/resources/members.d.ts +21 -1
  64. package/dist/cjs/resources/members.d.ts.map +1 -1
  65. package/dist/cjs/resources/members.js +15 -0
  66. package/dist/cjs/resources/members.js.map +1 -1
  67. package/dist/cjs/resources/operations.d.ts +179 -4
  68. package/dist/cjs/resources/operations.d.ts.map +1 -1
  69. package/dist/cjs/resources/operations.js +192 -2
  70. package/dist/cjs/resources/operations.js.map +1 -1
  71. package/dist/cjs/resources/registries.d.ts +19 -2
  72. package/dist/cjs/resources/registries.d.ts.map +1 -1
  73. package/dist/cjs/resources/registries.js +16 -0
  74. package/dist/cjs/resources/registries.js.map +1 -1
  75. package/dist/cjs/version.d.ts +1 -1
  76. package/dist/cjs/version.js +1 -1
  77. package/dist/esm/client.d.ts +27 -34
  78. package/dist/esm/client.d.ts.map +1 -1
  79. package/dist/esm/client.js +69 -0
  80. package/dist/esm/client.js.map +1 -1
  81. package/dist/esm/core/gated.d.ts +12 -10
  82. package/dist/esm/core/gated.d.ts.map +1 -1
  83. package/dist/esm/core/gated.js +12 -10
  84. package/dist/esm/core/gated.js.map +1 -1
  85. package/dist/esm/core/http.d.ts +18 -0
  86. package/dist/esm/core/http.d.ts.map +1 -1
  87. package/dist/esm/core/http.js +11 -1
  88. package/dist/esm/core/http.js.map +1 -1
  89. package/dist/esm/core/pagination.d.ts +11 -9
  90. package/dist/esm/core/pagination.d.ts.map +1 -1
  91. package/dist/esm/core/pagination.js +11 -9
  92. package/dist/esm/core/pagination.js.map +1 -1
  93. package/dist/esm/generated/operations.d.ts +218 -2
  94. package/dist/esm/generated/operations.d.ts.map +1 -1
  95. package/dist/esm/generated/operations.js +220 -4
  96. package/dist/esm/generated/operations.js.map +1 -1
  97. package/dist/esm/generated/types.d.ts +945 -93
  98. package/dist/esm/generated/types.d.ts.map +1 -1
  99. package/dist/esm/index.d.ts +6 -6
  100. package/dist/esm/index.d.ts.map +1 -1
  101. package/dist/esm/index.js.map +1 -1
  102. package/dist/esm/resources/addresses.d.ts +91 -4
  103. package/dist/esm/resources/addresses.d.ts.map +1 -1
  104. package/dist/esm/resources/addresses.js +55 -3
  105. package/dist/esm/resources/addresses.js.map +1 -1
  106. package/dist/esm/resources/admin.d.ts +32 -1
  107. package/dist/esm/resources/admin.d.ts.map +1 -1
  108. package/dist/esm/resources/admin.js +45 -0
  109. package/dist/esm/resources/admin.js.map +1 -1
  110. package/dist/esm/resources/approvals.d.ts +30 -2
  111. package/dist/esm/resources/approvals.d.ts.map +1 -1
  112. package/dist/esm/resources/approvals.js.map +1 -1
  113. package/dist/esm/resources/auth.d.ts +17 -1
  114. package/dist/esm/resources/auth.d.ts.map +1 -1
  115. package/dist/esm/resources/auth.js +20 -0
  116. package/dist/esm/resources/auth.js.map +1 -1
  117. package/dist/esm/resources/balances.d.ts +14 -7
  118. package/dist/esm/resources/balances.d.ts.map +1 -1
  119. package/dist/esm/resources/balances.js +10 -4
  120. package/dist/esm/resources/balances.js.map +1 -1
  121. package/dist/esm/resources/categories.d.ts +20 -6
  122. package/dist/esm/resources/categories.d.ts.map +1 -1
  123. package/dist/esm/resources/categories.js +19 -7
  124. package/dist/esm/resources/categories.js.map +1 -1
  125. package/dist/esm/resources/counterparties.d.ts +52 -6
  126. package/dist/esm/resources/counterparties.d.ts.map +1 -1
  127. package/dist/esm/resources/counterparties.js +24 -0
  128. package/dist/esm/resources/counterparties.js.map +1 -1
  129. package/dist/esm/resources/history.d.ts +227 -26
  130. package/dist/esm/resources/history.d.ts.map +1 -1
  131. package/dist/esm/resources/history.js +46 -0
  132. package/dist/esm/resources/history.js.map +1 -1
  133. package/dist/esm/resources/me.d.ts +17 -1
  134. package/dist/esm/resources/me.d.ts.map +1 -1
  135. package/dist/esm/resources/me.js +19 -0
  136. package/dist/esm/resources/me.js.map +1 -1
  137. package/dist/esm/resources/members.d.ts +21 -1
  138. package/dist/esm/resources/members.d.ts.map +1 -1
  139. package/dist/esm/resources/members.js +15 -0
  140. package/dist/esm/resources/members.js.map +1 -1
  141. package/dist/esm/resources/operations.d.ts +179 -4
  142. package/dist/esm/resources/operations.d.ts.map +1 -1
  143. package/dist/esm/resources/operations.js +192 -2
  144. package/dist/esm/resources/operations.js.map +1 -1
  145. package/dist/esm/resources/registries.d.ts +19 -2
  146. package/dist/esm/resources/registries.d.ts.map +1 -1
  147. package/dist/esm/resources/registries.js +16 -0
  148. package/dist/esm/resources/registries.js.map +1 -1
  149. package/dist/esm/version.d.ts +1 -1
  150. package/dist/esm/version.js +1 -1
  151. package/docs/concepts.md +13 -11
  152. package/docs/errors.md +73 -5
  153. package/package.json +1 -1
  154. package/src/client.ts +40 -0
  155. package/src/core/gated.ts +12 -10
  156. package/src/core/http.ts +30 -1
  157. package/src/core/pagination.ts +11 -9
  158. package/src/generated/operations.ts +220 -4
  159. package/src/generated/types.ts +990 -95
  160. package/src/index.ts +15 -1
  161. package/src/resources/addresses.ts +102 -4
  162. package/src/resources/admin.ts +59 -0
  163. package/src/resources/approvals.ts +30 -2
  164. package/src/resources/auth.ts +22 -1
  165. package/src/resources/balances.ts +14 -7
  166. package/src/resources/categories.ts +19 -5
  167. package/src/resources/counterparties.ts +59 -5
  168. package/src/resources/history.ts +238 -27
  169. package/src/resources/me.ts +22 -0
  170. package/src/resources/members.ts +30 -0
  171. package/src/resources/operations.ts +264 -5
  172. package/src/resources/registries.ts +26 -3
  173. package/src/version.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,181 @@
3
3
  All notable changes to this package are documented in this file. The format is based on
4
4
  [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
5
5
 
6
+ ## 0.5.0 — 2026-11-23
7
+
8
+ Catches up with eight releases of the API: summaries and facets, a much richer operation feed,
9
+ attachments, the counterparty of an operation chosen by hand, idempotent address creation, fiat
10
+ rates, logos fetched through the API. Spec snapshot refreshed from the live API (commit `f25db15`,
11
+ [v3-finance/policy-engine#30](https://github.com/v3-finance/policy-engine/pull/30) through
12
+ [#37](https://github.com/v3-finance/policy-engine/pull/37)). 26 operations were added (203 in all,
13
+ three more of them administrator-only), none removed. Most of what changed is additive, but a
14
+ number of generated shapes gained REQUIRED fields and one method now returns `Gated` — see
15
+ **Breaking** under Changed before upgrading.
16
+
17
+ ### Added
18
+
19
+ - `history.summary(params)` — `GET /history/summary`: for the same scope and filters as
20
+ `history.list()`, how many operations, amounts per asset and direction (raw and decimal), the USD
21
+ total with `pricedCount`/`unpricedCount`, and counters per value of the requested `facets`. Over
22
+ 25 000 operations after filtering is 422 `HISTORY_SUMMARY_TOO_BROAD`.
23
+ - `history.list()` takes the API's new filters: several values per filter (an array goes out as one
24
+ comma-separated value) and `<name>Not` exclusions for status, asset, token, network, address,
25
+ folder, counterparty, counterparty group, category, decision policy, initiator, AML level and tag;
26
+ `initiatorId`, `amlLevel` (with `unchecked` — not "clean"), `hasTxHash`, `hasFee`,
27
+ `hasCounterparty`, `hasCategory`, `hasRelations`, `hasUsd`, `relationType`, `dateBasis`, the
28
+ category filters `categoryKey`, `categoryField`, `categoryFieldRange`, `categoryFieldEmpty`, the
29
+ amount bounds `minimumAmount`/`maximumAmount` (in the operation's own token) and
30
+ `minimumUsd`/`maximumUsd`, and the order: `sort` (`createdAt`, `confirmedAt`, `amount`, `usd`) and
31
+ `order`. Types `HistoryFilters`, `HistorySummaryParams`, `HistoryFacet`, `HistoryAmlLevelFilter`,
32
+ `OperationRelationType`.
33
+ - `addresses.summary(params)` and `counterparties.summary(params)` — totals and facets of the two
34
+ listings (tags with counts, networks, folders, owners; tags, kinds, groups). Types
35
+ `AddressFilters`, `AddressesSummaryParams`, `AddressFacet`, `CounterpartyFilters`,
36
+ `CounterpartiesSummaryParams`, `CounterpartyFacet`.
37
+ - `addresses.list()` filters `network`, `tag`, `ownerId` (several values each) and `sort`
38
+ (`createdAt` or `lastActivity`); `counterparties.list()` filters `network` and `tag`.
39
+ - `operations.setCounterparty(kind, id, counterpartyId | null)` and
40
+ `operations.resetCounterparty(kind, id)` — `PUT`/`DELETE …/counterparty`: choose an operation's
41
+ counterparty by hand (`null` is "none"), or hand it back to the automatic match, which runs again
42
+ at once. Neither the automatic match nor the retro-match overwrites a manual choice. A transfer
43
+ awaiting signatures is 409 `OPERATION_AWAITING_APPROVAL`.
44
+ - `operations.attachments()`, `uploadAttachment()`, `downloadAttachment()`, `deleteAttachment()` —
45
+ files attached to an operation (PDF, PNG, JPEG, WebP by their bytes; at most 20 per operation).
46
+ An upload takes a `Blob`/`File`, `ArrayBuffer` or `Uint8Array` (sent as the raw body, up to 10 MB)
47
+ or a `FormData` (multipart, up to 5 MB — React Native's way); a download returns the untouched
48
+ `Response`. Types `AttachmentFile`, `UploadAttachmentOptions`.
49
+ - `operations.deleteRelation(relationId)` — `DELETE /operation-relations/{id}`, by its creator or an
50
+ administrator.
51
+ - `members.policyDirectory(params)` — `GET /policy-directory`: every policy of the vault by name,
52
+ effect and group, without rules — open to any member. Type `PolicyDirectoryParams`.
53
+ - `me.sessions(params)` — `GET /me/sessions`: where I am signed in, without tokens or IP addresses,
54
+ open to any session (web and Mac included).
55
+ - `core.logo(logoPath)` — a network's, a token's or an address's logo fetched through the API, from
56
+ the `logoPath` the record carries (`logoPath` is new on networks, tokens and addresses). Refuses,
57
+ without a request, anything that is not one of the three logo paths.
58
+ - `registries.rates({ base })` — rates in a fiat currency (`FiatCurrency`), converted through the
59
+ dollar at the Bank of Russia's official rate (`fx`). Without `base` the answer is as before.
60
+ - `approvals.list()` filters `vote` (with `approverId`), `order` (`newest`/`oldest`), `includeTotal`
61
+ (adds `total`) and several statuses at once.
62
+ - `categories.removeAssignment(type, id, assignmentId, { baseVersion })` — the same optimistic lock
63
+ as `updateAssignment()`'s `baseVersion` (in `EditAssignmentBody`).
64
+ - `admin.addresses.shared()`, `admin.legacyMetadata.reconcile(body)`,
65
+ `admin.vault(code).rebuildSearchIndex()` — platform administrators only: on-chain addresses that
66
+ exist in several vaults, carrying the older metadata table into the `general` category, and
67
+ computing missing amount sort keys of the feed by hand.
68
+ - The transport sends a file: `RequestOptions.rawBody` (type `RawBody`) with `contentType`, beside
69
+ the JSON `body`.
70
+ - `idempotencyKey` on `CreateAddressBody`, `note` (the initiator's comment) on `CreateTransferBody`
71
+ and `CreateTransferDraftBody` (generated).
72
+ - Generated: `HistorySummary`, `AddressesSummary`, `CounterpartiesSummary`, `Facet`, `FacetValue`,
73
+ `HistoryCategory`, `OperationAttachment`, `OperationAttachmentsList`, `OperationCounterparty`,
74
+ `PolicyDirectoryItem`, `PolicyDirectoryPage`, `MySession`, `MySessionList`, `RegistryNetwork`,
75
+ `FiatCurrency`, `FxQuote`, `FolderAccess`, `FolderRole`, `InternalDepositLink`,
76
+ `SourceTransferLink`, `TrxAmount`, `TransferCostItem`, `ReportingOperation`, the admin results,
77
+ and the better-auth shapes the API now documents (`AuthSession`, `DeviceCodeResponse`, …).
78
+ - `docs/errors.md`: 41 codes — attachments, logos, idempotent address creation,
79
+ `NETWORK_NOT_MONITORED`, `ADDRESS_DERIVATION_COLLISION`, the relation and counterparty-choice
80
+ codes, the feed's `TOO_MANY_VALUES`, `INVALID_FILTER_VALUE`, `SORT_REQUIRES_SINGLE_ASSET`,
81
+ `INVALID_CURSOR`, `CROSS_SITE_REQUEST_REFUSED`, `CATEGORY_KEY_RESERVED`,
82
+ `GENERAL_CATEGORY_CONFLICT` and more; new sections on logos, attachments and list filters.
83
+
84
+ ### Changed
85
+
86
+ - `addresses.create()` — with an `idempotencyKey`, a retry with the same key and body answers 200
87
+ with the address of that attempt, now labelled `outcome: 'replayed'` (it used to be impossible),
88
+ or 202 with the same pending request. New 409s `IDEMPOTENCY_KEY_REUSED`,
89
+ `IDEMPOTENCY_KEY_IN_PROGRESS`, `IDEMPOTENCY_KEY_CLOSED`; an address on a network without deposit
90
+ monitoring (anything but TRON) is 400 `NETWORK_NOT_MONITORED`.
91
+ - `operations.createRelation()` — idempotent: an identical repeat answers 200 with the existing
92
+ relation, the same (type, source, target) with other values is 409 `OPERATION_RELATION_EXISTS`.
93
+ Still returns the relation directly: both outcomes mean it exists exactly as asked.
94
+ - Every 202 "went for approval" carries the full request card (`ApprovalRequestDetail`: initiator,
95
+ signers as cards, steps, events), where it carried `ApprovalRequestWithApprovers` — a strict
96
+ subset, now marked deprecated by the API.
97
+ - The feed and the ledger: an administrator of THIS vault (`VaultMembership.role = admin`) now sees
98
+ the whole vault there, as a platform administrator does. `AddressAccess.isAdmin` means a platform
99
+ administrator only; a vault administrator's oversight shows as `supervisor`, and so do folders
100
+ seen that way.
101
+ - `balances.entries({ addressId })` — an address you cannot reach is 404 `ADDRESS_NOT_FOUND`
102
+ instead of an empty page; members see the entries of addresses shared with them too.
103
+ - `fee` on transfers is deprecated by the API (a raw value of the signing service, not money): use
104
+ `networkFee` (burnt on chain; `null` on new transfers, the server no longer reads the chain) and
105
+ `resourceCost` (administrators only).
106
+ - A changing request from a page of an untrusted site is refused with 403
107
+ `CROSS_SITE_REQUEST_REFUSED`.
108
+
109
+ #### Breaking
110
+
111
+ - `operations.setMetadata()` returns `Gated<OperationMetadata, ApprovalRequestCreated>` instead of
112
+ `OperationMetadata`. The metadata is now a facade over the system category `general`, and when an
113
+ administrator sets that category's approval the API answers 202 with a request and writes nothing
114
+ — returned directly, that body would have been typed as the metadata. Read `result.data` after
115
+ checking `result.outcome`.
116
+ - A field is now REQUIRED in a generated shape — it always arrives, so reading code is unaffected,
117
+ but an object literal or a test fixture typed as the shape stops compiling until it has it:
118
+ - `AddressAccess.supervisor`; `AddressListItem` and `AddressDetail`: `logoPath`,
119
+ `lastActivityAt`, `folderIds`;
120
+ - `AddressGroupDetail`: `access` and `sharing` (were optional), `myRole`, `supervisor`;
121
+ - `HistoryOutItem`: `categories`, `relations`, `tokenDecimals`, `counterpartySource`, `note`,
122
+ `internalDeposit`, `networkFee`, `resourceCost`, `metadata.references`;
123
+ `HistoryInItem`: `categories`, `relations`, `tokenDecimals`, `counterpartySource`,
124
+ `sourceTransfer`, `metadata.references`;
125
+ - `TransactionDetail`: `note`, `tokenDecimals`, `counterpartySource`, `counterpartySetById`,
126
+ `counterpartySetAt`, `internalDeposit`, `networkFee`, `resourceCost`, `costs`;
127
+ `IncomingTransactionDetail`: `tokenDecimals`, `counterpartySource`, `counterpartySetById`,
128
+ `counterpartySetAt`, `sourceTransfer`; `CreateTransactionResult.transaction.note`;
129
+ `OutgoingTxSummary` and `IncomingTxSummary`: `tokenDecimals`;
130
+ - `ApprovalRequestApprover.requestId`; `ApprovalTransferBrief.note`; `decisionPolicyVersionId` on
131
+ `ApprovalRequest`, `ApprovalRequestDetail`, `ApprovalRequestWithApprovers` and the items of
132
+ `ApprovalRequestsPage`;
133
+ - `CounterpartyDetail` and the items of `CounterpartiesPage`: `groupIds`, `operationsCount`;
134
+ - `TokenWithNetwork.logoPath`; `OperationCategoryField.maxLength`; `TransferDraft.note`.
135
+ - A field changed type:
136
+ - `HistoryOutItem.status` — `string` → `'awaiting_approval' | 'pending' | 'submitted' |
137
+ 'confirmed' | 'failed' | 'rejected' | 'cancelled'`. A fixture that sets it from a `string`
138
+ stops compiling;
139
+ - `ApprovalRequestStep.action` and `StepProgress.action` — `string` → `string | null`: `null` is
140
+ a gate step, a second signature requirement with no operation of its own. Code that reads
141
+ `action` as a string has to handle it;
142
+ - `RatesResponse.base` — `'USD'` → `FiatCurrency`. It is still `'USD'` without `?base=`;
143
+ - `DrilldownResponse.items` (what `reports.queryOperations()` returns) — a bag of
144
+ `Record<string, unknown>` → `ReportingOperation[]`. A key the schema does not declare no longer
145
+ compiles; `idempotencyKey` is not in the answer.
146
+ - Return types made wider, compatible with existing callers: `history.list()` answers
147
+ `HistoryResponse` (a page plus the optional `scanTruncated` and `sortIncomplete` flags) and
148
+ `registries.networks()` answers `RegistryNetwork[]` (`Network` plus `logoPath`).
149
+
150
+ ### Fixed
151
+
152
+ - `ListCounterpartiesParams.archived` — the note said that leaving it out returns active and
153
+ archived entries alike. The API returns only active ones unless `archived: true`.
154
+ - `categories.updateAssignment()` — the note said there was no optimistic lock on the direct path;
155
+ there is one now, with `baseVersion`, and the note says how to use it.
156
+ - `docs/errors.md` — `ASSIGNMENT_STALE` named an `expectVersion` field that does not exist (it is
157
+ `baseVersion`); `OPERATION_RELATION_INVALID` and `MONITORING_FAILED` describe their current
158
+ causes.
159
+
160
+ ## 0.4.0 — 2026-11-19
161
+
162
+ A phone can ask the server which client a login code belongs to before approving it. Spec snapshot
163
+ refreshed from the live API ([v3-finance/policy-engine#29](https://github.com/v3-finance/policy-engine/pull/29)).
164
+ One operation was added, none removed.
165
+
166
+ ### Added
167
+
168
+ - `auth.deviceLogin(userCode)` — `GET /api/v1/auth/device-login`: which client a pending login code
169
+ was started for (`client: "web" | "macos-desktop"`) and when it expires. Only a session that may
170
+ approve logins itself gets an answer (the mobile app); a web or desktop session and a platform
171
+ administrator get 403 (`WEB_SESSION_CANNOT_APPROVE`, `ADMIN_CANNOT_APPROVE_WEB_LOGIN`). Any code
172
+ that cannot be approved is the same 404. `client` is what the person who started the login
173
+ declared, not a verified identity, so keep the anti-phishing warning for any value.
174
+ - `DeviceLoginInfo` type.
175
+
176
+ ### Changed
177
+
178
+ - Login by device code now also accepts the client `macos-desktop` (the V3 app for Mac). Its session
179
+ is the same as the web version's: it can read and prepare drafts, but cannot send money or sign.
180
+
6
181
  ## 0.3.2 — 2026-11-16
7
182
 
8
183
  Spec snapshot refreshed from the live API ([v3-finance/policy-engine#28](https://github.com/v3-finance/policy-engine/pull/28)).
package/README.md CHANGED
@@ -163,36 +163,40 @@ Scoped to a vault — `core.vault(code).…`:
163
163
 
164
164
  | Resource | What it covers |
165
165
  | --- | --- |
166
- | `addresses` | list, detail, create (gated), edit metadata |
166
+ | `addresses` | list, totals and facets, detail, create (gated, idempotent), edit metadata |
167
167
  | `transfers` | send (gated), detail, vote, cancel, reconcile (admin) |
168
168
  | `transferDrafts` | create, list, detail, discard; send (gated) — from the mobile app only |
169
- | `history` | the unified feed of operations; direction is a filter, not an endpoint |
169
+ | `history` | the unified feed of operations, its totals and facets; direction is a filter, not an endpoint |
170
170
  | `balances` | balances, a point in time, the raw ledger |
171
171
  | `approvals` | requests, detail, vote, cancel, composite chains |
172
- | `counterparties`, `counterpartyGroups` | the directory and its groups — every mutation is gated |
172
+ | `counterparties`, `counterpartyGroups` | the directory, its totals and facets, and its groups — every mutation is gated |
173
173
  | `sharing` | sharing an address, participants, shared by me and with me |
174
174
  | `folders` | address folders, their grants and participants |
175
- | `members` | the directory, resolve by username, user groups |
175
+ | `members` | the directory, resolve by username, user groups, the policy directory |
176
176
  | `categories` | the labelling schema and the values on operations |
177
- | `operations` | metadata, links, status history, deposits, approval relations |
177
+ | `operations` | metadata (gated), links, the counterparty chosen by hand, attachments, status history, deposits, approval relations |
178
178
  | `reports` | reports, templates, snapshots, exports |
179
179
 
180
180
  At the root — `core.…`:
181
181
 
182
182
  | Resource | What it covers |
183
183
  | --- | --- |
184
- | `me` | profile, email binding, push tokens, allowed segments |
184
+ | `me` | profile, email binding, push tokens, allowed segments, where I am signed in |
185
185
  | `vaults` | list, detail, create, derivation-path build and parse |
186
- | `registries` | networks, tokens, rates, policy preflight, AML |
187
- | `auth` | request a magic link |
188
- | `admin` | policies, policy groups, users, invitations, visibility grants, seats |
186
+ | `registries` | networks, tokens, rates (in USD or a fiat currency), policy preflight, AML |
187
+ | `auth` | request a magic link, look up a login code before approving it |
188
+ | `admin` | policies, policy groups, users, invitations, visibility grants, seats, maintenance |
189
+ | `logo(logoPath)` | a network's, token's or address's logo, fetched through the API |
189
190
  | `health()` | liveness, no authentication |
190
191
 
191
- Fourteen of the API's 176 operations are deliberately absent. Two are not a client's business:
192
+ Twenty-two of the API's 203 operations are deliberately absent. Two are not a client's business:
192
193
  `/welcome` is a browser landing page the API redirects to, and `/webhooks/wallet` is the inbound
193
- channel for the wallet service. The other twelve are the `/address-groups/*` paths — the older
194
- prefix of the endpoints `folders` already serves under `/address-folders`. One entity, two
195
- prefixes; see [docs/concepts.md](./docs/concepts.md#5-shared-access-roles-out-flags-in).
194
+ channel for the wallet service. Twelve are the `/address-groups/*` paths — the older prefix of the
195
+ endpoints `folders` already serves under `/address-folders`. One entity, two prefixes; see
196
+ [docs/concepts.md](./docs/concepts.md#5-shared-access-roles-out-flags-in). The last eight are
197
+ better-auth's own `/api/auth/*` endpoints the API documents — verifying a link, the device-code
198
+ login, reading and ending a session: the package stops at requesting a magic link, and the rest
199
+ belongs to better-auth's client on each platform.
196
200
 
197
201
  ## Amounts
198
202
 
@@ -279,7 +283,7 @@ useQuery({
279
283
 
280
284
  ## TypeScript
281
285
 
282
- Every **named** model of the API is exported — all 262 schemas of its OpenAPI document, generated
286
+ Every **named** model of the API is exported — all 310 schemas of its OpenAPI document, generated
283
287
  rather than retyped, so a shape the resources do not surface yet is still reachable by name. Where
284
288
  the package presents a name of its own (`Address`, `Transaction`, `PersonCard`) it is an alias of
285
289
  the generated schema, not a parallel definition. The deliberate exceptions narrow a generated
@@ -17,40 +17,6 @@ import { SharingResource } from './resources/sharing.js';
17
17
  import { MeResource } from './resources/me.js';
18
18
  import { TransferDraftsResource } from './resources/transferDrafts.js';
19
19
  import { TransfersResource } from './resources/transfers.js';
20
- /**
21
- * Client for the V3 Finance Core API.
22
- *
23
- * CALL SHAPE: `core.vault(code).addresses.list()`.
24
- *
25
- * `vault(code)` is an EXPRESSION, not state. There is deliberately no
26
- * "current vault" that you set once and forget:
27
- *
28
- * • the vault code is visible on every call site, so reading the code does
29
- * not require scrolling up to find which vault is in effect;
30
- * • an administrator works with several vaults at once, and two scopes side
31
- * by side cannot interfere — there is no shared mutable field;
32
- * • in the mobile app and on the web the active vault changes at runtime,
33
- * and a remembered scope would mean requests to the wrong vault after a
34
- * switch.
35
- *
36
- * A scope is cheap: it is a pair of small objects over the shared HTTP
37
- * client, so creating one per call is fine.
38
- *
39
- * Cross-vault and registry endpoints live at the root: `core.vaults`, `core.me`.
40
- *
41
- * @example
42
- * ```ts
43
- * import { CoreClient } from '@v3finance/core-sdk'
44
- *
45
- * const core = new CoreClient({
46
- * getAuthHeaders: () => ({ Authorization: `Bearer ${sessionToken}` }),
47
- * onTokenRotated: (token) => save(token),
48
- * onUnauthorized: () => signOut(),
49
- * })
50
- *
51
- * const page = await core.vault('my-vault').addresses.list({ limit: 20 })
52
- * ```
53
- */
54
20
  export interface VaultScope {
55
21
  readonly code: string;
56
22
  readonly addresses: AddressesResource;
@@ -152,6 +118,33 @@ export declare class CoreClient {
152
118
  * reachable. Use a real read for that.
153
119
  */
154
120
  health(): Promise<Health>;
121
+ /**
122
+ * A logo, fetched through the API: the image of a network, a token or an
123
+ * address, read from the `logoPath` its record carries. Returns the
124
+ * untouched `Response` — read it with `.blob()`.
125
+ *
126
+ * Why not `logoUri`: the server fetches the picture, so the image's host
127
+ * sees neither the person's IP nor what they opened. Pass `logoPath` WHOLE,
128
+ * as the API returned it — its `?v=` is the version of the link, and a new
129
+ * `logoUri` gives a new path, so a client's day-long cache of the old one
130
+ * does not get in the way. `null` there means there is nothing to fetch;
131
+ * a path is not a promise of an image either (502 `LOGO_UNAVAILABLE` when
132
+ * the source does not deliver one, 404 `LOGO_NOT_FOUND` when there is none
133
+ * to fetch).
134
+ *
135
+ * An address's logo is seen by whoever sees the address card. Its
136
+ * `logoUri` is chosen by the address's owner and fetched at the moment of
137
+ * VIEWING, so a unique link to their own host tells them that — and
138
+ * roughly from where — someone opened the address (never the viewer's IP).
139
+ * A cautious client loads the logos of other people's addresses only on an
140
+ * explicit action.
141
+ *
142
+ * Throws, without a request, for a path that is not one of the three logo
143
+ * paths: this is not a general-purpose GET.
144
+ */
145
+ logo(logoPath: string, options?: {
146
+ signal?: AbortSignal | undefined;
147
+ }): Promise<Response>;
155
148
  /** The caller's own profile, devices and permissions. */
156
149
  readonly me: MeResource;
157
150
  /** Networks, tokens, rates, policy preflight and AML. Not vault-scoped. */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAO,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,sBAA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B,MAAM,UAAU,eAAe,KAAG,OAAO,CAAC,WAAW,CAAC;QAGtD;;;;;;;;;;;;;;;;WAgBG;QACH,mBAAmB,SAAS,MAAM,QAAQ,aAAa,KAAG,OAAO,CAAC,iBAAiB,CAAC;QAOpF;;;;;;WAMG;QACH,mBAAmB,SAAS,MAAM,QAAQ,aAAa,KAAG,OAAO,CAAC,kBAAkB,CAAC;MAMtF;IAED;;;;;;OAMG;IACH,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAExB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAO5F;IAED,yDAAyD;IACzD,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAA;IAEvB,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAA;IAEvC,qFAAqF;IACrF,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;IAE7B,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAC5B"}
@@ -20,6 +20,45 @@ const me_js_1 = require("./resources/me.js");
20
20
  const transferDrafts_js_1 = require("./resources/transferDrafts.js");
21
21
  const transfers_js_1 = require("./resources/transfers.js");
22
22
  const version_js_1 = require("./version.js");
23
+ /**
24
+ * Client for the V3 Finance Core API.
25
+ *
26
+ * CALL SHAPE: `core.vault(code).addresses.list()`.
27
+ *
28
+ * `vault(code)` is an EXPRESSION, not state. There is deliberately no
29
+ * "current vault" that you set once and forget:
30
+ *
31
+ * • the vault code is visible on every call site, so reading the code does
32
+ * not require scrolling up to find which vault is in effect;
33
+ * • an administrator works with several vaults at once, and two scopes side
34
+ * by side cannot interfere — there is no shared mutable field;
35
+ * • in the mobile app and on the web the active vault changes at runtime,
36
+ * and a remembered scope would mean requests to the wrong vault after a
37
+ * switch.
38
+ *
39
+ * A scope is cheap: it is a pair of small objects over the shared HTTP
40
+ * client, so creating one per call is fine.
41
+ *
42
+ * Cross-vault and registry endpoints live at the root: `core.vaults`, `core.me`.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * import { CoreClient } from '@v3finance/core-sdk'
47
+ *
48
+ * const core = new CoreClient({
49
+ * getAuthHeaders: () => ({ Authorization: `Bearer ${sessionToken}` }),
50
+ * onTokenRotated: (token) => save(token),
51
+ * onUnauthorized: () => signOut(),
52
+ * })
53
+ *
54
+ * const page = await core.vault('my-vault').addresses.list({ limit: 20 })
55
+ * ```
56
+ */
57
+ /**
58
+ * The three shapes of `logoPath`: a network's or a token's under `/logos`, an
59
+ * address's under its vault. The query (`?v=…`) is kept as it came.
60
+ */
61
+ const LOGO_PATH = /^\/api\/v1\/(?:logos\/(?:networks|tokens)\/[^/?#]+|vaults\/[^/?#]+\/addresses\/[^/?#]+\/logo)(?:\?[^#]*)?$/;
23
62
  class CoreClient {
24
63
  /** Low-level access for endpoints the resources do not cover yet. */
25
64
  http;
@@ -108,6 +147,36 @@ class CoreClient {
108
147
  health() {
109
148
  return this.http.request('GET', '/');
110
149
  }
150
+ /**
151
+ * A logo, fetched through the API: the image of a network, a token or an
152
+ * address, read from the `logoPath` its record carries. Returns the
153
+ * untouched `Response` — read it with `.blob()`.
154
+ *
155
+ * Why not `logoUri`: the server fetches the picture, so the image's host
156
+ * sees neither the person's IP nor what they opened. Pass `logoPath` WHOLE,
157
+ * as the API returned it — its `?v=` is the version of the link, and a new
158
+ * `logoUri` gives a new path, so a client's day-long cache of the old one
159
+ * does not get in the way. `null` there means there is nothing to fetch;
160
+ * a path is not a promise of an image either (502 `LOGO_UNAVAILABLE` when
161
+ * the source does not deliver one, 404 `LOGO_NOT_FOUND` when there is none
162
+ * to fetch).
163
+ *
164
+ * An address's logo is seen by whoever sees the address card. Its
165
+ * `logoUri` is chosen by the address's owner and fetched at the moment of
166
+ * VIEWING, so a unique link to their own host tells them that — and
167
+ * roughly from where — someone opened the address (never the viewer's IP).
168
+ * A cautious client loads the logos of other people's addresses only on an
169
+ * explicit action.
170
+ *
171
+ * Throws, without a request, for a path that is not one of the three logo
172
+ * paths: this is not a general-purpose GET.
173
+ */
174
+ logo(logoPath, options = {}) {
175
+ if (!LOGO_PATH.test(logoPath)) {
176
+ return Promise.reject(new Error(`@v3finance/core-sdk: not a logoPath the API returns: ${logoPath}`));
177
+ }
178
+ return this.http.fetchRaw('GET', logoPath, { signal: options.signal });
179
+ }
111
180
  /** The caller's own profile, devices and permissions. */
112
181
  me;
113
182
  /** Networks, tokens, rates, policy preflight and AML. Not vault-scoped. */
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;AAAA,4CAAoE;AAYpE,2DAA4D;AAC5D,2DAA4D;AAC5D,yDAA0D;AAC1D,qEAGsC;AACtC,mDAAoD;AACpD,iDAAkD;AAClD,6DAA8D;AAC9D,uDAAwD;AACxD,uDAAwD;AACxD,uDAAwD;AACxD,6DAA8D;AAC9D,6DAA8D;AAC9D,uDAAwD;AACxD,uDAAwD;AACxD,6CAA8C;AAC9C,qEAAsE;AACtE,2DAA4D;AAC5D,6CAA+C;AAiF/C;IACE,qEAAqE;IAC5D,IAAI,CAAY;IAEzB,YAAY,OAAO,GAAkB,EAAE;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,oBAAU,CAAC,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,6BAAgB,EAAE,CAAC,CAAA;QACxF,IAAI,CAAC,EAAE,GAAG,IAAI,kBAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnC,IAAI,CAAC,UAAU,GAAG,IAAI,kCAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnD,IAAI,CAAC,KAAK,GAAG,IAAI,wBAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACzC,IAAI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,qFAAqF;IAC5E,KAAK,CAAe;IAE7B,sEAAsE;IAC7D,IAAI,CAAc;CAC5B"}
@@ -4,10 +4,11 @@
4
4
  *
5
5
  * 201 — applied immediately (policy allowed it without signatures);
6
6
  * 202 — queued for approval, funds are reserved, nothing has moved yet;
7
- * 200 — on a transfer: a replay of the same idempotency key, nothing
8
- * happened now and the existing operation came back (no second
9
- * broadcast). Everywhere else: an ordinary applied success, because
10
- * an edit is not a creation and answers 200 (see `replayOn200`).
7
+ * 200 — on a transfer or an address: a replay of the same idempotency
8
+ * key, nothing happened now and the existing operation came back (no
9
+ * second broadcast, no second address). Everywhere else: an ordinary
10
+ * applied success, because an edit is not a creation and answers 200
11
+ * (see `replayOn200`).
11
12
  *
12
13
  * The body can be identical: a transfer returns `{transaction}` in all three.
13
14
  * A client that reads only the body will say "sent" where the truth is
@@ -54,12 +55,13 @@ export type Gated<TApplied, TPending = TApplied> = {
54
55
  * of the two it is instead of the helper guessing.
55
56
  *
56
57
  * Which also means `outcome: 'replayed'` is UNREACHABLE for every gated
57
- * method other than `transfers.send` and `transferDrafts.send`: replay
58
- * protection needs an idempotency key, and the API has one only on a
59
- * transfer — taken from the transfer body, or derived from the draft when a
60
- * draft is sent. The three-way `switch` in `docs/concepts.md` is right for a
61
- * transfer; beside a counterparty edit its `case 'replayed'` is dead, and it
62
- * is not evidence that such an edit can come back as a replay.
58
+ * method other than `transfers.send`, `transferDrafts.send` and
59
+ * `addresses.create`: replay protection needs an idempotency key, and the API
60
+ * has one only on a transfer — taken from the transfer body, or derived from
61
+ * the draft when a draft is sent — and on the creation of an address, where
62
+ * it is optional. The three-way `switch` in `docs/concepts.md` is right for
63
+ * those; beside a counterparty edit its `case 'replayed'` is dead, and it is
64
+ * not evidence that such an edit can come back as a replay.
63
65
  */
64
66
  export declare function toGated<TApplied, TPending>(status: number, data: unknown, options?: {
65
67
  replayOn200?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"gated.d.ts","sourceRoot":"","sources":["../../../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AO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;IAAE,OAAO,EAAE,SAAS,GAAG,UAAU,CAAA;CAAE,CAAC,CAEhE;AAED,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAC5B,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GACb,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC,CAEnD"}
@@ -5,10 +5,11 @@
5
5
  *
6
6
  * 201 — applied immediately (policy allowed it without signatures);
7
7
  * 202 — queued for approval, funds are reserved, nothing has moved yet;
8
- * 200 — on a transfer: a replay of the same idempotency key, nothing
9
- * happened now and the existing operation came back (no second
10
- * broadcast). Everywhere else: an ordinary applied success, because
11
- * an edit is not a creation and answers 200 (see `replayOn200`).
8
+ * 200 — on a transfer or an address: a replay of the same idempotency
9
+ * key, nothing happened now and the existing operation came back (no
10
+ * second broadcast, no second address). Everywhere else: an ordinary
11
+ * applied success, because an edit is not a creation and answers 200
12
+ * (see `replayOn200`).
12
13
  *
13
14
  * The body can be identical: a transfer returns `{transaction}` in all three.
14
15
  * A client that reads only the body will say "sent" where the truth is
@@ -36,12 +37,13 @@ exports.isPending = isPending;
36
37
  * of the two it is instead of the helper guessing.
37
38
  *
38
39
  * Which also means `outcome: 'replayed'` is UNREACHABLE for every gated
39
- * method other than `transfers.send` and `transferDrafts.send`: replay
40
- * protection needs an idempotency key, and the API has one only on a
41
- * transfer — taken from the transfer body, or derived from the draft when a
42
- * draft is sent. The three-way `switch` in `docs/concepts.md` is right for a
43
- * transfer; beside a counterparty edit its `case 'replayed'` is dead, and it
44
- * is not evidence that such an edit can come back as a replay.
40
+ * method other than `transfers.send`, `transferDrafts.send` and
41
+ * `addresses.create`: replay protection needs an idempotency key, and the API
42
+ * has one only on a transfer — taken from the transfer body, or derived from
43
+ * the draft when a draft is sent — and on the creation of an address, where
44
+ * it is optional. The three-way `switch` in `docs/concepts.md` is right for
45
+ * those; beside a counterparty edit its `case 'replayed'` is dead, and it is
46
+ * not evidence that such an edit can come back as a replay.
45
47
  */
46
48
  function toGated(status, data, options = {}) {
47
49
  switch (status) {
@@ -1 +1 @@
1
- {"version":3,"file":"gated.js","sourceRoot":"","sources":["../../../src/core/gated.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;AAkBH;;;;;;;;;;;;;;;;;GAiBG;AACH,iBACE,MAAc,EACd,IAAa,EACb,OAAO,GAA8B,EAAE;IAEvC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG;YACN,OAAO,OAAO,CAAC,WAAW;gBACxB,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAgB,EAAE;gBAC9D,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAgB,EAAE,CAAA;QACjE,KAAK,GAAG;YACN,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAgB,EAAE,CAAA;QACpE,KAAK,GAAG;YACN,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAgB,EAAE,CAAA;QACpE;YACE,MAAM,IAAI,KAAK,CACb,kDAAkD,MAAM,IAAI;gBAC1D,yDAAyD,CAC5D,CAAA;IACL,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,mBACE,CAAc;IAEd,OAAO,CAAC,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,KAAK,UAAU,CAAA;AAC5D,CAAC;AAED,yEAAyE;AACzE,mBACE,CAAc;IAEd,OAAO,CAAC,CAAC,OAAO,KAAK,SAAS,CAAA;AAChC,CAAC"}
1
+ {"version":3,"file":"gated.js","sourceRoot":"","sources":["../../../src/core/gated.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;AAkBH;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBACE,MAAc,EACd,IAAa,EACb,OAAO,GAA8B,EAAE;IAEvC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG;YACN,OAAO,OAAO,CAAC,WAAW;gBACxB,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAgB,EAAE;gBAC9D,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAgB,EAAE,CAAA;QACjE,KAAK,GAAG;YACN,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAgB,EAAE,CAAA;QACpE,KAAK,GAAG;YACN,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAgB,EAAE,CAAA;QACpE;YACE,MAAM,IAAI,KAAK,CACb,kDAAkD,MAAM,IAAI;gBAC1D,yDAAyD,CAC5D,CAAA;IACL,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,mBACE,CAAc;IAEd,OAAO,CAAC,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,CAAC,OAAO,KAAK,UAAU,CAAA;AAC5D,CAAC;AAED,yEAAyE;AACzE,mBACE,CAAc;IAEd,OAAO,CAAC,CAAC,OAAO,KAAK,SAAS,CAAA;AAChC,CAAC"}
@@ -33,9 +33,27 @@ export interface ClientOptions {
33
33
  /** Headers added to every request. */
34
34
  headers?: Record<string, string>;
35
35
  }
36
+ /**
37
+ * A body sent as it is instead of as JSON: a file.
38
+ *
39
+ * `fetch` writes `Content-Length` itself for every one of these — the API
40
+ * requires it on a raw upload (411 without it) — and the multipart boundary for
41
+ * a `FormData`. A stream is deliberately not accepted: its length is unknown
42
+ * up front, so fetch would send it chunked and the upload would be refused.
43
+ */
44
+ export type RawBody = Blob | ArrayBuffer | Uint8Array | FormData;
36
45
  export interface RequestOptions {
37
46
  query?: Query | undefined;
47
+ /** Serialised with `JSON.stringify` and sent as `application/json`. */
38
48
  body?: unknown;
49
+ /**
50
+ * Sent untouched — for the endpoints that take a FILE. Mutually exclusive
51
+ * with `body`. Set `contentType` for a binary body; leave it unset for a
52
+ * `FormData`, whose `Content-Type` carries a boundary only fetch knows.
53
+ */
54
+ rawBody?: RawBody | undefined;
55
+ /** `Content-Type` of `rawBody`. Ignored without one. */
56
+ contentType?: string | undefined;
39
57
  signal?: AbortSignal | undefined;
40
58
  timeoutMs?: number | undefined;
41
59
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/core/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,aAAa,CAAA;AAwBpB,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAA;AAE1C,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAE9C,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtB,SAAS,GACT,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAA;IAE/C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAEhC;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG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YAAY,OAAO,EAAE,aAAa,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,EAyBvD;IAED,yFAAyF;IACnF,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC,CAEvF;IAED;;;;;OAKG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqB5F;IAED,qFAAqF;IAC/E,UAAU,CAAC,CAAC,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAYzB;CAwGF"}
@@ -144,6 +144,9 @@ class HttpClient {
144
144
  */
145
145
  async #send(method, path, options, readPayload) {
146
146
  const endpoint = `${method.toUpperCase()} ${path}`;
147
+ if (options.body !== undefined && options.rawBody !== undefined) {
148
+ throw new Error(`@v3finance/core-sdk: ${endpoint} was given both a JSON body and a raw body.`);
149
+ }
147
150
  const url = `${this.baseUrl}${path}${serializeQuery(options.query)}`;
148
151
  const timeoutMs = options.timeoutMs ?? this.#timeoutMs;
149
152
  const headers = {
@@ -155,6 +158,9 @@ class HttpClient {
155
158
  };
156
159
  if (options.body !== undefined)
157
160
  headers['content-type'] = 'application/json';
161
+ else if (options.rawBody !== undefined && options.contentType !== undefined) {
162
+ headers['content-type'] = options.contentType;
163
+ }
158
164
  // NOTHING ELSE IS ADDED BY DEFAULT, and that is a browser constraint
159
165
  // rather than minimalism: the API's CORS preflight allows exactly
160
166
  // `Content-Type` and `Authorization`, so any further header of ours makes
@@ -185,7 +191,11 @@ class HttpClient {
185
191
  response = await this.#fetch(url, {
186
192
  method: method.toUpperCase(),
187
193
  headers,
188
- ...(options.body === undefined ? {} : { body: JSON.stringify(options.body) }),
194
+ ...(options.rawBody !== undefined
195
+ ? { body: options.rawBody }
196
+ : options.body === undefined
197
+ ? {}
198
+ : { body: JSON.stringify(options.body) }),
189
199
  ...(this.#options.credentials === undefined
190
200
  ? {}
191
201
  : { credentials: this.#options.credentials }),