@v3finance/core-sdk 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/CHANGELOG.md +154 -0
  2. package/README.md +18 -14
  3. package/dist/cjs/client.d.ts +27 -34
  4. package/dist/cjs/client.d.ts.map +1 -1
  5. package/dist/cjs/client.js +69 -0
  6. package/dist/cjs/client.js.map +1 -1
  7. package/dist/cjs/core/gated.d.ts +12 -10
  8. package/dist/cjs/core/gated.d.ts.map +1 -1
  9. package/dist/cjs/core/gated.js +12 -10
  10. package/dist/cjs/core/gated.js.map +1 -1
  11. package/dist/cjs/core/http.d.ts +18 -0
  12. package/dist/cjs/core/http.d.ts.map +1 -1
  13. package/dist/cjs/core/http.js +11 -1
  14. package/dist/cjs/core/http.js.map +1 -1
  15. package/dist/cjs/core/pagination.d.ts +11 -9
  16. package/dist/cjs/core/pagination.d.ts.map +1 -1
  17. package/dist/cjs/core/pagination.js +11 -9
  18. package/dist/cjs/core/pagination.js.map +1 -1
  19. package/dist/cjs/generated/operations.d.ts +210 -2
  20. package/dist/cjs/generated/operations.d.ts.map +1 -1
  21. package/dist/cjs/generated/operations.js +212 -4
  22. package/dist/cjs/generated/operations.js.map +1 -1
  23. package/dist/cjs/generated/types.d.ts +935 -93
  24. package/dist/cjs/generated/types.d.ts.map +1 -1
  25. package/dist/cjs/index.d.ts +6 -6
  26. package/dist/cjs/index.d.ts.map +1 -1
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/resources/addresses.d.ts +91 -4
  29. package/dist/cjs/resources/addresses.d.ts.map +1 -1
  30. package/dist/cjs/resources/addresses.js +55 -3
  31. package/dist/cjs/resources/addresses.js.map +1 -1
  32. package/dist/cjs/resources/admin.d.ts +32 -1
  33. package/dist/cjs/resources/admin.d.ts.map +1 -1
  34. package/dist/cjs/resources/admin.js +45 -0
  35. package/dist/cjs/resources/admin.js.map +1 -1
  36. package/dist/cjs/resources/approvals.d.ts +30 -2
  37. package/dist/cjs/resources/approvals.d.ts.map +1 -1
  38. package/dist/cjs/resources/approvals.js.map +1 -1
  39. package/dist/cjs/resources/balances.d.ts +14 -7
  40. package/dist/cjs/resources/balances.d.ts.map +1 -1
  41. package/dist/cjs/resources/balances.js +10 -4
  42. package/dist/cjs/resources/balances.js.map +1 -1
  43. package/dist/cjs/resources/categories.d.ts +20 -6
  44. package/dist/cjs/resources/categories.d.ts.map +1 -1
  45. package/dist/cjs/resources/categories.js +19 -7
  46. package/dist/cjs/resources/categories.js.map +1 -1
  47. package/dist/cjs/resources/counterparties.d.ts +52 -6
  48. package/dist/cjs/resources/counterparties.d.ts.map +1 -1
  49. package/dist/cjs/resources/counterparties.js +24 -0
  50. package/dist/cjs/resources/counterparties.js.map +1 -1
  51. package/dist/cjs/resources/history.d.ts +227 -26
  52. package/dist/cjs/resources/history.d.ts.map +1 -1
  53. package/dist/cjs/resources/history.js +46 -0
  54. package/dist/cjs/resources/history.js.map +1 -1
  55. package/dist/cjs/resources/me.d.ts +17 -1
  56. package/dist/cjs/resources/me.d.ts.map +1 -1
  57. package/dist/cjs/resources/me.js +19 -0
  58. package/dist/cjs/resources/me.js.map +1 -1
  59. package/dist/cjs/resources/members.d.ts +21 -1
  60. package/dist/cjs/resources/members.d.ts.map +1 -1
  61. package/dist/cjs/resources/members.js +15 -0
  62. package/dist/cjs/resources/members.js.map +1 -1
  63. package/dist/cjs/resources/operations.d.ts +179 -4
  64. package/dist/cjs/resources/operations.d.ts.map +1 -1
  65. package/dist/cjs/resources/operations.js +192 -2
  66. package/dist/cjs/resources/operations.js.map +1 -1
  67. package/dist/cjs/resources/registries.d.ts +19 -2
  68. package/dist/cjs/resources/registries.d.ts.map +1 -1
  69. package/dist/cjs/resources/registries.js +16 -0
  70. package/dist/cjs/resources/registries.js.map +1 -1
  71. package/dist/cjs/version.d.ts +1 -1
  72. package/dist/cjs/version.js +1 -1
  73. package/dist/esm/client.d.ts +27 -34
  74. package/dist/esm/client.d.ts.map +1 -1
  75. package/dist/esm/client.js +69 -0
  76. package/dist/esm/client.js.map +1 -1
  77. package/dist/esm/core/gated.d.ts +12 -10
  78. package/dist/esm/core/gated.d.ts.map +1 -1
  79. package/dist/esm/core/gated.js +12 -10
  80. package/dist/esm/core/gated.js.map +1 -1
  81. package/dist/esm/core/http.d.ts +18 -0
  82. package/dist/esm/core/http.d.ts.map +1 -1
  83. package/dist/esm/core/http.js +11 -1
  84. package/dist/esm/core/http.js.map +1 -1
  85. package/dist/esm/core/pagination.d.ts +11 -9
  86. package/dist/esm/core/pagination.d.ts.map +1 -1
  87. package/dist/esm/core/pagination.js +11 -9
  88. package/dist/esm/core/pagination.js.map +1 -1
  89. package/dist/esm/generated/operations.d.ts +210 -2
  90. package/dist/esm/generated/operations.d.ts.map +1 -1
  91. package/dist/esm/generated/operations.js +212 -4
  92. package/dist/esm/generated/operations.js.map +1 -1
  93. package/dist/esm/generated/types.d.ts +935 -93
  94. package/dist/esm/generated/types.d.ts.map +1 -1
  95. package/dist/esm/index.d.ts +6 -6
  96. package/dist/esm/index.d.ts.map +1 -1
  97. package/dist/esm/index.js.map +1 -1
  98. package/dist/esm/resources/addresses.d.ts +91 -4
  99. package/dist/esm/resources/addresses.d.ts.map +1 -1
  100. package/dist/esm/resources/addresses.js +55 -3
  101. package/dist/esm/resources/addresses.js.map +1 -1
  102. package/dist/esm/resources/admin.d.ts +32 -1
  103. package/dist/esm/resources/admin.d.ts.map +1 -1
  104. package/dist/esm/resources/admin.js +45 -0
  105. package/dist/esm/resources/admin.js.map +1 -1
  106. package/dist/esm/resources/approvals.d.ts +30 -2
  107. package/dist/esm/resources/approvals.d.ts.map +1 -1
  108. package/dist/esm/resources/approvals.js.map +1 -1
  109. package/dist/esm/resources/balances.d.ts +14 -7
  110. package/dist/esm/resources/balances.d.ts.map +1 -1
  111. package/dist/esm/resources/balances.js +10 -4
  112. package/dist/esm/resources/balances.js.map +1 -1
  113. package/dist/esm/resources/categories.d.ts +20 -6
  114. package/dist/esm/resources/categories.d.ts.map +1 -1
  115. package/dist/esm/resources/categories.js +19 -7
  116. package/dist/esm/resources/categories.js.map +1 -1
  117. package/dist/esm/resources/counterparties.d.ts +52 -6
  118. package/dist/esm/resources/counterparties.d.ts.map +1 -1
  119. package/dist/esm/resources/counterparties.js +24 -0
  120. package/dist/esm/resources/counterparties.js.map +1 -1
  121. package/dist/esm/resources/history.d.ts +227 -26
  122. package/dist/esm/resources/history.d.ts.map +1 -1
  123. package/dist/esm/resources/history.js +46 -0
  124. package/dist/esm/resources/history.js.map +1 -1
  125. package/dist/esm/resources/me.d.ts +17 -1
  126. package/dist/esm/resources/me.d.ts.map +1 -1
  127. package/dist/esm/resources/me.js +19 -0
  128. package/dist/esm/resources/me.js.map +1 -1
  129. package/dist/esm/resources/members.d.ts +21 -1
  130. package/dist/esm/resources/members.d.ts.map +1 -1
  131. package/dist/esm/resources/members.js +15 -0
  132. package/dist/esm/resources/members.js.map +1 -1
  133. package/dist/esm/resources/operations.d.ts +179 -4
  134. package/dist/esm/resources/operations.d.ts.map +1 -1
  135. package/dist/esm/resources/operations.js +192 -2
  136. package/dist/esm/resources/operations.js.map +1 -1
  137. package/dist/esm/resources/registries.d.ts +19 -2
  138. package/dist/esm/resources/registries.d.ts.map +1 -1
  139. package/dist/esm/resources/registries.js +16 -0
  140. package/dist/esm/resources/registries.js.map +1 -1
  141. package/dist/esm/version.d.ts +1 -1
  142. package/dist/esm/version.js +1 -1
  143. package/docs/concepts.md +13 -11
  144. package/docs/errors.md +73 -5
  145. package/package.json +1 -1
  146. package/src/client.ts +40 -0
  147. package/src/core/gated.ts +12 -10
  148. package/src/core/http.ts +30 -1
  149. package/src/core/pagination.ts +11 -9
  150. package/src/generated/operations.ts +212 -4
  151. package/src/generated/types.ts +979 -95
  152. package/src/index.ts +15 -1
  153. package/src/resources/addresses.ts +102 -4
  154. package/src/resources/admin.ts +59 -0
  155. package/src/resources/approvals.ts +30 -2
  156. package/src/resources/balances.ts +14 -7
  157. package/src/resources/categories.ts +19 -5
  158. package/src/resources/counterparties.ts +59 -5
  159. package/src/resources/history.ts +238 -27
  160. package/src/resources/me.ts +22 -0
  161. package/src/resources/members.ts +30 -0
  162. package/src/resources/operations.ts +264 -5
  163. package/src/resources/registries.ts +26 -3
  164. package/src/version.ts +1 -1
