@v3finance/core-sdk 0.1.0 → 0.2.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 (217) hide show
  1. package/CHANGELOG.md +397 -7
  2. package/README.md +215 -72
  3. package/dist/cjs/client.d.ts +67 -22
  4. package/dist/cjs/client.d.ts.map +1 -1
  5. package/dist/cjs/client.js +38 -2
  6. package/dist/cjs/client.js.map +1 -1
  7. package/dist/cjs/core/errors.d.ts +30 -10
  8. package/dist/cjs/core/errors.d.ts.map +1 -1
  9. package/dist/cjs/core/errors.js +47 -15
  10. package/dist/cjs/core/errors.js.map +1 -1
  11. package/dist/cjs/core/gated.d.ts +21 -3
  12. package/dist/cjs/core/gated.d.ts.map +1 -1
  13. package/dist/cjs/core/gated.js +12 -3
  14. package/dist/cjs/core/gated.js.map +1 -1
  15. package/dist/cjs/core/http.d.ts +12 -8
  16. package/dist/cjs/core/http.d.ts.map +1 -1
  17. package/dist/cjs/core/http.js +130 -40
  18. package/dist/cjs/core/http.js.map +1 -1
  19. package/dist/cjs/core/pagination.d.ts +28 -1
  20. package/dist/cjs/core/pagination.d.ts.map +1 -1
  21. package/dist/cjs/core/pagination.js +36 -1
  22. package/dist/cjs/core/pagination.js.map +1 -1
  23. package/dist/cjs/generated/operations.js +1 -1
  24. package/dist/cjs/generated/types.d.ts +948 -172
  25. package/dist/cjs/generated/types.d.ts.map +1 -1
  26. package/dist/cjs/index.d.ts +32 -8
  27. package/dist/cjs/index.d.ts.map +1 -1
  28. package/dist/cjs/index.js +12 -0
  29. package/dist/cjs/index.js.map +1 -1
  30. package/dist/cjs/resources/addresses.d.ts +22 -8
  31. package/dist/cjs/resources/addresses.d.ts.map +1 -1
  32. package/dist/cjs/resources/addresses.js +7 -1
  33. package/dist/cjs/resources/addresses.js.map +1 -1
  34. package/dist/cjs/resources/admin.d.ts +150 -25
  35. package/dist/cjs/resources/admin.d.ts.map +1 -1
  36. package/dist/cjs/resources/admin.js +94 -23
  37. package/dist/cjs/resources/admin.js.map +1 -1
  38. package/dist/cjs/resources/approvals.d.ts +46 -5
  39. package/dist/cjs/resources/approvals.d.ts.map +1 -1
  40. package/dist/cjs/resources/approvals.js +27 -4
  41. package/dist/cjs/resources/approvals.js.map +1 -1
  42. package/dist/cjs/resources/balances.d.ts +152 -16
  43. package/dist/cjs/resources/balances.d.ts.map +1 -1
  44. package/dist/cjs/resources/balances.js +9 -5
  45. package/dist/cjs/resources/balances.js.map +1 -1
  46. package/dist/cjs/resources/categories.d.ts +93 -21
  47. package/dist/cjs/resources/categories.d.ts.map +1 -1
  48. package/dist/cjs/resources/categories.js +65 -18
  49. package/dist/cjs/resources/categories.js.map +1 -1
  50. package/dist/cjs/resources/counterparties.d.ts +26 -3
  51. package/dist/cjs/resources/counterparties.d.ts.map +1 -1
  52. package/dist/cjs/resources/counterparties.js +17 -0
  53. package/dist/cjs/resources/counterparties.js.map +1 -1
  54. package/dist/cjs/resources/folders.d.ts +51 -10
  55. package/dist/cjs/resources/folders.d.ts.map +1 -1
  56. package/dist/cjs/resources/folders.js +36 -5
  57. package/dist/cjs/resources/folders.js.map +1 -1
  58. package/dist/cjs/resources/history.d.ts +20 -2
  59. package/dist/cjs/resources/history.d.ts.map +1 -1
  60. package/dist/cjs/resources/history.js.map +1 -1
  61. package/dist/cjs/resources/me.d.ts +27 -4
  62. package/dist/cjs/resources/me.d.ts.map +1 -1
  63. package/dist/cjs/resources/me.js +22 -1
  64. package/dist/cjs/resources/me.js.map +1 -1
  65. package/dist/cjs/resources/members.d.ts +19 -4
  66. package/dist/cjs/resources/members.d.ts.map +1 -1
  67. package/dist/cjs/resources/members.js +15 -6
  68. package/dist/cjs/resources/members.js.map +1 -1
  69. package/dist/cjs/resources/operations.d.ts +64 -8
  70. package/dist/cjs/resources/operations.d.ts.map +1 -1
  71. package/dist/cjs/resources/operations.js +26 -2
  72. package/dist/cjs/resources/operations.js.map +1 -1
  73. package/dist/cjs/resources/registries.d.ts +87 -9
  74. package/dist/cjs/resources/registries.d.ts.map +1 -1
  75. package/dist/cjs/resources/registries.js +54 -11
  76. package/dist/cjs/resources/registries.js.map +1 -1
  77. package/dist/cjs/resources/reports.d.ts +300 -41
  78. package/dist/cjs/resources/reports.d.ts.map +1 -1
  79. package/dist/cjs/resources/reports.js +135 -7
  80. package/dist/cjs/resources/reports.js.map +1 -1
  81. package/dist/cjs/resources/sharing.d.ts +61 -10
  82. package/dist/cjs/resources/sharing.d.ts.map +1 -1
  83. package/dist/cjs/resources/sharing.js +51 -4
  84. package/dist/cjs/resources/sharing.js.map +1 -1
  85. package/dist/cjs/resources/transfers.d.ts +26 -4
  86. package/dist/cjs/resources/transfers.d.ts.map +1 -1
  87. package/dist/cjs/resources/transfers.js +23 -1
  88. package/dist/cjs/resources/transfers.js.map +1 -1
  89. package/dist/cjs/resources/types.d.ts +20 -0
  90. package/dist/cjs/resources/types.d.ts.map +1 -1
  91. package/dist/cjs/units.d.ts.map +1 -1
  92. package/dist/cjs/units.js +18 -2
  93. package/dist/cjs/units.js.map +1 -1
  94. package/dist/cjs/version.d.ts +1 -1
  95. package/dist/cjs/version.js +1 -1
  96. package/dist/esm/client.d.ts +67 -22
  97. package/dist/esm/client.d.ts.map +1 -1
  98. package/dist/esm/client.js +38 -2
  99. package/dist/esm/client.js.map +1 -1
  100. package/dist/esm/core/errors.d.ts +30 -10
  101. package/dist/esm/core/errors.d.ts.map +1 -1
  102. package/dist/esm/core/errors.js +47 -15
  103. package/dist/esm/core/errors.js.map +1 -1
  104. package/dist/esm/core/gated.d.ts +21 -3
  105. package/dist/esm/core/gated.d.ts.map +1 -1
  106. package/dist/esm/core/gated.js +12 -3
  107. package/dist/esm/core/gated.js.map +1 -1
  108. package/dist/esm/core/http.d.ts +12 -8
  109. package/dist/esm/core/http.d.ts.map +1 -1
  110. package/dist/esm/core/http.js +131 -41
  111. package/dist/esm/core/http.js.map +1 -1
  112. package/dist/esm/core/pagination.d.ts +28 -1
  113. package/dist/esm/core/pagination.d.ts.map +1 -1
  114. package/dist/esm/core/pagination.js +36 -1
  115. package/dist/esm/core/pagination.js.map +1 -1
  116. package/dist/esm/generated/operations.js +1 -1
  117. package/dist/esm/generated/types.d.ts +948 -172
  118. package/dist/esm/generated/types.d.ts.map +1 -1
  119. package/dist/esm/index.d.ts +32 -8
  120. package/dist/esm/index.d.ts.map +1 -1
  121. package/dist/esm/index.js +17 -5
  122. package/dist/esm/index.js.map +1 -1
  123. package/dist/esm/resources/addresses.d.ts +22 -8
  124. package/dist/esm/resources/addresses.d.ts.map +1 -1
  125. package/dist/esm/resources/addresses.js +7 -1
  126. package/dist/esm/resources/addresses.js.map +1 -1
  127. package/dist/esm/resources/admin.d.ts +150 -25
  128. package/dist/esm/resources/admin.d.ts.map +1 -1
  129. package/dist/esm/resources/admin.js +94 -23
  130. package/dist/esm/resources/admin.js.map +1 -1
  131. package/dist/esm/resources/approvals.d.ts +46 -5
  132. package/dist/esm/resources/approvals.d.ts.map +1 -1
  133. package/dist/esm/resources/approvals.js +27 -4
  134. package/dist/esm/resources/approvals.js.map +1 -1
  135. package/dist/esm/resources/balances.d.ts +152 -16
  136. package/dist/esm/resources/balances.d.ts.map +1 -1
  137. package/dist/esm/resources/balances.js +9 -5
  138. package/dist/esm/resources/balances.js.map +1 -1
  139. package/dist/esm/resources/categories.d.ts +93 -21
  140. package/dist/esm/resources/categories.d.ts.map +1 -1
  141. package/dist/esm/resources/categories.js +65 -18
  142. package/dist/esm/resources/categories.js.map +1 -1
  143. package/dist/esm/resources/counterparties.d.ts +26 -3
  144. package/dist/esm/resources/counterparties.d.ts.map +1 -1
  145. package/dist/esm/resources/counterparties.js +17 -0
  146. package/dist/esm/resources/counterparties.js.map +1 -1
  147. package/dist/esm/resources/folders.d.ts +51 -10
  148. package/dist/esm/resources/folders.d.ts.map +1 -1
  149. package/dist/esm/resources/folders.js +36 -5
  150. package/dist/esm/resources/folders.js.map +1 -1
  151. package/dist/esm/resources/history.d.ts +20 -2
  152. package/dist/esm/resources/history.d.ts.map +1 -1
  153. package/dist/esm/resources/history.js.map +1 -1
  154. package/dist/esm/resources/me.d.ts +27 -4
  155. package/dist/esm/resources/me.d.ts.map +1 -1
  156. package/dist/esm/resources/me.js +22 -1
  157. package/dist/esm/resources/me.js.map +1 -1
  158. package/dist/esm/resources/members.d.ts +19 -4
  159. package/dist/esm/resources/members.d.ts.map +1 -1
  160. package/dist/esm/resources/members.js +15 -6
  161. package/dist/esm/resources/members.js.map +1 -1
  162. package/dist/esm/resources/operations.d.ts +64 -8
  163. package/dist/esm/resources/operations.d.ts.map +1 -1
  164. package/dist/esm/resources/operations.js +26 -2
  165. package/dist/esm/resources/operations.js.map +1 -1
  166. package/dist/esm/resources/registries.d.ts +87 -9
  167. package/dist/esm/resources/registries.d.ts.map +1 -1
  168. package/dist/esm/resources/registries.js +54 -11
  169. package/dist/esm/resources/registries.js.map +1 -1
  170. package/dist/esm/resources/reports.d.ts +300 -41
  171. package/dist/esm/resources/reports.d.ts.map +1 -1
  172. package/dist/esm/resources/reports.js +135 -7
  173. package/dist/esm/resources/reports.js.map +1 -1
  174. package/dist/esm/resources/sharing.d.ts +61 -10
  175. package/dist/esm/resources/sharing.d.ts.map +1 -1
  176. package/dist/esm/resources/sharing.js +51 -4
  177. package/dist/esm/resources/sharing.js.map +1 -1
  178. package/dist/esm/resources/transfers.d.ts +26 -4
  179. package/dist/esm/resources/transfers.d.ts.map +1 -1
  180. package/dist/esm/resources/transfers.js +23 -1
  181. package/dist/esm/resources/transfers.js.map +1 -1
  182. package/dist/esm/resources/types.d.ts +20 -0
  183. package/dist/esm/resources/types.d.ts.map +1 -1
  184. package/dist/esm/units.d.ts.map +1 -1
  185. package/dist/esm/units.js +18 -2
  186. package/dist/esm/units.js.map +1 -1
  187. package/dist/esm/version.d.ts +1 -1
  188. package/dist/esm/version.js +1 -1
  189. package/docs/concepts.md +191 -0
  190. package/docs/errors.md +471 -0
  191. package/package.json +7 -6
  192. package/src/client.ts +89 -25
  193. package/src/core/errors.ts +49 -15
  194. package/src/core/gated.ts +22 -4
  195. package/src/core/http.ts +156 -46
  196. package/src/core/pagination.ts +38 -1
  197. package/src/generated/operations.ts +1 -1
  198. package/src/generated/types.ts +983 -173
  199. package/src/index.ts +64 -7
  200. package/src/resources/addresses.ts +23 -8
  201. package/src/resources/admin.ts +186 -33
  202. package/src/resources/approvals.ts +55 -9
  203. package/src/resources/balances.ts +186 -14
  204. package/src/resources/categories.ts +125 -30
  205. package/src/resources/counterparties.ts +23 -6
  206. package/src/resources/folders.ts +74 -18
  207. package/src/resources/history.ts +27 -2
  208. package/src/resources/me.ts +30 -5
  209. package/src/resources/members.ts +26 -7
  210. package/src/resources/operations.ts +73 -8
  211. package/src/resources/registries.ts +90 -11
  212. package/src/resources/reports.ts +348 -67
  213. package/src/resources/sharing.ts +71 -18
  214. package/src/resources/transfers.ts +33 -5
  215. package/src/resources/types.ts +20 -0
  216. package/src/units.ts +19 -2
  217. package/src/version.ts +1 -1
