@firela/api-types 0.0.0-canary.a7bda42 → 0.0.0-canary.b3b7767b

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 (47) hide show
  1. package/dist/index.d.mts +6619 -0
  2. package/dist/index.d.ts +6619 -2
  3. package/dist/index.js +1237 -3
  4. package/dist/index.mjs +1204 -0
  5. package/package.json +27 -13
  6. package/src/generated/core/ApiError.ts +25 -0
  7. package/src/generated/core/ApiRequestOptions.ts +20 -0
  8. package/src/generated/core/ApiResult.ts +7 -0
  9. package/src/generated/core/CancelablePromise.ts +126 -0
  10. package/src/generated/core/OpenAPI.ts +56 -0
  11. package/src/generated/core/request.ts +391 -0
  12. package/{dist/generated/index.d.ts → src/generated/index.ts} +1 -1
  13. package/src/generated/schemas.gen.ts +4918 -0
  14. package/src/generated/services.gen.ts +3361 -0
  15. package/src/generated/types.gen.ts +6887 -0
  16. package/src/index.ts +12 -0
  17. package/README.md +0 -40
  18. package/dist/generated/core/ApiError.d.ts +0 -11
  19. package/dist/generated/core/ApiError.d.ts.map +0 -1
  20. package/dist/generated/core/ApiError.js +0 -11
  21. package/dist/generated/core/ApiRequestOptions.d.ts +0 -14
  22. package/dist/generated/core/ApiRequestOptions.d.ts.map +0 -1
  23. package/dist/generated/core/ApiRequestOptions.js +0 -1
  24. package/dist/generated/core/ApiResult.d.ts +0 -8
  25. package/dist/generated/core/ApiResult.d.ts.map +0 -1
  26. package/dist/generated/core/ApiResult.js +0 -1
  27. package/dist/generated/core/CancelablePromise.d.ts +0 -27
  28. package/dist/generated/core/CancelablePromise.d.ts.map +0 -1
  29. package/dist/generated/core/CancelablePromise.js +0 -88
  30. package/dist/generated/core/OpenAPI.d.ts +0 -28
  31. package/dist/generated/core/OpenAPI.d.ts.map +0 -1
  32. package/dist/generated/core/OpenAPI.js +0 -29
  33. package/dist/generated/core/request.d.ts +0 -30
  34. package/dist/generated/core/request.d.ts.map +0 -1
  35. package/dist/generated/core/request.js +0 -297
  36. package/dist/generated/index.d.ts.map +0 -1
  37. package/dist/generated/index.js +0 -7
  38. package/dist/generated/schemas.gen.d.ts +0 -771
  39. package/dist/generated/schemas.gen.d.ts.map +0 -1
  40. package/dist/generated/schemas.gen.js +0 -771
  41. package/dist/generated/services.gen.d.ts +0 -313
  42. package/dist/generated/services.gen.d.ts.map +0 -1
  43. package/dist/generated/services.gen.js +0 -705
  44. package/dist/generated/types.gen.d.ts +0 -1159
  45. package/dist/generated/types.gen.d.ts.map +0 -1
  46. package/dist/generated/types.gen.js +0 -2
  47. package/dist/index.d.ts.map +0 -1