@@ -60,6 +60,25 @@ export class MeResource {
60
60
  query: { ...params },
61
61
  });
62
62
  }
63
+ /**
64
+ * Where I am signed in: my live sessions — the phone, the web version, the
65
+ * Mac app, a browser — newest first, with `current` on the one making this
66
+ * request.
67
+ *
68
+ * Open to ANY session, a web or Mac one included, because it carries
69
+ * nothing worth stealing: no tokens, no IP addresses, no raw user agent.
70
+ * Read-only — ending another session is better-auth's own
71
+ * `/api/auth/revoke-session` and its neighbours, which a web or Mac
72
+ * session is refused; signing out of this session is always possible.
73
+ * Expired sessions are not listed, and neither are web or Mac ones older
74
+ * than 30 days from sign-in — their real ceiling, which is what
75
+ * `expiresAt` says for them.
76
+ */
77
+ sessions(params = {}) {
78
+ return this.#http.request('GET', '/api/v1/me/sessions', {
79
+ query: { ...params },
80
+ });
81
+ }
63
82
  registerPushToken(input) {
64
83
  return this.#http.request('POST', '/api/v1/me/push-tokens', { body: input });
65
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"me.js","sourceRoot":"","sources":["../../../src/resources/me.ts"],"names":[],"mappings":"AAUA,gFAAgF;AAChF,MAAM,OAAO,UAAU;IACZ,KAAK,CAAY;IAE1B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAc,KAAK,EAAE,oBAAoB,CAAC,CAAA;IACrE,CAAC;IAED;;;;;;;OAOG;IACH,aAAa,CAAC,KAAuB;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAc,OAAO,EAAE,oBAAoB,EAAE,EAAE,IAAI,EAA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C,KAAK,CAAC,OAAO,CAAc,OAAO,EAAE,oBAAoB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACxF,CAAC;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,KAAa;QACrB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,MAAM,EAAE,0BAA0B,EAAE;YAC/E,IAAI,EAAE,EAAE,KAAK,EAAE;SAChB,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAkB,KAAK,EAAE,kBAAkB,CAAC,CAAA;IACvE,CAAC;IAED;;;;;;;OAOG;IACH,eAAe,CAAC,MAA2C;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAA0B,KAAK,EAAE,6BAA6B,EAAE;YACvF,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE;SACrB,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,MAAM,GAAe,EAAE;QAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAgB,KAAK,EAAE,qBAAqB,EAAE;YACrE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE;SACrB,CAAC,CAAA;IACJ,CAAC;IAED,iBAAiB,CAAC,KAA4B;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAY,MAAM,EAAE,wBAAwB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACzF,CAAC;IAED,kFAAkF;IAClF,eAAe,CAAC,KAAa;QAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,QAAQ,EACR,0BAA0B,kBAAkB,CAAC,KAAK,CAAC,EAAE,CACtD,CAAA;IACH,CAAC;CACF"}
@@ -1,6 +1,13 @@
1
1
  import { type HttpClient } from '../core/http.js';
