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