@v3finance/core-sdk 0.4.0 → 0.6.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 (175) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/README.md +18 -14
  3. package/dist/cjs/client.d.ts +30 -34
  4. package/dist/cjs/client.d.ts.map +1 -1
  5. package/dist/cjs/client.js +71 -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 +250 -2
  20. package/dist/cjs/generated/operations.d.ts.map +1 -1
  21. package/dist/cjs/generated/operations.js +252 -4
  22. package/dist/cjs/generated/operations.js.map +1 -1
  23. package/dist/cjs/generated/types.d.ts +1137 -113
  24. package/dist/cjs/generated/types.d.ts.map +1 -1
  25. package/dist/cjs/index.d.ts +7 -6
  26. package/dist/cjs/index.d.ts.map +1 -1
  27. package/dist/cjs/index.js +3 -1
  28. package/dist/cjs/index.js.map +1 -1
  29. package/dist/cjs/resources/addresses.d.ts +91 -4
  30. package/dist/cjs/resources/addresses.d.ts.map +1 -1
  31. package/dist/cjs/resources/addresses.js +55 -3
  32. package/dist/cjs/resources/addresses.js.map +1 -1
  33. package/dist/cjs/resources/admin.d.ts +32 -1
  34. package/dist/cjs/resources/admin.d.ts.map +1 -1
  35. package/dist/cjs/resources/admin.js +45 -0
  36. package/dist/cjs/resources/admin.js.map +1 -1
  37. package/dist/cjs/resources/aml.d.ts +56 -0
  38. package/dist/cjs/resources/aml.d.ts.map +1 -0
  39. package/dist/cjs/resources/aml.js +71 -0
  40. package/dist/cjs/resources/aml.js.map +1 -0
  41. package/dist/cjs/resources/approvals.d.ts +30 -2
  42. package/dist/cjs/resources/approvals.d.ts.map +1 -1
  43. package/dist/cjs/resources/approvals.js.map +1 -1
  44. package/dist/cjs/resources/balances.d.ts +14 -7
  45. package/dist/cjs/resources/balances.d.ts.map +1 -1
  46. package/dist/cjs/resources/balances.js +10 -4
  47. package/dist/cjs/resources/balances.js.map +1 -1
  48. package/dist/cjs/resources/categories.d.ts +20 -6
  49. package/dist/cjs/resources/categories.d.ts.map +1 -1
  50. package/dist/cjs/resources/categories.js +19 -7
  51. package/dist/cjs/resources/categories.js.map +1 -1
  52. package/dist/cjs/resources/counterparties.d.ts +52 -6
  53. package/dist/cjs/resources/counterparties.d.ts.map +1 -1
  54. package/dist/cjs/resources/counterparties.js +24 -0
  55. package/dist/cjs/resources/counterparties.js.map +1 -1
  56. package/dist/cjs/resources/history.d.ts +227 -26
  57. package/dist/cjs/resources/history.d.ts.map +1 -1
  58. package/dist/cjs/resources/history.js +46 -0
  59. package/dist/cjs/resources/history.js.map +1 -1
  60. package/dist/cjs/resources/me.d.ts +17 -1
  61. package/dist/cjs/resources/me.d.ts.map +1 -1
  62. package/dist/cjs/resources/me.js +19 -0
  63. package/dist/cjs/resources/me.js.map +1 -1
  64. package/dist/cjs/resources/members.d.ts +21 -1
  65. package/dist/cjs/resources/members.d.ts.map +1 -1
  66. package/dist/cjs/resources/members.js +15 -0
  67. package/dist/cjs/resources/members.js.map +1 -1
  68. package/dist/cjs/resources/operations.d.ts +179 -4
  69. package/dist/cjs/resources/operations.d.ts.map +1 -1
  70. package/dist/cjs/resources/operations.js +192 -2
  71. package/dist/cjs/resources/operations.js.map +1 -1
  72. package/dist/cjs/resources/registries.d.ts +28 -2
  73. package/dist/cjs/resources/registries.d.ts.map +1 -1
  74. package/dist/cjs/resources/registries.js +27 -0
  75. package/dist/cjs/resources/registries.js.map +1 -1
  76. package/dist/cjs/version.d.ts +1 -1
  77. package/dist/cjs/version.js +1 -1
  78. package/dist/esm/client.d.ts +30 -34
  79. package/dist/esm/client.d.ts.map +1 -1
  80. package/dist/esm/client.js +71 -0
  81. package/dist/esm/client.js.map +1 -1
  82. package/dist/esm/core/gated.d.ts +12 -10
  83. package/dist/esm/core/gated.d.ts.map +1 -1
  84. package/dist/esm/core/gated.js +12 -10
  85. package/dist/esm/core/gated.js.map +1 -1
  86. package/dist/esm/core/http.d.ts +18 -0
  87. package/dist/esm/core/http.d.ts.map +1 -1
  88. package/dist/esm/core/http.js +11 -1
  89. package/dist/esm/core/http.js.map +1 -1
  90. package/dist/esm/core/pagination.d.ts +11 -9
  91. package/dist/esm/core/pagination.d.ts.map +1 -1
  92. package/dist/esm/core/pagination.js +11 -9
  93. package/dist/esm/core/pagination.js.map +1 -1
  94. package/dist/esm/generated/operations.d.ts +250 -2
  95. package/dist/esm/generated/operations.d.ts.map +1 -1
  96. package/dist/esm/generated/operations.js +252 -4
  97. package/dist/esm/generated/operations.js.map +1 -1
  98. package/dist/esm/generated/types.d.ts +1137 -113
  99. package/dist/esm/generated/types.d.ts.map +1 -1
  100. package/dist/esm/index.d.ts +7 -6
  101. package/dist/esm/index.d.ts.map +1 -1
  102. package/dist/esm/index.js +1 -0
  103. package/dist/esm/index.js.map +1 -1
  104. package/dist/esm/resources/addresses.d.ts +91 -4
  105. package/dist/esm/resources/addresses.d.ts.map +1 -1
  106. package/dist/esm/resources/addresses.js +55 -3
  107. package/dist/esm/resources/addresses.js.map +1 -1
  108. package/dist/esm/resources/admin.d.ts +32 -1
  109. package/dist/esm/resources/admin.d.ts.map +1 -1
  110. package/dist/esm/resources/admin.js +45 -0
  111. package/dist/esm/resources/admin.js.map +1 -1
  112. package/dist/esm/resources/aml.d.ts +56 -0
  113. package/dist/esm/resources/aml.d.ts.map +1 -0
  114. package/dist/esm/resources/aml.js +67 -0
  115. package/dist/esm/resources/aml.js.map +1 -0
  116. package/dist/esm/resources/approvals.d.ts +30 -2
  117. package/dist/esm/resources/approvals.d.ts.map +1 -1
  118. package/dist/esm/resources/approvals.js.map +1 -1
  119. package/dist/esm/resources/balances.d.ts +14 -7
  120. package/dist/esm/resources/balances.d.ts.map +1 -1
  121. package/dist/esm/resources/balances.js +10 -4
  122. package/dist/esm/resources/balances.js.map +1 -1
  123. package/dist/esm/resources/categories.d.ts +20 -6
  124. package/dist/esm/resources/categories.d.ts.map +1 -1
  125. package/dist/esm/resources/categories.js +19 -7
  126. package/dist/esm/resources/categories.js.map +1 -1
  127. package/dist/esm/resources/counterparties.d.ts +52 -6
  128. package/dist/esm/resources/counterparties.d.ts.map +1 -1
  129. package/dist/esm/resources/counterparties.js +24 -0
  130. package/dist/esm/resources/counterparties.js.map +1 -1
  131. package/dist/esm/resources/history.d.ts +227 -26
  132. package/dist/esm/resources/history.d.ts.map +1 -1
  133. package/dist/esm/resources/history.js +46 -0
  134. package/dist/esm/resources/history.js.map +1 -1
  135. package/dist/esm/resources/me.d.ts +17 -1
  136. package/dist/esm/resources/me.d.ts.map +1 -1
  137. package/dist/esm/resources/me.js +19 -0
  138. package/dist/esm/resources/me.js.map +1 -1
  139. package/dist/esm/resources/members.d.ts +21 -1
  140. package/dist/esm/resources/members.d.ts.map +1 -1
  141. package/dist/esm/resources/members.js +15 -0
  142. package/dist/esm/resources/members.js.map +1 -1
  143. package/dist/esm/resources/operations.d.ts +179 -4
  144. package/dist/esm/resources/operations.d.ts.map +1 -1
  145. package/dist/esm/resources/operations.js +192 -2
  146. package/dist/esm/resources/operations.js.map +1 -1
  147. package/dist/esm/resources/registries.d.ts +28 -2
  148. package/dist/esm/resources/registries.d.ts.map +1 -1
  149. package/dist/esm/resources/registries.js +27 -0
  150. package/dist/esm/resources/registries.js.map +1 -1
  151. package/dist/esm/version.d.ts +1 -1
  152. package/dist/esm/version.js +1 -1
  153. package/docs/concepts.md +13 -11
  154. package/docs/errors.md +76 -5
  155. package/package.json +1 -1
  156. package/src/client.ts +44 -0
  157. package/src/core/gated.ts +12 -10
  158. package/src/core/http.ts +30 -1
  159. package/src/core/pagination.ts +11 -9
  160. package/src/generated/operations.ts +252 -4
  161. package/src/generated/types.ts +1173 -95
  162. package/src/index.ts +16 -1
  163. package/src/resources/addresses.ts +102 -4
  164. package/src/resources/admin.ts +59 -0
  165. package/src/resources/aml.ts +76 -0
  166. package/src/resources/approvals.ts +30 -2
  167. package/src/resources/balances.ts +14 -7
  168. package/src/resources/categories.ts +19 -5
  169. package/src/resources/counterparties.ts +59 -5
  170. package/src/resources/history.ts +238 -27
  171. package/src/resources/me.ts +22 -0
  172. package/src/resources/members.ts +30 -0
  173. package/src/resources/operations.ts +264 -5
  174. package/src/resources/registries.ts +39 -3
  175. package/src/version.ts +1 -1
