@firela/api-types 0.0.0-canary.a90ce0e4 → 0.0.0-canary.aa5c64ec

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,603 @@ 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 $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
+ },
4405
+ payeeKeywords: {
4406
+ description: 'Keywords to match in payee name',
4407
+ type: 'array',
4408
+ items: {
4409
+ type: 'string'
4410
+ }
4411
+ },
4412
+ categoryKeywords: {
4413
+ description: 'Keywords to match in category',
4414
+ type: 'array',
4415
+ items: {
4416
+ type: 'string'
4417
+ }
4418
+ },
4419
+ methodKeywords: {
4420
+ description: 'Keywords to match in payment method',
4421
+ type: 'array',
4422
+ items: {
4423
+ type: 'string'
4424
+ }
4425
+ },
4426
+ categoryAccount: {
4427
+ type: 'string',
4428
+ description: 'Destination account for categorization'
4429
+ },
4430
+ matchLogic: {
4431
+ type: 'string',
3904
4432
  description: 'Keyword matching logic',
3905
4433
  enum: ['OR', 'AND'],
3906
4434
  example: 'OR'
@@ -4324,227 +4852,80 @@ export const $UpdateTransactionRuleDto = {
4324
4852
  },
4325
4853
  priority: {
4326
4854
  type: 'number',
4327
- minimum: 0,
4328
- maximum: 1000
4329
- },
4330
- enabled: {
4331
- type: 'boolean',
4332
- description: 'Enable or disable the rule'
4333
- },
4334
- additionalTags: {
4335
- items: {
4336
- type: 'array'
4337
- },
4338
- maxItems: 20,
4339
- type: 'array'
4340
- },
4341
- additionalMetadata: {
4342
- type: 'object'
4343
- }
4344
- }
4345
- } as const;
4346
-
4347
- export const $TestRuleDto = {
4348
- type: 'object',
4349
- properties: {
4350
- narration: {
4351
- type: 'string',
4352
- minLength: 1,
4353
- maxLength: 500
4354
- },
4355
- payee: {
4356
- type: 'string',
4357
- maxLength: 200
4358
- },
4359
- categoryAccount: {
4360
- type: 'string',
4361
- maxLength: 200
4362
- },
4363
- amount: {
4364
- type: 'number'
4365
- },
4366
- currency: {
4367
- type: 'string',
4368
- maxLength: 10
4369
- }
4370
- },
4371
- required: ['narration']
4372
- } as const;
4373
-
4374
- export const $TestRuleResponseDto = {
4375
- type: 'object',
4376
- properties: {
4377
- ruleId: {
4378
- type: 'string',
4379
- description: 'Rule ID that was tested'
4380
- },
4381
- matches: {
4382
- type: 'boolean',
4383
- description: 'Whether the rule matched the test data'
4384
- },
4385
- confidence: {
4386
- type: 'number',
4387
- description: 'Match confidence score (0-1)',
4388
- example: 0.85
4389
- },
4390
- matchDetails: {
4391
- type: 'object',
4392
- description: 'Details of which fields matched',
4393
- example: {
4394
- narration: true,
4395
- payee: false,
4396
- categoryAccount: false
4397
- }
4398
- }
4399
- },
4400
- required: ['ruleId', 'matches', 'confidence', 'matchDetails']
4401
- } as const;
4402
-
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 = {
4428
- type: 'object',
4429
- 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: {
4450
- type: 'string',
4451
- description: 'Benchmark symbol',
4452
- example: 'SPY'
4453
- },
4454
- colorScheme: {
4455
- type: 'string',
4456
- description: 'Color scheme',
4457
- enum: ['DARK', 'LIGHT']
4458
- },
4459
- dateRange: {
4460
- 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
- }
4475
- },
4476
- 'filters.assetClasses': {
4477
- description: 'Asset class filters',
4478
- type: 'array',
4479
- items: {
4480
- type: 'string'
4481
- }
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',
4493
- type: 'array',
4494
- items: {
4495
- type: 'string'
4496
- }
4855
+ minimum: 0,
4856
+ maximum: 1000
4497
4857
  },
