@firela/api-types 0.0.0-canary.da5984a1 → 0.0.0-canary.ebb51de2

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.
@@ -316,6 +316,53 @@ export type RegionsMetadataResponseDto = {
316
316
  regions: Array<RegionInfoDto>;
317
317
  };
318
318
 
319
+ export type CostSpecDto = {
320
+ /**
321
+ * Cost specification mode (mirrors engine CostSpec)
322
+ */
323
+ mode: 'per-unit' | 'total' | 'date' | 'label' | 'auto';
324
+ /**
325
+ * Per-unit cost (required when mode is "per-unit")
326
+ */
327
+ numberPerUnit?: string;
328
+ /**
329
+ * Total cost for all units (required when mode is "total")
330
+ */
331
+ totalNumber?: string;
332
+ /**
333
+ * Cost currency (required in all modes)
334
+ */
335
+ currency: string;
336
+ /**
337
+ * Lot acquisition date, ISO 8601 (required when mode is "date")
338
+ */
339
+ date?: string;
340
+ /**
341
+ * Lot label (required when mode is "label"; optional tag in buy modes)
342
+ */
343
+ label?: string;
344
+ /**
345
+ * Merge lots for AVERAGE booking (mode: auto)
346
+ */
347
+ merge?: boolean;
348
+ };
349
+
350
+ /**
351
+ * Cost specification mode (mirrors engine CostSpec)
352
+ */
353
+ export type mode = 'per-unit' | 'total' | 'date' | 'label' | 'auto';
354
+
355
+ export type AmountDto = {
356
+ /**
357
+ * Amount as decimal string (max 15 integer + 15 decimal digits)
358
+ */
359
+ number: string;
360
+ /**
361
+ * Currency/commodity code
362
+ */
363
+ currency: string;
364
+ };
365
+
319
366
  export type CreatePostingDto = {
320
367
  /**
321
368
  * Account name in Beancount format (must start with uppercase, colon-separated)
@@ -335,6 +382,14 @@ export type CreatePostingDto = {
335
382
  meta?: {
336
383
  [key: string]: unknown;
337
384
  };
385
+ /**
386
+ * Cost basis (Beancount `{...}`). Maps to engine costSpec. Required for commodity holdings so they carry a monetary weight that can balance.
387
+ */
388
+ cost?: CostSpecDto;
389
+ /**
390
+ * Price annotation (Beancount `@...`). Maps to engine price. Used for valuation; cost takes priority for balance weight.
391
+ */
392
+ price?: AmountDto;
338
393
  };
339
394
 
