@firela/api-types 0.0.0-canary.693e8bdf → 0.0.0-canary.69a6df79

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.
@@ -776,7 +776,7 @@ export const $PostingResponseDto = {
776
776
  units: {
777
777
  type: 'string',
778
778
  description:
779
- 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.',
779
+ 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned. Carries the raw Beancount sign (credit-normal accounts such as Income post negative — the accounting truth, ADR-0126); renderers must not infer economic semantics from this sign.',
780
780
  example: '100.50'
781
781
  },
782
782
  currency: {
@@ -1142,7 +1142,7 @@ export const $PostingDetailDto = {
1142
1142
  units: {
1143
1143
  type: 'string',
1144
1144
  description:
1145
- 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned.',
1145
+ 'Amount as decimal string. Typed optional but always present in responses: interpolation fills any MISSING posting before it is persisted or returned. Carries the raw Beancount sign (credit-normal accounts such as Income post negative — the accounting truth, ADR-0126); renderers must not infer economic semantics from this sign.',
1146
1146
  example: '100.50'
1147
1147
  },
1148
1148
  currency: {
@@ -1326,6 +1326,147 @@ export const $TransactionDetailDto = {
1326
1326
  ]
1327
1327
  } as const;
1328
1328
 
1329
+ export const $TransactionListItemDto = {
1330
+ type: 'object',
1331
+ properties: {
1332
+ id: {
1333
+ type: 'string',
1334
+ description: 'Transaction ID',
1335
+ example: 'clh1234567890abcdef'
1336
+ },
1337
+ date: {
1338
+ type: 'string',
1339
+ description: 'Transaction date',
1340
+ example: '2024-11-28'
1341
+ },
1342
+ flag: {
1343
+ type: 'string',
1344
+ description: 'Transaction flag',
1345
+ enum: [
1346
+ 'CLEARED',
1347
+ 'PENDING',
1348
+ 'PADDING',
1349
+ 'SUMMARIZE',
1350
+ 'TRANSFER',
1351
+ 'CONVERSIONS'
1352
+ ],
1353
+ example: 'CLEARED'
1354
+ },
1355
+ customFlag: {
1356
+ type: 'string',
1357
+ description: 'Custom flag (if not using standard flags)',
1358
+ example: 'R'
1359
+ },
1360
+ payee: {
1361
+ type: 'string',
1362
+ description: 'Payee name',
1363
+ example: 'Whole Foods Market'
1364
+ },
1365
+ narration: {
1366
+ type: 'string',
1367
+ description: 'Transaction narration',
1368
+ example: 'Grocery shopping'
1369
+ },
1370
+ tags: {
1371
+ description: 'Transaction tags',
1372
+ example: ['groceries'],
1373
+ type: 'array',
1374
+ items: {
1375
+ type: 'string'
1376
+ }
1377
+ },
1378
+ links: {
1379
+ description: 'Transaction links',
1380
+ example: ['invoice-2024-001'],
1381
+ type: 'array',
1382
+ items: {
1383
+ type: 'string'
1384
+ }
1385
+ },
1386
+ meta: {
1387
+ type: 'object',
1388
+ description: 'Transaction metadata'
1389
+ },
1390
+ status: {
1391
+ type: 'string',
1392
+ description: 'Transaction status',
1393
+ enum: ['ACTIVE', 'VOIDED', 'SUPERSEDED'],
1394
+ example: 'ACTIVE'
1395
+ },
1396
+ sourceType: {
1397
+ type: 'string',
1398
+ description:
1399
+ 'Source type (free-form string from transaction metadata, e.g. import, api)'
1400
+ },
1401
+ sourcePlatform: {
1402
+ type: 'string',
1403
+ description: 'Source platform (e.g., alipay, wechat)',
1404
+ example: 'alipay'
1405
+ },
1406
+ postings: {
1407
+ description: 'Transaction postings',
1408
+ type: 'array',
1409
+ items: {
1410
+ $ref: '#/components/schemas/PostingDetailDto'
1411
+ }
1412
+ },
1413
+ createdAt: {
1414
+ type: 'string',
1415
+ description: 'Created at timestamp',
1416
+ example: '2024-11-28T10:30:00.000Z'
1417
+ },
1418
+ voidedAt: {
1419
+ type: 'string',
1420
+ description: 'Voided at timestamp (if voided)',
1421
+ example: '2024-11-29T15:00:00.000Z'
1422
+ },
1423
+ voidedBy: {
1424
+ type: 'string',
1425
+ description: 'User ID who voided this transaction',
1426
+ example: 'clh1234567890abcdef'
1427
+ },
1428
+ correctionReason: {
1429
+ type: 'string',
1430
+ description: 'Correction reason (if voided or superseded)',
1431
+ example: 'Duplicate entry'
1432
+ },
1433
+ supersededBy: {
1434
+ type: 'string',
1435
+ description:
1436
+ 'ID of the transaction that supersedes this one (set when status=SUPERSEDED)',
1437
+ example: 'clh1234567890abcdef'
1438
+ },
1439
+ originalTxn: {
1440
+ type: 'string',
1441
+ description:
1442
+ 'ID of the transaction this one corrected/replaced (back-link on the replacement)',
1443
+ example: 'clh1234567890abcdef'
1444
+ },
1445
+ viewpointAmount: {
1446
+ type: 'string',
1447
+ description:
1448
+ 'Row amount under the request viewpoint (ADR-0126). Category viewpoint (category + flow): per-leg sign-normalized sum over the category account set (Income-root legs negated, Expenses-root identity) — positive under normal booking but NOT clamped (explicit negative expense legs and net-flip refund months stay negative). No viewpoint (plain list / search, no accountId): wallet money-flow net = raw-sign sum over cost-less Assets/Liabilities legs (income positive, expenses negative, transfers net ~0); color cue is the wallet sign (net < 0 = wealth-decreasing). Status-orthogonal: audit views match too (ADR-0128 amount-as-matching-key). Omitted under the account viewpoint (incl. dual) and for rows with no wallet leg.',
1449
+ example: '10000.00'
1450
+ },
1451
+ viewpointCurrency: {
1452
+ type: 'string',
1453
+ description:
1454
+ 'Currency of viewpointAmount. A row spanning multiple currencies takes the largest-magnitude currency group (known simplification, ADR-0126).',
1455
+ example: 'CNY'
1456
+ }
1457
+ },
1458
+ required: [
1459
+ 'id',
1460
+ 'date',
1461
+ 'narration',
1462
+ 'tags',
1463
+ 'links',
1464
+ 'status',
1465
+ 'postings',
1466
+ 'createdAt'
1467
+ ]
1468
+ } as const;
1469
+
1329
1470
  export const $BalanceByCurrencyDto = {
1330
1471
  type: 'object',
1331
1472
  properties: {
@@ -1371,7 +1512,7 @@ export const $TransactionListSummaryDto = {
1371
1512
  totalAmount: {
1372
1513
  type: 'string',
1373
1514
  description:
1374
- 'Partial converted total in base currency (rated currencies only, raw Beancount sign). When warnings is non-empty this excludes currencies missing an FX rate; may be "0.00" if ALL non-base currencies lack a rate. Converted at the dateTo (or current) available rate.',
1515
+ 'Partial converted total in base currency (rated currencies only). Sign by viewpoint (ADR-0126): account viewpoint keeps the raw Beancount sign (income negative); category viewpoint is per-leg sign-normalized (Income legs negated, Expenses legs identity — positive under normal booking, not clamped). When warnings is non-empty this excludes currencies missing an FX rate; may be "0.00" if ALL non-base currencies lack a rate. Converted at the dateTo (or current) available rate.',
1375
1516
  example: '-6000.00'
1376
1517
  },
1377
1518
  currency: {
@@ -1397,6 +1538,26 @@ export const $TransactionListSummaryDto = {
1397
1538
  required: ['totalAmount', 'currency', 'balanceByCurrency']
1398
1539
  } as const;
1399
1540
 
1541
+ export const $TransactionListViewpointDto = {
1542
+ type: 'object',
1543
+ properties: {
1544
+ type: {
1545
+ type: 'string',
1546
+ description:
1547
+ 'Viewpoint type (only category drill-down carries a viewpoint today)',
1548
+ enum: ['category'],
1549
+ example: 'category'
1550
+ },
1551
+ flow: {
1552
+ type: 'string',
1553
+ description: 'Flow root the category account set is restricted to',
1554
+ enum: ['income', 'expense'],
1555
+ example: 'expense'
1556
+ }
1557
+ },
1558
+ required: ['type', 'flow']
1559
+ } as const;
1560
+
1400
1561
  export const $TransactionListResponseDto = {
1401
1562
  type: 'object',
1402
1563
  properties: {
@@ -1404,7 +1565,7 @@ export const $TransactionListResponseDto = {
1404
1565
  description: 'List of transactions',
1405
1566
  type: 'array',
1406
1567
  items: {
1407
- $ref: '#/components/schemas/TransactionDetailDto'
1568
+ $ref: '#/components/schemas/TransactionListItemDto'
1408
1569
  }
1409
1570
  },
1410
1571
  total: {
@@ -1430,6 +1591,15 @@ export const $TransactionListResponseDto = {
1430
1591
  $ref: '#/components/schemas/TransactionListSummaryDto'
1431
1592
  }
1432
1593
  ]
1594
+ },
1595
+ viewpoint: {
1596
+ description:
1597
+ 'Viewpoint metadata (ADR-0126). Present only for a single category filter (category + flow, no accountId); dual-perspective requests are viewpoint-less (raw signs, no viewpointAmount).',
1598
+ allOf: [
1599
+ {
1600
+ $ref: '#/components/schemas/TransactionListViewpointDto'
1601
+ }
1602
+ ]
1433
1603
  }
1434
1604
  },
1435
1605
  required: ['data', 'total', 'limit', 'offset']
@@ -6217,7 +6387,7 @@ export const $ProcessNlpDto = {
6217
6387
  selectedAccount: {
6218
6388
  type: 'string',
6219
6389
  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.',
6390
+ 'confirm_account echo-back: account path selected from the prior confirm_account response (suggestedAccount, similarAccounts[i].path, or a typed path). Applied directly when the session is confirming_account — no NL re-parse.',
6221
6391
  example: 'Expenses:Food:Coffee'
6222
6392
  }
6223
6393
  }
@@ -6532,6 +6702,24 @@ export const $NlpRuleConfirmationDataDto = {
6532
6702
  ]
6533
6703
  } as const;
6534
6704
 
6705
+ export const $NlpAccountCandidateDto = {
6706
+ type: 'object',
6707
+ properties: {
6708
+ path: {
6709
+ type: 'string',
6710
+ description: 'Canonical beancount account path (echo back on selection)',
6711
+ example: 'Expenses:Food:Dining'
6712
+ },
6713
+ name: {
6714
+ type: 'string',
6715
+ description:
6716
+ 'Localized display name (ADR-0114 read-time projection, user locale)',
6717
+ example: '餐饮'
6718
+ }
6719
+ },
6720
+ required: ['path', 'name']
6721
+ } as const;
6722
+
6535
6723
  export const $NlpAccountConfirmationDataDto = {
6536
6724
  type: 'object',
6537
6725
  properties: {
@@ -6547,10 +6735,11 @@ export const $NlpAccountConfirmationDataDto = {
6547
6735
  example: 'Expenses:Food:Drinks'
6548
6736
  },
6549
6737
  similarAccounts: {
6550
- description: 'Similar accounts for user selection',
6738
+ description:
6739
+ 'Similar accounts for user selection (path + localized name, #680)',
6551
6740
  type: 'array',
6552
6741
  items: {
6553
- type: 'string'
6742
+ $ref: '#/components/schemas/NlpAccountCandidateDto'
6554
6743
  }
6555
6744
  },
6556
6745
  errorMessage: {
@@ -8395,6 +8584,216 @@ export const $AnonymousLoginResponseDto = {
8395
8584
  required: ['authToken']
8396
8585
  } as const;
8397
8586
 
8587
+ export const $ParserContributionMetaDto = {
8588
+ type: 'object',
8589
+ properties: {
8590
+ institution: {
8591
+ type: 'string',
8592
+ description: 'Institution slug (lowercase kebab-case)',
8593
+ pattern: '^[a-z0-9]+(-[a-z0-9]+)*$',
8594
+ example: 'icbc'
8595
+ },
8596
+ region: {
8597
+ type: 'string',
8598
+ enum: [
8599
+ 'cn',
8600
+ 'us',
8601
+ 'de',
8602
+ 'fr',
8603
+ 'gb',
8604
+ 'hk',
8605
+ 'jp',
8606
+ 'sg',
8607
+ 'au',
8608
+ 'ca',
8609
+ 'other'
8610
+ ]
8611
+ },
8612
+ accountType: {
8613
+ type: 'string',
8614
+ enum: ['checking', 'savings', 'credit', 'debit', 'investment']
8615
+ },
8616
+ format: {
8617
+ type: 'string',
8618
+ enum: ['csv', 'xlsx', 'pdf', 'ofx', 'qif']
8619
+ },
8620
+ institutionDisplayName: {
8621
+ type: 'string',
8622
+ example: '中国工商银行'
8623
+ },
8624
+ encoding: {
8625
+ type: 'string',
8626
+ example: 'utf-8'
8627
+ },
8628
+ delimiter: {
8629
+ type: 'string',
8630
+ description: 'CSV delimiter character: ",", ";", "\\t" or "|"'
8631
+ },
8632
+ headerRows: {
8633
+ type: 'number',
8634
+ default: 1,
8635
+ description: 'Header row count; the client omits the field when it is 1'
8636
+ },
8637
+ notes: {
8638
+ type: 'string',
8639
+ maxLength: 2000
8640
+ }
8641
+ },
8642
+ required: ['institution', 'region', 'accountType', 'format']
8643
+ } as const;
8644
+
8645
+ export const $ParserContributionSamplesDto = {
8646
+ type: 'object',
8647
+ properties: {
8648
+ rows: {
8649
+ description:
8650
+ 'Client-sanitized sample rows (key = column name, value = cell)',
8651
+ type: 'array',
8652
+ items: {
8653
+ type: 'object'
8654
+ }
8655
+ },
8656
+ rawHeaders: {
8657
+ type: 'array',
8658
+ items: {
8659
+ type: 'string'
8660
+ }
8661
+ }
8662
+ },
8663
+ required: ['rows']
8664
+ } as const;
8665
+
8666
+ export const $FieldHintDto = {
8667
+ type: 'object',
8668
+ properties: {
8669
+ columnName: {
8670
+ type: 'string',
8671
+ example: '交易日期'
8672
+ },
8673
+ format: {
8674
+ type: 'string',
8675
+ description: 'Date format, e.g. yyyy-MM-dd HH:mm',
8676
+ example: 'yyyy-MM-dd'
8677
+ },
8678
+ signConvention: {
8679
+ type: 'string',
8680
+ enum: ['negative-expense', 'positive-expense', 'separate-columns']
8681
+ },
8682
+ creditColumn: {
8683
+ type: 'string'
8684
+ },
8685
+ debitColumn: {
8686
+ type: 'string'
8687
+ }
8688
+ },
8689
+ required: ['columnName']
8690
+ } as const;
8691
+
8692
+ export const $ParserContributionFieldHintsDto = {
8693
+ type: 'object',
8694
+ properties: {
8695
+ date: {
8696
+ $ref: '#/components/schemas/FieldHintDto'
8697
+ },
8698
+ amount: {
8699
+ $ref: '#/components/schemas/FieldHintDto'
8700
+ },
8701
+ description: {
8702
+ $ref: '#/components/schemas/FieldHintDto'
8703
+ },
8704
+ balance: {
8705
+ $ref: '#/components/schemas/FieldHintDto'
8706
+ },
8707
+ payee: {
8708
+ $ref: '#/components/schemas/FieldHintDto'
8709
+ },
8710
+ reference: {
8711
+ $ref: '#/components/schemas/FieldHintDto'
8712
+ },
8713
+ category: {
8714
+ $ref: '#/components/schemas/FieldHintDto'
8715
+ }
8716
+ },
8717
+ required: ['date', 'amount']
8718
+ } as const;
8719
+
8720
+ export const $ExpectedTransactionDto = {
8721
+ type: 'object',
8722
+ properties: {
8723
+ date: {
8724
+ type: 'string',
8725
+ example: '2026-08-01'
8726
+ },
8727
+ amount: {
8728
+ type: 'number',
8729
+ example: -45.5
8730
+ },
8731
+ description: {
8732
+ type: 'string',
8733
+ example: '星巴克-***店'
8734
+ },
8735
+ payee: {
8736
+ type: 'string'
8737
+ },
8738
+ category: {
8739
+ type: 'string'
8740
+ }
8741
+ },
8742
+ required: ['date', 'amount', 'description']
8743
+ } as const;
8744
+
8745
+ export const $ParserContributionExamplesDto = {
8746
+ type: 'object',
8747
+ properties: {
8748
+ expectedTransactions: {
8749
+ type: 'array',
8750
+ items: {
8751
+ $ref: '#/components/schemas/ExpectedTransactionDto'
8752
+ }
8753
+ }
8754
+ },
8755
+ required: ['expectedTransactions']
8756
+ } as const;
8757
+
8758
+ export const $ParserContributionRequestDto = {
8759
+ type: 'object',
8760
+ properties: {
8761
+ meta: {
8762
+ $ref: '#/components/schemas/ParserContributionMetaDto'
8763
+ },
8764
+ samples: {
8765
+ $ref: '#/components/schemas/ParserContributionSamplesDto'
8766
+ },
8767
+ fieldHints: {
8768
+ $ref: '#/components/schemas/ParserContributionFieldHintsDto'
8769
+ },
8770
+ examples: {
8771
+ description: 'Omitted entirely by the client when empty',
8772
+ allOf: [
8773
+ {
8774
+ $ref: '#/components/schemas/ParserContributionExamplesDto'
8775
+ }
8776
+ ]
8777
+ }
8778
+ },
8779
+ required: ['meta', 'samples', 'fieldHints']
8780
+ } as const;
8781
+
8782
+ export const $ParserContributionRelayResponseDto = {
8783
+ type: 'object',
8784
+ properties: {
8785
+ issueUrl: {
8786
+ type: 'string',
8787
+ example: 'https://github.com/fire-zu/firela-vlt/issues/42'
8788
+ },
8789
+ issueNumber: {
8790
+ type: 'number',
8791
+ example: 42
8792
+ }
8793
+ },
8794
+ required: ['issueUrl', 'issueNumber']
8795
+ } as const;
8796
+
8398
8797
  export const $SymbolSearchResultDto = {
8399
8798
  type: 'object',
8400
8799
  properties: {
@@ -280,6 +280,8 @@ import type {
280
280
  ApiKeysControllerCreateApiKeyResponse,
281
281
  AuthControllerAccessTokenLoginData,
282
282
  AuthControllerAccessTokenLoginResponse,
283
+ ParserContributionControllerCreateData,
284
+ ParserContributionControllerCreateResponse,
283
285
  CacheControllerFlushCacheResponse,
284
286
  ExchangeRateControllerGetExchangeRateData,
285
287
  ExchangeRateControllerGetExchangeRateResponse,
@@ -638,10 +640,11 @@ export class BeanTransactionsService {
638
640
  * @param data.offset Number of items to skip (default: 0)
639
641
  * @param data.dateFrom Filter by start date (inclusive), format: YYYY-MM-DD
640
642
  * @param data.dateTo Filter by end date (inclusive), format: YYYY-MM-DD
641
- * @param data.status Filter by transaction status
643
+ * @param data.status Filter by transaction status: single value, comma-separated multi-value (e.g. VOIDED,SUPERSEDED), or ALL to include audit rows. Defaults to ACTIVE-only (ADR-0128; previously unfiltered — breaking change).
642
644
  * @param data.search Search in narration and payee fields (max 200 chars)
643
645
  * @param data.accountId Filter by account ID (transactions with postings to this account)
644
- * @param data.category Filter by ADR-0075 functional category (Group segment); matches any posting to an Expenses/Income account whose derived Group segment equals this value
646
+ * @param data.category Filter by ADR-0075 functional category (Group segment); matches any posting to an account whose derived Group segment equals this value. Must be accompanied by flow (ADR-0126).
647
+ * @param data.flow Required when category is present (400 otherwise) and vice versa (ADR-0126). Restricts the category account set to the flow root (income → Income:, expense → Expenses:) and drives the per-leg sign normalization of row viewpointAmount and the summary. OpenAPI cannot express conditional requiredness — the pairing is enforced at runtime.
645
648
  * @returns TransactionListResponseDto Transaction list
646
649
  * @throws ApiError
647
650
  */
@@ -662,7 +665,8 @@ export class BeanTransactionsService {
662
665
  status: data.status,
663
666
  search: data.search,
664
667
  accountId: data.accountId,
665
- category: data.category
668
+ category: data.category,
669
+ flow: data.flow
666
670
  },
667
671
  errors: {
668
672
  400: 'Validation failed',
@@ -4042,6 +4046,38 @@ export class AuthService {
4042
4046
  }
4043
4047
  }
4044
4048
 
4049
+ export class CommunityService {
4050
+ /**
4051
+ * Relay a sanitized parser-contribution payload
4052
+ * A server-side bot re-sanitizes the payload and opens an issue on the target repository; the issue URL is returned. The payload is never persisted or logged (forward-and-drop).
4053
+ * @param data The data for the request.
4054
+ * @param data.region Region code for tenant context (routing only; the institution region rides in the payload meta)
4055
+ * @param data.requestBody
4056
+ * @returns ParserContributionRelayResponseDto Issue created by the bot
4057
+ * @throws ApiError
4058
+ */
4059
+ public static parserContributionControllerCreate(
4060
+ data: ParserContributionControllerCreateData
4061
+ ): CancelablePromise<ParserContributionControllerCreateResponse> {
4062
+ return __request(OpenAPI, {
4063
+ method: 'POST',
4064
+ url: '/api/v1/{region}/community/parser-contributions',
4065
+ path: {
4066
+ region: data.region
4067
+ },
4068
+ body: data.requestBody,
4069
+ mediaType: 'application/json',
4070
+ errors: {
4071
+ 401: 'Unauthorized',
4072
+ 422: 'Validation failed (institution slug, empty samples, row/cell size limits)',
4073
+ 429: 'Rate limited (5 submissions per user per hour)',
4074
+ 501: 'Relay not configured on this deployment — clients fall back to the clipboard flow',
4075
+ 502: 'GitHub bot failure (upstream), safe to retry'
4076
+ }
4077
+ });
4078
+ }
4079
+ }
4080
+
4045
4081
  export class DefaultService {
4046
4082
  /**
4047
4083
  * @returns unknown