4498
- isExperimentalFeatures: {
4858
+ enabled: {
4499
4859
  type: 'boolean',
4500
- description: 'Enable experimental features'
4860
+ description: 'Enable or disable the rule'
4501
4861
  },
4502
- isRestrictedView: {
4503
- type: 'boolean',
4504
- description: 'Enable restricted view mode'
4862
+ additionalTags: {
4863
+ items: {
4864
+ type: 'array'
4865
+ },
4866
+ maxItems: 20,
4867
+ type: 'array'
4505
4868
  },
4506
- language: {
4869
+ additionalMetadata: {
4870
+ type: 'object'
4871
+ }
4872
+ }
4873
+ } as const;
4874
+
4875
+ export const $TestRuleDto = {
4876
+ type: 'object',
4877
+ properties: {
4878
+ narration: {
4507
4879
  type: 'string',
4508
- description: 'Language code',
4509
- example: 'en'
4880
+ minLength: 1,
4881
+ maxLength: 500
4510
4882
  },
4511
- locale: {
4883
+ payee: {
4512
4884
  type: 'string',
4513
- description: 'Locale code',
4514
- example: 'en-US'
4515
- },
4516
- projectedTotalAmount: {
4517
- type: 'number',
4518
- description: 'Projected total amount',
4519
- example: 1000000
4885
+ maxLength: 200
4520
4886
  },
4521
- retirementDate: {
4887
+ categoryAccount: {
4522
4888
  type: 'string',
4523
- description: 'Retirement date in ISO 8601 format',
4524
- example: '2050-01-01'
4889
+ maxLength: 200
4525
4890
  },
4526
- savingsRate: {
4527
- type: 'number',
4528
- description: 'Savings rate percentage',
4529
- example: 0.2
4891
+ amount: {
4892
+ type: 'number'
4530
4893
  },
4531
- viewMode: {
4894
+ currency: {
4532
4895
  type: 'string',
4533
- description: 'View mode',
4534
- enum: ['DEFAULT', 'ZEN']
4896
+ maxLength: 10
4535
4897
  }
4536
- }
4898
+ },
4899
+ required: ['narration']
4537
4900
  } as const;
4538
4901
 
4539
- export const $UpdatePropertyDto = {
4902
+ export const $TestRuleResponseDto = {
4540
4903
  type: 'object',
4541
4904
  properties: {
4542
- value: {
4905
+ ruleId: {
4543
4906
  type: 'string',
4544
- 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
+ }
4545
4926
  }
4546
4927
  },
4547
- required: ['value']
4928
+ required: ['ruleId', 'matches', 'confidence', 'matchDetails']
4548
4929
  } as const;
4549
4930
 
4550
4931
  export const $CreateBeanEventDto = {
@@ -5366,12 +5747,14 @@ export const $ProviderSyncConfigDto = {
5366
5747
  },
5367
5748
  defaultExpenseAccount: {
5368
5749
  type: 'string',
5369
- 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).',
5370
5752
  example: 'Expenses:Unknown'
5371
5753
  },
5372
5754
  defaultIncomeAccount: {
5373
5755
  type: 'string',
5374
- 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).',
5375
5758
  example: 'Income:Unknown'
5376
5759
  },
5377
5760
  filterPending: {
@@ -5386,12 +5769,7 @@ export const $ProviderSyncConfigDto = {
5386
5769
  example: 'acc_gocardless_001'
5387
5770
  }
5388
5771
  },
5389
- required: [
5390
- 'sourceAccount',
5391
- 'defaultCurrency',
5392
- 'defaultExpenseAccount',
5393
- 'defaultIncomeAccount'
5394
- ]
5772
+ required: ['sourceAccount', 'defaultCurrency']
5395
5773
  } as const;
5396
5774
 
5397
5775
  export const $ProviderSyncDto = {
@@ -5625,6 +6003,18 @@ export const $ProcessNlpDto = {
5625
6003
  currency: 'CNY',
5626
6004
  payee: 'Starbucks'
5627
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'
5628
6018
  }
5629
6019
  },
5630
6020
  required: ['message']
@@ -5949,7 +6339,8 @@ export const $NlpAccountConfirmationDataDto = {
5949
6339
  },
5950
6340
  suggestedAccount: {
5951
6341
  type: 'string',
5952
- description: 'Suggested replacement account',
6342
+ description:
6343
+ 'Suggested replacement account (omitted when no clear candidate)',
5953
6344
  example: 'Expenses:Food:Drinks'
5954
6345
  },
5955
6346
  similarAccounts: {
@@ -5971,7 +6362,6 @@ export const $NlpAccountConfirmationDataDto = {
5971
6362
  },
5972
6363
  required: [
5973
6364
  'invalidAccount',
5974
- 'suggestedAccount',
5975
6365
  'similarAccounts',
5976
6366
  'errorMessage',
5977
6367
  'transactionContext'
@@ -6144,7 +6534,8 @@ export const $NlpSuggestedAccountDto = {
6144
6534
  },
6145
6535
  confidence: {
6146
6536
  type: 'number',
6147
- 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)',
6148
6539
  example: 0.9
6149
6540
  }
6150
6541
  },
@@ -6180,23 +6571,31 @@ export const $NlpDefaultAccountsDto = {
6180
6571
  properties: {
6181
6572
  asset: {
6182
6573
  type: 'string',
6183
- description: 'Default asset account',
6184
- example: 'Assets:Checking'
6574
+ description:
6575
+ 'Default OPEN asset account (MRU when multiple), or null when none/ambiguous',
6576
+ example: 'Assets:Checking',
6577
+ nullable: true
6185
6578
  },
6186
6579
  expense: {
6187
6580
  type: 'string',
6188
- description: 'Default expense account',
6189
- 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
6190
6585
  },
6191
6586
  income: {
6192
6587
  type: 'string',
6193
- description: 'Default income account',
6194
- 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
6195
6592
  },
6196
6593
  liability: {
6197
6594
  type: 'string',
6198
- description: 'Default liability account',
6199
- 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
6200
6599
  }
6201
6600
  },
6202
6601
  required: ['asset', 'expense', 'income', 'liability']
@@ -6221,7 +6620,8 @@ export const $NlpResponseDto = {
6221
6620
  'confirm_rule',
6222
6621
  'confirm_account',
6223
6622
  'confirm_payee',
6224
- 'cancel'
6623
+ 'cancel',
6624
+ 'aborted'
6225
6625
  ]
6226
6626
  },
6227
6627
  intent: {
@@ -6316,91 +6716,263 @@ export const $NlpResponseDto = {
6316
6716
  }
6317
6717
  ]
6318
6718
  },
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
- ]
6719
+ duplicateData: {
6720
+ description:
6721
+ 'Duplicate detection data (when action is "confirm_duplicate"). Contains information about potential duplicate transaction for user confirmation.',
6722
+ allOf: [
6723
+ {
6724
+ $ref: '#/components/schemas/NlpDuplicateConfirmationDataDto'
6725
+ }
6726
+ ]
6727
+ },
6728
+ ruleData: {
6729
+ description:
6730
+ 'Rule match data (when action is "confirm_rule"). Contains information about medium-confidence rule match for user confirmation.',
6731
+ allOf: [
6732
+ {
6733
+ $ref: '#/components/schemas/NlpRuleConfirmationDataDto'
6734
+ }
6735
+ ]
6736
+ },
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")'
6327
6894
  },
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
- }
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'
6335
6906
  ]