@@ -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,OA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nB,IAAI,EAAE,cAAc,GAAG,QAAQ,EAC/B,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,mBAAmB,CAAC,CAY9B;IAED;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAChB,IAAI,EAAE,aAAa,EACnB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;KAAO,GACjD,OAAO,CAAC,QAAQ,CAAC,CAMnB;IAED;;;;;;;;;;OAUG;IACH,gBAAgB,CACd,IAAI,EAAE,aAAa,EACnB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,0BAA0B,CAAC,CAKrC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAK7D;IAED;;;;;;;OAOG;IACH,iBAAiB,CAAC,MAAM,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAM9E;CACF"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OperationsResource = void 0;
4
4
  const http_js_1 = require("../core/http.js");
5
+ const gated_js_1 = require("../core/gated.js");
5
6
  /**
6
7
  * Everything hanging off a single operation: free-form metadata, links to
7
8
  * other operations, and how its status changed over time.
@@ -28,8 +29,26 @@ class OperationsResource {
28
29
  metadata(kind, operationId) {
29
30
  return this.#http.request('GET', `${this.#op(kind, operationId)}/metadata`);
30
31
  }
31
- setMetadata(kind, operationId, input) {
32
- return this.#http.request('PATCH', `${this.#op(kind, operationId)}/metadata`, { body: input });
32
+ /**
33
+ * A sent field replaces its value, `null` clears it, an absent one stays.
34
+ *
35
+ * Returns `Gated`. The metadata is a facade over the assignment of the
36
+ * system category `general`, and is written the way `categories` writes:
37
+ * a version per change, an optimistic lock, and the category's approval.
38
+ * By default `general` has none and the answer is `applied` (200), as it
39
+ * always was. If an administrator set its `approvalScope`, nothing is
40
+ * written: a request is created (`category_assign` / `category_edit`) and
41
+ * the answer is `pending` (202) with its card. An edit of ANOTHER field
42
+ * made concurrently is not lost — the patch is laid over the fresh version
43
+ * up to three times before 409 `ASSIGNMENT_STALE`.
44
+ *
45
+ * Writing takes the labelling right of `general`: by default `transfer` on
46
+ * the operation's address. Seeing the operation is not enough — a signer or
47
+ * an initiator without that right gets 404.
48
+ */
49
+ async setMetadata(kind, operationId, input) {
50
+ const res = await this.#http.requestRaw('PATCH', `${this.#op(kind, operationId)}/metadata`, { body: input });
51
+ return (0, gated_js_1.toGated)(res.status, res.data);
33
52
  }