@@ -22,20 +22,59 @@ export class ReportsResource {
22
22
  get #base() {
23
23
  return `/api/v1/vaults/${this.#vault}`;
24
24
  }
25
- /** Runs a report. The compiler requires whatever that type needs. */
25
+ /**
26
+ * Runs a report. The compiler requires whatever that type needs, and the
27
+ * answer is the schema of THAT type — see `ReportResult`.
28
+ *
29
+ * Money in a report is DECIMAL, not raw smallest units: every `AssetAmount`
30
+ * (`…ByAsset[].amount`), the `byAsset` rows, and the balances of
31
+ * `asset_movement`, `account_statement` and `balance_position` are strings
32
+ * like `"1.5"`. Read them with `parseDecimal`; `amount` would take `"1.5"`
33
+ * for an integer and reject it. The one exception is `address_activity`,
34
+ * whose `openingBalances`/`closingBalances` are raw (`balanceRaw`).
35
+ *
36
+ * Percentages — `comparison.*ChangePercent`, `observations[].changePercent`,
37
+ * the `…ShareUsd` and `…RatePercent` fields — are decimal STRINGS too
38
+ * (`"12.5"`, `"-40"`), and `null` where the figure cannot be worked out:
39
+ * no previous period to compare with, no USD valuation, a zero base.
40
+ */
26
41
  run(type, params) {
27
42
  return this.#http.request('GET', `${this.#base}/reports/${type}`, {
28
43
  query: { ...params },
29
44
  });