6336
6907
  },
6337
- accountData: {
6908
+ suggestedSegment: {
6909
+ type: 'string',
6338
6910
  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
- ]
6911
+ 'Suggested path segment — PascalCase of canonical, hyphens removed (e.g. "ApplePay")'
6345
6912
  },
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
- ]
6913
+ logoUrl: {
6914
+ type: 'string',
6915
+ description: 'Logo URL',
6916
+ nullable: true
6354
6917
  },
6355
- confidence: {
6356
- type: 'number',
6357
- description: 'Overall confidence score (0-1)',
6358
- example: 0.85
6918
+ countryCode: {
6919
+ type: 'string',
6920
+ description: 'ISO 3166-1 alpha-2 (UPPERCASE); null = global platform',
6921
+ example: 'CN',
6922
+ nullable: true
6359
6923
  },
6360
- confidenceThreshold: {
6361
- type: 'number',
6924
+ category: {
6925
+ type: 'string',
6362
6926
  description:
6363
- 'Confidence threshold for automatic creation (default: 0.75). When confidence < threshold, action will be "confirm" requiring user verification.',
6364
- example: 0.75
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'
6365
6930
  },
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
- ]
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
+ }
6374
6959
  },
6375
- recurringSuggestion: {
6960
+ matchType: {
6961
+ type: 'string',
6376
6962
  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
- ]
6963
+ "Overall match quality — top row's tier, or 'none' when no hits",
6964
+ enum: ['none', 'exact', 'prefix', 'substring']
6383
6965
  },
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
- ]
6966
+ total: {
6967
+ type: 'number',
6968
+ description: 'Total matches before LIMIT (truncation transparency)'
6392
6969
  },
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
- ]
6970
+ hasMore: {
6971
+ type: 'boolean',
6972
+ description: 'true when total > platforms.length (more matches exist)'
6401
6973
  }
6402
6974
  },
6403
- required: ['status', 'action']
6975
+ required: ['platforms', 'matchType', 'total', 'hasMore']
6404
6976
  } as const;
6405
6977
 
6406
6978
  export const $CreatePlatformDto = {
@@ -7545,344 +8117,220 @@ export const $HoldingPnlWarningDto = {
7545
8117
  'OVERSOLD_LOTS',
7546
8118
  'NO_PRICE',
7547
8119
  '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'
8120
+ ]
7690
8121
  },
7691
- byCurrency: {
7692
- description: 'Balances by currency',
7693
- type: 'array',
7694
- items: {
7695
- $ref: '#/components/schemas/CurrencyBalanceDto'
7696
- }
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
7697
8133
  }
7698
8134
  },
7699
- required: ['date', 'byCurrency']
8135
+ required: ['type']
7700
8136
  } as const;
7701
8137
 
