@v3finance/core-sdk 0.1.0 → 0.2.1

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 +441 -7
  2. package/README.md +219 -73
  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 +30 -6
  12. package/dist/cjs/core/gated.d.ts.map +1 -1
  13. package/dist/cjs/core/gated.js +21 -6
  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 +147 -43
  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 +965 -179
  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 +23 -8
  31. package/dist/cjs/resources/addresses.d.ts.map +1 -1
  32. package/dist/cjs/resources/addresses.js +8 -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 +44 -6
  86. package/dist/cjs/resources/transfers.d.ts.map +1 -1
  87. package/dist/cjs/resources/transfers.js +41 -3
  88. package/dist/cjs/resources/transfers.js.map +1 -1
  89. package/dist/cjs/resources/types.d.ts +16 -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 +30 -6
  105. package/dist/esm/core/gated.d.ts.map +1 -1
  106. package/dist/esm/core/gated.js +21 -6
  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 +148 -44
  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 +965 -179
  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 +23 -8
  124. package/dist/esm/resources/addresses.d.ts.map +1 -1
  125. package/dist/esm/resources/addresses.js +8 -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 +44 -6
  179. package/dist/esm/resources/transfers.d.ts.map +1 -1
  180. package/dist/esm/resources/transfers.js +41 -3
  181. package/dist/esm/resources/transfers.js.map +1 -1
  182. package/dist/esm/resources/types.d.ts +16 -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 +193 -0
  190. package/docs/errors.md +491 -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 +31 -7
  195. package/src/core/http.ts +173 -49
  196. package/src/core/pagination.ts +38 -1
  197. package/src/generated/operations.ts +1 -1
  198. package/src/generated/types.ts +1001 -180
  199. package/src/index.ts +64 -7
  200. package/src/resources/addresses.ts +24 -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 +51 -7
  215. package/src/resources/types.ts +16 -0
  216. package/src/units.ts +19 -2
  217. package/src/version.ts +1 -1
@@ -25,20 +25,59 @@ class ReportsResource {
25
25
  get #base() {
26
26
  return `/api/v1/vaults/${this.#vault}`;
27
27
  }
28
- /** Runs a report. The compiler requires whatever that type needs. */
28
+ /**
29
+ * Runs a report. The compiler requires whatever that type needs, and the
30
+ * answer is the schema of THAT type — see `ReportResult`.
31
+ *
32
+ * Money in a report is DECIMAL, not raw smallest units: every `AssetAmount`
33
+ * (`…ByAsset[].amount`), the `byAsset` rows, and the balances of
34
+ * `asset_movement`, `account_statement` and `balance_position` are strings
35
+ * like `"1.5"`. Read them with `parseDecimal`; `amount` would take `"1.5"`
36
+ * for an integer and reject it. The one exception is `address_activity`,
37
+ * whose `openingBalances`/`closingBalances` are raw (`balanceRaw`).
38
+ *
39
+ * Percentages — `comparison.*ChangePercent`, `observations[].changePercent`,
40
+ * the `…ShareUsd` and `…RatePercent` fields — are decimal STRINGS too
41
+ * (`"12.5"`, `"-40"`), and `null` where the figure cannot be worked out:
42
+ * no previous period to compare with, no USD valuation, a zero base.
43
+ */
29
44
  run(type, params) {
30
45
  return this.#http.request('GET', `${this.#base}/reports/${type}`, {
31
46
  query: { ...params },
32
47
  });
33
48
  }
34
- /** The same thing through the unified endpoint, choosing the type by alias. */
49
+ /**
50
+ * The same thing through the unified endpoint, choosing the type by alias.
51
+ *
52
+ * The document types this endpoint's answer as `AnyReport`, the union of
53
+ * all ten. The type you pass decides which member arrives, so the return is
54
+ * narrowed to it; call it with a `ReportType` known only at runtime and you
55
+ * get the whole union back.
56
+ */
35
57
  runUnified(type, params) {
36
58
  return this.#http.request('GET', `${this.#base}/reports`, {
37
59
  query: { type, ...params },
38
60
  });
