@firela/api-types 0.0.0-canary.6feee68d → 0.0.0-canary.78c2840b

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.
@@ -583,7 +583,8 @@ export const $PostingResponseDto = {
583
583
  },
584
584
  units: {
585
585
  type: 'string',
586
- description: 'Amount (may be null if interpolated)',
586
+ description:
587
+ 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.',
587
588
  example: '100.50'
588
589
  },
589
590
  currency: {
@@ -840,6 +841,85 @@ export const $BatchTransactionResponseDto = {
840
841
  required: ['succeeded', 'failed']
841
842
  } as const;
842
843
 
844
+ export const $CorrectTransactionDto = {
845
+ type: 'object',
846
+ properties: {
847
+ date: {
848
+ type: 'string',
849
+ description: 'Transaction date (ISO 8601 format)',
850
+ example: '2024-11-28'
851
+ },
852
+ flag: {
853
+ type: 'string',
854
+ description: 'Transaction flag: * (cleared), ! (pending)',
855
+ enum: ['*', '!'],
856
+ example: '*'
857
+ },
858
+ payee: {
859
+ type: 'string',
860
+ description: 'Payee name',
861
+ example: 'Whole Foods Market'
862
+ },
863
+ narration: {
864
+ type: 'string',
865
+ description: 'Transaction narration/description',
866
+ example: 'Grocery shopping'
867
+ },
868
+ tags: {
869
+ description: 'Transaction tags (without # prefix)',
870
+ example: ['vacation', 'personal'],
871
+ type: 'array',
872
+ items: {
873
+ type: 'string'
874
+ }
875
+ },
876
+ links: {
877
+ description: 'Transaction links (without ^ prefix)',
878
+ example: ['invoice-123'],
879
+ type: 'array',
880
+ items: {
881
+ type: 'string'
882
+ }
883
+ },
884
+ postings: {
885
+ description:
886
+ 'Transaction postings (minimum 1, typically 2 for double-entry)',
887
+ type: 'array',
888
+ items: {
889
+ $ref: '#/components/schemas/CreatePostingDto'
890
+ }
891
+ },
892
+ meta: {
893
+ type: 'object',
894
+ description: 'Transaction-level metadata',
895
+ example: {
896
+ invoice: '12345'
897
+ }
898
+ },
899
+ idempotencyKey: {
900
+ type: 'string',
901
+ description:
902
+ 'Unique key for idempotent transaction creation. If provided, duplicate requests with the same key will return the existing transaction.',
903
+ example: 'import-2024-01-15-batch-001',
904
+ maxLength: 128
905
+ },
906
+ autoCreateAccounts: {
907
+ type: 'boolean',
908
+ description:
909
+ 'Auto-create accounts if not found. When true, missing accounts will be automatically created. When false (default for API), missing accounts will cause a validation error. Set to true for quick entry scenarios where you want to create accounts on-the-fly.',
910
+ default: true,
911
+ example: true
912
+ },
913
+ correctionReason: {
914
+ type: 'string',
915
+ description: 'Reason for correcting/superseding the original transaction',
916
+ example: 'Wrong amount — corrected from receipt',
917
+ maxLength: 500
918
+ }
919
+ },
920
+ required: ['date', 'narration', 'postings']
921
+ } as const;
922
+
843
923
  export const $PostingDetailDto = {
844
924
  type: 'object',
845
925
  properties: {
@@ -860,7 +940,8 @@ export const $PostingDetailDto = {
860
940
  },
861
941
  units: {
862
942
  type: 'string',
863
- description: 'Amount (may be null if interpolated)',
943
+ description:
944
+ 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.',
864
945
  example: '100.50'
865
946
  },
866
947
  currency: {
@@ -975,8 +1056,8 @@ export const $TransactionDetailDto = {
975
1056
  },
976
1057
  sourceType: {
977
1058
  type: 'string',
978
- description: 'Source type (how the transaction was created)',
979
- enum: ['NLP', 'CSV', 'OCR', 'API']
1059
+ description:
1060
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
980
1061
  },
981
1062
  sourcePlatform: {
982
1063
  type: 'string',
@@ -1009,6 +1090,18 @@ export const $TransactionDetailDto = {
1009
1090
  type: 'string',
1010
1091
  description: 'Correction reason (if voided or superseded)',
1011
1092
  example: 'Duplicate entry'
1093
+ },
1094
+ supersededBy: {
1095
+ type: 'string',
1096
+ description:
1097
+ 'ID of the transaction that supersedes this one (set when status=SUPERSEDED)',
1098
+ example: 'clh1234567890abcdef'
1099
+ },
1100
+ originalTxn: {
1101
+ type: 'string',
1102
+ description:
1103
+ 'ID of the transaction this one corrected/replaced (back-link on the replacement)',
1104
+ example: 'clh1234567890abcdef'
1012
1105
  }
1013
1106
  },
1014
1107
  required: [
@@ -1052,6 +1145,37 @@ export const $TransactionListResponseDto = {
1052
1145
  required: ['data', 'total', 'limit', 'offset']
1053
1146
  } as const;
1054
1147
 
1148
+ export const $TagSuggestionDto = {
1149
+ type: 'object',
1150
+ properties: {
1151
+ tag: {
1152
+ type: 'string',
1153
+ description: 'Tag name',
1154
+ example: 'Monthly'
1155
+ },
1156
+ count: {
1157
+ type: 'number',
1158
+ description: 'Usage count across ACTIVE transactions',
1159
+ example: 12
1160
+ }
1161
+ },
1162
+ required: ['tag', 'count']
1163
+ } as const;
1164
+
1165
+ export const $TagSuggestionsResponseDto = {
1166
+ type: 'object',
1167
+ properties: {
1168
+ data: {
1169
+ description: 'Tag suggestions sorted as requested',
1170
+ type: 'array',
1171
+ items: {
1172
+ $ref: '#/components/schemas/TagSuggestionDto'
1173
+ }
1174
+ }
1175
+ },
1176
+ required: ['data']
1177
+ } as const;
1178
+
1055
1179
  export const $UpdateTransactionDto = {
1056
1180
  type: 'object',
1057
1181
  properties: {
@@ -1202,8 +1326,8 @@ export const $TransactionSummaryDto = {
1202
1326
  },
1203
1327
  sourceType: {
1204
1328
  type: 'string',
1205
- description: 'Source type (NLP, CSV, OCR, API)',
1206
- enum: ['NLP', 'CSV', 'OCR', 'API']
1329
+ description:
1330
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1207
1331
  },
1208
1332
  sourcePlatform: {
1209
1333
  type: 'string',
@@ -1243,8 +1367,10 @@ export const $ReviewSummaryDto = {
1243
1367
  },
1244
1368
  confidenceLevel: {
1245
1369
  type: 'string',
1246
- description: 'Confidence level derived from score',
1247
- enum: ['HIGH', 'MEDIUM', 'LOW']
1370
+ description:
1371
+ 'Confidence level derived from score. Null for error-type reviews (ACCOUNT_VALIDATION/PIPELINE_ERROR) which carry no confidence.',
1372
+ enum: ['HIGH', 'MEDIUM', 'LOW'],
1373
+ nullable: true
1248
1374
  },
1249
1375
  summaryKey: {
1250
1376
  type: 'string',
@@ -1268,7 +1394,8 @@ export const $ReviewSummaryDto = {
1268
1394
  },
1269
1395
  sourceType: {
1270
1396
  type: 'string',
1271
- description: 'Source type (NLP, CSV, OCR, API)'
1397
+ description:
1398
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1272
1399
  },
1273
1400
  sourcePlatform: {
1274
1401
  type: 'string',
@@ -1378,7 +1505,20 @@ export const $DecisionOptionDto = {
1378
1505
  properties: {
1379
1506
  value: {
1380
1507
  type: 'string',
1381
- description: 'The action value to submit (e.g., UPGRADE_REPLACE, ACCEPT)'
1508
+ description: 'The action value to submit (e.g., UPGRADE_REPLACE, ACCEPT)',
1509
+ enum: [
1510
+ 'UPGRADE_REPLACE',
1511
+ 'LINK_KEEP_BOTH',
1512
+ 'IGNORE_NEW',
1513
+ 'CONFIRM_DIFFERENT',
1514
+ 'ACCEPT',
1515
+ 'REJECT',
1516
+ 'ACCEPT_AND_LEARN',
1517
+ 'CHOOSE_OTHER',
1518
+ 'CANCEL',
1519
+ 'FIX',
1520
+ 'IGNORE'
1521
+ ]
1382
1522
  },
1383
1523
  labelKey: {
1384
1524
  type: 'string',
@@ -1426,8 +1566,10 @@ export const $ReviewDetailDto = {
1426
1566
  },
1427
1567
  confidenceLevel: {
1428
1568
  type: 'string',
1429
- description: 'Confidence level derived from score',
1430
- enum: ['HIGH', 'MEDIUM', 'LOW']
1569
+ description:
1570
+ 'Confidence level derived from score. Null for error-type reviews (ACCOUNT_VALIDATION/PIPELINE_ERROR) which carry no confidence.',
1571
+ enum: ['HIGH', 'MEDIUM', 'LOW'],
1572
+ nullable: true
1431
1573
  },
1432
1574
  summaryKey: {
1433
1575
  type: 'string',
@@ -1451,7 +1593,8 @@ export const $ReviewDetailDto = {
1451
1593
  },
1452
1594
  sourceType: {
1453
1595
  type: 'string',
1454
- description: 'Source type (NLP, CSV, OCR, API)'
1596
+ description:
1597
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1455
1598
  },
1456
1599
  sourcePlatform: {
1457
1600
  type: 'string',
@@ -1531,7 +1674,20 @@ export const $ResolveReviewDto = {
1531
1674
  action: {
1532
1675
  type: 'string',
1533
1676
  description:
1534
- 'Decision action. Available actions vary by review type: DUPLICATE: UPGRADE_REPLACE, KEEP_EXISTING, KEEP_BOTH | PAYEE_MATCH: ACCEPT, REJECT, ACCEPT_AND_LEARN | ACCOUNT_VALIDATION: FIX, REJECT | RULE_MATCH: ACCEPT, REJECT, ACCEPT_AND_LEARN',
1677
+ 'Decision action. Valid actions vary by review type — see DecisionOptionDto.value returned by the review detail endpoint.',
1678
+ enum: [
1679
+ 'UPGRADE_REPLACE',
1680
+ 'LINK_KEEP_BOTH',
1681
+ 'IGNORE_NEW',
1682
+ 'CONFIRM_DIFFERENT',
1683
+ 'ACCEPT',
1684
+ 'REJECT',
1685
+ 'ACCEPT_AND_LEARN',
1686
+ 'CHOOSE_OTHER',
1687
+ 'CANCEL',
1688
+ 'FIX',
1689
+ 'IGNORE'
1690
+ ],
1535
1691
  example: 'ACCEPT'
1536
1692
  },
1537
1693
  data: {
@@ -1622,6 +1778,19 @@ export const $BatchResolveDto = {
1622
1778
  action: {
1623
1779
  type: 'string',
1624
1780
  description: 'Decision action to apply to all items',
1781
+ enum: [
1782
+ 'UPGRADE_REPLACE',
1783
+ 'LINK_KEEP_BOTH',
1784
+ 'IGNORE_NEW',
1785
+ 'CONFIRM_DIFFERENT',
1786
+ 'ACCEPT',
1787
+ 'REJECT',
1788
+ 'ACCEPT_AND_LEARN',
1789
+ 'CHOOSE_OTHER',
1790
+ 'CANCEL',
1791
+ 'FIX',
1792
+ 'IGNORE'
1793
+ ],
1625
1794
  example: 'ACCEPT'
1626
1795
  },
1627
1796
  data: {
@@ -29,6 +29,10 @@ import type {
29
29
  TransactionControllerListResponse,
30
30
  TransactionControllerCreateBatchData,
31
31
  TransactionControllerCreateBatchResponse,
32
+ TransactionControllerCorrectData,
33
+ TransactionControllerCorrectResponse,
34
+ TransactionControllerSuggestTagsData,
35
+ TransactionControllerSuggestTagsResponse,
32
36
  TransactionControllerGetDetailData,
33
37
  TransactionControllerGetDetailResponse,
34
38
  TransactionControllerUpdateData,
@@ -603,6 +607,68 @@ export class BeanTransactionsService {
603
607
  });
604
608
  }
605
609
 
610
+ /**
611
+ * Correct (supersede) a transaction
612
+ * Atomically voids the original (SUPERSEDED) and creates a replacement through the full validation pipeline.
613
+ * @param data The data for the request.
614
+ * @param data.id Original transaction ID to correct
615
+ * @param data.region Region code for tenant context
616
+ * @param data.requestBody
617
+ * @returns TransactionDetailDto Corrected transaction created
618
+ * @throws ApiError
619
+ */
620
+ public static transactionControllerCorrect(
621
+ data: TransactionControllerCorrectData
622
+ ): CancelablePromise<TransactionControllerCorrectResponse> {
623
+ return __request(OpenAPI, {
624
+ method: 'POST',
625
+ url: '/api/v1/{region}/bean/transactions/{id}/correct',
626
+ path: {
627
+ id: data.id,
628
+ region: data.region
629
+ },
630
+ body: data.requestBody,
631
+ mediaType: 'application/json',
632
+ errors: {
633
+ 404: 'Original transaction not found',
634
+ 409: 'Original no longer ACTIVE (concurrent modification)',
635
+ 422: 'Pipeline validation failed (does not balance, invalid accounts)'
636
+ }
637
+ });
638
+ }
639
+
640
+ /**
641
+ * Suggest transaction tags
642
+ * Returns distinct tags from the user ACTIVE transactions, sorted by usage, for autocomplete. Optional q performs a case-insensitive prefix match.
643
+ * @param data The data for the request.
644
+ * @param data.region Region code for tenant context
645
+ * @param data.q Prefix match, case-insensitive (max 50 chars)
646
+ * @param data.sort usage (default) or name
647
+ * @param data.limit Max suggestions (1-100, default 10)
648
+ * @returns TagSuggestionsResponseDto Tag suggestions
649
+ * @throws ApiError
650
+ */
651
+ public static transactionControllerSuggestTags(
652
+ data: TransactionControllerSuggestTagsData
653
+ ): CancelablePromise<TransactionControllerSuggestTagsResponse> {
654
+ return __request(OpenAPI, {
655
+ method: 'GET',
656
+ url: '/api/v1/{region}/bean/transactions/tags',
657
+ path: {
658
+ region: data.region
659
+ },
660
+ query: {
661
+ q: data.q,
662
+ sort: data.sort,
663
+ limit: data.limit
664
+ },
665
+ errors: {
666
+ 400: 'Validation failed',
667
+ 401: 'Authentication required'
668
+ }
669
+ });
670
+ }
671
+
606
672
  /**
607
673
  * Get transaction detail
608
674
  * Returns transaction details including all postings