2
2
  import type { PageParams } from '../core/pagination.js';
3
- import type { MemberCard, MemberDetail, MembersPage, UserGroup, UserGroupDetail, UserGroupMembers } from '../generated/types.js';
3
+ import type { ActionType, MemberCard, MemberDetail, MembersPage, PolicyDirectoryPage, UserGroup, UserGroupDetail, UserGroupMembers } from '../generated/types.js';
4
+ export interface PolicyDirectoryParams extends PageParams {
5
+ actionType?: ActionType | undefined;
6
+ effect?: 'allow' | 'block' | undefined;
7
+ enabled?: boolean | undefined;
8
+ /** Only the policies of groups I belong to. Without it — every group's. */
9
+ mine?: boolean | undefined;
10
+ }
4
11
  /**
5
12
  * People in the vault, and the groups they belong to.
6
13
  *
@@ -48,6 +55,19 @@ export declare class MembersResource {
48
55
  * policies stays administrator-only.
49
56
  */
50
57
  group(groupId: string): Promise<UserGroupDetail>;
58
+ /**
59
+ * Every policy of the vault by name — code, name, look, `actionType`,
60
+ * `effect`, `enabled` and the group it hangs on — for a "decided by" label
61
+ * and the feed's `decisionPolicyId` filter. Open to any member, and it
62
+ * lists the policies of ALL groups, not only yours: rule names are not
63
+ * personal data and each group's detail already shows them.
64
+ *
65
+ * No rules, conditions, limits, thresholds or signers here — those stay
66
+ * with the administrator endpoints (`admin.policies`). The fields are the
67
+ * ones `group()` shows in `policies[]`, gathered into one list. Keyset
68
+ * paging, newest first.
69
+ */
70
+ policyDirectory(params?: PolicyDirectoryParams): Promise<PolicyDirectoryPage>;
51
71
  groupMembers(groupId: string): Promise<UserGroupMembers>;
52
72
  }
53
73
  //# sourceMappingURL=members.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../../src/resources/members.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,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,eAAe,EACf,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B;;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,SAAS,CAAA;IAC7B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC3B;AAED;;;;;;;GAOG;AACH,qBAAa,eAAe;;IAI1B,YAAY,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAG9C;IAED,IAAI,CAAC,MAAM,GAAE,UAAU,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAIxE;IAED,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAKzC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAM7C;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CAMpF;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAK/C;IAED;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,MAAM,GAAE,qBAA0B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAMhF;IAED,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAKvD;CACF"}