340
395
  export type CreateTransactionDto = {
@@ -387,6 +442,25 @@ export type CreateTransactionDto = {
387
442
  */
388
443
  export type flag = '*' | '!';
389
444
 
445
+ export type CostDetailDto = {
446
+ /**
447
+ * Per-unit cost basis (mirrors engine Cost.number)
448
+ */
449
+ number?: string;
450
+ /**
451
+ * Cost currency
452
+ */
453
+ currency?: string;
454
+ /**
455
+ * Lot acquisition date (ISO yyyy-mm-dd)
456
+ */
457
+ date?: string;
458
+ /**
459
+ * Lot label
460
+ */
461
+ label?: string;
462
+ };
463
+
390
464
  export type PostingResponseDto = {
391
465
  /**
392
466
  * Account name
@@ -400,6 +474,10 @@ export type PostingResponseDto = {
400
474
  * Currency
401
475
  */
402
476
  currency?: string;
477
+ /**
478
+ * Booking-resolved cost (mirrors engine Cost). Undefined when the posting has no cost basis.
479
+ */
480
+ cost?: CostDetailDto;
403
481
  };
404
482
 
405
483
  export type RecurringSuggestionDto = {
@@ -561,6 +639,55 @@ export type BatchTransactionResponseDto = {
561
639
  failed: Array<BatchTransactionErrorDto>;
562
640
  };
563
641
 
642
+ export type CorrectTransactionDto = {
643
+ /**
644
+ * Transaction date (ISO 8601 format)
645
+ */
646
+ date: string;
647
+ /**
648
+ * Transaction flag: * (cleared), ! (pending)
649
+ */
650
+ flag?: '*' | '!';
651
+ /**
652
+ * Payee name
653
+ */
654
+ payee?: string;
655
+ /**
656
+ * Transaction narration/description
657
+ */
658
+ narration: string;
659
+ /**
660
+ * Transaction tags (without # prefix)
661
+ */
662
+ tags?: Array<string>;
663
+ /**
664
+ * Transaction links (without ^ prefix)
665
+ */
666
+ links?: Array<string>;
667
+ /**
668
+ * Transaction postings (minimum 1, typically 2 for double-entry)
669
+ */
670
+ postings: Array<CreatePostingDto>;
671
+ /**
672
+ * Transaction-level metadata
673
+ */
674
+ meta?: {
675
+ [key: string]: unknown;
676
+ };
677
+ /**
678
+ * Unique key for idempotent transaction creation. If provided, duplicate requests with the same key will return the existing transaction.
679
+ */
680
+ idempotencyKey?: string;
681
+ /**
682
+ * Auto-create accounts if not found. When true, missing accounts will be automatically created. When false (default for API), missing accounts will cause a validation error. Set to true for quick entry scenarios where you want to create accounts on-the-fly.
683
+ */
684
+ autoCreateAccounts?: boolean;
685
+ /**
686
+ * Reason for correcting/superseding the original transaction
687
+ */
688
+ correctionReason?: string;
689
+ };
690
+
564
691
  export type PostingDetailDto = {
565
692
  /**
566
693
  * Posting ID
@@ -571,9 +698,9 @@ export type PostingDetailDto = {
571
698
  */
572
699
  accountId: string;
573
700
  /**
574
- * Account name
701
+ * Fully-qualified Beancount account path
575
702
  */
576
- accountName: string;
703
+ account: string;
577
704
  /**
578
705
  * Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.
579
706
  */
@@ -594,6 +721,10 @@ export type PostingDetailDto = {
594
721
  * Cost date
595
722
  */
596
723
  costDate?: string;
724
+ /**
725
+ * Booking-resolved cost (mirrors engine Cost). Undefined when the posting has no cost basis.
726
+ */
727
+ cost?: CostDetailDto;
597
728
  /**
598
729
  * Price amount
599
730
  */
@@ -664,9 +795,9 @@ export type TransactionDetailDto = {
664
795
  */
665
796
  status: 'ACTIVE' | 'VOIDED' | 'SUPERSEDED';
666
797
  /**
667
- * Source type (how the transaction was created)
798
+ * Source type (free-form string from transaction metadata, e.g. import, api)
668
799
  */
669
- sourceType?: 'NLP' | 'CSV' | 'OCR' | 'API';
800
+ sourceType?: string;
670
801
  /**
671
802
  * Source platform (e.g., alipay, wechat)
672
803
  */
@@ -691,6 +822,14 @@ export type TransactionDetailDto = {
691
822
  * Correction reason (if voided or superseded)
692
823
  */
693
824
  correctionReason?: string;
825
+ /**
826
+ * ID of the transaction that supersedes this one (set when status=SUPERSEDED)
827
+ */
828
+ supersededBy?: string;
829
+ /**
830
+ * ID of the transaction this one corrected/replaced (back-link on the replacement)
831
+ */
832
+ originalTxn?: string;
694
833
  };
695
834
 
696
835
  /**
@@ -709,11 +848,6 @@ export type flag2 =
709
848
  */
710
849
  export type status2 = 'ACTIVE' | 'VOIDED' | 'SUPERSEDED';
711
850
 
712
- /**
713
- * Source type (how the transaction was created)
714
- */
715
- export type sourceType = 'NLP' | 'CSV' | 'OCR' | 'API';
716
-
717
851
  export type TransactionListResponseDto = {
718
852
  /**
719
853
  * List of transactions
@@ -852,9 +986,9 @@ export type TransactionSummaryDto = {
852
986
  */
853
987
  accountName?: string;
854
988
  /**
855
- * Source type (NLP, CSV, OCR, API)
989
+ * Source type (free-form string from transaction metadata, e.g. import, api)
856
990
  */
857
- sourceType?: 'NLP' | 'CSV' | 'OCR' | 'API';
991
+ sourceType?: string;
858
992
  /**
859
993
  * Source platform (e.g., alipay, wechat)
860
994
  */
@@ -902,7 +1036,7 @@ export type ReviewSummaryDto = {
902
1036
  */
903
1037
  matchReasons: Array<string>;
904
1038
  /**
905
- * Source type (NLP, CSV, OCR, API)
1039
+ * Source type (free-form string from transaction metadata, e.g. import, api)
906
1040
  */
907
1041
  sourceType: string;
908
1042
  /**
@@ -1000,7 +1134,18 @@ export type DecisionOptionDto = {
1000
1134
  /**
1001
1135
  * The action value to submit (e.g., UPGRADE_REPLACE, ACCEPT)
1002
1136
  */
1003
- value: string;
1137
+ value:
1138
+ | 'UPGRADE_REPLACE'
1139
+ | 'LINK_KEEP_BOTH'
1140
+ | 'IGNORE_NEW'
1141
+ | 'CONFIRM_DIFFERENT'
1142
+ | 'ACCEPT'
1143
+ | 'REJECT'
1144
+ | 'ACCEPT_AND_LEARN'
1145
+ | 'CHOOSE_OTHER'
1146
+ | 'CANCEL'
1147
+ | 'FIX'
1148
+ | 'IGNORE';
1004
1149
  /**
1005
1150
  * i18n message key for display label (e.g., review.payee.accept.label)
1006
1151
  */
@@ -1015,6 +1160,22 @@ export type DecisionOptionDto = {
1015
1160
  recommended?: boolean;
1016
1161
  };
1017
1162
 
1163
+ /**
1164
+ * The action value to submit (e.g., UPGRADE_REPLACE, ACCEPT)
1165
+ */
1166
+ export type value =
1167
+ | 'UPGRADE_REPLACE'
1168
+ | 'LINK_KEEP_BOTH'
1169
+ | 'IGNORE_NEW'
1170
+ | 'CONFIRM_DIFFERENT'
1171
+ | 'ACCEPT'
1172
+ | 'REJECT'
1173
+ | 'ACCEPT_AND_LEARN'
1174
+ | 'CHOOSE_OTHER'
1175
+ | 'CANCEL'
1176
+ | 'FIX'
1177
+ | 'IGNORE';
1178
+
1018
1179
  export type ReviewDetailDto = {
1019
1180
  /**
1020
1181
  * Review item ID
@@ -1056,7 +1217,7 @@ export type ReviewDetailDto = {
1056
1217
  */
1057
1218
  matchReasons: Array<string>;
1058
1219
  /**
1059
- * Source type (NLP, CSV, OCR, API)
1220
+ * Source type (free-form string from transaction metadata, e.g. import, api)
1060
1221
  */
1061
1222
  sourceType: string;
1062
1223
  /**
@@ -1109,9 +1270,20 @@ export type ReviewDetailDto = {
1109
1270
 
1110
1271
  export type ResolveReviewDto = {
1111
1272
  /**
1112
- * Decision action. Available actions vary by review type: DUPLICATE: UPGRADE_REPLACE, KEEP_EXISTING, KEEP_BOTH | PAYEE_MATCH: ACCEPT, REJECT, ACCEPT_AND_LEARN | ACCOUNT_VALIDATION: FIX, REJECT | RULE_MATCH: ACCEPT, REJECT, ACCEPT_AND_LEARN
1273
+ * Decision action. Valid actions vary by review type — see DecisionOptionDto.value returned by the review detail endpoint.
1113
1274
  */
1114
- action: string;
1275
+ action:
1276
+ | 'UPGRADE_REPLACE'
1277
+ | 'LINK_KEEP_BOTH'
1278
+ | 'IGNORE_NEW'
1279
+ | 'CONFIRM_DIFFERENT'
1280
+ | 'ACCEPT'
1281
+ | 'REJECT'
1282
+ | 'ACCEPT_AND_LEARN'
1283
+ | 'CHOOSE_OTHER'
1284
+ | 'CANCEL'
1285
+ | 'FIX'
1286
+ | 'IGNORE';
1115
1287
  /**
1116
1288
  * Additional data for the decision (e.g., selected account ID)
1117
1289
  */
@@ -1120,6 +1292,22 @@ export type ResolveReviewDto = {
1120
1292
  };
1121
1293
  };
1122
1294
 
1295
+ /**
1296
+ * Decision action. Valid actions vary by review type — see DecisionOptionDto.value returned by the review detail endpoint.
1297
+ */
1298
+ export type action =
1299
+ | 'UPGRADE_REPLACE'
1300
+ | 'LINK_KEEP_BOTH'
1301
+ | 'IGNORE_NEW'
1302
+ | 'CONFIRM_DIFFERENT'
1303
+ | 'ACCEPT'
1304
+ | 'REJECT'
1305
+ | 'ACCEPT_AND_LEARN'
1306
+ | 'CHOOSE_OTHER'
1307
+ | 'CANCEL'
1308
+ | 'FIX'
1309
+ | 'IGNORE';
1310
+
1123
1311
  export type ResolveResultDto = {
1124
1312
  /**
1125
1313
  * Whether resolution was successful
@@ -1176,7 +1364,18 @@ export type BatchResolveDto = {
1176
1364
  /**
1177
1365
  * Decision action to apply to all items
1178
1366
  */
1179
- action: string;
1367
+ action:
1368
+ | 'UPGRADE_REPLACE'
1369
+ | 'LINK_KEEP_BOTH'
1370
+ | 'IGNORE_NEW'
1371
+ | 'CONFIRM_DIFFERENT'
1372
+ | 'ACCEPT'
1373
+ | 'REJECT'
1374
+ | 'ACCEPT_AND_LEARN'
1375
+ | 'CHOOSE_OTHER'
1376
+ | 'CANCEL'
1377
+ | 'FIX'
1378
+ | 'IGNORE';
1180
1379
  /**
1181
1380
  * Additional data for the decision
1182
1381
  */
@@ -3258,33 +3457,6 @@ export type ProviderSyncDto = {
3258
3457
  transactions: unknown[];
3259
3458
  };
3260
3459
 
3261
- export type ProviderSyncResponseDto = {
3262
- /**
3263
- * Number of transactions successfully imported
3264
- */
3265
- imported: number;
3266
- /**
3267
- * Number of transactions skipped (duplicates)
3268
- */
3269
- skipped: number;
3270
- /**
3271
- * Number of transactions pending review
3272
- */
3273
- pendingReview: number;
3274
- /**
3275
- * Number of transactions that failed to import
3276
- */
3277
- failed: number;
3278
- /**
3279
- * IDs of successfully imported transactions
3280
- */
3281
- importedTransactionIds?: Array<string>;
3282
- /**
3283
- * IDs of review items created for branched transactions
3284
- */
3285
- reviewItemIds?: Array<string>;
3286
- };
3287
-
3288
3460
  export type SupportedProvidersResponseDto = {
3289
3461
  /**
3290
3462
  * List of supported provider names
@@ -3294,6 +3466,8 @@ export type SupportedProvidersResponseDto = {
3294
3466
 
3295
3467
  export type ParserTelemetryReportDto = unknown;
3296
3468
 
3469
+ export type UncoveredFormatMissDto = unknown;
3470
+
3297
3471
  export type ProcessNlpDto = {
3298
3472
  /**
3299
3473
  * Natural language text describing a transaction (Chinese)
@@ -3311,607 +3485,418 @@ export type ProcessNlpDto = {
3311
3485
  };
3312
3486
  };
3313
3487
 
3314
- export type NlpTransactionInfoDto = {
3488
+ export type BalanceByCurrencyDto = {
3315
3489
  /**
3316
- * Transaction ID
3490
+ * ISO 4217 currency code
3317
3491
  */
3318
- id: string;
3492
+ currency: string;
3319
3493
  /**
3320
- * Transaction date (ISO format)
3494
+ * Balance amount
3321
3495
  */
3322
- date: string;
3496
+ balance: string;
3497
+ };
3498
+
3499
+ export type NetWorthByCurrencyDto = {
3323
3500
  /**
3324
- * Transaction amount
3501
+ * Net worth by currency
3325
3502
  */
3326
- amount: number;
3503
+ netWorth: Array<BalanceByCurrencyDto>;
3327
3504
  /**
3328
- * Currency code
3505
+ * Assets by currency
3329
3506
  */
3330
- currency: string;
3507
+ assets: Array<BalanceByCurrencyDto>;
3331
3508
  /**
3332
- * Payee name
3509
+ * Liabilities by currency
3333
3510
  */
3334
- payee?: string;
3511
+ liabilities: Array<BalanceByCurrencyDto>;
3512
+ };
3513
+
3514
+ export type ConvertedNetWorthDto = {
3335
3515
  /**
3336
- * Transaction narration
3516
+ * Base currency for conversion
3337
3517
  */
3338
- narration?: string;
3518
+ baseCurrency: string;
3339
3519
  /**
3340
- * Warning message for special transaction scenarios (e.g., cross-currency settlement)
3520
+ * Converted net worth
3341
3521
  */
3342
- warning?: string;
3343
- };
3344
-
3345
- export type NlpParsedDataDto = {
3522
+ netWorth: string;
3346
3523
  /**
3347
- * Extracted amount
3524
+ * Converted assets
3348
3525
  */
3349
- amount?: number;
3526
+ assets: string;
3350
3527
  /**
3351
- * Currency code
3528
+ * Converted liabilities
3352
3529
  */
3353
- currency?: string;
3530
+ liabilities: string;
3354
3531
  /**
3355
- * Transaction date (ISO format)
3532
+ * Exchange rates used for conversion
3356
3533
  */
3357
- date?: string;
3534
+ exchangeRates: {
3535
+ [key: string]: unknown;
3536
+ };
3537
+ };
3538
+
3539
+ export type ExchangeRateWarningDto = {
3358
3540
  /**
3359
- * Payee name
3541
+ * Warning type
3360
3542
  */
3361
- payee?: string;
3543
+ type: string;
3362
3544
  /**
3363
- * Transaction narration
3545
+ * Currency without exchange rate
3364
3546
  */
3365
- narration?: string;
3547
+ currency: string;
3366
3548
  /**
3367
- * Category
3549
+ * Total amount affected
3368
3550
  */
3369
- category?: string;
3551
+ totalAmount: string;
3552
+ };
3553
+
3554
+ export type NetWorthResponseDto = {
3555
+ /**
3556
+ * Total net worth (assets - liabilities, converted to base currency)
3557
+ */
3558
+ netWorth: string;
3370
3559
  /**
3371
- * Income type (e.g., Salary, Bonus, Dividend, Interest)
3560
+ * Total assets value (converted)
3372
3561
  */
3373
- incomeType?: string;
3562
+ assets: string;
3374
3563
  /**
3375
- * Income source (e.g., company name)
3564
+ * Total liabilities value (positive number, converted)
3376
3565
  */
3377
- incomeSource?: string;
3566
+ liabilities: string;
3378
3567
  /**
3379
- * Security symbol code (e.g., 600519, AAPL)
3568
+ * Monthly return (change from last month)
3380
3569
  */
3381
- symbol?: string;
3570
+ monthlyReturn: string;
3382
3571
  /**
3383
- * Quantity of shares/units
3572
+ * Monthly return percentage
3384
3573
  */
3385
- quantity?: number;
3574
+ monthlyReturnPercentage: string;
3386
3575
  /**
3387
- * Unit price per share/unit
3576
+ * Base currency code
3388
3577
  */
3389
- price?: number;
3578
+ currency: string;
3390
3579
  /**
3391
- * Investment action
3580
+ * Data as of date (ISO 8601)
3392
3581
  */
3393
- investmentAction?: 'buy' | 'sell';
3582
+ asOf: string;
3394
3583
  /**
3395
- * Payment source: asset (default) or liability (credit card)
3584
+ * Balances grouped by original currency
3396
3585
  */
3397
- paymentSource?: 'asset' | 'liability';
3586
+ byCurrency?: NetWorthByCurrencyDto;
3398
3587
  /**
3399
- * Liability account hint (CreditCard/Huabei/Baitiao)
3588
+ * Converted values in base currency (undefined if no exchange rates available)
3400
3589
  */
3401
- liabilityHint?: string;
3590
+ converted?: ConvertedNetWorthDto;
3402
3591
  /**
3403
- * Warning message for special scenarios (e.g., cross-currency settlement)
3592
+ * Exchange rate warnings
3404
3593
  */
3405
- warning?: string;
3594
+ warnings?: Array<ExchangeRateWarningDto>;
3406
3595
  };
3407
3596
 
3408
- /**
3409
- * Investment action
3410
- */
3411
- export type investmentAction = 'buy' | 'sell';
3412
-
3413
- /**
3414
- * Payment source: asset (default) or liability (credit card)
3415
- */
3416
- export type paymentSource = 'asset' | 'liability';
3417
-
3418
- export type NlpSourceTransactionDto = {
3597
+ export type AccountItemDto = {
3419
3598
  /**
3420
- * Transaction date (ISO format)
3599
+ * Account ID
3421
3600
  */
3422
- date: string;
3601
+ id: string;
3423
3602
  /**
3424
- * Amount as string
3603
+ * Full account name
3425
3604
  */
3426
- amount: string;
3605
+ name: string;
3427
3606
  /**
3428
- * Currency code
3607
+ * Display name (last part of account path)
3429
3608
  */
3430
- currency: string;
3609
+ displayName: string;
3431
3610
  /**
3432
- * Payee name
3611
+ * Account balance
3433
3612
  */
3434
- payee?: string;
3613
+ balance: string;
3435
3614
  /**
3436
- * Transaction narration
3615
+ * Currency code
3437
3616
  */
3438
- narration: string;
3617
+ currency: string;
3439
3618
  };
3440
3619
 
3441
- export type NlpTargetTransactionDto = {
3620
+ export type PlatformGroupDto = {
3442
3621
  /**
3443
- * Existing transaction ID
3622
+ * Platform ID
3444
3623
  */
3445
- id: string;
3624
+ platformId: string;
3446
3625
  /**
3447
- * Transaction date (ISO format)
3626
+ * Platform display name
3448
3627
  */
3449
- date: string;
3628
+ platformName: string;
3450
3629
  /**
3451
- * Amount as string
3630
+ * Accounts within this platform
3452
3631
  */
3453
- amount: string;
3454
- /**
3455
- * Currency code
3456
- */
3457
- currency: string;
3458
- /**
3459
- * Payee name
3460
- */
3461
- payee?: string;
3632
+ accounts: Array<AccountItemDto>;
3462
3633
  /**
3463
- * Transaction narration
3634
+ * Total balance across all accounts in platform
3464
3635
  */
3465
- narration: string;
3636
+ totalBalance: string;
3466
3637
  };
3467
3638
 
3468
- export type NlpSimilarityDto = {
3469
- /**
3470
- * Whether dates match
3471
- */
3472
- dateMatch: boolean;
3473
- /**
3474
- * Date difference in days
3475
- */
3476
- dateDiff: number;
3477
- /**
3478
- * Whether amounts match
3479
- */
3480
- amountMatch: boolean;
3481
- /**
3482
- * Amount difference as decimal string
3483
- */
3484
- amountDiff: string;
3485
- /**
3486
- * Whether payees match
3487
- */
3488
- payeeMatch: boolean;
3639
+ export type AccountsSummaryDto = {
3489
3640
  /**
3490
- * Payee similarity score (0-1)
3641
+ * Total number of accounts
3491
3642
  */
3492
- payeeSimilarity: number;
3643
+ totalAccounts: number;
3493
3644
  /**
3494
- * Account overlap score (0-1)
3645
+ * Total number of platforms
3495
3646
  */
3496
- accountOverlap: number;
3647
+ totalPlatforms: number;
3497
3648
  };
3498
3649
 
3499
- export type NlpDuplicateConfirmationDataDto = {
3500
- /**
3501
- * Duplicate detection confidence score (0.5-0.89)
3502
- */
3503
- confidence: number;
3504
- /**
3505
- * Source transaction summary (the new transaction being entered)
3506
- */
3507
- sourceTransaction: NlpSourceTransactionDto;
3508
- /**
3509
- * Target transaction summary (existing potential duplicate)
3510
- */
3511
- targetTransaction: NlpTargetTransactionDto;
3650
+ export type AccountsResponseDto = {
3512
3651
  /**
3513
- * Detailed similarity information
3652
+ * Account groups by platform
3514
3653
  */
3515
- similarity: NlpSimilarityDto;
3654
+ groups: Array<PlatformGroupDto>;
3516
3655
  /**
3517
- * Human-readable reasons for duplicate detection
3656
+ * Summary statistics
3518
3657
  */
3519
- reasons: Array<string>;
3658
+ summary: AccountsSummaryDto;
3520
3659
  };
3521
3660
 
3522
- export type NlpRuleConfirmationDataDto = {
3661
+ export type AccountItemWithAssetClassDto = {
3523
3662
  /**
3524
- * Rule match confidence score (0.5-0.74)
3663
+ * Account ID
3525
3664
  */
3526
- confidence: number;
3665
+ id: string;
3527
3666
  /**
3528
- * Matched rule information
3667
+ * Full account name
3529
3668
  */
3530
- matchedRule: {
3531
- [key: string]: unknown;
3532
- };
3669
+ name: string;
3533
3670
  /**
3534
- * Suggested accounts from the rule
3671
+ * Display name (last part of account path)
3535
3672
  */
3536
- suggestedAccounts: {
3537
- [key: string]: unknown;
3538
- };
3673
+ displayName: string;
3539
3674
  /**
3540
- * Alternative rules that also match
3675
+ * Account balance
3541
3676
  */
3542
- alternatives: unknown[];
3677
+ balance: string;
3543
3678
  /**
3544
- * Human-readable reasons for the match
3679
+ * Currency code
3545
3680
  */
3546
- reasons: Array<string>;
3547
- };
3548
-
3549
- export type NlpAccountConfirmationDataDto = {
3681
+ currency: string;
3550
3682
  /**
3551
- * The invalid account name
3683
+ * Asset class
3552
3684
  */
3553
- invalidAccount: string;
3685
+ assetClass: string;
3554
3686
  /**
3555
- * Suggested replacement account
3687
+ * Asset sub-class (Prisma-compatible)
3556
3688
  */
3557
- suggestedAccount: string;
3689
+ assetSubClass?: string;
3558
3690
  /**
3559
- * Similar accounts for user selection
3691
+ * Regional sub-class (region-specific, for display)
3560
3692
  */
3561
- similarAccounts: Array<string>;
3693
+ regionalSubClass?: string;
3562
3694
  /**
3563
- * Error message explaining the issue
3695
+ * Risk level
3564
3696
  */
3565
- errorMessage: string;
3697
+ riskLevel?: string;
3566
3698
  /**
3567
- * Transaction context for reference
3699
+ * ADR-0105 classification provenance (holding level always; account level only on FALLBACK)
3568
3700
  */
3569
- transactionContext: {
3570
- [key: string]: unknown;
3571
- };
3701
+ source?: 'USER_META' | 'FIAT_CURRENCY' | 'OPENBB_MAPPING' | 'FALLBACK';
3572
3702
  };
3573
3703
 
3574
- export type NlpSuggestedPayeeDto = {
3704
+ /**
3705
+ * ADR-0105 classification provenance (holding level always; account level only on FALLBACK)
3706
+ */
3707
+ export type source =
3708
+ | 'USER_META'
3709
+ | 'FIAT_CURRENCY'
3710
+ | 'OPENBB_MAPPING'
3711
+ | 'FALLBACK';
3712
+
3713
+ export type AssetClassGroupDto = {
3575
3714
  /**
3576
- * Payee ID
3715
+ * Asset class name
3577
3716
  */
3578
- id: string;
3717
+ assetClass:
3718
+ | 'LIQUIDITY'
3719
+ | 'EQUITY'
3720
+ | 'FIXED_INCOME'
3721
+ | 'PRECIOUS_METALS'
3722
+ | 'COMMODITY'
3723
+ | 'INSURANCE'
3724
+ | 'ALTERNATIVE_INVESTMENT'
3725
+ | 'PERSONAL_ASSETS'
3726
+ | 'LIABILITY'
3727
+ | 'REAL_ESTATE'
3728
+ | 'INDEX';
3579
3729
  /**
3580
- * Payee name
3730
+ * Asset sub-class name
3581
3731
  */
3582
- name: string;
3732
+ assetSubClass?: string;
3583
3733
  /**
3584
- * Payee category
3734
+ * Accounts within this asset class
3585
3735
  */
3586
- category?: string;
3736
+ accounts: Array<AccountItemWithAssetClassDto>;
3587
3737
  /**
3588
- * Source of the payee
3738
+ * Balances grouped by currency
3589
3739
  */
3590
- source?: 'user' | 'global';
3740
+ balanceByCurrency: Array<BalanceByCurrencyDto>;
3591
3741
  /**
3592
- * PayeeProfile ID (if matched from global)
3742
+ * Converted balance in base currency
3593
3743
  */
3594
- payeeProfileId?: string;
3744
+ convertedBalance?: string;
3595
3745
  };
3596
3746
 
3597
3747
  /**
3598
- * Source of the payee
3748
+ * Asset class name
3599
3749
  */
3600
- export type source = 'user' | 'global';
3601
-
3602
- export type NlpAlternativePayeeDto = {
3603
- /**
3604
- * Payee ID
3605
- */
3606
- id: string;
3607
- /**
3608
- * Payee name
3609
- */
3610
- name: string;
3611
- /**
3612
- * Similarity score (0-1)
3613
- */
3614
- similarity: number;
3615
- };
3750
+ export type assetClass =
3751
+ | 'LIQUIDITY'
3752
+ | 'EQUITY'
3753
+ | 'FIXED_INCOME'
3754
+ | 'PRECIOUS_METALS'
3755
+ | 'COMMODITY'
3756
+ | 'INSURANCE'
3757
+ | 'ALTERNATIVE_INVESTMENT'
3758
+ | 'PERSONAL_ASSETS'
3759
+ | 'LIABILITY'
3760
+ | 'REAL_ESTATE'
3761
+ | 'INDEX';
3616
3762
 
3617
- export type NlpPayeeConfirmationDataDto = {
3618
- /**
3619
- * Confidence score for the payee match (0-1)
3620
- */
3621
- confidence: number;
3622
- /**
3623
- * Original payee string from user input
3624
- */
3625
- originalPayee: string;
3763
+ export type AccountExchangeRateWarningDto = {
3626
3764
  /**
3627
- * Suggested payee to use (null when no similar payees found)
3765
+ * Warning type
3628
3766
  */
3629
- suggestedPayee?: NlpSuggestedPayeeDto | null;
3767
+ type: string;
3630
3768
  /**
3631
- * Similarity score between original and suggested (0-1)
3769
+ * Currency without exchange rate
3632
3770
  */
3633
- similarity: number;
3771
+ currency: string;
3634
3772
  /**
3635
- * Alternative payee options
3773
+ * Affected account paths
3636
3774
  */
3637
- alternatives: Array<NlpAlternativePayeeDto>;
3775
+ accounts: Array<string>;
3638
3776
  /**
3639
- * Human-readable reasons for the match
3777
+ * Total amount in this currency
3640
3778
  */
3641
- reasons: Array<string>;
3779
+ totalAmount: string;
3642
3780
  };
3643
3781
 
3644
- export type RecurringMatchInfoDto = {
3645
- /**
3646
- * Expected transaction ID
3647
- */
3648
- expectedId: string;
3649
- /**
3650
- * Recurring rule ID
3651
- */
3652
- ruleId: string;
3653
- /**
3654
- * Rule name for display
3655
- */
3656
- ruleName: string;
3657
- /**
3658
- * Rule icon
3659
- */
3660
- ruleIcon?: string;
3661
- /**
3662
- * Expected date (YYYY-MM-DD)
3663
- */
3664
- expectedDate: string;
3665
- /**
3666
- * Expected amount
3667
- */
3668
- expectedAmount: number;
3669
- /**
3670
- * Match confidence score (0-1)
3671
- */
3672
- confidence: number;
3782
+ export type AssetClassSummaryDto = {
3673
3783
  /**
3674
- * Whether auto-matched (confidence >= 0.82)
3784
+ * Total number of accounts
3675
3785
  */
3676
- isAutoMatched: boolean;
3677
- };
3678
-
3679
- export type NlpSuggestedAccountDto = {
3786
+ totalAccounts: number;
3680
3787
  /**
3681
- * Suggested account path
3788
+ * Total number of asset classes
3682
3789
  */
3683
- account: string;
3790
+ totalAssetClasses: number;
3684
3791
  /**
3685
- * Confidence score for this suggestion (0-1)
3792
+ * Base currency for conversion
3686
3793
  */
3687
- confidence?: number;
3688
- };
3689
-
3690
- export type NlpSuggestedAccountsDto = {
3794
+ baseCurrency: string;
3691
3795
  /**
3692
- * Source account suggestion (where money comes from). For expense: asset/liability account. For income: income account.
3796
+ * Exchange rate warnings
3693
3797
  */
3694
- source?: NlpSuggestedAccountDto;
3798
+ warnings?: Array<AccountExchangeRateWarningDto>;
3695
3799
  /**
3696
- * Destination account suggestion (where money goes to). For expense: expense account. For income: asset/liability account.
3800
+ * ADR-0105 §4 fallback provenance stats (holding level only). valueRatio is the grey-area share of total converted value; count is the number of source=FALLBACK holdings.
3697
3801
  */
3698
- destination?: NlpSuggestedAccountDto;
3802
+ fallback?: {
3803
+ [key: string]: unknown;
3804
+ };
3699
3805
  };
3700
3806
 
3701
- export type NlpDefaultAccountsDto = {
3702
- /**
3703
- * Default asset account
3704
- */
3705
- asset: string;
3807
+ export type AssetClassAccountsResponseDto = {
3706
3808
  /**
3707
- * Default expense account
3809
+ * Account groups by asset class
3708
3810
  */
3709
- expense: string;
3811
+ groups: Array<AssetClassGroupDto>;
3710
3812
  /**
3711
- * Default income account
3813
+ * Summary statistics
3712
3814
  */
3713
- income: string;
3815
+ summary: AssetClassSummaryDto;
3714
3816
  /**
3715
- * Default liability account
3817
+ * ADR-0105 §6 holding-level grey-area bucket (source=FALLBACK holdings peeled out of groups). Present only for groupBy=holdingAssetClass when FALLBACK holdings exist.
3716
3818
  */
3717
- liability: string;
3819
+ uncategorized?: AssetClassGroupDto;
3718
3820
  };
3719
3821
 
3720
- export type NlpResponseDto = {
3721
- /**
3722
- * Response status
3723
- */
3724
- status: 'success' | 'pending' | 'error';
3725
- /**
3726
- * Action taken or requested
3727
- */
3728
- action:
3729
- | 'created'
3730
- | 'ask'
3731
- | 'confirm'
3732
- | 'confirm_duplicate'
3733
- | 'confirm_rule'
3734
- | 'confirm_account'
3735
- | 'confirm_payee'
3736
- | 'cancel';
3737
- /**
3738
- * Transaction intent detected by EntityRouter (v6.0: 5 core intents). Frontend uses this to render scenario-specific form fields.
3739
- */
3740
- intent?: 'expense' | 'asset' | 'income' | 'liability' | 'equity';
3741
- /**
3742
- * Asset sub-type (only present when intent is "asset"). Determines which asset-related form to render.
3743
- */
3744
- assetSubType?: 'transfer' | 'banking' | 'investment';
3745
- /**
3746
- * Liability sub-type (only present when intent is "liability"). borrow: borrowing money (Liabilities → Assets), repay: repaying debt (Assets → Liabilities).
3747
- */
3748
- liabilitySubType?: 'borrow' | 'repay';
3749
- /**
3750
- * Equity sub-type (only present when intent is "equity"). opening: account opening balance (Equity → Assets), adjustment: balance correction.
3751
- */
3752
- equitySubType?: 'opening' | 'adjustment';
3753
- /**
3754
- * Payment source for expense transactions (v6.1). Indicates whether payment comes from asset or liability account. Only present when intent is "expense".
3755
- */
3756
- paymentSource?: 'asset' | 'liability';
3757
- /**
3758
- * Liability account type hint for credit card/BNPL spending (v6.1). Only present when paymentSource is "liability". Values: CreditCard, Huabei, Baitiao
3759
- */
3760
- liabilityHint?: string;
3761
- /**
3762
- * Human-readable message (for ask or error actions). Deprecated: Use messageKey for i18n support.
3763
- * @deprecated
3764
- */
3765
- message?: string;
3766
- /**
3767
- * i18n message key for frontend translation. Use this instead of message for internationalization support.
3768
- */
3769
- messageKey?: string;
3770
- /**
3771
- * Parameters for message interpolation. Used with messageKey for dynamic values in translated messages.
3772
- */
3773
- messageParams?: {
3774
- [key: string]: unknown;
3775
- };
3776
- /**
3777
- * Session ID for multi-turn dialogue. Must be included in subsequent requests to continue the conversation.
3778
- */
3779
- sessionId?: string;
3780
- /**
3781
- * Which slot is waiting for user input
3782
- */
3783
- waitingFor?: string;
3784
- /**
3785
- * Created transaction info (for created action)
3786
- */
3787
- transaction?: NlpTransactionInfoDto;
3788
- /**
3789
- * Parsed data for confirmation (when action is "confirm"). Contains extracted fields that user should verify before transaction creation.
3790
- */
3791
- parsedData?: NlpParsedDataDto;
3792
- /**
3793
- * Duplicate detection data (when action is "confirm_duplicate"). Contains information about potential duplicate transaction for user confirmation.
3794
- */
3795
- duplicateData?: NlpDuplicateConfirmationDataDto;
3796
- /**
3797
- * Rule match data (when action is "confirm_rule"). Contains information about medium-confidence rule match for user confirmation.
3798
- */
3799
- ruleData?: NlpRuleConfirmationDataDto;
3822
+ export type HoldingAssetClassAccountSliceDto = {
3800
3823
  /**
3801
- * Account validation data (when action is "confirm_account"). Contains information about invalid account for user correction.
3824
+ * Account ID
3802
3825
  */
3803
- accountData?: NlpAccountConfirmationDataDto;
3826
+ accountId: string;
3804
3827
  /**
3805
- * Payee confirmation data (when action is "confirm_payee"). Contains information about medium/low confidence payee match for user confirmation.
3828
+ * Full account path
3806
3829
  */
3807
- payeeData?: NlpPayeeConfirmationDataDto;
3830
+ accountPath: string;
3808
3831
  /**
3809
- * Overall confidence score (0-1)
3832
+ * Currency of the holding with the largest converted base value; undefined when no holding is convertible
3810
3833
  */
3811
- confidence?: number;
3834
+ accountCurrency?: string;
3812
3835
  /**
3813
- * Confidence threshold for automatic creation (default: 0.75). When confidence < threshold, action will be "confirm" requiring user verification.
3836
+ * Account's market value in base currency (Σ converted holdings; grey bucket included)
3814
3837
  */
3815
- confidenceThreshold?: number;
3838
+ marketValueBase: string;
3816
3839
  /**
3817
- * Recurring transaction match info (when action is "created"). Contains match details when transaction matches a pending expected transaction.
3840
+ * Share of the global total (0-100). 0 when globalTotal is zero (no NaN/Infinity).
3818
3841
  */
3819
- recurringMatch?: RecurringMatchInfoDto;
3842
+ shareOfTotalPct: number;
3820
3843
  /**
3821
- * Recurring rule creation suggestion (when action is "created"). Contains suggestion to create a recurring rule based on detected patterns. Only present when no existing rule matched and similar historical transactions were found.
3844
+ * Per-account asset-class breakdown
3822
3845
  */
3823
- recurringSuggestion?: RecurringSuggestionDto;
3846
+ groups: Array<AssetClassGroupDto>;
3824
3847
  /**
3825
- * Suggested accounts for this transaction. Contains recommended source and destination accounts based on the detected intent and rules.
3848
+ * Per-account grey bucket (source=FALLBACK holdings, incl. broker cash)
3826
3849
  */
3827
- suggestedAccounts?: NlpSuggestedAccountsDto;
3850
+ uncategorized?: AssetClassGroupDto;
3828
3851
  /**
3829
- * Default accounts for the user/region. These are fallback accounts used when no specific suggestion is available.
3852
+ * Every holding row for this account (account ID in each row’s `id` field)
3830
3853
  */
3831
- defaultAccounts?: NlpDefaultAccountsDto;
3854
+ holdings: Array<AccountItemWithAssetClassDto>;
3832
3855
  };
3833
3856
 
3834
- /**
3835
- * Response status
3836
- */
3837
- export type status4 = 'success' | 'pending' | 'error';
3838
-
3839
- /**
3840
- * Action taken or requested
3841
- */
3842
- export type action =
3843
- | 'created'
3844
- | 'ask'
3845
- | 'confirm'
3846
- | 'confirm_duplicate'
3847
- | 'confirm_rule'
3848
- | 'confirm_account'
3849
- | 'confirm_payee'
3850
- | 'cancel';
3851
-
3852
- /**
3853
- * Transaction intent detected by EntityRouter (v6.0: 5 core intents). Frontend uses this to render scenario-specific form fields.
3854
- */
3855
- export type intent = 'expense' | 'asset' | 'income' | 'liability' | 'equity';
3856
-
3857
- /**
3858
- * Asset sub-type (only present when intent is "asset"). Determines which asset-related form to render.
3859
- */
3860
- export type assetSubType = 'transfer' | 'banking' | 'investment';
3861
-
3862
- /**
3863
- * Liability sub-type (only present when intent is "liability"). borrow: borrowing money (Liabilities → Assets), repay: repaying debt (Assets → Liabilities).
3864
- */
3865
- export type liabilitySubType = 'borrow' | 'repay';
3866
-
3867
- /**
3868
- * Equity sub-type (only present when intent is "equity"). opening: account opening balance (Equity → Assets), adjustment: balance correction.
3869
- */
3870
- export type equitySubType = 'opening' | 'adjustment';
3871
-
3872
- export type BalanceByCurrencyDto = {
3857
+ export type HoldingAssetClassCrossAccountResponseDto = {
3873
3858
  /**
3874
- * ISO 4217 currency code
3859
+ * Merged cross-account holding aggregation
3875
3860
  */
3876
- currency: string;
3861
+ global: AssetClassAccountsResponseDto;
3877
3862
  /**
3878
- * Balance amount
3863
+ * Per-account slices
3879
3864
  */
3880
- balance: string;
3865
+ byAccount: Array<HoldingAssetClassAccountSliceDto>;
3881
3866
  };
3882
3867
 
3883
- export type NetWorthByCurrencyDto = {
3868
+ export type CashFlowByCurrencyDto = {
3884
3869
  /**
3885
- * Net worth by currency
3870
+ * Income by currency
3886
3871
  */
3887
- netWorth: Array<BalanceByCurrencyDto>;
3872
+ income: Array<BalanceByCurrencyDto>;
3888
3873
  /**
3889
- * Assets by currency
3874
+ * Expense by currency
3890
3875
  */
3891
- assets: Array<BalanceByCurrencyDto>;
3876
+ expense: Array<BalanceByCurrencyDto>;
3892
3877
  /**
3893
- * Liabilities by currency
3878
+ * Net savings by currency
3894
3879
  */
3895
- liabilities: Array<BalanceByCurrencyDto>;
3880
+ netSavings: Array<BalanceByCurrencyDto>;
3896
3881
  };
3897
3882
 
3898
- export type ConvertedNetWorthDto = {
3883
+ export type ConvertedCashFlowDto = {
3899
3884
  /**
3900
3885
  * Base currency for conversion
3901
3886
  */
3902
3887
  baseCurrency: string;
3903
3888
  /**
3904
- * Converted net worth
3889
+ * Converted income
3905
3890
  */
3906
- netWorth: string;
3891
+ income: string;
3907
3892
  /**
3908
- * Converted assets
3893
+ * Converted expense
3909
3894
  */
3910
- assets: string;
3895
+ expense: string;
3911
3896
  /**
3912
- * Converted liabilities
3897
+ * Converted net savings
3913
3898
  */
3914
- liabilities: string;
3899
+ netSavings: string;
3915
3900
  /**
3916
3901
  * Exchange rates used for conversion
3917
3902
  */
@@ -3920,343 +3905,340 @@ export type ConvertedNetWorthDto = {
3920
3905
  };
3921
3906
  };
3922
3907
 
3923
- export type ExchangeRateWarningDto = {
3924
- /**
3925
- * Warning type
3926
- */
3927
- type: string;
3928
- /**
3929
- * Currency without exchange rate
3930
- */
3931
- currency: string;
3932
- /**
3933
- * Total amount affected
3934
- */
3935
- totalAmount: string;
3936
- };
3937
-
3938
- export type NetWorthResponseDto = {
3908
+ export type CashFlowResponseDto = {
3939
3909
  /**
3940
- * Total net worth (assets - liabilities, converted to base currency)
3910
+ * Period identifier (YYYY-MM)
3941
3911
  */
3942
- netWorth: string;
3912
+ period: string;
3943
3913
  /**
3944
- * Total assets value (converted)
3914
+ * Total income for the period (converted)
3945
3915
  */
3946
- assets: string;
3916
+ income: string;
3947
3917
  /**
3948
- * Total liabilities value (positive number, converted)
3918
+ * Total expenses for the period (converted)
3949
3919
  */
3950
- liabilities: string;
3920
+ expense: string;
3951
3921
  /**
3952
- * Monthly return (change from last month)
3922
+ * Net savings (income - expense, converted)
3953
3923
  */
3954
- monthlyReturn: string;
3924
+ netSavings: string;
3955
3925
  /**
3956
- * Monthly return percentage
3926
+ * Savings rate percentage (netSavings / income * 100)
3957
3927
  */
3958
- monthlyReturnPercentage: string;
3928
+ savingsRate: string;
3959
3929
  /**
3960
3930
  * Base currency code
3961
3931
  */
3962
3932
  currency: string;
3963
3933
  /**
3964
- * Data as of date (ISO 8601)
3965
- */
3966
- asOf: string;
3967
- /**
3968
- * Balances grouped by original currency
3934
+ * Cash flow grouped by original currency
3969
3935
  */
3970
- byCurrency?: NetWorthByCurrencyDto;
3936
+ byCurrency?: CashFlowByCurrencyDto;
3971
3937
  /**
3972
- * Converted values in base currency (undefined if no exchange rates available)
3938
+ * Converted values in base currency
3973
3939
  */
3974
- converted?: ConvertedNetWorthDto;
3940
+ converted?: ConvertedCashFlowDto;
3975
3941
  /**
3976
3942
  * Exchange rate warnings
3977
3943
  */
3978
3944
  warnings?: Array<ExchangeRateWarningDto>;
3979
3945
  };
3980
3946
 
3981
- export type AccountItemDto = {
3947
+ export type MonetaryDto = {
3982
3948
  /**
3983
- * Account ID
3949
+ * Amount (Decimal string)
3984
3950
  */
3985
- id: string;
3986
- /**
3987
- * Full account name
3988
- */
3989
- name: string;
3990
- /**
3991
- * Display name (last part of account path)
3992
- */
3993
- displayName: string;
3951
+ amount: string;
3994
3952
  /**
3995
- * Account balance
3953
+ * ISO 4217 currency
3996
3954
  */
3997
- balance: string;
3955
+ currency: string;
3998
3956
  /**
3999
- * Currency code
3957
+ * Converted to user base currency (Decimal string)
4000
3958
  */
4001
- currency: string;
3959
+ baseCcyEquivalent?: {
3960
+ [key: string]: unknown;
3961
+ } | null;
4002
3962
  };
4003
3963
 
4004
- export type PlatformGroupDto = {
3964
+ export type CurrentPriceDto = {
4005
3965
  /**
4006
- * Platform ID
3966
+ * Price amount (Decimal string)
4007
3967
  */
4008
- platformId: string;
3968
+ amount: string;
4009
3969
  /**
4010
- * Platform display name
3970
+ * Price currency (ISO 4217)
4011
3971
  */
4012
- platformName: string;
3972
+ currency: string;
4013
3973
  /**
4014
- * Accounts within this platform
3974
+ * Price date (ISO 8601)
4015
3975
  */
4016
- accounts: Array<AccountItemDto>;
3976
+ date: string;
4017
3977
  /**
4018
- * Total balance across all accounts in platform
3978
+ * Price source
4019
3979
  */
4020
- totalBalance: string;
3980
+ source: 'USER_OVERRIDE' | 'OPENBB_EQUITY' | 'OPENBB_CURRENCY';
4021
3981
  };
4022
3982
 
4023
- export type AccountsSummaryDto = {
4024
- /**
4025
- * Total number of accounts
4026
- */
4027
- totalAccounts: number;
4028
- /**
4029
- * Total number of platforms
4030
- */
4031
- totalPlatforms: number;
4032
- };
3983
+ /**
3984
+ * Price source
3985
+ */
3986
+ export type source2 = 'USER_OVERRIDE' | 'OPENBB_EQUITY' | 'OPENBB_CURRENCY';
4033
3987
 
4034
- export type AccountsResponseDto = {
3988
+ export type FxRateDto = {
3989
+ from: string;
3990
+ to: string;
4035
3991
  /**
4036
- * Account groups by platform
3992
+ * FX rate (Decimal string)
4037
3993
  */
4038
- groups: Array<PlatformGroupDto>;
3994
+ rate: string;
4039
3995
  /**
4040
- * Summary statistics
3996
+ * Rate date (ISO 8601)
4041
3997
  */
4042
- summary: AccountsSummaryDto;
3998
+ date: string;
4043
3999
  };
4044
4000
 
4045
- export type AccountItemWithAssetClassDto = {
4001
+ export type HoldingPnlRowDto = {
4046
4002
  /**
4047
- * Account ID
4003
+ * Account UUID
4048
4004
  */
4049
- id: string;
4005
+ accountId: string;
4050
4006
  /**
4051
- * Full account name
4007
+ * Full account path
4052
4008
  */
4053
- name: string;
4009
+ accountPath: string;
4054
4010
  /**
4055
- * Display name (last part of account path)
4011
+ * Account settlement currency (ISO 4217), from cost currency
4056
4012
  */
4057
- displayName: string;
4013
+ accountCcy?: {
4014
+ [key: string]: unknown;
4015
+ } | null;
4058
4016
  /**
4059
- * Account balance
4017
+ * Broker type derived from Platform.type
4060
4018
  */
4061
- balance: string;
4019
+ brokerType?: {
4020
+ [key: string]: unknown;
4021
+ } | null;
4062
4022
  /**
4063
- * Currency code
4023
+ * Commodity symbol
4064
4024
  */
4065
- currency: string;
4025
+ symbol: string;
4066
4026
  /**
4067
- * Asset class
4027
+ * Chart segment token (libs/common resolver)
4068
4028
  */
4029
+ chartToken: 'equity' | 'fund' | 'bond' | 'cash' | 'other';
4069
4030
  assetClass: string;
4031
+ assetSubClass?: {
4032
+ [key: string]: unknown;
4033
+ } | null;
4070
4034
  /**
4071
- * Asset sub-class (Prisma-compatible)
4035
+ * Net held units (Decimal string)
4072
4036
  */
4073
- assetSubClass?: string;
4037
+ units: string;
4074
4038
  /**
4075
- * Regional sub-class (region-specific, for display)
4039
+ * Average cost per unit; null when cost currency conflicts or no cost
4076
4040
  */
4077
- regionalSubClass?: string;
4041
+ averageCostPerUnit?: MonetaryDto | null;
4078
4042
  /**
4079
- * Risk level
4043
+ * Cost basis of held units
4080
4044
  */
4081
- riskLevel?: string;
4082
- };
4083
-
4084
- export type AssetClassGroupDto = {
4045
+ costBasis?: MonetaryDto | null;
4085
4046
  /**
4086
- * Asset class name
4047
+ * Market value at asOf price
4087
4048
  */
4088
- assetClass:
4089
- | 'LIQUIDITY'
4090
- | 'EQUITY'
4091
- | 'FIXED_INCOME'
4092
- | 'PRECIOUS_METALS'
4093
- | 'COMMODITY'
4094
- | 'INSURANCE'
4095
- | 'ALTERNATIVE_INVESTMENT'
4096
- | 'PERSONAL_ASSETS'
4097
- | 'LIABILITY'
4098
- | 'REAL_ESTATE'
4099
- | 'INDEX';
4049
+ marketValue?: MonetaryDto | null;
4100
4050
  /**
4101
- * Asset sub-class name
4102
- */
4103
- assetSubClass?: string;
4104
- /**
4105
- * Accounts within this asset class
4051
+ * Price used for market value
4106
4052
  */
4107
- accounts: Array<AccountItemWithAssetClassDto>;
4108
- /**
4109
- * Balances grouped by currency
4110
- */
4111
- balanceByCurrency: Array<BalanceByCurrencyDto>;
4112
- /**
4113
- * Converted balance in base currency
4114
- */
4115
- convertedBalance?: string;
4116
- };
4117
-
4118
- /**
4119
- * Asset class name
4120
- */
4121
- export type assetClass =
4122
- | 'LIQUIDITY'
4123
- | 'EQUITY'
4124
- | 'FIXED_INCOME'
4125
- | 'PRECIOUS_METALS'
4126
- | 'COMMODITY'
4127
- | 'INSURANCE'
4128
- | 'ALTERNATIVE_INVESTMENT'
4129
- | 'PERSONAL_ASSETS'
4130
- | 'LIABILITY'
4131
- | 'REAL_ESTATE'
4132
- | 'INDEX';
4133
-
4134
- export type AccountExchangeRateWarningDto = {
4053
+ currentPrice?: CurrentPriceDto | null;
4135
4054
  /**
4136
- * Warning type
4055
+ * Unrealized P&L in base currency (Decimal string); null when any FX/price missing
4137
4056
  */
4138
- type: string;
4057
+ unrealizedPnlBase?: {
4058
+ [key: string]: unknown;
4059
+ } | null;
4139
4060
  /**
4140
- * Currency without exchange rate
4061
+ * Unrealized P&L % (Decimal string)
4141
4062
  */
4142
- currency: string;
4063
+ unrealizedPnlPct?: {
4064
+ [key: string]: unknown;
4065
+ } | null;
4143
4066
  /**
4144
- * Affected account paths
4067
+ * Historical FX rate applied to cost basis
4145
4068
  */
4146
- accounts: Array<string>;
4069
+ costFxRate?: FxRateDto | null;
4147
4070
  /**
4148
- * Total amount in this currency
4071
+ * FX rate applied to market value
4149
4072
  */
4150
- totalAmount: string;
4151
- };
4152
-
4153
- export type AssetClassSummaryDto = {
4073
+ marketFxRate?: FxRateDto | null;
4154
4074
  /**
4155
- * Total number of accounts
4075
+ * Share of invested assets % (Decimal string); only for invested chartTokens
4156
4076
  */
4157
- totalAccounts: number;
4077
+ pctOfInvestedAssets?: {
4078
+ [key: string]: unknown;
4079
+ } | null;
4158
4080
  /**
4159
- * Total number of asset classes
4081
+ * Cumulative realized P&L on sold lots (asOf-date cutoff); null when the method has no applicable sells, a sell lacks a price, or any required FX rate is missing (never-mix). When a sell spans multiple currencies (cross-currency sale), amount and currency reflect the base currency; baseCcyEquivalent is always the authoritative dual-FX figure
4160
4082
  */
4161
- totalAssetClasses: number;
4083
+ realizedPnl?: MonetaryDto | null;
4084
+ };
4085
+
4086
+ /**
4087
+ * Chart segment token (libs/common resolver)
4088
+ */
4089
+ export type chartToken = 'equity' | 'fund' | 'bond' | 'cash' | 'other';
4090
+
4091
+ export type HoldingPnlWarningDto = {
4162
4092
  /**
4163
- * Base currency for conversion
4093
+ * Warning type
4164
4094
  */
4095
+ type:
4096
+ | 'MISSING_COST_FX_RATE'
4097
+ | 'MISSING_MARKET_FX_RATE'
4098
+ | 'MISSING_SALE_PRICE'
4099
+ | 'MISSING_REALIZED_FX_RATE'
4100
+ | 'OVERSOLD_LOTS'
4101
+ | 'NO_PRICE'
4102
+ | 'MIXED_COST_CURRENCY';
4103
+ symbol?: {
4104
+ [key: string]: unknown;
4105
+ } | null;
4106
+ accountId?: {
4107
+ [key: string]: unknown;
4108
+ } | null;
4109
+ currency?: {
4110
+ [key: string]: unknown;
4111
+ } | null;
4112
+ };
4113
+
4114
+ /**
4115
+ * Warning type
4116
+ */
4117
+ export type type4 =
4118
+ | 'MISSING_COST_FX_RATE'
4119
+ | 'MISSING_MARKET_FX_RATE'
4120
+ | 'MISSING_SALE_PRICE'
4121
+ | 'MISSING_REALIZED_FX_RATE'
4122
+ | 'OVERSOLD_LOTS'
4123
+ | 'NO_PRICE'
4124
+ | 'MIXED_COST_CURRENCY';
4125
+
4126
+ export type HoldingPnlResponseDto = {
4127
+ asOfDate: string;
4165
4128
  baseCurrency: string;
4166
4129
  /**
4167
- * Exchange rate warnings
4130
+ * Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).
4168
4131
  */
4169
- warnings?: Array<AccountExchangeRateWarningDto>;
4132
+ method: 'average' | 'FIFO';
4133
+ rows: Array<HoldingPnlRowDto>;
4134
+ warnings: Array<HoldingPnlWarningDto>;
4170
4135
  };
4171
4136
 
4172
- export type AssetClassAccountsResponseDto = {
4137
+ /**
4138
+ * Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).
4139
+ */
4140
+ export type method = 'average' | 'FIFO';
4141
+
4142
+ export type CreateBeanPriceDto = {
4173
4143
  /**
4174
- * Account groups by asset class
4144
+ * Currency being priced (e.g., USD, AAPL, BTC)
4175
4145
  */
4176
- groups: Array<AssetClassGroupDto>;
4146
+ currency: string;
4177
4147
  /**
4178
- * Summary statistics
4148
+ * Quote currency (pricing currency, e.g., CNY, EUR)
4179
4149
  */
4180
- summary: AssetClassSummaryDto;
4181
- };
4182
-
4183
- export type CashFlowByCurrencyDto = {
4150
+ quoteCurrency: string;
4184
4151
  /**
4185
- * Income by currency
4152
+ * Price amount (MUST be >= 0 per Beancount spec, supports up to 15 decimal places). Zero allowed for conversion entries, negative strictly prohibited.
4186
4153
  */
4187
- income: Array<BalanceByCurrencyDto>;
4154
+ amount: number;
4188
4155
  /**
4189
- * Expense by currency
4156
+ * Price date (ISO 8601 format)
4190
4157
  */
4191
- expense: Array<BalanceByCurrencyDto>;
4158
+ date: string;
4192
4159
  /**
4193
- * Net savings by currency
4160
+ * Metadata (validated by Zod schema, max field lengths enforced)
4194
4161
  */
4195
- netSavings: Array<BalanceByCurrencyDto>;
4162
+ metadata?: {
4163
+ [key: string]: unknown;
4164
+ };
4196
4165
  };
4197
4166
 
4198
- export type ConvertedCashFlowDto = {
4167
+ export type PriceResponseDto = {
4199
4168
  /**
4200
- * Base currency for conversion
4169
+ * Unique identifier
4201
4170
  */
4202
- baseCurrency: string;
4171
+ id: string;
4203
4172
  /**
4204
- * Converted income
4173
+ * User ID (owner of the price)
4205
4174
  */
4206
- income: string;
4175
+ userId: string;
4207
4176
  /**
4208
- * Converted expense
4177
+ * Currency being priced (e.g., USD, AAPL, BTC)
4209
4178
  */
4210
- expense: string;
4179
+ currency: string;
4211
4180
  /**
4212
- * Converted net savings
4181
+ * Quote currency (pricing currency, e.g., USD, CNY)
4213
4182
  */
4214
- netSavings: string;
4183
+ quoteCurrency: string;
4215
4184
  /**
4216
- * Exchange rates used for conversion
4185
+ * Price amount (corresponds to Beancount Amount.number). Supports up to 15 decimal places.
4217
4186
  */
4218
- exchangeRates: {
4187
+ amount: number;
4188
+ /**
4189
+ * Price date (ISO 8601 format). Represents the date this price was valid.
4190
+ */
4191
+ date: string;
4192
+ /**
4193
+ * Metadata (corresponds to Beancount meta field). Contains source, confidence, note, etc.
4194
+ */
4195
+ meta: {
4219
4196
  [key: string]: unknown;
4220
4197
  };
4221
- };
4222
-
4223
- export type CashFlowResponseDto = {
4224
4198
  /**
4225
- * Period identifier (YYYY-MM)
4199
+ * Creation timestamp
4226
4200
  */
4227
- period: string;
4201
+ createdAt: string;
4228
4202
  /**
4229
- * Total income for the period (converted)
4203
+ * Last update timestamp
4230
4204
  */
4231
- income: string;
4205
+ updatedAt: string;
4206
+ };
4207
+
4208
+ export type PriceListResponseDto = {
4232
4209
  /**
4233
- * Total expenses for the period (converted)
4210
+ * List of prices
4234
4211
  */
4235
- expense: string;
4212
+ items: Array<PriceResponseDto>;
4236
4213
  /**
4237
- * Net savings (income - expense, converted)
4214
+ * Total number of prices
4238
4215
  */
4239
- netSavings: string;
4216
+ total: number;
4217
+ };
4218
+
4219
+ export type UpdateBeanPriceDto = {
4240
4220
  /**
4241
- * Savings rate percentage (netSavings / income * 100)
4221
+ * Currency being priced
4242
4222
  */
4243
- savingsRate: string;
4223
+ currency?: string;
4244
4224
  /**
4245
- * Base currency code
4225
+ * Quote currency (pricing currency)
4246
4226
  */
4247
- currency: string;
4227
+ quoteCurrency?: string;
4248
4228
  /**
4249
- * Cash flow grouped by original currency
4229
+ * Price amount (MUST be >= 0 per Beancount spec)
4250
4230
  */
4251
- byCurrency?: CashFlowByCurrencyDto;
4231
+ amount?: number;
4252
4232
  /**
4253
- * Converted values in base currency
4233
+ * Price date (ISO 8601 format)
4254
4234
  */
4255
- converted?: ConvertedCashFlowDto;
4235
+ date?: string;
4256
4236
  /**
4257
- * Exchange rate warnings
4237
+ * Metadata
4258
4238
  */
4259
- warnings?: Array<ExchangeRateWarningDto>;
4239
+ metadata?: {
4240
+ [key: string]: unknown;
4241
+ };
4260
4242
  };
4261
4243
 
4262
4244
  export type CurrencyBalanceDto = {
@@ -4375,7 +4357,7 @@ export type AccountControllerCreateData = {
4375
4357
  requestBody: CreateAccountDto;
4376
4358
  };
4377
4359
 
4378
- export type AccountControllerCreateResponse = AccountResponseDto;
4360
+ export type AccountControllerCreateResponse = unknown;
4379
4361
 
4380
4362
  export type AccountControllerFindAllData = {
4381
4363
  /**
@@ -4424,9 +4406,6 @@ export type AccountControllerFindOneData = {
4424
4406
  export type AccountControllerFindOneResponse = AccountResponseDto;
4425
4407
 
4426
4408
  export type AccountControllerUpdateData = {
4427
- /**
4428
- * Account UUID
4429
- */
4430
4409
  id: string;
4431
4410
  /**
4432
4411
  * Region code for tenant context
@@ -4435,12 +4414,9 @@ export type AccountControllerUpdateData = {
4435
4414
  requestBody: UpdateAccountDto;
4436
4415
  };
4437
4416
 
4438
- export type AccountControllerUpdateResponse = AccountResponseDto;
4417
+ export type AccountControllerUpdateResponse = unknown;
4439
4418
 
4440
4419
  export type AccountControllerDeleteData = {
4441
- /**
4442
- * Account UUID
4443
- */
4444
4420
  id: string;
4445
4421
  /**
4446
4422
  * Region code for tenant context
@@ -4448,12 +4424,9 @@ export type AccountControllerDeleteData = {
4448
4424
  region: 'cn' | 'us' | 'de' | 'gb';
4449
4425
  };
4450
4426
 
4451
- export type AccountControllerDeleteResponse = void;
4427
+ export type AccountControllerDeleteResponse = unknown;
4452
4428
 
4453
4429
  export type AccountControllerCloseData = {
4454
- /**
4455
- * Account UUID
4456
- */
4457
4430
  id: string;
4458
4431
  /**
4459
4432
  * Region code for tenant context
@@ -4462,12 +4435,9 @@ export type AccountControllerCloseData = {
4462
4435
  requestBody: CloseAccountDto;
4463
4436
  };
4464
4437
 
4465
- export type AccountControllerCloseResponse = AccountResponseDto;
4438
+ export type AccountControllerCloseResponse = unknown;
4466
4439
 
4467
4440
  export type AccountControllerReopenData = {
4468
- /**
4469
- * Account UUID
4470
- */
4471
4441
  id: string;
4472
4442
  /**
4473
4443
  * Region code for tenant context
@@ -4476,7 +4446,7 @@ export type AccountControllerReopenData = {
4476
4446
  requestBody: ReopenAccountDto;
4477
4447
  };
4478
4448
 
4479
- export type AccountControllerReopenResponse = AccountResponseDto;
4449
+ export type AccountControllerReopenResponse = unknown;
4480
4450
 
4481
4451
  export type AccountStandardsControllerGetTemplatesData = {
4482
4452
  /**
@@ -4581,6 +4551,20 @@ export type TransactionControllerCreateBatchData = {
4581
4551
  export type TransactionControllerCreateBatchResponse =
4582
4552
  BatchTransactionResponseDto;
4583
4553
 
4554
+ export type TransactionControllerCorrectData = {
4555
+ /**
4556
+ * Original transaction ID to correct
4557
+ */
4558
+ id: string;
4559
+ /**
4560
+ * Region code for tenant context
4561
+ */
4562
+ region: 'cn' | 'us' | 'de' | 'gb';
4563
+ requestBody: CorrectTransactionDto;
4564
+ };
4565
+
4566
+ export type TransactionControllerCorrectResponse = TransactionDetailDto;
4567
+
4584
4568
  export type TransactionControllerSuggestTagsData = {
4585
4569
  /**
4586
4570
  * Max suggestions (1-100, default 10)
@@ -5544,25 +5528,13 @@ export type FileImportControllerIdentifyFileData = {
5544
5528
  export type FileImportControllerIdentifyFileResponse = IdentifyResultDto;
5545
5529
 
5546
5530
  export type FileImportControllerImportBeancountData = {
5547
- /**
5548
- * Beancount file to import
5549
- */
5550
- formData: FileImportDto;
5551
5531
  /**
5552
5532
  * Region code for tenant context
5553
5533
  */
5554
5534
  region: 'cn' | 'us' | 'de' | 'gb';
5555
5535
  };
5556
5536
 
5557
- export type FileImportControllerImportBeancountResponse = {
5558
- imported?: number;
5559
- skipped?: number;
5560
- failed?: number;
5561
- accountsCreated?: number;
5562
- errors?: Array<{
5563
- [key: string]: unknown;
5564
- }>;
5565
- };
5537
+ export type FileImportControllerImportBeancountResponse = unknown;
5566
5538
 
5567
5539
  export type ImporterConfigControllerGetConfigData = {
5568
5540
  /**
@@ -5650,26 +5622,15 @@ export type PlatformControllerDeleteData = {
5650
5622
  export type PlatformControllerDeleteResponse = void;
5651
5623
 
5652
5624
  export type ProviderSyncControllerSyncData = {
5625
+ providerName: string;
5653
5626
  /**
5654
- * Provider name
5655
- */
5656
- providerName:
5657
- | 'plaid'
5658
- | 'teller'
5659
- | 'truelayer'
5660
- | 'gocardless'
5661
- | 'simplefin'
5662
- | 'yodlee'
5663
- | 'beancount-direct'
5664
- | 'parsed-bill';
5665
- /**
5666
- * Region code
5627
+ * Region code for tenant context
5667
5628
  */
5668
- region: unknown;
5629
+ region: 'cn' | 'us' | 'de' | 'gb';
5669
5630
  requestBody: ProviderSyncDto;
5670
5631
  };
5671
5632
 
5672
- export type ProviderSyncControllerSyncResponse = ProviderSyncResponseDto;
5633
+ export type ProviderSyncControllerSyncResponse = unknown;
5673
5634
 
5674
5635
  export type ProviderSyncControllerGetSupportedProvidersData = {
5675
5636
  /**
@@ -5678,115 +5639,262 @@ export type ProviderSyncControllerGetSupportedProvidersData = {
5678
5639
  region: 'cn' | 'us' | 'de' | 'gb';
5679
5640
  };
5680
5641
 
5681
- export type ProviderSyncControllerGetSupportedProvidersResponse =
5682
- SupportedProvidersResponseDto;
5642
+ export type ProviderSyncControllerGetSupportedProvidersResponse =
5643
+ SupportedProvidersResponseDto;
5644
+
5645
+ export type ProviderSyncControllerIsProviderSupportedData = {
5646
+ /**
5647
+ * Provider name to check
5648
+ */
5649
+ providerName: string;
5650
+ /**
5651
+ * Region code for tenant context
5652
+ */
5653
+ region: 'cn' | 'us' | 'de' | 'gb';
5654
+ };
5655
+
5656
+ export type ProviderSyncControllerIsProviderSupportedResponse = unknown;
5657
+
5658
+ export type TelemetryControllerReportTelemetryData = {
5659
+ /**
5660
+ * Region code for tenant context
5661
+ */
5662
+ region: 'cn' | 'us' | 'de' | 'gb';
5663
+ requestBody: ParserTelemetryReportDto;
5664
+ };
5665
+
5666
+ export type TelemetryControllerReportTelemetryResponse = unknown;
5667
+
5668
+ export type TelemetryControllerReportCoverageMissData = {
5669
+ /**
5670
+ * Region code for tenant context
5671
+ */
5672
+ region: 'cn' | 'us' | 'de' | 'gb';
5673
+ requestBody: UncoveredFormatMissDto;
5674
+ };
5675
+
5676
+ export type TelemetryControllerReportCoverageMissResponse = unknown;
5677
+
5678
+ export type TelemetryControllerGetCoverageMetricsData = {
5679
+ /**
5680
+ * Region code for tenant context
5681
+ */
5682
+ region: 'cn' | 'us' | 'de' | 'gb';
5683
+ /**
5684
+ * Top-N uncovered formats (default 10)
5685
+ */
5686
+ topN?: unknown;
5687
+ };
5688
+
5689
+ export type TelemetryControllerGetCoverageMetricsResponse = unknown;
5690
+
5691
+ export type NlpControllerProcessNaturalLanguageData = {
5692
+ /**
5693
+ * Region code for tenant context
5694
+ */
5695
+ region: 'cn' | 'us' | 'de' | 'gb';
5696
+ requestBody: ProcessNlpDto;
5697
+ };
5698
+
5699
+ export type NlpControllerProcessNaturalLanguageResponse = unknown;
5700
+
5701
+ export type NlpControllerClearSessionData = {
5702
+ /**
5703
+ * Region code for tenant context
5704
+ */
5705
+ region: 'cn' | 'us' | 'de' | 'gb';
5706
+ /**
5707
+ * Specific session ID to clear (defaults to user session)
5708
+ */
5709
+ sessionId?: string;
5710
+ };
5711
+
5712
+ export type NlpControllerClearSessionResponse = void;
5713
+
5714
+ export type NlpControllerGetSessionData = {
5715
+ /**
5716
+ * Region code for tenant context
5717
+ */
5718
+ region: 'cn' | 'us' | 'de' | 'gb';
5719
+ /**
5720
+ * Specific session ID to get (defaults to user session)
5721
+ */
5722
+ sessionId?: string;
5723
+ };
5724
+
5725
+ export type NlpControllerGetSessionResponse = unknown;
5726
+
5727
+ export type DashboardControllerGetNetWorthData = {
5728
+ /**
5729
+ * Date for balance calculation (ISO 8601 format)
5730
+ */
5731
+ date?: string;
5732
+ /**
5733
+ * Region code for tenant context
5734
+ */
5735
+ region: 'cn' | 'us' | 'de' | 'gb';
5736
+ };
5737
+
5738
+ export type DashboardControllerGetNetWorthResponse = NetWorthResponseDto;
5739
+
5740
+ export type DashboardControllerGetAccountsData = {
5741
+ /**
5742
+ * Scope to a single account (only valid with groupBy=holdingAssetClass, ADR-0105 §6)
5743
+ */
5744
+ accountId?: string;
5745
+ /**
5746
+ * Date for balance calculation (ISO 8601 format)
5747
+ */
5748
+ date?: string;
5749
+ /**
5750
+ * Grouping strategy
5751
+ */
5752
+ groupBy?:
5753
+ | 'platform'
5754
+ | 'assetClass'
5755
+ | 'holdingAssetClass'
5756
+ | 'holdingAssetClassByAccount';
5757
+ /**
5758
+ * Region code for tenant context
5759
+ */
5760
+ region: 'cn' | 'us' | 'de' | 'gb';
5761
+ };
5762
+
5763
+ export type DashboardControllerGetAccountsResponse =
5764
+ | AccountsResponseDto
5765
+ | AssetClassAccountsResponseDto
5766
+ | HoldingAssetClassCrossAccountResponseDto;
5683
5767
 
5684
- export type ProviderSyncControllerIsProviderSupportedData = {
5768
+ export type DashboardControllerGetCashFlowData = {
5685
5769
  /**
5686
- * Provider name to check
5770
+ * Period in YYYY-MM format
5687
5771
  */
5688
- providerName: string;
5772
+ period: string;
5689
5773
  /**
5690
5774
  * Region code for tenant context
5691
5775
  */
5692
5776
  region: 'cn' | 'us' | 'de' | 'gb';
5693
5777
  };
5694
5778
 
5695
- export type ProviderSyncControllerIsProviderSupportedResponse = unknown;
5779
+ export type DashboardControllerGetCashFlowResponse = CashFlowResponseDto;
5696
5780
 
5697
- export type TelemetryControllerReportTelemetryData = {
5781
+ export type HoldingPnlControllerGetHoldingPnlData = {
5782
+ /**
5783
+ * Scope to a single account
5784
+ */
5785
+ accountId?: string;
5786
+ /**
5787
+ * As-of date (ISO 8601), defaults to today
5788
+ */
5789
+ asOf?: string;
5790
+ /**
5791
+ * Realized-P&L lot-matching method (default average). Does not affect the average-cost unrealized basis.
5792
+ */
5793
+ method?: 'FIFO' | 'average';
5698
5794
  /**
5699
5795
  * Region code for tenant context
5700
5796
  */
5701
5797
  region: 'cn' | 'us' | 'de' | 'gb';
5702
- requestBody: ParserTelemetryReportDto;
5703
5798
  };
5704
5799
 
5705
- export type TelemetryControllerReportTelemetryResponse = unknown;
5800
+ export type HoldingPnlControllerGetHoldingPnlResponse = HoldingPnlResponseDto;
5706
5801
 
5707
- export type NlpControllerProcessNaturalLanguageData = {
5802
+ export type PriceControllerCreateData = {
5708
5803
  /**
5709
5804
  * Region code for tenant context
5710
5805
  */
5711
5806
  region: 'cn' | 'us' | 'de' | 'gb';
5712
- /**
5713
- * Natural language transaction input with optional session ID
5714
- */
5715
- requestBody: ProcessNlpDto;
5807
+ requestBody: CreateBeanPriceDto;
5716
5808
  };
5717
5809
 
5718
- export type NlpControllerProcessNaturalLanguageResponse = NlpResponseDto;
5810
+ export type PriceControllerCreateResponse = PriceResponseDto;
5719
5811
 
5720
- export type NlpControllerClearSessionData = {
5812
+ export type PriceControllerFindAllData = {
5813
+ /**
5814
+ * Filter by currency (e.g., BTC, AAPL, USD)
5815
+ */
5816
+ currency?: string;
5817
+ /**
5818
+ * Filter prices from this date (ISO 8601 format)
5819
+ */
5820
+ dateFrom?: string;
5821
+ /**
5822
+ * Filter prices to this date (ISO 8601 format)
5823
+ */
5824
+ dateTo?: string;
5825
+ /**
5826
+ * Number of items per page (default: 20, max: 100)
5827
+ */
5828
+ limit?: number;
5829
+ /**
5830
+ * Page number for pagination (default: 1)
5831
+ */
5832
+ page?: number;
5833
+ /**
5834
+ * Filter by quote currency (pricing currency, e.g., USD, CNY)
5835
+ */
5836
+ quoteCurrency?: string;
5721
5837
  /**
5722
5838
  * Region code for tenant context
5723
5839
  */
5724
5840
  region: 'cn' | 'us' | 'de' | 'gb';
5725
5841
  /**
5726
- * Specific session ID to clear (defaults to user session)
5842
+ * Search term for currency or quoteCurrency (case-insensitive partial match)
5727
5843
  */
5728
- sessionId?: string;
5844
+ search?: string;
5729
5845
  };
5730
5846
 
5731
- export type NlpControllerClearSessionResponse = void;
5847
+ export type PriceControllerFindAllResponse = PriceListResponseDto;
5732
5848
 
5733
- export type NlpControllerGetSessionData = {
5849
+ export type PriceControllerFindOneData = {
5734
5850
  /**
5735
- * Region code for tenant context
5851
+ * Price ID
5736
5852
  */
5737
- region: 'cn' | 'us' | 'de' | 'gb';
5853
+ id: string;
5738
5854
  /**
5739
- * Specific session ID to get (defaults to user session)
5855
+ * Region code for tenant context
5740
5856
  */
5741
- sessionId?: string;
5857
+ region: 'cn' | 'us' | 'de' | 'gb';
5742
5858
  };
5743
5859
 
5744
- export type NlpControllerGetSessionResponse = unknown;
5860
+ export type PriceControllerFindOneResponse = PriceResponseDto;
5745
5861
 
5746
- export type DashboardControllerGetNetWorthData = {
5862
+ export type PriceControllerUpdateData = {
5747
5863
  /**
5748
- * Date for balance calculation (ISO 8601 format)
5864
+ * Price ID
5749
5865
  */
5750
- date?: string;
5866
+ id: string;
5751
5867
  /**
5752
5868
  * Region code for tenant context
5753
5869
  */
5754
5870
  region: 'cn' | 'us' | 'de' | 'gb';
5871
+ requestBody: UpdateBeanPriceDto;
5755
5872
  };
5756
5873
 
5757
- export type DashboardControllerGetNetWorthResponse = NetWorthResponseDto;
5874
+ export type PriceControllerUpdateResponse = PriceResponseDto;
5758
5875
 
5759
- export type DashboardControllerGetAccountsData = {
5876
+ export type PriceControllerDeleteData = {
5760
5877
  /**
5761
- * Date for balance calculation (ISO 8601 format)
5762
- */
5763
- date?: string;
5764
- /**
5765
- * Grouping strategy
5878
+ * Price ID
5766
5879
  */
5767
- groupBy?: 'platform' | 'assetClass';
5880
+ id: string;
5768
5881
  /**
5769
5882
  * Region code for tenant context
5770
5883
  */
5771
5884
  region: 'cn' | 'us' | 'de' | 'gb';
5772
5885
  };
5773
5886
 
5774
- export type DashboardControllerGetAccountsResponse =
5775
- | AccountsResponseDto
5776
- | AssetClassAccountsResponseDto;
5887
+ export type PriceControllerDeleteResponse = void;
5777
5888
 
5778
- export type DashboardControllerGetCashFlowData = {
5779
- /**
5780
- * Period in YYYY-MM format
5781
- */
5782
- period: string;
5889
+ export type PriceControllerBulkCreateData = {
5783
5890
  /**
5784
5891
  * Region code for tenant context
5785
5892
  */
5786
5893
  region: 'cn' | 'us' | 'de' | 'gb';
5894
+ requestBody: Array<string>;
5787
5895
  };
5788
5896
 
5789
- export type DashboardControllerGetCashFlowResponse = CashFlowResponseDto;
5897
+ export type PriceControllerBulkCreateResponse = Array<PriceResponseDto>;
5790
5898
 
5791
5899
  export type ReportingControllerGetPortfolioTrendsData = {
5792
5900
  /**
@@ -5882,14 +5990,7 @@ export type $OpenApiTs = {
5882
5990
  post: {
5883
5991
  req: AccountControllerCreateData;
5884
5992
  res: {
5885
- /**
5886
- * Account created successfully
5887
- */
5888
- 201: AccountResponseDto;
5889
- /**
5890
- * Account already exists
5891
- */
5892
- 409: unknown;
5993
+ 201: unknown;
5893
5994
  };
5894
5995
  };
5895
5996
  get: {
@@ -5919,31 +6020,13 @@ export type $OpenApiTs = {
5919
6020
  put: {
5920
6021
  req: AccountControllerUpdateData;
5921
6022
  res: {
5922
- /**
5923
- * Account updated successfully
5924
- */
5925
- 200: AccountResponseDto;
5926
- /**
5927
- * Account not found
5928
- */
5929
- 404: unknown;
6023
+ 200: unknown;
5930
6024
  };
5931
6025
  };
5932
6026
  delete: {
5933
6027
  req: AccountControllerDeleteData;
5934
6028
  res: {
5935
- /**
5936
- * Account deleted successfully
5937
- */
5938
- 204: void;
5939
- /**
5940
- * Account not found
5941
- */
5942
- 404: unknown;
5943
- /**
5944
- * Account has transactions and cannot be deleted
5945
- */
5946
- 409: unknown;
6029
+ 200: unknown;
5947
6030
  };
5948
6031
  };
5949
6032
  };
@@ -5951,18 +6034,7 @@ export type $OpenApiTs = {
5951
6034
  post: {
5952
6035
  req: AccountControllerCloseData;
5953
6036
  res: {
5954
- /**
5955
- * Account closed successfully
5956
- */
5957
- 200: AccountResponseDto;
5958
- /**
5959
- * Account is already closed
5960
- */
5961
- 400: unknown;
5962
- /**
5963
- * Account not found
5964
- */
5965
- 404: unknown;
6037
+ 201: unknown;
5966
6038
  };
5967
6039
  };
5968
6040
  };
@@ -5970,18 +6042,7 @@ export type $OpenApiTs = {
5970
6042
  post: {
5971
6043
  req: AccountControllerReopenData;
5972
6044
  res: {
5973
- /**
5974
- * Account reopened successfully
5975
- */
5976
- 200: AccountResponseDto;
5977
- /**
5978
- * Account is not closed
5979
- */
5980
- 400: unknown;
5981
- /**
5982
- * Account not found
5983
- */
5984
- 404: unknown;
6045
+ 201: unknown;
5985
6046
  };
5986
6047
  };
5987
6048
  };
@@ -6081,6 +6142,29 @@ export type $OpenApiTs = {
6081
6142
  };
6082
6143
  };
6083
6144
  };
6145
+ '/api/v1/{region}/bean/transactions/{id}/correct': {
6146
+ post: {
6147
+ req: TransactionControllerCorrectData;
6148
+ res: {
6149
+ /**
6150
+ * Corrected transaction created
6151
+ */
6152
+ 201: TransactionDetailDto;
6153
+ /**
6154
+ * Original transaction not found
6155
+ */
6156
+ 404: ApiProblemResponseDto;
6157
+ /**
6158
+ * Original no longer ACTIVE (concurrent modification)
6159
+ */
6160
+ 409: ApiProblemResponseDto;
6161
+ /**
6162
+ * Pipeline validation failed (does not balance, invalid accounts)
6163
+ */
6164
+ 422: ApiProblemResponseDto;
6165
+ };
6166
+ };
6167
+ };
6084
6168
  '/api/v1/{region}/bean/transactions/tags': {
6085
6169
  get: {
6086
6170
  req: TransactionControllerSuggestTagsData;
@@ -7294,22 +7378,7 @@ export type $OpenApiTs = {
7294
7378
  post: {
7295
7379
  req: FileImportControllerImportBeancountData;
7296
7380
  res: {
7297
- /**
7298
- * Beancount file imported successfully
7299
- */
7300
- 200: {
7301
- imported?: number;
7302
- skipped?: number;
7303
- failed?: number;
7304
- accountsCreated?: number;
7305
- errors?: Array<{
7306
- [key: string]: unknown;
7307
- }>;
7308
- };
7309
- /**
7310
- * Bad request - invalid file or no file uploaded
7311
- */
7312
- 400: ApiProblemResponseDto;
7381
+ 201: unknown;
7313
7382
  };
7314
7383
  };
7315
7384
  };
@@ -7440,22 +7509,7 @@ export type $OpenApiTs = {
7440
7509
  post: {
7441
7510
  req: ProviderSyncControllerSyncData;
7442
7511
  res: {
7443
- /**
7444
- * Sync completed successfully
7445
- */
7446
- 200: ProviderSyncResponseDto;
7447
- /**
7448
- * Invalid request data
7449
- */
7450
- 400: unknown;
7451
- /**
7452
- * Missing or invalid authentication
7453
- */
7454
- 401: unknown;
7455
- /**
7456
- * Provider not supported
7457
- */
7458
- 404: unknown;
7512
+ 201: unknown;
7459
7513
  };
7460
7514
  };
7461
7515
  };
@@ -7504,18 +7558,14 @@ export type $OpenApiTs = {
7504
7558
  };
7505
7559
  };
7506
7560
  };
7507
- '/api/v1/{region}/bean/nlp/process': {
7561
+ '/api/v1/{region}/bean/import/parser-coverage-miss': {
7508
7562
  post: {
7509
- req: NlpControllerProcessNaturalLanguageData;
7563
+ req: TelemetryControllerReportCoverageMissData;
7510
7564
  res: {
7511
7565
  /**
7512
- * NLP processing result - either created transaction or asking for more info
7513
- */
7514
- 200: NlpResponseDto;
7515
- /**
7516
- * Invalid input
7566
+ * Coverage miss report received
7517
7567
  */
7518
- 400: unknown;
7568
+ 200: unknown;
7519
7569
  /**
7520
7570
  * Unauthorized
7521
7571
  */
@@ -7523,6 +7573,25 @@ export type $OpenApiTs = {
7523
7573
  };
7524
7574
  };
7525
7575
  };
7576
+ '/api/v1/{region}/bean/import/parser-coverage-metrics': {
7577
+ get: {
7578
+ req: TelemetryControllerGetCoverageMetricsData;
7579
+ res: {
7580
+ /**
7581
+ * Coverage metrics
7582
+ */
7583
+ 200: unknown;
7584
+ };
7585
+ };
7586
+ };
7587
+ '/api/v1/{region}/bean/nlp/process': {
7588
+ post: {
7589
+ req: NlpControllerProcessNaturalLanguageData;
7590
+ res: {
7591
+ 201: unknown;
7592
+ };
7593
+ };
7594
+ };
7526
7595
  '/api/v1/{region}/bean/nlp/session': {
7527
7596
  delete: {
7528
7597
  req: NlpControllerClearSessionData;
@@ -7573,7 +7642,10 @@ export type $OpenApiTs = {
7573
7642
  /**
7574
7643
  * Accounts retrieved successfully. Response type depends on groupBy parameter.
7575
7644
  */
7576
- 200: AccountsResponseDto | AssetClassAccountsResponseDto;
7645
+ 200:
7646
+ | AccountsResponseDto
7647
+ | AssetClassAccountsResponseDto
7648
+ | HoldingAssetClassCrossAccountResponseDto;
7577
7649
  /**
7578
7650
  * User not authenticated
7579
7651
  */
@@ -7600,6 +7672,109 @@ export type $OpenApiTs = {
7600
7672
  };
7601
7673
  };
7602
7674
  };
7675
+ '/api/v1/{region}/investment/holdings/pnl': {
7676
+ get: {
7677
+ req: HoldingPnlControllerGetHoldingPnlData;
7678
+ res: {
7679
+ /**
7680
+ * Holding P&L retrieved successfully
7681
+ */
7682
+ 200: HoldingPnlResponseDto;
7683
+ /**
7684
+ * Invalid asOf format/value/future date, invalid accountId format, or unsupported method
7685
+ */
7686
+ 400: unknown;
7687
+ /**
7688
+ * User not authenticated
7689
+ */
7690
+ 401: unknown;
7691
+ };
7692
+ };
7693
+ };
7694
+ '/api/v1/{region}/bean/prices': {
7695
+ post: {
7696
+ req: PriceControllerCreateData;
7697
+ res: {
7698
+ /**
7699
+ * Price created successfully
7700
+ */
7701
+ 201: PriceResponseDto;
7702
+ /**
7703
+ * Currency or quoteCurrency commodity not found
7704
+ */
7705
+ 404: unknown;
7706
+ /**
7707
+ * Price already exists for this currency pair and date
7708
+ */
7709
+ 409: unknown;
7710
+ };
7711
+ };
7712
+ get: {
7713
+ req: PriceControllerFindAllData;
7714
+ res: {
7715
+ /**
7716
+ * Prices retrieved successfully
7717
+ */
7718
+ 200: PriceListResponseDto;
7719
+ };
7720
+ };
7721
+ };
7722
+ '/api/v1/{region}/bean/prices/{id}': {
7723
+ get: {
7724
+ req: PriceControllerFindOneData;
7725
+ res: {
7726
+ /**
7727
+ * Price retrieved successfully
7728
+ */
7729
+ 200: PriceResponseDto;
7730
+ /**
7731
+ * Price not found
7732
+ */
7733
+ 404: unknown;
7734
+ };
7735
+ };
7736
+ put: {
7737
+ req: PriceControllerUpdateData;
7738
+ res: {
7739
+ /**
7740
+ * Price updated successfully
7741
+ */
7742
+ 200: PriceResponseDto;
7743
+ /**
7744
+ * Price not found
7745
+ */
7746
+ 404: unknown;
7747
+ /**
7748
+ * Updated price conflicts with existing price
7749
+ */
7750
+ 409: unknown;
7751
+ };
7752
+ };
7753
+ delete: {
7754
+ req: PriceControllerDeleteData;
7755
+ res: {
7756
+ /**
7757
+ * Price deleted successfully
7758
+ */
7759
+ 204: void;
7760
+ /**
7761
+ * Price not found
7762
+ */
7763
+ 404: unknown;
7764
+ };
7765
+ };
7766
+ };
7767
+ '/api/v1/{region}/bean/prices/bulk': {
7768
+ post: {
7769
+ req: PriceControllerBulkCreateData;
7770
+ res: {
7771
+ /**
7772
+ * Prices created successfully
7773
+ */
7774
+ 201: Array<PriceResponseDto>;
7775
+ };
7776
+ };
7777
+ };
7603
7778
  '/api/v1/{region}/reporting/portfolio/trends': {
7604
7779
  get: {
7605
7780
  req: ReportingControllerGetPortfolioTrendsData;