@firela/api-types 0.0.0-canary.63a53b7d → 0.0.0-canary.693e8bdf

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.
@@ -88,6 +88,49 @@ export const $AccountResponseDto = {
88
88
  enum: ['Assets', 'Liabilities', 'Income', 'Expenses', 'Equity'],
89
89
  example: 'Assets'
90
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
+ },
91
134
  status: {
92
135
  type: 'string',
93
136
  description: 'Account status',
@@ -354,9 +397,47 @@ export const $AccountStandardResponseDto = {
354
397
  type: 'string',
355
398
  description: 'Icon identifier for UI display',
356
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'
357
438
  }
358
439
  },
359
- required: ['path', 'type', 'description', 'tags', 'icon']
440
+ required: ['path', 'type', 'description', 'tags', 'icon', 'productCategory']
360
441
  } as const;
361
442
 
362
443
  export const $AccountStandardListResponseDto = {
@@ -3751,156 +3832,647 @@ export const $ForecastResponseDto = {
3751
3832
  ]
3752
3833
  } as const;
3753
3834
 
3754
- export const $CreateTransactionRuleDto = {
3835
+ export const $CurrencyBalanceDto = {
3755
3836
  type: 'object',
3756
3837
  properties: {
3757
- name: {
3838
+ currency: {
3758
3839
  type: 'string',
3759
- minLength: 1,
3760
- maxLength: 100
3840
+ description: 'ISO 4217 currency code',
3841
+ example: 'CNY'
3761
3842
  },
3762
- description: {
3843
+ balance: {
3763
3844
  type: 'string',
3764
- maxLength: 500
3765
- },
3766
- narrationKeywords: {
3767
- items: {
3768
- type: 'array'
3769
- },
3770
- maxItems: 50,
3771
- type: 'array'
3772
- },
3773
- payeeKeywords: {
3774
- items: {
3775
- type: 'array'
3776
- },
3777
- maxItems: 50,
3778
- type: 'array'
3779
- },
3780
- categoryKeywords: {
3781
- items: {
3782
- type: 'array'
3783
- },
3784
- maxItems: 50,
3785
- type: 'array'
3786
- },
3787
- methodKeywords: {
3788
- items: {
3789
- type: 'array'
3790
- },
3791
- maxItems: 50,
3792
- description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
3793
- type: 'array'
3794
- },
3795
- 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: {
3796
3856
  type: 'string',
3797
- maxLength: 200,
3798
- description:
3799
- 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
3857
+ description: 'Date in YYYY-MM-DD format',
3858
+ example: '2024-06-15'
3800
3859
  },
3801
- matchLogic: {
3860
+ value: {
3802
3861
  type: 'string',
3803
- enum: ['OR', 'AND'],
3804
- default: 'OR'
3862
+ description: 'Value at this date (in base currency)',
3863
+ example: '500000.00'
3805
3864
  },
3806
- amountMin: {
3807
- type: 'number',
3808
- minimum: 0,
3809
- description: 'Minimum transaction amount (inclusive)'
3865
+ change: {
3866
+ type: 'object',
3867
+ description: 'Change from previous point',
3868
+ example: '5000.00'
3810
3869
  },
3811
- amountMax: {
3812
- type: 'number',
3813
- minimum: 0,
3814
- description: 'Maximum transaction amount (inclusive)'
3870
+ assets: {
3871
+ type: 'string',
3872
+ description: 'Total assets at this date (in base currency)',
3873
+ example: '494338.00'
3815
3874
  },
3816
- priority: {
3817
- type: 'number',
3818
- default: 50,
3819
- minimum: 0,
3820
- maximum: 1000
3875
+ liabilities: {
3876
+ type: 'string',
3877
+ description: 'Total liabilities at this date (in base currency)',
3878
+ example: '310098.00'
3821
3879
  },
3822
- additionalTags: {
3880
+ byCurrency: {
3881
+ description: 'Multi-currency breakdown for this point',
3882
+ type: 'array',
3823
3883
  items: {
3824
- type: 'array'
3825
- },
3826
- maxItems: 20,
3827
- type: 'array'
3828
- },
3829
- additionalMetadata: {
3830
- type: 'object'
3831
- },
3832
- upsertByPayee: {
3833
- type: 'boolean',
3834
- description:
3835
- 'If true, update existing rule with matching payeeKeywords[0] instead of creating new rule'
3884
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3885
+ }
3836
3886
  }
3837
3887
  },
3838
- required: ['name', 'matchLogic', 'priority']
3888
+ required: ['date', 'value']
3839
3889
  } as const;
3840
3890
 
3841
- export const $AmountRangeDto = {
3891
+ export const $TrendSummaryDto = {
3842
3892
  type: 'object',
3843
3893
  properties: {
3844
- min: {
3845
- type: 'number',
3846
- description: 'Minimum amount'
3894
+ startValue: {
3895
+ type: 'string',
3896
+ description: 'Value at start of period',
3897
+ example: '450000.00'
3847
3898
  },
3848
- max: {
3849
- type: 'number',
3850
- 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%'
3851
3913
  }
3852
- }
3914
+ },
3915
+ required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
3853
3916
  } as const;
3854
3917
 
3855
- export const $TransactionRuleResponseDto = {
3918
+ export const $MultiCurrencyPointDto = {
3856
3919
  type: 'object',
3857
3920
  properties: {
3858
- id: {
3859
- type: 'string',
3860
- description: 'Rule ID'
3861
- },
3862
- name: {
3863
- type: 'string',
3864
- description: 'Rule name'
3865
- },
3866
- description: {
3921
+ date: {
3867
3922
  type: 'string',
3868
- description: 'Rule description'
3923
+ description: 'Date in YYYY-MM-DD format',
3924
+ example: '2024-06-15'
3869
3925
  },
3870
- narrationKeywords: {
3871
- description: 'Keywords to match in transaction narration',
3926
+ byCurrency: {
3927
+ description: 'Balances by currency',
3872
3928
  type: 'array',
3873
3929
  items: {
3874
- type: 'string'
3930
+ $ref: '#/components/schemas/CurrencyBalanceDto'
3875
3931
  }
3876
- },
3877
- payeeKeywords: {
3878
- description: 'Keywords to match in payee name',
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',
3879
3942
  type: 'array',
3880
3943
  items: {
3881
- type: 'string'
3944
+ $ref: '#/components/schemas/TimeSeriesPointDto'
3882
3945
  }
3883
3946
  },
3884
- categoryKeywords: {
3885
- description: 'Keywords to match in category',
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)',
3886
3973
  type: 'array',
3887
3974
  items: {
3888
- type: 'string'
3975
+ $ref: '#/components/schemas/MultiCurrencyPointDto'
3889
3976
  }
3890
3977
  },
3891
- methodKeywords: {
3892
- description: 'Keywords to match in payment method',
3978
+ warnings: {
3979
+ description: 'Exchange rate warnings',
3893
3980
  type: 'array',
3894
3981
  items: {
3895
- type: 'string'
3982
+ $ref: '#/components/schemas/ExchangeRateWarningDto'
3896
3983
  }
3897
- },
3898
- categoryAccount: {
3899
- type: 'string',
3900
- description: 'Destination account for categorization'
3901
- },
3902
- matchLogic: {
3903
- type: 'string',
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 $UserSettingsResponseDto = {
4127
+ type: 'object',
4128
+ properties: {
4129
+ baseCurrency: {
4130
+ type: 'string',
4131
+ description:
4132
+ 'Base currency (ISO 4217) for net-worth/report aggregation. Independent of region (ADR-0006).',
4133
+ example: 'USD',
4134
+ nullable: true
4135
+ }
4136
+ },
4137
+ required: ['baseCurrency']
4138
+ } as const;
4139
+
4140
+ export const $UserResponseDto = {
4141
+ type: 'object',
4142
+ properties: {
4143
+ id: {
4144
+ type: 'string',
4145
+ description: 'User ID'
4146
+ },
4147
+ role: {
4148
+ type: 'string',
4149
+ description: 'Assigned user role'
4150
+ },
4151
+ permissions: {
4152
+ description: 'Permission strings',
4153
+ type: 'array',
4154
+ items: {
4155
+ type: 'string'
4156
+ }
4157
+ },
4158
+ settings: {
4159
+ description: 'User settings',
4160
+ allOf: [
4161
+ {
4162
+ $ref: '#/components/schemas/UserSettingsResponseDto'
4163
+ }
4164
+ ]
4165
+ }
4166
+ },
4167
+ required: ['id', 'role', 'permissions', 'settings']
4168
+ } as const;
4169
+
4170
+ export const $SignupDto = {
4171
+ type: 'object',
4172
+ properties: {
4173
+ turnstileToken: {
4174
+ type: 'string',
4175
+ description:
4176
+ 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
4177
+ example: '0.abc123def456...'
4178
+ }
4179
+ }
4180
+ } as const;
4181
+
4182
+ export const $SignupResponseDto = {
4183
+ type: 'object',
4184
+ properties: {
4185
+ authToken: {
4186
+ type: 'string',
4187
+ description: 'JWT auth token',
4188
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
4189
+ },
4190
+ accessToken: {
4191
+ type: 'string',
4192
+ description: 'Auto-generated access token'
4193
+ },
4194
+ role: {
4195
+ type: 'string',
4196
+ description: 'Assigned user role',
4197
+ enum: ['USER', 'ADMIN', 'DEMO', 'INACTIVE', 'PAID', 'OPS']
4198
+ }
4199
+ },
4200
+ required: ['authToken', 'accessToken', 'role']
4201
+ } as const;
4202
+
4203
+ export const $UpdateUserSettingDto = {
4204
+ type: 'object',
4205
+ properties: {
4206
+ secId: {
4207
+ type: 'number',
4208
+ description: 'Security ID'
4209
+ },
4210
+ annualInterestRate: {
4211
+ type: 'number',
4212
+ description: 'Annual interest rate',
4213
+ example: 0.05
4214
+ },
4215
+ currency: {
4216
+ type: 'string',
4217
+ description: 'Currency code',
4218
+ example: 'USD'
4219
+ },
4220
+ baseCurrency: {
4221
+ type: 'string',
4222
+ description: 'Base currency code',
4223
+ example: 'USD'
4224
+ },
4225
+ benchmark: {
4226
+ type: 'string',
4227
+ description: 'Benchmark symbol',
4228
+ example: 'SPY'
4229
+ },
4230
+ colorScheme: {
4231
+ type: 'string',
4232
+ description: 'Color scheme',
4233
+ enum: ['DARK', 'LIGHT']
4234
+ },
4235
+ dateRange: {
4236
+ type: 'string',
4237
+ description: 'Date range filter',
4238
+ example: '1y'
4239
+ },
4240
+ emergencyFund: {
4241
+ type: 'number',
4242
+ description: 'Emergency fund amount',
4243
+ example: 10000
4244
+ },
4245
+ 'filters.accounts': {
4246
+ description: 'Account filter IDs',
4247
+ type: 'array',
4248
+ items: {
4249
+ type: 'string'
4250
+ }
4251
+ },
4252
+ 'filters.assetClasses': {
4253
+ description: 'Asset class filters',
4254
+ type: 'array',
4255
+ items: {
4256
+ type: 'string'
4257
+ }
4258
+ },
4259
+ 'filters.dataSource': {
4260
+ type: 'string',
4261
+ description: 'Data source filter'
4262
+ },
4263
+ 'filters.symbol': {
4264
+ type: 'string',
4265
+ description: 'Symbol filter'
4266
+ },
4267
+ 'filters.tags': {
4268
+ description: 'Tag filters',
4269
+ type: 'array',
4270
+ items: {
4271
+ type: 'string'
4272
+ }
4273
+ },
4274
+ isExperimentalFeatures: {
4275
+ type: 'boolean',
4276
+ description: 'Enable experimental features'
4277
+ },
4278
+ isRestrictedView: {
4279
+ type: 'boolean',
4280
+ description: 'Enable restricted view mode'
4281
+ },
4282
+ language: {
4283
+ type: 'string',
4284
+ description: 'Language code',
4285
+ example: 'en'
4286
+ },
4287
+ locale: {
4288
+ type: 'string',
4289
+ description: 'Locale code',
4290
+ example: 'en-US'
4291
+ },
4292
+ projectedTotalAmount: {
4293
+ type: 'number',
4294
+ description: 'Projected total amount',
4295
+ example: 1000000
4296
+ },
4297
+ retirementDate: {
4298
+ type: 'string',
4299
+ description: 'Retirement date in ISO 8601 format',
4300
+ example: '2050-01-01'
4301
+ },
4302
+ savingsRate: {
4303
+ type: 'number',
4304
+ description: 'Savings rate percentage',
4305
+ example: 0.2
4306
+ },
4307
+ viewMode: {
4308
+ type: 'string',
4309
+ description: 'View mode',
4310
+ enum: ['DEFAULT', 'ZEN']
4311
+ }
4312
+ }
4313
+ } as const;
4314
+
4315
+ export const $UpdatePropertyDto = {
4316
+ type: 'object',
4317
+ properties: {
4318
+ value: {
4319
+ type: 'string',
4320
+ description: 'Property value'
4321
+ }
4322
+ },
4323
+ required: ['value']
4324
+ } as const;
4325
+
4326
+ export const $CreateTransactionRuleDto = {
4327
+ type: 'object',
4328
+ properties: {
4329
+ name: {
4330
+ type: 'string',
4331
+ minLength: 1,
4332
+ maxLength: 100
4333
+ },
4334
+ description: {
4335
+ type: 'string',
4336
+ maxLength: 500
4337
+ },
4338
+ narrationKeywords: {
4339
+ items: {
4340
+ type: 'array'
4341
+ },
4342
+ maxItems: 50,
4343
+ type: 'array'
4344
+ },
4345
+ payeeKeywords: {
4346
+ items: {
4347
+ type: 'array'
4348
+ },
4349
+ maxItems: 50,
4350
+ type: 'array'
4351
+ },
4352
+ categoryKeywords: {
4353
+ items: {
4354
+ type: 'array'
4355
+ },
4356
+ maxItems: 50,
4357
+ type: 'array'
4358
+ },
4359
+ methodKeywords: {
4360
+ items: {
4361
+ type: 'array'
4362
+ },
4363
+ maxItems: 50,
4364
+ description: 'Payment method keywords (e.g., HuaBei, YuEBao)',
4365
+ type: 'array'
4366
+ },
4367
+ categoryAccount: {
4368
+ type: 'string',
4369
+ maxLength: 200,
4370
+ description:
4371
+ 'Destination account for expenses/income (e.g., Expenses:Food:Coffee)'
4372
+ },
4373
+ matchLogic: {
4374
+ type: 'string',
4375
+ enum: ['OR', 'AND'],
4376
+ default: 'OR'
4377
+ },
4378
+ amountMin: {
4379
+ type: 'number',
4380
+ minimum: 0,
4381
+ description: 'Minimum transaction amount (inclusive)'
4382
+ },
4383
+ amountMax: {
4384
+ type: 'number',
4385
+ minimum: 0,
4386
+ description: 'Maximum transaction amount (inclusive)'
4387
+ },
4388
+ priority: {
4389
+ type: 'number',
4390
+ default: 50,
4391
+ minimum: 0,
4392
+ maximum: 1000
4393
+ },
4394
+ additionalTags: {
4395
+ items: {
4396
+ type: 'array'
4397
+ },
4398
+ maxItems: 20,
4399
+ type: 'array'
4400
+ },
4401
+ additionalMetadata: {
4402
+ type: 'object'
4403
+ },
4404
+ upsertByPayee: {
4405
+ type: 'boolean',
4406
+ description:
4407
+ 'If true, update existing rule with matching payeeKeywords[0] instead of creating new rule'
4408
+ }
4409
+ },
4410
+ required: ['name', 'matchLogic', 'priority']
4411
+ } as const;
4412
+
4413
+ export const $AmountRangeDto = {
4414
+ type: 'object',
4415
+ properties: {
4416
+ min: {
4417
+ type: 'number',
4418
+ description: 'Minimum amount'
4419
+ },
4420
+ max: {
4421
+ type: 'number',
4422
+ description: 'Maximum amount'
4423
+ }
4424
+ }
4425
+ } as const;
4426
+
4427
+ export const $TransactionRuleResponseDto = {
4428
+ type: 'object',
4429
+ properties: {
4430
+ id: {
4431
+ type: 'string',
4432
+ description: 'Rule ID'
4433
+ },
4434
+ name: {
4435
+ type: 'string',
4436
+ description: 'Rule name'
4437
+ },
4438
+ description: {
4439
+ type: 'string',
4440
+ description: 'Rule description'
4441
+ },
4442
+ narrationKeywords: {
4443
+ description: 'Keywords to match in transaction narration',
4444
+ type: 'array',
4445
+ items: {
4446
+ type: 'string'
4447
+ }
4448
+ },
4449
+ payeeKeywords: {
4450
+ description: 'Keywords to match in payee name',
4451
+ type: 'array',
4452
+ items: {
4453
+ type: 'string'
4454
+ }
4455
+ },
4456
+ categoryKeywords: {
4457
+ description: 'Keywords to match in category',
4458
+ type: 'array',
4459
+ items: {
4460
+ type: 'string'
4461
+ }
4462
+ },
4463
+ methodKeywords: {
4464
+ description: 'Keywords to match in payment method',
4465
+ type: 'array',
4466
+ items: {
4467
+ type: 'string'
4468
+ }
4469
+ },
4470
+ categoryAccount: {
4471
+ type: 'string',
4472
+ description: 'Destination account for categorization'
4473
+ },
4474
+ matchLogic: {
4475
+ type: 'string',
3904
4476
  description: 'Keyword matching logic',
3905
4477
  enum: ['OR', 'AND'],
3906
4478
  example: 'OR'
@@ -4400,151 +4972,67 @@ export const $TestRuleResponseDto = {
4400
4972
  required: ['ruleId', 'matches', 'confidence', 'matchDetails']
4401
4973
  } as const;
4402
4974
 
4403
- export const $DeleteOwnUserDto = {
4404
- type: 'object',
4405
- properties: {
4406
- accessToken: {
4407
- type: 'string',
4408
- description: 'Access token for user verification',
4409
- example: 'abc123xyz'
4410
- }
4411
- },
4412
- required: ['accessToken']
4413
- } as const;
4414
-
4415
- export const $SignupDto = {
4416
- type: 'object',
4417
- properties: {
4418
- turnstileToken: {
4419
- type: 'string',
4420
- description:
4421
- 'Cloudflare Turnstile verification token (optional when Turnstile disabled)',
4422
- example: '0.abc123def456...'
4423
- }
4424
- }
4425
- } as const;
4426
-
4427
- export const $UpdateUserSettingDto = {
4975
+ export const $CategoryCatalogEntryDto = {
4428
4976
  type: 'object',
4429
4977
  properties: {
4430
- secId: {
4431
- type: 'number',
4432
- description: 'Security ID'
4433
- },
4434
- annualInterestRate: {
4435
- type: 'number',
4436
- description: 'Annual interest rate',
4437
- example: 0.05
4438
- },
4439
- currency: {
4440
- type: 'string',
4441
- description: 'Currency code',
4442
- example: 'USD'
4443
- },
4444
- baseCurrency: {
4445
- type: 'string',
4446
- description: 'Base currency code',
4447
- example: 'USD'
4448
- },
4449
- benchmark: {
4978
+ slug: {
4450
4979
  type: 'string',
4451
- description: 'Benchmark symbol',
4452
- example: 'SPY'
4980
+ description: 'Category slug (single source-of-truth)',
4981
+ example: 'food'
4453
4982
  },
4454
- colorScheme: {
4983
+ scenario: {
4455
4984
  type: 'string',
4456
- description: 'Color scheme',
4457
- enum: ['DARK', 'LIGHT']
4985
+ description: 'Display scenario group (maps to frontend picker _scenario)',
4986
+ enum: [
4987
+ 'expense',
4988
+ 'income',
4989
+ 'investment',
4990
+ 'banking',
4991
+ 'transfer',
4992
+ 'payment'
4993
+ ],
4994
+ example: 'expense'
4458
4995
  },
4459
- dateRange: {
4996
+ icon: {
4460
4997
  type: 'string',
4461
- description: 'Date range filter',
4462
- example: '1y'
4463
- },
4464
- emergencyFund: {
4465
- type: 'number',
4466
- description: 'Emergency fund amount',
4467
- example: 10000
4468
- },
4469
- 'filters.accounts': {
4470
- description: 'Account filter IDs',
4471
- type: 'array',
4472
- items: {
4473
- type: 'string'
4474
- }
4998
+ description: 'Lucide icon name',
4999
+ example: 'utensils'
4475
5000
  },
4476
- 'filters.assetClasses': {
4477
- description: 'Asset class filters',
5001
+ regions: {
5002
+ description: "Applicable regions ('*' = all, 'cn' = CN-only)",
5003
+ example: ['*'],
4478
5004
  type: 'array',
4479
5005
  items: {
4480
5006
  type: 'string'
4481
5007
  }
4482
- },
4483
- 'filters.dataSource': {
4484
- type: 'string',
4485
- description: 'Data source filter'
4486
- },
4487
- 'filters.symbol': {
4488
- type: 'string',
4489
- description: 'Symbol filter'
4490
- },
4491
- 'filters.tags': {
4492
- description: 'Tag filters',
5008
+ }
5009
+ },
5010
+ required: ['slug', 'scenario', 'icon', 'regions']
5011
+ } as const;
5012
+
5013
+ export const $CategoryCatalogListResponseDto = {
5014
+ type: 'object',
5015
+ properties: {
5016
+ items: {
5017
+ description: 'Category entries (region-scoped, query-filtered)',
4493
5018
  type: 'array',
4494
5019
  items: {
4495
- type: 'string'
5020
+ $ref: '#/components/schemas/CategoryCatalogEntryDto'
4496
5021
  }
4497
5022
  },
4498
- isExperimentalFeatures: {
4499
- type: 'boolean',
4500
- description: 'Enable experimental features'
4501
- },
4502
- isRestrictedView: {
4503
- type: 'boolean',
4504
- description: 'Enable restricted view mode'
4505
- },
4506
- language: {
4507
- type: 'string',
4508
- description: 'Language code',
4509
- example: 'en'
4510
- },
4511
- locale: {
4512
- type: 'string',
4513
- description: 'Locale code',
4514
- example: 'en-US'
4515
- },
4516
- projectedTotalAmount: {
4517
- type: 'number',
4518
- description: 'Projected total amount',
4519
- example: 1000000
4520
- },
4521
- retirementDate: {
4522
- type: 'string',
4523
- description: 'Retirement date in ISO 8601 format',
4524
- example: '2050-01-01'
4525
- },
4526
- savingsRate: {
5023
+ total: {
4527
5024
  type: 'number',
4528
- description: 'Savings rate percentage',
4529
- example: 0.2
5025
+ description:
5026
+ 'Total category entries for the region (before query filtering)',
5027
+ example: 30
4530
5028
  },
4531
- viewMode: {
4532
- type: 'string',
4533
- description: 'View mode',
4534
- enum: ['DEFAULT', 'ZEN']
4535
- }
4536
- }
4537
- } as const;
4538
-
4539
- export const $UpdatePropertyDto = {
4540
- type: 'object',
4541
- properties: {
4542
- value: {
5029
+ region: {
4543
5030
  type: 'string',
4544
- description: 'Property value'
5031
+ description: 'Region code',
5032
+ example: 'cn'
4545
5033
  }
4546
5034
  },
4547
- required: ['value']
5035
+ required: ['items', 'total', 'region']
4548
5036
  } as const;
4549
5037
 
4550
5038
  export const $CreateBeanEventDto = {
@@ -5289,7 +5777,8 @@ export const $UpdateMapperDefaultsDto = {
5289
5777
  type: 'string',
5290
5778
  description: 'Source account for transactions (Beancount format)',
5291
5779
  example: 'Assets:CN:Alipay:Balance',
5292
- pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
5780
+ pattern:
5781
+ '^(Assets|Liabilities|Income|Expenses|Equity)(:[A-Za-z0-9][A-Za-z0-9-]*)+$'
5293
5782
  },
5294
5783
  currency: {
5295
5784
  type: 'string',
@@ -5303,13 +5792,15 @@ export const $UpdateMapperDefaultsDto = {
5303
5792
  type: 'string',
5304
5793
  description: 'Default expense account (optional)',
5305
5794
  example: 'Expenses:Unknown',
5306
- pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
5795
+ pattern:
5796
+ '^(Assets|Liabilities|Income|Expenses|Equity)(:[A-Za-z0-9][A-Za-z0-9-]*)+$'
5307
5797
  },
5308
5798
  incomeAccount: {
5309
5799
  type: 'string',
5310
5800
  description: 'Default income account (optional)',
5311
5801
  example: 'Income:Unknown',
5312
- pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
5802
+ pattern:
5803
+ '^(Assets|Liabilities|Income|Expenses|Equity)(:[A-Za-z0-9][A-Za-z0-9-]*)+$'
5313
5804
  },
5314
5805
  methodAccountMapping: {
5315
5806
  type: 'object',
@@ -5366,12 +5857,14 @@ export const $ProviderSyncConfigDto = {
5366
5857
  },
5367
5858
  defaultExpenseAccount: {
5368
5859
  type: 'string',
5369
- description: 'Default expense account for the second posting',
5860
+ description:
5861
+ 'Default expense account for the second posting. Omit when no real default exists; the pipeline routes to Review via the Uncategorized sentinel (#618).',
5370
5862
  example: 'Expenses:Unknown'
5371
5863
  },
5372
5864
  defaultIncomeAccount: {
5373
5865
  type: 'string',
5374
- description: 'Default income account for the second posting',
5866
+ description:
5867
+ 'Default income account for the second posting. Omit when no real default exists; the pipeline routes to Review via the Uncategorized sentinel (#618).',
5375
5868
  example: 'Income:Unknown'
5376
5869
  },
5377
5870
  filterPending: {
@@ -5386,12 +5879,7 @@ export const $ProviderSyncConfigDto = {
5386
5879
  example: 'acc_gocardless_001'
5387
5880
  }
5388
5881
  },
5389
- required: [
5390
- 'sourceAccount',
5391
- 'defaultCurrency',
5392
- 'defaultExpenseAccount',
5393
- 'defaultIncomeAccount'
5394
- ]
5882
+ required: ['sourceAccount', 'defaultCurrency']
5395
5883
  } as const;
5396
5884
 
5397
5885
  export const $ProviderSyncDto = {
@@ -5601,15 +6089,105 @@ export const $UncoveredFormatMissDto = {
5601
6089
  properties: {}
5602
6090
  } as const;
5603
6091
 
6092
+ export const $ClientParsedDataDto = {
6093
+ type: 'object',
6094
+ properties: {
6095
+ amount: {
6096
+ type: 'number',
6097
+ description: 'Transaction amount',
6098
+ example: 35
6099
+ },
6100
+ currency: {
6101
+ type: 'string',
6102
+ description: 'Currency code',
6103
+ example: 'CNY'
6104
+ },
6105
+ date: {
6106
+ type: 'string',
6107
+ description: 'Transaction date (ISO 8601)',
6108
+ example: '2026-08-15'
6109
+ },
6110
+ payee: {
6111
+ type: 'string',
6112
+ description: 'Payee/merchant name',
6113
+ example: 'Starbucks'
6114
+ },
6115
+ narration: {
6116
+ type: 'string',
6117
+ description: 'Transaction narration'
6118
+ },
6119
+ category: {
6120
+ type: 'string',
6121
+ description: 'Category slug',
6122
+ example: 'food_restaurant'
6123
+ },
6124
+ incomeType: {
6125
+ type: 'string',
6126
+ description: 'Income type',
6127
+ example: 'Salary'
6128
+ },
6129
+ incomeSource: {
6130
+ type: 'string',
6131
+ description: 'Income source',
6132
+ example: 'Anthropic Inc.'
6133
+ },
6134
+ symbol: {
6135
+ type: 'string',
6136
+ description: 'Security symbol code (e.g., 600519, AAPL)',
6137
+ example: 'AAPL'
6138
+ },
6139
+ quantity: {
6140
+ type: 'number',
6141
+ description: 'Quantity of shares/units',
6142
+ example: 100
6143
+ },
6144
+ price: {
6145
+ type: 'number',
6146
+ description: 'Unit price per share/unit',
6147
+ example: 1900
6148
+ },
6149
+ investmentAction: {
6150
+ type: 'string',
6151
+ description: 'Investment action',
6152
+ enum: ['buy', 'sell'],
6153
+ example: 'buy'
6154
+ },
6155
+ paymentSource: {
6156
+ type: 'string',
6157
+ description: 'Payment source: asset (default) or liability (credit card)',
6158
+ enum: ['asset', 'liability'],
6159
+ example: 'asset'
6160
+ },
6161
+ liabilityHint: {
6162
+ type: 'string',
6163
+ description: 'Liability account hint (CreditCard/Huabei/Baitiao)',
6164
+ example: 'CreditCard'
6165
+ },
6166
+ warning: {
6167
+ type: 'string',
6168
+ description:
6169
+ 'Display-only warning from the prior response; accepted but ignored.',
6170
+ example: 'Cross-currency settlement applies.'
6171
+ }
6172
+ }
6173
+ } as const;
6174
+
5604
6175
  export const $ProcessNlpDto = {
5605
6176
  type: 'object',
5606
6177
  properties: {
5607
6178
  message: {
5608
6179
  type: 'string',
5609
- description: 'Natural language text describing a transaction (Chinese)',
5610
- example: 'yesterday Starbucks spent 35 yuan',
6180
+ description:
6181
+ 'Natural language text describing a transaction. Optional when `confirm` is true (structured confirm); otherwise required.',
6182
+ example: 'Starbucks 35',
5611
6183
  maxLength: 500
5612
6184
  },
6185
+ confirm: {
6186
+ type: 'boolean',
6187
+ description:
6188
+ 'Structured confirm signal — bypasses NL confirm-word matching when true. Send parsedData field edits alongside. The NL word-list path is the fallback.',
6189
+ example: true
6190
+ },
5613
6191
  sessionId: {
5614
6192
  type: 'string',
5615
6193
  description:
@@ -5617,17 +6195,32 @@ export const $ProcessNlpDto = {
5617
6195
  example: 'session_abc123'
5618
6196
  },
5619
6197
  parsedData: {
5620
- type: 'object',
5621
6198
  description:
5622
6199
  'Parsed data from previous NLP response for session recovery. Send back the parsedData received in confirm_payee/confirm responses.',
5623
6200
  example: {
5624
6201
  amount: 35,
5625
6202
  currency: 'CNY',
5626
6203
  payee: 'Starbucks'
5627
- }
6204
+ },
6205
+ allOf: [
6206
+ {
6207
+ $ref: '#/components/schemas/ClientParsedDataDto'
6208
+ }
6209
+ ]
6210
+ },
6211
+ selectedRuleId: {
6212
+ type: 'string',
6213
+ description:
6214
+ '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.',
6215
+ example: 'rule_abc123'
6216
+ },
6217
+ selectedAccount: {
6218
+ type: 'string',
6219
+ description:
6220
+ '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.',
6221
+ example: 'Expenses:Food:Coffee'
5628
6222
  }
5629
- },
5630
- required: ['message']
6223
+ }
5631
6224
  } as const;
5632
6225
 
5633
6226
  export const $NlpTransactionInfoDto = {
@@ -5949,7 +6542,8 @@ export const $NlpAccountConfirmationDataDto = {
5949
6542
  },
5950
6543
  suggestedAccount: {
5951
6544
  type: 'string',
5952
- description: 'Suggested replacement account',
6545
+ description:
6546
+ 'Suggested replacement account (omitted when no clear candidate)',
5953
6547
  example: 'Expenses:Food:Drinks'
5954
6548
  },
5955
6549
  similarAccounts: {
@@ -5971,7 +6565,6 @@ export const $NlpAccountConfirmationDataDto = {
5971
6565
  },
5972
6566
  required: [
5973
6567
  'invalidAccount',
5974
- 'suggestedAccount',
5975
6568
  'similarAccounts',
5976
6569
  'errorMessage',
5977
6570
  'transactionContext'
@@ -6144,7 +6737,8 @@ export const $NlpSuggestedAccountDto = {
6144
6737
  },
6145
6738
  confidence: {
6146
6739
  type: 'number',
6147
- description: 'Confidence score for this suggestion (0-1)',
6740
+ description:
6741
+ 'Confidence score for this suggestion (0-1). Present = predicted (confirm/confirm_rule/confirm_account); omitted = actual persisted account (created). (#586)',
6148
6742
  example: 0.9
6149
6743
  }
6150
6744
  },
@@ -6180,23 +6774,31 @@ export const $NlpDefaultAccountsDto = {
6180
6774
  properties: {
6181
6775
  asset: {
6182
6776
  type: 'string',
6183
- description: 'Default asset account',
6184
- example: 'Assets:Checking'
6777
+ description:
6778
+ 'Default OPEN asset account (MRU when multiple), or null when none/ambiguous',
6779
+ example: 'Assets:Checking',
6780
+ nullable: true
6185
6781
  },
6186
6782
  expense: {
6187
6783
  type: 'string',
6188
- description: 'Default expense account',
6189
- example: 'Expenses:Uncategorized'
6784
+ description:
6785
+ 'Default OPEN expense account (MRU when multiple), or null when none/ambiguous',
6786
+ example: 'Expenses:Food:Coffee',
6787
+ nullable: true
6190
6788
  },
6191
6789
  income: {
6192
6790
  type: 'string',
6193
- description: 'Default income account',
6194
- example: 'Income:Uncategorized'
6791
+ description:
6792
+ 'Default OPEN income account (MRU when multiple), or null when none/ambiguous',
6793
+ example: 'Income:Salary',
6794
+ nullable: true
6195
6795
  },
6196
6796
  liability: {
6197
6797
  type: 'string',
6198
- description: 'Default liability account',
6199
- example: 'Liabilities:CreditCard'
6798
+ description:
6799
+ 'Default OPEN liability account (MRU when multiple), or null when none/ambiguous',
6800
+ example: 'Liabilities:CreditCard',
6801
+ nullable: true
6200
6802
  }
6201
6803
  },
6202
6804
  required: ['asset', 'expense', 'income', 'liability']
@@ -6221,7 +6823,8 @@ export const $NlpResponseDto = {
6221
6823
  'confirm_rule',
6222
6824
  'confirm_account',
6223
6825
  'confirm_payee',
6224
- 'cancel'
6826
+ 'cancel',
6827
+ 'aborted'
6225
6828
  ]
6226
6829
  },
6227
6830
  intent: {
@@ -6235,7 +6838,7 @@ export const $NlpResponseDto = {
6235
6838
  type: 'string',
6236
6839
  description:
6237
6840
  'Asset sub-type (only present when intent is "asset"). Determines which asset-related form to render.',
6238
- enum: ['transfer', 'banking', 'investment'],
6841
+ enum: ['transfer', 'banking', 'investment', 'lend', 'lend_collect'],
6239
6842
  example: 'investment'
6240
6843
  },
6241
6844
  liabilitySubType: {
@@ -6316,91 +6919,263 @@ export const $NlpResponseDto = {
6316
6919
  }
6317
6920
  ]
6318
6921
  },
6319
- duplicateData: {
6320
- description:
6321
- 'Duplicate detection data (when action is "confirm_duplicate"). Contains information about potential duplicate transaction for user confirmation.',
6322
- allOf: [
6323
- {
6324
- $ref: '#/components/schemas/NlpDuplicateConfirmationDataDto'
6325
- }
6326
- ]
6922
+ duplicateData: {
6923
+ description:
6924
+ 'Duplicate detection data (when action is "confirm_duplicate"). Contains information about potential duplicate transaction for user confirmation.',
6925
+ allOf: [
6926
+ {
6927
+ $ref: '#/components/schemas/NlpDuplicateConfirmationDataDto'
6928
+ }
6929
+ ]
6930
+ },
6931
+ ruleData: {
6932
+ description:
6933
+ 'Rule match data (when action is "confirm_rule"). Contains information about medium-confidence rule match for user confirmation.',
6934
+ allOf: [
6935
+ {
6936
+ $ref: '#/components/schemas/NlpRuleConfirmationDataDto'
6937
+ }
6938
+ ]
6939
+ },
6940
+ accountData: {
6941
+ description:
6942
+ 'Account validation data (when action is "confirm_account"). Contains information about invalid account for user correction.',
6943
+ allOf: [
6944
+ {
6945
+ $ref: '#/components/schemas/NlpAccountConfirmationDataDto'
6946
+ }
6947
+ ]
6948
+ },
6949
+ payeeData: {
6950
+ description:
6951
+ 'Payee confirmation data (when action is "confirm_payee"). Contains information about medium/low confidence payee match for user confirmation.',
6952
+ allOf: [
6953
+ {
6954
+ $ref: '#/components/schemas/NlpPayeeConfirmationDataDto'
6955
+ }
6956
+ ]
6957
+ },
6958
+ confidence: {
6959
+ type: 'number',
6960
+ description: 'Overall confidence score (0-1)',
6961
+ example: 0.85
6962
+ },
6963
+ confidenceThreshold: {
6964
+ type: 'number',
6965
+ description:
6966
+ 'Confidence threshold for automatic creation (default: 0.75). When confidence < threshold, action will be "confirm" requiring user verification.',
6967
+ example: 0.75
6968
+ },
6969
+ recurringMatch: {
6970
+ description:
6971
+ 'Recurring transaction match info (when action is "created"). Contains match details when transaction matches a pending expected transaction.',
6972
+ allOf: [
6973
+ {
6974
+ $ref: '#/components/schemas/RecurringMatchInfoDto'
6975
+ }
6976
+ ]
6977
+ },
6978
+ recurringSuggestion: {
6979
+ description:
6980
+ '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.',
6981
+ allOf: [
6982
+ {
6983
+ $ref: '#/components/schemas/RecurringSuggestionDto'
6984
+ }
6985
+ ]
6986
+ },
6987
+ suggestedAccounts: {
6988
+ description:
6989
+ '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.',
6990
+ allOf: [
6991
+ {
6992
+ $ref: '#/components/schemas/NlpSuggestedAccountsDto'
6993
+ }
6994
+ ]
6995
+ },
6996
+ defaultAccounts: {
6997
+ description:
6998
+ 'Default fallback accounts for the user/region (#586). v1 returns universal constants; per-user personalization is planned.',
6999
+ allOf: [
7000
+ {
7001
+ $ref: '#/components/schemas/NlpDefaultAccountsDto'
7002
+ }
7003
+ ]
7004
+ }
7005
+ },
7006
+ required: ['status', 'action']
7007
+ } as const;
7008
+
7009
+ export const $PlatformListItemDto = {
7010
+ type: 'object',
7011
+ properties: {
7012
+ id: {
7013
+ type: 'string',
7014
+ description: 'Global platform ID'
7015
+ },
7016
+ name: {
7017
+ type: 'string',
7018
+ description: 'Platform name'
7019
+ },
7020
+ url: {
7021
+ type: 'string',
7022
+ description: 'Platform URL'
7023
+ },
7024
+ type: {
7025
+ type: 'string',
7026
+ description: 'Platform type',
7027
+ enum: [
7028
+ 'BANK',
7029
+ 'BROKERAGE',
7030
+ 'CRYPTO_EXCHANGE',
7031
+ 'PAYMENT',
7032
+ 'INVESTMENT',
7033
+ 'INSURANCE',
7034
+ 'OTHER'
7035
+ ]
7036
+ },
7037
+ canonical: {
7038
+ type: 'string',
7039
+ description: 'Canonical identifier in ACCOUNT_RE format (e.g., "icbc")'
7040
+ },
7041
+ suggestedSegment: {
7042
+ type: 'string',
7043
+ description:
7044
+ 'Suggested path segment — canonical PascalCased per hyphen-part, hyphens preserved (e.g. "Apple-Pay")'
7045
+ },
7046
+ logoUrl: {
7047
+ type: 'string',
7048
+ description: 'Logo URL',
7049
+ nullable: true
7050
+ },
7051
+ countryCode: {
7052
+ type: 'string',
7053
+ description: 'ISO 3166-1 alpha-2 (UPPERCASE); null = global platform',
7054
+ example: 'CN',
7055
+ nullable: true
7056
+ },
7057
+ category: {
7058
+ type: 'string',
7059
+ description:
7060
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank). null = no region-aware suggestion; fall back to type.',
7061
+ nullable: true,
7062
+ example: 'DigitalWallet'
7063
+ },
7064
+ isBound: {
7065
+ type: 'boolean',
7066
+ description: 'Whether user has accounts using this platform'
7067
+ }
7068
+ },
7069
+ required: [
7070
+ 'id',
7071
+ 'name',
7072
+ 'url',
7073
+ 'type',
7074
+ 'canonical',
7075
+ 'suggestedSegment',
7076
+ 'logoUrl',
7077
+ 'countryCode',
7078
+ 'category',
7079
+ 'isBound'
7080
+ ]
7081
+ } as const;
7082
+
7083
+ export const $PlatformMatchResultDto = {
7084
+ type: 'object',
7085
+ properties: {
7086
+ id: {
7087
+ type: 'string',
7088
+ description: 'Global platform ID'
7089
+ },
7090
+ name: {
7091
+ type: 'string',
7092
+ description: 'Platform name (e.g., "ICBC")'
7093
+ },
7094
+ canonical: {
7095
+ type: 'string',
7096
+ description: 'Canonical identifier in ACCOUNT_RE format (e.g., "icbc")'
6327
7097
  },
6328
- ruleData: {
6329
- description:
6330
- 'Rule match data (when action is "confirm_rule"). Contains information about medium-confidence rule match for user confirmation.',
6331
- allOf: [
6332
- {
6333
- $ref: '#/components/schemas/NlpRuleConfirmationDataDto'
6334
- }
7098
+ type: {
7099
+ type: 'string',
7100
+ description: 'Platform type',
7101
+ enum: [
7102
+ 'BANK',
7103
+ 'BROKERAGE',
7104
+ 'CRYPTO_EXCHANGE',
7105
+ 'PAYMENT',
7106
+ 'INVESTMENT',
7107
+ 'INSURANCE',
7108
+ 'OTHER'
6335
7109
  ]
6336
7110
  },
6337
- accountData: {
7111
+ suggestedSegment: {
7112
+ type: 'string',
6338
7113
  description:
6339
- 'Account validation data (when action is "confirm_account"). Contains information about invalid account for user correction.',
6340
- allOf: [
6341
- {
6342
- $ref: '#/components/schemas/NlpAccountConfirmationDataDto'
6343
- }
6344
- ]
7114
+ 'Suggested path segment — canonical PascalCased per hyphen-part, hyphens preserved (e.g. "Apple-Pay")'
6345
7115
  },
6346
- payeeData: {
6347
- description:
6348
- 'Payee confirmation data (when action is "confirm_payee"). Contains information about medium/low confidence payee match for user confirmation.',
6349
- allOf: [
6350
- {
6351
- $ref: '#/components/schemas/NlpPayeeConfirmationDataDto'
6352
- }
6353
- ]
7116
+ logoUrl: {
7117
+ type: 'string',
7118
+ description: 'Logo URL',
7119
+ nullable: true
6354
7120
  },
6355
- confidence: {
6356
- type: 'number',
6357
- description: 'Overall confidence score (0-1)',
6358
- example: 0.85
7121
+ countryCode: {
7122
+ type: 'string',
7123
+ description: 'ISO 3166-1 alpha-2 (UPPERCASE); null = global platform',
7124
+ example: 'CN',
7125
+ nullable: true
6359
7126
  },
6360
- confidenceThreshold: {
6361
- type: 'number',
7127
+ category: {
7128
+ type: 'string',
6362
7129
  description:
6363
- 'Confidence threshold for automatic creation (default: 0.75). When confidence < threshold, action will be "confirm" requiring user verification.',
6364
- example: 0.75
7130
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank). null = no region-aware suggestion; fall back to type.',
7131
+ nullable: true,
7132
+ example: 'DigitalWallet'
6365
7133
  },
6366
- recurringMatch: {
6367
- description:
6368
- 'Recurring transaction match info (when action is "created"). Contains match details when transaction matches a pending expected transaction.',
6369
- allOf: [
6370
- {
6371
- $ref: '#/components/schemas/RecurringMatchInfoDto'
6372
- }
6373
- ]
7134
+ matchType: {
7135
+ type: 'string',
7136
+ description: "How this row matched: 'exact' > 'prefix' > 'substring'",
7137
+ enum: ['exact', 'prefix', 'substring']
7138
+ }
7139
+ },
7140
+ required: [
7141
+ 'id',
7142
+ 'name',
7143
+ 'canonical',
7144
+ 'type',
7145
+ 'suggestedSegment',
7146
+ 'logoUrl',
7147
+ 'countryCode',
7148
+ 'category',
7149
+ 'matchType'
7150
+ ]
7151
+ } as const;
7152
+
7153
+ export const $PlatformMatchResponseDto = {
7154
+ type: 'object',
7155
+ properties: {
7156
+ platforms: {
7157
+ description: 'Ranked matches, best tier first (at most 10 rows)',
7158
+ type: 'array',
7159
+ items: {
7160
+ $ref: '#/components/schemas/PlatformMatchResultDto'
7161
+ }
6374
7162
  },
6375
- recurringSuggestion: {
7163
+ matchType: {
7164
+ type: 'string',
6376
7165
  description:
6377
- '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.',
6378
- allOf: [
6379
- {
6380
- $ref: '#/components/schemas/RecurringSuggestionDto'
6381
- }
6382
- ]
7166
+ "Overall match quality — top row's tier, or 'none' when no hits",
7167
+ enum: ['none', 'exact', 'prefix', 'substring']
6383
7168
  },
6384
- suggestedAccounts: {
6385
- description:
6386
- 'Suggested accounts for this transaction. Contains recommended source and destination accounts based on the detected intent and rules.',
6387
- allOf: [
6388
- {
6389
- $ref: '#/components/schemas/NlpSuggestedAccountsDto'
6390
- }
6391
- ]
7169
+ total: {
7170
+ type: 'number',
7171
+ description: 'Total matches before LIMIT (truncation transparency)'
6392
7172
  },
6393
- defaultAccounts: {
6394
- description:
6395
- 'Default accounts for the user/region. These are fallback accounts used when no specific suggestion is available.',
6396
- allOf: [
6397
- {
6398
- $ref: '#/components/schemas/NlpDefaultAccountsDto'
6399
- }
6400
- ]
7173
+ hasMore: {
7174
+ type: 'boolean',
7175
+ description: 'true when total > platforms.length (more matches exist)'
6401
7176
  }
6402
7177
  },
6403
- required: ['status', 'action']
7178
+ required: ['platforms', 'matchType', 'total', 'hasMore']
6404
7179
  } as const;
6405
7180
 
6406
7181
  export const $CreatePlatformDto = {
@@ -7545,344 +8320,220 @@ export const $HoldingPnlWarningDto = {
7545
8320
  'OVERSOLD_LOTS',
7546
8321
  'NO_PRICE',
7547
8322
  'MIXED_COST_CURRENCY'
7548
- ]
7549
- },
7550
- symbol: {
7551
- type: 'object',
7552
- nullable: true
7553
- },
7554
- accountId: {
7555
- type: 'object',
7556
- nullable: true
7557
- },
7558
- currency: {
7559
- type: 'object',
7560
- nullable: true
7561
- }
7562
- },
7563
- required: ['type']
7564
- } as const;
7565
-
7566
- export const $HoldingPnlResponseDto = {
7567
- type: 'object',
7568
- properties: {
7569
- asOfDate: {
7570
- type: 'string',
7571
- example: '2026-07-08'
7572
- },
7573
- baseCurrency: {
7574
- type: 'string',
7575
- example: 'CNY'
7576
- },
7577
- method: {
7578
- type: 'string',
7579
- description:
7580
- 'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
7581
- enum: ['average', 'FIFO'],
7582
- example: 'average'
7583
- },
7584
- rows: {
7585
- type: 'array',
7586
- items: {
7587
- $ref: '#/components/schemas/HoldingPnlRowDto'
7588
- }
7589
- },
7590
- warnings: {
7591
- type: 'array',
7592
- items: {
7593
- $ref: '#/components/schemas/HoldingPnlWarningDto'
7594
- }
7595
- }
7596
- },
7597
- required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
7598
- } as const;
7599
-
7600
- export const $CurrencyBalanceDto = {
7601
- type: 'object',
7602
- properties: {
7603
- currency: {
7604
- type: 'string',
7605
- description: 'ISO 4217 currency code',
7606
- example: 'CNY'
7607
- },
7608
- balance: {
7609
- type: 'string',
7610
- description: 'Balance amount',
7611
- example: '500000.00'
7612
- }
7613
- },
7614
- required: ['currency', 'balance']
7615
- } as const;
7616
-
7617
- export const $TimeSeriesPointDto = {
7618
- type: 'object',
7619
- properties: {
7620
- date: {
7621
- type: 'string',
7622
- description: 'Date in YYYY-MM-DD format',
7623
- example: '2024-06-15'
7624
- },
7625
- value: {
7626
- type: 'string',
7627
- description: 'Value at this date (in base currency)',
7628
- example: '500000.00'
7629
- },
7630
- change: {
7631
- type: 'object',
7632
- description: 'Change from previous point',
7633
- example: '5000.00'
7634
- },
7635
- assets: {
7636
- type: 'string',
7637
- description: 'Total assets at this date (in base currency)',
7638
- example: '494338.00'
7639
- },
7640
- liabilities: {
7641
- type: 'string',
7642
- description: 'Total liabilities at this date (in base currency)',
7643
- example: '310098.00'
7644
- },
7645
- byCurrency: {
7646
- description: 'Multi-currency breakdown for this point',
7647
- type: 'array',
7648
- items: {
7649
- $ref: '#/components/schemas/CurrencyBalanceDto'
7650
- }
7651
- }
7652
- },
7653
- required: ['date', 'value']
7654
- } as const;
7655
-
7656
- export const $TrendSummaryDto = {
7657
- type: 'object',
7658
- properties: {
7659
- startValue: {
7660
- type: 'string',
7661
- description: 'Value at start of period',
7662
- example: '450000.00'
7663
- },
7664
- endValue: {
7665
- type: 'string',
7666
- description: 'Value at end of period',
7667
- example: '500000.00'
7668
- },
7669
- totalChange: {
7670
- type: 'string',
7671
- description: 'Total change over period',
7672
- example: '50000.00'
7673
- },
7674
- totalChangePercentage: {
7675
- type: 'string',
7676
- description: 'Total change percentage',
7677
- example: '+11.11%'
7678
- }
7679
- },
7680
- required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
7681
- } as const;
7682
-
7683
- export const $MultiCurrencyPointDto = {
7684
- type: 'object',
7685
- properties: {
7686
- date: {
7687
- type: 'string',
7688
- description: 'Date in YYYY-MM-DD format',
7689
- example: '2024-06-15'
8323
+ ]
7690
8324
  },
7691
- byCurrency: {
7692
- description: 'Balances by currency',
7693
- type: 'array',
7694
- items: {
7695
- $ref: '#/components/schemas/CurrencyBalanceDto'
7696
- }
8325
+ symbol: {
8326
+ type: 'object',
8327
+ nullable: true
8328
+ },
8329
+ accountId: {
8330
+ type: 'object',
8331
+ nullable: true
8332
+ },
8333
+ currency: {
8334
+ type: 'object',
8335
+ nullable: true
7697
8336
  }
7698
8337
  },
7699
- required: ['date', 'byCurrency']
8338
+ required: ['type']
7700
8339
  } as const;
7701
8340
 
7702
- export const $PortfolioTrendsResponseDto = {
8341
+ export const $HoldingPnlResponseDto = {
7703
8342
  type: 'object',
7704
8343
  properties: {
7705
- series: {
7706
- description: 'Time series data points',
7707
- type: 'array',
7708
- items: {
7709
- $ref: '#/components/schemas/TimeSeriesPointDto'
7710
- }
7711
- },
7712
- summary: {
7713
- description: 'Period summary',
7714
- allOf: [
7715
- {
7716
- $ref: '#/components/schemas/TrendSummaryDto'
7717
- }
7718
- ]
7719
- },
7720
- period: {
7721
- type: 'string',
7722
- description: 'Period requested',
7723
- example: '6m'
7724
- },
7725
- granularity: {
8344
+ asOfDate: {
7726
8345
  type: 'string',
7727
- description: 'Data granularity',
7728
- example: 'month'
8346
+ example: '2026-07-08'
7729
8347
  },
7730
- currency: {
8348
+ baseCurrency: {
7731
8349
  type: 'string',
7732
- description: 'Base currency for converted values',
7733
8350
  example: 'CNY'
7734
8351
  },
7735
- byCurrency: {
8352
+ method: {
8353
+ type: 'string',
7736
8354
  description:
7737
- 'Multi-currency time series (each point has currency breakdown)',
8355
+ 'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
8356
+ enum: ['average', 'FIFO'],
8357
+ example: 'average'
8358
+ },
8359
+ rows: {
7738
8360
  type: 'array',
7739
8361
  items: {
7740
- $ref: '#/components/schemas/MultiCurrencyPointDto'
8362
+ $ref: '#/components/schemas/HoldingPnlRowDto'
7741
8363
  }
7742
8364
  },
7743
8365
  warnings: {
7744
- description: 'Exchange rate warnings',
7745
8366
  type: 'array',
7746
8367
  items: {
7747
- $ref: '#/components/schemas/ExchangeRateWarningDto'
8368
+ $ref: '#/components/schemas/HoldingPnlWarningDto'
7748
8369
  }
7749
8370
  }
7750
8371
  },
7751
- required: ['series', 'summary', 'period', 'granularity', 'currency']
8372
+ required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
7752
8373
  } as const;
7753
8374
 
7754
- export const $CashFlowPointDto = {
8375
+ export const $AnonymousLoginDto = {
7755
8376
  type: 'object',
7756
8377
  properties: {
7757
- month: {
7758
- type: 'string',
7759
- description: 'Month key (YYYY-MM)',
7760
- example: '2024-03'
7761
- },
7762
- income: {
7763
- type: 'string',
7764
- description: 'Income in base currency (absolute, converted)',
7765
- example: '10000.00'
7766
- },
7767
- expense: {
7768
- type: 'string',
7769
- description: 'Expense in base currency (absolute, converted)',
7770
- example: '5000.00'
7771
- },
7772
- netSavings: {
8378
+ accessToken: {
7773
8379
  type: 'string',
7774
- description: 'netSavings = income − expense (savings positive)',
7775
- example: '5000.00'
8380
+ description: 'Access token for anonymous login'
7776
8381
  }
7777
8382
  },
7778
- required: ['month', 'income', 'expense', 'netSavings']
8383
+ required: ['accessToken']
7779
8384
  } as const;
7780
8385
 
7781
- export const $CashFlowTrendSummaryDto = {
8386
+ export const $AnonymousLoginResponseDto = {
7782
8387
  type: 'object',
7783
8388
  properties: {
7784
- totalIncome: {
7785
- type: 'string',
7786
- description: 'Total income across the period',
7787
- example: '60000.00'
7788
- },
7789
- totalExpense: {
7790
- type: 'string',
7791
- description: 'Total expense across the period',
7792
- example: '30000.00'
7793
- },
7794
- totalNetSavings: {
7795
- type: 'string',
7796
- description: 'income − expense across the period',
7797
- example: '30000.00'
7798
- },
7799
- averageMonthlyNetSavings: {
8389
+ authToken: {
7800
8390
  type: 'string',
7801
- description:
7802
- 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
7803
- example: '5000.00'
8391
+ description: 'JWT auth token',
8392
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
7804
8393
  }
7805
8394
  },
7806
- required: [
7807
- 'totalIncome',
7808
- 'totalExpense',
7809
- 'totalNetSavings',
7810
- 'averageMonthlyNetSavings'
7811
- ]
8395
+ required: ['authToken']
7812
8396
  } as const;
7813
8397
 
7814
- export const $CashFlowTrendsResponseDto = {
8398
+ export const $SymbolSearchResultDto = {
7815
8399
  type: 'object',
7816
8400
  properties: {
7817
- series: {
7818
- description:
7819
- 'Monthly cash-flow series (fixed N-month window, zero-filled)',
7820
- type: 'array',
7821
- items: {
7822
- $ref: '#/components/schemas/CashFlowPointDto'
7823
- }
8401
+ symbol: {
8402
+ type: 'string',
8403
+ example: 'AAPL'
7824
8404
  },
7825
- summary: {
7826
- description: 'Period totals',
7827
- allOf: [
7828
- {
7829
- $ref: '#/components/schemas/CashFlowTrendSummaryDto'
7830
- }
7831
- ]
8405
+ name: {
8406
+ type: 'object',
8407
+ example: 'Apple Inc.',
8408
+ nullable: true
7832
8409
  },
7833
- period: {
7834
- type: 'string',
7835
- description: 'Period requested',
7836
- example: '6m'
8410
+ exchange: {
8411
+ type: 'object',
8412
+ example: 'US',
8413
+ nullable: true
7837
8414
  },
7838
- granularity: {
7839
- type: 'string',
7840
- description: 'Data granularity (v1 returns month buckets)',
7841
- example: 'month'
8415
+ assetType: {
8416
+ type: 'object',
8417
+ description: 'OpenBB asset_type (e.g. stock, etf)',
8418
+ example: 'stock',
8419
+ nullable: true
7842
8420
  },
7843
- currency: {
7844
- type: 'string',
7845
- description: 'Base currency for converted values',
7846
- example: 'CNY'
8421
+ assetClass: {
8422
+ type: 'object',
8423
+ description: 'IGN asset class (region.types.ts ASSET_CLASSES)',
8424
+ example: 'EQUITY',
8425
+ nullable: true
7847
8426
  },
7848
- warnings: {
7849
- description: 'Exchange rate warnings (e.g. missing rate for a currency)',
7850
- type: 'array',
7851
- items: {
7852
- $ref: '#/components/schemas/ExchangeRateWarningDto'
7853
- }
8427
+ assetSubClass: {
8428
+ type: 'object',
8429
+ description: 'IGN asset sub-class (region.types.ts ASSET_SUB_CLASSES)',
8430
+ example: 'STOCK',
8431
+ nullable: true
8432
+ },
8433
+ currency: {
8434
+ type: 'object',
8435
+ description: 'Trading currency (extra_data or inferred from exchange)',
8436
+ example: 'USD',
8437
+ nullable: true
7854
8438
  }
7855
8439
  },
7856
- required: ['series', 'summary', 'period', 'granularity', 'currency']
7857
- } as const;
7858
-
7859
- export const $GenerateSnapshotBody = {
7860
- type: 'object',
7861
- properties: {}
7862
- } as const;
7863
-
7864
- export const $GenerateSnapshotResponse = {
7865
- type: 'object',
7866
- properties: {}
7867
- } as const;
7868
-
7869
- export const $BackfillSnapshotsBody = {
7870
- type: 'object',
7871
- properties: {}
7872
- } as const;
7873
-
7874
- export const $BackfillSnapshotsResponse = {
7875
- type: 'object',
7876
- properties: {}
8440
+ required: ['symbol']
7877
8441
  } as const;
7878
8442
 
7879
- export const $AnonymousLoginDto = {
8443
+ export const $SymbolQuoteDto = {
7880
8444
  type: 'object',
7881
8445
  properties: {
7882
- accessToken: {
8446
+ symbol: {
7883
8447
  type: 'string',
7884
- description: 'Access token for anonymous login'
8448
+ example: 'AAPL'
8449
+ },
8450
+ name: {
8451
+ type: 'object',
8452
+ example: 'Apple Inc.',
8453
+ nullable: true
8454
+ },
8455
+ exchange: {
8456
+ type: 'object',
8457
+ example: 'US',
8458
+ nullable: true
8459
+ },
8460
+ assetType: {
8461
+ type: 'object',
8462
+ description: 'OpenBB asset_type',
8463
+ example: 'stock',
8464
+ nullable: true
8465
+ },
8466
+ assetClass: {
8467
+ type: 'object',
8468
+ description: 'IGN asset class',
8469
+ example: 'EQUITY',
8470
+ nullable: true
8471
+ },
8472
+ assetSubClass: {
8473
+ type: 'object',
8474
+ description: 'IGN asset sub-class',
8475
+ example: 'STOCK',
8476
+ nullable: true
8477
+ },
8478
+ currency: {
8479
+ type: 'object',
8480
+ description: 'Trading currency (extra_data or inferred from exchange)',
8481
+ example: 'USD',
8482
+ nullable: true
8483
+ },
8484
+ price: {
8485
+ type: 'object',
8486
+ description: 'Latest price (Decimal string)',
8487
+ example: '189.84',
8488
+ nullable: true
8489
+ },
8490
+ priceDate: {
8491
+ type: 'object',
8492
+ description: 'Date the price was observed (ISO yyyy-MM-dd)',
8493
+ example: '2026-08-05',
8494
+ nullable: true
8495
+ },
8496
+ changePercent: {
8497
+ type: 'object',
8498
+ description:
8499
+ '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.',
8500
+ example: 1.7,
8501
+ nullable: true
8502
+ },
8503
+ prevClose: {
8504
+ type: 'object',
8505
+ description: 'Previous close (Decimal string)',
8506
+ nullable: true
8507
+ },
8508
+ open: {
8509
+ type: 'object',
8510
+ description: 'Day open (Decimal string)',
8511
+ nullable: true
8512
+ },
8513
+ high: {
8514
+ type: 'object',
8515
+ description: 'Day high (Decimal string)',
8516
+ nullable: true
8517
+ },
8518
+ low: {
8519
+ type: 'object',
8520
+ description: 'Day low (Decimal string)',
8521
+ nullable: true
8522
+ },
8523
+ volume: {
8524
+ type: 'object',
8525
+ description: 'Day volume (Decimal string)',
8526
+ nullable: true
8527
+ },
8528
+ yearHigh: {
8529
+ type: 'object',
8530
+ description: '52-week high (Decimal string)',
8531
+ nullable: true
8532
+ },
8533
+ yearLow: {
8534
+ type: 'object',
8535
+ description: '52-week low (Decimal string)',
8536
+ nullable: true
7885
8537
  }
7886
- },
7887
- required: ['accessToken']
8538
+ }
7888
8539
  } as const;