package/dist/index.mjs ADDED
@@ -0,0 +1,1204 @@
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
+ * @deprecated
604
+ * Create transaction (DEPRECATED)
605
+ * DEPRECATED: Use POST /:region/bean/import/provider/:name/sync instead. This endpoint skips dedup, rule matching, and review branching.
606
+ * @param data The data for the request.
607
+ * @param data.region Region code for tenant context
608
+ * @param data.requestBody Transaction data with postings
609
+ * @returns TransactionResponseDto Transaction created successfully
610
+ * @throws ApiError
611
+ */
612
+ static transactionControllerCreate(data) {
613
+ return request(OpenAPI, {
614
+ method: "POST",
615
+ url: "/api/v1/{region}/bean/transactions",
616
+ path: {
617
+ region: data.region
618
+ },
619
+ body: data.requestBody,
620
+ mediaType: "application/json",
621
+ errors: {
622
+ 400: "Validation failed",
623
+ 401: "Authentication required",
624
+ 422: "Semantic validation failed (transaction does not balance, invalid accounts)",
625
+ 500: "Unexpected server error"
626
+ }
627
+ });
628
+ }
629
+ /**
630
+ * List transactions
631
+ * Returns a paginated list of transactions with optional filters
632
+ * @param data The data for the request.
633
+ * @param data.region Region code for tenant context
634
+ * @param data.limit Number of items per page (1-100, default: 20)
635
+ * @param data.offset Number of items to skip (default: 0)
636
+ * @param data.dateFrom Filter by start date (inclusive), format: YYYY-MM-DD
637
+ * @param data.dateTo Filter by end date (inclusive), format: YYYY-MM-DD
638
+ * @param data.status Filter by transaction status
639
+ * @param data.search Search in narration and payee fields (max 200 chars)
640
+ * @param data.accountId Filter by account ID (transactions with postings to this account)
641
+ * @returns TransactionListResponseDto Transaction list
642
+ * @throws ApiError
643
+ */
644
+ static transactionControllerList(data) {
645
+ return request(OpenAPI, {
646
+ method: "GET",
647
+ url: "/api/v1/{region}/bean/transactions",
648
+ path: {
649
+ region: data.region
650
+ },
651
+ query: {
652
+ limit: data.limit,
653
+ offset: data.offset,
654
+ dateFrom: data.dateFrom,
655
+ dateTo: data.dateTo,
656
+ status: data.status,
657
+ search: data.search,
658
+ accountId: data.accountId
659
+ },
660
+ errors: {
661
+ 401: "Authentication required"
662
+ }
663
+ });
664
+ }
665
+ /**
666
+ * @param data The data for the request.
667
+ * @param data.region Region code for tenant context
668
+ * @returns unknown
669
+ * @throws ApiError
670
+ */
671
+ static transactionController(data) {
672
+ return request(OpenAPI, {
673
+ method: "POST",
674
+ url: "/api/v1/{region}/bean/transactions/batch",
675
+ path: {
676
+ region: data.region
677
+ }
678
+ });
679
+ }
680
+ /**
681
+ * Get transaction detail
682
+ * Returns transaction details including all postings
683
+ * @param data The data for the request.
684
+ * @param data.id Transaction ID
685
+ * @param data.region Region code for tenant context
686
+ * @returns TransactionDetailDto Transaction detail
687
+ * @throws ApiError
688
+ */
689
+ static transactionControllerGetDetail(data) {
690
+ return request(OpenAPI, {
691
+ method: "GET",
692
+ url: "/api/v1/{region}/bean/transactions/{id}",
693
+ path: {
694
+ id: data.id,
695
+ region: data.region
696
+ },
697
+ errors: {
698
+ 401: "Authentication required",
699
+ 404: "Transaction not found"
700
+ }
701
+ });
702
+ }
703
+ /**
704
+ * Update transaction metadata
705
+ * Updates transaction metadata (flag, payee, narration, tags, links, meta). Postings cannot be modified.
706
+ * @param data The data for the request.
707
+ * @param data.id Transaction ID
708
+ * @param data.region Region code for tenant context
709
+ * @param data.requestBody Fields to update (all optional)
710
+ * @returns TransactionDetailDto Transaction updated successfully
711
+ * @throws ApiError
712
+ */
713
+ static transactionControllerUpdate(data) {
714
+ return request(OpenAPI, {
715
+ method: "PATCH",
716
+ url: "/api/v1/{region}/bean/transactions/{id}",
717
+ path: {
718
+ id: data.id,
719
+ region: data.region
720
+ },
721
+ body: data.requestBody,
722
+ mediaType: "application/json",
723
+ errors: {
724
+ 400: "Cannot update voided transaction",
725
+ 401: "Authentication required",
726
+ 404: "Transaction not found"
727
+ }
728
+ });
729
+ }
730
+ /**
731
+ * @param data The data for the request.
732
+ * @param data.region Region code for tenant context
733
+ * @returns void
734
+ * @throws ApiError
735
+ */
736
+ static transactionController1(data) {
737
+ return request(OpenAPI, {
738
+ method: "DELETE",
739
+ url: "/api/v1/{region}/bean/transactions/{id}",
740
+ path: {
741
+ region: data.region
742
+ }
743
+ });
744
+ }
745
+ };
746
+ var BeanBalancesService = class {
747
+ /**
748
+ * Query account balance
749
+ * Calculate account balance at a specific date for a single currency
750
+ * @param data The data for the request.
751
+ * @param data.account Account name (e.g., "Assets:Bank:Checking")
752
+ * @param data.region Region code (cn, us, de)
753
+ * @param data.date Date to calculate balance at (ISO 8601 format)
754
+ * @param data.currency Currency to query (e.g., "USD", "CNY")
755
+ * @returns BalanceResponseDto Balance calculated successfully
756
+ * @throws ApiError
757
+ */
758
+ static balanceControllerGetBalance(data) {
759
+ return request(OpenAPI, {
760
+ method: "GET",
761
+ url: "/api/v1/{region}/bean/balances",
762
+ path: {
763
+ region: data.region
764
+ },
765
+ query: {
766
+ account: data.account,
767
+ date: data.date,
768
+ currency: data.currency
769
+ },
770
+ errors: {
771
+ 400: "Invalid query parameters",
772
+ 401: "User not authenticated"
773
+ }
774
+ });
775
+ }
776
+ /**
777
+ * Query multi-currency account balance
778
+ * Calculate account balances for all currencies at a specific date
779
+ * @param data The data for the request.
780
+ * @param data.region Region code (cn, us, de)
781
+ * @returns MultiCurrencyBalanceResponseDto Balances calculated successfully
782
+ * @throws ApiError
783
+ */
784
+ static balanceControllerGetMultiCurrencyBalance(data) {
785
+ return request(OpenAPI, {
786
+ method: "GET",
787
+ url: "/api/v1/{region}/bean/balances/multi-currency",
788
+ path: {
789
+ region: data.region
790
+ },
791
+ errors: {
792
+ 400: "Invalid query parameters",
793
+ 401: "User not authenticated"
794
+ }
795
+ });
796
+ }
797
+ };
798
+ var BeanCommoditiesService = class {
799
+ /**
800
+ * @param data The data for the request.
801
+ * @param data.region Region code (cn, us, de)
802
+ * @returns unknown
803
+ * @throws ApiError
804
+ */
805
+ static commodityController(data) {
806
+ return request(OpenAPI, {
807
+ method: "POST",
808
+ url: "/api/v1/{region}/bean/commodities",
809
+ path: {
810
+ region: data.region
811
+ }
812
+ });
813
+ }
814
+ /**
815
+ * List user commodities
816
+ * Returns all commodity definitions for the authenticated user with optional filtering
817
+ * @param data The data for the request.
818
+ * @param data.region Region code (cn, us, de)
819
+ * @param data.search Search term for symbol or metadata fields (partial match). Searches symbol and metadata.name.
820
+ * @param data.symbol Filter by exact symbol match
821
+ * @returns CommodityListResponseDto Commodities retrieved successfully
822
+ * @throws ApiError
823
+ */
824
+ static commodityControllerFindAll(data) {
825
+ return request(OpenAPI, {
826
+ method: "GET",
827
+ url: "/api/v1/{region}/bean/commodities",
828
+ path: {
829
+ region: data.region
830
+ },
831
+ query: {
832
+ search: data.search,
833
+ symbol: data.symbol
834
+ }
835
+ });
836
+ }
837
+ /**
838
+ * Get commodity by symbol
839
+ * Returns a specific commodity definition by its symbol
840
+ * @param data The data for the request.
841
+ * @param data.symbol Commodity symbol
842
+ * @param data.region Region code (cn, us, de)
843
+ * @returns CommodityResponseDto Commodity retrieved successfully
844
+ * @throws ApiError
845
+ */
846
+ static commodityControllerFindOne(data) {
847
+ return request(OpenAPI, {
848
+ method: "GET",
849
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
850
+ path: {
851
+ symbol: data.symbol,
852
+ region: data.region
853
+ },
854
+ errors: {
855
+ 404: "Commodity not found"
856
+ }
857
+ });
858
+ }
859
+ /**
860
+ * @param data The data for the request.
861
+ * @param data.region Region code (cn, us, de)
862
+ * @returns unknown
863
+ * @throws ApiError
864
+ */
865
+ static commodityController1(data) {
866
+ return request(OpenAPI, {
867
+ method: "PUT",
868
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
869
+ path: {
870
+ region: data.region
871
+ }
872
+ });
873
+ }
874
+ /**
875
+ * @param data The data for the request.
876
+ * @param data.region Region code (cn, us, de)
877
+ * @returns void
878
+ * @throws ApiError
879
+ */
880
+ static commodityController2(data) {
881
+ return request(OpenAPI, {
882
+ method: "DELETE",
883
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
884
+ path: {
885
+ region: data.region
886
+ }
887
+ });
888
+ }
889
+ /**
890
+ * @param data The data for the request.
891
+ * @param data.region Region code (cn, us, de)
892
+ * @returns unknown
893
+ * @throws ApiError
894
+ */
895
+ static commodityController3(data) {
896
+ return request(OpenAPI, {
897
+ method: "POST",
898
+ url: "/api/v1/{region}/bean/commodities/{symbol}/ensure",
899
+ path: {
900
+ region: data.region
901
+ }
902
+ });
903
+ }
904
+ /**
905
+ * @param data The data for the request.
906
+ * @param data.region Region code (cn, us, de)
907
+ * @returns unknown
908
+ * @throws ApiError
909
+ */
910
+ static commodityController4(data) {
911
+ return request(OpenAPI, {
912
+ method: "POST",
913
+ url: "/api/v1/{region}/bean/commodities/bulk",
914
+ path: {
915
+ region: data.region
916
+ }
917
+ });
918
+ }
919
+ };
920
+ var ProviderSyncService = class {
921
+ /**
922
+ * Sync transactions from financial data provider
923
+ *
924
+ * Accepts raw transactions from external financial data providers, transforms them to Beancount format, and processes them through the ingestion pipeline.
925
+ *
926
+ * **Supported Providers:**
927
+ * - **plaid**: Plaid API (US, Canada, Europe)
928
+ * - **teller**: Teller API (US)
929
+ * - **truelayer**: TrueLayer Open Banking (UK, Europe)
930
+ * - **gocardless**: GoCardless Bank Account Data (Europe)
931
+ * - **simplefin**: SimpleFIN (Self-hosted)
932
+ * - **yodlee**: Yodlee (Global)
933
+ * - **beancount-direct**: Beancount format transactions
934
+ * - **parsed-bill**: Client-side parsed bill transactions
935
+ *
936
+ * **Processing Flow:**
937
+ * 1. Transform raw data via provider adapter
938
+ * 2. Validate transaction format
939
+ * 3. Deduplicate using originalId
940
+ * 4. Classify using rule engine
941
+ * 5. Route low-confidence to Review Center
942
+ * 6. Persist validated transactions
943
+ *
944
+ * @param data The data for the request.
945
+ * @param data.providerName Provider name
946
+ * @param data.region Region code
947
+ * @param data.requestBody
948
+ * @returns ProviderSyncResponseDto Sync completed successfully
949
+ * @throws ApiError
950
+ */
951
+ static providerSyncControllerSync(data) {
952
+ return request(OpenAPI, {
953
+ method: "POST",
954
+ url: "/api/v1/{region}/bean/import/provider/{providerName}/sync",
955
+ path: {
956
+ providerName: data.providerName,
957
+ region: data.region
958
+ },
959
+ body: data.requestBody,
960
+ mediaType: "application/json",
961
+ errors: {
962
+ 400: "Invalid request data",
963
+ 401: "Missing or invalid authentication",
964
+ 404: "Provider not supported"
965
+ }
966
+ });
967
+ }
968
+ /**
969
+ * Get supported providers
970
+ * Returns a list of all providers supported by the sync endpoint.
971
+ * @param data The data for the request.
972
+ * @param data.region Region code (cn, us, de)
973
+ * @returns SupportedProvidersResponseDto List of supported providers
974
+ * @throws ApiError
975
+ */
976
+ static providerSyncControllerGetSupportedProviders(data) {
977
+ return request(OpenAPI, {
978
+ method: "GET",
979
+ url: "/api/v1/{region}/bean/import/provider/supported",
980
+ path: {
981
+ region: data.region
982
+ },
983
+ errors: {
984
+ 401: "Missing or invalid authentication"
985
+ }
986
+ });
987
+ }
988
+ /**
989
+ * Check if provider is supported
990
+ * Returns whether a specific provider is supported.
991
+ * @param data The data for the request.
992
+ * @param data.providerName Provider name to check
993
+ * @param data.region Region code (cn, us, de)
994
+ * @returns unknown Provider support status
995
+ * @throws ApiError
996
+ */
997
+ static providerSyncControllerIsProviderSupported(data) {
998
+ return request(OpenAPI, {
999
+ method: "GET",
1000
+ url: "/api/v1/{region}/bean/import/provider/{providerName}/supported",
1001
+ path: {
1002
+ providerName: data.providerName,
1003
+ region: data.region
1004
+ },
1005
+ errors: {
1006
+ 401: "Missing or invalid authentication"
1007
+ }
1008
+ });
1009
+ }
1010
+ };
1011
+ var HealthService = class {
1012
+ /**
1013
+ * Basic health check for K8s/load balancer probes
1014
+ * @param data The data for the request.
1015
+ * @param data.region Region code (cn, us, de)
1016
+ * @returns unknown Service is healthy
1017
+ * @throws ApiError
1018
+ */
1019
+ static healthControllerGetHealth(data) {
1020
+ return request(OpenAPI, {
1021
+ method: "GET",
1022
+ url: "/api/v1/health",
1023
+ path: {
1024
+ region: data.region
1025
+ },
1026
+ errors: {
1027
+ 503: "Service unavailable"
1028
+ }
1029
+ });
1030
+ }
1031
+ /**
1032
+ * Check database connection health
1033
+ * @param data The data for the request.
1034
+ * @param data.region Region code (cn, us, de)
1035
+ * @returns unknown Database is healthy
1036
+ * @throws ApiError
1037
+ */
1038
+ static healthControllerCheckDatabase(data) {
1039
+ return request(OpenAPI, {
1040
+ method: "GET",
1041
+ url: "/api/v1/health/database",
1042
+ path: {
1043
+ region: data.region
1044
+ },
1045
+ errors: {
1046
+ 503: "Database unavailable"
1047
+ }
1048
+ });
1049
+ }
1050
+ /**
1051
+ * Check Redis connection health
1052
+ * @param data The data for the request.
1053
+ * @param data.region Region code (cn, us, de)
1054
+ * @returns unknown Redis is healthy
1055
+ * @throws ApiError
1056
+ */
1057
+ static healthControllerCheckRedis(data) {
1058
+ return request(OpenAPI, {
1059
+ method: "GET",
1060
+ url: "/api/v1/health/redis",
1061
+ path: {
1062
+ region: data.region
1063
+ },
1064
+ errors: {
1065
+ 503: "Redis unavailable"
1066
+ }
1067
+ });
1068
+ }
1069
+ /**
1070
+ * Get status of all circuit breakers
1071
+ * @param data The data for the request.
1072
+ * @param data.region Region code (cn, us, de)
1073
+ * @returns unknown Circuit breaker status
1074
+ * @throws ApiError
1075
+ */
1076
+ static healthControllerGetCircuitBreakersHealth(data) {
1077
+ return request(OpenAPI, {
1078
+ method: "GET",
1079
+ url: "/api/v1/health/circuit-breakers",
1080
+ path: {
1081
+ region: data.region
1082
+ },
1083
+ errors: {
1084
+ 401: "Unauthorized",
1085
+ 500: "Internal error"
1086
+ }
1087
+ });
1088
+ }
1089
+ /**
1090
+ * Reset a circuit breaker to CLOSED state
1091
+ * @param data The data for the request.
1092
+ * @param data.name Circuit breaker name to reset
1093
+ * @param data.region Region code (cn, us, de)
1094
+ * @returns unknown Circuit breaker reset successfully
1095
+ * @throws ApiError
1096
+ */
1097
+ static healthControllerResetCircuitBreaker(data) {
1098
+ return request(OpenAPI, {
1099
+ method: "POST",
1100
+ url: "/api/v1/health/circuit-breakers/{name}/reset",
1101
+ path: {
1102
+ name: data.name,
1103
+ region: data.region
1104
+ },
1105
+ errors: {
1106
+ 401: "Unauthorized",
1107
+ 404: "Circuit breaker not found"
1108
+ }
1109
+ });
1110
+ }
1111
+ /**
1112
+ * Get health check metrics and statistics
1113
+ * @param data The data for the request.
1114
+ * @param data.region Region code (cn, us, de)
1115
+ * @returns unknown Health metrics
1116
+ * @throws ApiError
1117
+ */
1118
+ static healthControllerGetMetrics(data) {
1119
+ return request(OpenAPI, {
1120
+ method: "GET",
1121
+ url: "/api/v1/health/metrics",
1122
+ path: {
1123
+ region: data.region
1124
+ },
1125
+ errors: {
1126
+ 401: "Unauthorized"
1127
+ }
1128
+ });
1129
+ }
1130
+ /**
1131
+ * Check health of a specific data enhancer
1132
+ * @param data The data for the request.
1133
+ * @param data.name Data enhancer name
1134
+ * @param data.region Region code (cn, us, de)
1135
+ * @returns unknown Data enhancer is healthy
1136
+ * @throws ApiError
1137
+ */
1138
+ static healthControllerGetHealthOfDataEnhancer(data) {
1139
+ return request(OpenAPI, {
1140
+ method: "GET",
1141
+ url: "/api/v1/health/data-enhancer/{name}",
1142
+ path: {
1143
+ name: data.name,
1144
+ region: data.region
1145
+ },
1146
+ errors: {
1147
+ 401: "Unauthorized",
1148
+ 503: "Data enhancer unavailable"
1149
+ }
1150
+ });
1151
+ }
1152
+ /**
1153
+ * Check health of all data providers
1154
+ * @param data The data for the request.
1155
+ * @param data.region Region code (cn, us, de)
1156
+ * @returns unknown Data providers health status
1157
+ * @throws ApiError
1158
+ */
1159
+ static healthControllerCheckDataProviders(data) {
1160
+ return request(OpenAPI, {
1161
+ method: "GET",
1162
+ url: "/api/v1/health/data-providers",
1163
+ path: {
1164
+ region: data.region
1165
+ },
1166
+ errors: {
1167
+ 401: "Unauthorized",
1168
+ 503: "Data providers check failed"
1169
+ }
1170
+ });
1171
+ }
1172
+ /**
1173
+ * Check health of a specific data provider
1174
+ * @param data The data for the request.
1175
+ * @param data.dataSource Data source identifier
1176
+ * @param data.region Region code (cn, us, de)
1177
+ * @returns unknown Data provider is healthy
1178
+ * @throws ApiError
1179
+ */
1180
+ static healthControllerGetHealthOfDataProvider(data) {
1181
+ return request(OpenAPI, {
1182
+ method: "GET",
1183
+ url: "/api/v1/health/data-provider/{dataSource}",
1184
+ path: {
1185
+ dataSource: data.dataSource,
1186
+ region: data.region
1187
+ },
1188
+ errors: {
1189
+ 400: "Invalid data source",
1190
+ 401: "Unauthorized",
1191
+ 503: "Data provider unavailable"
1192
+ }
1193
+ });
1194
+ }
1195
+ };
1196
+ export {
1197
+ BeanAccountsService,
1198
+ BeanBalancesService,
1199
+ BeanCommoditiesService,
1200
+ BeanTransactionsService,
1201
+ HealthService,
1202
+ OpenAPI,
1203
+ ProviderSyncService
1204
+ };