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

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 +10166 -0
  2. package/dist/index.d.ts +10166 -2
  3. package/dist/index.js +1298 -3
  4. package/dist/index.mjs +1265 -0
  5. package/package.json +25 -12
  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 +9423 -0
  14. package/src/generated/services.gen.ts +4411 -0
  15. package/src/generated/types.gen.ts +31791 -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,1265 @@
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 matched against account path and user-set display name (case-insensitive)
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 active transactions; voided/superseded residual postings are cleaned up)
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 active 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
+ * Post an opening-balance transaction
602
+ * Posts a double-entry opening-balance transaction against Equity:Opening-Balances for an existing Assets/Liabilities account. At most one active opening balance per account.
603
+ * @param data The data for the request.
604
+ * @param data.id Account UUID
605
+ * @param data.region Region code for tenant context
606
+ * @param data.requestBody
607
+ * @returns OpeningBalanceResultDto Opening-balance transaction created
608
+ * @throws ApiError
609
+ */
610
+ static accountControllerAddOpeningBalance(data) {
611
+ return request(OpenAPI, {
612
+ method: "POST",
613
+ url: "/api/v1/{region}/bean/accounts/{id}/opening-balance",
614
+ path: {
615
+ id: data.id,
616
+ region: data.region
617
+ },
618
+ body: data.requestBody,
619
+ mediaType: "application/json",
620
+ errors: {
621
+ 404: "Account not found",
622
+ 409: "An opening balance already exists for this account"
623
+ }
624
+ });
625
+ }
626
+ };
627
+ var BeanTransactionsService = class {
628
+ /**
629
+ * @deprecated
630
+ * Create transaction (DEPRECATED)
631
+ * DEPRECATED: Use POST /:region/bean/import/provider/:name/sync instead. This endpoint skips dedup, rule matching, and review branching.
632
+ * @param data The data for the request.
633
+ * @param data.region Region code for tenant context
634
+ * @param data.requestBody Transaction data with postings
635
+ * @returns TransactionResponseDto Transaction created successfully
636
+ * @throws ApiError
637
+ */
638
+ static transactionControllerCreate(data) {
639
+ return request(OpenAPI, {
640
+ method: "POST",
641
+ url: "/api/v1/{region}/bean/transactions",
642
+ path: {
643
+ region: data.region
644
+ },
645
+ body: data.requestBody,
646
+ mediaType: "application/json",
647
+ errors: {
648
+ 400: "Validation failed",
649
+ 401: "Authentication required",
650
+ 422: "Semantic validation failed (transaction does not balance, invalid accounts)",
651
+ 500: "Unexpected server error"
652
+ }
653
+ });
654
+ }
655
+ /**
656
+ * List transactions
657
+ * Returns a paginated list of transactions with optional filters
658
+ * @param data The data for the request.
659
+ * @param data.region Region code for tenant context
660
+ * @param data.limit Number of items per page (1-100, default: 20)
661
+ * @param data.offset Number of items to skip (default: 0)
662
+ * @param data.dateFrom Filter by start date (inclusive), format: YYYY-MM-DD
663
+ * @param data.dateTo Filter by end date (inclusive), format: YYYY-MM-DD
664
+ * @param data.status Filter by transaction status: single value, comma-separated multi-value (e.g. VOIDED,SUPERSEDED), or ALL to include audit rows. Defaults to ACTIVE-only (ADR-0128; previously unfiltered — breaking change).
665
+ * @param data.search Search in narration and payee fields (max 200 chars)
666
+ * @param data.accountId Filter by account ID (transactions with postings to this account)
667
+ * @param data.category Filter by ADR-0075 functional category (Group segment); matches any posting to an account whose derived Group segment equals this value. Must be accompanied by flow (ADR-0126).
668
+ * @param data.flow Required when category is present (400 otherwise) and vice versa (ADR-0126). Restricts the category account set to the flow root (income → Income:, expense → Expenses:) and drives the per-leg sign normalization of row viewpointAmount and the summary. OpenAPI cannot express conditional requiredness — the pairing is enforced at runtime.
669
+ * @returns TransactionListResponseDto Transaction list
670
+ * @throws ApiError
671
+ */
672
+ static transactionControllerList(data) {
673
+ return request(OpenAPI, {
674
+ method: "GET",
675
+ url: "/api/v1/{region}/bean/transactions",
676
+ path: {
677
+ region: data.region
678
+ },
679
+ query: {
680
+ limit: data.limit,
681
+ offset: data.offset,
682
+ dateFrom: data.dateFrom,
683
+ dateTo: data.dateTo,
684
+ status: data.status,
685
+ search: data.search,
686
+ accountId: data.accountId,
687
+ category: data.category,
688
+ flow: data.flow
689
+ },
690
+ errors: {
691
+ 400: "Validation failed",
692
+ 401: "Authentication required"
693
+ }
694
+ });
695
+ }
696
+ /**
697
+ * @deprecated
698
+ * Batch create transactions (DEPRECATED)
699
+ * DEPRECATED: Use POST /:region/bean/import/provider/:name/sync instead. This endpoint skips dedup, rule matching, and review branching.
700
+ * @param data The data for the request.
701
+ * @param data.region Region code for tenant context
702
+ * @param data.requestBody
703
+ * @returns BatchTransactionResponseDto Transactions processed
704
+ * @throws ApiError
705
+ */
706
+ static transactionControllerCreateBatch(data) {
707
+ return request(OpenAPI, {
708
+ method: "POST",
709
+ url: "/api/v1/{region}/bean/transactions/batch",
710
+ path: {
711
+ region: data.region
712
+ },
713
+ body: data.requestBody,
714
+ mediaType: "application/json",
715
+ errors: {
716
+ 400: "Invalid input",
717
+ 401: "Authentication required"
718
+ }
719
+ });
720
+ }
721
+ /**
722
+ * Correct (supersede) a transaction
723
+ * Atomically voids the original (SUPERSEDED) and creates a replacement through the full validation pipeline.
724
+ * @param data The data for the request.
725
+ * @param data.id Original transaction ID to correct
726
+ * @param data.region Region code for tenant context
727
+ * @param data.requestBody
728
+ * @returns TransactionDetailDto Corrected transaction created
729
+ * @throws ApiError
730
+ */
731
+ static transactionControllerCorrect(data) {
732
+ return request(OpenAPI, {
733
+ method: "POST",
734
+ url: "/api/v1/{region}/bean/transactions/{id}/correct",
735
+ path: {
736
+ id: data.id,
737
+ region: data.region
738
+ },
739
+ body: data.requestBody,
740
+ mediaType: "application/json",
741
+ errors: {
742
+ 404: "Original transaction not found",
743
+ 409: "Original no longer ACTIVE (concurrent modification)",
744
+ 422: "Pipeline validation failed (does not balance, invalid accounts)"
745
+ }
746
+ });
747
+ }
748
+ /**
749
+ * Suggest transaction tags
750
+ * Returns distinct tags from the user ACTIVE transactions, sorted by usage, for autocomplete. Optional q performs a case-insensitive prefix match.
751
+ * @param data The data for the request.
752
+ * @param data.region Region code for tenant context
753
+ * @param data.q Prefix match, case-insensitive (max 50 chars)
754
+ * @param data.sort usage (default) or name
755
+ * @param data.limit Max suggestions (1-100, default 10)
756
+ * @returns TagSuggestionsResponseDto Tag suggestions
757
+ * @throws ApiError
758
+ */
759
+ static transactionControllerSuggestTags(data) {
760
+ return request(OpenAPI, {
761
+ method: "GET",
762
+ url: "/api/v1/{region}/bean/transactions/tags",
763
+ path: {
764
+ region: data.region
765
+ },
766
+ query: {
767
+ q: data.q,
768
+ sort: data.sort,
769
+ limit: data.limit
770
+ },
771
+ errors: {
772
+ 400: "Validation failed",
773
+ 401: "Authentication required"
774
+ }
775
+ });
776
+ }
777
+ /**
778
+ * Get transaction detail
779
+ * Returns transaction details including all postings
780
+ * @param data The data for the request.
781
+ * @param data.id Transaction ID
782
+ * @param data.region Region code for tenant context
783
+ * @returns TransactionDetailDto Transaction detail
784
+ * @throws ApiError
785
+ */
786
+ static transactionControllerGetDetail(data) {
787
+ return request(OpenAPI, {
788
+ method: "GET",
789
+ url: "/api/v1/{region}/bean/transactions/{id}",
790
+ path: {
791
+ id: data.id,
792
+ region: data.region
793
+ },
794
+ errors: {
795
+ 401: "Authentication required",
796
+ 404: "Transaction not found"
797
+ }
798
+ });
799
+ }
800
+ /**
801
+ * Update transaction metadata
802
+ * Updates transaction metadata (flag, payee, narration, tags, links, meta). Postings cannot be modified.
803
+ * @param data The data for the request.
804
+ * @param data.id Transaction ID
805
+ * @param data.region Region code for tenant context
806
+ * @param data.requestBody Fields to update (all optional)
807
+ * @returns TransactionDetailDto Transaction updated successfully
808
+ * @throws ApiError
809
+ */
810
+ static transactionControllerUpdate(data) {
811
+ return request(OpenAPI, {
812
+ method: "PATCH",
813
+ url: "/api/v1/{region}/bean/transactions/{id}",
814
+ path: {
815
+ id: data.id,
816
+ region: data.region
817
+ },
818
+ body: data.requestBody,
819
+ mediaType: "application/json",
820
+ errors: {
821
+ 400: "Cannot update voided transaction",
822
+ 401: "Authentication required",
823
+ 404: "Transaction not found"
824
+ }
825
+ });
826
+ }
827
+ /**
828
+ * Void transaction
829
+ * Soft-deletes a transaction by marking it as VOIDED
830
+ * @param data The data for the request.
831
+ * @param data.id Transaction ID
832
+ * @param data.region Region code for tenant context
833
+ * @returns void Transaction voided successfully
834
+ * @throws ApiError
835
+ */
836
+ static transactionControllerDelete(data) {
837
+ return request(OpenAPI, {
838
+ method: "DELETE",
839
+ url: "/api/v1/{region}/bean/transactions/{id}",
840
+ path: {
841
+ id: data.id,
842
+ region: data.region
843
+ },
844
+ errors: {
845
+ 400: "Transaction already voided",
846
+ 401: "Authentication required",
847
+ 404: "Transaction not found"
848
+ }
849
+ });
850
+ }
851
+ };
852
+ var BeanBalancesService = class {
853
+ /**
854
+ * Query account balance
855
+ * Calculate account balance at a specific date for a single currency
856
+ * @param data The data for the request.
857
+ * @param data.account Account name (e.g., "Assets:Checking")
858
+ * @param data.region Region code for tenant context
859
+ * @param data.date Date to calculate balance at (ISO 8601 format)
860
+ * @param data.currency Currency to query (e.g., "USD", "CNY")
861
+ * @returns BalanceResponseDto Balance calculated successfully
862
+ * @throws ApiError
863
+ */
864
+ static balanceControllerGetBalance(data) {
865
+ return request(OpenAPI, {
866
+ method: "GET",
867
+ url: "/api/v1/{region}/bean/balances",
868
+ path: {
869
+ region: data.region
870
+ },
871
+ query: {
872
+ account: data.account,
873
+ date: data.date,
874
+ currency: data.currency
875
+ },
876
+ errors: {
877
+ 400: "Invalid query parameters",
878
+ 401: "User not authenticated"
879
+ }
880
+ });
881
+ }
882
+ /**
883
+ * Query multi-currency account balance
884
+ * Calculate account balances for all currencies at a specific date
885
+ * @param data The data for the request.
886
+ * @param data.region Region code for tenant context
887
+ * @returns MultiCurrencyBalanceResponseDto Balances calculated successfully
888
+ * @throws ApiError
889
+ */
890
+ static balanceControllerGetMultiCurrencyBalance(data) {
891
+ return request(OpenAPI, {
892
+ method: "GET",
893
+ url: "/api/v1/{region}/bean/balances/multi-currency",
894
+ path: {
895
+ region: data.region
896
+ },
897
+ errors: {
898
+ 400: "Invalid query parameters",
899
+ 401: "User not authenticated"
900
+ }
901
+ });
902
+ }
903
+ };
904
+ var BeanCommoditiesService = class {
905
+ /**
906
+ * Create a new commodity
907
+ * Creates a new commodity definition for the authenticated user
908
+ * @param data The data for the request.
909
+ * @param data.region Region code for tenant context
910
+ * @param data.requestBody
911
+ * @returns CommodityResponseDto Commodity created successfully
912
+ * @throws ApiError
913
+ */
914
+ static commodityControllerCreate(data) {
915
+ return request(OpenAPI, {
916
+ method: "POST",
917
+ url: "/api/v1/{region}/bean/commodities",
918
+ path: {
919
+ region: data.region
920
+ },
921
+ body: data.requestBody,
922
+ mediaType: "application/json",
923
+ errors: {
924
+ 400: "Invalid input data",
925
+ 409: "Commodity already exists"
926
+ }
927
+ });
928
+ }
929
+ /**
930
+ * List user commodities
931
+ * Returns all commodity definitions for the authenticated user with optional filtering
932
+ * @param data The data for the request.
933
+ * @param data.region Region code for tenant context
934
+ * @param data.search Search term for symbol or metadata fields (partial match). Searches symbol and metadata.name.
935
+ * @param data.symbol Filter by exact symbol match
936
+ * @returns CommodityListResponseDto Commodities retrieved successfully
937
+ * @throws ApiError
938
+ */
939
+ static commodityControllerFindAll(data) {
940
+ return request(OpenAPI, {
941
+ method: "GET",
942
+ url: "/api/v1/{region}/bean/commodities",
943
+ path: {
944
+ region: data.region
945
+ },
946
+ query: {
947
+ search: data.search,
948
+ symbol: data.symbol
949
+ }
950
+ });
951
+ }
952
+ /**
953
+ * Get commodity by symbol
954
+ * Returns a specific commodity definition by its symbol
955
+ * @param data The data for the request.
956
+ * @param data.symbol Commodity symbol
957
+ * @param data.region Region code for tenant context
958
+ * @returns CommodityResponseDto Commodity retrieved successfully
959
+ * @throws ApiError
960
+ */
961
+ static commodityControllerFindOne(data) {
962
+ return request(OpenAPI, {
963
+ method: "GET",
964
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
965
+ path: {
966
+ symbol: data.symbol,
967
+ region: data.region
968
+ },
969
+ errors: {
970
+ 404: "Commodity not found"
971
+ }
972
+ });
973
+ }
974
+ /**
975
+ * Update commodity
976
+ * Updates an existing commodity definition. Symbol cannot be changed.
977
+ * @param data The data for the request.
978
+ * @param data.symbol Commodity symbol
979
+ * @param data.region Region code for tenant context
980
+ * @param data.requestBody
981
+ * @returns CommodityResponseDto Commodity updated successfully
982
+ * @throws ApiError
983
+ */
984
+ static commodityControllerUpdate(data) {
985
+ return request(OpenAPI, {
986
+ method: "PUT",
987
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
988
+ path: {
989
+ symbol: data.symbol,
990
+ region: data.region
991
+ },
992
+ body: data.requestBody,
993
+ mediaType: "application/json",
994
+ errors: {
995
+ 400: "Invalid input data",
996
+ 404: "Commodity not found"
997
+ }
998
+ });
999
+ }
1000
+ /**
1001
+ * Delete commodity
1002
+ * Deletes a commodity definition
1003
+ * @param data The data for the request.
1004
+ * @param data.symbol Commodity symbol
1005
+ * @param data.region Region code for tenant context
1006
+ * @returns void Commodity deleted successfully
1007
+ * @throws ApiError
1008
+ */
1009
+ static commodityControllerDelete(data) {
1010
+ return request(OpenAPI, {
1011
+ method: "DELETE",
1012
+ url: "/api/v1/{region}/bean/commodities/{symbol}",
1013
+ path: {
1014
+ symbol: data.symbol,
1015
+ region: data.region
1016
+ },
1017
+ errors: {
1018
+ 404: "Commodity not found"
1019
+ }
1020
+ });
1021
+ }
1022
+ /**
1023
+ * Ensure commodity exists
1024
+ * Gets existing commodity or creates it with automatic initialization from OpenBB
1025
+ * @param data The data for the request.
1026
+ * @param data.symbol Commodity symbol
1027
+ * @param data.region Region code for tenant context
1028
+ * @returns CommodityResponseDto Commodity retrieved or created
1029
+ * @throws ApiError
1030
+ */
1031
+ static commodityControllerGetOrCreate(data) {
1032
+ return request(OpenAPI, {
1033
+ method: "POST",
1034
+ url: "/api/v1/{region}/bean/commodities/{symbol}/ensure",
1035
+ path: {
1036
+ symbol: data.symbol,
1037
+ region: data.region
1038
+ }
1039
+ });
1040
+ }
1041
+ /**
1042
+ * Bulk create commodities
1043
+ * Creates multiple commodities from a list of symbols, useful for initialization
1044
+ * @param data The data for the request.
1045
+ * @param data.region Region code for tenant context
1046
+ * @returns CommodityResponseDto Commodities created successfully
1047
+ * @throws ApiError
1048
+ */
1049
+ static commodityControllerBulkCreate(data) {
1050
+ return request(OpenAPI, {
1051
+ method: "POST",
1052
+ url: "/api/v1/{region}/bean/commodities/bulk",
1053
+ path: {
1054
+ region: data.region
1055
+ }
1056
+ });
1057
+ }
1058
+ };
1059
+ var ProviderSyncService = class {
1060
+ /**
1061
+ * Sync transactions from financial data provider
1062
+ *
1063
+ * Accepts raw transactions from external financial data providers, transforms them to Beancount format, and processes them through the ingestion pipeline.
1064
+ *
1065
+ * **Supported Providers:**
1066
+ * - **plaid**: Plaid API (US, Canada, Europe)
1067
+ * - **teller**: Teller API (US)
1068
+ * - **truelayer**: TrueLayer Open Banking (UK, Europe)
1069
+ * - **gocardless**: GoCardless Bank Account Data (Europe)
1070
+ * - **simplefin**: SimpleFIN (Self-hosted)
1071
+ * - **yodlee**: Yodlee (Global)
1072
+ * - **beancount-direct**: Beancount format transactions
1073
+ * - **parsed-bill**: Client-side parsed bill transactions
1074
+ *
1075
+ * **Processing Flow:**
1076
+ * 1. Transform raw data via provider adapter
1077
+ * 2. Validate transaction format
1078
+ * 3. Deduplicate using originalId
1079
+ * 4. Classify using rule engine
1080
+ * 5. Route low-confidence to Review Center
1081
+ * 6. Persist validated transactions
1082
+ *
1083
+ * @param data The data for the request.
1084
+ * @param data.providerName Provider name
1085
+ * @param data.region Region code for tenant context
1086
+ * @param data.requestBody
1087
+ * @returns ProviderSyncResponseDto Sync completed successfully
1088
+ * @throws ApiError
1089
+ */
1090
+ static providerSyncControllerSync(data) {
1091
+ return request(OpenAPI, {
1092
+ method: "POST",
1093
+ url: "/api/v1/{region}/bean/import/provider/{providerName}/sync",
1094
+ path: {
1095
+ providerName: data.providerName,
1096
+ region: data.region
1097
+ },
1098
+ body: data.requestBody,
1099
+ mediaType: "application/json",
1100
+ errors: {
1101
+ 400: "Invalid request data",
1102
+ 401: "Missing or invalid authentication",
1103
+ 404: "Provider not supported"
1104
+ }
1105
+ });
1106
+ }
1107
+ /**
1108
+ * Get supported providers
1109
+ * Returns a list of all providers supported by the sync endpoint.
1110
+ * @param data The data for the request.
1111
+ * @param data.region Region code for tenant context
1112
+ * @returns SupportedProvidersResponseDto List of supported providers
1113
+ * @throws ApiError
1114
+ */
1115
+ static providerSyncControllerGetSupportedProviders(data) {
1116
+ return request(OpenAPI, {
1117
+ method: "GET",
1118
+ url: "/api/v1/{region}/bean/import/provider/supported",
1119
+ path: {
1120
+ region: data.region
1121
+ },
1122
+ errors: {
1123
+ 401: "Missing or invalid authentication"
1124
+ }
1125
+ });
1126
+ }
1127
+ /**
1128
+ * Check if provider is supported
1129
+ * Returns whether a specific provider is supported.
1130
+ * @param data The data for the request.
1131
+ * @param data.providerName Provider name to check
1132
+ * @param data.region Region code for tenant context
1133
+ * @returns unknown Provider support status
1134
+ * @throws ApiError
1135
+ */
1136
+ static providerSyncControllerIsProviderSupported(data) {
1137
+ return request(OpenAPI, {
1138
+ method: "GET",
1139
+ url: "/api/v1/{region}/bean/import/provider/{providerName}/supported",
1140
+ path: {
1141
+ providerName: data.providerName,
1142
+ region: data.region
1143
+ },
1144
+ errors: {
1145
+ 401: "Missing or invalid authentication"
1146
+ }
1147
+ });
1148
+ }
1149
+ };
1150
+ var HealthService = class {
1151
+ /**
1152
+ * Basic health check for K8s/load balancer probes
1153
+ * @returns unknown Service is healthy
1154
+ * @throws ApiError
1155
+ */
1156
+ static healthControllerGetHealth() {
1157
+ return request(OpenAPI, {
1158
+ method: "GET",
1159
+ url: "/api/v1/health",
1160
+ errors: {
1161
+ 503: "Service unavailable"
1162
+ }
1163
+ });
1164
+ }
1165
+ /**
1166
+ * Check database connection health
1167
+ * @returns unknown Database is healthy
1168
+ * @throws ApiError
1169
+ */
1170
+ static healthControllerCheckDatabase() {
1171
+ return request(OpenAPI, {
1172
+ method: "GET",
1173
+ url: "/api/v1/health/database",
1174
+ errors: {
1175
+ 503: "Database unavailable"
1176
+ }
1177
+ });
1178
+ }
1179
+ /**
1180
+ * Check OpenBB schema status
1181
+ * @returns unknown OpenBB status
1182
+ * @throws ApiError
1183
+ */
1184
+ static healthControllerCheckOpenBb() {
1185
+ return request(OpenAPI, {
1186
+ method: "GET",
1187
+ url: "/api/v1/health/openbb",
1188
+ errors: {
1189
+ 503: "OpenBB unavailable"
1190
+ }
1191
+ });
1192
+ }
1193
+ /**
1194
+ * Check Redis connection health
1195
+ * @returns unknown Redis is healthy
1196
+ * @throws ApiError
1197
+ */
1198
+ static healthControllerCheckRedis() {
1199
+ return request(OpenAPI, {
1200
+ method: "GET",
1201
+ url: "/api/v1/health/redis",
1202
+ errors: {
1203
+ 503: "Redis unavailable"
1204
+ }
1205
+ });
1206
+ }
1207
+ /**
1208
+ * Get status of all circuit breakers
1209
+ * @returns unknown Circuit breaker status
1210
+ * @throws ApiError
1211
+ */
1212
+ static healthControllerGetCircuitBreakersHealth() {
1213
+ return request(OpenAPI, {
1214
+ method: "GET",
1215
+ url: "/api/v1/health/circuit-breakers",
1216
+ errors: {
1217
+ 401: "Unauthorized",
1218
+ 500: "Internal error"
1219
+ }
1220
+ });
1221
+ }
1222
+ /**
1223
+ * Reset a circuit breaker to CLOSED state
1224
+ * @param data The data for the request.
1225
+ * @param data.name Circuit breaker name to reset
1226
+ * @returns unknown Circuit breaker reset successfully
1227
+ * @throws ApiError
1228
+ */
1229
+ static healthControllerResetCircuitBreaker(data) {
1230
+ return request(OpenAPI, {
1231
+ method: "POST",
1232
+ url: "/api/v1/health/circuit-breakers/{name}/reset",
1233
+ path: {
1234
+ name: data.name
1235
+ },
1236
+ errors: {
1237
+ 401: "Unauthorized",
1238
+ 404: "Circuit breaker not found"
1239
+ }
1240
+ });
1241
+ }
1242
+ /**
1243
+ * Get health check metrics and statistics
1244
+ * @returns unknown Health metrics
1245
+ * @throws ApiError
1246
+ */
1247
+ static healthControllerGetMetrics() {
1248
+ return request(OpenAPI, {
1249
+ method: "GET",
1250
+ url: "/api/v1/health/metrics",
1251
+ errors: {
1252
+ 401: "Unauthorized"
1253
+ }
1254
+ });
1255
+ }
1256
+ };
1257
+ export {
1258
+ BeanAccountsService,
1259
+ BeanBalancesService,
1260
+ BeanCommoditiesService,
1261
+ BeanTransactionsService,
1262
+ HealthService,
1263
+ OpenAPI,
1264
+ ProviderSyncService
1265
+ };