@firela/api-types 0.0.0-canary.209966

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.
package/dist/index.mjs ADDED
@@ -0,0 +1,1202 @@
1
+ // src/generated/core/OpenAPI.ts
2
+ var Interceptors = class {
3
+ constructor() {
4
+ this._fns = [];
5
+ }
6
+ eject(fn) {
7
+ const index = this._fns.indexOf(fn);
8
+ if (index !== -1) {
9
+ this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)];
10
+ }
11
+ }
12
+ use(fn) {
13
+ this._fns = [...this._fns, fn];
14
+ }
15
+ };
16
+ var OpenAPI = {
17
+ BASE: "",
18
+ CREDENTIALS: "include",
19
+ ENCODE_PATH: void 0,
20
+ HEADERS: void 0,
21
+ PASSWORD: void 0,
22
+ TOKEN: void 0,
23
+ USERNAME: void 0,
24
+ VERSION: "dev",
25
+ WITH_CREDENTIALS: false,
26
+ interceptors: {
27
+ request: new Interceptors(),
28
+ response: new Interceptors()
29
+ }
30
+ };
31
+
32
+ // src/generated/core/ApiError.ts
33
+ var ApiError = class extends Error {
34
+ constructor(request2, response, message) {
35
+ super(message);
36
+ this.name = "ApiError";
37
+ this.url = response.url;
38
+ this.status = response.status;
39
+ this.statusText = response.statusText;
40
+ this.body = response.body;
41
+ this.request = request2;
42
+ }
43
+ };
44
+
45
+ // src/generated/core/CancelablePromise.ts
46
+ var CancelError = class extends Error {
47
+ constructor(message) {
48
+ super(message);
49
+ this.name = "CancelError";
50
+ }
51
+ get isCancelled() {
52
+ return true;
53
+ }
54
+ };
55
+ var CancelablePromise = class {
56
+ constructor(executor) {
57
+ this._isResolved = false;
58
+ this._isRejected = false;
59
+ this._isCancelled = false;
60
+ this.cancelHandlers = [];
61
+ this.promise = new Promise((resolve2, reject) => {
62
+ this._resolve = resolve2;
63
+ this._reject = reject;
64
+ const onResolve = (value) => {
65
+ if (this._isResolved || this._isRejected || this._isCancelled) {
66
+ return;
67
+ }
68
+ this._isResolved = true;
69
+ if (this._resolve) this._resolve(value);
70
+ };
71
+ const onReject = (reason) => {
72
+ if (this._isResolved || this._isRejected || this._isCancelled) {
73
+ return;
74
+ }
75
+ this._isRejected = true;
76
+ if (this._reject) this._reject(reason);
77
+ };
78
+ const onCancel = (cancelHandler) => {
79
+ if (this._isResolved || this._isRejected || this._isCancelled) {
80
+ return;
81
+ }
82
+ this.cancelHandlers.push(cancelHandler);
83
+ };
84
+ Object.defineProperty(onCancel, "isResolved", {
85
+ get: () => this._isResolved
86
+ });
87
+ Object.defineProperty(onCancel, "isRejected", {
88
+ get: () => this._isRejected
89
+ });
90
+ Object.defineProperty(onCancel, "isCancelled", {
91
+ get: () => this._isCancelled
92
+ });
93
+ return executor(onResolve, onReject, onCancel);
94
+ });
95
+ }
96
+ get [Symbol.toStringTag]() {
97
+ return "Cancellable Promise";
98
+ }
99
+ then(onFulfilled, onRejected) {
100
+ return this.promise.then(onFulfilled, onRejected);
101
+ }
102
+ catch(onRejected) {
103
+ return this.promise.catch(onRejected);
104
+ }
105
+ finally(onFinally) {
106
+ return this.promise.finally(onFinally);
107
+ }
108
+ cancel() {
109
+ if (this._isResolved || this._isRejected || this._isCancelled) {
110
+ return;
111
+ }
112
+ this._isCancelled = true;
113
+ if (this.cancelHandlers.length) {
114
+ try {
115
+ for (const cancelHandler of this.cancelHandlers) {
116
+ cancelHandler();
117
+ }
118
+ } catch (error) {
119
+ console.warn("Cancellation threw an error", error);
120
+ return;
121
+ }
122
+ }
123
+ this.cancelHandlers.length = 0;
124
+ if (this._reject) this._reject(new CancelError("Request aborted"));
125
+ }
126
+ get isCancelled() {
127
+ return this._isCancelled;
128
+ }
129
+ };
130
+
131
+ // src/generated/core/request.ts
132
+ var isString = (value) => {
133
+ return typeof value === "string";
134
+ };
135
+ var isStringWithValue = (value) => {
136
+ return isString(value) && value !== "";
137
+ };
138
+ var isBlob = (value) => {
139
+ return value instanceof Blob;
140
+ };
141
+ var isFormData = (value) => {
142
+ return value instanceof FormData;
143
+ };
144
+ var base64 = (str) => {
145
+ try {
146
+ return btoa(str);
147
+ } catch (err) {
148
+ return Buffer.from(str).toString("base64");
149
+ }
150
+ };
151
+ var getQueryString = (params) => {
152
+ const qs = [];
153
+ const append = (key, value) => {
154
+ qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
155
+ };
156
+ const encodePair = (key, value) => {
157
+ if (value === void 0 || value === null) {
158
+ return;
159
+ }
160
+ if (value instanceof Date) {
161
+ append(key, value.toISOString());
162
+ } else if (Array.isArray(value)) {
163
+ value.forEach((v) => encodePair(key, v));
164
+ } else if (typeof value === "object") {
165
+ Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v));
166
+ } else {
167
+ append(key, value);
168
+ }
169
+ };
170
+ Object.entries(params).forEach(([key, value]) => encodePair(key, value));
171
+ return qs.length ? `?${qs.join("&")}` : "";
172
+ };
173
+ var getUrl = (config, options) => {
174
+ const encoder = config.ENCODE_PATH || encodeURI;
175
+ const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
176
+ if (options.path?.hasOwnProperty(group)) {
177
+ return encoder(String(options.path[group]));
178
+ }
179
+ return substring;
180
+ });
181
+ const url = config.BASE + path;
182
+ return options.query ? url + getQueryString(options.query) : url;
183
+ };
184
+ var getFormData = (options) => {
185
+ if (options.formData) {
186
+ const formData = new FormData();
187
+ const process = (key, value) => {
188
+ if (isString(value) || isBlob(value)) {
189
+ formData.append(key, value);
190
+ } else {
191
+ formData.append(key, JSON.stringify(value));
192
+ }
193
+ };
194
+ Object.entries(options.formData).filter(([, value]) => value !== void 0 && value !== null).forEach(([key, value]) => {
195
+ if (Array.isArray(value)) {
196
+ value.forEach((v) => process(key, v));
197
+ } else {
198
+ process(key, value);
199
+ }
200
+ });
201
+ return formData;
202
+ }
203
+ return void 0;
204
+ };
205
+ var resolve = async (options, resolver) => {
206
+ if (typeof resolver === "function") {
207
+ return resolver(options);
208
+ }
209
+ return resolver;
210
+ };
211
+ var getHeaders = async (config, options) => {
212
+ const [token, username, password, additionalHeaders] = await Promise.all([
213
+ resolve(options, config.TOKEN),
214
+ resolve(options, config.USERNAME),
215
+ resolve(options, config.PASSWORD),
216
+ resolve(options, config.HEADERS)
217
+ ]);
218
+ const headers = Object.entries({
219
+ Accept: "application/json",
220
+ ...additionalHeaders,
221
+ ...options.headers
222
+ }).filter(([, value]) => value !== void 0 && value !== null).reduce(
223
+ (headers2, [key, value]) => ({
224
+ ...headers2,
225
+ [key]: String(value)
226
+ }),
227
+ {}
228
+ );
229
+ if (isStringWithValue(token)) {
230
+ headers["Authorization"] = `Bearer ${token}`;
231
+ }
232
+ if (isStringWithValue(username) && isStringWithValue(password)) {
233
+ const credentials = base64(`${username}:${password}`);
234
+ headers["Authorization"] = `Basic ${credentials}`;
235
+ }
236
+ if (options.body !== void 0) {
237
+ if (options.mediaType) {
238
+ headers["Content-Type"] = options.mediaType;
239
+ } else if (isBlob(options.body)) {
240
+ headers["Content-Type"] = options.body.type || "application/octet-stream";
241
+ } else if (isString(options.body)) {
242
+ headers["Content-Type"] = "text/plain";
243
+ } else if (!isFormData(options.body)) {
244
+ headers["Content-Type"] = "application/json";
245
+ }
246
+ }
247
+ return new Headers(headers);
248
+ };
249
+ var getRequestBody = (options) => {
250
+ if (options.body !== void 0) {
251
+ if (options.mediaType?.includes("application/json") || options.mediaType?.includes("+json")) {
252
+ return JSON.stringify(options.body);
253
+ } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
254
+ return options.body;
255
+ } else {
256
+ return JSON.stringify(options.body);
257
+ }
258
+ }
259
+ return void 0;
260
+ };
261
+ var sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
262
+ const controller = new AbortController();
263
+ let request2 = {
264
+ headers,
265
+ body: body ?? formData,
266
+ method: options.method,
267
+ signal: controller.signal
268
+ };
269
+ if (config.WITH_CREDENTIALS) {
270
+ request2.credentials = config.CREDENTIALS;
271
+ }
272
+ for (const fn of config.interceptors.request._fns) {
273
+ request2 = await fn(request2);
274
+ }
275
+ onCancel(() => controller.abort());
276
+ return await fetch(url, request2);
277
+ };
278
+ var getResponseHeader = (response, responseHeader) => {
279
+ if (responseHeader) {
280
+ const content = response.headers.get(responseHeader);
281
+ if (isString(content)) {
282
+ return content;
283
+ }
284
+ }
285
+ return void 0;
286
+ };
287
+ var getResponseBody = async (response) => {
288
+ if (response.status !== 204) {
289
+ try {
290
+ const contentType = response.headers.get("Content-Type");
291
+ if (contentType) {
292
+ const binaryTypes = [
293
+ "application/octet-stream",
294
+ "application/pdf",
295
+ "application/zip",
296
+ "audio/",
297
+ "image/",
298
+ "video/"
299
+ ];
300
+ if (contentType.includes("application/json") || contentType.includes("+json")) {
301
+ return await response.json();
302
+ } else if (binaryTypes.some((type) => contentType.includes(type))) {
303
+ return await response.blob();
304
+ } else if (contentType.includes("multipart/form-data")) {
305
+ return await response.formData();
306
+ } else if (contentType.includes("text/")) {
307
+ return await response.text();
308
+ }
309
+ }
310
+ } catch (error) {
311
+ console.error(error);
312
+ }
313
+ }
314
+ return void 0;
315
+ };
316
+ var catchErrorCodes = (options, result) => {
317
+ const errors = {
318
+ 400: "Bad Request",
319
+ 401: "Unauthorized",
320
+ 402: "Payment Required",
321
+ 403: "Forbidden",
322
+ 404: "Not Found",
323
+ 405: "Method Not Allowed",
324
+ 406: "Not Acceptable",
325
+ 407: "Proxy Authentication Required",
326
+ 408: "Request Timeout",
327
+ 409: "Conflict",
328
+ 410: "Gone",
329
+ 411: "Length Required",
330
+ 412: "Precondition Failed",
331
+ 413: "Payload Too Large",
332
+ 414: "URI Too Long",
333
+ 415: "Unsupported Media Type",
334
+ 416: "Range Not Satisfiable",
335
+ 417: "Expectation Failed",
336
+ 418: "Im a teapot",
337
+ 421: "Misdirected Request",
338
+ 422: "Unprocessable Content",
339
+ 423: "Locked",
340
+ 424: "Failed Dependency",
341
+ 425: "Too Early",
342
+ 426: "Upgrade Required",
343
+ 428: "Precondition Required",
344
+ 429: "Too Many Requests",
345
+ 431: "Request Header Fields Too Large",
346
+ 451: "Unavailable For Legal Reasons",
347
+ 500: "Internal Server Error",
348
+ 501: "Not Implemented",
349
+ 502: "Bad Gateway",
350
+ 503: "Service Unavailable",
351
+ 504: "Gateway Timeout",
352
+ 505: "HTTP Version Not Supported",
353
+ 506: "Variant Also Negotiates",
354
+ 507: "Insufficient Storage",
355
+ 508: "Loop Detected",
356
+ 510: "Not Extended",
357
+ 511: "Network Authentication Required",
358
+ ...options.errors
359
+ };
360
+ const error = errors[result.status];
361
+ if (error) {
362
+ throw new ApiError(options, result, error);
363
+ }
364
+ if (!result.ok) {
365
+ const errorStatus = result.status ?? "unknown";
366
+ const errorStatusText = result.statusText ?? "unknown";
367
+ const errorBody = (() => {
368
+ try {
369
+ return JSON.stringify(result.body, null, 2);
370
+ } catch (e) {
371
+ return void 0;
372
+ }
373
+ })();
374
+ throw new ApiError(
375
+ options,
376
+ result,
377
+ `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
378
+ );
379
+ }
380
+ };
381
+ var request = (config, options) => {
382
+ return new CancelablePromise(async (resolve2, reject, onCancel) => {
383
+ try {
384
+ const url = getUrl(config, options);
385
+ const formData = getFormData(options);
386
+ const body = getRequestBody(options);
387
+ const headers = await getHeaders(config, options);
388
+ if (!onCancel.isCancelled) {
389
+ let response = await sendRequest(
390
+ config,
391
+ options,
392
+ url,
393
+ body,
394
+ formData,
395
+ headers,
396
+ onCancel
397
+ );
398
+ for (const fn of config.interceptors.response._fns) {
399
+ response = await fn(response);
400
+ }
401
+ const responseBody = await getResponseBody(response);
402
+ const responseHeader = getResponseHeader(
403
+ response,
404
+ options.responseHeader
405
+ );
406
+ const result = {
407
+ url,
408
+ ok: response.ok,
409
+ status: response.status,
410
+ statusText: response.statusText,
411
+ body: responseHeader ?? responseBody
412
+ };
413
+ catchErrorCodes(options, result);
414
+ resolve2(result.body);
415
+ }
416
+ } catch (error) {
417
+ reject(error);
418
+ }
419
+ });
420
+ };
421
+
422
+ // src/generated/services.gen.ts
423
+ var BeanAccountsService = class {
424
+ /**
425
+ * Create a new account
426
+ * Creates a new account (Beancount Open directive)
427
+ * @param data The data for the request.
428
+ * @param data.region Region code for tenant context
429
+ * @param data.requestBody
430
+ * @returns AccountResponseDto Account created successfully
431
+ * @throws ApiError
432
+ */
433
+ static accountControllerCreate(data) {
434
+ return request(OpenAPI, {
435
+ method: "POST",
436
+ url: "/api/v1/{region}/bean/accounts",
437
+ path: {
438
+ region: data.region
439
+ },
440
+ body: data.requestBody,
441
+ mediaType: "application/json",
442
+ errors: {
443
+ 409: "Account already exists"
444
+ }
445
+ });
446
+ }
447
+ /**
448
+ * List accounts
449
+ * Returns all accounts with optional filtering
450
+ * @param data The data for the request.
451
+ * @param data.region Region code for tenant context
452
+ * @param data.type Filter by account type
453
+ * @param data.status Filter by status
454
+ * @param data.isCustom Filter by custom (user-created) accounts only
455
+ * @param data.search Search term for path or i18nKey
456
+ * @param data.limit Maximum number of results
457
+ * @param data.offset Number of results to skip
458
+ * @returns AccountListResponseDto Accounts retrieved successfully
459
+ * @throws ApiError
460
+ */
461
+ static accountControllerFindAll(data) {
462
+ return request(OpenAPI, {
463
+ method: "GET",
464
+ url: "/api/v1/{region}/bean/accounts",
465
+ path: {
466
+ region: data.region
467
+ },
468
+ query: {
469
+ type: data.type,
470
+ status: data.status,
471
+ isCustom: data.isCustom,
472
+ search: data.search,
473
+ limit: data.limit,
474
+ offset: data.offset
475
+ }
476
+ });
477
+ }
478
+ /**
479
+ * Get account by ID
480
+ * Returns a specific account
481
+ * @param data The data for the request.
482
+ * @param data.id Account UUID
483
+ * @param data.region Region code for tenant context
484
+ * @returns AccountResponseDto Account retrieved successfully
485
+ * @throws ApiError
486
+ */
487
+ static accountControllerFindOne(data) {
488
+ return request(OpenAPI, {
489
+ method: "GET",
490
+ url: "/api/v1/{region}/bean/accounts/{id}",
491
+ path: {
492
+ id: data.id,
493
+ region: data.region
494
+ },
495
+ errors: {
496
+ 404: "Account not found"
497
+ }
498
+ });
499
+ }
500
+ /**
501
+ * Update account
502
+ * Updates account metadata (path cannot be changed)
503
+ * @param data The data for the request.
504
+ * @param data.id Account UUID
505
+ * @param data.region Region code for tenant context
506
+ * @param data.requestBody
507
+ * @returns AccountResponseDto Account updated successfully
508
+ * @throws ApiError
509
+ */
510
+ static accountControllerUpdate(data) {
511
+ return request(OpenAPI, {
512
+ method: "PUT",
513
+ url: "/api/v1/{region}/bean/accounts/{id}",
514
+ path: {
515
+ id: data.id,
516
+ region: data.region
517
+ },
518
+ body: data.requestBody,
519
+ mediaType: "application/json",
520
+ errors: {
521
+ 404: "Account not found"
522
+ }
523
+ });
524
+ }
525
+ /**
526
+ * Delete account
527
+ * Deletes an account (only if no transactions)
528
+ * @param data The data for the request.
529
+ * @param data.id Account UUID
530
+ * @param data.region Region code for tenant context
531
+ * @returns void Account deleted successfully
532
+ * @throws ApiError
533
+ */
534
+ static accountControllerDelete(data) {
535
+ return request(OpenAPI, {
536
+ method: "DELETE",
537
+ url: "/api/v1/{region}/bean/accounts/{id}",
538
+ path: {
539
+ id: data.id,
540
+ region: data.region
541
+ },
542
+ errors: {
543
+ 404: "Account not found",
544
+ 409: "Account has transactions and cannot be deleted"
545
+ }
546
+ });
547
+ }
548
+ /**
549
+ * Close account
550
+ * Closes an account (Beancount Close directive)
551
+ * @param data The data for the request.
552
+ * @param data.id Account UUID
553
+ * @param data.region Region code for tenant context
554
+ * @param data.requestBody
555
+ * @returns AccountResponseDto Account closed successfully
556
+ * @throws ApiError
557
+ */
558
+ static accountControllerClose(data) {
559
+ return request(OpenAPI, {
560
+ method: "POST",
561
+ url: "/api/v1/{region}/bean/accounts/{id}/close",
562
+ path: {
563
+ id: data.id,
564
+ region: data.region
565
+ },
566
+ body: data.requestBody,
567
+ mediaType: "application/json",
568
+ errors: {
569
+ 400: "Account is already closed",
570
+ 404: "Account not found"
571
+ }
572
+ });
573
+ }
574
+ /**
575
+ * Reopen account
576
+ * Reopens a previously closed account
577
+ * @param data The data for the request.
578
+ * @param data.id Account UUID
579
+ * @param data.region Region code for tenant context
580
+ * @param data.requestBody
581
+ * @returns AccountResponseDto Account reopened successfully
582
+ * @throws ApiError
583
+ */
584
+ static accountControllerReopen(data) {
585
+ return request(OpenAPI, {
586
+ method: "POST",
587
+ url: "/api/v1/{region}/bean/accounts/{id}/reopen",
588
+ path: {
589
+ id: data.id,
590
+ region: data.region
591
+ },
592
+ body: data.requestBody,
593
+ mediaType: "application/json",
594
+ errors: {
595
+ 400: "Account is not closed",
596
+ 404: "Account not found"
597
+ }
598
+ });
599
+ }
600
+ };
601
+ var BeanTransactionsService = class {
602
+ /**
603
+ * Create transaction
604
+ * Creates a new double-entry transaction. Missing accounts are auto-created by default.
605
+ * @param data The data for the request.
606
+ * @param data.region Region code for tenant context
607
+ * @param data.requestBody Transaction data with postings
608
+ * @returns TransactionResponseDto Transaction created successfully
609
+ * @throws ApiError
610
+ */
611
+ static transactionControllerCreate(data) {
612
+ return request(OpenAPI, {
613
+ method: "POST",
614
+ url: "/api/v1/{region}/bean/transactions",
615
+ path: {
616
+ region: data.region
617
+ },
618
+ body: data.requestBody,
619
+ mediaType: "application/json",
620
+ errors: {
621
+ 400: "Validation failed",
622
+ 401: "Authentication required",
623
+ 422: "Semantic validation failed (transaction does not balance, invalid accounts)",
624
+ 500: "Unexpected server error"
625
+ }
626
+ });
627
+ }
628
+ /**
629
+ * List transactions
630
+ * Returns a paginated list of transactions with optional filters
631
+ * @param data The data for the request.
632
+ * @param data.region Region code for tenant context
633
+ * @param data.limit Number of items per page (1-100, default: 20)
634
+ * @param data.offset Number of items to skip (default: 0)
635
+ * @param data.dateFrom Filter by start date (inclusive), format: YYYY-MM-DD
636
+ * @param data.dateTo Filter by end date (inclusive), format: YYYY-MM-DD
637
+ * @param data.status Filter by transaction status
638
+ * @param data.search Search in narration and payee fields (max 200 chars)
639
+ * @param data.accountId Filter by account ID (transactions with postings to this account)
640
+ * @returns TransactionListResponseDto Transaction list
641
+ * @throws ApiError
642
+ */
643
+ static transactionControllerList(data) {
644
+ return request(OpenAPI, {
645
+ method: "GET",
646
+ url: "/api/v1/{region}/bean/transactions",
647
+ path: {
648
+ region: data.region
649
+ },
650
+ query: {
651
+ limit: data.limit,
652
+ offset: data.offset,
653
+ dateFrom: data.dateFrom,
654
+ dateTo: data.dateTo,
655
+ status: data.status,
656
+ search: data.search,
657
+ accountId: data.accountId
658
+ },
659
+ errors: {
660
+ 401: "Authentication required"
661
+ }
662
+ });
663
+ }
664
+ /**
665
+ * @param data The data for the request.
666
+ * @param data.region Region code for tenant context
667
+ * @returns unknown
668
+ * @throws ApiError
669
+ */
670
+ static transactionController(data) {
671
+ return request(OpenAPI, {
672
+ method: "POST",
673
+ url: "/api/v1/{region}/bean/transactions/batch",
674
+ path: {
675
+ region: data.region
676
+ }
677
+ });
678
+ }
679
+ /**
680
+ * Get transaction detail
681
+ * Returns transaction details including all postings
682
+ * @param data The data for the request.
683
+ * @param data.id Transaction ID
684
+ * @param data.region Region code for tenant context
685
+ * @returns TransactionDetailDto Transaction detail
686
+ * @throws ApiError
687
+ */
688
+ static transactionControllerGetDetail(data) {
689
+ return request(OpenAPI, {
690
+ method: "GET",
691
+ url: "/api/v1/{region}/bean/transactions/{id}",
692
+ path: {
693
+ id: data.id,
694
+ region: data.region
695
+ },
696
+ errors: {
697
+ 401: "Authentication required",
698
+ 404: "Transaction not found"
699
+ }
700
+ });
701
+ }
702
+ /**
703
+ * Update transaction metadata
704
+ * Updates transaction metadata (flag, payee, narration, tags, links, meta). Postings cannot be modified.
705
+ * @param data The data for the request.
706
+ * @param data.id Transaction ID
707
+ * @param data.region Region code for tenant context
708
+ * @param data.requestBody Fields to update (all optional)
709
+ * @returns TransactionDetailDto Transaction updated successfully
710
+ * @throws ApiError
711
+ */
712
+ static transactionControllerUpdate(data) {
713
+ return request(OpenAPI, {
714
+ method: "PATCH",
715
+ url: "/api/v1/{region}/bean/transactions/{id}",
716
+ path: {
717
+ id: data.id,
718
+ region: data.region
719
+ },
720
+ body: data.requestBody,
721
+ mediaType: "application/json",
722
+ errors: {
723
+ 400: "Cannot update voided transaction",
724
+ 401: "Authentication required",
725
+ 404: "Transaction not found"
726
+ }
727
+ });
728
+ }
729
+ /**
730
+ * @param data The data for the request.
731
+ * @param data.region Region code for tenant context
732
+ * @returns void
733
+ * @throws ApiError
734
+ */
735
+ static transactionController1(data) {
736
+ return request(OpenAPI, {
737
+ method: "DELETE",
738
+ url: "/api/v1/{region}/bean/transactions/{id}",
739
+ path: {
740
+ region: data.region
741
+ }
742
+ });
743
+ }
744
+ };
745
+ var BeanBalancesService = class {
746
+ /**
747
+ * Query account balance
748
+ * Calculate account balance at a specific date for a single currency
749
+ * @param data The data for the request.
750
+ * @param data.account Account name (e.g., "Assets:Bank:Checking")
751
+ * @param data.region Region code (cn, us, eu-core, de)
752
+ * @param data.date Date to calculate balance at (ISO 8601 format)
753
+ * @param data.currency Currency to query (e.g., "USD", "CNY")
754
+ * @returns BalanceResponseDto Balance calculated successfully
755
+ * @throws ApiError
756
+ */
757
+ static balanceControllerGetBalance(data) {
758
+ return request(OpenAPI, {
759
+ method: "GET",
760
+ url: "/api/v1/{region}/bean/balances",
761
+ path: {
762
+ region: data.region
763
+ },
764
+ query: {
765
+ account: data.account,
766
+ date: data.date,
767
+ currency: data.currency
768
+ },
769
+ errors: {
770
+ 400: "Invalid query parameters",
771
+ 401: "User not authenticated"
772
+ }
773
+ });
774
+ }
775
+ /**
776
+ * Query multi-currency account balance
777
+ * Calculate account balances for all currencies at a specific date
778
+ * @param data The data for the request.
779
+ * @param data.region Region code (cn, us, eu-core, de)
780
+ * @returns MultiCurrencyBalanceResponseDto Balances calculated successfully
781
+ * @throws ApiError
782
+ */
783
+ static balanceControllerGetMultiCurrencyBalance(data) {
784
+ return request(OpenAPI, {
785
+ method: "GET",
786
+ url: "/api/v1/{region}/bean/balances/multi-currency",
787
+ path: {
788
+ region: data.region
789
+ },
790
+ errors: {
791
+ 400: "Invalid query parameters",
792
+ 401: "User not authenticated"
793
+ }
794
+ });
795
+ }
796
+ };
797
+ var BeanCommoditiesService = class {
798
+ /**
799
+ * @param data The data for the request.
800
+ * @param data.region Region code (cn, us, eu-core, de)
801
+ * @returns unknown
802
+ * @throws ApiError
803
+ */
804
+ static commodityController(data) {
805
+ return request(OpenAPI, {
806
+ method: "POST",
807
+ url: "/api/v1/{region}/bean/commodities",
808
+ path: {
809
+ region: data.region
810
+ }
811
+ });
812
+ }
813
+ /**
814
+ * List user commodities
815
+ * Returns all commodity definitions for the authenticated user with optional filtering
816
+ * @param data The data for the request.
817
+ * @param data.region Region code (cn, us, eu-core, de)
818
+ * @param data.search Search term for symbol or metadata fields (partial match). Searches symbol and metadata.name.
819
+ * @param data.symbol Filter by exact symbol match
820
+ * @returns CommodityListResponseDto Commodities retrieved successfully
821
+ * @throws ApiError
822
+ */
823
+ static commodityControllerFindAll(data) {
824
+ return request(OpenAPI, {
825
+ method: "GET",
826
+ url: "/api/v1/{region}/bean/commodities",
827
+ path: {
828
+ region: data.region
829
+ },
830
+ query: {
831
+ search: data.search,
832
+ symbol: data.symbol
833
+ }
834
+ });
835
+ }
836
+ /**
837
+ * Get commodity by symbol
838
+ * Returns a specific commodity definition by its symbol
839
+ * @param data The data for the request.
840
+ * @param data.symbol Commodity symbol
841
+ * @param data.region Region code (cn, us, eu-core, de)
842
+ * @returns CommodityResponseDto Commodity retrieved successfully
843
+ * @throws ApiError
844
+ */
845
+ static commodityControllerFindOne(data) {
846
+ return request(OpenAPI, {
847
+ method: "GET",
848
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
849
+ path: {
850
+ symbol: data.symbol,
851
+ region: data.region
852
+ },
853
+ errors: {
854
+ 404: "Commodity not found"
855
+ }
856
+ });
857
+ }
858
+ /**
859
+ * @param data The data for the request.
860
+ * @param data.region Region code (cn, us, eu-core, de)
861
+ * @returns unknown
862
+ * @throws ApiError
863
+ */
864
+ static commodityController1(data) {
865
+ return request(OpenAPI, {
866
+ method: "PUT",
867
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
868
+ path: {
869
+ region: data.region
870
+ }
871
+ });
872
+ }
873
+ /**
874
+ * @param data The data for the request.
875
+ * @param data.region Region code (cn, us, eu-core, de)
876
+ * @returns void
877
+ * @throws ApiError
878
+ */
879
+ static commodityController2(data) {
880
+ return request(OpenAPI, {
881
+ method: "DELETE",
882
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
883
+ path: {
884
+ region: data.region
885
+ }
886
+ });
887
+ }
888
+ /**
889
+ * @param data The data for the request.
890
+ * @param data.region Region code (cn, us, eu-core, de)
891
+ * @returns unknown
892
+ * @throws ApiError
893
+ */
894
+ static commodityController3(data) {
895
+ return request(OpenAPI, {
896
+ method: "POST",
897
+ url: "/api/v1/{region}/bean/commodities/{symbol}/ensure",
898
+ path: {
899
+ region: data.region
900
+ }
901
+ });
902
+ }
903
+ /**
904
+ * @param data The data for the request.
905
+ * @param data.region Region code (cn, us, eu-core, de)
906
+ * @returns unknown
907
+ * @throws ApiError
908
+ */
909
+ static commodityController4(data) {
910
+ return request(OpenAPI, {
911
+ method: "POST",
912
+ url: "/api/v1/{region}/bean/commodities/bulk",
913
+ path: {
914
+ region: data.region
915
+ }
916
+ });
917
+ }
918
+ };
919
+ var ProviderSyncService = class {
920
+ /**
921
+ * Sync transactions from financial data provider
922
+ *
923
+ * Accepts raw transactions from external financial data providers, transforms them to Beancount format, and processes them through the ingestion pipeline.
924
+ *
925
+ * **Supported Providers:**
926
+ * - **plaid**: Plaid API (US, Canada, Europe)
927
+ * - **teller**: Teller API (US)
928
+ * - **truelayer**: TrueLayer Open Banking (UK, Europe)
929
+ * - **gocardless**: GoCardless Bank Account Data (Europe)
930
+ * - **simplefin**: SimpleFIN (Self-hosted)
931
+ * - **yodlee**: Yodlee (Global)
932
+ * - **beancount-direct**: Beancount format transactions
933
+ *
934
+ * **Processing Flow:**
935
+ * 1. Transform raw data via provider adapter
936
+ * 2. Validate transaction format
937
+ * 3. Deduplicate using originalId
938
+ * 4. Classify using rule engine
939
+ * 5. Route low-confidence to Review Center
940
+ * 6. Persist validated transactions
941
+ *
942
+ * @param data The data for the request.
943
+ * @param data.providerName Provider name
944
+ * @param data.region Region code
945
+ * @param data.requestBody
946
+ * @returns ProviderSyncResponseDto Sync completed successfully
947
+ * @throws ApiError
948
+ */
949
+ static providerSyncControllerSync(data) {
950
+ return request(OpenAPI, {
951
+ method: "POST",
952
+ url: "/api/v1/{region}/bean/import/provider/{providerName}/sync",
953
+ path: {
954
+ providerName: data.providerName,
955
+ region: data.region
956
+ },
957
+ body: data.requestBody,
958
+ mediaType: "application/json",
959
+ errors: {
960
+ 400: "Invalid request data",
961
+ 401: "Missing or invalid authentication",
962
+ 404: "Provider not supported"
963
+ }
964
+ });
965
+ }
966
+ /**
967
+ * Get supported providers
968
+ * Returns a list of all providers supported by the sync endpoint.
969
+ * @param data The data for the request.
970
+ * @param data.region Region code (cn, us, eu-core, de)
971
+ * @returns SupportedProvidersResponseDto List of supported providers
972
+ * @throws ApiError
973
+ */
974
+ static providerSyncControllerGetSupportedProviders(data) {
975
+ return request(OpenAPI, {
976
+ method: "GET",
977
+ url: "/api/v1/{region}/bean/import/provider/supported",
978
+ path: {
979
+ region: data.region
980
+ },
981
+ errors: {
982
+ 401: "Missing or invalid authentication"
983
+ }
984
+ });
985
+ }
986
+ /**
987
+ * Check if provider is supported
988
+ * Returns whether a specific provider is supported.
989
+ * @param data The data for the request.
990
+ * @param data.providerName Provider name to check
991
+ * @param data.region Region code (cn, us, eu-core, de)
992
+ * @returns unknown Provider support status
993
+ * @throws ApiError
994
+ */
995
+ static providerSyncControllerIsProviderSupported(data) {
996
+ return request(OpenAPI, {
997
+ method: "GET",
998
+ url: "/api/v1/{region}/bean/import/provider/{providerName}/supported",
999
+ path: {
1000
+ providerName: data.providerName,
1001
+ region: data.region
1002
+ },
1003
+ errors: {
1004
+ 401: "Missing or invalid authentication"
1005
+ }
1006
+ });
1007
+ }
1008
+ };
1009
+ var HealthService = class {
1010
+ /**
1011
+ * Basic health check for K8s/load balancer probes
1012
+ * @param data The data for the request.
1013
+ * @param data.region Region code (cn, us, eu-core, de)
1014
+ * @returns unknown Service is healthy
1015
+ * @throws ApiError
1016
+ */
1017
+ static healthControllerGetHealth(data) {
1018
+ return request(OpenAPI, {
1019
+ method: "GET",
1020
+ url: "/api/v1/health",
1021
+ path: {
1022
+ region: data.region
1023
+ },
1024
+ errors: {
1025
+ 503: "Service unavailable"
1026
+ }
1027
+ });
1028
+ }
1029
+ /**
1030
+ * Check database connection health
1031
+ * @param data The data for the request.
1032
+ * @param data.region Region code (cn, us, eu-core, de)
1033
+ * @returns unknown Database is healthy
1034
+ * @throws ApiError
1035
+ */
1036
+ static healthControllerCheckDatabase(data) {
1037
+ return request(OpenAPI, {
1038
+ method: "GET",
1039
+ url: "/api/v1/health/database",
1040
+ path: {
1041
+ region: data.region
1042
+ },
1043
+ errors: {
1044
+ 503: "Database unavailable"
1045
+ }
1046
+ });
1047
+ }
1048
+ /**
1049
+ * Check Redis connection health
1050
+ * @param data The data for the request.
1051
+ * @param data.region Region code (cn, us, eu-core, de)
1052
+ * @returns unknown Redis is healthy
1053
+ * @throws ApiError
1054
+ */
1055
+ static healthControllerCheckRedis(data) {
1056
+ return request(OpenAPI, {
1057
+ method: "GET",
1058
+ url: "/api/v1/health/redis",
1059
+ path: {
1060
+ region: data.region
1061
+ },
1062
+ errors: {
1063
+ 503: "Redis unavailable"
1064
+ }
1065
+ });
1066
+ }
1067
+ /**
1068
+ * Get status of all circuit breakers
1069
+ * @param data The data for the request.
1070
+ * @param data.region Region code (cn, us, eu-core, de)
1071
+ * @returns unknown Circuit breaker status
1072
+ * @throws ApiError
1073
+ */
1074
+ static healthControllerGetCircuitBreakersHealth(data) {
1075
+ return request(OpenAPI, {
1076
+ method: "GET",
1077
+ url: "/api/v1/health/circuit-breakers",
1078
+ path: {
1079
+ region: data.region
1080
+ },
1081
+ errors: {
1082
+ 401: "Unauthorized",
1083
+ 500: "Internal error"
1084
+ }
1085
+ });
1086
+ }
1087
+ /**
1088
+ * Reset a circuit breaker to CLOSED state
1089
+ * @param data The data for the request.
1090
+ * @param data.name Circuit breaker name to reset
1091
+ * @param data.region Region code (cn, us, eu-core, de)
1092
+ * @returns unknown Circuit breaker reset successfully
1093
+ * @throws ApiError
1094
+ */
1095
+ static healthControllerResetCircuitBreaker(data) {
1096
+ return request(OpenAPI, {
1097
+ method: "POST",
1098
+ url: "/api/v1/health/circuit-breakers/{name}/reset",
1099
+ path: {
1100
+ name: data.name,
1101
+ region: data.region
1102
+ },
1103
+ errors: {
1104
+ 401: "Unauthorized",
1105
+ 404: "Circuit breaker not found"
1106
+ }
1107
+ });
1108
+ }
1109
+ /**
1110
+ * Get health check metrics and statistics
1111
+ * @param data The data for the request.
1112
+ * @param data.region Region code (cn, us, eu-core, de)
1113
+ * @returns unknown Health metrics
1114
+ * @throws ApiError
1115
+ */
1116
+ static healthControllerGetMetrics(data) {
1117
+ return request(OpenAPI, {
1118
+ method: "GET",
1119
+ url: "/api/v1/health/metrics",
1120
+ path: {
1121
+ region: data.region
1122
+ },
1123
+ errors: {
1124
+ 401: "Unauthorized"
1125
+ }
1126
+ });
1127
+ }
1128
+ /**
1129
+ * Check health of a specific data enhancer
1130
+ * @param data The data for the request.
1131
+ * @param data.name Data enhancer name
1132
+ * @param data.region Region code (cn, us, eu-core, de)
1133
+ * @returns unknown Data enhancer is healthy
1134
+ * @throws ApiError
1135
+ */
1136
+ static healthControllerGetHealthOfDataEnhancer(data) {
1137
+ return request(OpenAPI, {
1138
+ method: "GET",
1139
+ url: "/api/v1/health/data-enhancer/{name}",
1140
+ path: {
1141
+ name: data.name,
1142
+ region: data.region
1143
+ },
1144
+ errors: {
1145
+ 401: "Unauthorized",
1146
+ 503: "Data enhancer unavailable"
1147
+ }
1148
+ });
1149
+ }
1150
+ /**
1151
+ * Check health of all data providers
1152
+ * @param data The data for the request.
1153
+ * @param data.region Region code (cn, us, eu-core, de)
1154
+ * @returns unknown Data providers health status
1155
+ * @throws ApiError
1156
+ */
1157
+ static healthControllerCheckDataProviders(data) {
1158
+ return request(OpenAPI, {
1159
+ method: "GET",
1160
+ url: "/api/v1/health/data-providers",
1161
+ path: {
1162
+ region: data.region
1163
+ },
1164
+ errors: {
1165
+ 401: "Unauthorized",
1166
+ 503: "Data providers check failed"
1167
+ }
1168
+ });
1169
+ }
1170
+ /**
1171
+ * Check health of a specific data provider
1172
+ * @param data The data for the request.
1173
+ * @param data.dataSource Data source identifier
1174
+ * @param data.region Region code (cn, us, eu-core, de)
1175
+ * @returns unknown Data provider is healthy
1176
+ * @throws ApiError
1177
+ */
1178
+ static healthControllerGetHealthOfDataProvider(data) {
1179
+ return request(OpenAPI, {
1180
+ method: "GET",
1181
+ url: "/api/v1/health/data-provider/{dataSource}",
1182
+ path: {
1183
+ dataSource: data.dataSource,
1184
+ region: data.region
1185
+ },
1186
+ errors: {
1187
+ 400: "Invalid data source",
1188
+ 401: "Unauthorized",
1189
+ 503: "Data provider unavailable"
1190
+ }
1191
+ });
1192
+ }
1193
+ };
1194
+ export {
1195
+ BeanAccountsService,
1196
+ BeanBalancesService,
1197
+ BeanCommoditiesService,
1198
+ BeanTransactionsService,
1199
+ HealthService,
1200
+ OpenAPI,
1201
+ ProviderSyncService
1202
+ };