34
53
  /** Other operations linked to this one. A plain array, not a page. */
35
54
  relations(kind, operationId) {
@@ -60,9 +79,171 @@ class OperationsResource {
60
79
  listRelations(params = {}) {
61
80
  return this.#http.request('GET', `/api/v1/vaults/${this.#vault}/operation-relations`, { query: { ...params } });
62
81
  }
82
+ /**
83
+ * Links two operations. DIRECTION: `source` is the DERIVED operation (the
84
+ * refund, reversal, correction or replacement itself), `target` the
85
+ * ORIGINAL it refers to — a deposit refunded by a transfer is source =
86
+ * transfer, target = deposit. Both must be in this vault, with `transfer`
87
+ * on the addresses of BOTH; otherwise 404 `OPERATION_NOT_FOUND`, as if
88
+ * missing.
89
+ *
90
+ * Idempotent, and not wrapped in `Gated`: a relation is unique by (type,
91
+ * source, target), and repeating the same body answers 200 with the
92
+ * existing relation where a new one answers 201 — both mean "this relation
93
+ * now exists, exactly as asked". The same triple with another amount, token
94
+ * or comment is 409 `OPERATION_RELATION_EXISTS`, the existing id in
95
+ * `details.relationId`. To change a relation, delete it and create it
96
+ * again.
97
+ *
98
+ * `relatedAmountRaw` only together with `tokenId`: a token of at least one
99
+ * of the two operations, an amount above zero and no larger than either
100
+ * side's amount in that token — otherwise 422 `OPERATION_RELATION_INVALID`,
101
+ * the field in `details.field`.
102
+ */
63
103
  createRelation(input) {
64
104
  return this.#http.request('POST', `/api/v1/vaults/${this.#vault}/operation-relations`, { body: input });
65
105
  }
106
+ /**
107
+ * Removes a relation — physically: a relation has no version history, so
108
+ * reports read the current state and report snapshots stay as they were.
109
+ *
110
+ * Its creator or an administrator. The creator needs what creating took —
111
+ * `transfer` on the addresses of BOTH operations, now; otherwise 403
112
+ * `OPERATION_RELATION_FORBIDDEN`. Someone else's relation is 403
113
+ * `NOT_RELATION_CREATOR`. A relation neither side of which you can see,
114
+ * like one already removed, is 404 `OPERATION_RELATION_NOT_FOUND`.
115
+ */
116
+ deleteRelation(relationId) {
117
+ return this.#http.request('DELETE', `/api/v1/vaults/${this.#vault}/operation-relations/${(0, http_js_1.seg)(relationId)}`);
118
+ }
119
+ /**
120
+ * Picks the counterparty of a transfer or a deposit by hand, correcting a
121
+ * wrong or missing automatic match: `counterpartySource` becomes `manual`.
122
+ * `null` is a choice too — "this operation has no counterparty".
123
+ *
124
+ * The choice is written where the automatic match is, so the feed, the
125
+ * cards, the counterparty's counters and reports see it at once. Neither
126
+ * the automatic match nor the retro-match on adding an address overwrites
127
+ * it; `resetCounterparty()` hands the operation back to them. Repeating the
128
+ * same value writes nothing and answers the current state.
129
+ *
130
+ * Only a counterparty of this vault that is not archived: 404
131
+ * `COUNTERPARTY_NOT_FOUND` (someone else's and a missing one alike), 409
132
+ * `COUNTERPARTY_ARCHIVED`. A transfer awaiting signatures is 409
133
+ * `OPERATION_AWAITING_APPROVAL` — its signers see the counterparty matched
134
+ * by the recipient's address, and a manual choice then would let them sign
135
+ * a stranger's address under a trusted name. The policy decision never
136
+ * depends on this choice; it was taken by address at creation.
137
+ *
138
+ * Takes the right to write the operation's metadata: `transfer` on its
139
+ * address. Seeing it is not enough — anyone else gets 404
140
+ * `OPERATION_NOT_FOUND`.
141
+ */
142
+ setCounterparty(kind, operationId, counterpartyId) {
143
+ return this.#http.request('PUT', `${this.#op(kind, operationId)}/counterparty`, { body: { counterpartyId } });
144
+ }
145
+ /**
146
+ * Drops the manual choice and matches the operation again AT ONCE — by the
147
+ * other side's address (the recipient of a transfer, the sender of a
148
+ * deposit) against the directory as it is NOW, by the rule used at
149
+ * creation (an archived counterparty does not match). The result can
150
+ * differ from what was there before the manual choice if the directory has
151
+ * changed since.
152
+ *
153
+ * On an operation that is already automatic nothing is written and the
154
+ * current state comes back, so a repeat is safe. Afterwards
155
+ * `counterpartySource` is `auto` and `counterpartySetById`/`At` say who
156
+ * reset it and when. Same rights and the same 409
157
+ * `OPERATION_AWAITING_APPROVAL` as `setCounterparty()`.
158
+ */
159
+ resetCounterparty(kind, operationId) {
160
+ return this.#http.request('DELETE', `${this.#op(kind, operationId)}/counterparty`);
161
+ }
162
+ /**
163
+ * Files attached to an operation (invoices, acts, screenshots) — metadata,
164
+ * in upload order; the bytes are fetched with `downloadAttachment()`. At
165
+ * most 20 per operation, so there is no cursor. Removed ones are not
166
+ * listed.
167
+ *
168
+ * Seen by whoever sees the operation: for a transfer an administrator, its
169
+ * initiator, a signer from the request's snapshot, or `view` on the sending
170
+ * address; for a deposit `view` on the receiving address. Anyone else gets
171
+ * 404 `OPERATION_NOT_FOUND`. A server without attachment storage answers
172
+ * 501 `ATTACHMENTS_DISABLED` on every attachment call — hide the feature
173
+ * then.
174
+ */
175
+ attachments(kind, operationId) {
176
+ return this.#http.request('GET', `${this.#op(kind, operationId)}/attachments`);
177
+ }
178
+ /**
179
+ * Attaches a file. Two forms, chosen by what you pass:
180
+ *
181
+ * • a `Blob`/`File`, an `ArrayBuffer` or a `Uint8Array` goes as the raw
182
+ * body (`application/octet-stream`, the name in `?filename=`), streamed
183
+ * to storage, up to 10 MB. `fetch` sets `Content-Length` itself, which
184
+ * the API requires (411 `ATTACHMENT_LENGTH_REQUIRED` without it);
185
+ * • a `FormData` goes as `multipart/form-data` exactly as built: the file
186
+ * in the field `file`, the name in the field `filename` or the part's
187
+ * own. Parsed in memory, so up to 5 MB. This is the form React Native
188
+ * sends a file from a `uri` with.
189
+ *
190
+ * The type is decided by the BYTES, never by a header: PDF, PNG, JPEG and
191
+ * WebP only — anything else (SVG and HTML included) is 415
192
+ * `ATTACHMENT_TYPE_NOT_ALLOWED`. The name is cleaned and its extension made
193
+ * to match the type; read the stored one from the answer. Over the size
194
+ * limit is 413 `ATTACHMENT_TOO_LARGE`; over 20 files on the operation, 409
195
+ * `ATTACHMENT_LIMIT_REACHED`; over the vault's quota (1 GB of live files by
196
+ * default), 409 `ATTACHMENT_QUOTA_EXCEEDED` with `details.quotaBytes` and
197
+ * `details.usedBytes`.
198
+ *
199
+ * Uploading takes `transfer` on the operation's address, as labelling does;
200
+ * a signer, an initiator whose grant was revoked and a view-only grant get
201
+ * 404. From a browser, a page of a site the API does not trust is refused
202
+ * with 403 `CROSS_SITE_REQUEST_REFUSED`, as every changing request is.
203
+ */
204
+ uploadAttachment(kind, operationId, file, options = {}) {
205
+ const path = `${this.#op(kind, operationId)}/attachments`;
206
+ const control = { signal: options.signal, timeoutMs: options.timeoutMs };
207
+ if (isFormData(file)) {
208
+ return this.#http.request('POST', path, { ...control, rawBody: file });
209
+ }
210
+ return this.#http.request('POST', path, {
211
+ ...control,
212
+ rawBody: file,
213
+ contentType: 'application/octet-stream',
214
+ query: { filename: options.filename ?? fileName(file) },
215
+ });
216
+ }
217
+ /**
218
+ * The file itself, as the untouched `Response`: read it with `.blob()` or
219
+ * `.arrayBuffer()`. `Content-Type` is the type detected at upload, and
220
+ * `Content-Disposition: attachment` carries the cleaned name. The same
221
+ * path is the attachment's `downloadPath`, relative to the API base.
222
+ *
223
+ * Who may read it is checked on every request, so a revoked access closes a
224
+ * cached copy too: the API answers with `ETag` = the file's SHA-256 and
225
+ * `Cache-Control: private, max-age=0, must-revalidate`. Do not send
226
+ * `If-None-Match` yourself — a 304 has no body and the transport reports it
227
+ * as an error; the browser's own revalidation is transparent. A file
228
+ * missing from storage is 502 `ATTACHMENT_STORAGE_UNAVAILABLE`.
229
+ */
230
+ downloadAttachment(kind, operationId, attachmentId, options = {}) {
231
+ return this.#http.fetchRaw('GET', `${this.#op(kind, operationId)}/attachments/${(0, http_js_1.seg)(attachmentId)}/content`, { signal: options.signal });
232
+ }
233
+ /**
234
+ * Removes an attachment: its uploader, while they still hold `transfer` on
235
+ * the operation's address, or an administrator — anyone else who sees the
236
+ * operation gets 403 `ATTACHMENT_DELETE_FORBIDDEN`. Soft: the file leaves
237
+ * the list and is no longer served, its bytes are erased, and the record
238
+ * stays as an audit trail. Repeating it answers the same.
239
+ *
240
+ * 502 `ATTACHMENT_STORAGE_UNAVAILABLE` with `details.deleted: true` means
241
+ * the attachment is already hidden but storage kept the bytes; repeat the
242
+ * call to clean them up.
243
+ */
244
+ deleteAttachment(kind, operationId, attachmentId) {
245
+ return this.#http.request('DELETE', `${this.#op(kind, operationId)}/attachments/${(0, http_js_1.seg)(attachmentId)}`);
246
+ }
66
247
  /**
67
248
  * An incoming payment in detail.
68
249
  *
@@ -91,4 +272,13 @@ class OperationsResource {
91
272
  }
92
273
  }
93
274
  exports.OperationsResource = OperationsResource;
275
+ /** `instanceof` alone fails where the global is missing (older Node) — guard it. */
276
+ function isFormData(value) {
277
+ return typeof FormData !== 'undefined' && value instanceof FormData;
278
+ }
279
+ /** The name a `File` carries; a bare `Blob` or buffer has none. */
280
+ function fileName(file) {
281
+ const name = file.name;
282
+ return typeof name === 'string' && name !== '' ? name : undefined;
283
+ }
94
284
  //# sourceMappingURL=operations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/resources/operations.ts"],"names":[],"mappings":";;;AAAA,6CAAsD;AAwCtD;;;;;;;;GAQG;AACH;IACW,KAAK,CAAY;IACjB,MAAM,CAAQ;IAEvB,YAAY,IAAgB,EAAE,SAAiB;QAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,IAAA,aAAG,EAAC,SAAS,CAAC,CAAA;IAC9B,CAAC;IAED,GAAG,CAAC,IAAmB,EAAE,WAAm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AC;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;;AAED,oFAAoF;AACpF,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,QAAQ,KAAK,WAAW,IAAI,KAAK,YAAY,QAAQ,CAAA;AACrE,CAAC;AAED,mEAAmE;AACnE,SAAS,QAAQ,CAAC,IAAoB;IACpC,MAAM,IAAI,GAAI,IAA2B,CAAC,IAAI,CAAA;IAC9C,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AACnE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from '../core/http.js';