39
61
  }
40
- /** Drill-down: the operations behind a figure in a report. */
41
- queryOperations(body) {
62
+ /**
63
+ * Drill-down: the operations behind a figure in a report.
64
+ *
65
+ * A PERIOD IS REQUIRED even though every field of the body is optional. The
66
+ * endpoint takes it from `drilldown.periodStart` or else from
67
+ * `filters.from`/`filters.to`, and with neither it answers 400
68
+ * `REPORT_INVALID_PERIOD` — `queryOperations({})` is not a "whole history"
69
+ * query.
70
+ *
71
+ * The other defaults narrow harder than people expect: with no
72
+ * `filters.statuses` only `confirmed` operations are listed, and with no
73
+ * `filters.flowTypes` only `external` ones. Pass the report's own filters
74
+ * through, or the breakdown comes back smaller than the figure it explains.
75
+ *
76
+ * `totals.byAsset[].amount` is a DECIMAL string, like every `AssetAmount`
77
+ * in the reports. Read it with `parseDecimal`, not `amount` — the latter
78
+ * would take `'1.5'` for an integer and reject it.
79
+ */
80
+ queryOperations(body = {}) {
42
81
  return this.#http.request('POST', `${this.#base}/reports/query/operations`, { body });
43
82
  }
44
83
  // --- saved templates ----------------------------------------------------
@@ -49,9 +88,47 @@ class ReportsResource {
49
88
  template(templateId) {
50
89
  return this.#http.request('GET', `${this.#base}/report-templates/${(0, http_js_1.seg)(templateId)}`);
51
90
  }
91
+ /**
92
+ * Saves a set of report parameters under a name.
93
+ *
94
+ * `parameters` is what the live report takes, as an object — with one
95
+ * addition: instead of `from`/`to` it may carry
96
+ * `relativePeriod: { unit: 'day' | 'week' | 'month', offset }`, resolved to
97
+ * dates each time the template runs.
98
+ *
99
+ * NOTHING IN `parameters` IS CHECKED ON SAVE — it is a free-form bag to the
100
+ * API. A template with no period, or one aimed at a counterparty that does
101
+ * not exist, saves fine and fails at `runTemplate`.
102
+ *
103
+ * `isShared: true` makes the template visible to the whole vault and is for
104
+ * administrators only. Sharing lends nobody the author's reach: the scope
105
+ * is worked out for whoever RUNS it, on every run, so two people get
106
+ * different figures from the same template.
107
+ *
108
+ * THE BAG IS NOT A QUERY STRING, and three things that work on a live
109
+ * report silently do not work here. It is stored and later handed to the
110
+ * report builder as it is — nothing parses it, nothing fills defaults:
111
+ *
112
+ * - a multi-value filter must be a real ARRAY; a comma-separated string is
113
+ * not split;
114
+ * - `categoryField` IS IGNORED. A live report parses `'ticker:EUR'` into a
115
+ * filter; this path does not, so a template or snapshot built from the
116
+ * filters of a report narrowed by `categoryField` answers 200 with
117
+ * figures for EVERY value — the wrong report, with no error. Until the
118
+ * API parses it here, send the parsed form the builder reads instead:
119
+ * `categoryFieldValues: { ticker: ['EUR'] }`;
120
+ * - `timezone` has no default. The live endpoints fall back to `UTC`; here
121
+ * an absent one reaches the builder as `undefined`. Always pass it.
122
+ *
123
+ * So spreading a `ReportFilters` value into `parameters` is safe only when
124
+ * it carries no `categoryField` and does carry a `timezone`. (The spread
125
+ * itself is needed because the type is an index signature, which an
126
+ * interface-typed value does not fit directly.)
127
+ */
52
128
  createTemplate(body) {
53
129
  return this.#http.request('POST', `${this.#base}/report-templates`, { body });
54
130
  }
131
+ /** Partial: only the fields you send change. `parameters` is replaced whole, not merged. */
55
132
  updateTemplate(templateId, body) {
56
133
  return this.#http.request('PATCH', `${this.#base}/report-templates/${(0, http_js_1.seg)(templateId)}`, { body });
57
134
  }
@@ -66,6 +143,18 @@ class ReportsResource {
66
143
  * template's period while believing you had asked for another one. To
67
144
  * change the filters, read the template and call `run()` with them, or
68
145
  * edit the template.
146
+ *
147
+ * The answer is `AnyReport`: which of the ten shapes arrives depends on the
148
+ * template's `reportType`, which is not known to the compiler. `report.type`
149
+ * says which one it is at runtime, but it does NOT narrow the union — the
150
+ * document types that field as the same ten-value enum on every member. So
151
+ * narrow by a block only that report has (`'totalsByAsset' in report`), or
152
+ * check `report.type` and assert the type yourself.
153
+ *
154
+ * This is also where a template's mistakes surface, since its parameters
155
+ * were not checked when it was saved: no period is a 400, a target that no
156
+ * longer exists a 404, and a template built for somebody else's `userId`
157
+ * run by a non-administrator a 403.
69
158
  */
70
159
  runTemplate(templateId) {
71
160
  return this.#http.request('POST', `${this.#base}/report-templates/${(0, http_js_1.seg)(templateId)}/run`);
@@ -80,18 +169,55 @@ class ReportsResource {
80
169
  * cursor, so a larger history is simply cut off rather than continued.
81
170
  */
82
171
  snapshots(params = {}) {
83
- return this.#http.request('GET', `${this.#base}/report-snapshots`, { query: { ...params } });
172
+ return this.#http.request('GET', `${this.#base}/report-snapshots`, {
173
+ query: { ...params },
174
+ });
84
175
  }
176
+ /**
177
+ * One snapshot WITH its figures — under `resultJson`, not `result`; see
178
+ * `ReportSnapshotDetail`. A non-admin can only read snapshots they
179
+ * generated themselves, and a missing one is 404 either way, so "not yours"
180
+ * and "not there" are indistinguishable.
181
+ */
85
182
  snapshot(snapshotId) {
86
183
  return this.#http.request('GET', `${this.#base}/report-snapshots/${(0, http_js_1.seg)(snapshotId)}`);
87
184
  }
185
+ /**
186
+ * Builds the report and freezes it. The answer carries the figures under
187
+ * `result` — the detail (`snapshot(id)`) calls the same thing `resultJson`.
188
+ *
189
+ * `parameters` follows the same rules as a template's — read them at
190
+ * `createTemplate`, because two of them fail silently: `categoryField` is
191
+ * ignored (the snapshot would freeze UNFILTERED figures; send
192
+ * `categoryFieldValues` instead) and `timezone` has no default. Unlike a
193
+ * template the parameters ARE used at once, so a bad period or a missing
194
+ * target fails here.
195
+ *
196
+ * `result` is the report of type `reportType`, but the type cannot say so:
197
+ * the spec declares it as a free-form object. Narrow it yourself —
198
+ * `snap.result as unknown as ReportResult['transaction_activity']` (the
199
+ * double cast is required; the detail's `resultJson` takes the same one).
200
+ * For the same reason the per-type REQUIRED parameters are not checked by
201
+ * the compiler here, as they are in `run()`.
202
+ *
203
+ * A result over roughly 900 KB is refused with 400
204
+ * `REPORT_PERIOD_TOO_LARGE` — narrow the filters.
205
+ */
88
206
  createSnapshot(body) {
89
207
  return this.#http.request('POST', `${this.#base}/report-snapshots`, { body });
90
208
  }
91
209
  deleteSnapshot(snapshotId) {
92
210
  return this.#http.request('DELETE', `${this.#base}/report-snapshots/${(0, http_js_1.seg)(snapshotId)}`);
93
211
  }
94
- /** Starts an export of a snapshot. The file is fetched separately. */
212
+ /**
213
+ * Exports a snapshot. The file is fetched separately, with `downloadExport`.
214
+ *
215
+ * Only `format` matters, and only two of its four values work: `json` (the
216
+ * frozen result) and `csv` (a flat register of operations). `xlsx` and
217
+ * `pdf` pass validation and are then refused with 400
218
+ * `REPORT_UNSUPPORTED_FORMAT`. `locale`, `timezone` and
219
+ * `includeOperationRegister` are accepted and currently change nothing.
220
+ */
95
221
  createExport(snapshotId, body) {
96
222
  return this.#http.request('POST', `${this.#base}/report-snapshots/${(0, http_js_1.seg)(snapshotId)}/exports`, { body });
97
223
  }
@@ -103,7 +229,9 @@ class ReportsResource {
103
229
  * be CSV or another binary format, and parsing that as JSON fails every
104
230
  * time. Read it with `.blob()`, `.text()` or `.arrayBuffer()`.
105
231
  *
106
- * Poll `export()` until it reports ready before calling this.
232
+ * Exports are produced synchronously today, so the record `createExport`
233
+ * answers with is already `completed` and can be downloaded at once. The
234
+ * `status` field exists for a queued path — check it rather than assuming.
107
235
  */
108
236
  downloadExport(exportId) {
109
237
  return this.#http.fetchRaw('GET', `${this.#base}/report-exports/${(0, http_js_1.seg)(exportId)}/download`);
@@ -1 +1 @@
1
- {"version":3,"file":"reports.js","sourceRoot":"","sources":["../../../src/resources/reports.ts"],"names":[],"mappings":";;;AAAA,6CAAkE;AAgKlE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C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAiB,MAAM,EAAE,GAAG,IAAI,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,IAAA,aAAG,EAAC,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,IAAA,aAAG,EAAC,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,IAAA,aAAG,EAAC,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,IAAA,aAAG,EAAC,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;AAE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,MAAM,EAG9C;IAMD,sCAAsC;IACtC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,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"}
@@ -41,8 +41,37 @@ class SharingResource {
41
41
  * 400 comes only when every subject was rejected. A consumer that trusts
42
42
  * the status code silently loses the people who were refused.
43
43
  *
44
+ * WHERE THE REASONS GO WHEN EVERY SUBJECT FAILED. That 400 is not an error
45
+ * envelope: the API sends the same `{results:[…]}` body with a 400 instead
46
+ * of a 201. The document describes both forms of that status — the
47
+ * envelope for a body that failed validation, and `ShareBatchAllRejected`
48
+ * for a batch in which every subject was refused. The SDK does not lose the
49
+ * second, but it does throw: `core/errors.ts` finds neither `error` nor
50
+ * `code` in the body, so it builds a `CoreError` with `code: 'BAD_REQUEST'`
51
+ * and puts the WHOLE body in `details`:
52
+ *
53
+ * ```ts
54
+ * catch (e) {
55
+ * if (isCoreError(e) && e.status === 400) {
56
+ * const per = (e.details as ShareBatchAllRejected | undefined)?.results
57
+ * // per[i].error.code — why that one subject was refused
58
+ * }
59
+ * }
60
+ * ```
61
+ *
62
+ * `details` is `undefined` for the other 400, the validation one — hence
63
+ * the `| undefined` in the cast, and the reason to check before reading.
64
+ *
65
+ * Reading `message` instead gets you "The request was rejected", because
66
+ * the server sent no message to pass on. Per-subject `error.message` equals
67
+ * its `code`, so neither is a sentence to show a person as-is.
68
+ *
44
69
  * The single-subject form answers with the grant itself rather than a
45
- * batch, which is why the return type is a union.
70
+ * batch, which is why the return type is a union — `ShareGrantCreated`,
71
+ * the grant or the batch; tell them apart with `'results' in answer`. It
72
+ * also reports failure differently: one subject refused is a plain 403 with
73
+ * no `results[]` at all, so the batch form is the one to use when you need
74
+ * reasons.
46
75
  */
47
76
  share(addressId, input) {
48
77
  return this.#http.request('POST', `${this.#address(addressId)}/shares`, { body: input });
@@ -50,6 +79,7 @@ class SharingResource {
50
79
  update(addressId, shareId, input) {
51
80
  return this.#http.request('PATCH', `${this.#address(addressId)}/shares/${(0, http_js_1.seg)(shareId)}`, { body: input });
52
81
  }
82
+ /** Soft: the row survives with `revokedAt`/`revokedById` for the audit trail. */
53
83
  revoke(addressId, shareId) {
54
84
  return this.#http.request('DELETE', `${this.#address(addressId)}/shares/${(0, http_js_1.seg)(shareId)}`);
55
85
  }
@@ -61,15 +91,32 @@ class SharingResource {
61
91
  participants(addressId) {
62
92
  return this.#http.request('GET', `${this.#address(addressId)}/participants`);
63
93
  }
64
- /** Addresses you have shared with others. */
94
+ /**
95
+ * What you have opened to others — addresses AND folders, so the entries
96
+ * are not all of one `targetType`. Same shape as `list()`.
97
+ */
65
98
  sharedByMe() {
66
99
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/shared-by-me`);
67
100
  }
68
- /** Addresses others have shared with you. */
101
+ /**
102
+ * Addresses others have shared with you — DIRECT grants on an address
103
+ * only. Access that reaches you through a shared FOLDER is not here, which
104
+ * is the trap: an empty answer does not mean nothing is shared with you.
105
+ * For shared access of every kind ask the addresses list with
106
+ * `access: 'shared'`, or `'all'` to include your own.
107
+ */
69
108
  sharedWithMe() {
70
109
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/shared-with-me`);
71
110
  }
72
- /** Gives up access someone granted you. Your own grant, your own decision. */
111
+ /**
112
+ * Gives up access someone granted you. Your own grant, your own decision —
113
+ * the owner is not asked.
114
+ *
115
+ * Works on a grant made to you PERSONALLY. Access you have through a user
116
+ * group cannot be dropped this way, because it belongs to the whole group:
117
+ * that answers 409 `ACCESS_VIA_GROUP`, with the group's id and name in
118
+ * `details`, so the interface can say which group to leave instead.
119
+ */
73
120
  leave(grantId) {
74
121
  return this.#http.request('DELETE', `/api/v1/vaults/${this.#vault}/shared-with-me/${(0, http_js_1.seg)(grantId)}`);
75
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sharing.js","sourceRoot":"","sources":["../../../src/resources/sharing.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AAWtD;;;;;;;;;;;;;;;;GAgBG;AACH;IACW,KAAK,CAAY;IACjB,MAAM,CAAQ;IAEvB,YAAY,IAAgB,EAAE,SAAiB;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,IAAA,aAAG,EAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;IAED,QAAQ,CAAC,SAAiB;QACxB,OAAO,kBAAkB,IAAI,CAAC,MAAM,cAAc,IAAA,aAAG,EAAC,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,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AAE,KAAK,EAAE,CAChB,CAAA;IACH,CAAC;IAED,iFAAiF;IACjF,MAAM,CAAC,SAAiB,EAAE,OAAe;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,QAAQ,EACR,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,IAAA,aAAG,EAAC,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,IAAA,aAAG,EAAC,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;
@@ -13,15 +13,31 @@ export interface VoteInput {
13
13
  *
14
14
  * applied (201) — executed, the money left;
15
15
  * pending (202) — awaiting signatures, funds RESERVED but not sent;
16
- * replayed (200) — a repeat; the transfer already existed.
16
+ * replayed (200) — a transfer with this `idempotencyKey` already existed,
17
+ * and this is that transfer as it stands NOW.
17
18
  *
18
19
  * They cannot be told apart by the body. Showing "sent" on `pending` tells
19
20
  * the person money has gone when it is frozen.
21
+ *
22
+ * `replayed` does not mean "sent" either. It says only that the request was
23
+ * seen before; what became of it is in `data.transaction.status`:
24
+ *
25
+ * confirmed, submitted — it left;
26
+ * awaiting_approval — waiting for signatures, funds reserved;
27
+ * pending — still executing;
28
+ * failed, rejected,
29
+ * cancelled — it did not leave.
20
30
  */
21
31
  export declare class TransfersResource {
22
32
  #private;
23
33
  constructor(http: HttpClient, vaultCode: string);
24
- /** Sends a transfer. The timeout is long: the path calls the wallet service. */
34
+ /**
35
+ * Sends a transfer. The timeout is long: the path calls the wallet service.
36
+ *
37
+ * On `outcome: 'replayed'` read `data.transaction.status` before telling
38
+ * anyone anything — a replay of an attempt that failed, or that is still
39
+ * waiting for signatures, comes back the same way as one that went out.
40
+ */
25
41
  send(input: CreateTransferBody, options?: {
26
42
  signal?: AbortSignal;
27
43
  timeoutMs?: number;
@@ -38,13 +54,35 @@ export declare class TransfersResource {
38
54
  * Only people captured in the approver SNAPSHOT taken when the request was
39
55
  * created may vote: editing a policy or a group afterwards does not change
40
56
  * an in-flight request.
57
+ *
58
+ * READ `status` FROM THE ANSWER — it is the status of the TRANSFER after
59
+ * the vote, and the vote is where the money moves:
60
+ *
61
+ * awaiting_approval — counted, more signatures still needed;
62
+ * rejected — a `reject` is a veto, and the reserve is released;
63
+ * confirmed/failed — this vote completed the threshold, so execution ran
64
+ * INSIDE this request (gas, then broadcast, ~10s).
65
+ *
66
+ * `failed` means the money is back: execution broke after approval and the
67
+ * reserve was released, with the reason in `executionError`. Treating the
68
+ * call as "approved, done" hides both the success and that failure.
41
69
  */
42
- vote(transferId: string, input: VoteInput): Promise<unknown>;
70
+ vote(transferId: string, input: VoteInput): Promise<VoteResult>;
43
71
  /**
44
72
  * Cancels your own transfer that is awaiting signatures and releases the
45
- * reserve. A transfer already broadcast cannot be cancelled.
73
+ * reserve. A transfer already broadcast cannot be cancelled; administrators
74
+ * may cancel somebody else's, so a stuck request is not hostage to an
75
+ * absent initiator.
76
+ *
77
+ * The resulting status is its own value, `cancelled` — not the `rejected`
78
+ * of a veto and not `failed`. Worth keeping apart in the interface: "you
79
+ * withdrew this" and "somebody refused it" are different events.
80
+ *
81
+ * Clear a stuck transfer through this endpoint and never by writing the
82
+ * status directly: the reserve is released by a ledger posting, not by the
83
+ * status, so a hand-edited row leaves the funds locked for good.
46
84
  */
47
- cancel(transferId: string): Promise<unknown>;
85
+ cancel(transferId: string): Promise<CancelResult>;
48
86
  /**
49
87
  * Settles a transfer stuck in `pending` — the case where the worker died
50
88
  * 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,EACrB,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,uBAAuB,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;QA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AC;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"}
@@ -11,10 +11,20 @@ const gated_js_1 = require("../core/gated.js");
11
11
  *
12
12
  * applied (201) — executed, the money left;
13
13
  * pending (202) — awaiting signatures, funds RESERVED but not sent;
14
- * replayed (200) — a repeat; the transfer already existed.
14
+ * replayed (200) — a transfer with this `idempotencyKey` already existed,
15
+ * and this is that transfer as it stands NOW.
15
16
  *
16
17
  * They cannot be told apart by the body. Showing "sent" on `pending` tells
17
18
  * the person money has gone when it is frozen.
19
+ *
20
+ * `replayed` does not mean "sent" either. It says only that the request was
21
+ * seen before; what became of it is in `data.transaction.status`:
22
+ *
23
+ * confirmed, submitted — it left;
24
+ * awaiting_approval — waiting for signatures, funds reserved;
25
+ * pending — still executing;
26
+ * failed, rejected,
27
+ * cancelled — it did not leave.
18
28
  */
19
29
  class TransfersResource {
20
30
  #http;
@@ -23,7 +33,13 @@ class TransfersResource {
23
33
  this.#http = http;
24
34
  this.#base = `/api/v1/vaults/${(0, http_js_1.seg)(vaultCode)}/transfers`;
25
35
  }
26
- /** Sends a transfer. The timeout is long: the path calls the wallet service. */
36
+ /**
37
+ * Sends a transfer. The timeout is long: the path calls the wallet service.
38
+ *
39
+ * On `outcome: 'replayed'` read `data.transaction.status` before telling
40
+ * anyone anything — a replay of an attempt that failed, or that is still
41
+ * waiting for signatures, comes back the same way as one that went out.
42
+ */
27
43
  async send(input, options = {}) {
28
44
  const res = await this.#http.requestRaw('POST', this.#base, {
29
45
  body: input,
@@ -49,13 +65,35 @@ class TransfersResource {
49
65
  * Only people captured in the approver SNAPSHOT taken when the request was
50
66
  * created may vote: editing a policy or a group afterwards does not change
51
67
  * an in-flight request.
68
+ *
69
+ * READ `status` FROM THE ANSWER — it is the status of the TRANSFER after
70
+ * the vote, and the vote is where the money moves:
71
+ *
72
+ * awaiting_approval — counted, more signatures still needed;
73
+ * rejected — a `reject` is a veto, and the reserve is released;
74
+ * confirmed/failed — this vote completed the threshold, so execution ran
75
+ * INSIDE this request (gas, then broadcast, ~10s).
76
+ *
77
+ * `failed` means the money is back: execution broke after approval and the
78
+ * reserve was released, with the reason in `executionError`. Treating the
79
+ * call as "approved, done" hides both the success and that failure.
52
80
  */
53
81
  vote(transferId, input) {
54
82
  return this.#http.request('POST', `${this.#base}/${(0, http_js_1.seg)(transferId)}/approvals`, { body: input });
55
83
  }
56
84
  /**
57
85
  * Cancels your own transfer that is awaiting signatures and releases the
58
- * reserve. A transfer already broadcast cannot be cancelled.
86
+ * reserve. A transfer already broadcast cannot be cancelled; administrators
87
+ * may cancel somebody else's, so a stuck request is not hostage to an
88
+ * absent initiator.
89
+ *
90
+ * The resulting status is its own value, `cancelled` — not the `rejected`
91
+ * of a veto and not `failed`. Worth keeping apart in the interface: "you
92
+ * withdrew this" and "somebody refused it" are different events.
93
+ *
94
+ * Clear a stuck transfer through this endpoint and never by writing the
95
+ * status directly: the reserve is released by a ledger posting, not by the
96
+ * status, so a hand-edited row leaves the funds locked for good.
59
97
  */
60
98
  cancel(transferId) {
61
99
  return this.#http.request('POST', `${this.#base}/${(0, http_js_1.seg)(transferId)}/cancel`);
@@ -1 +1 @@
1
- {"version":3,"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,IAAA,aAAG,EAAC,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,IAAA,aAAG,EAAC,UAAU,CAAC,YAAY,EAC5C,EAAE,IAAI,EAAE,KAAK,EAAE,CAChB,CAAA;IACH,CAAC;CACF"}
@@ -13,6 +13,22 @@ 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"
@@ -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,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