@firela/api-types 0.0.0-canary.792fa5f1 → 0.0.0-canary.7a8f5374

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.
@@ -442,6 +442,25 @@ export type CreateTransactionDto = {
442
442
  */
443
443
  export type flag = '*' | '!';
444
444
 
445
+ export type CostDetailDto = {
446
+ /**
447
+ * Per-unit cost basis (mirrors engine Cost.number)
448
+ */
449
+ number?: string;
450
+ /**
451
+ * Cost currency
452
+ */
453
+ currency?: string;
454
+ /**
455
+ * Lot acquisition date (ISO yyyy-mm-dd)
456
+ */
457
+ date?: string;
458
+ /**
459
+ * Lot label
460
+ */
461
+ label?: string;
462
+ };
463
+
445
464
  export type PostingResponseDto = {
446
465
  /**
447
466
  * Account name
@@ -455,6 +474,10 @@ export type PostingResponseDto = {
455
474
  * Currency
456
475
  */
457
476
  currency?: string;
477
+ /**
478
+ * Booking-resolved cost (mirrors engine Cost). Undefined when the posting has no cost basis.
479
+ */
480
+ cost?: CostDetailDto;
458
481
  };
459
482
 
460
483
  export type RecurringSuggestionDto = {
@@ -698,6 +721,10 @@ export type PostingDetailDto = {
698
721
  * Cost date
699
722
  */
700
723
  costDate?: string;
724
+ /**
725
+ * Booking-resolved cost (mirrors engine Cost). Undefined when the posting has no cost basis.
726
+ */
727
+ cost?: CostDetailDto;
701
728
  /**
702
729
  * Price amount
703
730
  */
@@ -1297,17 +1324,17 @@ export type ResolveResultDto = {
1297
1324
  [key: string]: string;
1298
1325
  };
1299
1326
  /**
1300
- * Resolution ID for undo
1327
+ * Resolution ID for undo. Absent when the resolver rejected the decision (review stayed PENDING).
1301
1328
  */
1302
- resolutionId: string;
1329
+ resolutionId?: string;
1303
1330
  /**
1304
1331
  * Whether this decision can be undone
1305
1332
  */
1306
- canUndo: boolean;
1333
+ canUndo?: boolean;
1307
1334
  /**
1308
1335
  * Deadline for undo (24h from resolution)
1309
1336
  */
1310
- undoDeadline: string;
1337
+ undoDeadline?: string;
1311
1338
  /**
1312
1339
  * Rule ID if learning was triggered (ACCEPT_AND_LEARN actions). Use this to deep-link to the rule management page.
1313
1340
  */
@@ -3002,6 +3029,96 @@ export type UpdatePropertyDto = {
3002
3029
  value: string;
3003
3030
  };
3004
3031
 
3032
+ export type CreateBeanEventDto = {
3033
+ /**
3034
+ * Life event date (ISO 8601)
3035
+ */
3036
+ date: string;
3037
+ /**
3038
+ * Life event type (e.g., "employer", "location", "marital-status") — user-defined, no enum constraint at engine layer
3039
+ */
3040
+ type: string;
3041
+ /**
3042
+ * Life event description. Empty string is a VALID value (distinct from absence).
3043
+ */
3044
+ description: string;
3045
+ /**
3046
+ * Product-side metadata (lives in BeanEvent.meta JSON, never in engine Event fields)
3047
+ */
3048
+ meta?: {
3049
+ [key: string]: unknown;
3050
+ };
3051
+ };
3052
+
3053
+ export type EventResponseDto = {
3054
+ /**
3055
+ * Unique identifier
3056
+ */
3057
+ id: string;
3058
+ /**
3059
+ * User ID (owner of the life event)
3060
+ */
3061
+ userId: string;
3062
+ /**
3063
+ * Life event date (ISO 8601 format)
3064
+ */
3065
+ date: string;
3066
+ /**
3067
+ * Life event type (user-defined, e.g., "employer", "location")
3068
+ */
3069
+ type: string;
3070
+ /**
3071
+ * Life event description. May be an empty string (a valid value distinct from absence).
3072
+ */
3073
+ description: string;
3074
+ /**
3075
+ * Product-side metadata (free-form JSON)
3076
+ */
3077
+ meta: {
3078
+ [key: string]: unknown;
3079
+ };
3080
+ /**
3081
+ * Creation timestamp
3082
+ */
3083
+ createdAt: string;
3084
+ /**
3085
+ * Last update timestamp. Also emitted as the ETag response header for If-Match optimistic concurrency.
3086
+ */
3087
+ updatedAt: string;
3088
+ };
3089
+
3090
+ export type EventListResponseDto = {
3091
+ /**
3092
+ * List of life events
3093
+ */
3094
+ items: Array<EventResponseDto>;
3095
+ /**
3096
+ * Total number of life events matching the query
3097
+ */
3098
+ total: number;
3099
+ };
3100
+
3101
+ export type UpdateBeanEventDto = {
3102
+ /**
3103
+ * Life event date (ISO 8601)
3104
+ */
3105
+ date?: string;
3106
+ /**
3107
+ * Life event type (user-defined)
3108
+ */
3109
+ type?: string;
3110
+ /**
3111
+ * Life event description. Empty string is a VALID value (distinct from absence).
3112
+ */
3113
+ description?: string;
3114
+ /**
3115
+ * Product-side metadata (free-form JSON)
3116
+ */
3117
+ meta?: {
3118
+ [key: string]: unknown;
3119
+ };
3120
+ };
3121
+
3005
3122
  export type FileImportDto = {
3006
3123
  /**
3007
3124
  * Bill file to import (CSV, PDF, OFX, etc.)
@@ -4502,6 +4619,63 @@ export type CashFlowResponseDto = {
4502
4619
  warnings?: Array<ExchangeRateWarningDto>;
4503
4620
  };
4504
4621
 
4622
+ export type CategoryGroupDto = {
4623
+ /**
4624
+ * Functional category (account-path Group segment); regional and universal account paths merge under it
4625
+ */
4626
+ category: string;
4627
+ /**
4628
+ * Converted total for this category in base currency (expense amount when flow=expense, income amount when flow=income)
4629
+ */
4630
+ totalExpense: string;
4631
+ /**
4632
+ * Share of grand total (0-100); 0 when grand total is 0
4633
+ */
4634
+ sharePct: number;
4635
+ /**
4636
+ * Raw (unconverted) expense per currency
4637
+ */
4638
+ balanceByCurrency: Array<BalanceByCurrencyDto>;
4639
+ /**
4640
+ * Converted total in base currency (omitted when FX missing for all currencies in this category)
4641
+ */
4642
+ convertedBalance?: string;
4643
+ };
4644
+
4645
+ export type ExpensesByCategorySummaryDto = {
4646
+ /**
4647
+ * Total across all categories, converted (convertible categories only); expense totals when flow=expense, income totals when flow=income
4648
+ */
4649
+ totalExpense: string;
4650
+ /**
4651
+ * Number of categories
4652
+ */
4653
+ categoryCount: number;
4654
+ };
4655
+
4656
+ export type ExpensesByCategoryResponseDto = {
4657
+ /**
4658
+ * Period requested
4659
+ */
4660
+ period: string;
4661
+ /**
4662
+ * Base currency for converted values
4663
+ */
4664
+ baseCurrency: string;
4665
+ /**
4666
+ * Expense groups by functional category, sorted by converted total desc
4667
+ */
4668
+ groups: Array<CategoryGroupDto>;
4669
+ /**
4670
+ * Summary statistics
4671
+ */
4672
+ summary: ExpensesByCategorySummaryDto;
4673
+ /**
4674
+ * Exchange rate warnings (e.g. missing rate for a currency)
4675
+ */
4676
+ warnings?: Array<ExchangeRateWarningDto>;
4677
+ };
4678
+
4505
4679
  export type MonetaryDto = {
4506
4680
  /**
4507
4681
  * Amount (Decimal string)
@@ -4825,6 +4999,14 @@ export type TimeSeriesPointDto = {
4825
4999
  change?: {
4826
5000
  [key: string]: unknown;
4827
5001
  };
5002
+ /**
5003
+ * Total assets at this date (in base currency)
5004
+ */
5005
+ assets?: string;
5006
+ /**
5007
+ * Total liabilities at this date (in base currency)
5008
+ */
5009
+ liabilities?: string;
4828
5010
  /**
4829
5011
  * Multi-currency breakdown for this point
4830
5012
  */
@@ -4892,6 +5074,71 @@ export type PortfolioTrendsResponseDto = {
4892
5074
  warnings?: Array<ExchangeRateWarningDto>;
4893
5075
  };
4894
5076
 
5077
+ export type CashFlowPointDto = {
5078
+ /**
5079
+ * Month key (YYYY-MM)
5080
+ */
5081
+ month: string;
5082
+ /**
5083
+ * Income in base currency (absolute, converted)
5084
+ */
5085
+ income: string;
5086
+ /**
5087
+ * Expense in base currency (absolute, converted)
5088
+ */
5089
+ expense: string;
5090
+ /**
5091
+ * netSavings = income − expense (savings positive)
5092
+ */
5093
+ netSavings: string;
5094
+ };
5095
+
5096
+ export type CashFlowTrendSummaryDto = {
5097
+ /**
5098
+ * Total income across the period
5099
+ */
5100
+ totalIncome: string;
5101
+ /**
5102
+ * Total expense across the period
5103
+ */
5104
+ totalExpense: string;
5105
+ /**
5106
+ * income − expense across the period
5107
+ */
5108
+ totalNetSavings: string;
5109
+ /**
5110
+ * totalNetSavings divided by the window length (N months, incl. zero-filled)
5111
+ */
5112
+ averageMonthlyNetSavings: string;
5113
+ };
5114
+
5115
+ export type CashFlowTrendsResponseDto = {
5116
+ /**
5117
+ * Monthly cash-flow series (fixed N-month window, zero-filled)
5118
+ */
5119
+ series: Array<CashFlowPointDto>;
5120
+ /**
5121
+ * Period totals
5122
+ */
5123
+ summary: CashFlowTrendSummaryDto;
5124
+ /**
5125
+ * Period requested
5126
+ */
5127
+ period: string;
5128
+ /**
5129
+ * Data granularity (v1 returns month buckets)
5130
+ */
5131
+ granularity: string;
5132
+ /**
5133
+ * Base currency for converted values
5134
+ */
5135
+ currency: string;
5136
+ /**
5137
+ * Exchange rate warnings (e.g. missing rate for a currency)
5138
+ */
5139
+ warnings?: Array<ExchangeRateWarningDto>;
5140
+ };
5141
+
4895
5142
  export type GenerateSnapshotBody = unknown;
4896
5143
 
4897
5144
  export type GenerateSnapshotResponse = unknown;
@@ -5078,6 +5325,10 @@ export type TransactionControllerListData = {
5078
5325
  * Filter by account ID (transactions with postings to this account)
5079
5326
  */
5080
5327
  accountId?: string;
5328
+ /**
5329
+ * Filter by ADR-0075 functional category (Group segment); matches any posting to an Expenses/Income account whose derived Group segment equals this value
5330
+ */
5331
+ category?: string;
5081
5332
  /**
5082
5333
  * Filter by start date (inclusive), format: YYYY-MM-DD
5083
5334
  */
@@ -6069,6 +6320,104 @@ export type PropertyControllerDeleteData = {
6069
6320
 
6070
6321
  export type PropertyControllerDeleteResponse = void;
6071
6322
 
6323
+ export type EventControllerCreateData = {
6324
+ /**
6325
+ * Region code for tenant context (decorative for life events)
6326
+ */
6327
+ region: 'cn' | 'us' | 'de' | 'gb';
6328
+ requestBody: CreateBeanEventDto;
6329
+ };
6330
+
6331
+ export type EventControllerCreateResponse = EventResponseDto;
6332
+
6333
+ export type EventControllerFindAllData = {
6334
+ /**
6335
+ * Filter life events from this date (ISO 8601 format)
6336
+ */
6337
+ from?: string;
6338
+ /**
6339
+ * Number of items per page (default: 20, max: 100)
6340
+ */
6341
+ limit?: number;
6342
+ /**
6343
+ * Page number for pagination (default: 1)
6344
+ */
6345
+ page?: number;
6346
+ /**
6347
+ * Search term for description (case-insensitive partial match)
6348
+ */
6349
+ q?: string;
6350
+ /**
6351
+ * Region code for tenant context (decorative for life events)
6352
+ */
6353
+ region: 'cn' | 'us' | 'de' | 'gb';
6354
+ /**
6355
+ * Filter life events to this date (ISO 8601 format)
6356
+ */
6357
+ to?: string;
6358
+ /**
6359
+ * Filter by life event type (exact match)
6360
+ */
6361
+ type?: string;
6362
+ };
6363
+
6364
+ export type EventControllerFindAllResponse = EventListResponseDto;
6365
+
6366
+ export type EventControllerFindOneData = {
6367
+ /**
6368
+ * Life event ID
6369
+ */
6370
+ id: string;
6371
+ /**
6372
+ * Region code for tenant context (decorative for life events)
6373
+ */
6374
+ region: 'cn' | 'us' | 'de' | 'gb';
6375
+ };
6376
+
6377
+ export type EventControllerFindOneResponse = EventResponseDto;
6378
+
6379
+ export type EventControllerUpdateData = {
6380
+ /**
6381
+ * Life event ID
6382
+ */
6383
+ id: string;
6384
+ /**
6385
+ * Region code for tenant context (decorative for life events)
6386
+ */
6387
+ region: 'cn' | 'us' | 'de' | 'gb';
6388
+ requestBody: UpdateBeanEventDto;
6389
+ };
6390
+
6391
+ export type EventControllerUpdateResponse = EventResponseDto;
6392
+
6393
+ export type EventControllerDeleteData = {
6394
+ /**
6395
+ * Life event ID
6396
+ */
6397
+ id: string;
6398
+ /**
6399
+ * Region code for tenant context (decorative for life events)
6400
+ */
6401
+ region: 'cn' | 'us' | 'de' | 'gb';
6402
+ };
6403
+
6404
+ export type EventControllerDeleteResponse = void;
6405
+
6406
+ export type EventControllerGetSliceData = {
6407
+ accountPattern: string;
6408
+ granularity: string;
6409
+ /**
6410
+ * Life event ID
6411
+ */
6412
+ id: string;
6413
+ /**
6414
+ * Region code for tenant context (decorative for life events)
6415
+ */
6416
+ region: 'cn' | 'us' | 'de' | 'gb';
6417
+ };
6418
+
6419
+ export type EventControllerGetSliceResponse = unknown;
6420
+
6072
6421
  export type ExportControllerExportBeancountResponse = unknown;
6073
6422
 
6074
6423
  export type FileImportControllerImportFileData = {
@@ -6374,6 +6723,28 @@ export type DashboardControllerGetCashFlowData = {
6374
6723
 
6375
6724
  export type DashboardControllerGetCashFlowResponse = CashFlowResponseDto;
6376
6725
 
6726
+ export type DashboardControllerGetExpensesData = {
6727
+ /**
6728
+ * Account root to aggregate (expense → ^Expenses:, income → ^Income:)
6729
+ */
6730
+ flow?: 'expense' | 'income';
6731
+ /**
6732
+ * Grouping strategy
6733
+ */
6734
+ groupBy?: 'category';
6735
+ /**
6736
+ * Time window (1m = current calendar month)
6737
+ */
6738
+ period?: '1m' | '3m' | '6m' | '1y';
6739
+ /**
6740
+ * Region code for tenant context
6741
+ */
6742
+ region: 'cn' | 'us' | 'de' | 'gb';
6743
+ };
6744
+
6745
+ export type DashboardControllerGetExpensesResponse =
6746
+ ExpensesByCategoryResponseDto;
6747
+
6377
6748
  export type HoldingPnlControllerGetHoldingPnlData = {
6378
6749
  /**
6379
6750
  * Scope to a single account
@@ -6510,6 +6881,24 @@ export type ReportingControllerGetPortfolioTrendsData = {
6510
6881
  export type ReportingControllerGetPortfolioTrendsResponse =
6511
6882
  PortfolioTrendsResponseDto;
6512
6883
 
6884
+ export type ReportingControllerGetCashFlowTrendsData = {
6885
+ /**
6886
+ * Data granularity (accepted for API symmetry; v1 returns month buckets)
6887
+ */
6888
+ granularity?: 'day' | 'week' | 'month';
6889
+ /**
6890
+ * Time period
6891
+ */
6892
+ period?: '1m' | '3m' | '6m' | '1y';
6893
+ /**
6894
+ * Region code for tenant context
6895
+ */
6896
+ region: 'cn' | 'us' | 'de' | 'gb';
6897
+ };
6898
+
6899
+ export type ReportingControllerGetCashFlowTrendsResponse =
6900
+ CashFlowTrendsResponseDto;
6901
+
6513
6902
  export type ReportingControllerGenerateSnapshotData = {
6514
6903
  /**
6515
6904
  * Region code for tenant context
@@ -7941,6 +8330,102 @@ export type $OpenApiTs = {
7941
8330
  };
7942
8331
  };
7943
8332
  };
8333
+ '/api/v1/{region}/bean/events': {
8334
+ post: {
8335
+ req: EventControllerCreateData;
8336
+ res: {
8337
+ /**
8338
+ * Life event created successfully
8339
+ */
8340
+ 201: EventResponseDto;
8341
+ /**
8342
+ * Life event already exists for this (userId, type, date) combination
8343
+ */
8344
+ 409: unknown;
8345
+ };
8346
+ };
8347
+ get: {
8348
+ req: EventControllerFindAllData;
8349
+ res: {
8350
+ /**
8351
+ * Life events retrieved successfully
8352
+ */
8353
+ 200: EventListResponseDto;
8354
+ };
8355
+ };
8356
+ };
8357
+ '/api/v1/{region}/bean/events/{id}': {
8358
+ get: {
8359
+ req: EventControllerFindOneData;
8360
+ res: {
8361
+ /**
8362
+ * Life event retrieved successfully
8363
+ */
8364
+ 200: EventResponseDto;
8365
+ /**
8366
+ * Life event not found
8367
+ */
8368
+ 404: unknown;
8369
+ };
8370
+ };
8371
+ put: {
8372
+ req: EventControllerUpdateData;
8373
+ res: {
8374
+ /**
8375
+ * Life event updated successfully
8376
+ */
8377
+ 200: EventResponseDto;
8378
+ /**
8379
+ * If-Match header is not a valid ISO 8601 date
8380
+ */
8381
+ 400: unknown;
8382
+ /**
8383
+ * Life event not found
8384
+ */
8385
+ 404: unknown;
8386
+ /**
8387
+ * Updated event conflicts with an existing (userId, type, date) combination
8388
+ */
8389
+ 409: unknown;
8390
+ /**
8391
+ * If-Match precondition failed (updatedAt mismatch)
8392
+ */
8393
+ 412: unknown;
8394
+ };
8395
+ };
8396
+ delete: {
8397
+ req: EventControllerDeleteData;
8398
+ res: {
8399
+ /**
8400
+ * Life event deleted successfully
8401
+ */
8402
+ 204: void;
8403
+ /**
8404
+ * Life event not found
8405
+ */
8406
+ 404: unknown;
8407
+ };
8408
+ };
8409
+ };
8410
+ '/api/v1/{region}/bean/events/{id}/slice': {
8411
+ get: {
8412
+ req: EventControllerGetSliceData;
8413
+ res: {
8414
+ /**
8415
+ * Time-series sliced by the life event range
8416
+ */
8417
+ 200: unknown;
8418
+ /**
8419
+ * accountPattern query param is empty
8420
+ */
8421
+ 400: unknown;
8422
+ /**
8423
+ * Life event not found
8424
+ */
8425
+ 404: unknown;
8426
+ };
8427
+ };
8428
+ };
7944
8429
  '/api/v1/{region}/bean/export/beancount': {
7945
8430
  get: {
7946
8431
  res: {
@@ -8356,6 +8841,25 @@ export type $OpenApiTs = {
8356
8841
  };
8357
8842
  };
8358
8843
  };
8844
+ '/api/v1/{region}/dashboard/expenses': {
8845
+ get: {
8846
+ req: DashboardControllerGetExpensesData;
8847
+ res: {
8848
+ /**
8849
+ * Expenses retrieved successfully
8850
+ */
8851
+ 200: ExpensesByCategoryResponseDto;
8852
+ /**
8853
+ * Invalid groupBy or period
8854
+ */
8855
+ 400: unknown;
8856
+ /**
8857
+ * User not authenticated
8858
+ */
8859
+ 401: unknown;
8860
+ };
8861
+ };
8862
+ };
8359
8863
  '/api/v1/{region}/investment/holdings/pnl': {
8360
8864
  get: {
8361
8865
  req: HoldingPnlControllerGetHoldingPnlData;
@@ -8474,6 +8978,21 @@ export type $OpenApiTs = {
8474
8978
  };
8475
8979
  };
8476
8980
  };
8981
+ '/api/v1/{region}/reporting/cash-flow/trends': {
8982
+ get: {
8983
+ req: ReportingControllerGetCashFlowTrendsData;
8984
+ res: {
8985
+ /**
8986
+ * Cash-flow trends retrieved successfully
8987
+ */
8988
+ 200: CashFlowTrendsResponseDto;
8989
+ /**
8990
+ * User not authenticated
8991
+ */
8992
+ 401: unknown;
8993
+ };
8994
+ };
8995
+ };
8477
8996
  '/api/v1/{region}/reporting/snapshots/generate': {
8478
8997
  post: {
8479
8998
  req: ReportingControllerGenerateSnapshotData;