7702
- export const $PortfolioTrendsResponseDto = {
8138
+ export const $HoldingPnlResponseDto = {
7703
8139
  type: 'object',
7704
8140
  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: {
8141
+ asOfDate: {
7726
8142
  type: 'string',
7727
- description: 'Data granularity',
7728
- example: 'month'
8143
+ example: '2026-07-08'
7729
8144
  },
7730
- currency: {
8145
+ baseCurrency: {
7731
8146
  type: 'string',
7732
- description: 'Base currency for converted values',
7733
8147
  example: 'CNY'
7734
8148
  },
7735
- byCurrency: {
8149
+ method: {
8150
+ type: 'string',
7736
8151
  description:
7737
- '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: {
7738
8157
  type: 'array',
7739
8158
  items: {
7740
- $ref: '#/components/schemas/MultiCurrencyPointDto'
8159
+ $ref: '#/components/schemas/HoldingPnlRowDto'
7741
8160
  }
7742
8161
  },
7743
8162
  warnings: {
7744
- description: 'Exchange rate warnings',
7745
8163
  type: 'array',
7746
8164
  items: {
7747
- $ref: '#/components/schemas/ExchangeRateWarningDto'
8165
+ $ref: '#/components/schemas/HoldingPnlWarningDto'
7748
8166
  }
7749
8167
  }
7750
8168
  },
7751
- required: ['series', 'summary', 'period', 'granularity', 'currency']
8169
+ required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
7752
8170
  } as const;
7753
8171
 
7754
- export const $CashFlowPointDto = {
8172
+ export const $AnonymousLoginDto = {
7755
8173
  type: 'object',
7756
8174
  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: {
8175
+ accessToken: {
7773
8176
  type: 'string',
7774
- description: 'netSavings = income − expense (savings positive)',
7775
- example: '5000.00'
8177
+ description: 'Access token for anonymous login'
7776
8178
  }
7777
8179
  },
7778
- required: ['month', 'income', 'expense', 'netSavings']
8180
+ required: ['accessToken']
7779
8181
  } as const;
7780
8182
 
7781
- export const $CashFlowTrendSummaryDto = {
8183
+ export const $AnonymousLoginResponseDto = {
7782
8184
  type: 'object',
7783
8185
  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: {
8186
+ authToken: {
7800
8187
  type: 'string',
7801
- description:
7802
- 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
7803
- example: '5000.00'
8188
+ description: 'JWT auth token',
8189
+ example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
7804
8190
  }
7805
8191
  },
7806
- required: [
7807
- 'totalIncome',
7808
- 'totalExpense',
7809
- 'totalNetSavings',
7810
- 'averageMonthlyNetSavings'
7811
- ]
8192
+ required: ['authToken']
7812
8193
  } as const;
7813
8194
 
7814
- export const $CashFlowTrendsResponseDto = {
8195
+ export const $SymbolSearchResultDto = {
7815
8196
  type: 'object',
7816
8197
  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
- }
8198
+ symbol: {
8199
+ type: 'string',
8200
+ example: 'AAPL'
7824
8201
  },
7825
- summary: {
7826
- description: 'Period totals',
7827
- allOf: [
7828
- {
7829
- $ref: '#/components/schemas/CashFlowTrendSummaryDto'
7830
- }
7831
- ]
8202
+ name: {
8203
+ type: 'object',
8204
+ example: 'Apple Inc.',
8205
+ nullable: true
7832
8206
  },
7833
- period: {
7834
- type: 'string',
7835
- description: 'Period requested',
7836
- example: '6m'
8207
+ exchange: {
8208
+ type: 'object',
8209
+ example: 'US',
8210
+ nullable: true
7837
8211
  },
7838
- granularity: {
7839
- type: 'string',
7840
- description: 'Data granularity (v1 returns month buckets)',
7841
- example: 'month'
8212
+ assetType: {
8213
+ type: 'object',
8214
+ description: 'OpenBB asset_type (e.g. stock, etf)',
8215
+ example: 'stock',
8216
+ nullable: true
7842
8217
  },
7843
- currency: {
7844
- type: 'string',
7845
- description: 'Base currency for converted values',
7846
- example: 'CNY'
8218
+ assetClass: {
8219
+ type: 'object',
8220
+ description: 'IGN asset class (region.types.ts ASSET_CLASSES)',
8221
+ example: 'EQUITY',
8222
+ nullable: true
7847
8223
  },
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
- }
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
7854
8235
  }
7855
8236
  },
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: {}
8237
+ required: ['symbol']
7877
8238
  } as const;
7878
8239
 
7879
- export const $AnonymousLoginDto = {
8240
+ export const $SymbolQuoteDto = {
7880
8241
  type: 'object',
7881
8242
  properties: {
7882
- accessToken: {
8243
+ symbol: {
7883
8244
  type: 'string',
7884
- 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
7885
8334
  }
7886
- },
7887
- required: ['accessToken']
8335
+ }
7888
8336
  } as const;