@firela/api-types 0.0.0-canary.9256c41b → 0.0.0-canary.92e8f8e1

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'
@@ -4356,216 +4928,111 @@ export const $TestRuleDto = {
4356
4928
  type: 'string',
4357
4929
  maxLength: 200
4358
4930
  },
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 $SignupResponseDto = {
4428
- type: 'object',
4429
- properties: {
4430
- authToken: {
4431
- type: 'string',
4432
- description: 'JWT auth token',
4433
- example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
4434
- },
4435
- accessToken: {
4931
+ categoryAccount: {
4436
4932
  type: 'string',
4437
- description: 'Auto-generated access token'
4933
+ maxLength: 200
4438
4934
  },
4439
- role: {
4935
+ amount: {
4936
+ type: 'number'
4937
+ },
4938
+ currency: {
4440
4939
  type: 'string',
4441
- description: 'Assigned user role',
4442
- enum: ['USER', 'ADMIN', 'DEMO', 'INACTIVE', 'PAID', 'OPS']
4940
+ maxLength: 10
4443
4941
  }
4444
4942
  },
4445
- required: ['authToken', 'accessToken', 'role']
4943
+ required: ['narration']
4446
4944
  } as const;
4447
4945
 
4448
- export const $UpdateUserSettingDto = {
4946
+ export const $TestRuleResponseDto = {
4449
4947
  type: 'object',
4450
4948
  properties: {
4451
- secId: {
4452
- type: 'number',
4453
- description: 'Security ID'
4454
- },
4455
- annualInterestRate: {
4456
- type: 'number',
4457
- description: 'Annual interest rate',
4458
- example: 0.05
4459
- },
4460
- currency: {
4461
- type: 'string',
4462
- description: 'Currency code',
4463
- example: 'USD'
4464
- },
4465
- baseCurrency: {
4466
- type: 'string',
4467
- description: 'Base currency code',
4468
- example: 'USD'
4469
- },
4470
- benchmark: {
4471
- type: 'string',
4472
- description: 'Benchmark symbol',
4473
- example: 'SPY'
4474
- },
4475
- colorScheme: {
4949
+ ruleId: {
4476
4950
  type: 'string',
4477
- description: 'Color scheme',
4478
- enum: ['DARK', 'LIGHT']
4951
+ description: 'Rule ID that was tested'
4479
4952
  },
4480
- dateRange: {
4481
- type: 'string',
4482
- description: 'Date range filter',
4483
- example: '1y'
4953
+ matches: {
4954
+ type: 'boolean',
4955
+ description: 'Whether the rule matched the test data'
4484
4956
  },
4485
- emergencyFund: {
4957
+ confidence: {
4486
4958
  type: 'number',
4487
- description: 'Emergency fund amount',
4488
- example: 10000
4489
- },
4490
- 'filters.accounts': {
4491
- description: 'Account filter IDs',
4492
- type: 'array',
4493
- items: {
4494
- type: 'string'
4495
- }
4959
+ description: 'Match confidence score (0-1)',
4960
+ example: 0.85
4496
4961
  },
4497
- 'filters.assetClasses': {
4498
- description: 'Asset class filters',
4499
- type: 'array',
4500
- items: {
4501
- type: 'string'
4962
+ matchDetails: {
4963
+ type: 'object',
4964
+ description: 'Details of which fields matched',
4965
+ example: {
4966
+ narration: true,
4967
+ payee: false,
4968
+ categoryAccount: false
4502
4969
  }
4970
+ }
4971
+ },
4972
+ required: ['ruleId', 'matches', 'confidence', 'matchDetails']
4973
+ } as const;
4974
+
4975
+ export const $CategoryCatalogEntryDto = {
4976
+ type: 'object',
4977
+ properties: {
4978
+ slug: {
4979
+ type: 'string',
4980
+ description: 'Category slug (single source-of-truth)',
4981
+ example: 'food'
4503
4982
  },
4504
- 'filters.dataSource': {
4983
+ scenario: {
4505
4984
  type: 'string',
4506
- description: 'Data source filter'
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'
4507
4995
  },
4508
- 'filters.symbol': {
4996
+ icon: {
4509
4997
  type: 'string',
4510
- description: 'Symbol filter'
4998
+ description: 'Lucide icon name',
4999
+ example: 'utensils'
4511
5000
  },
4512
- 'filters.tags': {
4513
- description: 'Tag filters',
5001
+ regions: {
5002
+ description: "Applicable regions ('*' = all, 'cn' = CN-only)",
5003
+ example: ['*'],
4514
5004
  type: 'array',
4515
5005
  items: {
4516
5006
  type: 'string'
4517
5007
  }
4518
- },
4519
- isExperimentalFeatures: {
4520
- type: 'boolean',
4521
- description: 'Enable experimental features'
4522
- },
4523
- isRestrictedView: {
4524
- type: 'boolean',
4525
- description: 'Enable restricted view mode'
4526
- },
4527
- language: {
4528
- type: 'string',
4529
- description: 'Language code',
4530
- example: 'en'
4531
- },
4532
- locale: {
4533
- type: 'string',
4534
- description: 'Locale code',
4535
- example: 'en-US'
4536
- },
4537
- projectedTotalAmount: {
4538
- type: 'number',
4539
- description: 'Projected total amount',
4540
- example: 1000000
4541
- },
4542
- retirementDate: {
4543
- type: 'string',
4544
- description: 'Retirement date in ISO 8601 format',
4545
- example: '2050-01-01'
4546
- },
4547
- savingsRate: {
4548
- type: 'number',
4549
- description: 'Savings rate percentage',
4550
- example: 0.2
4551
- },
4552
- viewMode: {
4553
- type: 'string',
4554
- description: 'View mode',
4555
- enum: ['DEFAULT', 'ZEN']
4556
5008
  }
4557
- }
5009
+ },
5010
+ required: ['slug', 'scenario', 'icon', 'regions']
4558
5011
  } as const;
4559
5012
 
4560
- export const $UpdatePropertyDto = {
5013
+ export const $CategoryCatalogListResponseDto = {
4561
5014
  type: 'object',
4562
5015
  properties: {
4563
- value: {
5016
+ items: {
5017
+ description: 'Category entries (region-scoped, query-filtered)',
5018
+ type: 'array',
5019
+ items: {
5020
+ $ref: '#/components/schemas/CategoryCatalogEntryDto'
5021
+ }
5022
+ },
5023
+ total: {
5024
+ type: 'number',
5025
+ description:
5026
+ 'Total category entries for the region (before query filtering)',
5027
+ example: 30
5028
+ },
5029
+ region: {
4564
5030
  type: 'string',
4565
- description: 'Property value'
5031
+ description: 'Region code',
5032
+ example: 'cn'
4566
5033
  }
4567
5034
  },
4568
- required: ['value']
5035
+ required: ['items', 'total', 'region']
4569
5036
  } as const;
4570
5037
 
4571
5038
  export const $CreateBeanEventDto = {
@@ -5310,7 +5777,8 @@ export const $UpdateMapperDefaultsDto = {
5310
5777
  type: 'string',
5311
5778
  description: 'Source account for transactions (Beancount format)',
5312
5779
  example: 'Assets:CN:Alipay:Balance',
5313
- 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-]*)+$'
5314
5782
  },
5315
5783
  currency: {
5316
5784
  type: 'string',
@@ -5324,13 +5792,15 @@ export const $UpdateMapperDefaultsDto = {
5324
5792
  type: 'string',
5325
5793
  description: 'Default expense account (optional)',
5326
5794
  example: 'Expenses:Unknown',
5327
- 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-]*)+$'
5328
5797
  },
5329
5798
  incomeAccount: {
5330
5799
  type: 'string',
5331
5800
  description: 'Default income account (optional)',
5332
5801
  example: 'Income:Unknown',
5333
- 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-]*)+$'
5334
5804
  },
5335
5805
  methodAccountMapping: {
5336
5806
  type: 'object',
@@ -5387,12 +5857,14 @@ export const $ProviderSyncConfigDto = {
5387
5857
  },
5388
5858
  defaultExpenseAccount: {
5389
5859
  type: 'string',
5390
- 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).',
5391
5862
  example: 'Expenses:Unknown'
5392
5863
  },
5393
5864
  defaultIncomeAccount: {
5394
5865
  type: 'string',
5395
- 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).',
5396
5868
  example: 'Income:Unknown'
5397
5869
  },
5398
5870
  filterPending: {
@@ -5407,12 +5879,7 @@ export const $ProviderSyncConfigDto = {
5407
5879
  example: 'acc_gocardless_001'
5408
5880
  }
5409
5881
  },
5410
- required: [
5411
- 'sourceAccount',
5412
- 'defaultCurrency',
5413
- 'defaultExpenseAccount',
5414
- 'defaultIncomeAccount'
5415
- ]
5882
+ required: ['sourceAccount', 'defaultCurrency']
5416
5883
  } as const;
5417
5884
 
5418
5885
  export const $ProviderSyncDto = {
@@ -5622,15 +6089,105 @@ export const $UncoveredFormatMissDto = {
5622
6089
  properties: {}
5623
6090
  } as const;
5624
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
+
5625
6175
  export const $ProcessNlpDto = {
5626
6176
  type: 'object',
5627
6177
  properties: {
5628
6178
  message: {
5629
6179
  type: 'string',
5630
- description: 'Natural language text describing a transaction (Chinese)',
5631
- 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',
5632
6183
  maxLength: 500
5633
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
+ },
5634
6191
  sessionId: {
5635
6192
  type: 'string',
5636
6193
  description:
@@ -5638,17 +6195,32 @@ export const $ProcessNlpDto = {
5638
6195
  example: 'session_abc123'
5639
6196
  },
5640
6197
  parsedData: {
5641
- type: 'object',
5642
6198
  description:
5643
6199
  'Parsed data from previous NLP response for session recovery. Send back the parsedData received in confirm_payee/confirm responses.',
5644
6200
  example: {
5645
6201
  amount: 35,
5646
6202
  currency: 'CNY',
5647
6203
  payee: 'Starbucks'
5648
- }
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'
5649
6222
  }
5650
- },
5651
- required: ['message']
6223
+ }
5652
6224
  } as const;
5653
6225
 
5654
6226
  export const $NlpTransactionInfoDto = {
@@ -5970,7 +6542,8 @@ export const $NlpAccountConfirmationDataDto = {
5970
6542
  },
5971
6543
  suggestedAccount: {
5972
6544
  type: 'string',
5973
- description: 'Suggested replacement account',
6545
+ description:
6546
+ 'Suggested replacement account (omitted when no clear candidate)',
5974
6547
  example: 'Expenses:Food:Drinks'
5975
6548
  },
5976
6549
  similarAccounts: {
@@ -5992,7 +6565,6 @@ export const $NlpAccountConfirmationDataDto = {
5992
6565
  },
5993
6566
  required: [
5994
6567
  'invalidAccount',
5995
- 'suggestedAccount',
5996
6568
  'similarAccounts',
5997
6569
  'errorMessage',
5998
6570
  'transactionContext'
@@ -6165,7 +6737,8 @@ export const $NlpSuggestedAccountDto = {
6165
6737
  },
6166
6738
  confidence: {
6167
6739
  type: 'number',
6168
- 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)',
6169
6742
  example: 0.9
6170
6743
  }
6171
6744
  },
@@ -6201,23 +6774,31 @@ export const $NlpDefaultAccountsDto = {
6201
6774
  properties: {
6202
6775
  asset: {
6203
6776
  type: 'string',
6204
- description: 'Default asset account',
6205
- 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
6206
6781
  },
6207
6782
  expense: {
6208
6783
  type: 'string',
6209
- description: 'Default expense account',
6210
- 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
6211
6788
  },
6212
6789
  income: {
6213
6790
  type: 'string',
6214
- description: 'Default income account',
6215
- 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
6216
6795
  },
6217
6796
  liability: {
6218
6797
  type: 'string',
6219
- description: 'Default liability account',
6220
- 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
6221
6802
  }
6222
6803
  },
6223
6804
  required: ['asset', 'expense', 'income', 'liability']
@@ -6242,7 +6823,8 @@ export const $NlpResponseDto = {
6242
6823
  'confirm_rule',
6243
6824
  'confirm_account',
6244
6825
  'confirm_payee',
6245
- 'cancel'
6826
+ 'cancel',
6827
+ 'aborted'
6246
6828
  ]
6247
6829
  },
6248
6830
  intent: {
@@ -6404,7 +6986,7 @@ export const $NlpResponseDto = {
6404
6986
  },
6405
6987
  suggestedAccounts: {
6406
6988
  description:
6407
- 'Suggested accounts for this transaction. Contains recommended source and destination accounts based on the detected intent and rules.',
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.',
6408
6990
  allOf: [
6409
6991
  {
6410
6992
  $ref: '#/components/schemas/NlpSuggestedAccountsDto'
@@ -6413,7 +6995,7 @@ export const $NlpResponseDto = {
6413
6995
  },
6414
6996
  defaultAccounts: {
6415
6997
  description:
6416
- 'Default accounts for the user/region. These are fallback accounts used when no specific suggestion is available.',
6998
+ 'Default fallback accounts for the user/region (#586). v1 returns universal constants; per-user personalization is planned.',
6417
6999
  allOf: [
6418
7000
  {
6419
7001
  $ref: '#/components/schemas/NlpDefaultAccountsDto'
@@ -6459,13 +7041,26 @@ export const $PlatformListItemDto = {
6459
7041
  suggestedSegment: {
6460
7042
  type: 'string',
6461
7043
  description:
6462
- 'Suggested path segment — canonical with first char uppercased (ACC_COMP_NAME_RE)'
7044
+ 'Suggested path segment — canonical PascalCased per hyphen-part, hyphens preserved (e.g. "Apple-Pay")'
6463
7045
  },
6464
7046
  logoUrl: {
6465
7047
  type: 'string',
6466
7048
  description: 'Logo URL',
6467
7049
  nullable: true
6468
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
+ },
6469
7064
  isBound: {
6470
7065
  type: 'boolean',
6471
7066
  description: 'Whether user has accounts using this platform'
@@ -6479,6 +7074,8 @@ export const $PlatformListItemDto = {
6479
7074
  'canonical',
6480
7075
  'suggestedSegment',
6481
7076
  'logoUrl',
7077
+ 'countryCode',
7078
+ 'category',
6482
7079
  'isBound'
6483
7080
  ]
6484
7081
  } as const;
@@ -6514,13 +7111,26 @@ export const $PlatformMatchResultDto = {
6514
7111
  suggestedSegment: {
6515
7112
  type: 'string',
6516
7113
  description:
6517
- 'Suggested path segment — canonical, already in ACCOUNT_RE format'
7114
+ 'Suggested path segment — canonical PascalCased per hyphen-part, hyphens preserved (e.g. "Apple-Pay")'
6518
7115
  },
6519
7116
  logoUrl: {
6520
7117
  type: 'string',
6521
7118
  description: 'Logo URL',
6522
7119
  nullable: true
6523
7120
  },
7121
+ countryCode: {
7122
+ type: 'string',
7123
+ description: 'ISO 3166-1 alpha-2 (UPPERCASE); null = global platform',
7124
+ example: 'CN',
7125
+ nullable: true
7126
+ },
7127
+ category: {
7128
+ type: 'string',
7129
+ description:
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'
7133
+ },
6524
7134
  matchType: {
6525
7135
  type: 'string',
6526
7136
  description: "How this row matched: 'exact' > 'prefix' > 'substring'",
@@ -6534,6 +7144,8 @@ export const $PlatformMatchResultDto = {
6534
7144
  'type',
6535
7145
  'suggestedSegment',
6536
7146
  'logoUrl',
7147
+ 'countryCode',
7148
+ 'category',
6537
7149
  'matchType'
6538
7150
  ]
6539
7151
  } as const;
@@ -7669,374 +8281,95 @@ export const $HoldingPnlRowDto = {
7669
8281
  type: 'object',
7670
8282
  description:
7671
8283
  'Share of invested assets % (Decimal string); only for invested chartTokens',
7672
- nullable: true,
7673
- example: '40'
7674
- },
7675
- realizedPnl: {
7676
- description:
7677
- 'Cumulative realized P&L on sold lots (asOf-date cutoff); null when the method has no applicable sells, a sell lacks a price, or any required FX rate is missing (never-mix). When a sell spans multiple currencies (cross-currency sale), amount and currency reflect the base currency; baseCcyEquivalent is always the authoritative dual-FX figure',
7678
- nullable: true,
7679
- allOf: [
7680
- {
7681
- $ref: '#/components/schemas/MonetaryDto'
7682
- }
7683
- ]
7684
- }
7685
- },
7686
- required: [
7687
- 'accountId',
7688
- 'accountPath',
7689
- 'symbol',
7690
- 'chartToken',
7691
- 'assetClass',
7692
- 'units'
7693
- ]
7694
- } as const;
7695
-
7696
- export const $HoldingPnlWarningDto = {
7697
- type: 'object',
7698
- properties: {
7699
- type: {
7700
- type: 'string',
7701
- description: 'Warning type',
7702
- example: 'MISSING_COST_FX_RATE',
7703
- enum: [
7704
- 'MISSING_COST_FX_RATE',
7705
- 'MISSING_MARKET_FX_RATE',
7706
- 'MISSING_SALE_PRICE',
7707
- 'MISSING_REALIZED_FX_RATE',
7708
- 'OVERSOLD_LOTS',
7709
- 'NO_PRICE',
7710
- 'MIXED_COST_CURRENCY'
7711
- ]
7712
- },
7713
- symbol: {
7714
- type: 'object',
7715
- nullable: true
7716
- },
7717
- accountId: {
7718
- type: 'object',
7719
- nullable: true
7720
- },
7721
- currency: {
7722
- type: 'object',
7723
- nullable: true
7724
- }
7725
- },
7726
- required: ['type']
7727
- } as const;
7728
-
7729
- export const $HoldingPnlResponseDto = {
7730
- type: 'object',
7731
- properties: {
7732
- asOfDate: {
7733
- type: 'string',
7734
- example: '2026-07-08'
7735
- },
7736
- baseCurrency: {
7737
- type: 'string',
7738
- example: 'CNY'
7739
- },
7740
- method: {
7741
- type: 'string',
7742
- description:
7743
- 'Realized-P&L lot-matching method (FIFO or average). Unrealized cost basis remains average regardless of this value (#473).',
7744
- enum: ['average', 'FIFO'],
7745
- example: 'average'
7746
- },
7747
- rows: {
7748
- type: 'array',
7749
- items: {
7750
- $ref: '#/components/schemas/HoldingPnlRowDto'
7751
- }
7752
- },
7753
- warnings: {
7754
- type: 'array',
7755
- items: {
7756
- $ref: '#/components/schemas/HoldingPnlWarningDto'
7757
- }
7758
- }
7759
- },
7760
- required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
7761
- } as const;
7762
-
7763
- export const $CurrencyBalanceDto = {
7764
- type: 'object',
7765
- properties: {
7766
- currency: {
7767
- type: 'string',
7768
- description: 'ISO 4217 currency code',
7769
- example: 'CNY'
7770
- },
7771
- balance: {
7772
- type: 'string',
7773
- description: 'Balance amount',
7774
- example: '500000.00'
7775
- }
7776
- },
7777
- required: ['currency', 'balance']
7778
- } as const;
7779
-
7780
- export const $TimeSeriesPointDto = {
7781
- type: 'object',
7782
- properties: {
7783
- date: {
7784
- type: 'string',
7785
- description: 'Date in YYYY-MM-DD format',
7786
- example: '2024-06-15'
7787
- },
7788
- value: {
7789
- type: 'string',
7790
- description: 'Value at this date (in base currency)',
7791
- example: '500000.00'
7792
- },
7793
- change: {
7794
- type: 'object',
7795
- description: 'Change from previous point',
7796
- example: '5000.00'
7797
- },
7798
- assets: {
7799
- type: 'string',
7800
- description: 'Total assets at this date (in base currency)',
7801
- example: '494338.00'
7802
- },
7803
- liabilities: {
7804
- type: 'string',
7805
- description: 'Total liabilities at this date (in base currency)',
7806
- example: '310098.00'
7807
- },
7808
- byCurrency: {
7809
- description: 'Multi-currency breakdown for this point',
7810
- type: 'array',
7811
- items: {
7812
- $ref: '#/components/schemas/CurrencyBalanceDto'
7813
- }
7814
- }
7815
- },
7816
- required: ['date', 'value']
7817
- } as const;
7818
-
7819
- export const $TrendSummaryDto = {
7820
- type: 'object',
7821
- properties: {
7822
- startValue: {
7823
- type: 'string',
7824
- description: 'Value at start of period',
7825
- example: '450000.00'
7826
- },
7827
- endValue: {
7828
- type: 'string',
7829
- description: 'Value at end of period',
7830
- example: '500000.00'
7831
- },
7832
- totalChange: {
7833
- type: 'string',
7834
- description: 'Total change over period',
7835
- example: '50000.00'
7836
- },
7837
- totalChangePercentage: {
7838
- type: 'string',
7839
- description: 'Total change percentage',
7840
- example: '+11.11%'
7841
- }
7842
- },
7843
- required: ['startValue', 'endValue', 'totalChange', 'totalChangePercentage']
7844
- } as const;
7845
-
7846
- export const $MultiCurrencyPointDto = {
7847
- type: 'object',
7848
- properties: {
7849
- date: {
7850
- type: 'string',
7851
- description: 'Date in YYYY-MM-DD format',
7852
- example: '2024-06-15'
7853
- },
7854
- byCurrency: {
7855
- description: 'Balances by currency',
7856
- type: 'array',
7857
- items: {
7858
- $ref: '#/components/schemas/CurrencyBalanceDto'
7859
- }
7860
- }
7861
- },
7862
- required: ['date', 'byCurrency']
7863
- } as const;
7864
-
7865
- export const $PortfolioTrendsResponseDto = {
7866
- type: 'object',
7867
- properties: {
7868
- series: {
7869
- description: 'Time series data points',
7870
- type: 'array',
7871
- items: {
7872
- $ref: '#/components/schemas/TimeSeriesPointDto'
7873
- }
7874
- },
7875
- summary: {
7876
- description: 'Period summary',
7877
- allOf: [
7878
- {
7879
- $ref: '#/components/schemas/TrendSummaryDto'
7880
- }
7881
- ]
7882
- },
7883
- period: {
7884
- type: 'string',
7885
- description: 'Period requested',
7886
- example: '6m'
7887
- },
7888
- granularity: {
7889
- type: 'string',
7890
- description: 'Data granularity',
7891
- example: 'month'
7892
- },
7893
- currency: {
7894
- type: 'string',
7895
- description: 'Base currency for converted values',
7896
- example: 'CNY'
7897
- },
7898
- byCurrency: {
7899
- description:
7900
- 'Multi-currency time series (each point has currency breakdown)',
7901
- type: 'array',
7902
- items: {
7903
- $ref: '#/components/schemas/MultiCurrencyPointDto'
7904
- }
8284
+ nullable: true,
8285
+ example: '40'
7905
8286
  },
7906
- warnings: {
7907
- description: 'Exchange rate warnings',
7908
- type: 'array',
7909
- items: {
7910
- $ref: '#/components/schemas/ExchangeRateWarningDto'
7911
- }
8287
+ realizedPnl: {
8288
+ description:
8289
+ 'Cumulative realized P&L on sold lots (asOf-date cutoff); null when the method has no applicable sells, a sell lacks a price, or any required FX rate is missing (never-mix). When a sell spans multiple currencies (cross-currency sale), amount and currency reflect the base currency; baseCcyEquivalent is always the authoritative dual-FX figure',
8290
+ nullable: true,
8291
+ allOf: [
8292
+ {
8293
+ $ref: '#/components/schemas/MonetaryDto'
8294
+ }
8295
+ ]
7912
8296
  }
7913
8297
  },
7914
- required: ['series', 'summary', 'period', 'granularity', 'currency']
8298
+ required: [
8299
+ 'accountId',
8300
+ 'accountPath',
8301
+ 'symbol',
8302
+ 'chartToken',
8303
+ 'assetClass',
8304
+ 'units'
8305
+ ]
7915
8306
  } as const;
7916
8307
 
7917
- export const $CashFlowPointDto = {
8308
+ export const $HoldingPnlWarningDto = {
7918
8309
  type: 'object',
7919
8310
  properties: {
7920
- month: {
8311
+ type: {
7921
8312
  type: 'string',
7922
- description: 'Month key (YYYY-MM)',
7923
- example: '2024-03'
8313
+ description: 'Warning type',
8314
+ example: 'MISSING_COST_FX_RATE',
8315
+ enum: [
8316
+ 'MISSING_COST_FX_RATE',
8317
+ 'MISSING_MARKET_FX_RATE',
8318
+ 'MISSING_SALE_PRICE',
8319
+ 'MISSING_REALIZED_FX_RATE',
8320
+ 'OVERSOLD_LOTS',
8321
+ 'NO_PRICE',
8322
+ 'MIXED_COST_CURRENCY'
8323
+ ]
7924
8324
  },
7925
- income: {
7926
- type: 'string',
7927
- description: 'Income in base currency (absolute, converted)',
7928
- example: '10000.00'
8325
+ symbol: {
8326
+ type: 'object',
8327
+ nullable: true
7929
8328
  },
7930
- expense: {
7931
- type: 'string',
7932
- description: 'Expense in base currency (absolute, converted)',
7933
- example: '5000.00'
8329
+ accountId: {
8330
+ type: 'object',
8331
+ nullable: true
7934
8332
  },
7935
- netSavings: {
7936
- type: 'string',
7937
- description: 'netSavings = income − expense (savings positive)',
7938
- example: '5000.00'
8333
+ currency: {
8334
+ type: 'object',
8335
+ nullable: true
7939
8336
  }
7940
8337
  },
7941
- required: ['month', 'income', 'expense', 'netSavings']
8338
+ required: ['type']
7942
8339
  } as const;
7943
8340
 
7944
- export const $CashFlowTrendSummaryDto = {
8341
+ export const $HoldingPnlResponseDto = {
7945
8342
  type: 'object',
7946
8343
  properties: {
7947
- totalIncome: {
7948
- type: 'string',
7949
- description: 'Total income across the period',
7950
- example: '60000.00'
7951
- },
7952
- totalExpense: {
8344
+ asOfDate: {
7953
8345
  type: 'string',
7954
- description: 'Total expense across the period',
7955
- example: '30000.00'
8346
+ example: '2026-07-08'
7956
8347
  },
7957
- totalNetSavings: {
8348
+ baseCurrency: {
7958
8349
  type: 'string',
7959
- description: 'income − expense across the period',
7960
- example: '30000.00'
8350
+ example: 'CNY'
7961
8351
  },
7962
- averageMonthlyNetSavings: {
8352
+ method: {
7963
8353
  type: 'string',
7964
8354
  description:
7965
- 'totalNetSavings divided by the window length (N months, incl. zero-filled)',
7966
- example: '5000.00'
7967
- }
7968
- },
7969
- required: [
7970
- 'totalIncome',
7971
- 'totalExpense',
7972
- 'totalNetSavings',
7973
- 'averageMonthlyNetSavings'
7974
- ]
7975
- } as const;
7976
-
7977
- export const $CashFlowTrendsResponseDto = {
7978
- type: 'object',
7979
- properties: {
7980
- series: {
7981
- description:
7982
- 'Monthly cash-flow series (fixed N-month window, zero-filled)',
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: {
7983
8360
  type: 'array',
7984
8361
  items: {
7985
- $ref: '#/components/schemas/CashFlowPointDto'
8362
+ $ref: '#/components/schemas/HoldingPnlRowDto'
7986
8363
  }
7987
8364
  },
7988
- summary: {
7989
- description: 'Period totals',
7990
- allOf: [
7991
- {
7992
- $ref: '#/components/schemas/CashFlowTrendSummaryDto'
7993
- }
7994
- ]
7995
- },
7996
- period: {
7997
- type: 'string',
7998
- description: 'Period requested',
7999
- example: '6m'
8000
- },
8001
- granularity: {
8002
- type: 'string',
8003
- description: 'Data granularity (v1 returns month buckets)',
8004
- example: 'month'
8005
- },
8006
- currency: {
8007
- type: 'string',
8008
- description: 'Base currency for converted values',
8009
- example: 'CNY'
8010
- },
8011
8365
  warnings: {
8012
- description: 'Exchange rate warnings (e.g. missing rate for a currency)',
8013
8366
  type: 'array',
8014
8367
  items: {
8015
- $ref: '#/components/schemas/ExchangeRateWarningDto'
8368
+ $ref: '#/components/schemas/HoldingPnlWarningDto'
8016
8369
  }
8017
8370
  }
8018
8371
  },
8019
- required: ['series', 'summary', 'period', 'granularity', 'currency']
8020
- } as const;
8021
-
8022
- export const $GenerateSnapshotBody = {
8023
- type: 'object',
8024
- properties: {}
8025
- } as const;
8026
-
8027
- export const $GenerateSnapshotResponse = {
8028
- type: 'object',
8029
- properties: {}
8030
- } as const;
8031
-
8032
- export const $BackfillSnapshotsBody = {
8033
- type: 'object',
8034
- properties: {}
8035
- } as const;
8036
-
8037
- export const $BackfillSnapshotsResponse = {
8038
- type: 'object',
8039
- properties: {}
8372
+ required: ['asOfDate', 'baseCurrency', 'method', 'rows', 'warnings']
8040
8373
  } as const;
8041
8374
 
8042
8375
  export const $AnonymousLoginDto = {
@@ -8061,3 +8394,146 @@ export const $AnonymousLoginResponseDto = {
8061
8394
  },
8062
8395
  required: ['authToken']
8063
8396
  } as const;
8397
+
8398
+ export const $SymbolSearchResultDto = {
8399
+ type: 'object',
8400
+ properties: {
8401
+ symbol: {
8402
+ type: 'string',
8403
+ example: 'AAPL'
8404
+ },
8405
+ name: {
8406
+ type: 'object',
8407
+ example: 'Apple Inc.',
8408
+ nullable: true
8409
+ },
8410
+ exchange: {
8411
+ type: 'object',
8412
+ example: 'US',
8413
+ nullable: true
8414
+ },
8415
+ assetType: {
8416
+ type: 'object',
8417
+ description: 'OpenBB asset_type (e.g. stock, etf)',
8418
+ example: 'stock',
8419
+ nullable: true
8420
+ },
8421
+ assetClass: {
8422
+ type: 'object',
8423
+ description: 'IGN asset class (region.types.ts ASSET_CLASSES)',
8424
+ example: 'EQUITY',
8425
+ nullable: true
8426
+ },
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
8438
+ }
8439
+ },
8440
+ required: ['symbol']
8441
+ } as const;
8442
+
8443
+ export const $SymbolQuoteDto = {
8444
+ type: 'object',
8445
+ properties: {
8446
+ symbol: {
8447
+ type: 'string',
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
8537
+ }
8538
+ }
8539
+ } as const;