@firela/api-types 0.0.0-canary.feeae929 → 0.0.0-canary.ffdf0021

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
+ 'Per-leg sign-normalized row amount for the category viewpoint (ADR-0126): each posting on the category account set contributes its unitsNumber with Income-root legs negated and Expenses-root legs identity. Positive under normal booking but NOT clamped (explicit negative expense legs and net-flip refund months stay negative). Omitted outside the category viewpoint.',
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). Omitted outside the category viewpoint.',
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']
@@ -4123,6 +4293,50 @@ export const $DeleteOwnUserDto = {
4123
4293
  required: ['accessToken']
4124
4294
  } as const;
4125
4295
 
4296
+ export const $UserSettingsResponseDto = {
4297
+ type: 'object',
4298
+ properties: {
4299
+ baseCurrency: {
4300
+ type: 'string',
4301
+ description:
4302
+ 'Base currency (ISO 4217) for net-worth/report aggregation. Independent of region (ADR-0006).',
4303
+ example: 'USD',
4304
+ nullable: true
4305
+ }
4306
+ },
4307
+ required: ['baseCurrency']
4308
+ } as const;
4309
+
4310
+ export const $UserResponseDto = {
4311
+ type: 'object',
4312
+ properties: {
4313
+ id: {
4314
+ type: 'string',
4315
+ description: 'User ID'
4316
+ },
4317
+ role: {
4318
+ type: 'string',
4319
+ description: 'Assigned user role'
4320
+ },
4321
+ permissions: {
4322
+ description: 'Permission strings',
4323
+ type: 'array',
4324
+ items: {
4325
+ type: 'string'
4326
+ }
4327
+ },
4328
+ settings: {
4329
+ description: 'User settings',
4330
+ allOf: [
4331
+ {
4332
+ $ref: '#/components/schemas/UserSettingsResponseDto'
4333
+ }
4334
+ ]
4335
+ }
4336
+ },
4337
+ required: ['id', 'role', 'permissions', 'settings']
4338
+ } as const;
4339
+
4126
4340
  export const $SignupDto = {
4127
4341
  type: 'object',
4128
4342
  properties: {
@@ -4928,6 +5142,69 @@ export const $TestRuleResponseDto = {
4928
5142
  required: ['ruleId', 'matches', 'confidence', 'matchDetails']
4929
5143
  } as const;
4930
5144
 
5145
+ export const $CategoryCatalogEntryDto = {
5146
+ type: 'object',
5147
+ properties: {
5148
+ slug: {
5149
+ type: 'string',
5150
+ description: 'Category slug (single source-of-truth)',
5151
+ example: 'food'
5152
+ },
5153
+ scenario: {
5154
+ type: 'string',
5155
+ description: 'Display scenario group (maps to frontend picker _scenario)',
5156
+ enum: [
5157
+ 'expense',
5158
+ 'income',
5159
+ 'investment',
5160
+ 'banking',
5161
+ 'transfer',
5162
+ 'payment'
5163
+ ],
5164
+ example: 'expense'
5165
+ },
5166
+ icon: {
5167
+ type: 'string',
5168
+ description: 'Lucide icon name',
5169
+ example: 'utensils'
5170
+ },
5171
+ regions: {
5172
+ description: "Applicable regions ('*' = all, 'cn' = CN-only)",
5173
+ example: ['*'],
5174
+ type: 'array',
5175
+ items: {
5176
+ type: 'string'
5177
+ }
5178
+ }
5179
+ },
5180
+ required: ['slug', 'scenario', 'icon', 'regions']
5181
+ } as const;
5182
+
5183
+ export const $CategoryCatalogListResponseDto = {
5184
+ type: 'object',
5185
+ properties: {
5186
+ items: {
5187
+ description: 'Category entries (region-scoped, query-filtered)',
5188
+ type: 'array',
5189
+ items: {
5190
+ $ref: '#/components/schemas/CategoryCatalogEntryDto'
5191
+ }
5192
+ },
5193
+ total: {
5194
+ type: 'number',
5195
+ description:
5196
+ 'Total category entries for the region (before query filtering)',
5197
+ example: 30
5198
+ },
5199
+ region: {
5200
+ type: 'string',
5201
+ description: 'Region code',
5202
+ example: 'cn'
5203
+ }
5204
+ },
5205
+ required: ['items', 'total', 'region']
5206
+ } as const;
5207
+
4931
5208
  export const $CreateBeanEventDto = {
4932
5209
  type: 'object',
4933
5210
  properties: {
@@ -5670,7 +5947,8 @@ export const $UpdateMapperDefaultsDto = {
5670
5947
  type: 'string',
5671
5948
  description: 'Source account for transactions (Beancount format)',
5672
5949
  example: 'Assets:CN:Alipay:Balance',
5673
- pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
5950
+ pattern:
5951
+ '^(Assets|Liabilities|Income|Expenses|Equity)(:[A-Za-z0-9][A-Za-z0-9-]*)+$'
5674
5952
  },
5675
5953
  currency: {
5676
5954
  type: 'string',
@@ -5684,13 +5962,15 @@ export const $UpdateMapperDefaultsDto = {
5684
5962
  type: 'string',
5685
5963
  description: 'Default expense account (optional)',
5686
5964
  example: 'Expenses:Unknown',
5687
- pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
5965
+ pattern:
5966
+ '^(Assets|Liabilities|Income|Expenses|Equity)(:[A-Za-z0-9][A-Za-z0-9-]*)+$'
5688
5967
  },
5689
5968
  incomeAccount: {
5690
5969
  type: 'string',
5691
5970
  description: 'Default income account (optional)',
5692
5971
  example: 'Income:Unknown',
5693
- pattern: '^[A-Z][a-zA-Z0-9-]*:[a-zA-Z0-9-:]+$'
5972
+ pattern:
5973
+ '^(Assets|Liabilities|Income|Expenses|Equity)(:[A-Za-z0-9][A-Za-z0-9-]*)+$'
5694
5974
  },
5695
5975
  methodAccountMapping: {
5696
5976
  type: 'object',
@@ -5979,15 +6259,105 @@ export const $UncoveredFormatMissDto = {
5979
6259
  properties: {}
5980
6260
  } as const;
5981
6261
 
6262
+ export const $ClientParsedDataDto = {
6263
+ type: 'object',
6264
+ properties: {
6265
+ amount: {
6266
+ type: 'number',
6267
+ description: 'Transaction amount',
6268
+ example: 35
6269
+ },
6270
+ currency: {
6271
+ type: 'string',
6272
+ description: 'Currency code',
6273
+ example: 'CNY'
6274
+ },
6275
+ date: {
6276
+ type: 'string',
6277
+ description: 'Transaction date (ISO 8601)',
6278
+ example: '2026-08-15'
6279
+ },
6280
+ payee: {
6281
+ type: 'string',
6282
+ description: 'Payee/merchant name',
6283
+ example: 'Starbucks'
6284
+ },
6285
+ narration: {
6286
+ type: 'string',
6287
+ description: 'Transaction narration'
6288
+ },
6289
+ category: {
6290
+ type: 'string',
6291
+ description: 'Category slug',
6292
+ example: 'food_restaurant'
6293
+ },
6294
+ incomeType: {
6295
+ type: 'string',
6296
+ description: 'Income type',
6297
+ example: 'Salary'
6298
+ },
6299
+ incomeSource: {
6300
+ type: 'string',
6301
+ description: 'Income source',
6302
+ example: 'Anthropic Inc.'
6303
+ },
6304
+ symbol: {
6305
+ type: 'string',
6306
+ description: 'Security symbol code (e.g., 600519, AAPL)',
6307
+ example: 'AAPL'
6308
+ },
6309
+ quantity: {
6310
+ type: 'number',
6311
+ description: 'Quantity of shares/units',
6312
+ example: 100
6313
+ },
6314
+ price: {
6315
+ type: 'number',
6316
+ description: 'Unit price per share/unit',
6317
+ example: 1900
6318
+ },
6319
+ investmentAction: {
6320
+ type: 'string',
6321
+ description: 'Investment action',
6322
+ enum: ['buy', 'sell'],
6323
+ example: 'buy'
6324
+ },
6325
+ paymentSource: {
6326
+ type: 'string',
6327
+ description: 'Payment source: asset (default) or liability (credit card)',
6328
+ enum: ['asset', 'liability'],
6329
+ example: 'asset'
6330
+ },
6331
+ liabilityHint: {
6332
+ type: 'string',
6333
+ description: 'Liability account hint (CreditCard/Huabei/Baitiao)',
6334
+ example: 'CreditCard'
6335
+ },
6336
+ warning: {
6337
+ type: 'string',
6338
+ description:
6339
+ 'Display-only warning from the prior response; accepted but ignored.',
6340
+ example: 'Cross-currency settlement applies.'
6341
+ }
6342
+ }
6343
+ } as const;
6344
+
5982
6345
  export const $ProcessNlpDto = {
5983
6346
  type: 'object',
5984
6347
  properties: {
5985
6348
  message: {
5986
6349
  type: 'string',
5987
- description: 'Natural language text describing a transaction (Chinese)',
5988
- example: 'yesterday Starbucks spent 35 yuan',
6350
+ description:
6351
+ 'Natural language text describing a transaction. Optional when `confirm` is true (structured confirm); otherwise required.',
6352
+ example: 'Starbucks 35',
5989
6353
  maxLength: 500
5990
6354
  },
6355
+ confirm: {
6356
+ type: 'boolean',
6357
+ description:
6358
+ 'Structured confirm signal — bypasses NL confirm-word matching when true. Send parsedData field edits alongside. The NL word-list path is the fallback.',
6359
+ example: true
6360
+ },
5991
6361
  sessionId: {
5992
6362
  type: 'string',
5993
6363
  description:
@@ -5995,14 +6365,18 @@ export const $ProcessNlpDto = {
5995
6365
  example: 'session_abc123'
5996
6366
  },
5997
6367
  parsedData: {
5998
- type: 'object',
5999
6368
  description:
6000
6369
  'Parsed data from previous NLP response for session recovery. Send back the parsedData received in confirm_payee/confirm responses.',
6001
6370
  example: {
6002
6371
  amount: 35,
6003
6372
  currency: 'CNY',
6004
6373
  payee: 'Starbucks'
6005
- }
6374
+ },
6375
+ allOf: [
6376
+ {
6377
+ $ref: '#/components/schemas/ClientParsedDataDto'
6378
+ }
6379
+ ]
6006
6380
  },
6007
6381
  selectedRuleId: {
6008
6382
  type: 'string',
@@ -6016,8 +6390,7 @@ export const $ProcessNlpDto = {
6016
6390
  '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.',
6017
6391
  example: 'Expenses:Food:Coffee'
6018
6392
  }
6019
- },
6020
- required: ['message']
6393
+ }
6021
6394
  } as const;
6022
6395
 
6023
6396
  export const $NlpTransactionInfoDto = {
@@ -6635,7 +7008,7 @@ export const $NlpResponseDto = {
6635
7008
  type: 'string',
6636
7009
  description:
6637
7010
  'Asset sub-type (only present when intent is "asset"). Determines which asset-related form to render.',
6638
- enum: ['transfer', 'banking', 'investment'],
7011
+ enum: ['transfer', 'banking', 'investment', 'lend', 'lend_collect'],
6639
7012
  example: 'investment'
6640
7013
  },
6641
7014
  liabilitySubType: {
@@ -6838,13 +7211,26 @@ export const $PlatformListItemDto = {
6838
7211
  suggestedSegment: {
6839
7212
  type: 'string',
6840
7213
  description:
6841
- 'Suggested path segment — canonical with first char uppercased (ACC_COMP_NAME_RE)'
7214
+ 'Suggested path segment — canonical PascalCased per hyphen-part, hyphens preserved (e.g. "Apple-Pay")'
6842
7215
  },
6843
7216
  logoUrl: {
6844
7217
  type: 'string',
6845
7218
  description: 'Logo URL',
6846
7219
  nullable: true
6847
7220
  },
7221
+ countryCode: {
7222
+ type: 'string',
7223
+ description: 'ISO 3166-1 alpha-2 (UPPERCASE); null = global platform',
7224
+ example: 'CN',
7225
+ nullable: true
7226
+ },
7227
+ category: {
7228
+ type: 'string',
7229
+ description:
7230
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank). null = no region-aware suggestion; fall back to type.',
7231
+ nullable: true,
7232
+ example: 'DigitalWallet'
7233
+ },
6848
7234
  isBound: {
6849
7235
  type: 'boolean',
6850
7236
  description: 'Whether user has accounts using this platform'
@@ -6858,6 +7244,8 @@ export const $PlatformListItemDto = {
6858
7244
  'canonical',
6859
7245
  'suggestedSegment',
6860
7246
  'logoUrl',
7247
+ 'countryCode',
7248
+ 'category',
6861
7249
  'isBound'
6862
7250
  ]
6863
7251
  } as const;
@@ -6893,13 +7281,26 @@ export const $PlatformMatchResultDto = {
6893
7281
  suggestedSegment: {
6894
7282
  type: 'string',
6895
7283
  description:
6896
- 'Suggested path segment — canonical, already in ACCOUNT_RE format'
7284
+ 'Suggested path segment — canonical PascalCased per hyphen-part, hyphens preserved (e.g. "Apple-Pay")'
6897
7285
  },
6898
7286
  logoUrl: {
6899
7287
  type: 'string',
6900
7288
  description: 'Logo URL',
6901
7289
  nullable: true
6902
7290
  },
7291
+ countryCode: {
7292
+ type: 'string',
7293
+ description: 'ISO 3166-1 alpha-2 (UPPERCASE); null = global platform',
7294
+ example: 'CN',
7295
+ nullable: true
7296
+ },
7297
+ category: {
7298
+ type: 'string',
7299
+ description:
7300
+ 'Region-aware category (institution vocab, e.g. DigitalWallet/Bank). null = no region-aware suggestion; fall back to type.',
7301
+ nullable: true,
7302
+ example: 'DigitalWallet'
7303
+ },
6903
7304
  matchType: {
6904
7305
  type: 'string',
6905
7306
  description: "How this row matched: 'exact' > 'prefix' > 'substring'",
@@ -6913,6 +7314,8 @@ export const $PlatformMatchResultDto = {
6913
7314
  'type',
6914
7315
  'suggestedSegment',
6915
7316
  'logoUrl',
7317
+ 'countryCode',
7318
+ 'category',
6916
7319
  'matchType'
6917
7320
  ]
6918
7321
  } as const;
@@ -8162,6 +8565,216 @@ export const $AnonymousLoginResponseDto = {
8162
8565
  required: ['authToken']
8163
8566
  } as const;
8164
8567
 
8568
+ export const $ParserContributionMetaDto = {
8569
+ type: 'object',
8570
+ properties: {
8571
+ institution: {
8572
+ type: 'string',
8573
+ description: 'Institution slug (lowercase kebab-case)',
8574
+ pattern: '^[a-z0-9]+(-[a-z0-9]+)*$',
8575
+ example: 'icbc'
8576
+ },
8577
+ region: {
8578
+ type: 'string',
8579
+ enum: [
8580
+ 'cn',
8581
+ 'us',
8582
+ 'de',
8583
+ 'fr',
8584
+ 'gb',
8585
+ 'hk',
8586
+ 'jp',
8587
+ 'sg',
8588
+ 'au',
8589
+ 'ca',
8590
+ 'other'
8591
+ ]
8592
+ },
8593
+ accountType: {
8594
+ type: 'string',
8595
+ enum: ['checking', 'savings', 'credit', 'debit', 'investment']
8596
+ },
8597
+ format: {
8598
+ type: 'string',
8599
+ enum: ['csv', 'xlsx', 'pdf', 'ofx', 'qif']
8600
+ },
8601
+ institutionDisplayName: {
8602
+ type: 'string',
8603
+ example: '中国工商银行'
8604
+ },
8605
+ encoding: {
8606
+ type: 'string',
8607
+ example: 'utf-8'
8608
+ },
8609
+ delimiter: {
8610
+ type: 'string',
8611
+ description: 'CSV delimiter character: ",", ";", "\\t" or "|"'
8612
+ },
8613
+ headerRows: {
8614
+ type: 'number',
8615
+ default: 1,
8616
+ description: 'Header row count; the client omits the field when it is 1'
8617
+ },
8618
+ notes: {
8619
+ type: 'string',
8620
+ maxLength: 2000
8621
+ }
8622
+ },
8623
+ required: ['institution', 'region', 'accountType', 'format']
8624
+ } as const;
8625
+
8626
+ export const $ParserContributionSamplesDto = {
8627
+ type: 'object',
8628
+ properties: {
8629
+ rows: {
8630
+ description:
8631
+ 'Client-sanitized sample rows (key = column name, value = cell)',
8632
+ type: 'array',
8633
+ items: {
8634
+ type: 'object'
8635
+ }
8636
+ },
8637
+ rawHeaders: {
8638
+ type: 'array',
8639
+ items: {
8640
+ type: 'string'
8641
+ }
8642
+ }
8643
+ },
8644
+ required: ['rows']
8645
+ } as const;
8646
+
8647
+ export const $FieldHintDto = {
8648
+ type: 'object',
8649
+ properties: {
8650
+ columnName: {
8651
+ type: 'string',
8652
+ example: '交易日期'
8653
+ },
8654
+ format: {
8655
+ type: 'string',
8656
+ description: 'Date format, e.g. yyyy-MM-dd HH:mm',
8657
+ example: 'yyyy-MM-dd'
8658
+ },
8659
+ signConvention: {
8660
+ type: 'string',
8661
+ enum: ['negative-expense', 'positive-expense', 'separate-columns']
8662
+ },
8663
+ creditColumn: {
8664
+ type: 'string'
8665
+ },
8666
+ debitColumn: {
8667
+ type: 'string'
8668
+ }
8669
+ },
8670
+ required: ['columnName']
8671
+ } as const;
8672
+
8673
+ export const $ParserContributionFieldHintsDto = {
8674
+ type: 'object',
8675
+ properties: {
8676
+ date: {
8677
+ $ref: '#/components/schemas/FieldHintDto'
8678
+ },
8679
+ amount: {
8680
+ $ref: '#/components/schemas/FieldHintDto'
8681
+ },
8682
+ description: {
8683
+ $ref: '#/components/schemas/FieldHintDto'
8684
+ },
8685
+ balance: {
8686
+ $ref: '#/components/schemas/FieldHintDto'
8687
+ },
8688
+ payee: {
8689
+ $ref: '#/components/schemas/FieldHintDto'
8690
+ },
8691
+ reference: {
8692
+ $ref: '#/components/schemas/FieldHintDto'
8693
+ },
8694
+ category: {
8695
+ $ref: '#/components/schemas/FieldHintDto'
8696
+ }
8697
+ },
8698
+ required: ['date', 'amount']
8699
+ } as const;
8700
+
8701
+ export const $ExpectedTransactionDto = {
8702
+ type: 'object',
8703
+ properties: {
8704
+ date: {
8705
+ type: 'string',
8706
+ example: '2026-08-01'
8707
+ },
8708
+ amount: {
8709
+ type: 'number',
8710
+ example: -45.5
8711
+ },
8712
+ description: {
8713
+ type: 'string',
8714
+ example: '星巴克-***店'
8715
+ },
8716
+ payee: {
8717
+ type: 'string'
8718
+ },
8719
+ category: {
8720
+ type: 'string'
8721
+ }
8722
+ },
8723
+ required: ['date', 'amount', 'description']
8724
+ } as const;
8725
+
8726
+ export const $ParserContributionExamplesDto = {
8727
+ type: 'object',
8728
+ properties: {
8729
+ expectedTransactions: {
8730
+ type: 'array',
8731
+ items: {
8732
+ $ref: '#/components/schemas/ExpectedTransactionDto'
8733
+ }
8734
+ }
8735
+ },
8736
+ required: ['expectedTransactions']
8737
+ } as const;
8738
+
8739
+ export const $ParserContributionRequestDto = {
8740
+ type: 'object',
8741
+ properties: {
8742
+ meta: {
8743
+ $ref: '#/components/schemas/ParserContributionMetaDto'
8744
+ },
8745
+ samples: {
8746
+ $ref: '#/components/schemas/ParserContributionSamplesDto'
8747
+ },
8748
+ fieldHints: {
8749
+ $ref: '#/components/schemas/ParserContributionFieldHintsDto'
8750
+ },
8751
+ examples: {
8752
+ description: 'Omitted entirely by the client when empty',
8753
+ allOf: [
8754
+ {
8755
+ $ref: '#/components/schemas/ParserContributionExamplesDto'
8756
+ }
8757
+ ]
8758
+ }
8759
+ },
8760
+ required: ['meta', 'samples', 'fieldHints']
8761
+ } as const;
8762
+
8763
+ export const $ParserContributionRelayResponseDto = {
8764
+ type: 'object',
8765
+ properties: {
8766
+ issueUrl: {
8767
+ type: 'string',
8768
+ example: 'https://github.com/fire-la/parsers/issues/42'
8769
+ },
8770
+ issueNumber: {
8771
+ type: 'number',
8772
+ example: 42
8773
+ }
8774
+ },
8775
+ required: ['issueUrl', 'issueNumber']
8776
+ } as const;
8777
+
8165
8778
  export const $SymbolSearchResultDto = {
8166
8779
  type: 'object',
8167
8780
  properties: {