2
- import type { AmlValue, CreateNetworkBody, CreateTokenBody, EvaluationRequest, EvaluationResult, Network, PatchNetworkBody, PatchTokenBody, RatesResponse, TokenWithNetwork } from '../generated/types.js';
2
+ import type { AmlProviders, 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.
@@ -118,6 +135,15 @@ export declare class RegistriesResource {
118
135
  amlScore(address: string, options?: {
119
136
  refresh?: boolean | undefined;
120
137
  }): Promise<AmlScore>;
138
+ /**
139
+ * AML providers and what each can do. `capabilities` decides which rule
140
+ * conditions a provider can serve: Scorechain has no shares of funds, no
141
+ * entity of the address itself and no separate sanction authorities, and
142
+ * the server will refuse a rule that needs them — so do not offer those
143
+ * conditions in a rule builder. The registry is code, the same for every
144
+ * vault.
145
+ */
146
+ amlProviders(): Promise<AmlProviders>;
121
147
  /**
122
148
  * Registering a network. Administrators only.
123
149
  *
@@ -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,OAA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AO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI5F;IAED;;;;;;;OAOG;IACH,YAAY,IAAI,OAAO,CAAC,YAAY,CAAC,CAEpC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAExD;IAED,2BAA2B;IAC3B,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAI1E;IAED;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAE7D;IAED;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAI7E;CACF"}
@@ -14,9 +14,15 @@ class RegistriesResource {
14
14
  constructor(http) {
15
15
  this.#http = http;
16
16
  }
17
+ /**
18
+ * Every registered network. Each carries `logoPath`: load the logo through
19
+ * the API with `CoreClient.logo(logoPath)` rather than from `logoUri`, or
20
+ * the image's host sees the client's IP.
21
+ */
17
22
  networks() {
18
23
  return this.#http.request('GET', '/api/v1/networks');
19
24
  }
25
+ /** Tokens, with `logoPath` — see `networks()` on why to load it, not `logoUri`. */
20
26
  tokens(params = {}) {
21
27
  return this.#http.request('GET', '/api/v1/tokens', { query: { ...params } });
22
28
  }
@@ -31,6 +37,16 @@ class RegistriesResource {
31
37
  * Rates are fetched live on every call and NOT cached, so this is the
32
38
  * "right now" figure. The rate stored on an operation is a separate thing:
33
39
  * a snapshot taken when it was created.
40
+ *
41
+ * `base` adds rates in a fiat currency: `fx.rate` is how much of `base` one
42
+ * USD costs, and each `rates[].rate` is `base` per token (`usdRate` ×
43
+ * `fx.rate`). The conversion goes THROUGH THE DOLLAR, at the Bank of
44
+ * Russia's official rate for the date (`fx.asOf`; unchanged over weekends) —
45
+ * fit for valuation, not for settlement; the server keeps that table for up
46
+ * to an hour. When the currency source is down, `fx` is `null` and every
47
+ * `rates[].rate` is `null`, still with 200. Without `base` the answer is the
48
+ * old one: `base: 'USD'` and neither `fx` nor `rate` keys at all — so pass
49
+ * `base: 'USD'` explicitly if you want `rate` filled in USD.
34
50
  */
35
51
  rates(params = {}) {
36
52
  return this.#http.request('GET', '/api/v1/rates', { query: { ...params } });
@@ -93,6 +109,17 @@ class RegistriesResource {
93
109
  query: { address, ...options },
94
110
  });
95
111
  }
112
+ /**
113
+ * AML providers and what each can do. `capabilities` decides which rule
114
+ * conditions a provider can serve: Scorechain has no shares of funds, no
115
+ * entity of the address itself and no separate sanction authorities, and
116
+ * the server will refuse a rule that needs them — so do not offer those
117
+ * conditions in a rule builder. The registry is code, the same for every
118
+ * vault.
119
+ */
120
+ amlProviders() {
121
+ return this.#http.request('GET', '/api/v1/aml/providers');
122
+ }
96
123
  /**
97
124
  * Registering a network. Administrators only.
98
125
  *
@@ -1 +1 @@
1
- {"version":3,"file":"registries.js","sourceRoot":"","sources":["../../../src/resources/registries.ts"],"names":[],"mappings":";;;AA8CA;;;;;;;GAOG;AACH;IACW,KAAK,CAAY;IAE1B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAY,KAAK,EAAE,kBAAkB,CAAC,CAAA;IACjE,CAAC;IAED,MAAM,CAAC,MAAM,GAA4C,EAAE;QACzD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAqB,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAA;IAClG,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,MAAM,GAAuD,EAAE;QACnE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,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,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAW,KAAK,EAAE,mBAAmB,EAAE;YAC9D,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE;SAC/B,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAe,KAAK,EAAE,uBAAuB,CAAC,CAAA;IACzE,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,KAAwB;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,MAAM,EAAE,kBAAkB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACjF,CAAC;IAED,2BAA2B;IAC3B,aAAa,CAAC,SAAiB,EAAE,KAAuB;QACtD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAU,OAAO,EAAE,oBAAoB,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAAE;YAC/F,IAAI,EAAE,KAAK;SACZ,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,KAAsB;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,MAAM,EAAE,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACxF,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,OAAe,EAAE,KAAqB;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAmB,OAAO,EAAE,kBAAkB,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAAE;YACpG,IAAI,EAAE,KAAK;SACZ,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  /** SDK version, sent in the `user-agent` header. */
2
- export declare const SDK_VERSION = "0.4.0";
2
+ export declare const SDK_VERSION = "0.6.0";
3
3
  /** Default API base URL. */
4
4
  export declare const DEFAULT_BASE_URL = "https://policy-engine-rest.ezig.workers.dev";
5
5
  //# sourceMappingURL=version.d.ts.map
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_BASE_URL = exports.SDK_VERSION = void 0;
4
4
  /** SDK version, sent in the `user-agent` header. */
5
- exports.SDK_VERSION = '0.4.0';
5
+ exports.SDK_VERSION = '0.6.0';
6
6
  /** Default API base URL. */
7
7
  exports.DEFAULT_BASE_URL = 'https://policy-engine-rest.ezig.workers.dev';
8
8
  //# sourceMappingURL=version.js.map