@firela/api-types 0.0.0-canary.6a42fd0e → 0.0.0-canary.6b17fb8b

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.
@@ -6,18 +6,12 @@ export const $CreateAccountDto = {
6
6
  path: {
7
7
  type: 'string',
8
8
  description: 'Account path (hierarchical, colon-separated)',
9
- example: 'Assets:CN:Bank:ICBC:Checking'
10
- },
11
- displayName: {
12
- type: 'string',
13
- description:
14
- 'Display name to distinguish accounts at the same path (default: "")',
15
- example: '工资卡'
9
+ example: 'Assets:CN:ICBC:Checking'
16
10
  },
17
11
  openDate: {
18
12
  format: 'date-time',
19
13
  type: 'string',
20
- description: 'Account open date',
14
+ description: 'Account open date (server defaults to today)',
21
15
  example: '2024-01-01'
22
16
  },
23
17
  currencies: {
@@ -45,26 +39,22 @@ export const $CreateAccountDto = {
45
39
  templatePath: {
46
40
  type: 'string',
47
41
  description: 'Reference to account-standards template path',
48
- example: 'Assets:CN:Bank:ICBC:Checking'
42
+ example: 'Assets:CN:Checking'
49
43
  },
50
44
  isCustom: {
51
45
  type: 'boolean',
52
46
  description: 'Whether this is a custom (user-created) account',
53
47
  default: false
54
48
  },
55
- i18nKey: {
56
- type: 'string',
57
- description: 'i18n key for display name (overrides template)',
58
- example: 'account.custom.mybank'
59
- },
60
49
  icon: {
61
50
  type: 'string',
62
51
  description: 'Icon identifier (overrides template)',
63
52
  example: 'bank-custom'
64
53
  },
65
- openMeta: {
54
+ openDirectiveMeta: {
66
55
  type: 'object',
67
- description: 'Additional metadata',
56
+ description:
57
+ 'Open directive metadata (NOT an opening-balance amount — use the opening-balance endpoint)',
68
58
  example: {
69
59
  branch: 'Downtown',
70
60
  accountNumber: '1234'
@@ -76,7 +66,7 @@ export const $CreateAccountDto = {
76
66
  example: 'c98e5d4a-2f71-4a5a-bb3c-92c9f231d5e2'
77
67
  }
78
68
  },
79
- required: ['path', 'openDate']
69
+ required: ['path']
80
70
  } as const;
81
71
 
82
72
  export const $AccountResponseDto = {
@@ -90,13 +80,7 @@ export const $AccountResponseDto = {
90
80
  path: {
91
81
  type: 'string',
92
82
  description: 'Account path (hierarchical, colon-separated)',
93
- example: 'Assets:CN:Bank:ICBC:Checking'
94
- },
95
- displayName: {
96
- type: 'string',
97
- description:
98
- 'Display name distinguishing multiple accounts at the same path',
99
- example: '工资卡'
83
+ example: 'Assets:CN:ICBC:Checking'
100
84
  },
101
85
  type: {
102
86
  type: 'string',
@@ -104,6 +88,49 @@ export const $AccountResponseDto = {
104
88
  enum: ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity'],
105
89
  example: 'Assets'
106
90
  },
91
+ assetSubClass: {
92
+ type: 'string',
93
+ description:
94
+ 'Account-level asset sub-class (product type, e.g. STOCK/DEPOSIT/CREDIT_CARD/PERSONAL_LOAN). Computed from the account path via the asset-classifier (ADR-0077). Null for non-asset accounts (Income/Expenses/Equity) or unmatched paths.',
95
+ enum: [
96
+ 'DEPOSIT',
97
+ 'CASH',
98
+ 'MONEY_MARKET_FUND',
99
+ 'STOCK',
100
+ 'ETF',
101
+ 'MUTUAL_FUND',
102
+ 'EQUITY_COMPENSATION',
103
+ 'GOVERNMENT_BOND',
104
+ 'CORPORATE_BOND',
105
+ 'BOND_FUND',
106
+ 'PRIMARY_RESIDENCE',
107
+ 'INVESTMENT_PROPERTY',
108
+ 'REIT',
109
+ 'GOLD',
110
+ 'SILVER',
111
+ 'PRECIOUS_METAL',
112
+ 'PRECIOUS_METAL_FUND',
113
+ 'COMMODITY',
114
+ 'COMMODITY_FUND',
115
+ 'CRYPTOCURRENCY',
116
+ 'RETIREMENT_ACCOUNT',
117
+ 'HEALTH_ACCOUNT',
118
+ 'EDUCATION_ACCOUNT',
119
+ 'INSURANCE',
120
+ 'PRIVATE_EQUITY',
121
+ 'HEDGE_FUND',
122
+ 'COLLECTIBLES',
123
+ 'MORTGAGE',
124
+ 'STUDENT_LOAN',
125
+ 'CREDIT_CARD',
126
+ 'PERSONAL_LOAN',
127
+ 'ACCOUNTS_PAYABLE',
128
+ 'TAX_PAYABLE',
129
+ 'OTHER'
130
+ ],
131
+ nullable: true,
132
+ example: 'STOCK'
133
+ },
107
134
  status: {
108
135
  type: 'string',
109
136
  description: 'Account status',
@@ -145,26 +172,26 @@ export const $AccountResponseDto = {
145
172
  templatePath: {
146
173
  type: 'string',
147
174
  description: 'Template path reference',
148
- example: 'Assets:CN:Bank:ICBC:Checking'
175
+ example: 'Assets:CN:Checking'
149
176
  },
150
177
  isCustom: {
151
178
  type: 'boolean',
152
179
  description: 'Whether this is a custom (user-created) account',
153
180
  example: false
154
181
  },
155
- i18nKey: {
182
+ displayName: {
156
183
  type: 'string',
157
- description: 'i18n key for display name',
158
- example: 'account.assets.cn.bank.icbc.checking'
184
+ description: 'Localized display name (ADR-0114, read-time projection)',
185
+ example: 'Checking'
159
186
  },
160
187
  icon: {
161
188
  type: 'string',
162
189
  description: 'Icon identifier',
163
190
  example: 'bank-icbc'
164
191
  },
165
- openMeta: {
192
+ openDirectiveMeta: {
166
193
  type: 'object',
167
- description: 'Account metadata',
194
+ description: 'Open directive metadata (ADR-0115 Decision 9)',
168
195
  example: {
169
196
  branch: 'Downtown'
170
197
  }
@@ -192,7 +219,6 @@ export const $AccountResponseDto = {
192
219
  required: [
193
220
  'id',
194
221
  'path',
195
- 'displayName',
196
222
  'type',
197
223
  'status',
198
224
  'openDate',
@@ -225,11 +251,6 @@ export const $AccountListResponseDto = {
225
251
  export const $UpdateAccountDto = {
226
252
  type: 'object',
227
253
  properties: {
228
- displayName: {
229
- type: 'string',
230
- description: 'Display name to distinguish accounts at the same path',
231
- example: '招行工资卡'
232
- },
233
254
  currencies: {
234
255
  description: 'Allowed currencies (null = no restriction)',
235
256
  example: ['CNY', 'USD'],
@@ -251,19 +272,15 @@ export const $UpdateAccountDto = {
251
272
  'NONE'
252
273
  ]
253
274
  },
254
- i18nKey: {
255
- type: 'string',
256
- description: 'i18n key for display name',
257
- example: 'account.custom.mybank'
258
- },
259
275
  icon: {
260
276
  type: 'string',
261
277
  description: 'Icon identifier',
262
278
  example: 'bank-custom'
263
279
  },
264
- openMeta: {
280
+ openDirectiveMeta: {
265
281
  type: 'object',
266
- description: 'Additional metadata (merged with existing)',
282
+ description:
283
+ 'Open directive metadata (merged with existing; NOT an opening-balance amount)',
267
284
  example: {
268
285
  branch: 'Uptown'
269
286
  }
@@ -310,13 +327,47 @@ export const $ReopenAccountDto = {
310
327
  }
311
328
  } as const;
312
329
 
330
+ export const $CreateOpeningBalanceDto = {
331
+ type: 'object',
332
+ properties: {
333
+ amount: {
334
+ type: 'number',
335
+ description: 'Opening balance amount (non-negative)',
336
+ example: 1000
337
+ },
338
+ currency: {
339
+ type: 'string',
340
+ description: 'Currency code',
341
+ example: 'CNY'
342
+ },
343
+ date: {
344
+ format: 'date-time',
345
+ type: 'string',
346
+ description: 'Opening-balance date (defaults to now)',
347
+ example: '2024-01-01'
348
+ }
349
+ },
350
+ required: ['amount', 'currency']
351
+ } as const;
352
+
353
+ export const $OpeningBalanceResultDto = {
354
+ type: 'object',
355
+ properties: {
356
+ transactionId: {
357
+ type: 'string',
358
+ description: 'Created opening-balance transaction id.'
359
+ }
360
+ },
361
+ required: ['transactionId']
362
+ } as const;
363
+
313
364
  export const $AccountStandardResponseDto = {
314
365
  type: 'object',
315
366
  properties: {
316
367
  path: {
317
368
  type: 'string',
318
369
  description: 'Account path (hierarchical, colon-separated)',
319
- example: 'Assets:CN:Bank:ICBC:Checking'
370
+ example: 'Assets:CN:Checking'
320
371
  },
321
372
  type: {
322
373
  type: 'string',
@@ -324,11 +375,6 @@ export const $AccountStandardResponseDto = {
324
375
  enum: ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity'],
325
376
  example: 'Assets'
326
377
  },
327
- i18nKey: {
328
- type: 'string',
329
- description: 'i18n key for localized display name',
330
- example: 'account.assets.cn.bank.icbc.checking'
331
- },
332
378
  name: {
333
379
  type: 'string',
334
380
  description: 'Short localized display name',
@@ -351,9 +397,47 @@ export const $AccountStandardResponseDto = {
351
397
  type: 'string',
352
398
  description: 'Icon identifier for UI display',
353
399
  example: 'bank-icbc'
400
+ },
401
+ productCategory: {
402
+ type: 'string',
403
+ description:
404
+ 'Onboarding product category (coarse grouping derived from assetSubClass)',
405
+ enum: [
406
+ 'cash',
407
+ 'investment',
408
+ 'credit_card',
409
+ 'loan',
410
+ 'payable_tax',
411
+ 'other'
412
+ ],
413
+ example: 'investment'
414
+ },
415
+ assetClass: {
416
+ type: 'string',
417
+ description:
418
+ 'Asset class (LIQUIDITY/EQUITY/.../LIABILITY), derived at read time from classification rules',
419
+ enum: [
420
+ 'LIQUIDITY',
421
+ 'EQUITY',
422
+ 'FIXED_INCOME',
423
+ 'PRECIOUS_METALS',
424
+ 'COMMODITY',
425
+ 'INSURANCE',
426
+ 'ALTERNATIVE_INVESTMENT',
427
+ 'PERSONAL_ASSETS',
428
+ 'LIABILITY',
429
+ 'REAL_ESTATE',
430
+ 'INDEX'
431
+ ]
432
+ },
433
+ assetSubClass: {
434
+ type: 'string',
435
+ description:
436
+ 'Asset sub-class (product type, derived at read time from classification rules)',
437
+ example: 'STOCK'
354
438
  }
355
439
  },
356
- required: ['path', 'type', 'i18nKey', 'description', 'tags', 'icon']
440
+ required: ['path', 'type', 'description', 'tags', 'icon', 'productCategory']
357
441
  } as const;
358
442
 
359
443
  export const $AccountStandardListResponseDto = {
@@ -383,18 +467,13 @@ export const $AccountStandardListResponseDto = {
383
467
  export const $TemplateMetadataDto = {
384
468
  type: 'object',
385
469
  properties: {
386
- extendable: {
387
- type: 'boolean',
388
- description: 'Whether this path can be extended',
389
- example: true
390
- },
391
470
  rootType: {
392
471
  type: 'string',
393
472
  description: 'Root account type',
394
473
  example: 'Assets'
395
474
  }
396
475
  },
397
- required: ['extendable', 'rootType']
476
+ required: ['rootType']
398
477
  } as const;
399
478
 
400
479
  export const $TemplateMetadataResponseDto = {
@@ -533,7 +612,7 @@ export const $CreatePostingDto = {
533
612
  type: 'string',
534
613
  description:
535
614
  'Account name in Beancount format (must start with uppercase, colon-separated)',
536
- example: 'Assets:Bank:Checking'
615
+ example: 'Assets:Checking'
537
616
  },
538
617
  units: {
539
618
  type: 'string',
@@ -692,7 +771,7 @@ export const $PostingResponseDto = {
692
771
  account: {
693
772
  type: 'string',
694
773
  description: 'Account name',
695
- example: 'Assets:Bank:Checking'
774
+ example: 'Assets:Checking'
696
775
  },
697
776
  units: {
698
777
  type: 'string',
@@ -1058,7 +1137,7 @@ export const $PostingDetailDto = {
1058
1137
  account: {
1059
1138
  type: 'string',
1060
1139
  description: 'Fully-qualified Beancount account path',
1061
- example: 'Assets:Bank:Checking'
1140
+ example: 'Assets:Checking'
1062
1141
  },
1063
1142
  units: {
1064
1143
  type: 'string',
@@ -1450,7 +1529,7 @@ export const $BalanceResponseDto = {
1450
1529
  account: {
1451
1530
  type: 'string',
1452
1531
  description: 'Account name',
1453
- example: 'Assets:Bank:Checking'
1532
+ example: 'Assets:Checking'
1454
1533
  },
1455
1534
  balance: {
1456
1535
  type: 'string',
@@ -1477,7 +1556,7 @@ export const $MultiCurrencyBalanceResponseDto = {
1477
1556
  account: {
1478
1557
  type: 'string',
1479
1558
  description: 'Account name',
1480
- example: 'Assets:Bank:Checking'
1559
+ example: 'Assets:Checking'
1481
1560
  },
1482
1561
  balances: {
1483
1562
  type: 'object',
@@ -1533,7 +1612,7 @@ export const $TransactionSummaryDto = {
1533
1612
  accountName: {
1534
1613
  type: 'string',
1535
1614
  description: 'Source account name (first posting)',
1536
- example: 'Assets:Bank:Checking'
1615
+ example: 'Assets:Checking'
1537
1616
  },
1538
1617
  sourceType: {
1539
1618
  type: 'string',
@@ -3753,129 +3832,576 @@ export const $ForecastResponseDto = {
3753
3832
  ]
3754
3833
  } as const;
3755
3834
 
3756
- export const $CreateTransactionRuleDto = {
3835
+ export const $CurrencyBalanceDto = {
3757
3836
  type: 'object',
3758
3837
  properties: {
3759
- name: {
3838
+ currency: {
3760
3839
  type: 'string',
3761
- minLength: 1,
3762
- maxLength: 100
3840
+ description: 'ISO 4217 currency code',
3841
+ example: 'CNY'
3763
3842
  },
3764
- description: {
3843
+ balance: {
3765
3844
  type: 'string',
3766
- maxLength: 500
3767
- },
3768
- narrationKeywords: {
3769
- items: {
3770
- type: 'array'
3771
- },
3772
- maxItems: 50,
3773
- type: 'array'
3774
- },
3775
- payeeKeywords: {
3776
- items: {
3777
- type: 'array'
3778
- },
3779
- maxItems: 50,
3780
- type: 'array'
3781
- },
3782
- categoryKeywords: {
3783
- items: {
3784
- type: 'array'
3785
- },
3786
- maxItems: 50,
3787
- type: 'array'
3788
- },
3789
- methodKeywords: {
3790
- items: {
3791
- type: 'array'
3792
- },
3793
- maxItems: 50,
3794
- description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
3795
- type: 'array'
3796
- },
3797
- categoryAccount: {
3845
+ description: 'Balance amount',
3846
+ example: '500000.00'
3847
+ }
3848
+ },
3849
+ required: ['currency', 'balance']
3850
+ } as const;
3851
+
3852
+ export const $TimeSeriesPointDto = {
3853
+ type: 'object',
3854
+ properties: {
3855
+ date: {
3798
3856
  type: 'string',
3799
- maxLength: 200,
3800
- description:
3801
- 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
3857
+ description: 'Date in YYYY-MM-DD format',
3858
+ example: '2024-06-15'
3802
3859
  },
3803
- matchLogic: {
3860
+ value: {
3804
3861
  type: 'string',
3805
- enum: ['OR', 'AND'],
3806
- default: 'OR'
3862
+ description: 'Value at this date (in base currency)',
3863
+ example: '500000.00'
3807
3864
  },
3808
- amountMin: {
3809
- type: 'number',
3810
- minimum: 0,
3811
- description: 'Minimum transaction amount (inclusive)'
3865
+ change: {
3866
+ type: 'object',
3867
+ description: 'Change from previous point',
3868
+ example: '5000.00'
3812
3869
  },
3813
- amountMax: {
3814
- type: 'number',
3815
- minimum: 0,
3816
- description: 'Maximum transaction amount (inclusive)'
3870
+ assets: {
3871
+ type: 'string',
3872
+ description: 'Total assets at this date (in base currency)',
3873
+ example: '494338.00'
3817
3874
  },
3818
- priority: {
3819
- type: 'number',
3820
- default: 50,
3821
- minimum: 0,
3822
- maximum: 1000
3875
+ liabilities: {
3876
+ type: 'string',
3877
+ description: 'Total liabilities at this date (in base currency)',
3878
+ example: '310098.00'
3823
3879
  },
3824
- additionalTags: {
3880
+ byCurrency: {
3881
+ description: 'Multi-currency breakdown for this point',
3882
+ type: 'array',
3825
3883
  items: {
3826
- type: 'array'
3827
- },
3828
- maxItems: 20,
3829
- type: 'array'
3830
- },
3831
- additionalMetadata: {
3832
- type: 'object'
3833
- },
3834
- upsertByPayee: {
3835
- type: 'boolean',
3836
- description:
3837
- 'If true, update existing rule with matching payeeKeywords[0] instead of creating new rule'
3884
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3885
+ }
3838
3886
  }
3839
3887
  },
3840
- required: ['name', 'matchLogic', 'priority']
3888
+ required: ['date', 'value']
3841
3889
  } as const;
3842
3890
 
3843
- export const $AmountRangeDto = {
3891
+ export const $TrendSummaryDto = {
3844
3892
  type: 'object',
3845
3893
  properties: {
3846
- min: {
3847
- type: 'number',
3848
- description: 'Minimum amount'
3894
+ startValue: {
3895
+ type: 'string',
3896
+ description: 'Value at start of period',
3897
+ example: '450000.00'
3849
3898
  },
3850
- max: {
3851
- type: 'number',
3852
- description: 'Maximum amount'
3899
+ endValue: {
3900
+ type: 'string',
3901
+ description: 'Value at end of period',
3902
+ example: '500000.00'
3903
+ },
3904
+ totalChange: {
3905
+ type: 'string',
3906
+ description: 'Total change over period',
3907
+ example: '50000.00'
3908
+ },
3909
+ totalChangePercentage: {
3910
+ type: 'string',
3911
+ description: 'Total change percentage',
3912
+ example: '+11.11%'
3853
3913
  }
3854
- }
3914
+ },
3915
+ required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
3855
3916
  } as const;
3856
3917
 
3857
- export const $TransactionRuleResponseDto = {
3918
+ export const $MultiCurrencyPointDto = {
3858
3919
  type: 'object',
3859
3920
  properties: {
3860
- id: {
3861
- type: 'string',
3862
- description: 'Rule ID'
3863
- },
3864
- name: {
3865
- type: 'string',
3866
- description: 'Rule name'
3867
- },
3868
- description: {
3921
+ date: {
3869
3922
  type: 'string',
3870
- description: 'Rule description'
3923
+ description: 'Date in YYYY-MM-DD format',
3924
+ example: '2024-06-15'
3871
3925
  },
3872
- narrationKeywords: {
3873
- description: 'Keywords to match in transaction narration',
3926
+ byCurrency: {
3927
+ description: 'Balances by currency',
3874
3928
  type: 'array',
3875
3929
  items: {
3876
- type: 'string'
3930
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3877
3931
  }
3878
- },
3932
+ }
3933
+ },
3934
+ required: ['date', 'byCurrency']
3935
+ } as const;
3936
+
3937
+ export const $PortfolioTrendsResponseDto = {
3938
+ type: 'object',
3939
+ properties: {
3940
+ series: {
3941
+ description: 'Time series data points',
3942
+ type: 'array',
3943
+ items: {
3944
+ $ref: '#/components/schemas/TimeSeriesPointDto'
3945
+ }
3946
+ },
3947
+ summary: {
3948
+ description: 'Period summary',
3949
+ allOf: [
3950
+ {
3951
+ $ref: '#/components/schemas/TrendSummaryDto'
3952
+ }
3953
+ ]
3954
+ },
3955
+ period: {
3956
+ type: 'string',
3957
+ description: 'Period requested',
3958
+ example: '6m'
3959
+ },
3960
+ granularity: {
3961
+ type: 'string',
3962
+ description: 'Data granularity',
3963
+ example: 'month'
3964
+ },
3965
+ currency: {
3966
+ type: 'string',
3967
+ description: 'Base currency for converted values',
3968
+ example: 'CNY'
3969
+ },
3970
+ byCurrency: {
3971
+ description:
3972
+ 'Multi-currency time series (each point has currency breakdown)',
3973
+ type: 'array',
3974
+ items: {
3975
+ $ref: '#/components/schemas/MultiCurrencyPointDto'
3976
+ }
3977
+ },
3978
+ warnings: {
3979
+ description: 'Exchange rate warnings',
3980
+ type: 'array',
3981
+ items: {
3982
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
3983
+ }
3984
+ }
3985
+ },
3986
+ required: ['series', 'summary', 'period', 'granularity', 'currency']
3987
+ } as const;
3988
+
3989
+ export const $CashFlowPointDto = {
3990
+ type: 'object',
3991
+ properties: {
3992
+ month: {
3993
+ type: 'string',
3994
+ description: 'Month key (YYYY-MM)',
3995
+ example: '2024-03'
3996
+ },
3997
+ income: {
3998
+ type: 'string',
3999
+ description: 'Income in base currency (absolute, converted)',
4000
+ example: '10000.00'
4001
+ },
4002
+ expense: {
4003
+ type: 'string',
4004
+ description: 'Expense in base currency (absolute, converted)',
4005
+ example: '5000.00'
4006
+ },
4007
+ netSavings: {
4008
+ type: 'string',
4009
+ description: 'netSavings = income − expense (savings positive)',
4010
+ example: '5000.00'
4011
+ }
4012
+ },
4013
+ required: ['month', 'income', 'expense', 'netSavings']
4014
+ } as const;
4015
+
4016
+ export const $CashFlowTrendSummaryDto = {
4017
+ type: 'object',
4018
+ properties: {
4019
+ totalIncome: {
4020
+ type: 'string',
4021
+ description: 'Total income across the period',
4022
+ example: '60000.00'
4023
+ },
4024
+ totalExpense: {
4025
+ type: 'string',
4026
+ description: 'Total expense across the period',
4027
+ example: '30000.00'
4028
+ },
4029
+ totalNetSavings: {
4030
+ type: 'string',
4031
+ description: 'income − expense across the period',
4032
+ example: '30000.00'
4033
+ },
4034
+ averageMonthlyNetSavings: {
4035
+ type: 'string',
4036
+ description:
4037
+ 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
4038
+ example: '5000.00'
4039
+ }
4040
+ },
4041
+ required: [
4042
+ 'totalIncome',
4043
+ 'totalExpense',
4044
+ 'totalNetSavings',
4045
+ 'averageMonthlyNetSavings'
4046
+ ]
4047
+ } as const;
4048
+
4049
+ export const $CashFlowTrendsResponseDto = {
4050
+ type: 'object',
4051
+ properties: {
4052
+ series: {
4053
+ description:
4054
+ 'Monthly cash-flow series (fixed N-month window, zero-filled)',
4055
+ type: 'array',
4056
+ items: {
4057
+ $ref: '#/components/schemas/CashFlowPointDto'
4058
+ }
4059
+ },
4060
+ summary: {
4061
+ description: 'Period totals',
4062
+ allOf: [
4063
+ {
4064
+ $ref: '#/components/schemas/CashFlowTrendSummaryDto'
4065
+ }
4066
+ ]
4067
+ },
4068
+ period: {
4069
+ type: 'string',
4070
+ description: 'Period requested',
4071
+ example: '6m'
4072
+ },
4073
+ granularity: {
4074
+ type: 'string',
4075
+ description: 'Data granularity (v1 returns month buckets)',
4076
+ example: 'month'
4077
+ },
4078
+ currency: {
4079
+ type: 'string',
4080
+ description: 'Base currency for converted values',
4081
+ example: 'CNY'
4082
+ },
4083
+ warnings: {
4084
+ description: 'Exchange rate warnings (e.g. missing rate for a currency)',
4085
+ type: 'array',
4086
+ items: {
4087
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
4088
+ }
4089
+ }
4090
+ },
4091
+ required: ['series', 'summary', 'period', 'granularity', 'currency']
4092
+ } as const;
4093
+
4094
+ export const $GenerateSnapshotBody = {
4095
+ type: 'object',
4096
+ properties: {}
4097
+ } as const;
4098
+
4099
+ export const $GenerateSnapshotResponse = {
4100
+ type: 'object',
4101
+ properties: {}
4102
+ } as const;
4103
+
4104
+ export const $BackfillSnapshotsBody = {
4105
+ type: 'object',
4106
+ properties: {}
4107
+ } as const;
4108
+
4109
+ export const $BackfillSnapshotsResponse = {
4110
+ type: 'object',
4111
+ properties: {}
4112
+ } as const;
4113
+
4114
+ export const $DeleteOwnUserDto = {
4115
+ type: 'object',
4116
+ properties: {
4117
+ accessToken: {
4118
+ type: 'string',
4119
+ description: 'Access token for user verification',
4120
+ example: 'abc123xyz'
4121
+ }
4122
+ },
4123
+ required: ['accessToken']
4124
+ } as const;
4125
+
4126
+ export const $SignupDto = {
4127
+ type: 'object',
4128
+ properties: {
4129
+ turnstileToken: {
4130
+ type: 'string',
4131
+ description:
4132
+ 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
4133
+ example: '0.abc123def456...'
4134
+ }
4135
+ }
4136
+ } as const;
4137
+
4138
+ export const $SignupResponseDto = {
4139
+ type: 'object',
4140
+ properties: {
4141
+ authToken: {
4142
+ type: 'string',
4143
+ description: 'JWT auth token',
4144
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
4145
+ },
4146
+ accessToken: {
4147
+ type: 'string',
4148
+ description: 'Auto-generated access token'
4149
+ },
4150
+ role: {
4151
+ type: 'string',
4152
+ description: 'Assigned user role',
4153
+ enum: ['USER', 'ADMIN', 'DEMO', 'INACTIVE', 'PAID', 'OPS']
4154
+ }
4155
+ },
4156
+ required: ['authToken', 'accessToken', 'role']
4157
+ } as const;
4158
+
4159
+ export const $UpdateUserSettingDto = {
4160
+ type: 'object',
4161
+ properties: {
4162
+ secId: {
4163
+ type: 'number',
4164
+ description: 'Security ID'
4165
+ },
4166
+ annualInterestRate: {
4167
+ type: 'number',
4168
+ description: 'Annual interest rate',
4169
+ example: 0.05
4170
+ },
4171
+ currency: {
4172
+ type: 'string',
4173
+ description: 'Currency code',
4174
+ example: 'USD'
4175
+ },
4176
+ baseCurrency: {
4177
+ type: 'string',
4178
+ description: 'Base currency code',
4179
+ example: 'USD'
4180
+ },
4181
+ benchmark: {
4182
+ type: 'string',
4183
+ description: 'Benchmark symbol',
4184
+ example: 'SPY'
4185
+ },
4186
+ colorScheme: {
4187
+ type: 'string',
4188
+ description: 'Color scheme',
4189
+ enum: ['DARK', 'LIGHT']
4190
+ },
4191
+ dateRange: {
4192
+ type: 'string',
4193
+ description: 'Date range filter',
4194
+ example: '1y'
4195
+ },
4196
+ emergencyFund: {
4197
+ type: 'number',
4198
+ description: 'Emergency fund amount',
4199
+ example: 10000
4200
+ },
4201
+ 'filters.accounts': {
4202
+ description: 'Account filter IDs',
4203
+ type: 'array',
4204
+ items: {
4205
+ type: 'string'
4206
+ }
4207
+ },
4208
+ 'filters.assetClasses': {
4209
+ description: 'Asset class filters',
4210
+ type: 'array',
4211
+ items: {
4212
+ type: 'string'
4213
+ }
4214
+ },
4215
+ 'filters.dataSource': {
4216
+ type: 'string',
4217
+ description: 'Data source filter'
4218
+ },
4219
+ 'filters.symbol': {
4220
+ type: 'string',
4221
+ description: 'Symbol filter'
4222
+ },
4223
+ 'filters.tags': {
4224
+ description: 'Tag filters',
4225
+ type: 'array',
4226
+ items: {
4227
+ type: 'string'
4228
+ }
4229
+ },
4230
+ isExperimentalFeatures: {
4231
+ type: 'boolean',
4232
+ description: 'Enable experimental features'
4233
+ },
4234
+ isRestrictedView: {
4235
+ type: 'boolean',
4236
+ description: 'Enable restricted view mode'
4237
+ },
4238
+ language: {
4239
+ type: 'string',
4240
+ description: 'Language code',
4241
+ example: 'en'
4242
+ },
4243
+ locale: {
4244
+ type: 'string',
4245
+ description: 'Locale code',
4246
+ example: 'en-US'
4247
+ },
4248
+ projectedTotalAmount: {
4249
+ type: 'number',
4250
+ description: 'Projected total amount',
4251
+ example: 1000000
4252
+ },
4253
+ retirementDate: {
4254
+ type: 'string',
4255
+ description: 'Retirement date in ISO 8601 format',
4256
+ example: '2050-01-01'
4257
+ },
4258
+ savingsRate: {
4259
+ type: 'number',
4260
+ description: 'Savings rate percentage',
4261
+ example: 0.2
4262
+ },
4263
+ viewMode: {
4264
+ type: 'string',
4265
+ description: 'View mode',
4266
+ enum: ['DEFAULT', 'ZEN']
4267
+ }
4268
+ }
4269
+ } as const;
4270
+
4271
+ export const $UpdatePropertyDto = {
4272
+ type: 'object',
4273
+ properties: {
4274
+ value: {
4275
+ type: 'string',
4276
+ description: 'Property value'
4277
+ }
4278
+ },
4279
+ required: ['value']
4280
+ } as const;
4281
+
4282
+ export const $CreateTransactionRuleDto = {
4283
+ type: 'object',
4284
+ properties: {
4285
+ name: {
4286
+ type: 'string',
4287
+ minLength: 1,
4288
+ maxLength: 100
4289
+ },
4290
+ description: {
4291
+ type: 'string',
4292
+ maxLength: 500
4293
+ },
4294
+ narrationKeywords: {
4295
+ items: {
4296
+ type: 'array'
4297
+ },
4298
+ maxItems: 50,
4299
+ type: 'array'
4300
+ },
4301
+ payeeKeywords: {
4302
+ items: {
4303
+ type: 'array'
4304
+ },
4305
+ maxItems: 50,
4306
+ type: 'array'
4307
+ },
4308
+ categoryKeywords: {
4309
+ items: {
4310
+ type: 'array'
4311
+ },
4312
+ maxItems: 50,
4313
+ type: 'array'
4314
+ },
4315
+ methodKeywords: {
4316
+ items: {
4317
+ type: 'array'
4318
+ },
4319
+ maxItems: 50,
4320
+ description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
4321
+ type: 'array'
4322
+ },
4323
+ categoryAccount: {
4324
+ type: 'string',
4325
+ maxLength: 200,
4326
+ description:
4327
+ 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
4328
+ },
4329
+ matchLogic: {
4330
+ type: 'string',
4331
+ enum: ['OR', 'AND'],
4332
+ default: 'OR'
4333
+ },
4334
+ amountMin: {
4335
+ type: 'number',
4336
+ minimum: 0,
4337
+ description: 'Minimum transaction amount (inclusive)'
4338
+ },
4339
+ amountMax: {
4340
+ type: 'number',
4341
+ minimum: 0,
4342
+ description: 'Maximum transaction amount (inclusive)'
4343
+ },
4344
+ priority: {
4345
+ type: 'number',
4346
+ default: 50,
4347
+ minimum: 0,
4348
+ maximum: 1000
4349
+ },
4350
+ additionalTags: {
4351
+ items: {
4352
+ type: 'array'
4353
+ },
4354
+ maxItems: 20,
4355
+ type: 'array'
4356
+ },
4357
+ additionalMetadata: {
4358
+ type: 'object'
4359
+ },
4360
+ upsertByPayee: {
4361
+ type: 'boolean',
4362
+ description:
4363
+ 'If true, update existing rule with matching payeeKeywords[0] instead of creating new rule'
4364
+ }
4365
+ },
4366
+ required: ['name', 'matchLogic', 'priority']
4367
+ } as const;
4368
+
4369
+ export const $AmountRangeDto = {
4370
+ type: 'object',
4371
+ properties: {
4372
+ min: {
4373
+ type: 'number',
4374
+ description: 'Minimum amount'
4375
+ },
4376
+ max: {
4377
+ type: 'number',
4378
+ description: 'Maximum amount'
4379
+ }
4380
+ }
4381
+ } as const;
4382
+
4383
+ export const $TransactionRuleResponseDto = {
4384
+ type: 'object',
4385
+ properties: {
4386
+ id: {
4387
+ type: 'string',
4388
+ description: 'Rule ID'
4389
+ },
4390
+ name: {
4391
+ type: 'string',
4392
+ description: 'Rule name'
4393
+ },
4394
+ description: {
4395
+ type: 'string',
4396
+ description: 'Rule description'
4397
+ },
4398
+ narrationKeywords: {
4399
+ description: 'Keywords to match in transaction narration',
4400
+ type: 'array',
4401
+ items: {
4402
+ type: 'string'
4403
+ }
4404
+ },
3879
4405
  payeeKeywords: {
3880
4406
  description: 'Keywords to match in payee name',
3881
4407
  type: 'array',
@@ -4360,193 +4886,46 @@ export const $TestRuleDto = {
4360
4886
  },
4361
4887
  categoryAccount: {
4362
4888
  type: 'string',
4363
- maxLength: 200
4364
- },
4365
- amount: {
4366
- type: 'number'
4367
- },
4368
- currency: {
4369
- type: 'string',
4370
- maxLength: 10
4371
- }
4372
- },
4373
- required: ['narration']
4374
- } as const;
4375
-
4376
- export const $TestRuleResponseDto = {
4377
- type: 'object',
4378
- properties: {
4379
- ruleId: {
4380
- type: 'string',
4381
- description: 'Rule ID that was tested'
4382
- },
4383
- matches: {
4384
- type: 'boolean',
4385
- description: 'Whether the rule matched the test data'
4386
- },
4387
- confidence: {
4388
- type: 'number',
4389
- description: 'Match confidence score (0-1)',
4390
- example: 0.85
4391
- },
4392
- matchDetails: {
4393
- type: 'object',
4394
- description: 'Details of which fields matched',
4395
- example: {
4396
- narration: true,
4397
- payee: false,
4398
- categoryAccount: false
4399
- }
4400
- }
4401
- },
4402
- required: ['ruleId', 'matches', 'confidence', 'matchDetails']
4403
- } as const;
4404
-
4405
- export const $DeleteOwnUserDto = {
4406
- type: 'object',
4407
- properties: {
4408
- accessToken: {
4409
- type: 'string',
4410
- description: 'Access token for user verification',
4411
- example: 'abc123xyz'
4412
- }
4413
- },
4414
- required: ['accessToken']
4415
- } as const;
4416
-
4417
- export const $SignupDto = {
4418
- type: 'object',
4419
- properties: {
4420
- turnstileToken: {
4421
- type: 'string',
4422
- description:
4423
- 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
4424
- example: '0.abc123def456...'
4425
- }
4426
- }
4427
- } as const;
4428
-
4429
- export const $UpdateUserSettingDto = {
4430
- type: 'object',
4431
- properties: {
4432
- secId: {
4433
- type: 'number',
4434
- description: 'Security ID'
4435
- },
4436
- annualInterestRate: {
4437
- type: 'number',
4438
- description: 'Annual interest rate',
4439
- example: 0.05
4440
- },
4441
- currency: {
4442
- type: 'string',
4443
- description: 'Currency code',
4444
- example: 'USD'
4445
- },
4446
- baseCurrency: {
4447
- type: 'string',
4448
- description: 'Base currency code',
4449
- example: 'USD'
4450
- },
4451
- benchmark: {
4452
- type: 'string',
4453
- description: 'Benchmark symbol',
4454
- example: 'SPY'
4455
- },
4456
- colorScheme: {
4457
- type: 'string',
4458
- description: 'Color scheme',
4459
- enum: ['DARK', 'LIGHT']
4460
- },
4461
- dateRange: {
4462
- type: 'string',
4463
- description: 'Date range filter',
4464
- example: '1y'
4465
- },
4466
- emergencyFund: {
4467
- type: 'number',
4468
- description: 'Emergency fund amount',
4469
- example: 10000
4470
- },
4471
- 'filters.accounts': {
4472
- description: 'Account filter IDs',
4473
- type: 'array',
4474
- items: {
4475
- type: 'string'
4476
- }
4477
- },
4478
- 'filters.assetClasses': {
4479
- description: 'Asset class filters',
4480
- type: 'array',
4481
- items: {
4482
- type: 'string'
4483
- }
4484
- },
4485
- 'filters.dataSource': {
4486
- type: 'string',
4487
- description: 'Data source filter'
4488
- },
4489
- 'filters.symbol': {
4490
- type: 'string',
4491
- description: 'Symbol filter'
4492
- },
4493
- 'filters.tags': {
4494
- description: 'Tag filters',
4495
- type: 'array',
4496
- items: {
4497
- type: 'string'
4498
- }
4499
- },
4500
- isExperimentalFeatures: {
4501
- type: 'boolean',
4502
- description: 'Enable experimental features'
4503
- },
4504
- isRestrictedView: {
4505
- type: 'boolean',
4506
- description: 'Enable restricted view mode'
4507
- },
4508
- language: {
4509
- type: 'string',
4510
- description: 'Language code',
4511
- example: 'en'
4512
- },
4513
- locale: {
4514
- type: 'string',
4515
- description: 'Locale code',
4516
- example: 'en-US'
4517
- },
4518
- projectedTotalAmount: {
4519
- type: 'number',
4520
- description: 'Projected total amount',
4521
- example: 1000000
4522
- },
4523
- retirementDate: {
4524
- type: 'string',
4525
- description: 'Retirement date in ISO 8601 format',
4526
- example: '2050-01-01'
4889
+ maxLength: 200
4527
4890
  },
4528
- savingsRate: {
4529
- type: 'number',
4530
- description: 'Savings rate percentage',
4531
- example: 0.2
4891
+ amount: {
4892
+ type: 'number'
4532
4893
  },
4533
- viewMode: {
4894
+ currency: {
4534
4895
  type: 'string',
4535
- description: 'View mode',
4536
- enum: ['DEFAULT', 'ZEN']
4896
+ maxLength: 10
4537
4897
  }
4538
- }
4898
+ },
4899
+ required: ['narration']
4539
4900
  } as const;
4540
4901
 
4541
- export const $UpdatePropertyDto = {
4902
+ export const $TestRuleResponseDto = {
4542
4903
  type: 'object',
4543
4904
  properties: {
4544
- value: {
4905
+ ruleId: {
4545
4906
  type: 'string',
4546
- description: 'Property value'
4907
+ description: 'Rule ID that was tested'
4908
+ },
4909
+ matches: {
4910
+ type: 'boolean',
4911
+ description: 'Whether the rule matched the test data'
4912
+ },
4913
+ confidence: {
4914
+ type: 'number',
4915
+ description: 'Match confidence score (0-1)',
4916
+ example: 0.85
4917
+ },
4918
+ matchDetails: {
4919
+ type: 'object',
4920
+ description: 'Details of which fields matched',
4921
+ example: {
4922
+ narration: true,
4923
+ payee: false,
4924
+ categoryAccount: false
4925
+ }
4547
4926
  }
4548
4927
  },
4549
- required: ['value']
4928
+ required: ['ruleId', 'matches', 'confidence', 'matchDetails']
4550
4929
  } as const;
4551
4930
 
4552
4931
  export const $CreateBeanEventDto = {
@@ -4687,6 +5066,55 @@ export const $UpdateBeanEventDto = {
4687
5066
  }
4688
5067
  } as const;
4689
5068
 
5069
+ export const $OnboardingAccountDto = {
5070
+ type: 'object',
5071
+ properties: {
5072
+ path: {
5073
+ type: 'string',
5074
+ description:
5075
+ 'Account path (Assets/Liabilities only; format validated by the account service)',
5076
+ example: 'Assets:Checking'
5077
+ },
5078
+ currency: {
5079
+ type: 'string',
5080
+ description: 'ISO 4217 currency code (3 letters)',
5081
+ example: 'USD'
5082
+ },
5083
+ openingBalance: {
5084
+ type: 'string',
5085
+ description:
5086
+ 'Opening balance as a non-negative Decimal string (e.g. "1000.00")',
5087
+ example: '1000.00'
5088
+ },
5089
+ platformId: {
5090
+ type: 'string',
5091
+ description:
5092
+ 'Platform ID to bind the account to (references Platform.id); omit for unbound',
5093
+ example: 'c98e5d4a-2f71-4a5a-bb3c-92c9f231d5e2'
5094
+ }
5095
+ },
5096
+ required: ['path', 'currency']
5097
+ } as const;
5098
+
5099
+ export const $OnboardingDto = {
5100
+ type: 'object',
5101
+ properties: {
5102
+ accounts: {
5103
+ description: 'Asset/Liability accounts to register with opening balances',
5104
+ type: 'array',
5105
+ items: {
5106
+ $ref: '#/components/schemas/OnboardingAccountDto'
5107
+ }
5108
+ },
5109
+ skipAssetRegistration: {
5110
+ type: 'boolean',
5111
+ description:
5112
+ 'Skip asset registration; only bootstrap the core account set',
5113
+ default: false
5114
+ }
5115
+ }
5116
+ } as const;
5117
+
4690
5118
  export const $ActualBalanceDto = {
4691
5119
  type: 'object',
4692
5120
  properties: {
@@ -5055,7 +5483,7 @@ export const $IdentifyResultDto = {
5055
5483
  account: {
5056
5484
  type: 'string',
5057
5485
  description: 'Default account used by this importer',
5058
- example: 'Assets:Alipay:Balance'
5486
+ example: 'Assets:CN:Alipay:Balance'
5059
5487
  },
5060
5488
  message: {
5061
5489
  type: 'string',
@@ -5072,7 +5500,7 @@ export const $MapperDefaultsDto = {
5072
5500
  sourceAccount: {
5073
5501
  type: 'string',
5074
5502
  description: 'Source account for transactions (Beancount format)',
5075
- example: 'Assets:Alipay:Balance'
5503
+ example: 'Assets:CN:Alipay:Balance'
5076
5504
  },
5077
5505
  currency: {
5078
5506
  type: 'string',
@@ -5109,7 +5537,7 @@ export const $MapperDefaultsDto = {
5109
5537
  description:
5110
5538
  'Payment method to source account mapping. Maps payment method keywords to Beancount account paths. Used by Alipay/WeChat importers to determine sourceAccount based on payment method (e.g., HuaBei, CreditCard).',
5111
5539
  example: {
5112
- HuaBei: 'Liabilities:Alipay:Huabei',
5540
+ HuaBei: 'Liabilities:CN:CreditLine',
5113
5541
  CreditCard: 'Liabilities:CreditCard'
5114
5542
  }
5115
5543
  }
@@ -5241,7 +5669,7 @@ export const $UpdateMapperDefaultsDto = {
5241
5669
  sourceAccount: {
5242
5670
  type: 'string',
5243
5671
  description: 'Source account for transactions (Beancount format)',
5244
- example: 'Assets:Alipay:Balance',
5672
+ example: 'Assets:CN:Alipay:Balance',
5245
5673
  pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
5246
5674
  },
5247
5675
  currency: {
@@ -5269,7 +5697,7 @@ export const $UpdateMapperDefaultsDto = {
5269
5697
  description:
5270
5698
  'Payment method to source account mapping. Maps payment method keywords to Beancount account paths. Used by Alipay/WeChat importers to determine sourceAccount based on payment method (e.g., HuaBei, CreditCard).',
5271
5699
  example: {
5272
- HuaBei: 'Liabilities:Alipay:Huabei',
5700
+ HuaBei: 'Liabilities:CN:CreditLine',
5273
5701
  CreditCard: 'Liabilities:CreditCard'
5274
5702
  }
5275
5703
  }
@@ -5304,119 +5732,13 @@ export const $UpdateImporterConfigDto = {
5304
5732
  }
5305
5733
  } as const;
5306
5734
 
5307
- export const $CreatePlatformDto = {
5308
- type: 'object',
5309
- properties: {
5310
- name: {
5311
- type: 'string',
5312
- description: 'Platform name',
5313
- example: 'Binance'
5314
- },
5315
- canonical: {
5316
- type: 'string',
5317
- description: 'Platform canonical identifier (lowercase, kebab-case)',
5318
- example: 'binance'
5319
- },
5320
- aliases: {
5321
- description: 'Platform aliases (multi-language names for lookup)',
5322
- example: ['Binance', 'Binance Exchange', 'BNB'],
5323
- type: 'array',
5324
- items: {
5325
- type: 'string'
5326
- }
5327
- },
5328
- url: {
5329
- type: 'string',
5330
- description: 'Platform URL',
5331
- example: 'https://www.binance.com'
5332
- },
5333
- type: {
5334
- type: 'string',
5335
- description: 'Platform type',
5336
- enum: [
5337
- 'BANK',
5338
- 'BROKERAGE',
5339
- 'CRYPTO_EXCHANGE',
5340
- 'PAYMENT',
5341
- 'INVESTMENT',
5342
- 'INSURANCE',
5343
- 'OTHER'
5344
- ],
5345
- example: 'CRYPTO_EXCHANGE'
5346
- },
5347
- logoUrl: {
5348
- type: 'string',
5349
- description: 'Platform logo URL',
5350
- example: 'https://example.com/logos/binance.png'
5351
- },
5352
- isActive: {
5353
- type: 'boolean',
5354
- description: 'Whether the platform is active',
5355
- default: true
5356
- }
5357
- },
5358
- required: ['name', 'canonical', 'aliases', 'url', 'type']
5359
- } as const;
5360
-
5361
- export const $UpdatePlatformDto = {
5362
- type: 'object',
5363
- properties: {
5364
- name: {
5365
- type: 'string',
5366
- description: 'Platform name',
5367
- example: 'Binance'
5368
- },
5369
- canonical: {
5370
- type: 'string',
5371
- description: 'Platform canonical identifier (lowercase, kebab-case)',
5372
- example: 'binance'
5373
- },
5374
- aliases: {
5375
- description: 'Platform aliases (multi-language names for lookup)',
5376
- example: ['Binance', 'Binance Exchange', 'BNB'],
5377
- type: 'array',
5378
- items: {
5379
- type: 'string'
5380
- }
5381
- },
5382
- url: {
5383
- type: 'string',
5384
- description: 'Platform URL',
5385
- example: 'https://www.binance.com'
5386
- },
5387
- type: {
5388
- type: 'string',
5389
- description: 'Platform type',
5390
- enum: [
5391
- 'BANK',
5392
- 'BROKERAGE',
5393
- 'CRYPTO_EXCHANGE',
5394
- 'PAYMENT',
5395
- 'INVESTMENT',
5396
- 'INSURANCE',
5397
- 'OTHER'
5398
- ],
5399
- example: 'CRYPTO_EXCHANGE'
5400
- },
5401
- logoUrl: {
5402
- type: 'string',
5403
- description: 'Platform logo URL',
5404
- example: 'https://example.com/logos/binance.png'
5405
- },
5406
- isActive: {
5407
- type: 'boolean',
5408
- description: 'Whether the platform is active'
5409
- }
5410
- }
5411
- } as const;
5412
-
5413
5735
  export const $ProviderSyncConfigDto = {
5414
5736
  type: 'object',
5415
5737
  properties: {
5416
5738
  sourceAccount: {
5417
5739
  type: 'string',
5418
5740
  description: 'Source account for the first posting',
5419
- example: 'Assets:Bank:Chase'
5741
+ example: 'Assets:US:Chase:Checking'
5420
5742
  },
5421
5743
  defaultCurrency: {
5422
5744
  type: 'string',
@@ -5425,26 +5747,29 @@ export const $ProviderSyncConfigDto = {
5425
5747
  },
5426
5748
  defaultExpenseAccount: {
5427
5749
  type: 'string',
5428
- description: 'Default expense account for the second posting',
5750
+ description:
5751
+ 'Default expense account for the second posting. Omit when no real default exists; the pipeline routes to Review via the Uncategorized sentinel (#618).',
5429
5752
  example: 'Expenses:Unknown'
5430
5753
  },
5431
5754
  defaultIncomeAccount: {
5432
5755
  type: 'string',
5433
- description: 'Default income account for the second posting',
5756
+ description:
5757
+ 'Default income account for the second posting. Omit when no real default exists; the pipeline routes to Review via the Uncategorized sentinel (#618).',
5434
5758
  example: 'Income:Unknown'
5435
5759
  },
5436
5760
  filterPending: {
5437
5761
  type: 'boolean',
5438
5762
  description: 'Filter pending transactions',
5439
5763
  default: true
5764
+ },
5765
+ externalAccountId: {
5766
+ type: 'string',
5767
+ description:
5768
+ 'External account ID for per-batch providers (e.g. GoCardless). Overrides sourceAccount when an ExternalAccountLink mapping exists.',
5769
+ example: 'acc_gocardless_001'
5440
5770
  }
5441
5771
  },
5442
- required: [
5443
- 'sourceAccount',
5444
- 'defaultCurrency',
5445
- 'defaultExpenseAccount',
5446
- 'defaultIncomeAccount'
5447
- ]
5772
+ required: ['sourceAccount', 'defaultCurrency']
5448
5773
  } as const;
5449
5774
 
5450
5775
  export const $ProviderSyncDto = {
@@ -5553,7 +5878,95 @@ export const $SupportedProvidersResponseDto = {
5553
5878
  }
5554
5879
  }
5555
5880
  },
5556
- required: ['providers']
5881
+ required: ['providers']
5882
+ } as const;
5883
+
5884
+ export const $CreateExternalAccountLinkDto = {
5885
+ type: 'object',
5886
+ properties: {
5887
+ provider: {
5888
+ type: 'string',
5889
+ enum: [
5890
+ 'plaid',
5891
+ 'teller',
5892
+ 'truelayer',
5893
+ 'gocardless',
5894
+ 'simplefin',
5895
+ 'yodlee',
5896
+ 'beancount-direct',
5897
+ 'parsed-bill'
5898
+ ],
5899
+ example: 'plaid',
5900
+ description: 'Open Banking provider (whitelist)'
5901
+ },
5902
+ externalAccountId: {
5903
+ type: 'string',
5904
+ example: 'acc-plaid-001',
5905
+ description: 'External account ID from the provider'
5906
+ },
5907
+ beanAccountId: {
5908
+ type: 'string',
5909
+ example: '550e8400-e29b-41d4-a716-446655440000',
5910
+ description: 'Target BeanAccount ID (must belong to the JWT user)'
5911
+ }
5912
+ },
5913
+ required: ['provider', 'externalAccountId', 'beanAccountId']
5914
+ } as const;
5915
+
5916
+ export const $ExternalAccountLinkResponseDto = {
5917
+ type: 'object',
5918
+ properties: {
5919
+ id: {
5920
+ type: 'string'
5921
+ },
5922
+ provider: {
5923
+ type: 'string'
5924
+ },
5925
+ externalAccountId: {
5926
+ type: 'string'
5927
+ },
5928
+ beanAccountId: {
5929
+ type: 'string'
5930
+ },
5931
+ isActive: {
5932
+ type: 'boolean'
5933
+ },
5934
+ createdAt: {
5935
+ type: 'string'
5936
+ },
5937
+ updatedAt: {
5938
+ type: 'string'
5939
+ }
5940
+ },
5941
+ required: [
5942
+ 'id',
5943
+ 'provider',
5944
+ 'externalAccountId',
5945
+ 'beanAccountId',
5946
+ 'isActive',
5947
+ 'createdAt',
5948
+ 'updatedAt'
5949
+ ]
5950
+ } as const;
5951
+
5952
+ export const $ExternalAccountLinkListResponseDto = {
5953
+ type: 'object',
5954
+ properties: {
5955
+ items: {
5956
+ type: 'array',
5957
+ items: {
5958
+ $ref: '#/components/schemas/ExternalAccountLinkResponseDto'
5959
+ }
5960
+ },
5961
+ total: {
5962
+ type: 'number'
5963
+ },
5964
+ provider: {
5965
+ type: 'string',
5966
+ description: 'Filter by provider (query param)'
5967
+ }
5968
+ },
5969
+ required: ['items', 'total']
5557
5970
  } as const;
5558
5971
 
5559
5972
  export const $ParserTelemetryReportDto = {
@@ -5590,6 +6003,18 @@ export const $ProcessNlpDto = {
5590
6003
  currency: 'CNY',
5591
6004
  payee: 'Starbucks'
5592
6005
  }
6006
+ },
6007
+ selectedRuleId: {
6008
+ type: 'string',
6009
+ description:
6010
+ 'confirm_rule echo-back: rule id selected from the prior confirm_rule response (matchedRule.id or alternatives[i].ruleId). Applied directly when the session is confirming_rule — no NL re-parse.',
6011
+ example: 'rule_abc123'
6012
+ },
6013
+ selectedAccount: {
6014
+ type: 'string',
6015
+ description:
6016
+ 'confirm_account echo-back: account path selected from the prior confirm_account response (suggestedAccount, similarAccounts[i], or a typed path). Applied directly when the session is confirming_account — no NL re-parse.',
6017
+ example: 'Expenses:Food:Coffee'
5593
6018
  }
5594
6019
  },
5595
6020
  required: ['message']
@@ -5914,7 +6339,8 @@ export const $NlpAccountConfirmationDataDto = {
5914
6339
  },
5915
6340
  suggestedAccount: {
5916
6341
  type: 'string',
5917
- description: 'Suggested replacement account',
6342
+ description:
6343
+ 'Suggested replacement account (omitted when no clear candidate)',
5918
6344
  example: 'Expenses:Food:Drinks'
5919
6345
  },
5920
6346
  similarAccounts: {
@@ -5936,7 +6362,6 @@ export const $NlpAccountConfirmationDataDto = {
5936
6362
  },
5937
6363
  required: [
5938
6364
  'invalidAccount',
5939
- 'suggestedAccount',
5940
6365
  'similarAccounts',
5941
6366
  'errorMessage',
5942
6367
  'transactionContext'
@@ -6105,11 +6530,12 @@ export const $NlpSuggestedAccountDto = {
6105
6530
  account: {
6106
6531
  type: 'string',
6107
6532
  description: 'Suggested account path',
6108
- example: 'Assets:Bank:Checking'
6533
+ example: 'Assets:Checking'
6109
6534
  },
6110
6535
  confidence: {
6111
6536
  type: 'number',
6112
- description: 'Confidence score for this suggestion (0-1)',
6537
+ description:
6538
+ 'Confidence score for this suggestion (0-1). Present = predicted (confirm/confirm_rule/confirm_account); omitted = actual persisted account (created). (#586)',
6113
6539
  example: 0.9
6114
6540
  }
6115
6541
  },
@@ -6145,23 +6571,31 @@ export const $NlpDefaultAccountsDto = {
6145
6571
  properties: {
6146
6572
  asset: {
6147
6573
  type: 'string',
6148
- description: 'Default asset account',
6149
- example: 'Assets:Bank:Checking'
6574
+ description:
6575
+ 'Default OPEN asset account (MRU when multiple), or null when none/ambiguous',
6576
+ example: 'Assets:Checking',
6577
+ nullable: true
6150
6578
  },
6151
6579
  expense: {
6152
6580
  type: 'string',
6153
- description: 'Default expense account',
6154
- example: 'Expenses:Uncategorized'
6581
+ description:
6582
+ 'Default OPEN expense account (MRU when multiple), or null when none/ambiguous',
6583
+ example: 'Expenses:Food:Coffee',
6584
+ nullable: true
6155
6585
  },
6156
6586
  income: {
6157
6587
  type: 'string',
6158
- description: 'Default income account',
6159
- example: 'Income:Uncategorized'
6588
+ description:
6589
+ 'Default OPEN income account (MRU when multiple), or null when none/ambiguous',
6590
+ example: 'Income:Salary',
6591
+ nullable: true
6160
6592
  },
6161
6593
  liability: {
6162
6594
  type: 'string',
6163
- description: 'Default liability account',
6164
- example: 'Liabilities:CreditCard'
6595
+ description:
6596
+ 'Default OPEN liability account (MRU when multiple), or null when none/ambiguous',
6597
+ example: 'Liabilities:CreditCard',
6598
+ nullable: true
6165
6599
  }
6166
6600
  },
6167
6601
  required: ['asset', 'expense', 'income', 'liability']
@@ -6186,7 +6620,8 @@ export const $NlpResponseDto = {
6186
6620
  'confirm_rule',
6187
6621
  'confirm_account',
6188
6622
  'confirm_payee',
6189
- 'cancel'
6623
+ 'cancel',
6624
+ 'aborted'
6190
6625
  ]
6191
6626
  },
6192
6627
  intent: {
@@ -6299,73 +6734,351 @@ export const $NlpResponseDto = {
6299
6734
  }
6300
6735
  ]
6301
6736
  },
6302
- accountData: {
6303
- description:
6304
- 'Account validation data (when action is "confirm_account"). Contains information about invalid account for user correction.',
6305
- allOf: [
6306
- {
6307
- $ref: '#/components/schemas/NlpAccountConfirmationDataDto'
6308
- }
6309
- ]
6737
+ accountData: {
6738
+ description:
6739
+ 'Account validation data (when action is "confirm_account"). Contains information about invalid account for user correction.',
6740
+ allOf: [
6741
+ {
6742
+ $ref: '#/components/schemas/NlpAccountConfirmationDataDto'
6743
+ }
6744
+ ]
6745
+ },
6746
+ payeeData: {
6747
+ description:
6748
+ 'Payee confirmation data (when action is "confirm_payee"). Contains information about medium/low confidence payee match for user confirmation.',
6749
+ allOf: [
6750
+ {
6751
+ $ref: '#/components/schemas/NlpPayeeConfirmationDataDto'
6752
+ }
6753
+ ]
6754
+ },
6755
+ confidence: {
6756
+ type: 'number',
6757
+ description: 'Overall confidence score (0-1)',
6758
+ example: 0.85
6759
+ },
6760
+ confidenceThreshold: {
6761
+ type: 'number',
6762
+ description:
6763
+ 'Confidence threshold for automatic creation (default: 0.75). When confidence < threshold, action will be "confirm" requiring user verification.',
6764
+ example: 0.75
6765
+ },
6766
+ recurringMatch: {
6767
+ description:
6768
+ 'Recurring transaction match info (when action is "created"). Contains match details when transaction matches a pending expected transaction.',
6769
+ allOf: [
6770
+ {
6771
+ $ref: '#/components/schemas/RecurringMatchInfoDto'
6772
+ }
6773
+ ]
6774
+ },
6775
+ recurringSuggestion: {
6776
+ description:
6777
+ '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.',
6778
+ allOf: [
6779
+ {
6780
+ $ref: '#/components/schemas/RecurringSuggestionDto'
6781
+ }
6782
+ ]
6783
+ },
6784
+ suggestedAccounts: {
6785
+ description:
6786
+ 'Suggested accounts for this transaction (#586). confirm/confirm_rule/confirm_account: predicted (source/destination carry confidence); created: actual persisted accounts (confidence omitted). confirm_account destination is the suggested replacement, never the invalid account.',
6787
+ allOf: [
6788
+ {
6789
+ $ref: '#/components/schemas/NlpSuggestedAccountsDto'
6790
+ }
6791
+ ]
6792
+ },
6793
+ defaultAccounts: {
6794
+ description:
6795
+ 'Default fallback accounts for the user/region (#586). v1 returns universal constants; per-user personalization is planned.',
6796
+ allOf: [
6797
+ {
6798
+ $ref: '#/components/schemas/NlpDefaultAccountsDto'
6799
+ }
6800
+ ]
6801
+ }
6802
+ },
6803
+ required: ['status', 'action']
6804
+ } as const;
6805
+
6806
+ export const $PlatformListItemDto = {
6807
+ type: 'object',
6808
+ properties: {
6809
+ id: {
6810
+ type: 'string',
6811
+ description: 'Global platform ID'
6812
+ },
6813
+ name: {
6814
+ type: 'string',
6815
+ description: 'Platform name'
6816
+ },
6817
+ url: {
6818
+ type: 'string',
6819
+ description: 'Platform URL'
6820
+ },
6821
+ type: {
6822
+ type: 'string',
6823
+ description: 'Platform type',
6824
+ enum: [
6825
+ 'BANK',
6826
+ 'BROKERAGE',
6827
+ 'CRYPTO_EXCHANGE',
6828
+ 'PAYMENT',
6829
+ 'INVESTMENT',
6830
+ 'INSURANCE',
6831
+ 'OTHER'
6832
+ ]
6833
+ },
6834
+ canonical: {
6835
+ type: 'string',
6836
+ description: 'Canonical identifier in ACCOUNT_RE format (e.g., "icbc")'
6837
+ },
6838
+ suggestedSegment: {
6839
+ type: 'string',
6840
+ description:
6841
+ 'Suggested path segment — PascalCase of canonical, hyphens removed (e.g. "ApplePay")'
6842
+ },
6843
+ logoUrl: {
6844
+ type: 'string',
6845
+ description: 'Logo URL',
6846
+ nullable: true
6847
+ },
6848
+ countryCode: {
6849
+ type: 'string',
6850
+ description: 'ISO 3166-1 alpha-2 (UPPERCASE); null = global platform',
6851
+ example: 'CN',
6852
+ nullable: true
6853
+ },
6854
+ category: {
6855
+ type: 'string',
6856
+ description:
6857
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank). null = no region-aware suggestion; fall back to type.',
6858
+ nullable: true,
6859
+ example: 'DigitalWallet'
6860
+ },
6861
+ isBound: {
6862
+ type: 'boolean',
6863
+ description: 'Whether user has accounts using this platform'
6864
+ }
6865
+ },
6866
+ required: [
6867
+ 'id',
6868
+ 'name',
6869
+ 'url',
6870
+ 'type',
6871
+ 'canonical',
6872
+ 'suggestedSegment',
6873
+ 'logoUrl',
6874
+ 'countryCode',
6875
+ 'category',
6876
+ 'isBound'
6877
+ ]
6878
+ } as const;
6879
+
6880
+ export const $PlatformMatchResultDto = {
6881
+ type: 'object',
6882
+ properties: {
6883
+ id: {
6884
+ type: 'string',
6885
+ description: 'Global platform ID'
6886
+ },
6887
+ name: {
6888
+ type: 'string',
6889
+ description: 'Platform name (e.g., "ICBC")'
6890
+ },
6891
+ canonical: {
6892
+ type: 'string',
6893
+ description: 'Canonical identifier in ACCOUNT_RE format (e.g., "icbc")'
6894
+ },
6895
+ type: {
6896
+ type: 'string',
6897
+ description: 'Platform type',
6898
+ enum: [
6899
+ 'BANK',
6900
+ 'BROKERAGE',
6901
+ 'CRYPTO_EXCHANGE',
6902
+ 'PAYMENT',
6903
+ 'INVESTMENT',
6904
+ 'INSURANCE',
6905
+ 'OTHER'
6906
+ ]
6907
+ },
6908
+ suggestedSegment: {
6909
+ type: 'string',
6910
+ description:
6911
+ 'Suggested path segment — PascalCase of canonical, hyphens removed (e.g. "ApplePay")'
6912
+ },
6913
+ logoUrl: {
6914
+ type: 'string',
6915
+ description: 'Logo URL',
6916
+ nullable: true
6917
+ },
6918
+ countryCode: {
6919
+ type: 'string',
6920
+ description: 'ISO 3166-1 alpha-2 (UPPERCASE); null = global platform',
6921
+ example: 'CN',
6922
+ nullable: true
6923
+ },
6924
+ category: {
6925
+ type: 'string',
6926
+ description:
6927
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank). null = no region-aware suggestion; fall back to type.',
6928
+ nullable: true,
6929
+ example: 'DigitalWallet'
6930
+ },
6931
+ matchType: {
6932
+ type: 'string',
6933
+ description: "How this row matched: 'exact' > 'prefix' > 'substring'",
6934
+ enum: ['exact', 'prefix', 'substring']
6935
+ }
6936
+ },
6937
+ required: [
6938
+ 'id',
6939
+ 'name',
6940
+ 'canonical',
6941
+ 'type',
6942
+ 'suggestedSegment',
6943
+ 'logoUrl',
6944
+ 'countryCode',
6945
+ 'category',
6946
+ 'matchType'
6947
+ ]
6948
+ } as const;
6949
+
6950
+ export const $PlatformMatchResponseDto = {
6951
+ type: 'object',
6952
+ properties: {
6953
+ platforms: {
6954
+ description: 'Ranked matches, best tier first (at most 10 rows)',
6955
+ type: 'array',
6956
+ items: {
6957
+ $ref: '#/components/schemas/PlatformMatchResultDto'
6958
+ }
6959
+ },
6960
+ matchType: {
6961
+ type: 'string',
6962
+ description:
6963
+ "Overall match quality — top row's tier, or 'none' when no hits",
6964
+ enum: ['none', 'exact', 'prefix', 'substring']
6965
+ },
6966
+ total: {
6967
+ type: 'number',
6968
+ description: 'Total matches before LIMIT (truncation transparency)'
6969
+ },
6970
+ hasMore: {
6971
+ type: 'boolean',
6972
+ description: 'true when total > platforms.length (more matches exist)'
6973
+ }
6974
+ },
6975
+ required: ['platforms', 'matchType', 'total', 'hasMore']
6976
+ } as const;
6977
+
6978
+ export const $CreatePlatformDto = {
6979
+ type: 'object',
6980
+ properties: {
6981
+ name: {
6982
+ type: 'string',
6983
+ description: 'Platform name',
6984
+ example: 'Binance'
6985
+ },
6986
+ canonical: {
6987
+ type: 'string',
6988
+ description: 'Platform canonical identifier (lowercase, kebab-case)',
6989
+ example: 'binance'
6990
+ },
6991
+ aliases: {
6992
+ description: 'Platform aliases (multi-language names for lookup)',
6993
+ example: ['Binance', 'Binance Exchange', 'BNB'],
6994
+ type: 'array',
6995
+ items: {
6996
+ type: 'string'
6997
+ }
6998
+ },
6999
+ url: {
7000
+ type: 'string',
7001
+ description: 'Platform URL',
7002
+ example: 'https://www.binance.com'
7003
+ },
7004
+ type: {
7005
+ type: 'string',
7006
+ description: 'Platform type',
7007
+ enum: [
7008
+ 'BANK',
7009
+ 'BROKERAGE',
7010
+ 'CRYPTO_EXCHANGE',
7011
+ 'PAYMENT',
7012
+ 'INVESTMENT',
7013
+ 'INSURANCE',
7014
+ 'OTHER'
7015
+ ],
7016
+ example: 'CRYPTO_EXCHANGE'
7017
+ },
7018
+ logoUrl: {
7019
+ type: 'string',
7020
+ description: 'Platform logo URL',
7021
+ example: 'https://example.com/logos/binance.png'
6310
7022
  },
6311
- payeeData: {
6312
- description:
6313
- 'Payee confirmation data (when action is "confirm_payee"). Contains information about medium/low confidence payee match for user confirmation.',
6314
- allOf: [
6315
- {
6316
- $ref: '#/components/schemas/NlpPayeeConfirmationDataDto'
6317
- }
6318
- ]
7023
+ isActive: {
7024
+ type: 'boolean',
7025
+ description: 'Whether the platform is active',
7026
+ default: true
7027
+ }
7028
+ },
7029
+ required: ['name', 'canonical', 'aliases', 'url', 'type']
7030
+ } as const;
7031
+
7032
+ export const $UpdatePlatformDto = {
7033
+ type: 'object',
7034
+ properties: {
7035
+ name: {
7036
+ type: 'string',
7037
+ description: 'Platform name',
7038
+ example: 'Binance'
6319
7039
  },
6320
- confidence: {
6321
- type: 'number',
6322
- description: 'Overall confidence score (0-1)',
6323
- example: 0.85
7040
+ canonical: {
7041
+ type: 'string',
7042
+ description: 'Platform canonical identifier (lowercase, kebab-case)',
7043
+ example: 'binance'
6324
7044
  },
6325
- confidenceThreshold: {
6326
- type: 'number',
6327
- description:
6328
- 'Confidence threshold for automatic creation (default: 0.75). When confidence < threshold, action will be "confirm" requiring user verification.',
6329
- example: 0.75
7045
+ aliases: {
7046
+ description: 'Platform aliases (multi-language names for lookup)',
7047
+ example: ['Binance', 'Binance Exchange', 'BNB'],
7048
+ type: 'array',
7049
+ items: {
7050
+ type: 'string'
7051
+ }
6330
7052
  },
6331
- recurringMatch: {
6332
- description:
6333
- 'Recurring transaction match info (when action is "created"). Contains match details when transaction matches a pending expected transaction.',
6334
- allOf: [
6335
- {
6336
- $ref: '#/components/schemas/RecurringMatchInfoDto'
6337
- }
6338
- ]
7053
+ url: {
7054
+ type: 'string',
7055
+ description: 'Platform URL',
7056
+ example: 'https://www.binance.com'
6339
7057
  },
6340
- recurringSuggestion: {
6341
- description:
6342
- '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.',
6343
- allOf: [
6344
- {
6345
- $ref: '#/components/schemas/RecurringSuggestionDto'
6346
- }
6347
- ]
7058
+ type: {
7059
+ type: 'string',
7060
+ description: 'Platform type',
7061
+ enum: [
7062
+ 'BANK',
7063
+ 'BROKERAGE',
7064
+ 'CRYPTO_EXCHANGE',
7065
+ 'PAYMENT',
7066
+ 'INVESTMENT',
7067
+ 'INSURANCE',
7068
+ 'OTHER'
7069
+ ],
7070
+ example: 'CRYPTO_EXCHANGE'
6348
7071
  },
6349
- suggestedAccounts: {
6350
- description:
6351
- 'Suggested accounts for this transaction. Contains recommended source and destination accounts based on the detected intent and rules.',
6352
- allOf: [
6353
- {
6354
- $ref: '#/components/schemas/NlpSuggestedAccountsDto'
6355
- }
6356
- ]
7072
+ logoUrl: {
7073
+ type: 'string',
7074
+ description: 'Platform logo URL',
7075
+ example: 'https://example.com/logos/binance.png'
6357
7076
  },
6358
- defaultAccounts: {
6359
- description:
6360
- 'Default accounts for the user/region. These are fallback accounts used when no specific suggestion is available.',
6361
- allOf: [
6362
- {
6363
- $ref: '#/components/schemas/NlpDefaultAccountsDto'
6364
- }
6365
- ]
7077
+ isActive: {
7078
+ type: 'boolean',
7079
+ description: 'Whether the platform is active'
6366
7080
  }
6367
- },
6368
- required: ['status', 'action']
7081
+ }
6369
7082
  } as const;
6370
7083
 
6371
7084
  export const $NetWorthByCurrencyDto = {
@@ -6522,7 +7235,7 @@ export const $AccountItemDto = {
6522
7235
  name: {
6523
7236
  type: 'string',
6524
7237
  description: 'Full account name',
6525
- example: 'Assets:Bank:CMB:Savings'
7238
+ example: 'Assets:CN:CMB:Savings'
6526
7239
  },
6527
7240
  displayName: {
6528
7241
  type: 'string',
@@ -6691,7 +7404,7 @@ export const $AccountItemWithAssetClassDto = {
6691
7404
  name: {
6692
7405
  type: 'string',
6693
7406
  description: 'Full account name',
6694
- example: 'Assets:Bank:CMB:Savings'
7407
+ example: 'Assets:CN:CMB:Savings'
6695
7408
  },
6696
7409
  displayName: {
6697
7410
  type: 'string',
@@ -6866,7 +7579,7 @@ export const $HoldingAssetClassAccountSliceDto = {
6866
7579
  accountPath: {
6867
7580
  type: 'string',
6868
7581
  description: 'Full account path',
6869
- example: 'Assets:US:Investments:Brokerage'
7582
+ example: 'Assets:US:Fidelity:Brokerage'
6870
7583
  },
6871
7584
  accountCurrency: {
6872
7585
  type: 'string',
@@ -7404,344 +8117,220 @@ export const $HoldingPnlWarningDto = {
7404
8117
  'OVERSOLD_LOTS',
7405
8118
  'NO_PRICE',
7406
8119
  'MIXED_COST_CURRENCY'
7407
- ]
7408
- },
7409
- symbol: {
7410
- type: 'object',
7411
- nullable: true
7412
- },
7413
- accountId: {
7414
- type: 'object',
7415
- nullable: true
7416
- },
7417
- currency: {
7418
- type: 'object',
7419
- nullable: true
7420
- }
7421
- },
7422
- required: ['type']
7423
- } as const;
7424
-
7425
- export const $HoldingPnlResponseDto = {
7426
- type: 'object',
7427
- properties: {
7428
- asOfDate: {
7429
- type: 'string',
7430
- example: '2026-07-08'
7431
- },
7432
- baseCurrency: {
7433
- type: 'string',
7434
- example: 'CNY'
7435
- },
7436
- method: {
7437
- type: 'string',
7438
- description:
7439
- 'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
7440
- enum: ['average', 'FIFO'],
7441
- example: 'average'
7442
- },
7443
- rows: {
7444
- type: 'array',
7445
- items: {
7446
- $ref: '#/components/schemas/HoldingPnlRowDto'
7447
- }
7448
- },
7449
- warnings: {
7450
- type: 'array',
7451
- items: {
7452
- $ref: '#/components/schemas/HoldingPnlWarningDto'
7453
- }
7454
- }
7455
- },
7456
- required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
7457
- } as const;
7458
-
7459
- export const $CurrencyBalanceDto = {
7460
- type: 'object',
7461
- properties: {
7462
- currency: {
7463
- type: 'string',
7464
- description: 'ISO 4217 currency code',
7465
- example: 'CNY'
7466
- },
7467
- balance: {
7468
- type: 'string',
7469
- description: 'Balance amount',
7470
- example: '500000.00'
7471
- }
7472
- },
7473
- required: ['currency', 'balance']
7474
- } as const;
7475
-
7476
- export const $TimeSeriesPointDto = {
7477
- type: 'object',
7478
- properties: {
7479
- date: {
7480
- type: 'string',
7481
- description: 'Date in YYYY-MM-DD format',
7482
- example: '2024-06-15'
7483
- },
7484
- value: {
7485
- type: 'string',
7486
- description: 'Value at this date (in base currency)',
7487
- example: '500000.00'
7488
- },
7489
- change: {
7490
- type: 'object',
7491
- description: 'Change from previous point',
7492
- example: '5000.00'
7493
- },
7494
- assets: {
7495
- type: 'string',
7496
- description: 'Total assets at this date (in base currency)',
7497
- example: '494338.00'
7498
- },
7499
- liabilities: {
7500
- type: 'string',
7501
- description: 'Total liabilities at this date (in base currency)',
7502
- example: '310098.00'
7503
- },
7504
- byCurrency: {
7505
- description: 'Multi-currency breakdown for this point',
7506
- type: 'array',
7507
- items: {
7508
- $ref: '#/components/schemas/CurrencyBalanceDto'
7509
- }
7510
- }
7511
- },
7512
- required: ['date', 'value']
7513
- } as const;
7514
-
7515
- export const $TrendSummaryDto = {
7516
- type: 'object',
7517
- properties: {
7518
- startValue: {
7519
- type: 'string',
7520
- description: 'Value at start of period',
7521
- example: '450000.00'
7522
- },
7523
- endValue: {
7524
- type: 'string',
7525
- description: 'Value at end of period',
7526
- example: '500000.00'
7527
- },
7528
- totalChange: {
7529
- type: 'string',
7530
- description: 'Total change over period',
7531
- example: '50000.00'
7532
- },
7533
- totalChangePercentage: {
7534
- type: 'string',
7535
- description: 'Total change percentage',
7536
- example: '+11.11%'
7537
- }
7538
- },
7539
- required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
7540
- } as const;
7541
-
7542
- export const $MultiCurrencyPointDto = {
7543
- type: 'object',
7544
- properties: {
7545
- date: {
7546
- type: 'string',
7547
- description: 'Date in YYYY-MM-DD format',
7548
- example: '2024-06-15'
8120
+ ]
7549
8121
  },
7550
- byCurrency: {
7551
- description: 'Balances by currency',
7552
- type: 'array',
7553
- items: {
7554
- $ref: '#/components/schemas/CurrencyBalanceDto'
7555
- }
8122
+ symbol: {
8123
+ type: 'object',
8124
+ nullable: true
8125
+ },
8126
+ accountId: {
8127
+ type: 'object',
8128
+ nullable: true
8129
+ },
8130
+ currency: {
8131
+ type: 'object',
8132
+ nullable: true
7556
8133
  }
7557
8134
  },
7558
- required: ['date', 'byCurrency']
8135
+ required: ['type']
7559
8136
  } as const;
7560
8137
 
7561
- export const $PortfolioTrendsResponseDto = {
8138
+ export const $HoldingPnlResponseDto = {
7562
8139
  type: 'object',
7563
8140
  properties: {
7564
- series: {
7565
- description: 'Time series data points',
7566
- type: 'array',
7567
- items: {
7568
- $ref: '#/components/schemas/TimeSeriesPointDto'
7569
- }
7570
- },
7571
- summary: {
7572
- description: 'Period summary',
7573
- allOf: [
7574
- {
7575
- $ref: '#/components/schemas/TrendSummaryDto'
7576
- }
7577
- ]
7578
- },
7579
- period: {
7580
- type: 'string',
7581
- description: 'Period requested',
7582
- example: '6m'
7583
- },
7584
- granularity: {
8141
+ asOfDate: {
7585
8142
  type: 'string',
7586
- description: 'Data granularity',
7587
- example: 'month'
8143
+ example: '2026-07-08'
7588
8144
  },
7589
- currency: {
8145
+ baseCurrency: {
7590
8146
  type: 'string',
7591
- description: 'Base currency for converted values',
7592
8147
  example: 'CNY'
7593
8148
  },
7594
- byCurrency: {
8149
+ method: {
8150
+ type: 'string',
7595
8151
  description:
7596
- 'Multi-currency time series (each point has currency breakdown)',
8152
+ 'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
8153
+ enum: ['average', 'FIFO'],
8154
+ example: 'average'
8155
+ },
8156
+ rows: {
7597
8157
  type: 'array',
7598
8158
  items: {
7599
- $ref: '#/components/schemas/MultiCurrencyPointDto'
8159
+ $ref: '#/components/schemas/HoldingPnlRowDto'
7600
8160
  }
7601
8161
  },
7602
8162
  warnings: {
7603
- description: 'Exchange rate warnings',
7604
8163
  type: 'array',
7605
8164
  items: {
7606
- $ref: '#/components/schemas/ExchangeRateWarningDto'
8165
+ $ref: '#/components/schemas/HoldingPnlWarningDto'
7607
8166
  }
7608
8167
  }
7609
8168
  },
7610
- required: ['series', 'summary', 'period', 'granularity', 'currency']
8169
+ required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
7611
8170
  } as const;
7612
8171
 
7613
- export const $CashFlowPointDto = {
8172
+ export const $AnonymousLoginDto = {
7614
8173
  type: 'object',
7615
8174
  properties: {
7616
- month: {
7617
- type: 'string',
7618
- description: 'Month key (YYYY-MM)',
7619
- example: '2024-03'
7620
- },
7621
- income: {
7622
- type: 'string',
7623
- description: 'Income in base currency (absolute, converted)',
7624
- example: '10000.00'
7625
- },
7626
- expense: {
7627
- type: 'string',
7628
- description: 'Expense in base currency (absolute, converted)',
7629
- example: '5000.00'
7630
- },
7631
- netSavings: {
8175
+ accessToken: {
7632
8176
  type: 'string',
7633
- description: 'netSavings = income − expense (savings positive)',
7634
- example: '5000.00'
8177
+ description: 'Access token for anonymous login'
7635
8178
  }
7636
8179
  },
7637
- required: ['month', 'income', 'expense', 'netSavings']
8180
+ required: ['accessToken']
7638
8181
  } as const;
7639
8182
 
7640
- export const $CashFlowTrendSummaryDto = {
8183
+ export const $AnonymousLoginResponseDto = {
7641
8184
  type: 'object',
7642
8185
  properties: {
7643
- totalIncome: {
7644
- type: 'string',
7645
- description: 'Total income across the period',
7646
- example: '60000.00'
7647
- },
7648
- totalExpense: {
7649
- type: 'string',
7650
- description: 'Total expense across the period',
7651
- example: '30000.00'
7652
- },
7653
- totalNetSavings: {
7654
- type: 'string',
7655
- description: 'income − expense across the period',
7656
- example: '30000.00'
7657
- },
7658
- averageMonthlyNetSavings: {
8186
+ authToken: {
7659
8187
  type: 'string',
7660
- description:
7661
- 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
7662
- example: '5000.00'
8188
+ description: 'JWT auth token',
8189
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
7663
8190
  }
7664
8191
  },
7665
- required: [
7666
- 'totalIncome',
7667
- 'totalExpense',
7668
- 'totalNetSavings',
7669
- 'averageMonthlyNetSavings'
7670
- ]
8192
+ required: ['authToken']
7671
8193
  } as const;
7672
8194
 
7673
- export const $CashFlowTrendsResponseDto = {
8195
+ export const $SymbolSearchResultDto = {
7674
8196
  type: 'object',
7675
8197
  properties: {
7676
- series: {
7677
- description:
7678
- 'Monthly cash-flow series (fixed N-month window, zero-filled)',
7679
- type: 'array',
7680
- items: {
7681
- $ref: '#/components/schemas/CashFlowPointDto'
7682
- }
8198
+ symbol: {
8199
+ type: 'string',
8200
+ example: 'AAPL'
7683
8201
  },
7684
- summary: {
7685
- description: 'Period totals',
7686
- allOf: [
7687
- {
7688
- $ref: '#/components/schemas/CashFlowTrendSummaryDto'
7689
- }
7690
- ]
8202
+ name: {
8203
+ type: 'object',
8204
+ example: 'Apple Inc.',
8205
+ nullable: true
7691
8206
  },
7692
- period: {
7693
- type: 'string',
7694
- description: 'Period requested',
7695
- example: '6m'
8207
+ exchange: {
8208
+ type: 'object',
8209
+ example: 'US',
8210
+ nullable: true
7696
8211
  },
7697
- granularity: {
7698
- type: 'string',
7699
- description: 'Data granularity (v1 returns month buckets)',
7700
- example: 'month'
8212
+ assetType: {
8213
+ type: 'object',
8214
+ description: 'OpenBB asset_type (e.g. stock, etf)',
8215
+ example: 'stock',
8216
+ nullable: true
7701
8217
  },
7702
- currency: {
7703
- type: 'string',
7704
- description: 'Base currency for converted values',
7705
- example: 'CNY'
8218
+ assetClass: {
8219
+ type: 'object',
8220
+ description: 'IGN asset class (region.types.ts ASSET_CLASSES)',
8221
+ example: 'EQUITY',
8222
+ nullable: true
7706
8223
  },
7707
- warnings: {
7708
- description: 'Exchange rate warnings (e.g. missing rate for a currency)',
7709
- type: 'array',
7710
- items: {
7711
- $ref: '#/components/schemas/ExchangeRateWarningDto'
7712
- }
8224
+ assetSubClass: {
8225
+ type: 'object',
8226
+ description: 'IGN asset sub-class (region.types.ts ASSET_SUB_CLASSES)',
8227
+ example: 'STOCK',
8228
+ nullable: true
8229
+ },
8230
+ currency: {
8231
+ type: 'object',
8232
+ description: 'Trading currency (extra_data or inferred from exchange)',
8233
+ example: 'USD',
8234
+ nullable: true
7713
8235
  }
7714
8236
  },
7715
- required: ['series', 'summary', 'period', 'granularity', 'currency']
7716
- } as const;
7717
-
7718
- export const $GenerateSnapshotBody = {
7719
- type: 'object',
7720
- properties: {}
7721
- } as const;
7722
-
7723
- export const $GenerateSnapshotResponse = {
7724
- type: 'object',
7725
- properties: {}
7726
- } as const;
7727
-
7728
- export const $BackfillSnapshotsBody = {
7729
- type: 'object',
7730
- properties: {}
7731
- } as const;
7732
-
7733
- export const $BackfillSnapshotsResponse = {
7734
- type: 'object',
7735
- properties: {}
8237
+ required: ['symbol']
7736
8238
  } as const;
7737
8239
 
7738
- export const $AnonymousLoginDto = {
8240
+ export const $SymbolQuoteDto = {
7739
8241
  type: 'object',
7740
8242
  properties: {
7741
- accessToken: {
8243
+ symbol: {
7742
8244
  type: 'string',
7743
- description: 'Access token for anonymous login'
8245
+ example: 'AAPL'
8246
+ },
8247
+ name: {
8248
+ type: 'object',
8249
+ example: 'Apple Inc.',
8250
+ nullable: true
8251
+ },
8252
+ exchange: {
8253
+ type: 'object',
8254
+ example: 'US',
8255
+ nullable: true
8256
+ },
8257
+ assetType: {
8258
+ type: 'object',
8259
+ description: 'OpenBB asset_type',
8260
+ example: 'stock',
8261
+ nullable: true
8262
+ },
8263
+ assetClass: {
8264
+ type: 'object',
8265
+ description: 'IGN asset class',
8266
+ example: 'EQUITY',
8267
+ nullable: true
8268
+ },
8269
+ assetSubClass: {
8270
+ type: 'object',
8271
+ description: 'IGN asset sub-class',
8272
+ example: 'STOCK',
8273
+ nullable: true
8274
+ },
8275
+ currency: {
8276
+ type: 'object',
8277
+ description: 'Trading currency (extra_data or inferred from exchange)',
8278
+ example: 'USD',
8279
+ nullable: true
8280
+ },
8281
+ price: {
8282
+ type: 'object',
8283
+ description: 'Latest price (Decimal string)',
8284
+ example: '189.84',
8285
+ nullable: true
8286
+ },
8287
+ priceDate: {
8288
+ type: 'object',
8289
+ description: 'Date the price was observed (ISO yyyy-MM-dd)',
8290
+ example: '2026-08-05',
8291
+ nullable: true
8292
+ },
8293
+ changePercent: {
8294
+ type: 'object',
8295
+ description:
8296
+ 'Change vs previous close, in percentage points (1.7 == 1.7%). openbb stores change_percent as a normalized decimal; this exposes percentage points for frontend convenience.',
8297
+ example: 1.7,
8298
+ nullable: true
8299
+ },
8300
+ prevClose: {
8301
+ type: 'object',
8302
+ description: 'Previous close (Decimal string)',
8303
+ nullable: true
8304
+ },
8305
+ open: {
8306
+ type: 'object',
8307
+ description: 'Day open (Decimal string)',
8308
+ nullable: true
8309
+ },
8310
+ high: {
8311
+ type: 'object',
8312
+ description: 'Day high (Decimal string)',
8313
+ nullable: true
8314
+ },
8315
+ low: {
8316
+ type: 'object',
8317
+ description: 'Day low (Decimal string)',
8318
+ nullable: true
8319
+ },
8320
+ volume: {
8321
+ type: 'object',
8322
+ description: 'Day volume (Decimal string)',
8323
+ nullable: true
8324
+ },
8325
+ yearHigh: {
8326
+ type: 'object',
8327
+ description: '52-week high (Decimal string)',
8328
+ nullable: true
8329
+ },
8330
+ yearLow: {
8331
+ type: 'object',
8332
+ description: '52-week low (Decimal string)',
8333
+ nullable: true
7744
8334
  }
7745
- },
7746
- required: ['accessToken']
8335
+ }
7747
8336
  } as const;