30
45
  }
31
- /** The same thing through the unified endpoint, choosing the type by alias. */
46
+ /**
47
+ * The same thing through the unified endpoint, choosing the type by alias.
48
+ *
49
+ * The document types this endpoint's answer as `AnyReport`, the union of
50
+ * all ten. The type you pass decides which member arrives, so the return is
51
+ * narrowed to it; call it with a `ReportType` known only at runtime and you
52
+ * get the whole union back.
53
+ */
32
54
  runUnified(type, params) {
33
55
  return this.#http.request('GET', `${this.#base}/reports`, {
34
56
  query: { type, ...params },
35
57
  });
36
58
  }
37
- /** Drill-down: the operations behind a figure in a report. */
38
- queryOperations(body) {
59
+ /**
60
+ * Drill-down: the operations behind a figure in a report.
61
+ *
62
+ * A PERIOD IS REQUIRED even though every field of the body is optional. The
63
+ * endpoint takes it from `drilldown.periodStart` or else from
64
+ * `filters.from`/`filters.to`, and with neither it answers 400
65
+ * `REPORT_INVALID_PERIOD` — `queryOperations({})` is not a "whole history"
66
+ * query.
67
+ *
68
+ * The other defaults narrow harder than people expect: with no
69
+ * `filters.statuses` only `confirmed` operations are listed, and with no
70
+ * `filters.flowTypes` only `external` ones. Pass the report's own filters
71
+ * through, or the breakdown comes back smaller than the figure it explains.
72
+ *
73
+ * `totals.byAsset[].amount` is a DECIMAL string, like every `AssetAmount`
74
+ * in the reports. Read it with `parseDecimal`, not `amount` — the latter
75
+ * would take `'1.5'` for an integer and reject it.
76
+ */
77
+ queryOperations(body = {}) {
39
78
  return this.#http.request('POST', `${this.#base}/reports/query/operations`, { body });
40
79
  }
41
80
  // --- saved templates ----------------------------------------------------
@@ -46,9 +85,47 @@ export class ReportsResource {
46
85
  template(templateId) {
47
86
  return this.#http.request('GET', `${this.#base}/report-templates/${seg(templateId)}`);
48
87
  }
88
+ /**
89
+ * Saves a set of report parameters under a name.
90
+ *
91
+ * `parameters` is what the live report takes, as an object — with one
92
+ * addition: instead of `from`/`to` it may carry
93
+ * `relativePeriod: { unit: 'day' | 'week' | 'month', offset }`, resolved to
94
+ * dates each time the template runs.
95
+ *
96
+ * NOTHING IN `parameters` IS CHECKED ON SAVE — it is a free-form bag to the
97
+ * API. A template with no period, or one aimed at a counterparty that does
98
+ * not exist, saves fine and fails at `runTemplate`.
99
+ *
100
+ * `isShared: true` makes the template visible to the whole vault and is for
101
+ * administrators only. Sharing lends nobody the author's reach: the scope
102
+ * is worked out for whoever RUNS it, on every run, so two people get
103
+ * different figures from the same template.
104
+ *
105
+ * THE BAG IS NOT A QUERY STRING, and three things that work on a live
106
+ * report silently do not work here. It is stored and later handed to the
107
+ * report builder as it is — nothing parses it, nothing fills defaults:
108
+ *
109
+ * - a multi-value filter must be a real ARRAY; a comma-separated string is
110
+ * not split;
111
+ * - `categoryField` IS IGNORED. A live report parses `'ticker:EUR'` into a
112
+ * filter; this path does not, so a template or snapshot built from the
113
+ * filters of a report narrowed by `categoryField` answers 200 with
114
+ * figures for EVERY value — the wrong report, with no error. Until the
115
+ * API parses it here, send the parsed form the builder reads instead:
116
+ * `categoryFieldValues: { ticker: ['EUR'] }`;
117
+ * - `timezone` has no default. The live endpoints fall back to `UTC`; here
118
+ * an absent one reaches the builder as `undefined`. Always pass it.
119
+ *
120
+ * So spreading a `ReportFilters` value into `parameters` is safe only when
121
+ * it carries no `categoryField` and does carry a `timezone`. (The spread
122
+ * itself is needed because the type is an index signature, which an
123
+ * interface-typed value does not fit directly.)
124
+ */
49
125
  createTemplate(body) {
50
126
  return this.#http.request('POST', `${this.#base}/report-templates`, { body });
51
127
  }
128
+ /** Partial: only the fields you send change. `parameters` is replaced whole, not merged. */
52
129
  updateTemplate(templateId, body) {
53
130
  return this.#http.request('PATCH', `${this.#base}/report-templates/${seg(templateId)}`, { body });
54
131
  }
@@ -63,6 +140,18 @@ export class ReportsResource {
63
140
  * template's period while believing you had asked for another one. To
64
141
  * change the filters, read the template and call `run()` with them, or
65
142
  * edit the template.
143
+ *
144
+ * The answer is `AnyReport`: which of the ten shapes arrives depends on the
145
+ * template's `reportType`, which is not known to the compiler. `report.type`
146
+ * says which one it is at runtime, but it does NOT narrow the union — the
147
+ * document types that field as the same ten-value enum on every member. So
148
+ * narrow by a block only that report has (`'totalsByAsset' in report`), or
149
+ * check `report.type` and assert the type yourself.
150
+ *
151
+ * This is also where a template's mistakes surface, since its parameters
152
+ * were not checked when it was saved: no period is a 400, a target that no
153
+ * longer exists a 404, and a template built for somebody else's `userId`
154
+ * run by a non-administrator a 403.
66
155
  */
67
156
  runTemplate(templateId) {
68
157
  return this.#http.request('POST', `${this.#base}/report-templates/${seg(templateId)}/run`);
@@ -77,18 +166,55 @@ export class ReportsResource {
77
166
  * cursor, so a larger history is simply cut off rather than continued.
78
167
  */
79
168
  snapshots(params = {}) {
80
- return this.#http.request('GET', `${this.#base}/report-snapshots`, { query: { ...params } });
169
+ return this.#http.request('GET', `${this.#base}/report-snapshots`, {
170
+ query: { ...params },
171
+ });
81
172
  }
173
+ /**
174
+ * One snapshot WITH its figures — under `resultJson`, not `result`; see
175
+ * `ReportSnapshotDetail`. A non-admin can only read snapshots they
176
+ * generated themselves, and a missing one is 404 either way, so "not yours"
177
+ * and "not there" are indistinguishable.
178
+ */
82
179
  snapshot(snapshotId) {
83
180
  return this.#http.request('GET', `${this.#base}/report-snapshots/${seg(snapshotId)}`);
84
181
  }
182
+ /**
183
+ * Builds the report and freezes it. The answer carries the figures under
184
+ * `result` — the detail (`snapshot(id)`) calls the same thing `resultJson`.
185
+ *
186
+ * `parameters` follows the same rules as a template's — read them at
187
+ * `createTemplate`, because two of them fail silently: `categoryField` is
188
+ * ignored (the snapshot would freeze UNFILTERED figures; send
189
+ * `categoryFieldValues` instead) and `timezone` has no default. Unlike a
190
+ * template the parameters ARE used at once, so a bad period or a missing
191
+ * target fails here.
192
+ *
193
+ * `result` is the report of type `reportType`, but the type cannot say so:
194
+ * the spec declares it as a free-form object. Narrow it yourself —
195
+ * `snap.result as unknown as ReportResult['transaction_activity']` (the
196
+ * double cast is required; the detail's `resultJson` takes the same one).
197
+ * For the same reason the per-type REQUIRED parameters are not checked by
198
+ * the compiler here, as they are in `run()`.
199
+ *
200
+ * A result over roughly 900 KB is refused with 400
201
+ * `REPORT_PERIOD_TOO_LARGE` — narrow the filters.
202
+ */
85
203
  createSnapshot(body) {
86
204
  return this.#http.request('POST', `${this.#base}/report-snapshots`, { body });
87
205
  }
88
206
  deleteSnapshot(snapshotId) {
89
207
  return this.#http.request('DELETE', `${this.#base}/report-snapshots/${seg(snapshotId)}`);
90
208
  }
91
- /** Starts an export of a snapshot. The file is fetched separately. */
209
+ /**
210
+ * Exports a snapshot. The file is fetched separately, with `downloadExport`.
211
+ *
212
+ * Only `format` matters, and only two of its four values work: `json` (the
213
+ * frozen result) and `csv` (a flat register of operations). `xlsx` and
214
+ * `pdf` pass validation and are then refused with 400
215
+ * `REPORT_UNSUPPORTED_FORMAT`. `locale`, `timezone` and
216
+ * `includeOperationRegister` are accepted and currently change nothing.
217
+ */
92
218
  createExport(snapshotId, body) {
93
219
  return this.#http.request('POST', `${this.#base}/report-snapshots/${seg(snapshotId)}/exports`, { body });
94
220
  }
@@ -100,7 +226,9 @@ export class ReportsResource {
100
226
  * be CSV or another binary format, and parsing that as JSON fails every
101
227
  * time. Read it with `.blob()`, `.text()` or `.arrayBuffer()`.
102
228
  *
103
- * Poll `export()` until it reports ready before calling this.
229
+ * Exports are produced synchronously today, so the record `createExport`
230
+ * answers with is already `completed` and can be downloaded at once. The
231
+ * `status` field exists for a queued path — check it rather than assuming.
104
232
  */
105
233
  downloadExport(exportId) {
106
234
  return this.#http.fetchRaw('GET', `${this.#base}/report-exports/${seg(exportId)}/download`);
@@ -1 +1 @@
1
- {"version":3,"file":"reports.js","sourceRoot":"","sources":["../../../src/resources/reports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAA+B,MAAM,iBAAiB,CAAA;AAgKlE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,eAAe;I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I,CAAC,KAAK,mBAAmB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/F,CAAC;IAED,cAAc,CAAC,UAAkB;QAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,qBAAqB,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IAC1F,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,UAAkB,EAAE,IAA4B;QAC3D,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,MAAM,EACN,GAAG,IAAI,CAAC,KAAK,qBAAqB,GAAG,CAAC,UAAU,CAAC,UAAU,EAC3D,EAAE,IAAI,EAAE,CACT,CAAA;IACH,CAAC;IAED,MAAM,CAAC,QAAgB;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,GAAG,IAAI,CAAC,KAAK,mBAAmB,GAAG,CAAC,QAAQ,CAAC,EAAE,CAChD,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,cAAc,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,mBAAmB,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;IAC7F,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import { type HttpClient } from '../core/http.js';
2
- import type { AddressAccessGrant, AddressSharesList, GrantAddressShareBody, ParticipantsResponse, PatchAddressShareBody, ShareBatchResult } from '../generated/types.js';
2
+ import type { AddressAccessGrant, AddressSharesList, GrantAddressShareBody, ParticipantsResponse, PatchAddressShareBody, ShareGrantCreated } from '../generated/types.js';
3
3
  /**
4
4
  * Shared access to addresses.
5
5
  *
@@ -30,23 +30,74 @@ export declare class SharingResource {
30
30
  * 400 comes only when every subject was rejected. A consumer that trusts
31
31
  * the status code silently loses the people who were refused.
32
32
  *
33
+ * WHERE THE REASONS GO WHEN EVERY SUBJECT FAILED. That 400 is not an error
34
+ * envelope: the API sends the same `{results:[…]}` body with a 400 instead
35
+ * of a 201. The document describes both forms of that status — the
36
+ * envelope for a body that failed validation, and `ShareBatchAllRejected`
37
+ * for a batch in which every subject was refused. The SDK does not lose the
38
+ * second, but it does throw: `core/errors.ts` finds neither `error` nor
39
+ * `code` in the body, so it builds a `CoreError` with `code: 'BAD_REQUEST'`
40
+ * and puts the WHOLE body in `details`:
41
+ *
42
+ * ```ts
43
+ * catch (e) {
44
+ * if (isCoreError(e) && e.status === 400) {
45
+ * const per = (e.details as ShareBatchAllRejected | undefined)?.results
46
+ * // per[i].error.code — why that one subject was refused
47
+ * }
48
+ * }
49
+ * ```
50
+ *
51
+ * `details` is `undefined` for the other 400, the validation one — hence
52
+ * the `| undefined` in the cast, and the reason to check before reading.
53
+ *
54
+ * Reading `message` instead gets you "The request was rejected", because
55
+ * the server sent no message to pass on. Per-subject `error.message` equals
56
+ * its `code`, so neither is a sentence to show a person as-is.
57
+ *
33
58
  * The single-subject form answers with the grant itself rather than a
34
- * batch, which is why the return type is a union.
59
+ * batch, which is why the return type is a union — `ShareGrantCreated`,
60
+ * the grant or the batch; tell them apart with `'results' in answer`. It
61
+ * also reports failure differently: one subject refused is a plain 403 with
62
+ * no `results[]` at all, so the batch form is the one to use when you need
63
+ * reasons.
35
64
  */
36
- share(addressId: string, input: GrantAddressShareBody): Promise<ShareBatchResult | AddressAccessGrant>;
65
+ share(addressId: string, input: GrantAddressShareBody): Promise<ShareGrantCreated>;
37
66
  update(addressId: string, shareId: string, input: PatchAddressShareBody): Promise<AddressAccessGrant>;
38
- revoke(addressId: string, shareId: string): Promise<unknown>;
67
+ /** Soft: the row survives with `revokedAt`/`revokedById` for the audit trail. */
68
+ revoke(addressId: string, shareId: string): Promise<{
69
+ revoked: boolean;
70
+ }>;
39
71
  /**
40
72
  * Everyone who reaches the address, as PEOPLE rather than grants: the
41
73
  * owner, direct grantees and members of granted groups. Each entry explains
42
74
  * where the access comes from, which is also how you learn how to revoke it.
43
75
  */
44
76
  participants(addressId: string): Promise<ParticipantsResponse>;
45
- /** Addresses you have shared with others. */
46
- sharedByMe(): Promise<unknown>;
47
- /** Addresses others have shared with you. */
48
- sharedWithMe(): Promise<unknown>;
49
- /** Gives up access someone granted you. Your own grant, your own decision. */
50
- leave(grantId: string): Promise<unknown>;
77
+ /**
78
+ * What you have opened to others — addresses AND folders, so the entries
79
+ * are not all of one `targetType`. Same shape as `list()`.
80
+ */
81
+ sharedByMe(): Promise<AddressSharesList>;
82
+ /**
83
+ * Addresses others have shared with you — DIRECT grants on an address
84
+ * only. Access that reaches you through a shared FOLDER is not here, which
85
+ * is the trap: an empty answer does not mean nothing is shared with you.
86
+ * For shared access of every kind ask the addresses list with
87
+ * `access: 'shared'`, or `'all'` to include your own.
88
+ */
89
+ sharedWithMe(): Promise<AddressSharesList>;
90
+ /**
91
+ * Gives up access someone granted you. Your own grant, your own decision —
92
+ * the owner is not asked.
93
+ *
94
+ * Works on a grant made to you PERSONALLY. Access you have through a user
95
+ * group cannot be dropped this way, because it belongs to the whole group:
96
+ * that answers 409 `ACCESS_VIA_GROUP`, with the group's id and name in
97
+ * `details`, so the interface can say which group to leave instead.
98
+ */
99
+ leave(grantId: string): Promise<{
100
+ left: boolean;
101
+ }>;
51
102
  }
52
103
  //# sourceMappingURL=sharing.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharing.d.ts","sourceRoot":"","sources":["../../../src/resources/sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EACV,kBAAkB,EAElB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,eAAe;;IAI1B,YAAY,IAAI,EAAE,UAAU,EAAE,SAAS,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CAAC,CAElD;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAMjF;IAED,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,qBAAqB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAM7B;IAED,iFAAiF;IACjF,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAKxE;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAK7D;IAED;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAKvC;IAED;;;;;;OAMG;IACH,YAAY,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAKzC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAKjD;CACF"}
@@ -38,8 +38,37 @@ export class SharingResource {
38
38
  * 400 comes only when every subject was rejected. A consumer that trusts
39
39
  * the status code silently loses the people who were refused.
40
40
  *
41
+ * WHERE THE REASONS GO WHEN EVERY SUBJECT FAILED. That 400 is not an error
42
+ * envelope: the API sends the same `{results:[…]}` body with a 400 instead
43
+ * of a 201. The document describes both forms of that status — the
44
+ * envelope for a body that failed validation, and `ShareBatchAllRejected`
45
+ * for a batch in which every subject was refused. The SDK does not lose the
46
+ * second, but it does throw: `core/errors.ts` finds neither `error` nor
47
+ * `code` in the body, so it builds a `CoreError` with `code: 'BAD_REQUEST'`
48
+ * and puts the WHOLE body in `details`:
49
+ *
50
+ * ```ts
51
+ * catch (e) {
52
+ * if (isCoreError(e) && e.status === 400) {
53
+ * const per = (e.details as ShareBatchAllRejected | undefined)?.results
54
+ * // per[i].error.code — why that one subject was refused
55
+ * }
56
+ * }
57
+ * ```
58
+ *
59
+ * `details` is `undefined` for the other 400, the validation one — hence
60
+ * the `| undefined` in the cast, and the reason to check before reading.
61
+ *
62
+ * Reading `message` instead gets you "The request was rejected", because
63
+ * the server sent no message to pass on. Per-subject `error.message` equals
64
+ * its `code`, so neither is a sentence to show a person as-is.
65
+ *
41
66
  * The single-subject form answers with the grant itself rather than a
42
- * batch, which is why the return type is a union.
67
+ * batch, which is why the return type is a union — `ShareGrantCreated`,
68
+ * the grant or the batch; tell them apart with `'results' in answer`. It
69
+ * also reports failure differently: one subject refused is a plain 403 with
70
+ * no `results[]` at all, so the batch form is the one to use when you need
71
+ * reasons.
43
72
  */
44
73
  share(addressId, input) {
45
74
  return this.#http.request('POST', `${this.#address(addressId)}/shares`, { body: input });
@@ -47,6 +76,7 @@ export class SharingResource {
47
76
  update(addressId, shareId, input) {
48
77
  return this.#http.request('PATCH', `${this.#address(addressId)}/shares/${seg(shareId)}`, { body: input });
49
78
  }
79
+ /** Soft: the row survives with `revokedAt`/`revokedById` for the audit trail. */
50
80
  revoke(addressId, shareId) {
51
81
  return this.#http.request('DELETE', `${this.#address(addressId)}/shares/${seg(shareId)}`);
52
82
  }
@@ -58,15 +88,32 @@ export class SharingResource {
58
88
  participants(addressId) {
59
89
  return this.#http.request('GET', `${this.#address(addressId)}/participants`);
60
90
  }
61
- /** Addresses you have shared with others. */
91
+ /**
92
+ * What you have opened to others — addresses AND folders, so the entries
93
+ * are not all of one `targetType`. Same shape as `list()`.
94
+ */
62
95
  sharedByMe() {
63
96
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/shared-by-me`);
64
97
  }
65
- /** Addresses others have shared with you. */
98
+ /**
99
+ * Addresses others have shared with you — DIRECT grants on an address
100
+ * only. Access that reaches you through a shared FOLDER is not here, which
101
+ * is the trap: an empty answer does not mean nothing is shared with you.
102
+ * For shared access of every kind ask the addresses list with
103
+ * `access: 'shared'`, or `'all'` to include your own.
104
+ */
66
105
  sharedWithMe() {
67
106
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/shared-with-me`);
68
107
  }
69
- /** Gives up access someone granted you. Your own grant, your own decision. */
108
+ /**
109
+ * Gives up access someone granted you. Your own grant, your own decision —
110
+ * the owner is not asked.
111
+ *
112
+ * Works on a grant made to you PERSONALLY. Access you have through a user
113
+ * group cannot be dropped this way, because it belongs to the whole group:
114
+ * that answers 409 `ACCESS_VIA_GROUP`, with the group's id and name in
115
+ * `details`, so the interface can say which group to leave instead.
116
+ */
70
117
  leave(grantId) {
71
118
  return this.#http.request('DELETE', `/api/v1/vaults/${this.#vault}/shared-with-me/${seg(grantId)}`);
72
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sharing.js","sourceRoot":"","sources":["../../../src/resources/sharing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AAWtD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,eAAe;IACjB,KAAK,CAAY;IACjB,MAAM,CAAQ;IAEvB,YAAY,IAAgB,EAAE,SAAiB;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;IAED,QAAQ,CAAC,SAAiB;QACxB,OAAO,kBAAkB,IAAI,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,CAAC,EAAE,CAAA;IACpE,CAAC;IAED,sCAAsC;IACtC,IAAI,CAAC,SAAiB;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,KAAK,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IAC3F,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CACH,SAAiB,EACjB,KAA4B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,CAAC,SAAiB,EAAE,OAAe;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,QAAQ,EACR,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,GAAG,CAAC,OAAO,CAAC,EAAE,CACrD,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,SAAiB;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,eAAe,CAC3C,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,eAAe,CAC7C,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,iBAAiB,CAC/C,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,OAAe;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,QAAQ,EACR,kBAAkB,IAAI,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAO,CAAC,EAAE,CAC/D,CAAA;IACH,CAAC;CACF"}
@@ -1,6 +1,6 @@
1
1
  import { type HttpClient } from '../core/http.js';
2
2
  import { type Gated } from '../core/gated.js';
3
- import type { CreateTransactionResult, CreateTransferBody, ReconcileTransferBody, ReconcileTransferResult, TransactionDetail } from '../generated/types.js';
3
+ import type { CancelResult, CreateTransactionResult, CreateTransferBody, ReconcileTransferBody, ReconcileTransferResult, TransactionDetail, VoteResult } from '../generated/types.js';
4
4
  export interface VoteInput {
5
5
  decision: 'approve' | 'reject';
6
6
  comment?: string | undefined;
@@ -38,13 +38,35 @@ export declare class TransfersResource {
38
38
  * Only people captured in the approver SNAPSHOT taken when the request was
39
39
  * created may vote: editing a policy or a group afterwards does not change
40
40
  * an in-flight request.
41
+ *
42
+ * READ `status` FROM THE ANSWER — it is the status of the TRANSFER after
43
+ * the vote, and the vote is where the money moves:
44
+ *
45
+ * awaiting_approval — counted, more signatures still needed;
46
+ * rejected — a `reject` is a veto, and the reserve is released;
47
+ * confirmed/failed — this vote completed the threshold, so execution ran
48
+ * INSIDE this request (gas, then broadcast, ~10s).
49
+ *
50
+ * `failed` means the money is back: execution broke after approval and the
51
+ * reserve was released, with the reason in `executionError`. Treating the
52
+ * call as "approved, done" hides both the success and that failure.
41
53
  */
42
- vote(transferId: string, input: VoteInput): Promise<unknown>;
54
+ vote(transferId: string, input: VoteInput): Promise<VoteResult>;
43
55
  /**
44
56
  * Cancels your own transfer that is awaiting signatures and releases the
45
- * reserve. A transfer already broadcast cannot be cancelled.
57
+ * reserve. A transfer already broadcast cannot be cancelled; administrators
58
+ * may cancel somebody else's, so a stuck request is not hostage to an
59
+ * absent initiator.
60
+ *
61
+ * The resulting status is its own value, `cancelled` — not the `rejected`
62
+ * of a veto and not `failed`. Worth keeping apart in the interface: "you
63
+ * withdrew this" and "somebody refused it" are different events.
64
+ *
65
+ * Clear a stuck transfer through this endpoint and never by writing the
66
+ * status directly: the reserve is released by a ledger posting, not by the
67
+ * status, so a hand-edited row leaves the funds locked for good.
46
68
  */
47
- cancel(transferId: string): Promise<unknown>;
69
+ cancel(transferId: string): Promise<CancelResult>;
48
70
  /**
49
71
  * Settles a transfer stuck in `pending` — the case where the worker died
50
72
  * mid-execution, so cancelling does not apply. Administrators only.
@@ -1 +1 @@
1
- {"version":3,"file":"transfers.d.ts","sourceRoot":"","sources":["../../../src/resources/transfers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EAC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B,CAAA;AAE9B,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAiB;;IAI5B,YAAY,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAG9C;IAED,gFAAgF;IAC1E,IAAI,CACR,KAAK,EAAE,kBAAkB,EACzB,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACzD,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAUzC;IAED;;;;OAIG;IACH,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAElD;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAM9D;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAEhD;IAED;;;;;;;;;;;;;;OAcG;IACH,SAAS,CACP,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,qBAA0B,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAMlC;CACF"}
@@ -46,13 +46,35 @@ export class TransfersResource {
46
46
  * Only people captured in the approver SNAPSHOT taken when the request was
47
47
  * created may vote: editing a policy or a group afterwards does not change
48
48
  * an in-flight request.
49
+ *
50
+ * READ `status` FROM THE ANSWER — it is the status of the TRANSFER after
51
+ * the vote, and the vote is where the money moves:
52
+ *
53
+ * awaiting_approval — counted, more signatures still needed;
54
+ * rejected — a `reject` is a veto, and the reserve is released;
55
+ * confirmed/failed — this vote completed the threshold, so execution ran
56
+ * INSIDE this request (gas, then broadcast, ~10s).
57
+ *
58
+ * `failed` means the money is back: execution broke after approval and the
59
+ * reserve was released, with the reason in `executionError`. Treating the
60
+ * call as "approved, done" hides both the success and that failure.
49
61
  */
50
62
  vote(transferId, input) {
51
63
  return this.#http.request('POST', `${this.#base}/${seg(transferId)}/approvals`, { body: input });
52
64
  }
53
65
  /**
54
66
  * Cancels your own transfer that is awaiting signatures and releases the
55
- * reserve. A transfer already broadcast cannot be cancelled.
67
+ * reserve. A transfer already broadcast cannot be cancelled; administrators
68
+ * may cancel somebody else's, so a stuck request is not hostage to an
69
+ * absent initiator.
70
+ *
71
+ * The resulting status is its own value, `cancelled` — not the `rejected`
72
+ * of a veto and not `failed`. Worth keeping apart in the interface: "you
73
+ * withdrew this" and "somebody refused it" are different events.
74
+ *
75
+ * Clear a stuck transfer through this endpoint and never by writing the
76
+ * status directly: the reserve is released by a ledger posting, not by the
77
+ * status, so a hand-edited row leaves the funds locked for good.
56
78
  */
57
79
  cancel(transferId) {
58
80
  return this.#http.request('POST', `${this.#base}/${seg(transferId)}/cancel`);
@@ -1 +1 @@
1
- {"version":3,"file":"transfers.js","sourceRoot":"","sources":["../../../src/resources/transfers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAA;AActD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,iBAAiB;IACnB,KAAK,CAAY;IACjB,KAAK,CAAQ;IAEtB,YAAY,IAAgB,EAAE,SAAiB;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,KAAK,GAAG,kBAAkB,GAAG,CAAC,SAAS,CAAC,YAAY,CAAA;IAC3D,CAAC;IAED,gFAAgF;IAChF,KAAK,CAAC,IAAI,CACR,KAAyB,EACzB,OAAO,GAAiD,EAAE;QAE1D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAA0B,MAAM,EAA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C,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;SAC7E,CAAC,CAAA;QACF,OAAO,OAAO,CAAmD,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE;YACrF,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,UAAkB;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IACzF,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,IAAI,CAAC,UAAkB,EAAE,KAAgB;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,MAAM,EACN,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,CAAC,YAAY,EAC5C,EAAE,IAAI,EAAE,KAAK,EAAE,CAChB,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,UAAkB;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAe,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAA;IAC5F,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,SAAS,CACP,UAAkB,EAClB,KAAK,GAA0B,EAAE;QAEjC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,MAAM,EACN,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,UAAU,CAAC,YAAY,EAC5C,EAAE,IAAI,EAAE,KAAK,EAAE,CAChB,CAAA;IACH,CAAC;CACF"}
@@ -13,11 +13,31 @@ import type { AddressDetail as GeneratedAddressDetail, AddressListItem, CreateTr
13
13
  /**
14
14
  * An address as it appears in listings.
15
15
  *
16
+ * Which shape comes from where: `GET /addresses` and `PATCH /addresses/{id}`
17
+ * both answer with `AddressListItem` — that is why this is an alias of it and
18
+ * not of the schema called `Address`. `GET /addresses/{id}` answers with the
19
+ * larger `AddressDetail` (transactions, shares, vault).
20
+ *
21
+ * The document DOES also declare a schema named `Address`, and this export
22
+ * shadows it — `src/index.ts` re-exports this name explicitly, and an
23
+ * explicit re-export beats `export type *`. That is deliberate, and the
24
+ * reason belongs here so nobody "fixes" it the wrong way round: no operation
25
+ * references the `Address` schema (zero `$ref`), and its sixteen properties
26
+ * are a strict subset of `AddressListItem`'s twenty-three, identical in type
27
+ * and in optionality. The alias is therefore narrower than the schema it
28
+ * hides, never wider, and the hidden schema describes no response at all.
29
+ * Pointing this name at `Address` would be the real break: the seven extra
30
+ * fields would vanish from the type while still arriving on the wire.
31
+ *
16
32
  * `balance` is `string | null`, and the `null` matters: it means the address
17
33
  * has NO ledger account yet — nothing has ever arrived. That is not zero, and
18
34
  * the two must not be merged, because "no account" and "empty account"
19
35
  * deserve different wording. Amounts are raw smallest units; put them through
20
36
  * the helpers in `units.ts` rather than `Number`.
37
+ *
38
+ * One field is thinner than the type admits: `sharing` is optional because
39
+ * `PATCH /addresses/{id}` reuses this schema WITHOUT it (the document says so
40
+ * itself, on the property). Listings and the detail endpoint do send it.
21
41
  */
22
42
  export type Address = AddressListItem;
23
43
  /** A single address with its sharing and access details. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/resources/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,aAAa,IAAI,sBAAsB,EACvC,eAAe,EACf,uBAAuB,EACvB,WAAW,IAAI,oBAAoB,EACnC,UAAU,EACX,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,GAAG,eAAe,CAAA;AAErC,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAA;AAElD,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAA;AAEhE,+CAA+C;AAC/C,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAA;AAE9C,4DAA4D;AAC5D,MAAM,MAAM,UAAU,GAAG,UAAU,CAAA;AAEnC;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,SAAS,GACT,WAAW,GACX,WAAW,GACX,QAAQ,GACR,WAAW,GACX,UAAU,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/resources/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,aAAa,IAAI,sBAAsB,EACvC,eAAe,EACf,uBAAuB,EACvB,WAAW,IAAI,oBAAoB,EACnC,UAAU,EACX,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,OAAO,GAAG,eAAe,CAAA;AAErC,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAA;AAElD,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,uBAAuB,CAAC,aAAa,CAAC,CAAA;AAEhE,+CAA+C;AAC/C,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAAA;AAE9C,4DAA4D;AAC5D,MAAM,MAAM,UAAU,GAAG,UAAU,CAAA;AAEnC;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,SAAS,GACT,WAAW,GACX,WAAW,GACX,QAAQ,GACR,WAAW,GACX,UAAU,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/units.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,MAAM;IACrB,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,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CAAC,GAAG,CAAC,GAAG,CAAC,CAKxD;AAED,eAAO,MAAM,MAAM,MAAO,MAAM,KAAG,OAA+B,CAAA;AAClE,eAAO,MAAM,UAAU,MAAO,MAAM,KAAG,OAA6B,CAAA"}
package/dist/esm/units.js CHANGED
@@ -23,8 +23,15 @@ export class AmountError extends Error {
23
23
  }
24
24
  const RAW_RE = /^-?\d+$/;
25
25
  const DECIMAL_RE = /^-?\d+(\.\d+)?$/;
26
+ /**
27
+ * The API's own ceiling: `CreateTokenBody.decimals` is `int().min(0).max(38)`
28
+ * in the policy engine's `src/openapi/models.ts`. A lower bound here would
29
+ * contradict the rest of the package — `registries.createToken` would accept a
30
+ * token this module then refuses to do arithmetic on.
31
+ */
32
+ const MAX_DECIMALS = 38;
26
33
  function assertDecimals(decimals) {
27
- if (!Number.isInteger(decimals) || decimals < 0 || decimals > 36) {
34
+ if (!Number.isInteger(decimals) || decimals < 0 || decimals > MAX_DECIMALS) {
28
35
  throw new AmountError(`Invalid decimals: ${decimals}`);
29
36
  }
30
37
  }
@@ -76,8 +83,17 @@ export function toDecimalString(a, options = {}) {
76
83
  */
77
84
  export function format(a, options = {}) {
78
85
  const decimal = toDecimalString(a, { trim: false });
86
+ // The padding is clamped to `decimals` because `decimals` is the maximum
87
+ // below, and Intl throws RangeError when a minimum exceeds its maximum. So
88
+ // the default of two digits made `format` unusable — not merely unpadded —
89
+ // for any token with 0 or 1 decimals, and such tokens are reachable: the API
90
+ // allows `decimals: 0` on a token, and a `currency` category field takes
91
+ // `scale: 0` today. Clamping rather than raising the maximum: digits past
92
+ // `decimals` do not exist in the asset, and printing them would claim a
93
+ // divisibility the token does not have.
94
+ const minFraction = Math.min(options.minFractionDigits ?? 2, a.decimals);
79
95
  const formatter = new Intl.NumberFormat(options.locale ?? 'en-US', {
80
- minimumFractionDigits: options.minFractionDigits ?? 2,
96
+ minimumFractionDigits: minFraction,
81
97
  maximumFractionDigits: a.decimals,
82
98
  });
83
99
  // The runtime accepts a string and keeps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