@@ -56,6 +56,21 @@ export class MembersResource {
56
56
  group(groupId) {
57
57
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/user-groups/${seg(groupId)}`);
58
58
  }
59
+ /**
60
+ * Every policy of the vault by name — code, name, look, `actionType`,
61
+ * `effect`, `enabled` and the group it hangs on — for a "decided by" label
62
+ * and the feed's `decisionPolicyId` filter. Open to any member, and it
63
+ * lists the policies of ALL groups, not only yours: rule names are not
64
+ * personal data and each group's detail already shows them.
65
+ *
66
+ * No rules, conditions, limits, thresholds or signers here — those stay
67
+ * with the administrator endpoints (`admin.policies`). The fields are the
68
+ * ones `group()` shows in `policies[]`, gathered into one list. Keyset
69
+ * paging, newest first.
70
+ */
71
+ policyDirectory(params = {}) {
72
+ return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/policy-directory`, { query: { ...params } });
73
+ }
59
74
  groupMembers(groupId) {
60
75
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/user-groups/${seg(groupId)}/members`);
61
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"members.js","sourceRoot":"","sources":["../../../src/resources/members.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AAWtD;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IACjB,KAAK,CAAY;IACjB,MAAM,CAAQ;IAEvB,YAAY,IAAgB,EAAE,SAAiB;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;IAED,IAAI,CAAC,MAAM,GAAqC,EAAE;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAc,KAAK,EAAE,kBAAkB,IAAI,CAAC,MAAM,UAAU,EAAE;YACrF,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE;SACrB,CAAC,CAAA;IACJ,CAAC;IAED,GAAG,CAAC,MAAc;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,EAAE,CACvD,CAAA;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,QAAgB;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,kBAAkB,EAC/C,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE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O,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,EAAE,CACvD,CAAA;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,QAAgB;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,kBAAkB,EAC/C,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,CACxB,CAAA;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,GAAoC,EAAE;QACjD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,cAAc,EAC3C,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CACzB,CAAA;IACH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAe;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,EAAE,CAC5D,CAAA;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,MAAM,GAA0B,EAAE;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,mBAAmB,EAChD,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CACzB,CAAA;IACH,CAAC;IAED,YAAY,CAAC,OAAe;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,UAAU,CACpE,CAAA;IACH,CAAC;CACF"}
@@ -1,6 +1,8 @@
1
- import { type HttpClient } from '../core/http.js';
1
+ import { type HttpClient, type RawBody } from '../core/http.js';
2
+ import { type Gated } from '../core/gated.js';
2
3
  import type { PageParams } from '../core/pagination.js';
3
- import type { ApprovalRelations, CreateOperationRelationBody, IncomingTransactionDetail, OperationMetadata, OperationRelation, OperationRelationsPage, OperationType, PatchOperationMetadataBody } from '../generated/types.js';
4
+ import type { ApprovalRelations, ApprovalRequestCreated, CreateOperationRelationBody, IncomingTransactionDetail, OperationAttachment, OperationAttachmentDeleted, OperationAttachmentsList, OperationCounterparty, OperationMetadata, OperationRelation, OperationRelationsPage, OperationType, PatchOperationMetadataBody } from '../generated/types.js';
5
+ import type { OperationRelationType } from './history.js';
4
6
  /**
5
7
  * Operation kind in a path. Exactly two values exist.
6
8
  *
@@ -13,7 +15,7 @@ import type { ApprovalRelations, CreateOperationRelationBody, IncomingTransactio
13
15
  */
14
16
  export type OperationKind = OperationType;
15
17
  export interface ListRelationsParams extends PageParams {
16
- relationType?: 'refund' | 'reversal' | 'correction' | 'replacement' | undefined;
18
+ relationType?: OperationRelationType | undefined;
17
19
  sourceOperationId?: string | undefined;
18
20
  targetOperationId?: string | undefined;
19
21
  /** Links that carry a partial amount in this token. */
@@ -26,6 +28,20 @@ export interface ListRelationsParams extends PageParams {
26
28
  from?: string | undefined;
27
29
  to?: string | undefined;
28
30
  }
31
+ /** A file to attach, sent as the raw request body. */
32
+ export type AttachmentFile = Exclude<RawBody, FormData>;
33
+ export interface UploadAttachmentOptions {
34
+ /**
35
+ * The file's name, for a raw body. Taken from a `File` when omitted; an
36
+ * `ArrayBuffer` or `Uint8Array` has none, and a raw upload without a name is
37
+ * 400 `ATTACHMENT_FILENAME_REQUIRED`. Not used with a `FormData`: there the
38
+ * name is the form's `filename` field, or the file part's own name.
39
+ */
40
+ filename?: string | undefined;
41
+ signal?: AbortSignal | undefined;
42
+ /** An upload can be large; the client's default timeout applies otherwise. */
43
+ timeoutMs?: number | undefined;
44
+ }
29
45
  /**
30
46
  * Everything hanging off a single operation: free-form metadata, links to
31
47
  * other operations, and how its status changed over time.
@@ -43,7 +59,24 @@ export declare class OperationsResource {
43
59
  * DEFAULT state, not an edge case. Check before reading fields.
44
60
  */
45
61
  metadata(kind: OperationKind, operationId: string): Promise<OperationMetadata | null>;
46
- setMetadata(kind: OperationKind, operationId: string, input: PatchOperationMetadataBody): Promise<OperationMetadata>;
62
+ /**
63
+ * A sent field replaces its value, `null` clears it, an absent one stays.
64
+ *
65
+ * Returns `Gated`. The metadata is a facade over the assignment of the
66
+ * system category `general`, and is written the way `categories` writes:
67
+ * a version per change, an optimistic lock, and the category's approval.
68
+ * By default `general` has none and the answer is `applied` (200), as it
69
+ * always was. If an administrator set its `approvalScope`, nothing is
70
+ * written: a request is created (`category_assign` / `category_edit`) and
71
+ * the answer is `pending` (202) with its card. An edit of ANOTHER field
72
+ * made concurrently is not lost — the patch is laid over the fresh version
73
+ * up to three times before 409 `ASSIGNMENT_STALE`.
74
+ *
75
+ * Writing takes the labelling right of `general`: by default `transfer` on
76
+ * the operation's address. Seeing the operation is not enough — a signer or
77
+ * an initiator without that right gets 404.
78
+ */
79
+ setMetadata(kind: OperationKind, operationId: string, input: PatchOperationMetadataBody): Promise<Gated<OperationMetadata, ApprovalRequestCreated>>;
47
80
  /** Other operations linked to this one. A plain array, not a page. */
48
81
  relations(kind: OperationKind, operationId: string): Promise<OperationRelation[]>;
49
82
  /**
@@ -76,7 +109,149 @@ export declare class OperationsResource {
76
109
  * `sourceOperationId` alone will miss half of its links.
77
110
  */
78
111
  listRelations(params?: ListRelationsParams): Promise<OperationRelationsPage>;
112
+ /**
113
+ * Links two operations. DIRECTION: `source` is the DERIVED operation (the
114
+ * refund, reversal, correction or replacement itself), `target` the
115
+ * ORIGINAL it refers to — a deposit refunded by a transfer is source =
116
+ * transfer, target = deposit. Both must be in this vault, with `transfer`
117
+ * on the addresses of BOTH; otherwise 404 `OPERATION_NOT_FOUND`, as if
118
+ * missing.
119
+ *
120
+ * Idempotent, and not wrapped in `Gated`: a relation is unique by (type,
121
+ * source, target), and repeating the same body answers 200 with the
122
+ * existing relation where a new one answers 201 — both mean "this relation
123
+ * now exists, exactly as asked". The same triple with another amount, token
124
+ * or comment is 409 `OPERATION_RELATION_EXISTS`, the existing id in
125
+ * `details.relationId`. To change a relation, delete it and create it
126
+ * again.
127
+ *
128
+ * `relatedAmountRaw` only together with `tokenId`: a token of at least one
129
+ * of the two operations, an amount above zero and no larger than either
130
+ * side's amount in that token — otherwise 422 `OPERATION_RELATION_INVALID`,
131
+ * the field in `details.field`.
132
+ */
79
133
  createRelation(input: CreateOperationRelationBody): Promise<OperationRelation>;
134
+ /**
135
+ * Removes a relation — physically: a relation has no version history, so
136
+ * reports read the current state and report snapshots stay as they were.
137
+ *
138
+ * Its creator or an administrator. The creator needs what creating took —
139
+ * `transfer` on the addresses of BOTH operations, now; otherwise 403
140
+ * `OPERATION_RELATION_FORBIDDEN`. Someone else's relation is 403
141
+ * `NOT_RELATION_CREATOR`. A relation neither side of which you can see,
142
+ * like one already removed, is 404 `OPERATION_RELATION_NOT_FOUND`.
143
+ */
144
+ deleteRelation(relationId: string): Promise<{
145
+ deleted: true;
146
+ }>;
147
+ /**
148
+ * Picks the counterparty of a transfer or a deposit by hand, correcting a
149
+ * wrong or missing automatic match: `counterpartySource` becomes `manual`.
150
+ * `null` is a choice too — "this operation has no counterparty".
151
+ *
152
+ * The choice is written where the automatic match is, so the feed, the
153
+ * cards, the counterparty's counters and reports see it at once. Neither
154
+ * the automatic match nor the retro-match on adding an address overwrites
155
+ * it; `resetCounterparty()` hands the operation back to them. Repeating the
156
+ * same value writes nothing and answers the current state.
157
+ *
158
+ * Only a counterparty of this vault that is not archived: 404
159
+ * `COUNTERPARTY_NOT_FOUND` (someone else's and a missing one alike), 409
160
+ * `COUNTERPARTY_ARCHIVED`. A transfer awaiting signatures is 409
161
+ * `OPERATION_AWAITING_APPROVAL` — its signers see the counterparty matched
162
+ * by the recipient's address, and a manual choice then would let them sign
163
+ * a stranger's address under a trusted name. The policy decision never
164
+ * depends on this choice; it was taken by address at creation.
165
+ *
166
+ * Takes the right to write the operation's metadata: `transfer` on its
167
+ * address. Seeing it is not enough — anyone else gets 404
168
+ * `OPERATION_NOT_FOUND`.
169
+ */
170
+ setCounterparty(kind: OperationKind, operationId: string, counterpartyId: string | null): Promise<OperationCounterparty>;
171
+ /**
172
+ * Drops the manual choice and matches the operation again AT ONCE — by the
173
+ * other side's address (the recipient of a transfer, the sender of a
174
+ * deposit) against the directory as it is NOW, by the rule used at
175
+ * creation (an archived counterparty does not match). The result can
176
+ * differ from what was there before the manual choice if the directory has
177
+ * changed since.
178
+ *
179
+ * On an operation that is already automatic nothing is written and the
180
+ * current state comes back, so a repeat is safe. Afterwards
181
+ * `counterpartySource` is `auto` and `counterpartySetById`/`At` say who
182
+ * reset it and when. Same rights and the same 409
183
+ * `OPERATION_AWAITING_APPROVAL` as `setCounterparty()`.
184
+ */
185
+ resetCounterparty(kind: OperationKind, operationId: string): Promise<OperationCounterparty>;
186
+ /**
187
+ * Files attached to an operation (invoices, acts, screenshots) — metadata,
188
+ * in upload order; the bytes are fetched with `downloadAttachment()`. At
189
+ * most 20 per operation, so there is no cursor. Removed ones are not
190
+ * listed.
191
+ *
192
+ * Seen by whoever sees the operation: for a transfer an administrator, its
193
+ * initiator, a signer from the request's snapshot, or `view` on the sending
194
+ * address; for a deposit `view` on the receiving address. Anyone else gets
195
+ * 404 `OPERATION_NOT_FOUND`. A server without attachment storage answers
196
+ * 501 `ATTACHMENTS_DISABLED` on every attachment call — hide the feature
197
+ * then.
198
+ */
199
+ attachments(kind: OperationKind, operationId: string): Promise<OperationAttachmentsList>;
200
+ /**
201
+ * Attaches a file. Two forms, chosen by what you pass:
202
+ *
203
+ * • a `Blob`/`File`, an `ArrayBuffer` or a `Uint8Array` goes as the raw
204
+ * body (`application/octet-stream`, the name in `?filename=`), streamed
205
+ * to storage, up to 10 MB. `fetch` sets `Content-Length` itself, which
206
+ * the API requires (411 `ATTACHMENT_LENGTH_REQUIRED` without it);
207
+ * • a `FormData` goes as `multipart/form-data` exactly as built: the file
208
+ * in the field `file`, the name in the field `filename` or the part's
209
+ * own. Parsed in memory, so up to 5 MB. This is the form React Native
210
+ * sends a file from a `uri` with.
211
+ *
212
+ * The type is decided by the BYTES, never by a header: PDF, PNG, JPEG and
213
+ * WebP only — anything else (SVG and HTML included) is 415
214
+ * `ATTACHMENT_TYPE_NOT_ALLOWED`. The name is cleaned and its extension made
215
+ * to match the type; read the stored one from the answer. Over the size
216
+ * limit is 413 `ATTACHMENT_TOO_LARGE`; over 20 files on the operation, 409
217
+ * `ATTACHMENT_LIMIT_REACHED`; over the vault's quota (1 GB of live files by
218
+ * default), 409 `ATTACHMENT_QUOTA_EXCEEDED` with `details.quotaBytes` and
219
+ * `details.usedBytes`.
220
+ *
221
+ * Uploading takes `transfer` on the operation's address, as labelling does;
222
+ * a signer, an initiator whose grant was revoked and a view-only grant get
223
+ * 404. From a browser, a page of a site the API does not trust is refused
224
+ * with 403 `CROSS_SITE_REQUEST_REFUSED`, as every changing request is.
225
+ */
226
+ uploadAttachment(kind: OperationKind, operationId: string, file: AttachmentFile | FormData, options?: UploadAttachmentOptions): Promise<OperationAttachment>;
227
+ /**
228
+ * The file itself, as the untouched `Response`: read it with `.blob()` or
229
+ * `.arrayBuffer()`. `Content-Type` is the type detected at upload, and
230
+ * `Content-Disposition: attachment` carries the cleaned name. The same
231
+ * path is the attachment's `downloadPath`, relative to the API base.
232
+ *
233
+ * Who may read it is checked on every request, so a revoked access closes a
234
+ * cached copy too: the API answers with `ETag` = the file's SHA-256 and
235
+ * `Cache-Control: private, max-age=0, must-revalidate`. Do not send
236
+ * `If-None-Match` yourself — a 304 has no body and the transport reports it
237
+ * as an error; the browser's own revalidation is transparent. A file
238
+ * missing from storage is 502 `ATTACHMENT_STORAGE_UNAVAILABLE`.
239
+ */
240
+ downloadAttachment(kind: OperationKind, operationId: string, attachmentId: string, options?: {
241
+ signal?: AbortSignal | undefined;
242
+ }): Promise<Response>;
243
+ /**
244
+ * Removes an attachment: its uploader, while they still hold `transfer` on
245
+ * the operation's address, or an administrator — anyone else who sees the
246
+ * operation gets 403 `ATTACHMENT_DELETE_FORBIDDEN`. Soft: the file leaves
247
+ * the list and is no longer served, its bytes are erased, and the record
248
+ * stays as an audit trail. Repeating it answers the same.
249
+ *
250
+ * 502 `ATTACHMENT_STORAGE_UNAVAILABLE` with `details.deleted: true` means
251
+ * the attachment is already hidden but storage kept the bytes; repeat the
252
+ * call to clean them up.
253
+ */
254
+ deleteAttachment(kind: OperationKind, operationId: string, attachmentId: string): Promise<OperationAttachmentDeleted>;
80
255
  /**
81
256
  * An incoming payment in detail.
82
257
  *
@@ -1 +1 @@
1
- {"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/resources/operations.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,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,EACb,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,CAAA;AAEzC,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,YAAY,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,CAAA;IAC/E,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACxB;AAED;;;;;;;;GAQG;AACH,qB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AA;KAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAM9E;CACF"}
@@ -1,4 +1,5 @@
1
1
  import { seg } from '../core/http.js';
2
+ import { toGated } from '../core/gated.js';
2
3
  /**
3
4
  * Everything hanging off a single operation: free-form metadata, links to
4
5
  * other operations, and how its status changed over time.
@@ -25,8 +26,26 @@ export class OperationsResource {
25
26
  metadata(kind, operationId) {
26
27
  return this.#http.request('GET', `${this.#op(kind, operationId)}/metadata`);
27
28
  }
28
- setMetadata(kind, operationId, input) {
29
- return this.#http.request('PATCH', `${this.#op(kind, operationId)}/metadata`, { body: input });
29
+ /**
30
+ * A sent field replaces its value, `null` clears it, an absent one stays.
31
+ *
32
+ * Returns `Gated`. The metadata is a facade over the assignment of the
33
+ * system category `general`, and is written the way `categories` writes:
34
+ * a version per change, an optimistic lock, and the category's approval.
35
+ * By default `general` has none and the answer is `applied` (200), as it
36
+ * always was. If an administrator set its `approvalScope`, nothing is
37
+ * written: a request is created (`category_assign` / `category_edit`) and
38
+ * the answer is `pending` (202) with its card. An edit of ANOTHER field
39
+ * made concurrently is not lost — the patch is laid over the fresh version
40
+ * up to three times before 409 `ASSIGNMENT_STALE`.
41
+ *
42
+ * Writing takes the labelling right of `general`: by default `transfer` on
43
+ * the operation's address. Seeing the operation is not enough — a signer or
44
+ * an initiator without that right gets 404.
45
+ */
46
+ async setMetadata(kind, operationId, input) {
47
+ const res = await this.#http.requestRaw('PATCH', `${this.#op(kind, operationId)}/metadata`, { body: input });
48
+ return toGated(res.status, res.data);
30
49
  }
31
50
  /** Other operations linked to this one. A plain array, not a page. */
32
51
  relations(kind, operationId) {
@@ -57,9 +76,171 @@ export class OperationsResource {
57
76
  listRelations(params = {}) {
58
77
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/operation-relations`, { query: { ...params } });
59
78
  }
79
+ /**
80
+ * Links two operations. DIRECTION: `source` is the DERIVED operation (the
81
+ * refund, reversal, correction or replacement itself), `target` the
82
+ * ORIGINAL it refers to — a deposit refunded by a transfer is source =
83
+ * transfer, target = deposit. Both must be in this vault, with `transfer`
84
+ * on the addresses of BOTH; otherwise 404 `OPERATION_NOT_FOUND`, as if
85
+ * missing.
86
+ *
87
+ * Idempotent, and not wrapped in `Gated`: a relation is unique by (type,
88
+ * source, target), and repeating the same body answers 200 with the
89
+ * existing relation where a new one answers 201 — both mean "this relation
90
+ * now exists, exactly as asked". The same triple with another amount, token
91
+ * or comment is 409 `OPERATION_RELATION_EXISTS`, the existing id in
92
+ * `details.relationId`. To change a relation, delete it and create it
93
+ * again.
94
+ *
95
+ * `relatedAmountRaw` only together with `tokenId`: a token of at least one
96
+ * of the two operations, an amount above zero and no larger than either
97
+ * side's amount in that token — otherwise 422 `OPERATION_RELATION_INVALID`,
98
+ * the field in `details.field`.
99
+ */
60
100
  createRelation(input) {
61
101
  return this.#http.request('POST', `/api/v1/vaults/${this.#vault}/operation-relations`, { body: input });
62
102
  }
103
+ /**
104
+ * Removes a relation — physically: a relation has no version history, so
105
+ * reports read the current state and report snapshots stay as they were.
106
+ *
107
+ * Its creator or an administrator. The creator needs what creating took —
108
+ * `transfer` on the addresses of BOTH operations, now; otherwise 403
109
+ * `OPERATION_RELATION_FORBIDDEN`. Someone else's relation is 403
110
+ * `NOT_RELATION_CREATOR`. A relation neither side of which you can see,
111
+ * like one already removed, is 404 `OPERATION_RELATION_NOT_FOUND`.
112
+ */
113
+ deleteRelation(relationId) {
114
+ return this.#http.request('DELETE', `/api/v1/vaults/${this.#vault}/operation-relations/${seg(relationId)}`);
115
+ }
116
+ /**
117
+ * Picks the counterparty of a transfer or a deposit by hand, correcting a
118
+ * wrong or missing automatic match: `counterpartySource` becomes `manual`.
119
+ * `null` is a choice too — "this operation has no counterparty".
120
+ *
121
+ * The choice is written where the automatic match is, so the feed, the
122
+ * cards, the counterparty's counters and reports see it at once. Neither
123
+ * the automatic match nor the retro-match on adding an address overwrites
124
+ * it; `resetCounterparty()` hands the operation back to them. Repeating the
125
+ * same value writes nothing and answers the current state.
126
+ *
127
+ * Only a counterparty of this vault that is not archived: 404
128
+ * `COUNTERPARTY_NOT_FOUND` (someone else's and a missing one alike), 409
129
+ * `COUNTERPARTY_ARCHIVED`. A transfer awaiting signatures is 409
130
+ * `OPERATION_AWAITING_APPROVAL` — its signers see the counterparty matched
131
+ * by the recipient's address, and a manual choice then would let them sign
132
+ * a stranger's address under a trusted name. The policy decision never
133
+ * depends on this choice; it was taken by address at creation.
134
+ *
135
+ * Takes the right to write the operation's metadata: `transfer` on its
136
+ * address. Seeing it is not enough — anyone else gets 404
137
+ * `OPERATION_NOT_FOUND`.
138
+ */
139
+ setCounterparty(kind, operationId, counterpartyId) {
140
+ return this.#http.request('PUT', `${this.#op(kind, operationId)}/counterparty`, { body: { counterpartyId } });
141
+ }
142
+ /**
143
+ * Drops the manual choice and matches the operation again AT ONCE — by the
144
+ * other side's address (the recipient of a transfer, the sender of a
145
+ * deposit) against the directory as it is NOW, by the rule used at
146
+ * creation (an archived counterparty does not match). The result can
147
+ * differ from what was there before the manual choice if the directory has
148
+ * changed since.
149
+ *
150
+ * On an operation that is already automatic nothing is written and the
151
+ * current state comes back, so a repeat is safe. Afterwards
152
+ * `counterpartySource` is `auto` and `counterpartySetById`/`At` say who
153
+ * reset it and when. Same rights and the same 409
154
+ * `OPERATION_AWAITING_APPROVAL` as `setCounterparty()`.
155
+ */
156
+ resetCounterparty(kind, operationId) {
157
+ return this.#http.request('DELETE', `${this.#op(kind, operationId)}/counterparty`);
158
+ }
159
+ /**
160
+ * Files attached to an operation (invoices, acts, screenshots) — metadata,
161
+ * in upload order; the bytes are fetched with `downloadAttachment()`. At
162
+ * most 20 per operation, so there is no cursor. Removed ones are not
163
+ * listed.
164
+ *
165
+ * Seen by whoever sees the operation: for a transfer an administrator, its
166
+ * initiator, a signer from the request's snapshot, or `view` on the sending
167
+ * address; for a deposit `view` on the receiving address. Anyone else gets
168
+ * 404 `OPERATION_NOT_FOUND`. A server without attachment storage answers
169
+ * 501 `ATTACHMENTS_DISABLED` on every attachment call — hide the feature
170
+ * then.
171
+ */
172
+ attachments(kind, operationId) {
173
+ return this.#http.request('GET', `${this.#op(kind, operationId)}/attachments`);
174
+ }
175
+ /**
176
+ * Attaches a file. Two forms, chosen by what you pass:
177
+ *
178
+ * • a `Blob`/`File`, an `ArrayBuffer` or a `Uint8Array` goes as the raw
179
+ * body (`application/octet-stream`, the name in `?filename=`), streamed
180
+ * to storage, up to 10 MB. `fetch` sets `Content-Length` itself, which
181
+ * the API requires (411 `ATTACHMENT_LENGTH_REQUIRED` without it);
182
+ * • a `FormData` goes as `multipart/form-data` exactly as built: the file
183
+ * in the field `file`, the name in the field `filename` or the part's
184
+ * own. Parsed in memory, so up to 5 MB. This is the form React Native
185
+ * sends a file from a `uri` with.
186
+ *
187
+ * The type is decided by the BYTES, never by a header: PDF, PNG, JPEG and
188
+ * WebP only — anything else (SVG and HTML included) is 415
189
+ * `ATTACHMENT_TYPE_NOT_ALLOWED`. The name is cleaned and its extension made
190
+ * to match the type; read the stored one from the answer. Over the size
191
+ * limit is 413 `ATTACHMENT_TOO_LARGE`; over 20 files on the operation, 409
192
+ * `ATTACHMENT_LIMIT_REACHED`; over the vault's quota (1 GB of live files by
193
+ * default), 409 `ATTACHMENT_QUOTA_EXCEEDED` with `details.quotaBytes` and
194
+ * `details.usedBytes`.
195
+ *
196
+ * Uploading takes `transfer` on the operation's address, as labelling does;
197
+ * a signer, an initiator whose grant was revoked and a view-only grant get
198
+ * 404. From a browser, a page of a site the API does not trust is refused
199
+ * with 403 `CROSS_SITE_REQUEST_REFUSED`, as every changing request is.
200
+ */
201
+ uploadAttachment(kind, operationId, file, options = {}) {
202
+ const path = `${this.#op(kind, operationId)}/attachments`;
203
+ const control = { signal: options.signal, timeoutMs: options.timeoutMs };
204
+ if (isFormData(file)) {
205
+ return this.#http.request('POST', path, { ...control, rawBody: file });
206
+ }
207
+ return this.#http.request('POST', path, {
208
+ ...control,
209
+ rawBody: file,
210
+ contentType: 'application/octet-stream',
211
+ query: { filename: options.filename ?? fileName(file) },
212
+ });
213
+ }
214
+ /**
215
+ * The file itself, as the untouched `Response`: read it with `.blob()` or
216
+ * `.arrayBuffer()`. `Content-Type` is the type detected at upload, and
217
+ * `Content-Disposition: attachment` carries the cleaned name. The same
218
+ * path is the attachment's `downloadPath`, relative to the API base.
219
+ *
220
+ * Who may read it is checked on every request, so a revoked access closes a
221
+ * cached copy too: the API answers with `ETag` = the file's SHA-256 and
222
+ * `Cache-Control: private, max-age=0, must-revalidate`. Do not send
223
+ * `If-None-Match` yourself — a 304 has no body and the transport reports it
224
+ * as an error; the browser's own revalidation is transparent. A file
225
+ * missing from storage is 502 `ATTACHMENT_STORAGE_UNAVAILABLE`.
226
+ */
227
+ downloadAttachment(kind, operationId, attachmentId, options = {}) {
228
+ return this.#http.fetchRaw('GET', `${this.#op(kind, operationId)}/attachments/${seg(attachmentId)}/content`, { signal: options.signal });
229
+ }
230
+ /**
231
+ * Removes an attachment: its uploader, while they still hold `transfer` on
232
+ * the operation's address, or an administrator — anyone else who sees the
233
+ * operation gets 403 `ATTACHMENT_DELETE_FORBIDDEN`. Soft: the file leaves
234
+ * the list and is no longer served, its bytes are erased, and the record
235
+ * stays as an audit trail. Repeating it answers the same.
236
+ *
237
+ * 502 `ATTACHMENT_STORAGE_UNAVAILABLE` with `details.deleted: true` means
238
+ * the attachment is already hidden but storage kept the bytes; repeat the
239
+ * call to clean them up.
240
+ */
241
+ deleteAttachment(kind, operationId, attachmentId) {
242
+ return this.#http.request('DELETE', `${this.#op(kind, operationId)}/attachments/${seg(attachmentId)}`);
243
+ }
63
244
  /**
64
245
  * An incoming payment in detail.
65
246
  *
@@ -87,4 +268,13 @@ export class OperationsResource {
87
268
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/approval-relations`, { query: { ...params } });
88
269
  }
89
270
  }
271
+ /** `instanceof` alone fails where the global is missing (older Node) — guard it. */
272
+ function isFormData(value) {
273
+ return typeof FormData !== 'undefined' && value instanceof FormData;
274
+ }
275
+ /** The name a `File` carries; a bare `Blob` or buffer has none. */
276
+ function fileName(file) {
277
+ const name = file.name;
278
+ return typeof name === 'string' && name !== '' ? name : undefined;
279
+ }
90
280
  //# sourceMappingURL=operations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/resources/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,iBAAiB,CAAA;AAwCtD;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IACpB,KAAK,CAAY;IACjB,MAAM,CAAQ;IAEvB,YAAY,IAAgB,EAAE,SAAiB;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;IAED,GAAG,CAAC,IAAmB,EAAE,WAAmB;QAC1C,OAAO,kBAAkB,IAAI,CAAC,MAAM,eAAe,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,WAAW,CAAC,EAAE,CAAA;IACpF,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,IAAmB,EAAE,WAAmB;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,WAAW,CAC1C,CAAA;IACH,CAAC;IAED,WAAW,CACT,IAAmB,EACnB,WAAmB,EACnB,KAAiC;QAEjC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,OAAO,EACP,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,WAAW,EACzC,EAAE,IAAI,EAAE,KAAK,EAAE,CAChB,CAAA;IACH,CAAC;IAED,sEAAsE;IACtE,SAAS,CAAC,IAAmB,EAAE,WAAmB;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,CAC3C,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,aAAa,CACX,IAAmB,EACnB,WAAmB;QAWnB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAA;IACnF,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,MAAM,GAAwB,EAAE;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,sBAAsB,EACnD,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CACzB,CAAA;IACH,CAAC;IAED,cAAc,CAAC,KAAkC;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,MAAM,EACN,kBAAkB,IAAI,CAAC,MAAM,sBAAsB,EACnD,EAAE,IAAI,EAAE,KAAK,EAAE,CAChB,CAAA;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,SAAiB;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,CAAC,EAAE,CAC3D,CAAA;IACH,CAAC;IAED;;;;;;;OAOG;IACH,iBAAiB,CAAC,MAAM,GAAwB,EAAE;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CACvB,KAAK,EACL,kBAAkB,IAAI,CAAC,MAAM,qBAAqB,EAClD,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CACzB,CAAA;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/resources/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAiC,MAAM,iBAAiB,CAAA;A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CreateNetworkBody, CreateTokenBody, EvaluationRequest, EvaluationResult, Network, PatchNetworkBody, PatchTokenBody, RatesResponse, TokenWithNetwork } from '../generated/types.js';
2
+ import type { AmlValue, CreateNetworkBody, CreateTokenBody, EvaluationRequest, EvaluationResult, FiatCurrency, Network, PatchNetworkBody, PatchTokenBody, RatesResponse, RegistryNetwork, TokenWithNetwork } from '../generated/types.js';
3
3
  /**
4
4
  * The AML risk of one address, as `amlScore` returns it.
5
5
  *
@@ -45,7 +45,13 @@ export interface AmlScore {
45
45
  export declare class RegistriesResource {
46
46
  #private;
47
47
  constructor(http: HttpClient);
48
- networks(): Promise<Network[]>;
48
+ /**
49
+ * Every registered network. Each carries `logoPath`: load the logo through
50
+ * the API with `CoreClient.logo(logoPath)` rather than from `logoUri`, or
51
+ * the image's host sees the client's IP.
52
+ */
53
+ networks(): Promise<RegistryNetwork[]>;
54
+ /** Tokens, with `logoPath` — see `networks()` on why to load it, not `logoUri`. */
49
55
  tokens(params?: {
50
56
  network?: string;
51
57
  enabled?: boolean;
@@ -61,9 +67,20 @@ export declare class RegistriesResource {
61
67
  * Rates are fetched live on every call and NOT cached, so this is the
62
68
  * "right now" figure. The rate stored on an operation is a separate thing:
63
69
  * a snapshot taken when it was created.
70
+ *
71
+ * `base` adds rates in a fiat currency: `fx.rate` is how much of `base` one
72
+ * USD costs, and each `rates[].rate` is `base` per token (`usdRate` ×
73
+ * `fx.rate`). The conversion goes THROUGH THE DOLLAR, at the Bank of
74
+ * Russia's official rate for the date (`fx.asOf`; unchanged over weekends) —
75
+ * fit for valuation, not for settlement; the server keeps that table for up
76
+ * to an hour. When the currency source is down, `fx` is `null` and every
77
+ * `rates[].rate` is `null`, still with 200. Without `base` the answer is the
78
+ * old one: `base: 'USD'` and neither `fx` nor `rate` keys at all — so pass
79
+ * `base: 'USD'` explicitly if you want `rate` filled in USD.
64
80
  */
65
81
  rates(params?: {
66
82
  codes?: string | readonly string[] | undefined;
83
+ base?: FiatCurrency | undefined;
67
84
  }): Promise<RatesResponse>;
68
85
  /**
69
86
  * Asks the policy engine what would happen, without doing it.
@@ -1 +1 @@
1
- {"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../../src/resources/registries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAE9B;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAA;IACf,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAA;IAC3B,iFAAiF;IACjF,UAAU,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAClD,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;IACtC,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,mFAAmF;IACnF,SAAS,EAAE,MAAM,CAAA;IACjB,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,qBAAa,kBAAkB;;IAG7B,YAAY,IAAI,EAAE,UAAU,EAE3B;IAED,QAAQ,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAE7B;IAED,MAAM,CAAC,MAAM,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAExF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