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

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.)
@@ -4892,6 +5009,71 @@ export type PortfolioTrendsResponseDto = {
4892
5009
  warnings?: Array<ExchangeRateWarningDto>;
4893
5010
  };
4894
5011
 
5012
+ export type CashFlowPointDto = {
5013
+ /**
5014
+ * Month key (YYYY-MM)
5015
+ */
5016
+ month: string;
5017
+ /**
5018
+ * Income in base currency (absolute, converted)
5019
+ */
5020
+ income: string;
5021
+ /**
5022
+ * Expense in base currency (absolute, converted)
5023
+ */
5024
+ expense: string;
5025
+ /**
5026
+ * netSavings = income − expense (savings positive)
5027
+ */
5028
+ netSavings: string;
5029
+ };
5030
+
5031
+ export type CashFlowTrendSummaryDto = {
5032
+ /**
5033
+ * Total income across the period
5034
+ */
5035
+ totalIncome: string;
5036
+ /**
5037
+ * Total expense across the period
5038
+ */
5039
+ totalExpense: string;
5040
+ /**
5041
+ * income − expense across the period
5042
+ */
5043
+ totalNetSavings: string;
5044
+ /**
5045
+ * totalNetSavings divided by the window length (N months, incl. zero-filled)
5046
+ */
5047
+ averageMonthlyNetSavings: string;
5048
+ };
5049
+
5050
+ export type CashFlowTrendsResponseDto = {
5051
+ /**
5052
+ * Monthly cash-flow series (fixed N-month window, zero-filled)
5053
+ */
5054
+ series: Array<CashFlowPointDto>;
5055
+ /**
5056
+ * Period totals
5057
+ */
5058
+ summary: CashFlowTrendSummaryDto;
5059
+ /**
5060
+ * Period requested
5061
+ */
5062
+ period: string;
5063
+ /**
5064
+ * Data granularity (v1 returns month buckets)
5065
+ */
5066
+ granularity: string;
5067
+ /**
5068
+ * Base currency for converted values
5069
+ */
5070
+ currency: string;
5071
+ /**
5072
+ * Exchange rate warnings (e.g. missing rate for a currency)
5073
+ */
5074
+ warnings?: Array<ExchangeRateWarningDto>;
5075
+ };
5076
+
4895
5077
  export type GenerateSnapshotBody = unknown;
4896
5078
 
4897
5079
  export type GenerateSnapshotResponse = unknown;
