@firela/api-types 0.0.0-canary.ba0a88d9 → 0.0.0-canary.cf050c09

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.
package/dist/index.js CHANGED
@@ -720,6 +720,62 @@ var BeanTransactionsService = class {
720
720
  }
721
721
  });
722
722
  }
723
+ /**
724
+ * Correct (supersede) a transaction
725
+ * Atomically voids the original (SUPERSEDED) and creates a replacement through the full validation pipeline.
726
+ * @param data The data for the request.
727
+ * @param data.id Original transaction ID to correct
728
+ * @param data.region Region code for tenant context
729
+ * @param data.requestBody
730
+ * @returns TransactionDetailDto Corrected transaction created
731
+ * @throws ApiError
732
+ */
733
+ static transactionControllerCorrect(data) {
734
+ return request(OpenAPI, {
735
+ method: "POST",
736
+ url: "/api/v1/{region}/bean/transactions/{id}/correct",
737
+ path: {
738
+ id: data.id,
739
+ region: data.region
740
+ },
741
+ body: data.requestBody,
742
+ mediaType: "application/json",
743
+ errors: {
744
+ 404: "Original transaction not found",
745
+ 409: "Original no longer ACTIVE (concurrent modification)",
746
+ 422: "Pipeline validation failed (does not balance, invalid accounts)"
747
+ }
748
+ });
749
+ }
750
+ /**
751
+ * Suggest transaction tags
752
+ * Returns distinct tags from the user ACTIVE transactions, sorted by usage, for autocomplete. Optional q performs a case-insensitive prefix match.
753
+ * @param data The data for the request.
754
+ * @param data.region Region code for tenant context
755
+ * @param data.q Prefix match, case-insensitive (max 50 chars)
756
+ * @param data.sort usage (default) or name
757
+ * @param data.limit Max suggestions (1-100, default 10)
758
+ * @returns TagSuggestionsResponseDto Tag suggestions
759
+ * @throws ApiError
760
+ */
761
+ static transactionControllerSuggestTags(data) {
762
+ return request(OpenAPI, {
763
+ method: "GET",
764
+ url: "/api/v1/{region}/bean/transactions/tags",
765
+ path: {
766
+ region: data.region
767
+ },
768
+ query: {
769
+ q: data.q,
770
+ sort: data.sort,
771
+ limit: data.limit
772
+ },
773
+ errors: {
774
+ 400: "Validation failed",
775
+ 401: "Authentication required"
776
+ }
777
+ });
778
+ }
723
779
  /**
724
780
  * Get transaction detail
725
781
  * Returns transaction details including all postings
package/dist/index.mjs CHANGED
@@ -688,6 +688,62 @@ var BeanTransactionsService = class {
688
688
  }
689
689
  });
690
690
  }
691
+ /**
692
+ * Correct (supersede) a transaction
693
+ * Atomically voids the original (SUPERSEDED) and creates a replacement through the full validation pipeline.
694
+ * @param data The data for the request.
695
+ * @param data.id Original transaction ID to correct
696
+ * @param data.region Region code for tenant context
697
+ * @param data.requestBody
698
+ * @returns TransactionDetailDto Corrected transaction created
699
+ * @throws ApiError
700
+ */
701
+ static transactionControllerCorrect(data) {
702
+ return request(OpenAPI, {
703
+ method: "POST",
704
+ url: "/api/v1/{region}/bean/transactions/{id}/correct",
705
+ path: {
706
+ id: data.id,
707
+ region: data.region
708
+ },
709
+ body: data.requestBody,
710
+ mediaType: "application/json",
711
+ errors: {
712
+ 404: "Original transaction not found",
713
+ 409: "Original no longer ACTIVE (concurrent modification)",
714
+ 422: "Pipeline validation failed (does not balance, invalid accounts)"
715
+ }
716
+ });
717
+ }
718
+ /**
719
+ * Suggest transaction tags
720
+ * Returns distinct tags from the user ACTIVE transactions, sorted by usage, for autocomplete. Optional q performs a case-insensitive prefix match.
721
+ * @param data The data for the request.
722
+ * @param data.region Region code for tenant context
723
+ * @param data.q Prefix match, case-insensitive (max 50 chars)
724
+ * @param data.sort usage (default) or name
725
+ * @param data.limit Max suggestions (1-100, default 10)
726
+ * @returns TagSuggestionsResponseDto Tag suggestions
727
+ * @throws ApiError
728
+ */
729
+ static transactionControllerSuggestTags(data) {
730
+ return request(OpenAPI, {
731
+ method: "GET",
732
+ url: "/api/v1/{region}/bean/transactions/tags",
733
+ path: {
734
+ region: data.region
735
+ },
736
+ query: {
737
+ q: data.q,
738
+ sort: data.sort,
739
+ limit: data.limit
740
+ },
741
+ errors: {
742
+ 400: "Validation failed",
743
+ 401: "Authentication required"
744
+ }
745
+ });
746
+ }
691
747
  /**
692
748
  * Get transaction detail
693
749
  * Returns transaction details including all postings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firela/api-types",
3
- "version": "0.0.0-canary.ba0a88d9",
3
+ "version": "0.0.0-canary.cf050c09",
4
4
  "description": "TypeScript types generated from IGN OpenAPI specification",
5
5
  "license": "MIT",
6
6
  "author": "FireLa Team",
@@ -24,8 +24,7 @@
24
24
  "src"
25
25
  ],
26
26
  "scripts": {
27
- "sync": "npx ts-node scripts/sync-spec.ts",
28
- "generate": "npm run sync && openapi-ts",
27
+ "generate": "openapi-ts",
29
28
  "build": "tsup src/index.ts --format cjs,esm --dts --clean",
30
29
  "lint": "spectral lint openapi.yaml",
31
30
  "prepublishOnly": "npm run generate && npm run build"
@@ -329,9 +329,14 @@ export const $AccountStandardResponseDto = {
329
329
  description: 'i18n key for localized display name',
330
330
  example: 'account.assets.cn.bank.icbc.checking'
331
331
  },
332
+ name: {
333
+ type: 'string',
334
+ description: 'Short localized display name',
335
+ example: 'Housing Fund'
336
+ },
332
337
  description: {
333
338
  type: 'string',
334
- description: 'Account description',
339
+ description: 'Account description (stable semantics only)',
335
340
  example: 'ICBC checking account for daily transactions'
336
341
  },
337
342
  tags: {
@@ -348,7 +353,7 @@ export const $AccountStandardResponseDto = {
348
353
  example: 'bank-icbc'
349
354
  }
350
355
  },
351
- required: ['path', 'type']
356
+ required: ['path', 'type', 'i18nKey', 'description', 'tags', 'icon']
352
357
  } as const;
353
358
 
354
359
  export const $AccountStandardListResponseDto = {
@@ -432,11 +437,10 @@ export const $RegionInfoDto = {
432
437
  example: 'Germany'
433
438
  },
434
439
  parent: {
435
- type: 'string',
436
- example: 'eu-core'
440
+ type: 'string'
437
441
  },
438
442
  chain: {
439
- example: ['eu-core', 'de'],
443
+ example: ['de'],
440
444
  type: 'array',
441
445
  items: {
442
446
  type: 'string'
@@ -579,7 +583,8 @@ export const $PostingResponseDto = {
579
583
  },
580
584
  units: {
581
585
  type: 'string',
582
- 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.',
583
588
  example: '100.50'
584
589
  },
585
590
  currency: {
@@ -805,6 +810,11 @@ export const $BatchTransactionErrorDto = {
805
810
  type: 'string',
806
811
  description: 'Error message describing the failure',
807
812
  example: 'Transaction does not balance'
813
+ },
814
+ errorCode: {
815
+ type: 'string',
816
+ description: 'Structured error code for programmatic handling',
817
+ example: 'INSUFFICIENT_QUANTITY'
808
818
  }
809
819
  },
810
820
  required: ['index', 'error']
@@ -831,6 +841,85 @@ export const $BatchTransactionResponseDto = {
831
841
  required: ['succeeded', 'failed']
832
842
  } as const;
833
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
+
834
923
  export const $PostingDetailDto = {
835
924
  type: 'object',
836
925
  properties: {
@@ -851,7 +940,8 @@ export const $PostingDetailDto = {
851
940
  },
852
941
  units: {
853
942
  type: 'string',
854
- 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.',
855
945
  example: '100.50'
856
946
  },
857
947
  currency: {
@@ -966,8 +1056,8 @@ export const $TransactionDetailDto = {
966
1056
  },
967
1057
  sourceType: {
968
1058
  type: 'string',
969
- description: 'Source type (how the transaction was created)',
970
- enum: ['NLP', 'CSV', 'OCR', 'API']
1059
+ description:
1060
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
971
1061
  },
972
1062
  sourcePlatform: {
973
1063
  type: 'string',
@@ -1000,6 +1090,18 @@ export const $TransactionDetailDto = {
1000
1090
  type: 'string',
1001
1091
  description: 'Correction reason (if voided or superseded)',
1002
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'
1003
1105
  }
1004
1106
  },
1005
1107
  required: [
@@ -1043,6 +1145,37 @@ export const $TransactionListResponseDto = {
1043
1145
  required: ['data', 'total', 'limit', 'offset']
1044
1146
  } as const;
1045
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
+
1046
1179
  export const $UpdateTransactionDto = {
1047
1180
  type: 'object',
1048
1181
  properties: {
@@ -1193,8 +1326,8 @@ export const $TransactionSummaryDto = {
1193
1326
  },
1194
1327
  sourceType: {
1195
1328
  type: 'string',
1196
- description: 'Source type (NLP, CSV, OCR, API)',
1197
- enum: ['NLP', 'CSV', 'OCR', 'API']
1329
+ description:
1330
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1198
1331
  },
1199
1332
  sourcePlatform: {
1200
1333
  type: 'string',
@@ -1234,8 +1367,10 @@ export const $ReviewSummaryDto = {
1234
1367
  },
1235
1368
  confidenceLevel: {
1236
1369
  type: 'string',
1237
- description: 'Confidence level derived from score',
1238
- 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
1239
1374
  },
1240
1375
  summaryKey: {
1241
1376
  type: 'string',
@@ -1259,7 +1394,8 @@ export const $ReviewSummaryDto = {
1259
1394
  },
1260
1395
  sourceType: {
1261
1396
  type: 'string',
1262
- description: 'Source type (NLP, CSV, OCR, API)'
1397
+ description:
1398
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1263
1399
  },
1264
1400
  sourcePlatform: {
1265
1401
  type: 'string',
@@ -1369,7 +1505,20 @@ export const $DecisionOptionDto = {
1369
1505
  properties: {
1370
1506
  value: {
1371
1507
  type: 'string',
1372
- 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
+ ]
1373
1522
  },
1374
1523
  labelKey: {
1375
1524
  type: 'string',
@@ -1417,8 +1566,10 @@ export const $ReviewDetailDto = {
1417
1566
  },
1418
1567
  confidenceLevel: {
1419
1568
  type: 'string',
1420
- description: 'Confidence level derived from score',
1421
- 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
1422
1573
  },
1423
1574
  summaryKey: {
1424
1575
  type: 'string',
@@ -1442,7 +1593,8 @@ export const $ReviewDetailDto = {
1442
1593
  },
1443
1594
  sourceType: {
1444
1595
  type: 'string',
1445
- description: 'Source type (NLP, CSV, OCR, API)'
1596
+ description:
1597
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1446
1598
  },
1447
1599
  sourcePlatform: {
1448
1600
  type: 'string',
@@ -1522,7 +1674,20 @@ export const $ResolveReviewDto = {
1522
1674
  action: {
1523
1675
  type: 'string',
1524
1676
  description:
1525
- '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
+ ],
1526
1691
  example: 'ACCEPT'
1527
1692
  },
1528
1693
  data: {
@@ -1613,6 +1778,19 @@ export const $BatchResolveDto = {
1613
1778
  action: {
1614
1779
  type: 'string',
1615
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
+ ],
1616
1794
  example: 'ACCEPT'
1617
1795
  },
1618
1796
  data: {
@@ -4688,6 +4866,16 @@ export const $ProcessNlpDto = {
4688
4866
  description:
4689
4867
  'Session ID for multi-turn conversation (auto-generated if not provided)',
4690
4868
  example: 'session_abc123'
4869
+ },
4870
+ parsedData: {
4871
+ type: 'object',
4872
+ description:
4873
+ 'Parsed data from previous NLP response for session recovery. Send back the parsedData received in confirm_payee/confirm responses.',
4874
+ example: {
4875
+ amount: 35,
4876
+ currency: 'CNY',
4877
+ payee: 'Starbucks'
4878
+ }
4691
4879
  }
4692
4880
  },
4693
4881
  required: ['message']
@@ -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