@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
@@ -1 +1 @@
1
- {"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/resources/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAEtD,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AACD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,kCAAk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AAI,wBAAwB,EAC5C,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,GAAG,wBAAwB,CAAA;AAEtD,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAA;IAC7C,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B;AAED;;;;;;;GAOG;AACH,qBAAa,iBAAiB;;IAI5B,YAAY,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAG9C;IAED,8DAA8D;IAC9D,IAAI,CAAC,MAAM,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAE7D;IAED,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAE7C;IAED,sFAAsF;IAChF,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAG3F;IAED;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnE;CACF"}
@@ -27,7 +27,13 @@ export class AddressesResource {
27
27
  const res = await this.#http.requestRaw('POST', this.#base, { body: input });
28
28
  return toGated(res.status, res.data);
29
29
  }
30
- /** Metadata only: this touches neither money nor the derivation path. */
30
+ /**
31
+ * Metadata only: this touches neither money nor the derivation path.
32
+ *
33
+ * Answers with the listing shape, minus `sharing` — the endpoint reuses the
34
+ * schema but does not fill that property, which is why it is optional on
35
+ * `Address`. Refresh the list rather than reading the share count back.
36
+ */
31
37
  update(addressId, input) {
32
38
  return this.#http.request('PATCH', `${this.#base}/${seg(addressId)}`, { body: input });
33
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/resources/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAA;AA6BtD;;;;;;;GAOG;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,8DAA8D;IAC9D,IAAI,CAAC,MAAM,GAAwB,EAAE;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAgB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAA;IACvF,CAAC;IAED,GAAG,CAAC,SAAiB;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAgB,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IACpF,CAAC;IAED,sFAAsF;IACtF,KAAK,CAAC,MAAM,CAAC,KAAwB;QACnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAU,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;QACrF,OAAO,OAAO,CAAuC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;IAC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AAE,CAAC,CAAA;QACrF,OAAO,OAAO,CAAuC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;IAC5E,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,SAAiB,EAAE,KAAuB;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACjG,CAAC;CACF"}
@@ -1,5 +1,41 @@
1
1
  import { type HttpClient } from '../core/http.js';
2
- import type { CreateInvitationBody, PolicyGroup, PolicyTableItem, PolicyWithRules, CreateSeatBody, SeatCreated, CreatePolicyBody, CreatePolicyGroupBody, CreateVisibilityGrantBody, InvitationCreated, InvitationDetail, PatchPolicyBody, PatchPolicyGroupBody, PolicyDetail, PolicyGroupDetail, PolicyVersionList, VaultPoliciesPage, VisibilityGrant } from '../generated/types.js';
2
+ import type { PageParams } from '../core/pagination.js';
3
+ import type { AcceptDebugBody, AcceptResult, ActionType, CreateInvitationBody, Effect, Invitation, InvitationListItem, InvitationPublic, Membership, PolicyGroup, PolicyGroupWithCounts, PolicyTableItem, PolicyWithRules, CreateSeatBody, SeatCreated, CreatePolicyBody, CreatePolicyGroupBody, CreateVisibilityGrantBody, InvitationCreated, InvitationDetail, PatchPolicyBody, PatchPolicyGroupBody, PolicyDetail, PolicyGroupDetail, PolicyVersionList, UserGroupItem, VaultPoliciesPage, VisibilityGrant } from '../generated/types.js';
4
+ /**
5
+ * A policy as the two LISTING endpoints return it. A strict alias of the
6
+ * generated `PolicyTableItem`, kept under its earlier name.
7
+ *
8
+ * There is NO `conditionJson` and no `approvalJson` here: neither listing
9
+ * selects them, so a row cannot tell you whether a policy is conditional —
10
+ * and treating the absence as "applies always" is the opposite of what a
11
+ * condition usually says. Load one policy (`policies.get`) when you need the
12
+ * rule itself; the vault-scoped page (`vault().policies`) does carry both
13
+ * fields.
14
+ */
15
+ export type PolicyRow = PolicyTableItem;
16
+ /** Filters of the vault-scoped policy page (`vault().policies`). */
17
+ export interface VaultPoliciesParams extends PageParams {
18
+ actionType?: ActionType | undefined;
19
+ /**
20
+ * `requireApproval` is accepted here and nowhere else. A policy's own
21
+ * effect has been `allow | block` only since approval became a property of
22
+ * an allowing policy rather than an effect of its own, so this third value
23
+ * exists for rows written before that change — not for new ones.
24
+ */
25
+ effect?: Effect | 'requireApproval' | undefined;
26
+ enabled?: boolean | undefined;
27
+ }
28
+ /** A policy from the flat vault listing, which also names its owner group. */
29
+ export interface PolicyRowWithGroup extends PolicyRow {
30
+ groupId: string;
31
+ group: {
32
+ id: string;
33
+ code: string;
34
+ name: string;
35
+ color: string | null;
36
+ emoji: string | null;
37
+ };
38
+ }
3
39
  /**
4
40
  * Administrative endpoints.
5
41
  *
@@ -12,6 +48,11 @@ import type { CreateInvitationBody, PolicyGroup, PolicyTableItem, PolicyWithRule
12
48
  * this OBJECT" — grants — lives with the resources it belongs to
13
49
  * (`sharing`, `folders`, `categories`).
14
50
  */
51
+ /**
52
+ * The PLATFORM role, from the spec's own enum. Not a role inside a vault —
53
+ * a platform `admin` sees every vault while belonging to none.
54
+ */
55
+ export type PlatformRole = 'admin' | 'user';
15
56
  export declare class AdminResource {
16
57
  #private;
17
58
  constructor(http: HttpClient);
@@ -36,16 +77,27 @@ export declare class AdminResource {
36
77
  /**
37
78
  * `vaultId` is REQUIRED — the endpoint lists policies of one vault and
38
79
  * answers 400 without it. It is also NOT paginated: everything comes
39
- * back in one array.
80
+ * back in one array, sorted group then code.
81
+ *
82
+ * `actionType` is spelled out rather than left as a string because the
83
+ * API does not validate it here: an unrecognised value is passed to the
84
+ * query as-is and comes back as an EMPTY list, which reads like "this
85
+ * vault has no transfer policies" instead of "you misspelled it". The
86
+ * vault-scoped twin (`vault().policies`) declares the same ten values as
87
+ * an enum, so one spelling serves both.
88
+ *
89
+ * `effect` is `allow | block` only. Approval stopped being an effect when
90
+ * it became a property of an allowing policy; the vault-scoped twin still
91
+ * accepts the historical third value, this one does not and answers 400.
40
92
  */
41
93
  list: (params: {
42
94
  vaultId: string;
43
- groupId?: string;
44
- actionType?: string;
45
- effect?: string;
46
- enabled?: boolean;
95
+ groupId?: string | undefined;
96
+ actionType?: ActionType | undefined;
97
+ effect?: Effect | undefined;
98
+ enabled?: boolean | undefined;
47
99
  }) => Promise<{
48
- items: PolicyTableItem[];
100
+ items: PolicyRowWithGroup[];
49
101
  }>;
50
102
  get: (policyId: string) => Promise<PolicyDetail>;
51
103
  /** Every version of a policy — what changed, and which decision used which. */
@@ -69,8 +121,21 @@ export declare class AdminResource {
69
121
  */
70
122
  readonly policyGroups: {
71
123
  get: (groupId: string) => Promise<PolicyGroupDetail>;
72
- policies: (groupId: string) => Promise<unknown>;
73
- /** What this group's members can reach. */
124
+ /** This group's policies for a table view: every field but the rules. */
125
+ policies: (groupId: string, params?: {
126
+ actionType?: ActionType | undefined;
127
+ }) => Promise<PolicyTableItem[]>;
128
+ /**
129
+ * What this group's members can reach: the group, its member count, its
130
+ * policies and the three kinds of grant held by the group as a subject
131
+ * (addresses, member visibility, operation categories).
132
+ *
133
+ * Left untyped. The API declares this body inline, so there is no
134
+ * generated name to import, and it nests four different resources —
135
+ * hand-writing them here would add exactly the kind of duplicated shape
136
+ * that drifts from the API with nothing to notice it. Narrow it at the
137
+ * call site, or read the single-purpose endpoints.
138
+ */
74
139
  access: (groupId: string) => Promise<unknown>;
75
140
  create: (input: CreatePolicyGroupBody) => Promise<PolicyGroup>;
76
141
  update: (groupId: string, input: PatchPolicyGroupBody) => Promise<PolicyGroup>;
@@ -78,30 +143,82 @@ export declare class AdminResource {
78
143
  * Adding somebody to a group also makes them a vault member — the two
79
144
  * used to drift apart, leaving people with policies but no membership.
80
145
  */
81
- addMember: (groupId: string, userId: string) => Promise<unknown>;
82
- /** Takes the MEMBERSHIP id, not the user id — a user id answers 404. */
83
- removeMember: (groupId: string, membershipId: string) => Promise<unknown>;
146
+ addMember: (groupId: string, userId: string) => Promise<Membership>;
147
+ /**
148
+ * Takes the MEMBERSHIP id, not the user id — a user id answers 404. The
149
+ * id comes from `users.policyGroups`, which returns it as `membershipId`
150
+ * for this purpose.
151
+ *
152
+ * Removing somebody from their last group does NOT remove them from the
153
+ * vault: membership is its own record, so they stay in the directory with
154
+ * no policies — able to be granted access, refused every action.
155
+ */
156
+ removeMember: (groupId: string, membershipId: string) => Promise<{
157
+ deleted: true;
158
+ }>;
84
159
  };
85
160
  readonly users: {
86
- policyGroups: (userId: string) => Promise<unknown>;
87
- /** The PLATFORM role, not a role within a vault. The two are different. */
88
- setRole: (userId: string, role: string) => Promise<unknown>;
161
+ /**
162
+ * Every group this person is in, each with the `membershipId` that
163
+ * `policyGroups.removeMember` needs. Without `vaultId` it spans ALL
164
+ * vaults, so filter when you are rendering one vault's screen.
165
+ */
166
+ policyGroups: (userId: string, params?: {
167
+ vaultId?: string | undefined;
168
+ }) => Promise<UserGroupItem[]>;
169
+ /**
170
+ * The PLATFORM role, not a role within a vault. The two are different:
171
+ * a platform `admin` sees every vault while belonging to none, whereas a
172
+ * vault membership carries its own role.
173
+ *
174
+ * The parameter is narrowed to the two values the spec declares, which is
175
+ * worth the compile error on a privilege path: `string` here let a caller
176
+ * pass anything and find out from a 400 — after sending a role change.
177
+ * The RESPONSE keeps `role: string`, because the spec declares it bare and
178
+ * narrowing an answer we do not control would be a guess.
179
+ */
180
+ setRole: (userId: string, role: PlatformRole) => Promise<{
181
+ id: string;
182
+ email: string;
183
+ role: string;
184
+ }>;
89
185
  };
90
186
  /** Vault-scoped administrative listings and creation. */
91
187
  vault(vaultCode: string): {
92
- invitations: () => Promise<unknown>;
93
- policies: (params?: Record<string, string | number | boolean>) => Promise<VaultPoliciesPage>;
94
- policyGroups: () => Promise<unknown>;
188
+ invitations: (params?: {
189
+ status?: 'pending' | 'accepted' | 'revoked' | undefined;
190
+ }) => Promise<InvitationListItem[]>;
191
+ policies: (params?: VaultPoliciesParams) => Promise<VaultPoliciesPage>;
192
+ policyGroups: () => Promise<PolicyGroupWithCounts[]>;
95
193
  createSeat: (input: CreateSeatBody) => Promise<SeatCreated>;
96
194
  };
97
195
  readonly invitations: {
98
- /** Public: lets an invited person see what they were invited to. */
99
- byToken: (token: string) => Promise<unknown>;
196
+ /**
197
+ * Public: lets an invited person see what they were invited to — the
198
+ * vault and the groups, no token echoed back. The only endpoint here
199
+ * that needs no session, because it is what the /accept page calls.
200
+ *
201
+ * A revoked or already-accepted invitation answers 410, not 404: the
202
+ * difference is worth showing, since "this link was withdrawn" and "this
203
+ * link never existed" lead somewhere different.
204
+ */
205
+ byToken: (token: string) => Promise<InvitationPublic>;
206
+ /** The one place the magic-link token is returned. */
100
207
  get: (invitationId: string) => Promise<InvitationDetail>;
101
208
  create: (input: CreateInvitationBody) => Promise<InvitationCreated>;
102
- revoke: (invitationId: string) => Promise<unknown>;
103
- /** Accepts an invitation without the email round-trip. For debugging. */
104
- acceptDebug: (body: unknown) => Promise<unknown>;
209
+ /** Answers the invitation itself, now `revoked`. Already revoked → 400. */
210
+ revoke: (invitationId: string) => Promise<Invitation>;
211
+ /**
212
+ * Accepts an invitation without the email round-trip, for an account that
213
+ * already exists. For debugging and curl tests: in the real flow this
214
+ * happens inside the sign-up hook.
215
+ *
216
+ * Matches on the EMAIL in the body, not on a token — it finds the pending
217
+ * invitation for that address. No pending invitation → 404; the user
218
+ * already attached to another invitation → 400, so a repeat is refused
219
+ * rather than duplicating memberships.
220
+ */
221
+ acceptDebug: (body: AcceptDebugBody) => Promise<AcceptResult>;
105
222
  };
106
223
  /**
107
224
  * Who can see whom.
@@ -112,9 +229,17 @@ export declare class AdminResource {
112
229
  * here.
113
230
  */
114
231
  visibilityGrants(vaultCode: string): {
115
- list: () => Promise<unknown>;
232
+ list: (params?: {
233
+ subjectUserId?: string | undefined;
234
+ subjectGroupId?: string | undefined;
235
+ includeRevoked?: boolean | undefined;
236
+ }) => Promise<{
237
+ items: VisibilityGrant[];
238
+ }>;
116
239
  create: (input: CreateVisibilityGrantBody) => Promise<VisibilityGrant>;
117
- revoke: (grantId: string) => Promise<unknown>;
240
+ revoke: (grantId: string) => Promise<{
241
+ revoked: true;
242
+ }>;
118
243
  };
119
244
  }
120
245
  //# sourceMappingURL=admin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/resources/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEtD,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,eAAe,EACf,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;;IAGxB,YAAY,IAAI,EAAE,UAAU,EAE3B;IAID;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,QAAQ;QACf;;;;WAIG;QACH,IAAI,WAAW;YACb,OAAO,EAAE,MAAM,CAAA;YACf,OAAO,CAAC,EAAE,MAAM,CAAA;YAChB,UAAU,CAAC,EAAE,MAAM,CAAA;YACnB,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,OAAO,CAAC,EAAE,OAAO,CAAA;SAClB;mBAAiC,eAAe,EAAE;;QAInD,GAAG,aAAa,MAAM;QAGtB,+EAA+E;QAC/E,QAAQ,aAAa,MAAM;QAG3B,MAAM,UAAU,gBAAgB;QAGhC;;;;WAIG;QACH,MAAM,aAAa,MAAM,SAAS,eAAe;MAIlD;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY;QACnB,GAAG,YAAY,MAAM;QAGrB,QAAQ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1
+ {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../../src/resources/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,MAAM,EACN,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,CAAA;AAEvC,oEAAoE;AACpE,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IACnC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAA;IAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,8EAA8E;AAC9E,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;QACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KACrB,CAAA;CACF;AAED;;;;;;;;;;;GAWG;AACH;;;GAGG;AACH,MAAM,MAAM,YA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,CAeA;CACF"}
@@ -1,16 +1,4 @@
1
1
  import { seg } from '../core/http.js';
2
- /**
3
- * Administrative endpoints.
4
- *
5
- * They are in the package because the package covers the whole API. Having a
6
- * method here grants nothing: the server decides from your session, and a
7
- * non-administrator gets 403.
8
- *
9
- * Note that this is the half of the authorisation model that answers "may
10
- * this ACTION happen" — policies. The other half, "does this person reach
11
- * this OBJECT" — grants — lives with the resources it belongs to
12
- * (`sharing`, `folders`, `categories`).
13
- */
14
2
  export class AdminResource {
15
3
  #http;
16
4
  constructor(http) {
@@ -38,7 +26,18 @@ export class AdminResource {
38
26
  /**
39
27
  * `vaultId` is REQUIRED — the endpoint lists policies of one vault and
40
28
  * answers 400 without it. It is also NOT paginated: everything comes
41
- * back in one array.
29
+ * back in one array, sorted group then code.
30
+ *
31
+ * `actionType` is spelled out rather than left as a string because the
32
+ * API does not validate it here: an unrecognised value is passed to the
33
+ * query as-is and comes back as an EMPTY list, which reads like "this
34
+ * vault has no transfer policies" instead of "you misspelled it". The
35
+ * vault-scoped twin (`vault().policies`) declares the same ten values as
36
+ * an enum, so one spelling serves both.
37
+ *
38
+ * `effect` is `allow | block` only. Approval stopped being an effect when
39
+ * it became a property of an allowing policy; the vault-scoped twin still
40
+ * accepts the historical third value, this one does not and answers 400.
42
41
  */
43
42
  list: (params) => this.#http.request('GET', '/api/v1/policies', {
44
43
  query: { ...params },
@@ -67,8 +66,21 @@ export class AdminResource {
67
66
  */
68
67
  policyGroups = {
69
68
  get: (groupId) => this.#http.request('GET', `/api/v1/policy-groups/${seg(groupId)}`),
70
- policies: (groupId) => this.#http.request('GET', `/api/v1/policy-groups/${seg(groupId)}/policies`),
71
- /** What this group's members can reach. */
69
+ /** This group's policies for a table view: every field but the rules. */
70
+ policies: (groupId, params = {}) => this.#http.request('GET', `/api/v1/policy-groups/${seg(groupId)}/policies`, {
71
+ query: { ...params },
72
+ }),
73
+ /**
74
+ * What this group's members can reach: the group, its member count, its
75
+ * policies and the three kinds of grant held by the group as a subject
76
+ * (addresses, member visibility, operation categories).
77
+ *
78
+ * Left untyped. The API declares this body inline, so there is no
79
+ * generated name to import, and it nests four different resources —
80
+ * hand-writing them here would add exactly the kind of duplicated shape
81
+ * that drifts from the API with nothing to notice it. Narrow it at the
82
+ * call site, or read the single-purpose endpoints.
83
+ */
72
84
  access: (groupId) => this.#http.request('GET', `/api/v1/policy-groups/${seg(groupId)}/access`),
73
85
  create: (input) => this.#http.request('POST', '/api/v1/policy-groups', { body: input }),
74
86
  update: (groupId, input) => this.#http.request('PATCH', `/api/v1/policy-groups/${seg(groupId)}`, {
@@ -81,21 +93,54 @@ export class AdminResource {
81
93
  addMember: (groupId, userId) => this.#http.request('POST', `/api/v1/policy-groups/${seg(groupId)}/members`, {
82
94
  body: { userId },
83
95
  }),
84
- /** Takes the MEMBERSHIP id, not the user id — a user id answers 404. */
96
+ /**
97
+ * Takes the MEMBERSHIP id, not the user id — a user id answers 404. The
98
+ * id comes from `users.policyGroups`, which returns it as `membershipId`
99
+ * for this purpose.
100
+ *
101
+ * Removing somebody from their last group does NOT remove them from the
102
+ * vault: membership is its own record, so they stay in the directory with
103
+ * no policies — able to be granted access, refused every action.
104
+ */
85
105
  removeMember: (groupId, membershipId) => this.#http.request('DELETE', `/api/v1/policy-groups/${seg(groupId)}/members/${seg(membershipId)}`),
86
106
  };
87
107
  // --- people -------------------------------------------------------------
88
108
  users = {
89
- policyGroups: (userId) => this.#http.request('GET', `/api/v1/users/${seg(userId)}/policy-groups`),
90
- /** The PLATFORM role, not a role within a vault. The two are different. */
109
+ /**
110
+ * Every group this person is in, each with the `membershipId` that
111
+ * `policyGroups.removeMember` needs. Without `vaultId` it spans ALL
112
+ * vaults, so filter when you are rendering one vault's screen.
113
+ */
114
+ policyGroups: (userId, params = {}) => this.#http.request('GET', `/api/v1/users/${seg(userId)}/policy-groups`, {
115
+ query: { ...params },
116
+ }),
117
+ /**
118
+ * The PLATFORM role, not a role within a vault. The two are different:
119
+ * a platform `admin` sees every vault while belonging to none, whereas a
120
+ * vault membership carries its own role.
121
+ *
122
+ * The parameter is narrowed to the two values the spec declares, which is
123
+ * worth the compile error on a privilege path: `string` here let a caller
124
+ * pass anything and find out from a 400 — after sending a role change.
125
+ * The RESPONSE keeps `role: string`, because the spec declares it bare and
126
+ * narrowing an answer we do not control would be a guess.
127
+ */
91
128
  setRole: (userId, role) => this.#http.request('PATCH', `/api/v1/users/${seg(userId)}/role`, { body: { role } }),
92
129
  };
93
130
  /** Vault-scoped administrative listings and creation. */
94
131
  vault(vaultCode) {
95
132
  const base = `/api/v1/vaults/${seg(vaultCode)}`;
96
133
  return {
97
- invitations: () => this.#http.request('GET', `${base}/invitations`),
98
- policies: (params = {}) => this.#http.request('GET', `${base}/policies`, { query: params }),
134
+ /**
135
+ * Every invitation of the vault, newest first. The magic-link TOKEN is
136
+ * not in the listing — only `invitations.get` returns it, so that it
137
+ * cannot leak through a screenshot or a log of a list view.
138
+ */
139
+ invitations: (params = {}) => this.#http.request('GET', `${base}/invitations`, {
140
+ query: { ...params },
141
+ }),
142
+ policies: (params = {}) => this.#http.request('GET', `${base}/policies`, { query: { ...params } }),
143
+ /** Groups with `_count` of their policies and members. No cursor. */
99
144
  policyGroups: () => this.#http.request('GET', `${base}/policy-groups`),
100
145
  /**
101
146
  * Creates a "seat": an account prepared in advance, before the person's
@@ -107,12 +152,31 @@ export class AdminResource {
107
152
  };
108
153
  }
109
154
  invitations = {
110
- /** Public: lets an invited person see what they were invited to. */
155
+ /**
156
+ * Public: lets an invited person see what they were invited to — the
157
+ * vault and the groups, no token echoed back. The only endpoint here
158
+ * that needs no session, because it is what the /accept page calls.
159
+ *
160
+ * A revoked or already-accepted invitation answers 410, not 404: the
161
+ * difference is worth showing, since "this link was withdrawn" and "this
162
+ * link never existed" lead somewhere different.
163
+ */
111
164
  byToken: (token) => this.#http.request('GET', `/api/v1/invitations/by-token/${seg(token)}`),
165
+ /** The one place the magic-link token is returned. */
112
166
  get: (invitationId) => this.#http.request('GET', `/api/v1/invitations/${seg(invitationId)}`),
113
167
  create: (input) => this.#http.request('POST', '/api/v1/invitations', { body: input }),
168
+ /** Answers the invitation itself, now `revoked`. Already revoked → 400. */
114
169
  revoke: (invitationId) => this.#http.request('POST', `/api/v1/invitations/${seg(invitationId)}/revoke`),
115
- /** Accepts an invitation without the email round-trip. For debugging. */
170
+ /**
171
+ * Accepts an invitation without the email round-trip, for an account that
172
+ * already exists. For debugging and curl tests: in the real flow this
173
+ * happens inside the sign-up hook.
174
+ *
175
+ * Matches on the EMAIL in the body, not on a token — it finds the pending
176
+ * invitation for that address. No pending invitation → 404; the user
177
+ * already attached to another invitation → 400, so a repeat is refused
178
+ * rather than duplicating memberships.
179
+ */
116
180
  acceptDebug: (body) => this.#http.request('POST', '/api/v1/invitations/accept-debug', { body }),
117
181
  };
118
182
  /**
@@ -126,8 +190,15 @@ export class AdminResource {
126
190
  visibilityGrants(vaultCode) {
127
191
  const base = `/api/v1/vaults/${seg(vaultCode)}/visibility-grants`;
128
192
  return {
129
- list: () => this.#http.request('GET', base),
193
+ /**
194
+ * Active grants with the cards of subject and target group. The subject
195
+ * filters answer "what is open to this person or group", which is what
196
+ * their detail screen needs; `includeRevoked` adds the soft-deleted
197
+ * rows, the only way to see what access was withdrawn and when.
198
+ */
199
+ list: (params = {}) => this.#http.request('GET', base, { query: { ...params } }),
130
200
  create: (input) => this.#http.request('POST', base, { body: input }),
201
+ /** Soft: the row stays as `revoked`. Effective immediately. */
131
202
  revoke: (grantId) => this.#http.request('DELETE', `${base}/${seg(grantId)}`),
132
203
  };
133
204
  }
@@ -1 +1 @@
1
- {"version":3,"file":"admin.js","sourceRoot":"","sources":["../../../src/resources/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AAuBtD;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,aAAa;IACf,KAAK,CAAY;IAE1B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IA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IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,QAAQ,EAAE,GAAG,IAAI,IAAI,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;SAChG,CAAA;IACH,CAAC;CACF"}
@@ -1,9 +1,23 @@
1
1
  import { type HttpClient } from '../core/http.js';
2
2
  import type { PageParams } from '../core/pagination.js';
3
3
  import { type Gated } from '../core/gated.js';
4
- import type { ApprovalRequestCreated, ApprovalRequestDetail, CompositeApplied, ApprovalRequestsPage, CreateCompositeBody, VoteBody } from '../generated/types.js';
4
+ import type { ApprovalRequestCreated, ApprovalRequestDetail, ApprovalRequestsPage, CompositeApplied, CreateCompositeBody, RequestVoteResult, VoteBody } from '../generated/types.js';
5
+ /**
6
+ * Status of an approval REQUEST — and in UPPER CASE.
7
+ *
8
+ * That is the trap this type exists for: a transfer's status is lowercase
9
+ * (`awaiting_approval`, `confirmed`), a request's is not, and the two live
10
+ * side by side on the same screen. `status: 'pending'` used to compile and
11
+ * answer 400.
12
+ *
13
+ * `APPROVED` is about the VOTES, not about the outcome. "Approved but it
14
+ * failed to apply" is still `APPROVED`, and the difference shows up in
15
+ * `applyError` and `resolvedResultId` on the vote's answer — so a listing
16
+ * filtered to `APPROVED` is not a listing of things that happened.
17
+ */
18
+ export type ApprovalRequestStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CANCELLED';
5
19
  export interface ListApprovalsParams extends PageParams {
6
- status?: string | undefined;
20
+ status?: ApprovalRequestStatus | undefined;
7
21
  action?: string | undefined;
8
22
  /** Requests I STARTED. Not the same as the ones waiting for me. */
9
23
  mine?: boolean | undefined;
@@ -31,9 +45,36 @@ export declare class ApprovalsResource {
31
45
  constructor(http: HttpClient, vaultCode: string);
32
46
  list(params?: ListApprovalsParams): Promise<ApprovalRequestsPage>;
33
47
  get(requestId: string): Promise<ApprovalRequestDetail>;
34
- vote(requestId: string, input: VoteBody): Promise<unknown>;
35
- /** Cancels your own request and releases whatever it reserved. */
36
- cancel(requestId: string, reason?: string): Promise<unknown>;
48
+ /**
49
+ * Typed from `RequestVoteResult`, which the spec declares as a component but
50
+ * never `$ref`s — the operation inlines its 200 instead. The two were
51
+ * compared key by key and type by type and are the same schema; the only
52
+ * difference is an `additionalProperties: false` that does not reach the
53
+ * TypeScript shape. Worth saying, because a component nothing references
54
+ * usually means the opposite: an orphan left behind, which is what the
55
+ * `Address` schema turned out to be.
56
+ *
57
+ * Read `finalized` with `applyError`: a vote can finalize a request AND
58
+ * fail to apply it, and then the money has not moved.
59
+ */
60
+ vote(requestId: string, input: VoteBody): Promise<RequestVoteResult>;
61
+ /**
62
+ * Cancels your own request and releases whatever it reserved.
63
+ *
64
+ * Only while the request is `PENDING`, and only as its initiator or as an
65
+ * admin — the admin case exists so a request whose initiator is gone can
66
+ * still be cleared instead of holding the reserve forever.
67
+ *
68
+ * @param reason IGNORED BY THE SERVER, and no longer sent. The endpoint
69
+ * declares no request body and the handler never reads one, so the reason
70
+ * reached nothing: not the cancellation event, not the audit trail. It
71
+ * stays in the signature only so that existing callers keep compiling —
72
+ * drop it from your call, and record the reason wherever you need it to
73
+ * actually survive.
74
+ */
75
+ cancel(requestId: string, reason?: string): Promise<{
76
+ status: 'CANCELLED';
77
+ }>;
37
78
  /**
38
79
  * A composite request: several steps approved as one chain.
39
80
  *
@@ -1 +1 @@
1
- {"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../../src/resources/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,QAAQ,EACT,MAAM,uBAAuB,CAAA;AAE9B,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,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AM,EAG9C;IAED,IAAI,CAAC,MAAM,GAAE,mBAAwB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAEpE;IAED,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAErD;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAMnE;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,CAAC,CAK3E;IAED;;;;;;;OAOG;IACG,eAAe,CACnB,KAAK,EAAE,mBAAmB,GACzB,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC,CAK1D;CACF"}
@@ -21,14 +21,37 @@ export class ApprovalsResource {
21
21
  get(requestId) {
22
22
  return this.#http.request('GET', `${this.#base}/${seg(requestId)}`);
23
23
  }
24
+ /**
25
+ * Typed from `RequestVoteResult`, which the spec declares as a component but
26
+ * never `$ref`s — the operation inlines its 200 instead. The two were
27
+ * compared key by key and type by type and are the same schema; the only
28
+ * difference is an `additionalProperties: false` that does not reach the
29
+ * TypeScript shape. Worth saying, because a component nothing references
30
+ * usually means the opposite: an orphan left behind, which is what the
31
+ * `Address` schema turned out to be.
32
+ *
33
+ * Read `finalized` with `applyError`: a vote can finalize a request AND
34
+ * fail to apply it, and then the money has not moved.
35
+ */
24
36
  vote(requestId, input) {
25
37
  return this.#http.request('POST', `${this.#base}/${seg(requestId)}/approvals`, { body: input });
26
38
  }
27
- /** Cancels your own request and releases whatever it reserved. */
39
+ /**
40
+ * Cancels your own request and releases whatever it reserved.
41
+ *
42
+ * Only while the request is `PENDING`, and only as its initiator or as an
43
+ * admin — the admin case exists so a request whose initiator is gone can
44
+ * still be cleared instead of holding the reserve forever.
45
+ *
46
+ * @param reason IGNORED BY THE SERVER, and no longer sent. The endpoint
47
+ * declares no request body and the handler never reads one, so the reason
48
+ * reached nothing: not the cancellation event, not the audit trail. It
49
+ * stays in the signature only so that existing callers keep compiling —
50
+ * drop it from your call, and record the reason wherever you need it to
51
+ * actually survive.
52
+ */
28
53
  cancel(requestId, reason) {
29
- return this.#http.request('POST', `${this.#base}/${seg(requestId)}/cancel`, {
30
- body: reason === undefined ? {} : { reason },
31
- });
54
+ return this.#http.request('POST', `${this.#base}/${seg(requestId)}/cancel`);
32
55
  }
33
56
  /**
34
57
  * A composite request: several steps approved as one chain.
@@ -1 +1 @@
1
- {"version":3,"file":"approvals.js","sourceRoot":"","sources":["../../../src/resources/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AAEtD,OAAO,EAAE,OAAO,EAAc,MAAM,kBAAkB,CAAA;AA2BtD;;;;;;;GAOG;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,oBAAoB,CAAA;IACnE,CAAC;IAED,IAAI,CAAC,MAAM,GAAwB,EAAE;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAuB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAA;IAC9F,CAAC;IAED,GAAG,CAAC,SAAiB;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAwB,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAC5F,CAAC;IAED,IAAI,CAAC,SAAiB,EAAE,KAAe;QACr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