@@ -6069,6 +6251,104 @@ export type PropertyControllerDeleteData = {
6069
6251
 
6070
6252
  export type PropertyControllerDeleteResponse = void;
6071
6253
 
6254
+ export type EventControllerCreateData = {
6255
+ /**
6256
+ * Region code for tenant context (decorative for life events)
6257
+ */
6258
+ region: 'cn' | 'us' | 'de' | 'gb';
6259
+ requestBody: CreateBeanEventDto;
6260
+ };
6261
+
6262
+ export type EventControllerCreateResponse = EventResponseDto;
6263
+
6264
+ export type EventControllerFindAllData = {
6265
+ /**
6266
+ * Filter life events from this date (ISO 8601 format)
6267
+ */
6268
+ from?: string;
6269
+ /**
6270
+ * Number of items per page (default: 20, max: 100)
6271
+ */
6272
+ limit?: number;
6273
+ /**
6274
+ * Page number for pagination (default: 1)
6275
+ */
6276
+ page?: number;
6277
+ /**
6278
+ * Search term for description (case-insensitive partial match)
6279
+ */
6280
+ q?: string;
6281
+ /**
6282
+ * Region code for tenant context (decorative for life events)
6283
+ */
6284
+ region: 'cn' | 'us' | 'de' | 'gb';
6285
+ /**
6286
+ * Filter life events to this date (ISO 8601 format)
6287
+ */
6288
+ to?: string;
6289
+ /**
6290
+ * Filter by life event type (exact match)
6291
+ */
6292
+ type?: string;
6293
+ };
6294
+
6295
+ export type EventControllerFindAllResponse = EventListResponseDto;
6296
+
6297
+ export type EventControllerFindOneData = {
6298
+ /**
6299
+ * Life event ID
6300
+ */
6301
+ id: string;
6302
+ /**
6303
+ * Region code for tenant context (decorative for life events)
6304
+ */
6305
+ region: 'cn' | 'us' | 'de' | 'gb';
6306
+ };
6307
+
6308
+ export type EventControllerFindOneResponse = EventResponseDto;
6309
+
6310
+ export type EventControllerUpdateData = {
6311
+ /**
6312
+ * Life event ID
6313
+ */
6314
+ id: string;
6315
+ /**
6316
+ * Region code for tenant context (decorative for life events)
6317
+ */
6318
+ region: 'cn' | 'us' | 'de' | 'gb';
6319
+ requestBody: UpdateBeanEventDto;
6320
+ };
6321
+
6322
+ export type EventControllerUpdateResponse = EventResponseDto;
6323
+
6324
+ export type EventControllerDeleteData = {
6325
+ /**
6326
+ * Life event ID
6327
+ */
6328
+ id: string;
6329
+ /**
6330
+ * Region code for tenant context (decorative for life events)
6331
+ */
6332
+ region: 'cn' | 'us' | 'de' | 'gb';
6333
+ };
6334
+
6335
+ export type EventControllerDeleteResponse = void;
6336
+
6337
+ export type EventControllerGetSliceData = {
6338
+ accountPattern: string;
6339
+ granularity: string;
6340
+ /**
6341
+ * Life event ID
6342
+ */
6343
+ id: string;
6344
+ /**
6345
+ * Region code for tenant context (decorative for life events)
6346
+ */
6347
+ region: 'cn' | 'us' | 'de' | 'gb';
6348
+ };
6349
+
6350
+ export type EventControllerGetSliceResponse = unknown;
6351
+
6072
6352
  export type ExportControllerExportBeancountResponse = unknown;
6073
6353
 
6074
6354
  export type FileImportControllerImportFileData = {
@@ -6510,6 +6790,24 @@ export type ReportingControllerGetPortfolioTrendsData = {
6510
6790
  export type ReportingControllerGetPortfolioTrendsResponse =
6511
6791
  PortfolioTrendsResponseDto;
6512
6792
 
6793
+ export type ReportingControllerGetCashFlowTrendsData = {
6794
+ /**
6795
+ * Data granularity (accepted for API symmetry; v1 returns month buckets)
6796
+ */
6797
+ granularity?: 'day' | 'week' | 'month';
6798
+ /**
6799
+ * Time period
6800
+ */
6801
+ period?: '1m' | '3m' | '6m' | '1y';
6802
+ /**
6803
+ * Region code for tenant context
6804
+ */
6805
+ region: 'cn' | 'us' | 'de' | 'gb';
6806
+ };
6807
+
6808
+ export type ReportingControllerGetCashFlowTrendsResponse =
6809
+ CashFlowTrendsResponseDto;
6810
+
6513
6811
  export type ReportingControllerGenerateSnapshotData = {
6514
6812
  /**
6515
6813
  * Region code for tenant context
@@ -7941,6 +8239,102 @@ export type $OpenApiTs = {
7941
8239
  };
7942
8240
  };
7943
8241
  };
8242
+ '/api/v1/{region}/bean/events': {
8243
+ post: {
8244
+ req: EventControllerCreateData;
8245
+ res: {
8246
+ /**
8247
+ * Life event created successfully
8248
+ */
8249
+ 201: EventResponseDto;
8250
+ /**
8251
+ * Life event already exists for this (userId, type, date) combination
8252
+ */
8253
+ 409: unknown;
8254
+ };
8255
+ };
8256
+ get: {
8257
+ req: EventControllerFindAllData;
8258
+ res: {
8259
+ /**
8260
+ * Life events retrieved successfully
8261
+ */
8262
+ 200: EventListResponseDto;
8263
+ };
8264
+ };
8265
+ };
8266
+ '/api/v1/{region}/bean/events/{id}': {
8267
+ get: {
8268
+ req: EventControllerFindOneData;
8269
+ res: {
8270
+ /**
8271
+ * Life event retrieved successfully
8272
+ */
8273
+ 200: EventResponseDto;
8274
+ /**
8275
+ * Life event not found
8276
+ */
8277
+ 404: unknown;
8278
+ };
8279
+ };
8280
+ put: {
8281
+ req: EventControllerUpdateData;
8282
+ res: {
8283
+ /**
8284
+ * Life event updated successfully
8285
+ */
8286
+ 200: EventResponseDto;
8287
+ /**
8288
+ * If-Match header is not a valid ISO 8601 date
8289
+ */
8290
+ 400: unknown;
8291
+ /**
8292
+ * Life event not found
8293
+ */
8294
+ 404: unknown;
8295
+ /**
8296
+ * Updated event conflicts with an existing (userId, type, date) combination
8297
+ */
8298
+ 409: unknown;
8299
+ /**
8300
+ * If-Match precondition failed (updatedAt mismatch)
8301
+ */
8302
+ 412: unknown;
8303
+ };
8304
+ };
8305
+ delete: {
8306
+ req: EventControllerDeleteData;
8307
+ res: {
8308
+ /**
8309
+ * Life event deleted successfully
8310
+ */
8311
+ 204: void;
8312
+ /**
8313
+ * Life event not found
8314
+ */
8315
+ 404: unknown;
8316
+ };
8317
+ };
8318
+ };
8319
+ '/api/v1/{region}/bean/events/{id}/slice': {
8320
+ get: {
8321
+ req: EventControllerGetSliceData;
8322
+ res: {
8323
+ /**
8324
+ * Time-series sliced by the life event range
8325
+ */
8326
+ 200: unknown;
8327
+ /**
8328
+ * accountPattern query param is empty
8329
+ */
8330
+ 400: unknown;
8331
+ /**
8332
+ * Life event not found
8333
+ */
8334
+ 404: unknown;
8335
+ };
8336
+ };
8337
+ };
7944
8338
  '/api/v1/{region}/bean/export/beancount': {
7945
8339
  get: {
7946
8340
  res: {
@@ -8474,6 +8868,21 @@ export type $OpenApiTs = {
8474
8868
  };
8475
8869
  };
8476
8870
  };
8871
+ '/api/v1/{region}/reporting/cash-flow/trends': {
8872
+ get: {
8873
+ req: ReportingControllerGetCashFlowTrendsData;
8874
+ res: {
8875
+ /**
8876
+ * Cash-flow trends retrieved successfully
8877
+ */
8878
+ 200: CashFlowTrendsResponseDto;
8879
+ /**
8880
+ * User not authenticated
8881
+ */
8882
+ 401: unknown;
8883
+ };
8884
+ };
8885
+ };
8477
8886
  '/api/v1/{region}/reporting/snapshots/generate': {
8478
8887
  post: {
8479
8888
  req: ReportingControllerGenerateSnapshotData;